Skip to content

[Merged by Bors] - chore: remove some redundant classical#41497

Closed
felixpernegger wants to merge 3 commits into
leanprover-community:masterfrom
felixpernegger:classicalcleaup
Closed

[Merged by Bors] - chore: remove some redundant classical#41497
felixpernegger wants to merge 3 commits into
leanprover-community:masterfrom
felixpernegger:classicalcleaup

Conversation

@felixpernegger

Copy link
Copy Markdown
Contributor

Remove classical (in two cases open scoped Classical in) when we already did open (scoped) Classical in

Found by @vlad902 here


Open in Gitpod

@felixpernegger

Copy link
Copy Markdown
Contributor Author

easy

@github-actions github-actions Bot added the easy < 20s of review time. See the lifecycle page for guidelines. label Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

PR summary e3867a6efe

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

No declarations were harmed in the making of this PR! 🐙

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit e3867a6).

  • +0 new declarations
  • −0 removed declarations

No declaration differences.


No changes to strong technical debt.

No changes to weak technical debt.

Current commit e3867a6efe
Reference commit 1c3e8f34a8

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@grunweg grunweg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there!

lemma traceDual_top' :
(⊤ : Submodule B L)ᵛ =
if ((LinearMap.range (Algebra.trace K L)).restrictScalars A ≤ 1) then ⊤ else ⊥ := by
classical

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, please remove the open scoped Classical in instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I check each of them before the PR

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do this instead?

/-- The dual of a non-zero fractional ideal is the dual of the submodule under the trace form. -/
noncomputable
def dual (I : FractionalIdeal B⁰ L) : FractionalIdeal B⁰ L :=
  open scoped Classical in

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(The point is that the statement then does not rely on any classical decidability instances, although this might be quite minor here.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats another line. I think the script missed something (or I when i went over it), but whatever

Comment thread Mathlib/NumberTheory/NumberField/CanonicalEmbedding/NormLeOne.lean
Comment thread Mathlib/RingTheory/Extension/Presentation/Submersive.lean
@grunweg grunweg added the awaiting-author A reviewer has asked the author a question or requested changes. label Jul 8, 2026
@felixpernegger

Copy link
Copy Markdown
Contributor Author

-awaiting-author

@github-actions github-actions Bot removed the awaiting-author A reviewer has asked the author a question or requested changes. label Jul 8, 2026
Comment on lines +230 to 233
open scoped Classical in
if hI : I = 0 then 0 else
⟨Iᵛ, by
classical

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI here we really need both

@felixpernegger

Copy link
Copy Markdown
Contributor Author

Continuation in #41532

@grunweg grunweg removed the easy < 20s of review time. See the lifecycle page for guidelines. label Jul 9, 2026
@grunweg

grunweg commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

I definitely put more than 20 seconds into reviewing this, so unlabelling as easy.

@grunweg

grunweg commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Thanks!
bors merge

@mathlib-bors mathlib-bors Bot added the ready-to-merge This PR has been sent to bors. label Jul 9, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Jul 9, 2026
Remove `classical` (in two cases `open scoped Classical in`) when we already did `open (scoped) Classical in`

Found by @vlad902 [here](#41423 (comment))

Co-authored-by: Batixx <s59fpern@uni-bonn.de>
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Jul 9, 2026
@mathlib-bors

mathlib-bors Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@mathlib-bors mathlib-bors Bot changed the title chore: remove some redundant classical [Merged by Bors] - chore: remove some redundant classical Jul 9, 2026
@mathlib-bors mathlib-bors Bot closed this Jul 9, 2026
michaellee94 pushed a commit to michaellee94/mathlib4 that referenced this pull request Jul 11, 2026
Remove `classical` (in two cases `open scoped Classical in`) when we already did `open (scoped) Classical in`

Found by @vlad902 [here](leanprover-community#41423 (comment))

Co-authored-by: Batixx <s59fpern@uni-bonn.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bors-staging This PR is currently being built by bors on the staging branch. ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants