Skip to content

feat: store eqn-affecting options at definition time instead of eager generation - #13394

Merged
nomeata merged 3 commits into
nightly-with-mathlibfrom
joachim/eqn-options
Apr 13, 2026
Merged

nomeata merged 3 commits into
nightly-with-mathlibfrom
joachim/eqn-options

Conversation

@nomeata

@nomeata nomeata commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

This PR replaces eager equation generation with a MapDeclarationExtension
that stores non-default option values at definition time. Previously,
non-default values of equation-affecting options (like
backward.eqns.nonrecursive) triggered eager equation generation.
This caused problems when setting options globally, as it changed
the timing of equation generation and could break definitions with
complex auto-params.

The stored values are restored when equations are lazily realized, ensuring
the same equations are produced regardless of when generation occurs.

… generation

Previously, non-default values of equation-affecting options (like
`backward.eqns.nonrecursive`) triggered eager equation generation.
This caused problems when setting options globally, as it changed
the timing of equation generation and could break definitions with
complex auto-params.

This PR replaces eager generation with a `MapDeclarationExtension`
that stores non-default option values at definition time. These
values are restored when equations are lazily realized, ensuring
the same equations are produced regardless of when generation occurs.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@nomeata nomeata added the changelog-language Language features and metaprograms label Apr 13, 2026
@nomeata

nomeata commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator Author

!radar

@leanprover-radar

leanprover-radar commented Apr 13, 2026 •

Copy link
Copy Markdown

Benchmark results for 0555a3c against d76e5a1 are in. There are significant results. @nomeata

  • 🟥 build//instructions: +3.4G (+0.03%)

Large changes (1🟥)

  • 🟥 build/profile/blocked (unaccounted)//wall-clock: +46s (+37.61%)

Small changes (4🟥)

  • 🟥 build/module/Init.Data.Int.Lemmas//instructions: +46.7M (+0.95%)
  • 🟥 build/module/Init.Data.List.ToArray//instructions: +85.2M (+0.39%)
  • 🟥 build/module/Lean.Elab.PreDefinition.Structural.Main//instructions: +26.7M (+0.58%)
  • 🟥 build/module/Lean.Meta.Eqns//instructions: +243.9M (+6.06%) (reduced significance based on *//lines)

@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 Apr 13, 2026
@leanprover-bot

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-04-13 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2026-04-13 16:15:04)

mathlib-nightly-testing Bot pushed a commit to leanprover-community/batteries that referenced this pull request Apr 13, 2026
@github-actions github-actions Bot added the mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN label Apr 13, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Apr 13, 2026
Comment thread src/Lean/Meta/Eqns.lean Resolved
@nomeata

nomeata commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator Author

!radar

@leanprover-radar

leanprover-radar commented Apr 13, 2026 •

Copy link
Copy Markdown

Benchmark results for 94bfebe against d76e5a1 are in. There are significant results. @nomeata

  • 🟥 build exited with code -1
  • 🟥 other exited with code -1

No significant changes detected.

@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Apr 13, 2026
@mathlib-lean-pr-testing

Copy link
Copy Markdown

Mathlib CI status (docs):

@nomeata

nomeata commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot can you fix my fix from the last commit

Copilot AI commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

@copilot can you fix my fix from the last commit

Fixed in d5bac4b. The suggestion used asyncMode := .async .local, but .local is an AsyncMode constructor, not an AsyncBranch (which only has mainEnv and asyncEnv). Changed it to asyncMode := .local directly.

@nomeata

nomeata commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator Author

!radar

@leanprover-radar

leanprover-radar commented Apr 13, 2026 •

Copy link
Copy Markdown

Benchmark results for d5bac4b against d76e5a1 are in. No significant results found. @nomeata

  • 🟥 build//instructions: +641.7M (+0.01%)

Small changes (3🟥)

  • 🟥 build/module/Lean.Elab.PreDefinition.Structural.Main//instructions: +28.5M (+0.61%)
  • 🟥 build/module/Lean.Meta.Eqns//instructions: +242.1M (+6.02%) (reduced significance based on *//lines)
  • 🟥 mvcgen/sym/ReaderState/100/vcgen//wall-clock: +3ms (+2.17%)

@nomeata
nomeata merged commit f78cd68 into nightly-with-mathlib Apr 13, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds-mathlib CI has verified that Mathlib builds against this PR changelog-language Language features and metaprograms mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN 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.

4 participants