Skip to content

fix: do not export realizations triggered only from proofs - #16623

Merged
Kha merged 1 commit into
unfold-nonrec-eq-deffrom
reapply-no-export-proof-realizations
Nov 20, 2026
Merged

Kha merged 1 commit into
unfold-nonrec-eq-deffrom
reapply-no-export-proof-realizations

Conversation

@Kha

@Kha Kha commented Nov 20, 2026

Copy link
Copy Markdown
Member

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, MapDeclarationExtensions, and the axiom extension now consider only constants known on the main environment branch.

This re-applies #15559, which was reverted in #15655 because unfold on non-recursive definitions depended on the visibility of eq_def.

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 Kha added changelog-other downstream Request a downstream-lean4 adaptation PR. labels Nov 20, 2026
@Kha
Kha added this pull request to stack #16625 November 20, 2026 09:08
@Kha
Kha marked this pull request as ready for review November 20, 2026 09:15
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Nov 20, 2026
@downstream-lean4

Copy link
Copy Markdown

The adaptation PR for this PR is leanprover/downstream-lean4#266.

@Kha
Kha added this pull request to the merge queue Nov 20, 2026
Merged via the queue into master with commit 1649eb5 Nov 20, 2026
50 of 56 checks passed
Kha added a commit that referenced this pull request Nov 21, 2026
This reverts "fix: export theorems realized inside proofs as axioms" and its test. Since #16623, a constant realized only inside a proof is not exported at all, which covers the same case.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-other downstream Request a downstream-lean4 adaptation PR. toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant