formalization: verify Ix.Tc and establish the Ixon v2 compiler refinement path - #594
Open
johnchandlerburnham wants to merge 16 commits into
Open
formalization: verify Ix.Tc and establish the Ixon v2 compiler refinement path#594johnchandlerburnham wants to merge 16 commits into
johnchandlerburnham wants to merge 16 commits into
Conversation
johnchandlerburnham
force-pushed
the
jcb/ix-formalization3
branch
from
August 25, 2026 16:23
158108e to
1d9242e
Compare
Member
|
!benchmark aiur-sharded-env |
Contributor
|
| constant | check-time (main) | check-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | constants (main) | constants (PR) | Δ% | shards (main) | shards (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ISLB |
1m 21.7s | 1m 23.0s | +1.6% | 2.24K | 2.21K | -1.5% | 94.18 GiB | 94.72 GiB | +0.6% | 183,062 | 183,062 | +0.0% | 151 | 152 | +0.7% |
samuelburnham
approved these changes
Aug 25, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR lands the current Ix formalization checkpoint on Lean 4.33.1 and the
published
argumentcomputer/lean4ixdevelopment line. It brings togetherthree connected pieces of work:
block transactions, and the currently supported inductive, projection, and
quotient slices;
and Rust while conservatively embedding ordinary Lean terms; and
production compiler execution, Ixon values and metadata arenas, wire
codecs, and Lean4Ix's independent
Theorysemantics.The compiler theorem is intentionally independent of Ix.Tc acceptance. The
checker and compiler now meet at the same Lean4Ix semantic endpoint, but a
compiler theorem cannot prove correctness merely by showing that the output
checker accepts its own encoding.
This is a foundation checkpoint rather than the end of the compiler roadmap.
It proves the ordinary, surgery-free expression path and the first complete
codec domains; whole declarations, mutual blocks, whole environments,
canonical-address invariance, richer mode-producing compilers, and production
Rust refinement remain later milestones.
Why this is one PR
These changes share one representation and trust boundary:
checking admits valid Lean4Ix declarations.
Ixon output has the same independently stated value.
semantics, metadata, and byte grammar must be represented consistently in
Lean, Rust, ingress, decompilation, tests, and proofs.
Landing only one layer would either leave the new format without its semantic
bridge or leave the proofs pinned to the obsolete representation. This stack
keeps the format transition, production behavior, semantic relations, and
trust audits reviewable at the same commit boundary.
Main changes
1. Lean 4.33.1 and Lean4Ix integration
argumentcomputer/lean4ixata4188d7c2979378d85c6bb41fdd96c3a48a71371. The Lake package and Leannamespace remain
lean4lean/Lean4Leanfor source compatibility.leanprover/lean4:v4.33.1.certificate, nested-block, projection, and checker surfaces.
main's plan-head arity audit,eta-adapter metadata, self-contained catalog work, and compiler/kernel
changes.
removed the transitive dependency on
Lean4Lean.ptrEqExpr_eqfrom theproduced-generation transaction roots.
2. Audited Ix.Tc verification checkpoint
The
Ix.Tc.Verifytree connects the production checker toLean4Lean.Theorythrough explicit translation, state, cache, collision, andworld-extension invariants. The public checkpoint includes:
TcM.checkConstpath, including concrete promotion from pending to trustedsemantic worlds;
invariant that constrains only successful executions;
block-cache publication, and the anonymous-environment driver;
projection, and bounded-recursion interfaces used by those public roots;
checking schedule is related to an independently justified semantic
topological schedule;
fixtures, including constructor positivity and validation traversals;
member checking, rule comparison, and atomic family/recursor admission;
LeanBox/LeanTreenested transaction, with restoredrecursors and rules, both production block checkers, exact restored iota
patterns, and no surviving flat auxiliary declaration;
Eq/K-target fixtures that preserve recursor universelayout and the generated K bit;
semantics, including substitution, universe instantiation, and a concrete
dependent-record projection; and
the real production executions while taking the still-upstream semantic
transactions as explicit theorem inputs.
The production checker changes associated with this proof work also fail
closed when a coordinated block body disappears and avoid falling through to
a second standalone check after coordinated handling.
The inductive implementation is factored into proof-visible stages and kept
aligned with Rust. The main hardening points include checked metadata sums,
nested-application arity checks, specialization-aware auxiliary deduplication,
block-level recursor construction, complete-type selection for auxiliary
recursors, canonical peer-header checks, and exact type/rule/K-target
comparison before accepting stored recursors.
This is not an unconditional claim about every Ix.Tc feature. The exact
completed manifest contains 2,034 theorem roots. A separate one-root
conditional manifest names the two remaining mutual-recursion witnesses:
Ix.Tc.Upstream.Pending.mutualTreePhysicalGenerationWFIx.Tc.Upstream.Pending.mutualTreePhysicalRulePatternSoundQuotient bridges similarly receive their semantic transaction/law resources
as parameters; Ix does not manufacture those resources with a new global
axiom. Remaining Lean4Ix metatheory debt is recorded by exact transitive
origin rather than duplicated or hidden locally.
3. Ixon v2 binder modes and wire format
Ixon expressions now carry substructural intent directly:
Uses(erased,linear,affine, ormany);UsesandOwned(uniqueorshared);many;many/shared.The stable format id is
ixon-v2;.ixeenvironment version 2 begins withthe
0xE2header. The Lean and Rust readers/writers agree on the new modebytes and maximal lambda/forall telescope grammar. They reject invalid mode
bits, noncanonical nested telescopes, invalid Boolean let flags, trailing
bytes in full-buffer decoders, and incompatible environment versions.
All affected in-repo consumers are ported, including production compilation,
Lean and Rust decompilation, anonymous and metadata ingress, sharing,
typechecking, FFI conversion, tests, and documentation. Existing v1
.ixeartifacts must be regenerated; the version error reports that requirement
directly.
The Aiur IxVM is now a first-class v2 consumer as well. Its internal Ixon
schema carries the same
UsesandOwnedfields, its deserializer validatesthe exact v2 mode ranges and Boolean let flag, and its reader rejects
non-maximal App, lambda, and forall telescopes. Its serializer emits the modes
again, so
Revealchecks the address of the exact committed v2 expression;the modes are erased only afterward when converting into the current
mode-agnostic kernel expression representation.
Because binder bytes participate in content addressing, the v2 transition
also rekeys canonical declarations. This checkpoint regenerates the canonical
Rust primitive-address table, the Lean typechecker table, every Aiur IxVM
primitive literal, the generated 5.8 MB Rust Aiur kernel, and the affected FFT
cost pins. The legacy/original primitive table and the synthetic
eagerReducemarker remain unchanged. Address-parity tests scan the elaboratedAiur AST, including the formerly inline
Eqaddress, so an unlabelled staleliteral cannot bypass the table comparison.
The IxVM coverage includes a positive hash-bound
Revealfixture containinglinear, affine, and erased usage plus unique/shared ownership. Raw committed
fixtures exercise the negative boundary for reserved mode bits, non-Boolean
let flags, and non-maximal App/lambda/forall telescopes.
The semantic bridge proves that erasing v2 modes is constructive in both
directions for the related ordinary Lean fragment. This PR does not yet make
the Lean compiler infer or exploit linear/affine/unique modes; its current
output deliberately inhabits the conservative
many/sharedsubset.4. Independent compiler semantics
This PR adds
IxCompileVerifyas a separate, non-default Lean library. Itsstatement frontier deliberately does not import checker acceptance as the
compiler specification.
The new source/target model includes:
IxonExprRel, a table-aware relation from Ixon expressions to Lean4IxVExprvalues;literals, lambdas, foralls, lets, metadata erasure, and projections;
SourceExprRelfor named Ix source syntax and an explicitKernelSourceWitnessboundary, without treating the production compiler ordecompiler as a semantic oracle;
Catalogwith explicit canonical, anonymous-operational,metadata-sidecar, and decompile-only views;
Catalog.WF, table resolution, ordered sharing resolution, projectionaddress integrity, and explicit digest/key-faithfulness assumptions; and
outputs preserve the independent Lean4Ix value.
Hash-map and content-address assumptions are scoped to finite run support.
They are theorem premises, not implicit claims that cryptographic collision
freedom follows from Lean's
BEqimplementation.5. Production compiler refinement
The production compiler now exposes kernel-visible total paths for the part
covered by this checkpoint:
CompileM.compileUnivis structurally total and refines the referenceuniverse compiler through
CompileM.run.memos, and the independent Lean4Ix universe value.
CompileEnv.surgeryFreeselects a totalcompileExprNoSurgerypath when noordinary,
brecOn, orbelowcall-site plans are present.compiler; the merge preserves main's plan-head arity checks and eta adapter
behavior.
spine, arena allocation order, cache lookup/insertion behavior, local mutual
references, external references, arbitrary universe vectors, literals,
projections, binders, lets, and metadata. Lean/Rust equality remains checked
by the differential gates below.
The refinement proof is layered rather than monolithic:
warm expression cache;
constants, universes, literals, and projections across the complete
recursive ordinary-expression tree;
ArenaRelconnects the returned metadata root to the source expression;cost, with
UInt64no-wrap stated explicitly; andindependent Lean4Ix expression value.
Call-site surgery itself is not claimed by these theorems. The public
dispatcher is proved only under
CompileEnv.surgeryFree; plan-bearingbehavior remains protected by the existing differential tests while its
formal refinement is future work.
6. Metadata and presentation-store refinement
Expression metadata is no longer restricted to empty maps in the verified
ordinary path.
serializeIxSyntaxis structurally total and has an exactreference/run theorem.
source spans, pre-resolved identifiers, nested syntax arrays, and final
serialized syntax blobs.
compileDataValueandcompileKVMaprefine their total reference encoderswhile changing only presentation-side name/blob stores.
the finite metadata traversal, preserves old lookups, and proves recovery
of every collected name, ancestor name component, and blob payload.
This separation is intentional: anonymous semantic preservation does not
inherit stronger metadata-key assumptions merely because a source expression
contains presentation data.
7. Total Ixon codec foundations
The production Lean universe and expression writers/readers are now
kernel-visible total definitions.
For universes, this PR proves:
Tag2forms; andSort 1universe required by the first declaration fixture.For expressions, this PR proves:
Tag0andTag4inverse laws;singleton-spine, empty-universe-vector domain.
That expression domain contains the
A : Sort 1type and both the type andvalue shapes of
idA : A -> A. Nonempty universe-index vectors and maximalApp/lambda/forall telescope round trips remain the next X1 codec slice; this
PR does not claim the full expression wire theorem yet.
8. Exact trust manifests
Trust is checked per exported theorem root rather than summarized informally.
Ix.Tc.Verify.Audit.Completed: 2,034 completed roots.Ix.Tc.Verify.Audit.Conditional: one root with exactly named pendingdependencies.
Ix.Tc.Verify.Audit.Statements: seven statement/frontier roots.Ix.Compile.Verify.Audit.Statements: 47 compiler roots.that directly uses
sorryAx.Each root records its exact standard axioms, native axioms, upstream
sorryAxorigins, pending assumptions, and forbidden dependencies. The auditfails both when an unlisted dependency appears and when a stale expected
dependency disappears. The compiler statement frontier independently relates
source and Ixon values and does not use checker acceptance as its semantic
specification.
The conditional Ix.Tc audit is added to the merge workflow.
IxCompileVerifyremains deliberately separate and non-default, so its focused build/audit
command is included below.
Compatibility and operational impact
.ixev1 artifacts are not accepted as v2 and mustbe recompiled.
contain binders receives a new v2 address. Canonical primitive tables and
fixtures in this repository have been regenerated; external catalogs,
claims, caches, and address-pinned artifacts must be rebuilt.
(
many/shared) and passed Lean/Rust byte-differential checks.surgical implementation; main's eta adapters and plan-head validation are
preserved.
recursor peers, missing generated recursors, and mismatched recursor
metadata/rules now fail closed.
the content-address boundary, rejects noncanonical encodings, and erases
binder modes only when entering the current kernel AST.
multi-STARK algorithms and codecs are unchanged. Their inputs are not:
regenerated Ixon addresses and the changed guest/kernel programs invalidate
cached Aiur proofs and any SP1/Zisk proof or verification-key material tied
to the prior program bytes. Those artifacts must be regenerated rather than
translated.
runtime build. They are built explicitly for formalization and trust
auditing.
native-reduction, upstream theorem, or semantic-transaction premise into a
proved fact.
Validation
The merged branch was validated at
158108e6with the following commands.Default build
Result: passed, 301 jobs.
Ix.Tc proof and trust frontier
Result: passed, 620 jobs; 2,034 completed roots, one conditional root, seven
statement roots, and no Ix.Tc verification source declaration using
sorryAx.Compiler proof and trust frontier
Result: passed, 99 jobs; 47 exact theorem roots and no compiler-verification
source declaration using
sorryAx.Lean/Rust auxiliary compiler differential
nix develop --command lake test -- --ignored aux-gen-diffResult: passed all plain-drift, expansion, patch, plan, driver, and parallel
gates. Lean and Rust produced identical 6,893,510-byte environments.
Ingress corpus
nix develop --command lake test -- --ignored tc-ingress-metaResult: passed all seven corpus groups:
nat-add,list-map,nat-arith,eq-basics,bool-decide,char-ordinal, andinductives-recursors.Decompiler differential
nix develop --command lake test -- --ignored decompile-diffResult: passed for 6,615 constants with zero errors or mismatches: 3,969 plain
constants and 2,646 auxiliary constants. Call-site replay and plan parity
gates also passed.
Ixon codec and parity suite
nix develop --command lake test -- ixonResult: passed the full Ixon syntax/codec suite, including v2 mode vectors,
malformed-input rejection, and Lean/Rust byte parity.
IxVM generated kernel and security boundary
Result: generated Aiur sources were current; canonical and original primitive
address parity passed across Rust, Lean, and 89 named Aiur literals; and the
full ignored IxVM suite passed. The latter includes all kernel execution and
interpreter/native parity cases, every regenerated FFT cost pin, the shard
pipeline pin (
6,859,583,032), the positive v2 binder-modeReveal, and allsix malformed-v2 rejection fixtures.
Cryptography and recursive-verifier regression suite
nix develop --command lake test -- \ aiur-hashes claim merkle assumption-tree multi-starkResult: passed BLAKE3 and SHA-256 execution/proving vectors, claim and
assumption-tree codecs, Merkle properties, and the multi-STARK PCS, challenger,
FRI, reduced-opening, and field-arithmetic reference comparisons.
Rust workspace check
Result: passed, including
ixon,ix-kernel,aiur,multi-stark,ixvm-codegen,ix-compile, and the FFI crates.The SP1 and Zisk guests depend on the shared
ixon,ix-kernel, andix-commoncrates, so their CI jobs must rebuild their guest ELFs and derivefresh program verification keys. Those specialized guest toolchains were not
run locally; the ordinary Rust workspace check does not compile the excluded
zkVM targets.
The final merge also passed
git diff --checkand contained no unresolved Jjconflict markers.
Suggested review order
The branch is intentionally split into reviewable commits:
8a17a72049f2dd43f5660b1bd1eae96b6fece5925a077b945cc3d4afcac72b912f205d5ffa449102fd1a7417fee3b893df7d67cbaa286acc6f18ea90158108e6A practical review sequence is:
Non-goals and follow-up work
This PR does not claim:
environment;
quotient semantic resources still assigned to Lean4Ix;
binder modes;
telescopes;
theorems (X3-X5);
reference pipeline (X7); or
The next bounded compiler slice is to extend the expression codec theorem to
nonempty universe-index vectors and maximal App/lambda/forall telescopes, then
lift the
A/idAfixture through declaration bytes and content addresses.The typechecker track can continue independently by replacing the remaining
conditional Lean4Ix resources with constructive definitions and proofs as
they become available.