Repository navigation
fix: do not export realizations triggered only from proofs - #15559
Merged
Merged
Conversation
This PR stops a `module` from exporting constants such as `foo.eq_1` when they were realized only inside a proof, so that such proofs no longer trigger downstream rebuilds. Importing modules realize these constants again on demand. Previously, such a constant reached the exported `.olean` through the `allRealizations` fallback of `Environment.find?`, which returns the private constant info, so the theorem was exported together with its proof. `mkModuleData` and the exported-level filters of attributes, instances, matcher info, `MapDeclarationExtension`s, and the axiom extension now consider only constants known on the main environment branch. As a consequence, such a constant is part of the private scope of its module only. A module that accesses it through `import all` cannot use it in a public scope, which is now reported as an unknown identifier with a corresponding note. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Kha
force-pushed
the
no-export-proof-realizations
branch
from
October 8, 2026 15:33
9a0b3bb to
a0138cd
Compare
|
The adaptation PR for this PR is leanprover/downstream-lean4#147. |
This PR makes the generation of equation theorems such as `f.eq_1` use the values that `backward.isDefEq.respectTransparency`, `backward.isDefEq.respectTransparency.types`, `backward.whnf.reducibleClassField`, and `smartUnfolding` had where `f` was defined. Previously, a definition whose equation theorems can only be generated under a local `set_option` failed with "failed to generate equational theorem" when the theorems were first requested from an importing module. The options are added to `eqnAffectingOptions`, whose non-default values are stored with the definition and restored when its equation theorems are realized. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 13, 2026
Kha
added a commit
that referenced
this pull request
Oct 13, 2026
…oofs (#15559)" This PR reverts #15559, which stopped a `module` from exporting constants such as `foo.eq_1` when they were realized only inside a proof. Tactics whose behavior depends on whether such a constant already exists changed behavior in importing modules as a result: `unfold f` on a non-recursive `f` rewrites with `f.eq_def` and reduces the resulting matcher application only if that theorem is visible, so proofs relying on an upstream `fun_cases f` having realized it broke, such as `Batteries.Data.Float.Lemmas.pack_unpack`. The change can be reapplied once `unfold` no longer depends on the visibility of `eq_def`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
yermakoffivan
pushed a commit
to yermakoffivan/lean4
that referenced
this pull request
Oct 13, 2026
…oofs" (leanprover#15655) Reverts leanprover#15559 until leanprover/downstream-lean4#161 is addressed Co-authored-by: Claude Opus 5.5 <[email protected]>
3 tasks done
3 of 4 tasks
Kha
added a commit
that referenced
this pull request
Nov 19, 2026
This PR stops a `module` from exporting constants such as `foo.eq_1` when they were realized only inside a proof, so that such proofs no longer trigger downstream rebuilds. Importing modules realize these constants again on demand. Previously, such a constant reached the exported `.olean` through the `allRealizations` fallback of `Environment.find?`, which returns the private constant info, so the theorem was exported together with its proof. `mkModuleData` and the exported-level filters of attributes, instances, matcher info, `MapDeclarationExtension`s, and the axiom extension now consider only constants known on the main environment branch. --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Kha
added a commit
that referenced
this pull request
Nov 19, 2026
This PR stops a `module` from exporting constants such as `foo.eq_1` when they were realized only inside a proof, so that such proofs no longer trigger downstream rebuilds. Importing modules realize these constants again on demand. Previously, such a constant reached the exported `.olean` through the `allRealizations` fallback of `Environment.find?`, which returns the private constant info, so the theorem was exported together with its proof. `mkModuleData` and the exported-level filters of attributes, instances, matcher info, `MapDeclarationExtension`s, and the axiom extension now consider only constants known on the main environment branch. --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Rob23oba
pushed a commit
to Rob23oba/lean4
that referenced
this pull request
Nov 20, 2026
…r#16623) This PR stops a `module` from exporting constants such as `foo.eq_1` when they were realized only inside a proof, so that such proofs no longer trigger downstream rebuilds. Importing modules realize these constants again on demand. Previously, such a constant reached the exported `.olean` through the `allRealizations` fallback of `Environment.find?`, which returns the private constant info, so the theorem was exported together with its proof. `mkModuleData` and the exported-level filters of attributes, instances, matcher info, `MapDeclarationExtension`s, and the axiom extension now consider only constants known on the main environment branch. This re-applies leanprover#15559, which was reverted in leanprover#15655 because `unfold` on non-recursive definitions depended on the visibility of `eq_def`. Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR stops a
modulefrom exporting constants such asfoo.eq_1when they were realized only inside a proof, so that such proofs no longer trigger downstream rebuilds. Importing modules realize these constants again on demand.Previously, such a constant reached the exported
.oleanthrough theallRealizationsfallback ofEnvironment.find?, which returns the private constant info, so the theorem was exported together with its proof.mkModuleDataand the exported-level filters of attributes, instances, matcher info,MapDeclarationExtensions, and the axiom extension now consider only constants known on the main environment branch.