Repository navigation
Lean v4.33.0 consolidation + module-mode full-content compile fix - #572
Conversation
Toolchain and dependencies bumped by lean-update.
`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.
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.
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.
Formatting-only, plus the formatter declaration itself; nixfmt-tree wraps nixfmt so `nix fmt .` can still take a directory.
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.
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.
`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.
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).
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.
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.
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.
`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.
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.
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`.
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`.
Merge of update/lean-v4.33.0 (supersedes jcb/lean-v4.33.0-rebase: its lean4lean lint patch landed in the fork pin 4844eda4, its ports were re-authored on the newer branch) with main after the upstream-from-TruthMines mega-PR (#569) and the Prop-mutual .below fix (#571). Conflict resolutions: Tests/Main.lean unions #569's new suites with the branch's ByteArray-suite removal; Ix/Meta.lean resolves #569's module-header honoring directly into the corrected semantics — imports always at the classic (private) level, module mode honored as scoping — because an exported-level import axiomizes imported theorems (see the child commit for the scoping half and the regression tests).
…ng 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.
… value? default Benchmarks/Lean4Lean.lean vendors the replay machinery, and its getUsedConstants used bare ConstantInfo.value? — which v4.33 changed to hide theorem values (allowOpaque := false default). Theorem proofs were no longer walked, so proof-only auxiliaries (the ._f structural-recursion helpers, e.g. Nat.add_comm._f) never got added and the kernel rejected every replayed theorem depending on one with 'unknown constant'. The constHasStrLit scan had the same blind spot for string literals inside proofs. Both now pass allowOpaque := true, mirroring the fix the lean4lean fork itself ships in Lean4Lean.Replay at pin 4844eda4 (the 'lean4lean' ignored gate never ran on the update branch, so this surfaced only now).
3cf7748 to
81350bc
Compare
|
!benchmark compile decompile |
|
!benchmark ooc |
|
!benchmark aiur |
|
| env | compile-time (main) | compile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
FLT |
37.831 s | 49.982 s | +32.1% (1.32× slower) |
13.50K | 15.62K | +15.7% (1.16× faster) 🟢 | 12.32 GiB | 20.67 GiB | +67.7% (1.68× larger) |
1.68 GiB | 3.20 GiB | +90.5% (1.90× larger) |
510,687 | 780,906 | +52.9% (1.53× more) |
compile · InitStd — main from: base run @ 05e552f (not on bencher)
1 env · 1 with regressions · 0 with improvements (|Δ| > 3.0% on any metric).
| env | compile-time (main) | compile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
InitStd |
4.002 s | 4.357 s | +8.9% (1.09× slower) |
26.36K | 26.87K | +1.9% | 3.65 GiB | 4.02 GiB | +9.9% (1.10× larger) |
301.26 MiB | 324.65 MiB | +7.8% (1.08× larger) |
105,492 | 117,084 | +11.0% (1.11× more) |
compile · Lean — main from: base run @ 05e552f (not on bencher)
1 env · 1 with regressions · 1 with improvements (|Δ| > 3.0% on any metric).
| env | compile-time (main) | compile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lean |
8.302 s | 8.085 s | -2.6% | 22.77K | 25.56K | +12.3% (1.12× faster) 🟢 | 5.13 GiB | 5.28 GiB | +3.0% |
448.68 MiB | 481.18 MiB | +7.2% (1.07× larger) |
188,999 | 206,647 | +9.3% (1.09× more) |
compile · Mathlib — main from: base run @ 05e552f (not on bencher)
1 env · 1 with regressions · 1 with improvements (|Δ| > 3.0% on any metric).
| env | compile-time (main) | compile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Mathlib |
53.254 s | 48.706 s | -8.5% (1.09× faster) 🟢 | 13.83K | 15.83K | +14.5% (1.14× faster) 🟢 | 18.31 GiB | 19.07 GiB | +4.1% |
2.94 GiB | 3.10 GiB | +5.4% (1.05× larger) |
736,618 | 771,129 | +4.7% |
decompile · FLT — main from: base run @ 05e552f (not on bencher)
1 constant · 1 with regressions · 0 with improvements (|Δ| > 3.0% on any metric).
| constant | decompile-time (main) | decompile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
FLT |
1m 10.6s | 4m 34.9s | +289.5% (3.90× slower) |
7.24K | 2.84K | -60.7% (2.55× slower) |
18.91 GiB | 33.72 GiB | +78.3% (1.78× larger) |
1.68 GiB | 3.20 GiB | +90.5% (1.90× larger) |
510,687 | 780,906 | +52.9% (1.53× more) |
decompile · InitStd — main from: base run @ 05e552f (not on bencher)
1 constant · 1 with regressions · 0 with improvements (|Δ| > 3.0% on any metric).
| constant | decompile-time (main) | decompile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
InitStd |
5.855 s | 6.627 s | +13.2% (1.13× slower) |
18.02K | 17.67K | -1.9% | 3.63 GiB | 4.22 GiB | +16.2% (1.16× larger) |
301.26 MiB | 324.65 MiB | +7.8% (1.08× larger) |
105,492 | 117,084 | +11.0% (1.11× more) |
decompile · Lean — main from: base run @ 05e552f (not on bencher)
1 constant · 1 with regressions · 0 with improvements (|Δ| > 3.0% on any metric).
| constant | decompile-time (main) | decompile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lean |
11.980 s | 12.931 s | +7.9% (1.08× slower) |
15.78K | 15.98K | +1.3% | 5.07 GiB | 5.45 GiB | +7.5% (1.08× larger) |
448.68 MiB | 481.18 MiB | +7.2% (1.07× larger) |
188,999 | 206,647 | +9.3% (1.09× more) |
decompile · Mathlib — main from: base run @ 05e552f (not on bencher)
1 constant · 1 with regressions · 0 with improvements (|Δ| > 3.0% on any metric).
| constant | decompile-time (main) | decompile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Mathlib |
3m 22.6s | 3m 52.6s | +14.8% (1.15× slower) |
3.64K | 3.32K | -8.8% (1.10× slower) |
31.81 GiB | 32.90 GiB | +3.4% |
2.94 GiB | 3.10 GiB | +5.4% (1.05× larger) |
736,618 | 771,129 | +4.7% |
|
| constant | execute-time (main) | execute-time (PR) | Δ% | prove-time (main) | prove-time (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | proof-size (main) | proof-size (PR) | Δ% | verify-time (main) | verify-time (PR) | Δ% | fft-cost (main) | fft-cost (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Array.extract_append |
10.516 s | 10.681 s | +1.6% | 34.600 s | 39.805 s | +15.0% (1.15× slower) |
77.60 GiB | 77.71 GiB | +0.1% | 10.94 MiB | 10.94 MiB | +0.0% | 68.1 ms | 77.7 ms | +14.1% (1.14× slower) |
147.17B | 156.30B | +6.2% (1.06× more) |
ByteArray.utf8DecodeChar?_utf8EncodeChar_append |
10.249 s | 10.084 s | -1.6% | 33.434 s | 37.865 s | +13.3% (1.13× slower) |
76.82 GiB | 76.45 GiB | -0.5% | 10.99 MiB | 10.99 MiB | +0.0% | 67.6 ms | 68.6 ms | +1.5% | 152.43B | 153.04B | +0.4% |
Char.ofOrdinal_le_of_le |
6.662 s | 6.848 s | +2.8% | 25.510 s | 29.988 s | +17.6% (1.18× slower) |
63.40 GiB | 64.37 GiB | +1.5% | 11.00 MiB | 11.00 MiB | +0.0% | 71.5 ms | 79.7 ms | +11.5% (1.11× slower) |
103.35B | 107.22B | +3.7% |
_private.Init.Data.Range.Polymorphic.SInt.0.Int64.instRxcHasSize_eq |
3.798 s | 3.782 s | -0.4% | 15.264 s | 17.698 s | +15.9% (1.16× slower) |
36.14 GiB | 36.69 GiB | +1.5% | 10.91 MiB | 10.91 MiB | +0.0% | 78.2 ms | 69.3 ms | -11.3% (1.13× faster) 🟢 | 60.20B | 60.82B | +1.0% |
String.append |
400.8 ms | 403.3 ms | +0.6% | 2.169 s | 2.389 s | +10.1% (1.10× slower) |
4.84 GiB | 4.96 GiB | +2.6% | 9.74 MiB | 9.74 MiB | +0.0% | 57.4 ms | 63.0 ms | +9.8% (1.10× slower) |
3.23B | 3.28B | +1.7% |
Nat.add_comm |
255.1 ms | 252.7 ms | -0.9% | 1.031 s | 1.081 s | +4.8% |
3.82 GiB | 4.29 GiB | +12.2% (1.12× larger) |
8.90 MiB | 8.90 MiB | +0.0% | 51.8 ms | 54.6 ms | +5.3% (1.05× slower) |
287.58M | 303.19M | +5.4% (1.05× more) |
Stage 2 — FRI recursion on FRI (6 constants)
| constant | execute-time (main) | execute-time (PR) | Δ% | prove-time (main) | prove-time (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | proof-size (main) | proof-size (PR) | Δ% | verify-time (main) | verify-time (PR) | Δ% | fft-cost (main) | fft-cost (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Array.extract_append |
5.058 s | 4.883 s | -3.5% 🟢 | 28.604 s | 32.743 s | +14.5% (1.14× slower) |
90.17 GiB | 90.43 GiB | +0.3% | 3.97 MiB | 3.97 MiB | +0.0% | 24.8 ms | 26.3 ms | +5.8% (1.06× slower) |
199.15B | 198.33B | -0.4% |
ByteArray.utf8DecodeChar?_utf8EncodeChar_append |
5.117 s | 4.981 s | -2.7% | 29.564 s | 34.062 s | +15.2% (1.15× slower) |
94.82 GiB | 94.62 GiB | -0.2% | 3.97 MiB | 3.97 MiB | +0.0% | 24.6 ms | 26.8 ms | +9.1% (1.09× slower) |
201.90B | 203.36B | +0.7% |
Char.ofOrdinal_le_of_le |
5.069 s | 4.999 s | -1.4% | 29.575 s | 34.416 s | +16.4% (1.16× slower) |
94.31 GiB | 94.88 GiB | +0.6% | 3.97 MiB | 3.97 MiB | +0.0% | 26.5 ms | 25.4 ms | -3.8% 🟢 | 201.75B | 203.66B | +0.9% |
_private.Init.Data.Range.Polymorphic.SInt.0.Int64.instRxcHasSize_eq |
4.954 s | 4.796 s | -3.2% 🟢 | 29.511 s | 32.572 s | +10.4% (1.10× slower) |
93.81 GiB | 89.94 GiB | -4.1% 🟢 | 3.97 MiB | 3.97 MiB | +0.0% | 25.5 ms | 28.7 ms | +12.6% (1.13× slower) |
198.88B | 197.42B | -0.7% |
String.append |
3.954 s | 3.989 s | +0.9% | 26.969 s | 31.164 s | +15.6% (1.16× slower) |
87.51 GiB | 87.80 GiB | +0.3% | 3.97 MiB | 3.97 MiB | +0.0% | 24.7 ms | 25.4 ms | +2.9% | 160.06B | 165.44B | +3.4% |
Nat.add_comm |
3.169 s | 3.183 s | +0.4% | 17.647 s | 20.855 s | +18.2% (1.18× slower) |
57.39 GiB | 57.75 GiB | +0.6% | 3.97 MiB | 3.97 MiB | +0.0% | 24.5 ms | 25.7 ms | +4.8% |
123.53B | 127.65B | +3.3% |
Pipeline total (6 constants)
| constant | total-time (main) | total-time (PR) | Δ% | pipeline-peak-ram (main) | pipeline-peak-ram (PR) | Δ% |
|---|---|---|---|---|---|---|
Array.extract_append |
1m 3.2s | 1m 12.5s | +14.8% (1.15× slower) |
90.17 GiB | 90.43 GiB | +0.3% |
ByteArray.utf8DecodeChar?_utf8EncodeChar_append |
1m 3.0s | 1m 11.9s | +14.2% (1.14× slower) |
94.82 GiB | 94.62 GiB | -0.2% |
Char.ofOrdinal_le_of_le |
55.084 s | 1m 4.4s | +16.9% (1.17× slower) |
94.31 GiB | 94.88 GiB | +0.6% |
_private.Init.Data.Range.Polymorphic.SInt.0.Int64.instRxcHasSize_eq |
44.775 s | 50.270 s | +12.3% (1.12× slower) |
93.81 GiB | 89.94 GiB | -4.1% 🟢 |
String.append |
29.138 s | 33.553 s | +15.2% (1.15× slower) |
87.51 GiB | 87.80 GiB | +0.3% |
Nat.add_comm |
18.679 s | 21.935 s | +17.4% (1.17× slower) |
57.39 GiB | 57.75 GiB | +0.6% |
|
| env/constant | check-time (main) | check-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|
InitStd |
9.235 s | 7.749 s | -16.1% (1.19× faster) 🟢 | 9.64K | 12.75K | +32.3% (1.32× faster) 🟢 | 1.85 GiB | 2.40 GiB | +29.7% (1.30× larger) |
Std.Tactic.BVDecide.BVExpr.bitblast.goCache_Inv_of_Inv._mutual |
3.384 s | 3.408 s | +0.7% | 1.67K | 1.81K | +8.4% (1.08× faster) 🟢 | 1.99 GiB | 2.24 GiB | +12.6% (1.13× larger) |
Array.extract_append |
518.5 ms | 517.5 ms | -0.2% | 2.99K | 3.12K | +4.3% 🟢 | 1.52 GiB | 1.25 GiB | -17.6% (1.21× smaller) 🟢 |
Vector.extract_append._proof_2 |
512.0 ms | 512.3 ms | +0.1% | 2.55K | 2.66K | +4.1% 🟢 | 1.61 GiB | 1.51 GiB | -6.0% (1.06× smaller) 🟢 |
ByteArray.utf8DecodeChar?_utf8EncodeChar_append |
278.7 ms | 279.5 ms | +0.3% | 9.68K | 9.95K | +2.8% | 1.25 GiB | 1.24 GiB | -0.8% |
Char.ofOrdinal_le_of_le |
273.5 ms | 274.2 ms | +0.3% | 9.72K | 10.12K | +4.1% 🟢 | 1.52 GiB | 1.67 GiB | +9.8% (1.10× larger) |
_private.Init.Data.Range.Polymorphic.SInt.0.Int64.instRxcHasSize_eq |
264.6 ms | 264.9 ms | +0.1% | 6.87K | 7.07K | +2.9% | 1.71 GiB | 1.67 GiB | -2.6% |
String.split |
263.9 ms | 264.0 ms | +0.0% | 6.71K | 6.95K | +3.5% 🟢 | 1.38 GiB | 1.36 GiB | -1.3% |
List.mergeSort |
261.5 ms | 261.8 ms | +0.1% | 5.56K | 5.79K | +4.1% 🟢 | 1.07 GiB | 980.36 MiB | -10.1% (1.11× smaller) 🟢 |
Vector.append |
254.6 ms | 254.8 ms | +0.1% | 1.96K | 2.10K | +7.4% (1.07× faster) 🟢 | 778.31 MiB | 870.62 MiB | +11.9% (1.12× larger) |
Nat.gcd_comm |
254.5 ms | 254.7 ms | +0.1% | 1.53K | 1.64K | +7.3% (1.07× faster) 🟢 | 942.22 MiB | 871.25 MiB | -7.5% (1.08× smaller) 🟢 |
String.append |
253.0 ms | 253.4 ms | +0.2% | 1.21K | 1.30K | +7.3% (1.07× faster) 🟢 | 1.38 GiB | 1.34 GiB | -2.6% |
Nat.sub_le_of_le_add |
252.8 ms | 252.9 ms | +0.0% | 672.480 | 727.600 | +8.2% (1.08× faster) 🟢 | 661.30 MiB | 644.48 MiB | -2.5% |
Int.gcd |
252.6 ms | 252.7 ms | +0.0% | 823.340 | 882.470 | +7.2% (1.07× faster) 🟢 | 781.77 MiB | 744.58 MiB | -4.8% 🟢 |
Nat.add_comm |
252.7 ms | 252.5 ms | -0.1% | 166.220 | 182.200 | +9.6% (1.10× faster) 🟢 | 474.22 MiB | 520.00 MiB | +9.7% (1.10× larger) |
per-constant drill-down — Σ check 203.99s → 213.06s (+4.4%), Σ cost +7.8%; 1957 cost mover(s), 31 time-only mover(s); 12392 added (19.22s), 2933 removed (3.56s)
Each entry is one constant's own check within the whole-env run (deps ingress lazily; each dep is checked in its own entry; entries sum to the env) — not the full-closure scope of the headline --consts measurements.
Cost regressions (counter-backed)
| constant | main | PR | Δtime | Δcost (Zisk) | driver |
|---|---|---|---|---|---|
Vector.range_eq_range' |
0.5ms | 214ms | +41039.7% (411.40× slower) |
+84247.8% (843.48× more) |
whnf +1026260.0% |
_private.Std.Tactic.BVDecide.LRAT.Internal.Formula.Lemmas.0.Std.Tactic.BVDecide.LRAT.Internal.DefaultFormula.deleteOne_preserves_strongAssignmentsInvariant._proof_1_25 |
0.2ms | 8.9ms | +5298.2% (53.98× slower) |
+8466.9% (85.67× more) |
subst +11585.2% |
Std.Time.FormatConfig.mk.sizeOf_spec |
0.4ms | 7.9ms | +2105.8% (22.06× slower) |
+6698.8% (67.99× more) |
whnf +18246.7% |
_private.Std.Tactic.BVDecide.LRAT.Internal.Formula.RupAddSound.0.Std.Tactic.BVDecide.LRAT.Internal.DefaultFormula.confirmRupHint_preserves_motive._proof_1_9 |
0.2ms | 17ms | +7004.5% (71.05× slower) |
+6077.9% (61.78× more) |
whnf +62800.0% |
Std.Tactic.BVDecide.LRAT.Internal.compactLratChecker.go._unary._proof_6 |
0.5ms | 21ms | +4082.4% (41.82× slower) |
+6021.9% (61.22× more) |
whnf +83800.0% |
_private.Std.Tactic.BVDecide.LRAT.Internal.Formula.RupAddResult.0.Std.Tactic.BVDecide.LRAT.Internal.DefaultFormula.nodup_derivedLits._proof_1_21 |
0.4ms | 26ms | +5763.6% (58.64× slower) |
+6007.7% (61.08× more) |
whnf +31066.7% |
_private.Std.Tactic.BVDecide.LRAT.Internal.Formula.RatAddSound.0.Std.Tactic.BVDecide.LRAT.Internal.DefaultFormula.existsRatHint_of_ratHintsExhaustive._proof_1_28 |
0.5ms | 12ms | +2138.2% (22.38× slower) |
+4511.0% (46.11× more) |
whnf +40400.0% |
_private.Init.Data.Array.Lex.Basic.0.Array.lex._proof_1 |
0.4ms | 18ms | +4699.7% (48.00× slower) |
+3969.9% (40.70× more) |
whnf +17125.0% |
Std.Time.DateTime.toLeanDateTimeWithZoneString |
0.1ms | 3.7ms | +2816.0% (29.16× slower) |
+3947.5% (40.48× more) |
whnf +7500.0% |
_private.Init.Data.Array.Lex.Basic.0.Array.lex._proof_2 |
0.4ms | 17ms | +3732.7% (38.33× slower) |
+3727.7% (38.28× more) |
whnf +65800.0% |
Cost improvements (counter-backed)
| constant | main | PR | Δtime | Δcost (Zisk) | driver |
|---|---|---|---|---|---|
_private.Std.Tactic.BVDecide.LRAT.Internal.Formula.Lemmas.0.Std.Tactic.BVDecide.LRAT.Internal.DefaultFormula.deleteOne_preserves_strongAssignmentsInvariant._proof_1_35 |
18ms | 0.2ms | -99.1% (114.77× faster) 🟢 | -99.4% (165.42× fewer) 🟢 | whnf -99.8% |
_private.Std.Tactic.BVDecide.LRAT.Internal.Formula.Lemmas.0.Std.Tactic.BVDecide.LRAT.Internal.DefaultFormula.deleteOne_preserves_strongAssignmentsInvariant._proof_1_33 |
10ms | 0.2ms | -98.5% (67.39× faster) 🟢 | -99.0% (97.37× fewer) 🟢 | subst -99.3% |
Std.Tactic.BVDecide.BVLogicalExpr.bitblast.go |
17ms | 0.5ms | -97.2% (35.88× faster) 🟢 | -98.6% (70.93× fewer) 🟢 | whnf -99.8% |
Std.Tactic.BVDecide.BVExpr.decEq |
41ms | 2.5ms | -93.8% (16.13× faster) 🟢 | -98.2% (55.38× fewer) 🟢 | subst -99.7% |
_private.Std.Tactic.BVDecide.LRAT.Internal.Formula.RupAddResult.0.Std.Tactic.BVDecide.LRAT.Internal.DefaultFormula.confirmRupHint_preserves_invariant_helper._proof_1_12 |
21ms | 0.3ms | -98.4% (61.95× faster) 🟢 | -97.8% (46.40× fewer) 🟢 | whnf -99.2% |
_private.Std.Tactic.BVDecide.LRAT.Internal.Formula.RatAddSound.0.Std.Tactic.BVDecide.LRAT.Internal.DefaultFormula.existsRatHint_of_ratHintsExhaustive._proof_1_16 |
12ms | 0.2ms | -98.0% (48.96× faster) 🟢 | -97.5% (40.41× fewer) 🟢 | whnf -100.0% |
_private.Init.Data.Array.Lex.Basic.0.Array.lex._proof_3 |
17ms | 0.4ms | -97.6% (42.23× faster) 🟢 | -97.5% (40.16× fewer) 🟢 | nat_arith -100.0% |
_private.Init.Data.Array.Lex.Basic.0.Array.lex._proof_4 |
17ms | 0.5ms | -97.1% (34.82× faster) 🟢 | -97.4% (37.77× fewer) 🟢 | whnf -100.0% |
_private.Std.Tactic.BVDecide.LRAT.Internal.Formula.RupAddResult.0.Std.Tactic.BVDecide.LRAT.Internal.DefaultFormula.derivedLitsInvariant_confirmRupHint._proof_1_12 |
6.6ms | 0.3ms | -95.7% (23.52× faster) 🟢 | -97.1% (34.71× fewer) 🟢 | whnf -99.3% |
Std.Do.ExceptConds.false_and |
2.6ms | 0.1ms | -94.5% (18.28× faster) 🟢 | -97.1% (34.70× fewer) 🟢 | whnf -100.0% |
Time-only movers (cost flat — scheduling/locality noise)
| constant | main | PR | Δtime | Δcost (Zisk) | driver |
|---|---|---|---|---|---|
_private.Std.Sat.CNF.Basic.0.Std.Sat.CNF.VarMem_add._simp_1 |
0.3ms | 32ms | +9141.9% (92.42× slower) |
+0.0% | — |
Std.Internal.List.getValue?_insertList |
2.3ms | 24ms | +953.8% (10.54× slower) |
-1.2% | — |
Std.DHashMap.Raw.get!_ofList_of_contains_eq_false |
5.7ms | 25ms | +334.3% (4.34× slower) |
-5.6% (1.06× fewer) 🟢 | intern -9.3% |
Std.Internal.List.length_insertListConst |
4.5ms | 18ms | +297.3% (3.97× slower) |
-1.4% | — |
_private.Init.Grind.ToInt.0.Lean.Grind.IntInterval.wrap_mem._proof_1_4 |
17ms | 58ms | +249.9% (3.50× slower) |
+1.3% | — |
|
!benchmark aiur fresh |
|
| constant | execute-time (main) | execute-time (PR) | Δ% | prove-time (main) | prove-time (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | proof-size (main) | proof-size (PR) | Δ% | verify-time (main) | verify-time (PR) | Δ% | fft-cost (main) | fft-cost (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Array.extract_append |
10.508 s | 11.095 s | +5.6% (1.06× slower) |
35.791 s | 41.713 s | +16.5% (1.17× slower) |
77.60 GiB | 77.71 GiB | +0.1% | 10.94 MiB | 10.94 MiB | +0.0% | 68.9 ms | 74.6 ms | +8.3% (1.08× slower) |
147.17B | 156.30B | +6.2% (1.06× more) |
ByteArray.utf8DecodeChar?_utf8EncodeChar_append |
10.358 s | 9.989 s | -3.6% 🟢 | 34.473 s | 39.415 s | +14.3% (1.14× slower) |
76.87 GiB | 76.49 GiB | -0.5% | 10.99 MiB | 10.99 MiB | +0.0% | 68.0 ms | 72.2 ms | +6.0% (1.06× slower) |
152.43B | 153.04B | +0.4% |
Char.ofOrdinal_le_of_le |
6.903 s | 6.923 s | +0.3% | 26.493 s | 31.434 s | +18.6% (1.19× slower) |
63.44 GiB | 64.35 GiB | +1.4% | 11.00 MiB | 11.00 MiB | +0.0% | 77.3 ms | 75.9 ms | -1.8% | 103.35B | 107.22B | +3.7% |
_private.Init.Data.Range.Polymorphic.SInt.0.Int64.instRxcHasSize_eq |
3.952 s | 3.819 s | -3.4% 🟢 | 15.991 s | 18.468 s | +15.5% (1.15× slower) |
36.08 GiB | 36.67 GiB | +1.6% | 10.91 MiB | 10.91 MiB | +0.0% | 79.3 ms | 78.6 ms | -0.9% | 60.20B | 60.82B | +1.0% |
String.append |
413.5 ms | 412.2 ms | -0.3% | 2.217 s | 2.445 s | +10.3% (1.10× slower) |
5.86 GiB | 5.95 GiB | +1.5% | 9.74 MiB | 9.74 MiB | +0.0% | 58.6 ms | 62.6 ms | +6.8% (1.07× slower) |
3.23B | 3.28B | +1.7% |
Nat.add_comm |
254.0 ms | 263.4 ms | +3.7% |
1.036 s | 1.122 s | +8.2% (1.08× slower) |
3.64 GiB | 4.70 GiB | +29.3% (1.29× larger) |
8.90 MiB | 8.90 MiB | +0.0% | 53.3 ms | 54.9 ms | +2.9% | 287.58M | 303.19M | +5.4% (1.05× more) |
Stage 2 — FRI recursion on FRI (6 constants)
| constant | execute-time (main) | execute-time (PR) | Δ% | prove-time (main) | prove-time (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | proof-size (main) | proof-size (PR) | Δ% | verify-time (main) | verify-time (PR) | Δ% | fft-cost (main) | fft-cost (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Array.extract_append |
5.161 s | 4.993 s | -3.2% 🟢 | 29.446 s | 34.490 s | +17.1% (1.17× slower) |
90.19 GiB | 90.45 GiB | +0.3% | 3.97 MiB | 3.97 MiB | +0.0% | 24.8 ms | 26.7 ms | +7.8% (1.08× slower) |
199.15B | 198.33B | -0.4% |
ByteArray.utf8DecodeChar?_utf8EncodeChar_append |
5.228 s | 5.044 s | -3.5% 🟢 | 30.599 s | 35.764 s | +16.9% (1.17× slower) |
94.33 GiB | 94.59 GiB | +0.3% | 3.97 MiB | 3.97 MiB | +0.0% | 24.6 ms | 27.0 ms | +9.6% (1.10× slower) |
201.90B | 203.36B | +0.7% |
Char.ofOrdinal_le_of_le |
5.097 s | 5.119 s | +0.4% | 30.842 s | 35.763 s | +16.0% (1.16× slower) |
94.30 GiB | 95.06 GiB | +0.8% | 3.97 MiB | 3.97 MiB | +0.0% | 26.6 ms | 25.5 ms | -4.2% 🟢 | 201.75B | 203.66B | +0.9% |
_private.Init.Data.Range.Polymorphic.SInt.0.Int64.instRxcHasSize_eq |
5.073 s | 4.980 s | -1.8% | 30.697 s | 34.389 s | +12.0% (1.12× slower) |
93.88 GiB | 89.99 GiB | -4.1% 🟢 | 3.97 MiB | 3.97 MiB | +0.0% | 25.8 ms | 26.6 ms | +3.0% | 198.88B | 197.42B | -0.7% |
String.append |
4.109 s | 4.100 s | -0.2% | 28.087 s | 32.781 s | +16.7% (1.17× slower) |
87.51 GiB | 87.82 GiB | +0.4% | 3.97 MiB | 3.97 MiB | +0.0% | 24.5 ms | 27.0 ms | +10.2% (1.10× slower) |
160.06B | 165.44B | +3.4% |
Nat.add_comm |
3.284 s | 3.307 s | +0.7% | 18.539 s | 22.060 s | +19.0% (1.19× slower) |
57.44 GiB | 57.67 GiB | +0.4% | 3.97 MiB | 3.97 MiB | +0.0% | 24.5 ms | 25.7 ms | +4.8% |
123.53B | 127.65B | +3.3% |
Pipeline total (6 constants)
| constant | total-time (main) | total-time (PR) | Δ% | pipeline-peak-ram (main) | pipeline-peak-ram (PR) | Δ% |
|---|---|---|---|---|---|---|
Array.extract_append |
1m 5.2s | 1m 16.2s | +16.8% (1.17× slower) |
90.19 GiB | 90.45 GiB | +0.3% |
ByteArray.utf8DecodeChar?_utf8EncodeChar_append |
1m 5.1s | 1m 15.2s | +15.5% (1.16× slower) |
94.33 GiB | 94.59 GiB | +0.3% |
Char.ofOrdinal_le_of_le |
57.335 s | 1m 7.2s | +17.2% (1.17× slower) |
94.30 GiB | 95.06 GiB | +0.8% |
_private.Init.Data.Range.Polymorphic.SInt.0.Int64.instRxcHasSize_eq |
46.689 s | 52.856 s | +13.2% (1.13× slower) |
93.88 GiB | 89.99 GiB | -4.1% 🟢 |
String.append |
30.304 s | 35.226 s | +16.2% (1.16× slower) |
87.51 GiB | 87.82 GiB | +0.4% |
Nat.add_comm |
19.575 s | 23.182 s | +18.4% (1.18× slower) |
57.44 GiB | 57.67 GiB | +0.4% |
|
!bencher-thresholds-reset all |
|
♻️ Baseline reset queued for: all — will anchor to the merge commit when this PR merges. |
Raise the shared kernel-environment clear threshold to 131072 so current Mathlib and FLT dependency closures stay cached while retaining a memory backstop. Add an environment override and report ingress, generation, peak, and clear diagnostics. Expose the tuning knob through the benchmark command and documentation.
`ci.yml` never ran a bare `lake test`: the `build` job passes `test: false`, and `lean-test`'s lean-action step sets `auto-config: false`, so its three steps were the only Lean tests and each was filtered. The primary tier -- `primitive-address-parity` among it, the live-vs-pinned check that grounds the hardcoded primitive addresses against a real compile -- therefore ran only under `nix.yml`'s `lake build && lake test`. Real coverage, but incidental: a Nix-job skip or a path filter would drop the guard from PR CI without anything failing. lean-action's `test` input takes precedence over `auto-config`, so `test: true` runs `lake test` without also re-running `lake build`, preserving this job's design of testing against the restored cache. The Aiur step goes: all six names it passed are primary (`aiur-cross` a suite, the rest runners), and a bare run takes every primary suite -- `lspecIO` keeps the whole map on an empty filter -- and every primary runner. The two remaining steps cover what a bare run cannot reach: `cli` is special-cased ahead of the suite dispatch in `Tests/Main.lean`, and the ixvm fixtures are in the ignored tier. No `test-args: "--wfail"`: the input is declared but never wired to the step in the released `v1` (fixed on the default branch, unreleased), so it would be silently ignored. Nothing is lost -- the `build` job's `lake lint -- --wfail -v` already compiles every lib and exe except `IxTcVerify`, `Tests` and `IxTests` included.
The ceiling note claimed the largest legitimate workload was Mathlib `ix compile` at ~100 GB. Both halves were wrong: compile is the *lighter* of the pair, and it peaks around 18-19 GiB, not 100. Measured locally on this tree (771,129 / 780,906 constants, matching the PR's CI figures), `ix bench run`: Mathlib compile 18.13 GiB decompile 37.83 GiB FLT compile 18.75 GiB decompile 39.07 GiB Decompile now dominates because Pass 2 holds its kenv rather than clearing it: at the previous 65536 threshold Mathlib peaked 29.7 GiB with 11 clears, and at 131072 it peaks 37.5 GiB with none, trading ~8 GiB for a 2.2x faster Pass 2. The correction matters operationally: the default ceiling is the machine's RAM minus 15 GB, so a ~48 GB machine defaults to 32 GB -- under the real decompile peak, and the run dies as a spurious OOM row. Clearing ~39 GiB by default now needs roughly 55 GB; below that, pass `--ceiling-gb`.
|
!benchmark compile decompile |
|
| env | compile-time (main) | compile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
FLT |
37.743 s | 1m 1.4s | +62.5% (1.63× slower) |
13.53K | 12.73K | -5.9% (1.06× slower) |
12.41 GiB | 20.58 GiB | +65.8% (1.66× larger) |
1.68 GiB | 3.20 GiB | +90.5% (1.90× larger) |
510,687 | 780,906 | +52.9% (1.53× more) |
compile · InitStd — main from: base run @ 05e552f (not on bencher)
1 env · 1 with regressions · 1 with improvements (|Δ| > 3.0% on any metric).
| env | compile-time (main) | compile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
InitStd |
4.604 s | 4.444 s | -3.5% 🟢 | 22.91K | 26.35K | +15.0% (1.15× faster) 🟢 | 3.65 GiB | 3.93 GiB | +7.7% (1.08× larger) |
301.26 MiB | 324.65 MiB | +7.8% (1.08× larger) |
105,492 | 117,084 | +11.0% (1.11× more) |
compile · Lean — main from: base run @ 05e552f (not on bencher)
1 env · 1 with regressions · 1 with improvements (|Δ| > 3.0% on any metric).
| env | compile-time (main) | compile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lean |
8.161 s | 7.849 s | -3.8% 🟢 | 23.16K | 26.33K | +13.7% (1.14× faster) 🟢 | 5.08 GiB | 5.28 GiB | +4.1% |
448.68 MiB | 481.18 MiB | +7.2% (1.07× larger) |
188,999 | 206,647 | +9.3% (1.09× more) |
compile · Mathlib — main from: base run @ 05e552f (not on bencher)
1 env · 1 with regressions · 1 with improvements (|Δ| > 3.0% on any metric).
| env | compile-time (main) | compile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Mathlib |
59.779 s | 48.674 s | -18.6% (1.23× faster) 🟢 | 12.32K | 15.84K | +28.6% (1.29× faster) 🟢 | 19.04 GiB | 19.18 GiB | +0.7% | 2.94 GiB | 3.10 GiB | +5.4% (1.05× larger) |
736,618 | 771,129 | +4.7% |
decompile · FLT — main from: base run @ 05e552f (not on bencher)
1 constant · 1 with regressions · 0 with improvements (|Δ| > 3.0% on any metric).
| constant | decompile-time (main) | decompile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
FLT |
1m 17.4s | 2m 45.7s | +114.2% (2.14× slower) |
6.60K | 4.71K | -28.6% (1.40× slower) |
18.87 GiB | 39.58 GiB | +109.8% (2.10× larger) |
1.68 GiB | 3.20 GiB | +90.5% (1.90× larger) |
510,687 | 780,906 | +52.9% (1.53× more) |
decompile · InitStd — main from: base run @ 05e552f (not on bencher)
1 constant · 1 with regressions · 0 with improvements (|Δ| > 3.0% on any metric).
| constant | decompile-time (main) | decompile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
InitStd |
6.797 s | 8.100 s | +19.2% (1.19× slower) |
15.52K | 14.45K | -6.9% (1.07× slower) |
3.62 GiB | 4.23 GiB | +16.9% (1.17× larger) |
301.26 MiB | 324.65 MiB | +7.8% (1.08× larger) |
105,492 | 117,084 | +11.0% (1.11× more) |
decompile · Lean — main from: base run @ 05e552f (not on bencher)
1 constant · 1 with regressions · 0 with improvements (|Δ| > 3.0% on any metric).
| constant | decompile-time (main) | decompile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lean |
11.959 s | 13.207 s | +10.4% (1.10× slower) |
15.80K | 15.65K | -1.0% | 5.02 GiB | 5.46 GiB | +8.6% (1.09× larger) |
448.68 MiB | 481.18 MiB | +7.2% (1.07× larger) |
188,999 | 206,647 | +9.3% (1.09× more) |
decompile · Mathlib — main from: base run @ 05e552f (not on bencher)
1 constant · 1 with regressions · 1 with improvements (|Δ| > 3.0% on any metric).
| constant | decompile-time (main) | decompile-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | env-size (main) | env-size (PR) | Δ% | constants (main) | constants (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Mathlib |
3m 32.3s | 2m 32.5s | -28.2% (1.39× faster) 🟢 | 3.47K | 5.06K | +45.7% (1.46× faster) 🟢 | 31.74 GiB | 38.40 GiB | +21.0% (1.21× larger) |
2.94 GiB | 3.10 GiB | +5.4% (1.05× larger) |
736,618 | 771,129 | +4.7% |
The `native-decide-dynlib` branch merged as Blake3.lean#43, so the pin moves off that branch onto Blake3 main at its tip. No content change: #43 is the same `blake3_rs_shared` work this was already pinned to, now upstream. `blake3_rs_shared` builds `blake3-rs` as a cdylib alongside the staticlib; `ix_native_decide_dynlib` fetches it to supply the BLAKE3 backend to Lean's native evaluator, and that dynlib gates every `IxTcVerify` module. The lakefile comment is rewritten accordingly -- it no longer describes an unmerged branch, and instead records the constraint that outlives it: the pin must stay at or after the revision introducing the target. `Benchmarks/Compile/lake-manifest.json` inherits Blake3 through the `ix` path require and is synced by hand, its mathlib/FLT deps being materialized locally rather than resolvable by `lake update` here.
A working document for the v4.33 bump, not something to carry onto main. It has been branch-only throughout, so removing it here keeps it out of the merged tree; the three commits that touched it retain it in history, and a squash merge drops it entirely.
|
♻️ Baseline reset to |
… perf pass) (#579) * perf: enable thin LTO for release builds Cross-crate inlining across the ixon/compile/ffi boundary — the hot loops (blake3 digests, subterm sharing, serialization) span crates. Byte-output invariant: codegen-only change. * diag: phase-level attribution for the Rust compile path Closes the instrumentation gap ahead of the perf pass (the Rust side had no RSS attribution): - crates/compile/src/diag.rs: rss_log_suffix moves out of decompile.rs so the compile scheduler can use it; setup phases 1/2/3/5/7, the periodic progress tick, scheduler-drained and complete lines now carry rss/anon/file GiB. - IX_COMPILE_DBG=1 (the Lean driver's phase knob) now also lights up the Rust-side IX_VERBOSE logging in compile_env, so one flag attributes the whole pipeline. (Env::put/put_file get the same alias plus per-section timers in the companion perf commit, which owns serialize.rs.) - stale doc fix: compile/env.rs claimed worker kernel envs 'clear periodically'; they are fresh per block (canonicity §10.5). No behavior change outside env-gated logging. * perf: decompile Pass-2 restructure + compile hot-path batch Decompile (Mathlib 736k-const measurements; default-threshold run 151.2s -> 133.2s before the prewarm-stub change): - get_constant_info_references: single-accumulator iterative DAG walk (visited keyed on Expr's digest Hash/Eq) instead of a per-node NameSet materialize+merge+clone per expr node. Feeds compile's setup_scan and decompile's Pass-2 ingress BFS. Value-identical sets; no consumer reads set iteration order into bytes (SCC members and serialized sections re-sort canonically) - held by the parity gates. - Pass-2 ingress BFS: run-scoped refs memo surviving the kenv clear (the clear wiped the only BFS memo, making each clear re-walk the whole closure - the Θ(N²/L) term behind FLT's +114% decompile). Names absent from work_env stay unmemoized (aux constants appear only when their block regenerates). - aux ingress walkers: per-call seen sets move into KernelCtx.aux_ingress_seen (resolved-id-keyed, cleared with the kenv; per-block-fresh in compile per §10.5), so a block no longer re-expands the whole closure that previous blocks already ingressed (Θ(blocks x closure) -> amortized O(closure)). collect_const_refs gains a digest-keyed visited set (shared subterms walked once). Measured: Pass-2 gen 75.9s -> 62.7s on Mathlib. Lean mirrors: Ix/AuxGen/Kernel.lean (AuxKernelCtx.auxIngressSeen), Ix/AuxGen/Recursor.lean (drainIngressQueue + visited set). - Pass-2 prewarm (ensure_in_kenv_of_prewarm): theorem/opaque values ingress as type-only Axio stubs - the fidelity ingress_type_stub already gives thms the gen walkers discover, sufficient for kernel TC (proof irrelevance; opaque never unfolds). Full proof ingestion was the dominant share of Pass-2 kenv RSS (~47 KB/name measured), which is what forced the periodic clears; the clear default rises 131072 -> 1048576 and becomes a rare backstop (FLT-scale closures no longer cross it). Lean mirror: ensureInKenvOfPrewarm, both Pass-2 driver variants. - lean_env (a third whole-env copy) now drops after Pass 1.5 instead of living to end of decompile_env. Compile: - ixon/sharing.rs: all blake3-digest-keyed maps move from SipHash std HashMap to FxHashMap (keys are already uniform digests; every order-sensitive consumer re-sorts). - merkle_root_canonical_sorted (host-only): parallel leaf+level hashing for callers holding sorted unique leaves; bit-identical root. Env::put/put_file use it; rs_compile_env computes the const table + root once and hands both to put_file_with_header - the sort and the ~2N-node tree ran twice per compile. - Env::put_file: per-section timers mirroring Env::put (same IX_VERBOSE/IX_COMPILE_DBG knobs; §4's serial name topo sort timed separately). - compile_definition/inductive/recursor take the block-context address list as a parameter, computed once per block (was: full ctx sort + re-intern per member, O(M² log M) per block). - mutual-path ConstantMeta moves out of all_metas via remove instead of two deep clones per constant. Bytes are unchanged by construction everywhere; gated by put_file_matches_put, aux-gen-diff, decompile-diff, validate-aux and the Mathlib-scale roundtrip.
One PR consolidating the v4.33 toolchain update with the fix for the
module-mode environment regression that is currently failing main's
Ix.Tc verification and parityjob (thetc-pins/tc-accel-diffreds introduced by #569).
Commit 1 — merge:
update/lean-v4.33.0× post-#571 mainSupersedes both previous v4.33 efforts:
update/lean-v4.33.0(fork #568, 20 commits — taken wholesale) and
jcb/lean-v4.33.0-rebase(fork #562 — fully obsolete: its
patches/lean4lean-v4.33-lint-clean.patchlanded upstream in the fork pin
4844eda4this branch already uses, andits ports were re-authored on the newer branch).
Only two textual conflicts, resolved as:
Tests/Main.lean— union: Upstream aux determinism, fail-closed compile, versioned.ixe, catalogs,import_ixefrom TruthMines #569's four new suites in, the branch'sdeliberate
ByteArray-suite removal stands.Ix/Meta.lean— Upstream aux determinism, fail-closed compile, versioned.ixe, catalogs,import_ixefrom TruthMines #569's module-header honoring resolved into thecorrected semantics (commit 2's subject); the branch's
enableInitializersExecutionline (a v4.33 requirement) kept.Merge fallout fixed in the same commit: the catalog smoke test's
CatalogSpecgains aPlausibleentry ahead ofLSpec— the v4.33workspace pins LSpec with a new
plausibledependency, and thecataloguer is fail-closed about uncatalogued packages (and replays
dependencies before dependents).
Inherited from the branch (pre-existing, unchanged — see
HANDOFF.md):native-decide-dynlib,730f910a). Do not merge this PR until that branch merges to Blake3main; then re-pin.
lake test -- --ignored ixvmOOMs in the Aiur toplevel build(42–79 GB; diagnosis in HANDOFF §2.3). Not addressed here.
IxTcVerifyremains excluded from the--wfaillint driver(pre-existing decision; 331 ix-own warnings).
Commit 2 — fix(meta): module-mode files compile full-content envs
The regression (#569,
getFileEnvhonoring themoduleheader):module-mode header processing imports at
OLeanLevel.exported, and anexported-level env is not "the same env minus some private names" — it
is content-trimmed:
(probe on Init:
Nat.add_comm,Char.succ?_eq,List.length_appendallaxiom, no value);_private.*constants are absent entirely(Init: 14,457 → 2,148 at v4.29; 16,278 → 2,328 at v4.33);
@[expose]d def bodies survive.Compiling that env axiomizes imported proofs: kernel checks pass
vacuously, every address drifts from private-level compiles of the
same constants (catalog,
getCompileEnv, thePrimAddrspins), andbecause the exported view is level-closed, the groundedness scan sees
0 ungrounded — the corruption is silent. That is exactly the
tc-pins(_private...Char.succ?_eq._proof_1_8: resolves in env) andtc-accel-diff(accel≡pure address parity) failures on main.v4.33 relevance:
ConstantInfo.value?now defaultsallowOpaque := false(theorem values hidden at the API level — the"theorems effectively opaque" change). ix reads values by constructor
match everywhere (audited: zero bare
value?/hasValueuses), so onlythe import level matters — and at the private level, v4.33 theorem
bodies are fully present.
The fix — content and scoping are separated:
getFileEnvCore(new;getFileEnvkeeps its signature): alwaysimport classic/private — full content — and report the header's
modulebit.moduleVisibleNames: the exported-level name set, used forscoping only.
Ix.EnvScope(new module):collectDepsmoves here fromIx.Cli.ValidateCmd(namespaced, so tests can import it alongsideValidateAux's same-named top-level mirror —ParityEnvdrops itsinlined copy), plus
defaultConstList: classic files keep thewhole-env behavior byte-identically; module-mode files seed from the
visible surface + the file's own decls and close over the
full-content env. Referenced foreign
_private.*proof auxiliariesship (content is mandatory for groundedness, named rows for
decompile/tc lookups); unreferenced foreign privates stay out — the
qualified-package isolation TruthMines'
module-header-v1patchwanted, minus the corruption.
compile,compile-lean,validate,validate-lean,ingress) route throughdefaultConstList.ParityEnv.ensureis now fail-closed (allowPartial := false) —silent drops were how this regression hid.
How we validate theorem bodies are really exposed (kernel-checking
cannot detect axiomization — axioms typecheck vacuously — so the
assertions are kind/content/address-level):
Tests/Ix/MetaEnv(defaultlake test): for both header modes, theenv must hold imported
Nat.add_commas a.thmInfowhose proofrefs all resolve in the same env, with
_private.*present; anddefaultConstListmust scope names without trimming content(theorems stay theorems in the scoped list). Measured on the module
fixture: 51,981 visible seeds → 64,705 after closure < 65,995 full.
ParityEnvfail-closed: any missing referenced constant now abortsthe tc fixture compile instead of silently dropping named rows.
tc-parity.ixe:tc-pinsproves_private.*names resolve;tc-accel-diffproves address parity(addresses are transitive content hashes — they only converge on
real proof bodies);
tc-roundtripproves theorems survive to andfrom the artifact as theorems.
Commit 3 — fix(bench): lean4lean replay walks theorem proofs again
Benchmarks/Lean4Lean.leanvendors the replay machinery, and itsgetUsedConstantsused bareConstantInfo.value?— v4.33's newallowOpaque := falsedefault made theorem values invisible to it, soproof-only auxiliaries (the
._fstructural-recursion helpers, e.g.Nat.add_comm._f) were never walked and the kernel rejected everyreplayed theorem depending on one ("unknown constant").
constHasStrLithad the same blind spot. Both now pass
allowOpaque := true, mirroringthe fix the lean4lean fork itself ships in
Lean4Lean.Replayat pin4844eda4. (Thelean4leanignored gate never ran on the updatebranch, so this only surfaced in this PR's gate sweep. Repo-wide audit:
these were the only two bare
value?uses left —Ix/andTests/read values by constructor match.)
Verification
cargo check --workspacecargo fmt --checklake build(all default targets)lake test(default suites)cargo test --workspace --releasetc-parity.ixe, 6,254 consts)tc-pins8/8 — incl._private...Char.succ?_eq._proof_1_8in 773ms, the exact red on main;tc-accel-diff5/5 — the exactBitVec.toNat/Nat.decLeaddr-parity reds;tc-roundtripwhole-env (165,970 meta-checked);tc-tutorial274;tc-init;tc-anon-diff6/6lake test --wfail -- --ignored lean4leanlake lint -- --wfaillake test -- clicargo clippy --workspace --all-targets -- -D warningsnix build .#checks.x86_64-linux.clippy(the CI leg)One toolchain re-baseline surfaced by the fail-closed parity compile:
v4.33 moved
Std.DTreeMap.Internal.Impl.minKey!_eq_get!_minKey?toStd.Internal.List.minKey!_eq_get!_minKey?(unique rename, samestatement shape → same OOM-class pin coverage); the seed fixture and
Pins.leanlabel were updated in the merge commit.Performance impact
Module fix: zero change for classic files. Classic-header files
(every Benchmarks compile file, the mathlib path) short-circuit before
any new code runs — constant lists and artifacts are bit-for-bit
unchanged. Module-mode files' CLI default paths pay two new costs,
measured at real
Ix.leanscale (239k-const closure):importModules, transfers directly to the CLI)defaultConstList)collectDepsshape as routine--consts/--nsruns)Compile-input size for a module-mode file: the default scope is
201,595 consts — 16% smaller than the pre-#569 classic full dump
(239,424) and 24% larger than the trimmed 162,329 that current main
compiles. The
.ixegrows vs main because theorem proofs are actuallystored now — that is the artifact ceasing to be axioms, not overhead.
The lean4lean walker fix likewise just restores 4.29-equivalent work
(the "cheaper" broken walker skipped the proofs the replay then choked
on).
ParityEnv's fail-closed flip costs nothing (same compile, 1.36 senv-ready for 6,254 consts).
Toolchain bump (inherited). Core grew ~9% (Init at private level:
60,598 → 65,994 consts), so envs, imports, and compiles scale up
proportionally. No kernel performance-class regressions surfaced: the
tc pins — which exist as OOM/∞/perf-class guards — pass in 2–773 ms
against 60 s budgets, and the whole-env kernel roundtrip peaked at
34.3 GiB, in line with prior same-scale runs. Two caveats: the
inherited
ixvmignored-suite OOM (42–79 GiB in the Aiur toplevelbuild, HANDOFF §2.3) is the one genuine open perf problem, pre-existing
and untouched here; and the canonical mathlib-scale numbers (69 s Rust
compile, 3.16 GB artifact, validate RSS profiles) have no v4.33
counterpart yet — Benchmarks pins a 4.29 mathlib, so A7-scale perf is
unmeasurable until a 4.33-compatible mathlib exists. When it does,
expect wholesale content-address churn and cost-model drift (HANDOFF
already flags the repinned Slice FFT cost as stale): re-baseline,
don't compare byte-for-byte.
Downstream
derived instances flipped
def→theoremin v4.31,Float.Model,exposure changes, …) — re-baseline, don't debug (HANDOFF §3).
comes from seed scoping (
defaultConstList) instead of contenttrimming, so their qualified catalogs keep working while compiled
artifacts carry real proofs. Their closure-scoped compiles
(
--consts) can now resolve_private.*spellings again.