Skip to content

IxVM kernel: six divergence fixes from sharded env checking - #510

Merged
arthurpaulino merged 5 commits into
mainfrom
ap/ixvm
Jul 22, 2026
Merged

arthurpaulino merged 5 commits into
mainfrom
ap/ixvm

Conversation

@arthurpaulino

Copy link
Copy Markdown
Member

Summary

This branch fixes six divergences between the IxVM Aiur kernel
(Ix/IxVM/*.lean) and the Rust kernel (crates/kernel/src/*.rs), found by
shard-checking whole environments: ix compile → ix profile → ix shard → ix check --ixe <env> --ixes <manifest> --shard K, debugging each rejected
constant down to the exact kernel-code divergence and mirroring the Rust
behavior.

With these fixes the IxVM kernel accepts, end to end:

  • Init (60,598 consts): 2/2 shards
  • Lean (159,741 consts): 4/4 shards

Every fix ships with a pinned-FFT-cost driver in the ixvm test suite
(Tests/Ix/IxVM.lean, lake test -- --ignored ixvm), currently green at
644 assertions.

Fixes (one commit each)

  1. nat offset-stuck head + limb-boundary literal normalization
    Offset-stuck Nat.div/Nat.mod applications reduced with a corrupted
    head, and klimbs_normalize mis-normalized literals exactly at limb
    boundaries.

  2. trailing identity marker in canonical aux order
    compare_aux_view ignored the trailing identity marker when comparing a
    recursor's canonical aux order, accepting/rejecting the wrong aux
    permutations.

  3. rec-field classification without a local-binder whnf context
    is_rec_field peeled binders with a whnf context carrying local binders;
    the Rust kernel classifies each peel in an empty context. Divergence
    surfaced via ctx-trim frame well-formedness.

  4. aux occurrence-universe shift + primary-type param peel
    Two divergences in nested-inductive aux handling: occurrence scanning ran
    before instantiating the ctor type at the occurrence universes
    (expr_inst_levels), and recursor-type construction peeled params from
    the member's own type instead of collect_n_doms_whnf over the primary's
    type.

  5. exact mirror of the Rust max-level constructor
    level_max factored Succ out of Max nodes; Lean/Rust store
    Type (max u v) with Succ distributed into the Max
    (max (u+1) (v+1)) and the kernel must preserve that shape. Rewritten as
    an exact mirror (explicit-numeral collapse, zero absorption, subsumption,
    offset comparison), with structural equality (level_struct_eq) rather
    than pointer inequality anywhere a "different data" conclusion is needed —
    pointer inequality never implies data inequality.

…ization

Two defects in the Const-head nat dispatch, found via a shard-scale
CheckEnv run whose def-eq on UTF-8 decoder proofs (heavy in `x >>> k`
over symbolic bases) ran the kernel into an unbounded delta cascade
(single core pinned, RSS past 250 GB).

1. try_nat_offset_dispatch routed div/mod through mk_nat_offset_stuck,
   which builds the ADD-offset shape — rewriting `x / n` into `x + n`.
   Wrong value: offset-aware def-eq could equate /- and +-derived forms
   (unsound), and multi-route `x >>> k` comparisons arrived as
   mismatched offsets, falling through to full delta-unfolds of the
   division algorithm on symbolic args. Div/mod stuck forms now keep
   their own head via mk_nat_binop_stuck; the add-offset builder stays
   shared with the linear-rec collapse. Suite driver: Nat.shiftRight_succ
   (the succ-step unfold of `>>>` into a symbolic-base div).

2. nat_lit_to_ctor_or_self dropped klimbs_normalize on the decremented
   literal. Dec at a limb boundary (2^32 = [0,1] -> [0xFFFFFFFF, 0])
   leaves a trailing zero limb, so the ctor-exposure countdown reaches a
   Cons-shaped zero and decrements past it forever. Same normalization
   restored in try_nat_dispatch's pred arm, which had the identical
   latent hazard. Suite driver: IxVMPrim.nat_cases_big (Nat.casesOn on
   a 2^32 literal).

Codegen regenerated; FFT pins re-bumped (drift <= 0.005% from the extra
normalize rows + the offset circuit's head-preserving arm). The formerly
hanging shard CheckEnv repro completes in 19s — 6x faster than with the
offset relocation reverted, so the relocation is a real win once the
stuck forms are value-correct. `lake test -- --ignored ixvm` green
(608 assertions).
The Aiur mirror of inductive.rs canonical_aux_order compared aux views
by n_indices, ctor count, view ind type, and pairwise ctor views — but
omitted the trailing identity marker (the ext inductive applied to its
occurrence universes and spec params) that both the compiler and the
Rust kernel append as a final synthetic ctor. Aux members whose field
views tie weak through sentinels (structurally identical wrappers over
different nested containers) then fell to weak ordering by the field
targets' refinement-class indices, which can disagree with the marker's
external-address order — transposing flat-block members relative to the
stored recursor type and rejecting valid recursors with a canonical-
type def-eq mismatch.

Observed on Lean.Json.rec (flat block: Json + Array/List and
TreeMap.Raw/DTreeMap.Raw aux chains — the Array_1/TreeMap_Raw_2 pair
tied and swapped). Latent since the aux-order port: fails identically
back to the first mathlib shard validation; that partition simply never
placed a Json-block recursor in a checked position. The Rust kernel was
unaffected (its marker was already in place).

Fix mirrors the marker as a final comparison in compare_aux_view: NOT
sentinel-rewritten, so distinct exts (or phantom-distinct spec params
over one ext) order strongly by external address while address-equal
spec params still collapse. The inductive_check quotation now needs an
explicit maxRecDepth — it was already at the elaborator's default limit.

Suite: IxVMInd.AuxTie — same-shaped wrappers over same-shaped cells
with Char vs Int payloads, verified to fail on the pre-marker kernel —
pinned alongside re-bumped nested-inductive pins (Lean.Json.rec itself
measures ~68G FFT, far too heavy to pin). Codegen regenerated.
`lake test -- --ignored ixvm` green (620 assertions); Lean.Json.rec
passes solo and in the shard CheckEnv repro.
is_rec_field built a whnf context from the peeled binder doms of the
field being classified (peel_leading_foralls, then whnf under
reverse(doms) ++ types). For a parameterized inductive whose ctor field
references the params under local ∀-binders — e.g. a Prop class
`C (pat) [inst] where f (s t) : P pat s → ...` — those doms carry
caller-frame param refs (build_minor_at_depth substitutes ctor params
with minor-frame BVars), so a stored type's loose range exceeds the
depth below it. That violates ctx-trim's documented frame
well-formedness invariant and runs the valid-cut walk off the end of
the context (ctx_next_cut on Nil: "no match case"). Zero-field large
eliminators (Eq/HEq) and parameterless nested inductives (Syntax,
Json) never trip it; Init's slice-pattern Prop classes do.

Mirror inductive.rs is_rec_field faithfully: whnf and peel ONE Forall
at a time, with NO local-binder context — the body's loose BVars are
stuck under whnf either way. Per-peel whnf also exposes binders hidden
under definitional wrappers, which the old peel-then-whnf missed.

Suite: String.Slice.Pattern.Model.NoPrefixForwardPatternModel.rec
pinned as the regression driver; FFT pins re-bumped (drift <= 0.003%
both directions from the per-peel whnf's changed memo profile).
Codegen regenerated. `lake test -- --ignored ixvm` green
(626 assertions).
Two canonical-recursor-construction defects surfaced by shard-checking
the Lean compiler env (4-way CheckEnv partition; the Rust kernel
accepts both constants).

1. Nested-occurrence detection scanned ORIGINAL members' ctor types
   without instantiating their level params, so aux flat members stored
   raw block-frame universe args. Under a large eliminator
   (univ_offset = 1) every minor built from an aux member then
   referenced the wrong universe — canonical `TaggedText.{Param 0}`
   against the stored recursor's `{Param 1}` — failing the rec-type
   def-eq for universe-polymorphic nested inductives. Mirror the Rust
   queue scan: instantiate ctor types with the member's occurrence
   universes (the univ_offset-shifted range for originals) before
   scanning, so detected occurrences inherit rec-frame levels.
   Driver: Lean.Widget.TaggedText.rec.

2. build_rec_type peeled the param binders from SELF's inductive type
   under self's occurrence universes. The params of the recursor
   telescope belong to the PRIMARY inductive (mirror: inductive.rs
   walks `ind_infos[0].4` under the first inductive's shifted
   universes, whnf per step, tolerant of running out of binders) — for
   aux-member recursors, peeling self's ext type with the primary's
   param count walked past the end of the type ("no match case" on a
   Sort in collect_n_doms). New collect_n_doms_whnf: whnf-tolerant
   peel over the primary's instantiated type.
   Driver: Lean.Doc.Part.rec.

Suite: both drivers pinned; FFT pins re-bumped (broad drift <= 0.005%
from the per-peel whnf and level-instantiation rows). Codegen
regenerated. `lake test -- --ignored ixvm` green (638 assertions).
Lean-env shards 2 and 3 now pass (0 and 1 still fail on a further
divergence, tracked separately).
level_max diverged from level.rs KUniv::max in three ways:

1. It FACTORED Succ out of Max (`max(a+1, b+1) → (max a b)+1`). Lean
   stores type-former levels with Succ distributed INTO Max
   (`Type (max u v)` elaborates level `max (u+1) (v+1)`), and Rust's
   constructor preserves that shape. Factoring rebuilt Succ-headed
   levels whose variant rank (Zero < Succ < Max < IMax < Param)
   differs, so the canonical aux-order comparator ranked members
   differently from the compile-side sort in blocks whose aux view
   sorts mix Succ-headed and Max-headed levels — e.g. Lean.Doc.Block's
   Array auxes (`Sort (max u v)+1`) vs its DescItem aux
   (`Sort (max (u+1) ((max u v)+1))`) — permuting the flat block
   relative to the stored recursor and failing the rec-type def-eq.

2. It collapsed equal operands via NORMALIZED equality where Rust uses
   raw structural equality, over-collapsing shapes Rust keeps.

3. It lacked Rust's remaining simplifications: explicit-numeral
   collapse, max-subsumption (`max(a, max(a, b)) = max(a, b)`), and
   same-base offset collapse (`succ^n(x)` vs `succ^m(x)`).

Rewritten as a faithful mirror: explicit numerals by value, structural
equality via level_struct_eq (pointer equality is a sound fast path,
but pointer INEQUALITY does not imply distinct data — the fallback
compares values recursively), zero absorption, subsumption, same-base
offsets, and a raw Max node otherwise — no factoring.

Suite: Lean.Doc.Block.rec pinned as the regression driver; the
constructor runs under every level in the kernel, so every FFT pin
re-bumped (drift <= 0.15% both directions). Codegen regenerated.
`lake test -- --ignored ixvm` green (644 assertions).
@arthurpaulino

Copy link
Copy Markdown
Member Author

!benchmark

@argument-ci-bot

argument-ci-bot Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

!benchmark — main vs 3056945

backends: aiur=prove · envs: InitStd · set: primary · shard: 0

aiur · InitStd · prove — main from: base run @ 86c7927 (not on bencher)

constant prove-time (main) prove-time (PR) Δ% throughput (const/s) (main) throughput (const/s) (PR) Δ% peak-ram (main) peak-ram (PR) Δ% execute-time (main) execute-time (PR) Δ% verify-time (main) verify-time (PR) Δ% proof-size (main) proof-size (PR) Δ% fft-cost (main) fft-cost (PR) Δ%
Array.extract_append 39.536 s 39.093 s -1.1% 43.150 43.640 +1.1% 58.83 GiB 58.59 GiB -0.4% 10.538 s 10.570 s +0.3% 172.2 ms 172.8 ms +0.4% 25.93 MiB 26.22 MiB +1.1% 36.16B 36.16B -0.0%
ByteArray.utf8DecodeChar?_utf8EncodeChar_append OOM 38.687 s n/a OOM 74.700 n/a OOM 64.30 GiB n/a OOM 9.190 s n/a OOM 177.6 ms n/a OOM 26.30 MiB n/a OOM 38.09B n/a
Char.ofOrdinal_le_of_le OOM 30.191 s n/a OOM 94.800 n/a OOM 50.44 GiB n/a OOM 6.708 s n/a OOM 180.7 ms n/a OOM 26.24 MiB n/a OOM 29.13B n/a
Vector.extract_append._proof_2 22.857 s 22.934 s +0.3% 63.040 62.830 -0.3% 33.78 GiB 33.64 GiB -0.4% 5.777 s 5.795 s +0.3% 165.9 ms 161.6 ms -2.5% 25.60 MiB 25.89 MiB +1.1% 21.16B 21.16B -0.0%
_private.Init.Data.Range.Polymorphic.SInt.0.Int64.instRxcHasSize_eq OOM 18.736 s n/a OOM 105.300 n/a OOM 32.12 GiB n/a OOM 3.476 s n/a OOM 166.2 ms n/a OOM 26.06 MiB n/a OOM 15.70B n/a
String.split 17.669 s 17.771 s +0.6% 110.310 109.670 -0.6% 30.14 GiB 31.51 GiB +4.6% ⚠️ 3.138 s 3.122 s -0.5% 164.2 ms 163.4 ms -0.5% 25.94 MiB 26.22 MiB +1.1% 14.21B 14.21B -0.0%
List.mergeSort 12.382 s 12.395 s +0.1% 129.060 128.920 -0.1% 19.62 GiB 20.00 GiB +2.0% 2.310 s 2.240 s -3.0% 🟢 176.6 ms 175.6 ms -0.5% 25.83 MiB 26.11 MiB +1.1% 10.49B 10.45B -0.4%
Vector.append 4.232 s 4.344 s +2.6% 133.760 130.310 -2.6% 6.33 GiB 6.34 GiB +0.1% 591.4 ms 600.9 ms +1.6% 153.6 ms 153.5 ms -0.1% 24.46 MiB 24.71 MiB +1.0% 2.21B 2.21B -0.0%
Nat.gcd_comm 3.537 s 3.569 s +0.9% 117.340 116.280 -0.9% 6.36 GiB 6.09 GiB -4.2% 🟢 471.9 ms 468.4 ms -0.7% 152.4 ms 161.3 ms +5.9% (1.06× slower) ⚠️ 24.15 MiB 24.32 MiB +0.7% 1.56B 1.56B +0.0%
String.append 2.721 s 2.689 s -1.2% 129.740 131.260 +1.2% 4.81 GiB 6.57 GiB +36.7% (1.37× larger) ⚠️ 350.6 ms 350.8 ms +0.0% 145.6 ms 145.6 ms -0.0% 23.32 MiB 23.57 MiB +1.1% 868.57M 868.67M +0.0%
Int.gcd 2.213 s 2.303 s +4.1% ⚠️ 103.460 99.430 -3.9% ⚠️ 4.77 GiB 5.80 GiB +21.7% (1.22× larger) ⚠️ 287.9 ms 288.7 ms +0.3% 152.4 ms 153.6 ms +0.7% 23.06 MiB 23.22 MiB +0.7% 538.98M 539.07M +0.0%
Nat.sub_le_of_le_add 2.117 s 2.114 s -0.2% 89.740 89.880 +0.2% 4.62 GiB 5.69 GiB +23.2% (1.23× larger) ⚠️ 276.1 ms 278.8 ms +1.0% 151.7 ms 142.9 ms -5.8% (1.06× faster) 🟢 23.54 MiB 23.70 MiB +0.7% 451.46M 451.52M +0.0%
Nat.add_comm 1.172 s 1.220 s +4.1% ⚠️ 43.510 41.800 -3.9% ⚠️ 4.04 GiB 4.19 GiB +3.6% ⚠️ 192.0 ms 194.1 ms +1.1% 141.4 ms 139.3 ms -1.5% 21.90 MiB 22.15 MiB +1.1% 48.86M 48.90M +0.1%
Std.Tactic.BVDecide.BVExpr.bitblast.goCache_Inv_of_Inv._mutual OOM OOM n/a OOM OOM n/a OOM OOM n/a OOM 55.574 s n/a OOM OOM n/a OOM OOM n/a OOM 205.13B n/a

14 constants · 6 with regressions · 3 with improvements (|Δ| > 3.0% on any metric).

Workflow logs

@arthurpaulino
arthurpaulino enabled auto-merge (squash) July 22, 2026 21:08
@arthurpaulino
arthurpaulino merged commit 41964fe into main Jul 22, 2026
10 checks passed
@arthurpaulino
arthurpaulino deleted the ap/ixvm branch July 22, 2026 21:12
samuelburnham added a commit that referenced this pull request Aug 18, 2026
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.
samuelburnham added a commit that referenced this pull request Aug 18, 2026
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.
samuelburnham added a commit that referenced this pull request Aug 18, 2026
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.
johnchandlerburnham added a commit 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants