Skip to content

feat: bound kernel recursion by maxRecDepth - #13956

Merged
Kha merged 3 commits into
leanprover:masterfrom
Kha:push-suozorvvkkpz
Jul 7, 2026
Merged

Kha merged 3 commits into
leanprover:masterfrom
Kha:push-suozorvvkkpz

Conversation

@Kha

@Kha Kha commented Jun 4, 2026 •

Copy link
Copy Markdown
Member

This PR makes the kernel's (kernel) deep recursion detected error deterministic by bounding kernel type checking with the existing maxRecDepth option instead of the physical stack size. The limit previously depended on the native stack, so it varied across platforms, builds, and optimization levels and could not be reproduced reliably; it is now a function of maxRecDepth alone and is raised the usual way with set_option maxRecDepth <num>.

To avoid rejecting existing code that already fits within maxRecDepth during elaboration, the kernel is allowed to recurse up to a fixed multiple (currently 16×) of the configured value before reporting deep recursion; this is sufficient for lean4/Mathlib to build. Since the absolute value of maxRecDepth has no inherent meaning, this multiplier should not lead to surprising behavior.

The value is threaded to the kernel entry points (lean_add_decl, lean_elab_add_decl) alongside maxHeartbeats and tracked with a thread-local recursion-depth counter checked at the type checker's recursive entry points (infer, whnf, isDefEq). The former physical-stack-based budget in the structural Expr comparison is removed. The standalone debugging entry points Kernel.check / Kernel.whnf / Kernel.isDefEq remain unbounded.

This PR also improves the decide +kernel failure report: when the kernel rejects the proof and the tactic's lazy diagnostic itself exceeds maxRecDepth while re-reducing the instance, the tactic now surfaces the kernel's actual error (using tryCatchRuntimeEx, since maxRecDepth is a runtime exception that ordinary try/catch re-raises) instead of an opaque [Error pretty printing: …].

Breaking change: some existing code depending on deep kernel recursion may need explicit maxRecDepth bumps after this change.

@Kha
Kha requested review from kim-em and leodemoura as code owners June 4, 2026 11:39
@Kha

Kha commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

!bench

@leanprover-radar

leanprover-radar commented Jun 4, 2026 •

Copy link
Copy Markdown

Benchmark results for 183982a against c47a0c7 are in. There are significant results. @Kha

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

No significant changes detected.

@Kha Kha added the changelog-language Language features and metaprograms label Jun 4, 2026
@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 Jun 4, 2026
@leanprover-bot

leanprover-bot commented Jun 4, 2026 •

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-05-28 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-06-04 12:23:02)
  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-07-03 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-07-06 14:40:57)

@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 Jun 4, 2026
@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Jun 4, 2026
@mathlib-lean-pr-testing

mathlib-lean-pr-testing Bot commented Jun 4, 2026 •

Copy link
Copy Markdown

Mathlib CI status (docs):

@Kha

Kha commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

!bench

@leanprover-radar

leanprover-radar commented Jun 5, 2026 •

Copy link
Copy Markdown

Benchmark results for 62082bb against c47a0c7 are in. There are significant results. @Kha

  • ✅ build//instructions: -8.9G (-0.08%)

Large changes (2✅)

  • ✅ elab/big_omega//instructions: -507.3M (-2.35%)
  • ✅ elab/big_omega_MT//instructions: -510.4M (-2.35%)

Small changes (20✅, 1🟥)

Too many entries to display here. View the full report on radar instead.

mathlib-nightly-testing Bot pushed a commit to leanprover-community/batteries that referenced this pull request Jun 5, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Jun 5, 2026
@leanprover-radar

Copy link
Copy Markdown

Benchmark results for 62082bb against c47a0c7 are in. (These commits have already been benchmarked in a previous command.) There are significant results. @Kha

  • ✅ build//instructions: -8.9G (-0.08%)

Large changes (2✅)

  • ✅ elab/big_omega//instructions: -507.3M (-2.35%)
  • ✅ elab/big_omega_MT//instructions: -510.4M (-2.35%)

Small changes (20✅, 1🟥)

Too many entries to display here. View the full report on radar instead.

@Kha

Kha commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

!bench mathlib

@leanprover-radar

leanprover-radar commented Jun 5, 2026 •

Copy link
Copy Markdown

Benchmark results for leanprover-community/mathlib4-nightly-testing@49f5b1e against leanprover-community/mathlib4-nightly-testing@8a9ccb2 are in. No significant results found. @Kha

  • 🟥 build//instructions: +121.0G (+0.07%)

Small changes (2🟥)

  • 🟥 build/module/Mathlib.Lean.Environment//instructions: +89.4M (+5.37%)
  • 🟥 build/profile/initialization//wall-clock: +10s (+4.04%)

@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added builds-mathlib CI has verified that Mathlib builds against this PR and removed breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan labels Jun 5, 2026
@Kha Kha added the downstream Request a downstream-lean4 adaptation PR. label Jul 6, 2026
@downstream-lean4

downstream-lean4 Bot commented Jul 6, 2026 •

Copy link
Copy Markdown

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

Kha and others added 3 commits July 6, 2026 13:58
This PR makes the kernel type checker bound its recursion depth using the existing `maxRecDepth` option instead of measuring physical stack space. Previously the kernel relied on a non-deterministic stack-space check that varied by platform, build, and optimization, making `(kernel) deep recursion detected` errors irreproducible. The limit is now deterministic and adjustable with `set_option maxRecDepth`.

The `maxRecDepth` value is threaded to the kernel entry points (`lean_add_decl`, `lean_elab_add_decl`) alongside `maxHeartbeats` and tracked via a thread-local recursion-depth counter (`scope_max_rec_depth` / `scope_rec_depth`) checked at the type checker's recursive entry points. The stack-based limit in `expr_eq_fn` is removed, and the `.deepRecursion` message now points at `maxRecDepth`.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This PR lets the kernel recurse up to 16 times the configured `maxRecDepth` before reporting deep recursion. The kernel re-checks a fully elaborated term from scratch, without the caching, metavariable assignments, and reducibility shortcuts the elaborator relies on while building it, so it bottoms out substantially deeper than elaboration did for the same term; without this headroom, code that fits within `maxRecDepth` during elaboration -- including stdlib `grind`/`simp` proofs -- could be rejected by the kernel.

Adjust the kernel-heavy benchmarks accordingly: `string_simp_ne` needs a higher `maxRecDepth` for its O(n) `String.ofList` verification, while `bv_decide_rewriter` no longer needs its earlier bump. Also fix a stray trailing CRLF in the `identifier_completion` LSP fixture that desynced the message stream.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@Kha
Kha force-pushed the push-suozorvvkkpz branch from 62082bb to 6baff05 Compare July 6, 2026 13:58
mathlib-nightly-testing Bot pushed a commit to leanprover-community/batteries that referenced this pull request Jul 6, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Jul 6, 2026
@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan and removed builds-mathlib CI has verified that Mathlib builds against this PR labels Jul 6, 2026
@Kha
Kha added this pull request to the merge queue Jul 7, 2026
Merged via the queue into leanprover:master with commit 85e209a Jul 7, 2026
26 checks passed
AndPuQing added a commit to LeanOxide/leo3 that referenced this pull request Aug 1, 2026
- lean_mk_empty_environment export was removed in Lean 4.33 (leanprover/lean4#14306);
  bind the Lean-compiled l_Lean_mkEmptyEnvironment symbol with identical ABI
- lean_add_decl/lean_elab_add_decl gained a maxRecDepth argument in Lean 4.33
  (leanprover/lean4#13956); pass 0 (unlimited) to preserve prior behavior
- dispatch both on the existing lean_4_33 version cfg; no regressions for
  stable/nightly/v4.20.0
samuelburnham added a commit to argumentcomputer/ix that referenced this pull request Aug 12, 2026
Fallout of the v4.29 -> v4.33 bump that the skipped updater validation
never surfaced:

- batteries retired the `Batteries.Data.RBMap` umbrella module and moved
  the type to `RBTree.RBMap` in `Batteries.Recycling.RBTree`; ix keeps
  the recycled structure (the Verify layer proves theorems about it)
  rather than migrating `NormLevel`/`CNorm` to `Std.TreeMap`.
- Two `groups`/`atoms` lookups in IxonUniv were RBMap sites caught in the
  earlier `Std.HashMap` `find?` -> `get?` rename; RBMap kept `find?`.
- `do match` arms are non-dependent since v4.32 (leanprover/lean4#13305);
  the ShardMap size-invariant proofs need `match (dependent := true)`.
- `Environment.addDeclCore` gained a `maxRecDepth` parameter
  (leanprover/lean4#13956); pass Lean's default.
- The Canonicity alias fixtures need `@[expose]` under the module
  system's cross-module compilation-type check.
samuelburnham added a commit to argumentcomputer/ix that referenced this pull request Aug 18, 2026
Fallout of the v4.29 -> v4.33 bump that the skipped updater validation
never surfaced:

- batteries retired the `Batteries.Data.RBMap` umbrella module and moved
  the type to `RBTree.RBMap` in `Batteries.Recycling.RBTree`; ix keeps
  the recycled structure (the Verify layer proves theorems about it)
  rather than migrating `NormLevel`/`CNorm` to `Std.TreeMap`.
- Two `groups`/`atoms` lookups in IxonUniv were RBMap sites caught in the
  earlier `Std.HashMap` `find?` -> `get?` rename; RBMap kept `find?`.
- `do match` arms are non-dependent since v4.32 (leanprover/lean4#13305);
  the ShardMap size-invariant proofs need `match (dependent := true)`.
- `Environment.addDeclCore` gained a `maxRecDepth` parameter
  (leanprover/lean4#13956); pass Lean's default.
- The Canonicity alias fixtures need `@[expose]` under the module
  system's cross-module compilation-type check.
samuelburnham added a commit to argumentcomputer/ix that referenced this pull request Aug 18, 2026
Fallout of the v4.29 -> v4.33 bump that the skipped updater validation
never surfaced:

- batteries retired the `Batteries.Data.RBMap` umbrella module and moved
  the type to `RBTree.RBMap` in `Batteries.Recycling.RBTree`; ix keeps
  the recycled structure (the Verify layer proves theorems about it)
  rather than migrating `NormLevel`/`CNorm` to `Std.TreeMap`.
- Two `groups`/`atoms` lookups in IxonUniv were RBMap sites caught in the
  earlier `Std.HashMap` `find?` -> `get?` rename; RBMap kept `find?`.
- `do match` arms are non-dependent since v4.32 (leanprover/lean4#13305);
  the ShardMap size-invariant proofs need `match (dependent := true)`.
- `Environment.addDeclCore` gained a `maxRecDepth` parameter
  (leanprover/lean4#13956); pass Lean's default.
- The Canonicity alias fixtures need `@[expose]` under the module
  system's cross-module compilation-type check.
samuelburnham added a commit to argumentcomputer/ix that referenced this pull request Aug 18, 2026
Fallout of the v4.29 -> v4.33 bump that the skipped updater validation
never surfaced:

- batteries retired the `Batteries.Data.RBMap` umbrella module and moved
  the type to `RBTree.RBMap` in `Batteries.Recycling.RBTree`; ix keeps
  the recycled structure (the Verify layer proves theorems about it)
  rather than migrating `NormLevel`/`CNorm` to `Std.TreeMap`.
- Two `groups`/`atoms` lookups in IxonUniv were RBMap sites caught in the
  earlier `Std.HashMap` `find?` -> `get?` rename; RBMap kept `find?`.
- `do match` arms are non-dependent since v4.32 (leanprover/lean4#13305);
  the ShardMap size-invariant proofs need `match (dependent := true)`.
- `Environment.addDeclCore` gained a `maxRecDepth` parameter
  (leanprover/lean4#13956); pass Lean's default.
- The Canonicity alias fixtures need `@[expose]` under the module
  system's cross-module compilation-type check.
johnchandlerburnham added a commit to argumentcomputer/ix that referenced this pull request Aug 19, 2026
* chore: Update Lean to v4.33.0

Toolchain and dependencies bumped by lean-update.

* ci: Use lean-update's pr setting

`pr: true` opens the update PR on any outcome and skips the updater's
validation build by default; the PR's own CI is the authority on whether
the update builds.

* chore: Adapt sources and pins to Lean v4.33.0

Carries the v4.31 adaptation work forward: Std.HashMap `find?` renames to
`get?` (including call sites added on main since), the ByteArray FFI
helpers removed on the Lean and Rust sides, and assorted API fixes.

Dependency pins move to v4.33.0: Cli and batteries by tag, LSpec to the
merge commit of its v4.33.0 bump, and Blake3 to its v4.33.0 bump commit —
the manifest entry for Blake3 still needs `lake update Blake3` once that
commit is reachable on the remote. Benchmarks/Compile moves to the v4.33.0
toolchain with mathlib and FLT at their v4.33.0 tags.

* nix: Switch to the lean4-nix fork API

Upstream lean4-nix stops at Lean v4.32.0 and builds toolchains from source
behind an overlay; the fork provides released toolchains as plain
derivations and removed the overlay API. The overlay block is replaced by
`lib.${system}.fromToolchainFile`, and the Lean sysroot for bindgen, the
Lake build inputs, the binary wrappers, and the dev shell take the
toolchain derivation directly.

The dev shell and the crane-side derivations evaluate now. The Lake
packages remain blocked on the `blake3-lean` input: it follows this flake's
lean4-nix, so Blake3.lean's own fork migration must be pushed and merged,
after which `nix flake update blake3-lean` and `lake update Blake3`
complete the move.

* chore: Move from alejandra to nixfmt

Formatting-only, plus the formatter declaration itself; nixfmt-tree wraps
nixfmt so `nix fmt .` can still take a directory.

* fix(tc): classify Prop up to universe normalization

Lean v4.33.0 fixed two kernel soundness bugs (leanprover/lean4#14613,
leanprover/lean4#14615) where a sort spelled e.g. `Sort (imax 1 0)` was
not recognized as `Prop` because the zero test was syntactic; a non-proof
field could then be projected out of a proof, and the inductive checker
could misclassify Prop-only elimination and K-like reduction.

Both ix kernels had the same syntactic test. `KUniv.isSemanticZero` /
`KUniv::is_semantic_zero` decide `u ≡ 0` through the existing Géran
normal form (zero normalizes to empty entries only, and norm-level
equality already ignores empty entries), and replace the syntactic test
at the four affected sites, in lockstep across both kernels:

- proof-irrelevance Prop classification (Tc/DefEq, kernel/def_eq)
- the struct-eta H3 Prop-major guard (Tc/Whnf, kernel/whnf)
- the A4 field-universe Prop exemption (Tc/Inductive, kernel/inductive)
- recursor-generation isProp/isLarge (AuxGen/Recursor; compile-side,
  Lean only)

The IxVM kernel model retains the syntactic test and needs the same
treatment separately.

* fix: Adapt to Lean/batteries v4.33 API changes

Fallout of the v4.29 -> v4.33 bump that the skipped updater validation
never surfaced:

- batteries retired the `Batteries.Data.RBMap` umbrella module and moved
  the type to `RBTree.RBMap` in `Batteries.Recycling.RBTree`; ix keeps
  the recycled structure (the Verify layer proves theorems about it)
  rather than migrating `NormLevel`/`CNorm` to `Std.TreeMap`.
- Two `groups`/`atoms` lookups in IxonUniv were RBMap sites caught in the
  earlier `Std.HashMap` `find?` -> `get?` rename; RBMap kept `find?`.
- `do match` arms are non-dependent since v4.32 (leanprover/lean4#13305);
  the ShardMap size-invariant proofs need `match (dependent := true)`.
- `Environment.addDeclCore` gained a `maxRecDepth` parameter
  (leanprover/lean4#13956); pass Lean's default.
- The Canonicity alias fixtures need `@[expose]` under the module
  system's cross-module compilation-type check.

* fix(ffi): decode Lean.Int by value, not as a constructor

`Lean.Int` is in the compiler's `builtinRuntimeTypes`, so at runtime it
shares `Nat`'s representation — a tagged scalar or a GMP mpz object;
`Int.ofNat` compiles to the identity `lean_nat_to_int` and no ctor cell
ever exists. The mdata `DataValue.ofInt` decode path nevertheless read
it through the `LeanIxInt` ctor layout, dereferencing a tagged scalar
(or reading mpz limbs as ctor fields) whenever an `Expr.mdata` KVMap
carried an integer.

Decode by value instead: arithmetic-shift the tagged scalar to recover
the signed payload, and for mpz objects take the sign from
`lean_int_dec_lt` and the magnitude from `lean_nat_abs`. `LeanIxInt`
remains in use for `Ix.Int`, a genuine two-ctor inductive.

Pre-existing bug surfaced by the v4.33 FFI layout audit, which found no
other divergence between the hardcoded layouts and Lean v4.33.0.

* docs: Add v4.33 bump handoff

Records the lean4lean integration steps and their verification queue, the
open kernel-semantics divergences from upstream (theorem opacity, the IxVM
syntactic zero test, the deliberately-unenforced mutual universe
uniformity, missing regression fixtures), the divergences considered and
cleared during the audit, and the non-blocking follow-ups (FFI pointer
liveness, benchmark re-baselining, thread-pool stack ordering, OpenSSL
link watch, setup-file JSON parsing).

* chore: Bump lean4lean to dev 4844eda and Blake3 to native-decide-dynlib

lean4lean 5e5bb767 -> 4844eda4. The old pin predated the v4.32.1 kernel
soundness fix (leanprover/lean4#14498): its `addOpaque` never called
`checkNoMVarNoFVar` on the opaque's value, so it accepted the axiom-free
`False` construction from #14484 -- reachable from ix via
`Benchmarks/Lean4Lean.lean:209`. The new pin also builds `--wfail` clean,
which the ix lint gate needs, since 785 linter warnings and the 16
frontier sorries were cleared upstream in PR #5.

Blake3 is pinned to the unmerged `native-decide-dynlib` branch: it builds
`blake3-rs` as a cdylib and exposes `blake3_rs_shared`, which
`ix_native_decide_dynlib` needs to supply the BLAKE3 backend to Lean's
native evaluator, and that dynlib gates every `IxTcVerify` module. Move
to Blake3 main once that branch merges.

* fix(tc): Respell `try?` to keep its `EStateM.tryCatch` reachable

v4.33 routes a `return` inside a `try` block through the early-return
transformer, which buries the plain `EStateM.tryCatch` this reduces to and
that `Ix/Tc/Verify/Whnf/Iota/ConstructorSynthesis.lean` reasons about.
Spelled with `tryCatch`/`pure` instead. Both spellings denote the same
function; `lake build Ix` confirms nothing downstream depended on the old
elaboration.

* fix(aiur): Migrate MemSizes off deprecated Lean.RBTree

v4.33 deprecates `Lean.RBTree` in favour of `Std.TreeSet`, which fails the
`--wfail` lint gate. `Bytecode.MemSizes` was the only Lean-side use; the
API is identical except `fold` -> `foldl`. The `Batteries.Recycling.RBTree`
uses in `Ix/Tc/Level.lean` and `Ix/IxonUniv.lean` are a different,
non-deprecated type and are untouched.

* fix: Clear the two remaining v4.33 lint warnings

`BRecOn`'s `rtc` rebind after `popLocals` is dead -- nothing reads it past
that point -- but the call must still run to balance the TC-side local
context, so the value is discarded rather than the call removed.

`wfTwoEqDef` stays a `def`: the fixture exists to pin the prop-valued-`def`
constant class metaprograms emit, so `linter.defProp` is silenced at that
declaration rather than obeyed.

* test(ixvm): Repin the Slice pattern-model entry to its v4.33 name

v4.33 removed `String.Slice.Pattern.Model.NoPrefixForwardPatternModel`.
`NoPrefixPatternModel` is the surviving class of the same shape -- a `Prop`
class over a single forall-typed field -- which is what the entry exists to
drive: it is the regression driver for `is_rec_field`'s per-peel whnf
(#510). The FFT cost is still the removed constant's measurement and needs
a re-baseline.

* chore(tc-verify): Retune the trust manifests to the new lean4lean pin

The manifests are exact-match, so a *shrinking* trust boundary fails them
too. Three movements at the new pin: `Lean4Lean.TrProj` no longer uses
`sorryAx`, dropping it from 15 roots' `sorryOrigins`; ~56 roots no longer
reach the `ctxAddrForLbrUncached` native axiom; and `canonicalAuxOrder`'s
native axiom is `ax_9` rather than `ax_15`, that index being a count of
`native_decide` sites in `Ix/Tc/Inductive.lean`.

Both audits pass: 1796 roots in `Completed`, 7 in `Statements`.

* fix(tc-verify): Port IxTcVerify to v4.33 and the new lean4lean surface

Nothing downstream of lean4lean compiled under the old pin, so all of this
only surfaced once the dependency built. All 438 modules build, sorry-free.
Recurring causes:

v4.33 elaborator. A pure `let` in `do` is a term-level `have`, not
`pure _ >>= _`, so `run_pure_bind`/`ReaderT.run_pure`/`pure_bind` steps and
the matching `WF.bind (WF.pure ..)` proof layers became no-ops. `do` loops
carry state as a `Prod`, not an `MProd`. Guard `if`s survive as
`if false = true then ..`.

v4.33 simp. `simpa [f] using h` closes with reducible transparency, so it
now fails where the goal and `h` differ only by delta/iota on a plain `def`
(`TcM.runRec`, `StepWFAtOn`, `BlockCatalog.Contains`, `KExpr.addr` on a
literal); `exact` unfolds at default transparency and succeeds. Relatedly,
`runRec`'s equation lemma is eta-expanded, so naming it in a simp set does
nothing against an unapplied `runRec y`. simp also stopped unfolding
semireducible definitions while matching, hence `KVLCtx` is now an `abbrev`.

Core/batteries. `Nat.imax` moved into the `Lean` namespace;
`Batteries.RBNode.cmpLT_iff` became `RBTree.RBNode.cmpLT_iff`; `Except` has
no `DecidableEq`, so `Driver/Enumeration.lean` defines one for the
`native_decide` fixtures.

lean4lean API. `VEnv` gained `structEtas`; `VDecl.block` became
`mutualDef`; `Checked` gained `kTarget`/`kTarget_eq`; `fieldsR`/`recArgsR`/
`resultIndicesR` gained an `ElimMode` argument; `instL_lamN`/`instN_lamN`
are now upstream and the local copies are deleted.

Two spec decisions where the new lean4lean models both elimination modes:
`SingletonRecursor` is generalized to `generation.recUvars`, while
`SingletonEnumeration` gains an explicit `largeElimination` field, since its
proofs are built around the fresh motive universe.

`PropositionClassifierContext` gains a `universes` field bounding the size
of universes the run support covers. This is needed because the classifier
now splits on `u.isSemanticZero` to match production, whose positive branch
routes through `Level.normalizeLevel_eval` and its `size < UInt64.size`
side condition. The structure is only ever a hypothesis, so this ADDS an
assumption the eventual instantiation must discharge; it mirrors the
convention in `DefEq/StructuralCongruence.lean` and `DefEq/SameHeadSpine.lean`.

* docs: Record v4.33 integration status and the ixvm OOM diagnosis

* Clippy

* fmt

* Fix stale Ixon addresses

* fix(meta): module-mode files compile full-content envs; module honoring becomes seed scoping

An OLeanLevel.exported import (what module-mode header processing
yields) loads every imported public theorem as a body-less AXIOM and
omits non-exported _private.* constants entirely. Compiling such an env
axiomizes imported proofs: kernel checks pass vacuously and every
address drifts from private-level compiles of the same constants. This
shipped in #569 as getFileEnv's module-header honoring and fired as the
tc-pins/tc-accel-diff failures on main (v4.33 additionally hides
theorem values behind ConstantInfo.value?'s new allowOpaque default —
ix reads by constructor match, so only the import level matters).

- getFileEnvCore: always import classic/private (full content), report
  the header's module bit; getFileEnv keeps its signature.
- moduleVisibleNames: the exported-level NAME set, for scoping only.
- Ix.EnvScope (new): collectDeps moves here from Ix.Cli.ValidateCmd
  (namespaced, so tests can import it next to ValidateAux's top-level
  mirror) + defaultConstList — classic files keep the whole-env
  behavior byte-identically; module-mode files seed from the visible
  surface + local decls and close over the full-content env, so
  referenced _private.* proof auxiliaries ship (named) while
  unreferenced foreign privates stay out (TruthMines' qualified
  isolation, minus the corruption).
- CLI: compile/compile-lean/validate/validate-lean/ingress default
  paths route through defaultConstList.
- ParityEnv: shared collectDeps, and the fixture compile is now
  fail-closed (allowPartial := false) — silent drops were how this
  regression hid.
- Tests/Ix/MetaEnv: asserts full content (imported theorems are
  theorems with closed proof refs; privates present) for both header
  modes, and that defaultConstList scopes names without trimming
  content.

---------

Co-authored-by: samuelburnham <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan changelog-language Language features and metaprograms downstream Request a downstream-lean4 adaptation PR. 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.

3 participants