refactor: make exportEntriesFnEx return all olean levels at once#13142
Merged
refactor: make exportEntriesFnEx return all olean levels at once#13142
Conversation
Replace the per-level `OLeanLevel → Array α` return type of `exportEntriesFnEx` with a new `OLeanEntries (Array α)` structure that bundles exported, server, and private entries together. This allows extensions to share expensive computation across all three olean levels instead of being called three separate times. A new `computeExtEntries` function calls each extension's export function once and distributes results across levels. Extensions that previously relied on `env.setExporting` being pre-applied by `mkModuleData` now call `env.setExporting true` internally for their exported/server-level filtering. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
|
!radar |
|
Benchmark results for 4f9f135 against 4786e08 are in. Significant changes detected! @nomeata
Large changes (1✅)
Medium changes (23✅) Too many entries to display here. View the full report on radar instead. Small changes (365✅, 3🟥) Too many entries to display here. View the full report on radar instead. |
Collaborator
|
Reference manual CI status:
|
mathlib-nightly-testing bot
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Mar 26, 2026
mathlib-nightly-testing bot
pushed a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Mar 26, 2026
|
Mathlib CI status (docs):
|
|
Mathlib CI status (docs):
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 27, 2026
This PR re-enables `#print axioms` under the module system by computing axiom dependencies at olean serialization time. It reverts #8174 and replaces it with a proper fix. Depends on #13142, which refactors `exportEntriesFnEx` to return all three olean levels at once via a new `OLeanEntries` structure, allowing extensions to share expensive computation. The axiom extension uses `exportEntriesFnEx` to walk bodies of all public declarations in the current module, collecting axiom dependencies in a single batch with a shared cache across declarations. The results are stored sorted for binary search and exported uniformly to all olean levels. Downstream modules look up pre-computed axiom data from imported oleans, so axiom collection never crosses module boundaries. During elaboration of the current module, `collectAxioms` walks bodies directly since they are always available locally. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Ari4ka
approved these changes
Mar 30, 2026
volodeyka
pushed a commit
that referenced
this pull request
Apr 16, 2026
This PR re-enables `#print axioms` under the module system by computing axiom dependencies at olean serialization time. It reverts #8174 and replaces it with a proper fix. Depends on #13142, which refactors `exportEntriesFnEx` to return all three olean levels at once via a new `OLeanEntries` structure, allowing extensions to share expensive computation. The axiom extension uses `exportEntriesFnEx` to walk bodies of all public declarations in the current module, collecting axiom dependencies in a single batch with a shared cache across declarations. The results are stored sorted for binary search and exported uniformly to all olean levels. Downstream modules look up pre-computed axiom data from imported oleans, so axiom collection never crosses module boundaries. During elaboration of the current module, `collectAxioms` walks bodies directly since they are always available locally. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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 replaces the per-level
OLeanLevel → Array αreturn type ofexportEntriesFnExwith a newOLeanEntries (Array α)structure that bundles exported, server, and private entries together. This allows extensions to share expensive computation across all three olean levels instead of being called three separate times.A new
computeExtEntriesfunction inEnvironment.leancalls each extension's export function once and distributes results across levels.mkModuleDataaccepts optional pre-computed entries, andwriteModuleusescomputeExtEntriesto compute once for all three olean parts.Extensions that previously relied on
env.setExportingbeing pre-applied bymkModuleDatanow callenv.setExporting trueinternally for their exported/server-level filtering, since the export function is called once rather than per-level.Extracted from #13117 to be reviewed independently.