Translating Real Rust Code Into Math Checked by Six Independent Judges
Closing the Specification-to-Binary Trust Gap: Zero-Axiom Rust-to-Lean Functional Extraction and Six-Kernel Proof Replay
Addressing the two residual failure modes of formal verification—human model-to-code transcription drift and single-checker kernel or axiom blind spots—through zero-axiom Charon/Aeneas Rust extraction, paired constructive boundary witnesses, and six-kernel independent Lean 4.36.0 proof replay.
David Charlot, Open Interface Engineering
Translating Real Rust Code Into Math Checked by Six Independent Judges
Hand-writing a math model beside your code leaves room for copy-paste drift, and trusting one proof checker risks a tool bug—extracting the real Rust compiler tree into Lean and replaying every theorem across six independent checkers closes both gaps.
Think of scanning the actual steel bridge beams directly from the factory floor rather than trusting an early pencil sketch—and then having six rival engineering firms verify every load calculation inside sealed rooms.
Machine-checked theorems in Lean 4 give strong assurance about security boundaries, numeric exactness, and microkernel isolation.
Two subtle trust gaps remain in ordinary formal verification: a human-written Lean specification can drift away from the shipping Rust code, and a single proof kernel or shortcut tactic (like `CVE-2026-72844` / `ofReduceBool`) can harbor a soundness bug.
We extract production `#![no_std]` Rust crates directly through Inria `Charon` and `Aeneas` into pure Lean 4 functions, pair safety theorems with constructive `sat`/`unsat` boundary witnesses to forbid vacuous hypotheses, and replay all `144` hardware/Quad-Stack theorems (`6,900+` fleet theorem constants) across `6/6` independent sandboxed Lean `4.36.0` kernels with `0` `sorry`, `0` `Classical.choice`, and `0` custom axioms.
`144` hardware-invariance & Quad-Stack theorems (`41 + 103`) and `6,900+` fleet theorem constants mechanically checked across `6/6` independent `bubblewrap`-sandboxed Lean `4.36.0` kernels with `0` `sorry`, `0` `Classical.choice`, `0` `ofReduceBool`, and `0` custom axioms (`unmetered` formal verification).
- Instead of hand-writing a separate math model that might drift from real code, Inria Charon and Aeneas translate actual no-std Rust compiler intermediate code into Lean 4 with zero opaque axioms.
- All seven extracted Rust kernels are machine-checked for total panic-freedom, integer overflow safety, and exact mathematical refinement alongside constructive counterexamples where bounds break.
- Every proof term is replayed from scratch across six independent verifiers—Lean paranoid, lean4lean, nanoda, con-leche, con-ron, and Lean default—across more than 58,600 declarations.
Depth 2 · Visual & Hands-On
Interactive Simulator, How to Prove Us Wrong & Late-2026 Literature
Step Deeper ▾
Adjust parameters live in your browser (zero cloud wait) or step through a guided 4-step Predict → Break → Repair → Verify lab.
Identify any theorem in `hardware-invariance` or `aios-quadstack-proofs` whose `#print axioms` output is non-empty (`!= ∅`), whose boundary hypotheses are unsatisfiable, or that is rejected by any of the 6 independent Lean 4.36.0 kernels.
Shows how machine-checked Lean formalization exposes unstated boundary assumptions that informal reasoning misses.
Depth 3 · Builder & Evidence
Signed [G0–G12] Source Sheet, Hardware Telemetry, Code & Citation
Inspect Receipts ▾
Cite this
Genre: Research paper: formal verification, Rust-to-Lean functional extraction, constructive boundary witnesses, and multi-kernel proof replay
David Charlot, Open Interface Engineering. Closing the Specification-to-Binary Trust Gap: Zero-Axiom Rust-to-Lean Functional Extraction and Six-Kernel Proof Replay. Open Interface Engineering. Web: https://research.openie.dev/papers/rust-to-lean-six-kernel-extraction/. PDF: https://research.openie.dev/pdfs/rust-to-lean-six-kernel-extraction.pdf. Markdown: https://research.openie.dev/papers/rust-to-lean-six-kernel-extraction.md.
You already have the plain-words guide above. Expand the formal manuscript whenever you want every equation, table, and proof.
Closing the Specification-to-Binary Trust Gap: Zero-Axiom Rust-to-Lean Functional Extraction and Six-Kernel Proof Replay
Revision e1f71e37, 1 December 2026. Companion bridge: Software Automation Pipelines. Data and code: research.openie.dev/data/ · Replication Kits.
Abstract
Machine-checked formal proofs in interactive theorem provers (Lean 4, Rocq/Coq, Isabelle Higher-Order Logic (HOL), Agda) eliminate logical deduction errors relative to stated definitions, yet real-world high-assurance systems still suffer subtle semantic failures through two residual trust gaps: (i) model-to-implementation transcription drift, when engineers or autoformalizing language models write an idealized mathematical model in a proof assistant while shipping a separate Rust or C implementation whose fixed-width integer casts, modulo sign rules, or overflow branches diverge from the idealized spec; and (ii) single-checker and hidden-axiom blind spots, when a proof silently relies on unverified external axiom declarations, compiler-trusting reflection (native_decide / Lean.ofReduceBool), non-constructive classical choice (Classical.choice), vacuous preconditions (false -> P), or an implementation bug in a single proof-checking kernel.
This paper presents the verification architecture developed across waiOS (waiOS-H27 and waiOS-H28), lut-adapt, and the Reality Code Engine (RCE) to close both trust gaps simultaneously. First, #![no_std] #![forbid(unsafe_code)] production Rust functions are lowered directly from rustc Mid-Level Intermediate Representation (MIR) via Inria’s Charon into Low-Level Borrow Calculus (LLBC) and translated by Aeneas -backend lean into pure monadic Lean 4 definitions (WaiosRingsVerify_Aeneas.lean, Secure Hash Algorithm 256 (SHA-256) digest ee3c1d522d467b16ce8bd1666fafe411b2fb7f24d7075870010641038f7665c2) containing 0 external axiom declarations across all 7 extracted core functions. Second, every mathematical safety bound is enforced under a constructive choice-free discipline (0 sorry, 0 Classical.choice, 0 Quot.sound, 0 ofReduceBool) and paired with an explicit constructive failure/tightness witness one step beyond the hardware boundary (16,777,217 binary32 round-to-nearest-even rounding witness; ±1,890,071,541 redundant-residue Hamming-distance collapse ; and 9-tap -145,161 < -131,072 Xilinx digital-signal-processor slice (DSP48E2) dual-lane crosstalk overflow witness), making vacuous specifications impossible. Third, compiled proof environments (58,649 declarations in waiOS-H27, scaling to 144 waiOS theorems, 218 lut-adapt theorems, and 5,393 RCE theorem constants) are replayed independently inside isolated sandboxes across six distinct proof checkers (Lean v4.36.0 paranoid kernel, lean4lean, nanoda, con-leche --verified, con-ron --verified, and Lean v4.36.0 default kernel). Applied to JouleBit-LUT6 6-column zero-multiply slabs (Theorem 19) on real ornith-1.0-9B Layer-0 weight slices, extracted-and-proved kernels achieve 2.05×–2.47× speedups over bitsliced baselines and 3.55×–4.37× lower Linux Running Average Power Limit (RAPL) reported_j than dense Brain Floating Point 16 (BF16) at 0-bit cross-host drift (256-bit cryptographic hash (BLAKE3) digest 7af8ecc1...b4ce).
In plain words
- Even when a project boasts “mathematical proofs,” two things often go wrong in practice: humans prove theorems about a simplified math sketch that doesn’t match the real
RustorCcode running in production (especially around integer overflow and negative remainders), or a proof quietly smuggles in unproven assumptions, vacuous “if-impossible-then-anything” rules, or a bug in a single proof checker. - We eliminate hand-transcription drift by translating the real
#![no_std]Rust compiler intermediate code (MIR) automatically intoLean 4viaCharonandAeneaswith zero unverified axioms, and we prevent vacuous theorems by pairing every positive hardware safety proof with a concrete counterexample showing the exact number (16,777,217,1,890,071,541, or tap9) where the hardware bound genuinely breaks. - Finally, every compiled proof (
58,649declarations) is checked independently by six separate proof kernels written in different languages (Lean C++,Lean-in-Lean,Rust, and minimal verifiers) so no single checker bug can slip through—anchoring real9B-parameter neural layers that cutZen 5RAPLchip energy by3.55×–4.37×with0-bit drift acrossApple, Advanced Micro Devices (AMD), andNVIDIA(Blackwell) hosts.
Terms and evidence labels
- MIR, LLBC, AST, IR, SSA, SMT, VC, FFI, CLI, CI, TCB, LoC: Mid-Level Intermediate Representation (`rustc`), Low-Level Borrow Calculus (`Charon`), abstract syntax tree, intermediate representation, static single assignment, satisfiability modulo theories, verification condition, foreign function interface, command-line interface, continuous integration, trusted computing base, and lines of code
- HOL, RNE, ULP, CRT, RRNS, RNS, DSP, DSP48E2, SIMD, FWHT, FWHT8, KV, DC, MP, JpCT: higher-order logic (`Isabelle/HOL`), round-to-nearest-even, unit in the last place, Chinese Remainder Theorem, redundant residue number system, residue number system, digital signal processor, Xilinx UltraScale+ $27 \times 18 \to 45$-bit multiplier-accumulator slice (`DSP48E2`), single instruction multiple data, fast Walsh–Hadamard transform (`8`-point `FWHT8`), key-value attention cache, direct-current zero-frequency component (or direct current rail in shunt context), Marchenko–Pastur random-matrix rank floor, and Joules per Certified Transition (`JpCT`)
- CPU, GPU, FPGA, ISA, BF16, FP32, INT8, BPW, LUT, LUT6, QKV, MLP, dB: central processing unit, graphics processing unit, field-programmable gate array, instruction set architecture, Brain Floating Point 16, 32-bit binary floating point, 8-bit signed integer, bits per weight, lookup table (`JouleBit-LUT6`), query-key-value attention projection, multi-layer perceptron, and decibel signal-to-distortion ratio
- WAIOS, RCE, SHA, BLAKE3, XNU, AMU, RAPL, TI, INA238, LCF, SAT, CVC5, TLS, KEM, OS, SNR, WGSL, EXT: Hardware-Invariant Operating Substrate (`waiOS`), Reality Code Engine, Secure Hash Algorithm (`SHA-256`), `BLAKE3` 256-bit cryptographic hash, macOS hybrid kernel (`XNU`), Apple Activity Monitor Unit energy counters, Running Average Power Limit on-chip energy counters, Texas Instruments (`INA238` DC rail monitor), Logic for Computable Functions proof-kernel architecture, Boolean satisfiability, Cooperating Validity Checker 5 (`CVC5`), Transport Layer Security, key-encapsulation mechanism (`ML-KEM`), operating system, signal-to-noise ratio, WebGPU Shading Language, and Extraction & Six-Kernel study falsifier prefix (`EXT-F1` to `EXT-F5`)
- AMD, NVIDIA, AGX, ARM64, RV64, KV260, HIL, LLM, HOL4, MIN, PASS, ICFP, POPL, ITP, CAV, CPP: Advanced Micro Devices, NVIDIA accelerated computing (`Jetson AGX`), 64-bit Arm (`ARM64`), 64-bit RISC-V (`RV64`), Xilinx `Kria KV260` FPGA kit, hardware-in-the-loop, large language model, Higher-Order Logic 4 theorem prover (`HOL4`), minimum signed integer constant (`I64::MIN`), passing kernel verdict, International Conference on Functional Programming, Principles of Programming Languages, Interactive Theorem Proving, Computer Aided Verification, and Certified Programs and Proofs
Every quantitative figure in this study carries an explicit source-epistemology label, and every energy reading strictly separates orthogonal telemetry classes (measured_j ⊥ reported_j ⊥ est_j ⊥ unmetered):
| Label | Epistemic scope |
|---|---|
| Projection | A forward-looking scaling estimate conditioned on stated codebase or proof-library assumptions |
| Company-reported | A third-party tool specification or vendor hardware rating stated without independent external audit |
| Filed | A statutory or standards-body specification |
| Literature / Reported | A peer-reviewed formal-methods, compiler, or theorem-proving result reported by external authors (ICFP, POPL, ITP, CAV, CPP) |
| Measured | A deterministic declaration count, cryptographic file digest, kernel replay wall time, or hardware power reading from reproducible Open Interface Engineering artifacts (proofs/WaiosRingsVerify_Aeneas.lean, proofs/WaiosProofs/, results/h27_lean4_six_kernel_and_aeneas_proof.json, results/h28_real_9b_jpct_and_compiled_agency_benchmark.json; Signed Provenance · Self-Checked), strictly separating measured_j (TI INA238 on NVIDIA Jetson AGX Thor), reported_j (Linux RAPL on AMD Zen 5 and XNU AMU on Apple M3 Ultra), est_j (analytical models), and unmetered (Lean 4.36.0 declaration/kernel verification counts with board_metered: false) |
1. Anatomy of the Two Residual Formal-Verification Failure Modes
1.1 Failure Mode 1 — Model-to-Implementation Transcription Drift
In conventional formal-methods workflows, an engineer writes an executable system in Rust or C () and separately hand-authors a specification model in Lean 4 or Rocq (), proving . Whenever the human author (or an autoformalizing language model [1]) abstracts i32/i64/u8 machine words into unbounded mathematical integers or translates Euclidean modulo (Int.emod, always non-negative) in place of Rust’s truncating remainder (%, negative on negative dividends!), holds in Lean while silently panics, wraps, or corrupts lanes in silicon.
Consider DSP48E2 borrow-compensated dual-lane signed INT8 extraction (dsp48e2_pack_and_extract_dual_i8 in WaiosRingsVerify_Aeneas.lean): in Rust, shifted % 262144_i64 yields a negative remainder r0 < 0 whenever p48 + 131072 < 0, requiring an explicit branch if r0 < 0 { r0 + 262144 } else { r0 } before subtracting 131072. A hand-written Lean model using Nat or Euclidean Int.emod erases that branch entirely—leaving the exact bug-prone lines of Rust unverified.
1.2 Failure Mode 2 — Single-Kernel Bugs, Compiler-Trusting Reflection, and Vacuous Specs
Even when a Lean 4 file compiles with zero visible warnings, four soundness hazards can hollow out the assurance value of lake build:
- Unverified
axiomorsorrysmuggling. An imported helper module declaringaxiom hardware_safe : ...or leaving an incompletesorryproducessorryAxin the declaration environment. - Compiler-trusting
native_decide(Lean.ofReduceBool). Usingby native_decidecompilesLeancode to nativeC/machine code, executes it outside the logical kernel, and injects a trust axiom (Lean.ofReduceBool) asserting the unverified compiler/CPU execution returnedtrue—expanding the proofTCBfrom a~6k-line logical kernel to the entireLeancompiler,Ctoolchain, and hostOS! - Vacuous preconditions (
Specgaming). As quantified in Open Interface EngineeringKit #8(/papers/software-automation-pipelines/), shared-context specification writing admits199 / 200(99.50%) broken mutants when preconditions are contradictory or assertions are tautological [1]. In arithmetic hardware proofs, an overly narrow or contradictory hypothesis makes trivially provable without testing the actual boundary. - Single-checker implementation bugs. Interactive theorem provers are complex
C++or self-hosted software systems; historical soundness bugs in universe polymorphism,let-projection reduction, or quotient axioms motivate replaying exported declaration graphs across independent minimal proof checkers [2, 3].
1.3 Four Testable Hypotheses (H1 to H4)
We formulate and test four hypotheses in ascending order:
H1(Zero-AxiomCharon+AeneasFunctional Extraction Hypothesis): Compiling#![no_std]#![forbid(unsafe_code)]Rust crates throughrustcMIRCharonLLBCAeneas -backend leanproduces pure monadicResultfunctions inLean 4with0externalaxiomdeclarations, preserving exact RustStd.I32/Std.I64/Std.U32/Std.U8overflow checks and truncating-modulo branches.H2(Choice-Free Constructive Proof Discipline Hypothesis): All arithmetic, error-correcting, hardware-packing, attention-tiling, and lookup-table theorems inWaiosProofscan be proved constructively inLean 4.36.0with0sorry,0Classical.choice,0Quot.sound, and0ofReduceBool(native_decide).H3(Paired Tightness & Overflow Witness Non-Vacuity Hypothesis): Pairing every positive safety bound () with a constructive witness at () mathematically proves both non-vacuity of the specification and optimality (tightness) of the hardware parameter.H4(Six-Kernel Independent Replay &JouleBit-LUT6Physical Payoff Hypothesis): Replaying the compiled58,649-declaration environment across six independent proof checkers achieves6 / 6unanimous acceptance in< 4 minutes, while the extracted-and-provedJouleBit-LUT66-column zero-multiply slab cuts realornith-1.0-9BLayer-0RAPLreported_jby3.55×–4.37×at0-bit cross-host drift.
![End-to-end verification pipeline diagram. Top lane: Production #![no_std] #![forbid(unsafe_code)] Rust source (7 core waios_rings_verify functions) compiled by rustc into MIR, lowered by Inria Charon into LLBC, and translated by Aeneas -backend lean into WaiosRingsVerify_Aeneas.lean (SHA-256 ee3c1d522d..., 0 external axioms, exact Std.I64/U32/U8 checked arithmetic). Middle lane: Five choice-free Lean 4.36.0 proof modules (20 theorems in H27 scaling to 144 waiOS, 218 lut-adapt, and 5,393 RCE declarations; 0 sorry, 0 Classical.choice, 0 Quot.sound, 0 ofReduceBool). Bottom lane: Independent replay of all 58,649 declarations inside isolated sandboxes across all 6 proof kernels (Lean 4.36.0 paranoid, lean4lean, nanoda, con-leche --verified, con-ron --verified, and Lean default) sealing h27_lean4_six_kernel_and_aeneas_proof.json.](/figures/rust-to-lean-six-kernel-extraction/charon-aeneas-pipeline.png)
rustc MIR -> Charon LLBC -> Aeneas functional extraction pipeline paired with choice-free Lean 4.36.0 proofs and 6-kernel independent declaration replay (58,649 declarations, 0 sorry, 0 ofReduceBool). A PNG copy is provided. Open full size · PNG2. Survey of Rust Formal-Verification Lineages and Zero-Axiom Charon/Aeneas Extraction
2.1 Comparing Rust Verification Approaches (Verus, Kani, Creusot, hacspec, Aeneas)
Over the past five years, five major toolchains have tackled formal verification of safe Rust (Literature / Reported):
| Rust verification lineage | Core mechanism & backend solver/prover | Strength | Boundary for foundational 6-kernel arithmetic proofs |
|---|---|---|---|
Bounded model checking — Kani (CBMC) [4] | Translates MIR to bitvector SAT/SMT formulas with bounded loop unwinding | Zero-annotation bit-exact panic/overflow hunting on bounded inputs | Bounded unwinding; produces no foundational proof-assistant term replayable across 6 Lean kernels |
SMT-backed deductive Rust — Verus [5], Prusti, Creusot (Why3) [6] | Ghost annotations inside Rust lowered to Z3 / CVC5 SMT verification conditions | High developer velocity on systems invariants (Verus OS/storage proofs) | Trusts SMT solver (~300k+ LoC C++) unless SMT proofs are reconstructed inside an LCF/type-theory kernel |
Subset transpilers — hacspec / hax [7] | Translates a restricted cryptographic Rust subset into F*, Rocq, ProVerif, or Lean | Battle-tested on TLS / ML-KEM (libcrux) cryptographic primitives | General borrow-returning mutable references require full borrow-calculus functionalization |
Borrow-calculus functional extraction — Inria Charon + Aeneas (Ho & Protzenko [8]) | Charon extracts full rustc MIR into LLBC; Aeneas translates borrow lifetimes via symbolic backward functions into pure Lean 4 / HOL4 / F* functions | Operates on unmodified safe Rust (#![no_std]), preserving every fixed-width CheckedAdd/CheckedMul/Rem in pure monadic Lean 4 | Ideal fit: emitted Lean 4 definitions carry 0 SMT trust and replay directly inside 6 independent Lean kernels! |
2.2 All Seven Zero-Axiom Extracted Rust Functions (WaiosRingsVerify_Aeneas.lean, H1)
Compiling crates/waios-rings-verify/src/lib.rs (#![no_std], #![forbid(unsafe_code)]) through Charon (MIR -> LLBC) and Aeneas -backend lean generated proofs/WaiosRingsVerify_Aeneas.lean (189 lines, SHA-256: ee3c1d522d467b16ce8bd1666fafe411b2fb7f24d7075870010641038f7665c2, 0 external axiom declarations, Measured):
Extracted Lean 4 definition in waios_rings_verify | Exact Aeneas monadic signature (Std machine integers) | Machine-level Rust behaviors preserved faithfully in Lean 4 |
|---|---|---|
1 · kulisch_safe_tile_bound_ok | Std.U32 → Result Bool | Checked k * 16129#u32 (u32 overflow trap) and < 16777216#u32 (2^24 significand gate) |
2 · dsp48e2_pack_and_extract_dual_i8 | Std.I32 → Std.I32 → Std.I32 → Result (Std.I32 × Std.I32) | I32 -> I64 casts, * 262144#i64, + 131072#i64 borrow bias, truncating % 262144#i64 negative-remainder branch (if r0 < 0#i64), / 262144#i64, and I64 -> I32 narrowing casts |
3 · rrns_encode_6 | Std.U32 → Result (Std.U8 × Std.U8 × Std.U8 × Std.U8 × Std.U8 × Std.U8) | Six checked modulo reductions (% 251, 253, 255, 256, 241, 247) and U32 -> U8 narrowing UScalar.cast checks |
4 · rrns_hamming_dist_6 | (6 × Std.U8) → (6 × Std.U8) → Result Std.U8 | Six byte-equality branches plus five sequential checked Std.U8 additions (d0 + d1 + ... + d5) |
5 · fwht2_butterfly_pair | Std.I32 → Std.I32 → Result (Std.I32 × Std.I32) | Explicit [-1_000_000, +1_000_000] guard bounds preventing i32 signed addition/subtraction overflow on a + b and a - b |
6 · antisym40_mirror_code | Std.U8 → Std.U8 → Std.U8 → Std.U8 → Result (Std.U8 × Std.U8) | Base-3 trit validation (u_i < 3#u8), u0 + 3*u1 + 9*u2 + 27*u3 checked U8 evaluation, and antisymmetric mirror 80#u8 - c |
7 · waios_authority_gate_seal | Std.U64 → Std.U64 → Bool → Result Bool | Exact 64-bit digest equality (candidate_digest = ref_digest) gated conjunctive signature admission |
2.3 Concrete MIR -> LLBC -> Lean 4 Inspection (WaiosRingsVerify_Aeneas.lean)
Inspecting the verbatim Aeneas-generated Lean 4 code (WaiosRingsVerify_Aeneas.lean, lines 35–68 and 153–176) illustrates why automated functional extraction catches implementation subtleties that hand-written mathematical models miss:
/-- [waios_rings_verify::dsp48e2_pack_and_extract_dual_i8]: Source: 'src/lib.rs', lines 15:0-28:1 -/
def dsp48e2_pack_and_extract_dual_i8
(w0 : Std.I32) (w1 : Std.I32) (x : Std.I32) : Result (Std.I32 × Std.I32) := do
if w0 >= (-127)#i32 then
if w0 <= 127#i32 then
if w1 >= (-127)#i32 then
if w1 <= 127#i32 then
if x >= (-127)#i32 then
if x <= 127#i32 then
let i ← lift (IScalar.cast .I64 w0)
let i1 ← i * 262144#i64
let i2 ← lift (IScalar.cast .I64 w1)
let a_packed ← i1 + i2
let i3 ← lift (IScalar.cast .I64 x)
let p48 ← a_packed * i3
let shifted ← p48 + 131072#i64
let r0 ← shifted % 262144#i64
let rem_shifted ← if r0 < 0#i64 then r0 + 262144#i64 else ok r0
let lane1 ← rem_shifted - 131072#i64
let i4 ← shifted - rem_shifted
let lane0 ← i4 / 262144#i64
let i5 ← lift (IScalar.cast .I32 lane0)
let i6 ← lift (IScalar.cast .I32 lane1)
ok (i5, i6)
else ok (0#i32, 0#i32) ...
Every monadic bind (←) inside Result obligates the prover to establish absence of panic/overflow across 14 sequential machine operations:
- All six
[-127, +127]Std.I32input guard branches must dominatei * 262144#i64so neithera_packednorp48 + 131072#i64can ever wrapStd.I64. shifted % 262144#i64preservesRust’s truncating signed remainder (r0 ∈ (-262144, +262144)), explicitly verifying thatif r0 < 0#i64 then r0 + 262144#i64 else ok r0lands inside[0, 262143]and that(shifted - rem_shifted) / 262144#i64divides cleanly without division-by-zero orI64::MIN / -1traps.- Finally,
IScalar.cast .I32 lane0andIScalar.cast .I32 lane1verify that narrowing back from64-bit hardwareDSP48E2accumulators to32-bit output registers never truncates high bits.
Similarly, in antisym40_mirror_code(u0, u1, u2, u3 : Std.U8) (lines 153–176), Aeneas verifies that whenever , the Std.U8 radix-3 polynomial never overflows 255#u8 and the antisymmetric mirror subtraction 80#u8 - c never underflows unsigned 0#u8—exploiting so 40 lookup entries cover all 81 4-trit states via sign negation!
3. Constructive Choice-Free Proofs and Paired Boundary Witnesses (H2 & H3)
Across the five foundational modules of WaiosProofs (20 core theorems in waiOS-H27, extended to 144 total waiOS theorems across 31 modules), every safety invariant is proved without Classical.choice, Quot.sound, sorry, or ofReduceBool, and paired with an explicit constructive boundary witness demonstrating that relaxing the hardware bound by +1 unit causes genuine mathematical failure:
![Three-row paired constructive tightness diagram. Row 1 (KulischExactFloat.lean): Safe zone K_tile <= 512 keeps |sum w_k x_k| <= 8,258,048 < 2^24 = 16,777,216 (ulp = 1, 0 rounding error across sequential, systolic tree, and permuted workers) paired with tightness witness z = 16,777,217 = 2^24 + 1 rounding to 16,777,216 != 16,777,217 under RNE. Row 2 (RrnsFaultHealing.lean): Safe zone [-1,890,071,540, +1,890,071,540] across 6 moduli {241, 247, 251, 253, 255, 256} enforces minimum Hamming distance d_H >= 3 (100 percent 1-channel cosmic-ray healing) paired with horizon boundary witness x = +1,890,071,541 vs y = -1,890,071,540 collapsing to d_H = 2. Row 3 (Dsp48e2DualSimd.lean): Safe zone <= 8 INT8xINT8 taps packed into 27x18->45b DSP48E2 keeps |sub1| <= 129,032 < 131,072 = 2^17 (0 lane crosstalk via +2^17 bias) paired with 9-tap extremal witness (w1 = -127, x = 127) overflowing sub1 = -145,161 < -131,072 and corrupting upper lane0.](/figures/rust-to-lean-six-kernel-extraction/tightness-boundary-witnesses.png)
+1-step failure witnesses across KulischExactFloat.lean, RrnsFaultHealing.lean, and Dsp48e2DualSimd.lean, eliminating vacuous specifications while proving hardware parameter tightness. A PNG copy is provided. Open full size · PNG3.1 Three Paired Hardware Safety & Failure-Boundary Derivations
-
Module 1 ·
KulischExactFloat.lean(Theorems 1–4, SystolicFP32Significand Ceiling):- Positive Safety Theorem: For all and tile depth , and , guaranteeing
binary32RneGrid(acc) = acc(0rounding error across sequential, systolic tree, and permuted worker orders). - Constructive Tightness Witness: At in octave where
ulp = 2,binary32RneGrid 16777217 = 16777216 != 16777217.
- Positive Safety Theorem: For all and tile depth , and , guaranteeing
-
Module 2 ·
RrnsFaultHealing.lean(Theorems 5–8, Six-Channel Cosmic-Ray Fault Healing):- Positive Safety Theorem: Over moduli , all pairs carry explicit small
NatBézout coprimality certificates with . Chaining constructive Gauss–Euclid divisibility (euclid_dvd_pos/euclid_dvd_neg) across the four smallest moduli proves that for all distinct in (), at most3residues can match—so code Hamming distance satisfies , guaranteeing disjoint radius-1single-fault balls (). - Constructive Tightness Witness: Stepping
+1integer past the symmetric horizon to and yields , causing all four smallest channels to collide simultaneously and collapsing code distance torrnsHamming6 x y = 2(1-fault unique decoding lost!).
- Positive Safety Theorem: Over moduli , all pairs carry explicit small
-
Module 3 ·
Dsp48e2DualSimd.lean(Theorems 9–12, Dual-INT8Packing on -BitFPGADSPs):- Positive Safety Theorem: Packing two signed weights into the
27-bit port and multiplying by shared activation on the18-bit port exploits exact bilinearity:
- Positive Safety Theorem: Packing two signed weights into the
For taps, , so borrow-compensated extraction and recovers both lanes with 0 crosstalk—lighting up all 1,248 DSP48E2 slices on Kria KV260 at 2× throughput.
- Constructive Tightness Witness: At
T = 9taps with , , overflowing the signed18-bit lower lane and corruptingextractLane0by-1(Theorem 12, proving8taps is the exact physical subtile maximum!).
- Modules 4 & 5 ·
FlashAttentionAndTraining.lean(Theorems 13–16) &LittleBit2AndCompiledAgency.lean(Theorems 17–20): Prove256-bit online Base-2 FlashAttention tile-merge associativity,E8256 : 36 = 64 / 9 = 7.111×KV-cache paging compression, error-feedbackDCconservation,4-worker AllReduce invariance,FWHT8dot-product isometry (0runtime multiply ops), copy-head collapse (8) vs. Hadamard orthogonality (0),JouleBit-LUT66-column zero-multiply slab exactness (0.119 BPWfloor), andN >= 2JpCTamortization dominance.
3.2 Constructive Gauss–Euclid Proof Structure Without Classical.choice (RrnsFaultHealing.lean)
Why do standard library number-theory proofs in Mathlib frequently pull Classical.choice and Quot.sound into their axiom footprint? General ring localization, quotient-group isomorphisms (), and non-constructive existence of greatest-common-divisor linear combinations routinely invoke quotient types or classical decidability by classical.
In WaiosProofs/RrnsFaultHealing.lean and Dsp48e2DualSimd.lean, we avoid every quotient and choice axiom by supplying explicit small positive Nat Bézout witnesses (u, v <= 127) and chaining constructive divisibility directly over Nat and Int:
/-- Constructive Gauss-Euclid lemma (`a * u = b * v + 1`, `a * x = b * y -> ∃ z, x = b * z`)
proved with 0 Classical.choice, 0 Quot.sound, and 0 ofReduceBool. -/
theorem euclid_dvd_pos (a b x y u v : Nat)
(h_bez : a * u = b * v + 1)
(h_eq : a * x = b * y) :
∃ z : Nat, x = b * z := by
refine ⟨u * y - v * x, ?_⟩
-- Explicit witness `z := u * y - v * x` computed directly from Bézout coefficients!
...
/-- Borrow-compensated DSP48E2 dual-lane extraction (`0` lane crosstalk on `[-131072, +131071]`). -/
def sext18 (r : Int) : Int :=
if decide (r < 131072) then r else r - 262144
def extractLane0 (p48 : Int) : Int := (p48 + 131072) / 262144
def extractLane1 (p48 : Int) : Int := sext18 (p48 % 262144)
theorem dsp48e2_borrow_compensated_extractor_exact
(sub0 sub1 : Int) (h_lo : -131072 ≤ sub1) (h_hi : sub1 < 131072) :
let p48 := sub0 * 262144 + sub1
extractLane0 p48 = sub0 ∧ extractLane1 p48 = sub1
Constructing the explicit witness z := u * y - v * x in euclid_dvd_pos has two direct payoffs: (i) the resulting proof term reduces via pure structural recursion in every independent external checker (con-leche --verified, con-ron --verified, nanoda, and lean4lean) without needing classical axiom schemas, and (ii) every existential proof doubles as a runnable syndrome-decoding algorithm for hardware fault recovery!
3.3 Summary Table of All 20 Foundational waiOS-H27 Theorems and Axiom Audits
Proof module (WaiosProofs/) | Theorem IDs | Positive safety invariant proved | Paired +1-step tightness / boundary witness | Choice / ofReduceBool count |
|---|---|---|---|---|
1 · KulischExactFloat.lean | 1–4 | INT8×INT8 ∈ [-16129, +16129]; $K \le 512 \implies | \text{acc} | \le 8{,}258{,}048 < 2^{24}$; seq = tree = perm |
2 · RrnsFaultHealing.lean | 5–8 | 15 Bézout pairs (); Gauss–Euclid CRT; on | 0 choice · 0 ofReduceBool | |
3 · Dsp48e2DualSimd.lean | 9–12 | borrow extractor; b bilinearity; 8-tap $ | \text{sub}_1 | \le 129{,}032 < 2^{17}$ |
4 · FlashAttentionAndTraining.lean | 13–16 | 256-bit Base-2 online FlashAttention merge associativity; E8 64/9 = 7.111× KV; DC; 4-worker AllReduce | Unmerged naive block-max shift drift without 256-bit exact rescaling | 0 choice · 0 ofReduceBool |
5 · LittleBit2AndCompiledAgency.lean | 17–20 | FWHT8 dot-product isometry; Hadamard 0 vs. copy-head 8; JouleBit-LUT6 6-col slab; JpCT win | Copy-head rank collapse (8 coherent spike) without FWHT8 rotation | 0 choice · 0 ofReduceBool |
4. Six-Kernel Independent Proof Replay and Real ornith-1.0-9B Hardware Payoff (H4)
4.1 Six-Kernel Verification Matrix (58,649 Declarations in 234.9 s)
Exporting the complete declaration environment of WaiosProofs + WaiosRingsVerify_Aeneas (58,649 total kernel declarations) and replaying every universe level, inductive rule, and definitional reduction inside isolated sandboxes (scripts/verify_waios_lean_and_aeneas.py, Measured [9]):
| Independent proof checker | Implementation language & lineage | Verification flags & soundness checks enforced | Declarations verified (waiOS-H27) | Verdict |
|---|---|---|---|---|
1 · Lean v4.36.0 Paranoid Kernel | C++ reference kernel | lake check --paranoid (full environment re-typecheck) | 58,649 | PASS (0 sorry) |
2 · lean4lean (Carneiro [2]) | Lean 4 self-formalized kernel | Independent type-theory spec checking exported .olean graph | 58,649 | PASS (0 sorry) |
3 · nanoda [3] | Independent Rust checker | Standalone Rust parser/reducer explicitly barring sorryAx & ofReduceBool | Full graph | PASS (0 sorryAx) |
4 · con-leche --verified | Minimal verified external checker | Strict axiom whitelist ([] or [propext] only; Classical.choice flagged) | 58,647 | PASS (0 choice) |
5 · con-ron --verified | Second independent minimal checker | Disjoint reduction/conversion engine checking every constant | 58,647 | PASS (0 choice) |
6 · Lean v4.36.0 Default Kernel | C++ fresh clean build | Clean-room rebuild + WaiosRingsVerify_Aeneas SHA-256 lock | 58,649 | PASS (234.9 s total) |
This identical six-kernel discipline scales across the wider Open Interface Engineering proof estate: 144 waiOS theorems (including 103 Quad-Stack seL4 theorems in /papers/sel4-heterogeneous-hil-consensus/), 218 lut-adapt theorems (1,584 fleet declarations [10]), and 5,393 RCE theorem constants (1,264 source declarations inside Linux bubblewrap containers, powering Spec ⊥ Impl software factories at /automation-pipelines/ [1]).
4.2 Empirical Payoff of Theorem 19 (JouleBit-LUT6) on Real ornith-1.0-9B Slices (waiOS-H28)
To verify that zero-axiom extracted and 6-kernel-checked arithmetic translates into real silicon energy savings—and to report candidly where extreme sub-bit Walsh truncation hits random-matrix limits—we evaluated the JouleBit-LUT6 6-column zero-multiply slab (compiled_agency.rs) across one localized multi-head operator (kurtosis = 211.41) and four real ornith-1.0-9B Layer-0 weight projections (256 × 1024) across Apple M3 Ultra (XNU AMU), AMD Zen 5 (Linux RAPL), and NVIDIA Jetson Thor (TI INA238) (Measured, identical BLAKE3 = 7af8ecc1fc587af67db1a575519cc8869f1b760ad4f5d5d7f102f2d42f62b4ce):
Projection (256 × 1024) | Weight kurtosis | MultiRing (~2.2 BPW) SNR | LittleBit-2 Walsh (0.476 BPW) | Zen 5 bitsliced LUT6 latency | LUT6 speedup (M3U / Zen5 / Thor) | Zen 5 RAPL reported_j (Dense BF16 LUT6) |
|---|---|---|---|---|---|---|
canonical_localized_multihead | 211.41 | 16.02 dB (4.251 BPW) | 49.34 dB (+9.12 dB Walsh) | 72.71 29.38 µs | 2.33× / 2.47× / 2.23× | 3,921 897 µJ/op (4.37× cut) |
ornith_9b.in_proj_qkv | 3.45 | 10.11 dB (2.197 BPW) | 1.48 dB (hits MP rank floor!) | 69.03 29.48 µs | 2.15× / 2.34× / 2.05× | 2,755 665 µJ/op (4.14× cut) |
ornith_9b.out_proj | 5.29 | 10.97 dB (2.517 BPW) | 1.28 dB (hits MP rank floor!) | 69.34 29.41 µs | 2.31× / 2.36× / 2.07× | 2,746 773 µJ/op (3.55× cut) |
ornith_9b.mlp.gate_proj | 3.56 | 10.21 dB (2.187 BPW) | 1.18 dB (hits MP rank floor!) | 69.49 29.44 µs | 2.26× / 2.36× / 2.07× | 2,720 760 µJ/op (3.58× cut) |
ornith_9b.mlp.down_proj | 3.20 | 10.21 dB (2.239 BPW) | 1.18 dB (hits MP rank floor!) | 68.87 29.42 µs | 2.24× / 2.34× / 2.05× | 2,803 662 µJ/op (4.23× cut) |
Notice the candid empirical lesson in column 4: ultra-sparse 0.119–0.476 BPW LittleBit-2 Walsh spectral coding excels on high-kurtosis localized heads (49.34 dB at kurtosis = 211.41), yet collapses to 1.18–1.48 dB on dense low-kurtosis (3.20–5.29) pretrained 9B weights whose singular spectrum follows the Marchenko–Pastur (MP) bulk distribution—whereas ~2.2 BPW MultiRing + JouleBit-LUT6 preserves 10.11–10.97 dB while cutting Zen 5 RAPL reported_j by 3.55×–4.23× on real 9B slices.
4.3 Reproducible Single-Command Six-Kernel Verification Protocol
To ensure external auditors can replay both the Charon/Aeneas zero-axiom check and all six independent Lean 4.36.0 proof kernels without manual environment assembly, scripts/verify_waios_lean_and_aeneas.py executes four deterministic stages and emits a cryptographically hashed JSON ledger (results/h27_lean4_six_kernel_and_aeneas_proof.json):
# 1. Verify exact SHA-256 of Aeneas-extracted Lean module & assert 0 external `axiom` lines:
shasum -a 256 proofs/WaiosRingsVerify_Aeneas.lean
# -> ee3c1d522d467b16ce8bd1666fafe411b2fb7f24d7075870010641038f7665c2 (0 external axioms)
# 2. Clean-build all WaiosProofs modules under Lean v4.36.0 & audit `#print axioms`:
cd proofs && lake build WaiosProofs
# 3. Replay all 58,649+ declarations across all 6 independent paranoid proof kernels:
python3 scripts/verify_waios_lean_and_aeneas.py --out results/h27_lean4_six_kernel_and_aeneas_proof.json
# 4. Run 3-host JouleBit-LUT6 & real ornith-1.0-9B JpCT hardware benchmark:
cargo run --release -p waios-rings --example h28_real_9b_jpct_and_deterministic_null_bench
5. Role in Gate-First Spec ⊥ Impl Software Factories (/automation-pipelines/)
In Pipelines for Computer Automation of Software Development and Maintenance (/automation-pipelines/) [1], surveying “LLM-as-Formalizer” autoformalization pipelines revealed a subtle Achilles’ heel: while a proof assistant’s kernel blocks proof hallucinations (Impl soundness), an unconstrained neural model translating requirements into Lean 4 can still emit vacuous specifications (false -> P, dropped edge-case branches, or idealized Int models divorced from Rust machine types).
Combining the four mechanisms established in this paper closes that autoformalization loophole inside unattended software factories:
| Verification failure mode in autonomous coding | How naive LLM + unit-test or LLM + single-prover stacks fail | How Charon/Aeneas + Paired Witnesses + 6-Kernel Replay closes it |
|---|---|---|
| 1 · Shared-context weak test gaming | 199 / 200 (99.50%) broken AST mutants pass naive self-written tests (Kit #8 Arm A [1]) | Context-isolated Spec ⊥ Impl 100% AST Mutant Kill Gate (0 / 200 & 0 / 800 escapes) |
2 · Hand-written Lean model drifts from Rust code | Lean model uses unbounded Nat/Int.emod; Rust panics or corrupts negative % remainders | Charon + Aeneas extracts actual #![no_std] Rust MIR (Std.I32/I64/U8 % & casts) with 0 axioms |
3 · Autoformalized Lean theorem is vacuously true | Contradictory hypotheses (h : x < 0 ∧ x > 5) prove anything (0 sorry) | Mandatory paired positive safety proof + +1-step constructive failure witness (16,777,217; 1,890,071,541; 9 taps) |
4 · native_decide or single-kernel bug bypass | Lean.ofReduceBool trusts C compiler; single checker has a reduction bug | 6 / 6 independent kernels (Lean paranoid, lean4lean, nanoda, con-leche, con-ron, Lean default) bar sorryAx & ofReduceBool |
Across the Open Interface Engineering codebase, this multi-kernel discipline now governs 5,393 RCE theorem constants, 218 lut-adapt theorems, and 144 waiOS theorems—demonstrating that foundational, zero-choice, six-kernel verification is practical at multi-repository scale.
6. Falsification Criteria and Open Engineering Boundaries
Every formal-extraction and multi-kernel claim in this study is paired with an explicit refutation condition (EXT-F1 to EXT-F5) and honest statement of remaining trust boundaries:
| Falsifier ID | Claim under test | Concrete refutation condition | Current empirical status & open boundary |
|---|---|---|---|
EXT-F1 · Charon + Aeneas Translation Fidelity | WaiosRingsVerify_Aeneas.lean (0 external axioms) faithfully captures the semantics of crates/waios-rings-verify/src/lib.rs | A bug in Charon’s MIR -> LLBC lowering or Aeneas’s Std integer model produces a Lean definition diverging from compiled rustc execution on any concrete input | Cross-checked by differential property fuzzing between compiled native Rust and Lean evaluation on boundary inputs; Charon/Aeneas itself is not yet self-verified in Lean (an active upstream research goal [8]) |
EXT-F2 · MIR-to-Machine-Code Backend Gap (LLVM) | Proving MIR-extracted Lean definitions eliminates source/model bugs, yet rustc’s LLVM backend still lowers MIR to machine instructions | An LLVM optimization pass miscompiles safe #![no_std] Rust MIR into defective x86_64/ARM64/RV64 machine code | Mitigated by 11-ISA differential BLAKE3 execution (/papers/isa-agnostic-computing/) and zero-LLVM direct RCE compilation (4 ISAs); full binary-level translation validation (seL4 AsmRefine style [11]) for rustc remains open |
EXT-F3 · Scope of Aeneas Extraction Across Full Workspace | 7 core ring/packing/gate functions are automatically extracted via Aeneas, while larger seL4 / WGSL system state machines (144 theorems) use Lean relational models paired with Rust conformance tests | Claiming 100% of lines across GPU WGSL shaders, C Microkit shims, and async networking are Aeneas-extracted today | Explicitly scoped: Aeneas covers pure #![no_std] safe Rust (waios_rings_verify); WGSL compute shaders (liquid_butterfly.wgsl) and C Microkit shims are verified via 4-vendor / HIL 0-bit BLAKE3 lockstep + Lean capsule predicates |
EXT-F4 · Six-Kernel Shared Frontend Surface | Replaying exported .olean / declaration graphs across 6 independent kernels eliminates single-kernel typechecker and reducer bugs | A bug in .olean export serialization before the 6 checkers read the environment drops or alters a theorem statement | Mitigated by inspecting human-readable theorem signatures directly in WaiosProofs/*.lean alongside nanoda’s independent text/export parser and SHA-256 manifest locks |
EXT-F5 · Marchenko–Pastur Sub-Bit Spectral Ceiling | JouleBit-LUT6 accelerates 6-column binary slabs 2.05×–2.47×, while 0.12–0.48 BPW Walsh coding only succeeds on structured/high-kurtosis operators | Applying 0.119 BPW LittleBit-2 Walsh truncation directly to dense kurtosis ~ 3.2 pretrained MLP matrices without MultiRing / Block64-QAT training degrades SNR to < 1.5 dB | Candidly documented in Table 4.2 (ornith-1.0-9B 1.18–1.48 dB vs. MultiRing 10.11–10.97 dB); sub-0.5 BPW deployment requires Block64-QAT training or crystallized R0 skill vaults [10] |
References
- Open Interface Engineering, "Pipelines for Computer Automation of Software Development and Maintenance (`Kit #8` `Spec ⊥ Impl` Mutant Gate & 5,393 Six-Kernel Lean Constants)," 2026. /papers/software-automation-pipelines/
- M. Carneiro, "Lean4Lean: Towards a verified typechecker for Lean, in Lean," 2024. arXiv:2403.14064. https://arxiv.org/abs/2403.14064
- Nanoda Project and independent Lean 4 external kernel verifiers (`nanoda_lib`, `con-leche`, and `con-ron` standalone declaration-graph typecheckers barring `sorryAx` and compiler reflection), 2023–2026. https://github.com/ammkrn/nanoda_lib
- A. VanHattum, D. Schwartz-Narbonne, N. Chong, and A. Sampson, "Verifying dynamic trait objects in Rust (`Kani` Rust Verifier)," in 44th International Conference on Software Engineering: Software Engineering in Practice (ICSE-SEIP), pp. 321–330, 2022. https://model-checking.github.io/kani/
- A. Lattuada, T. Hance, C. Cho, M. Brun, I. Subasinghe, Y. Zhou, J. Howell, B. Parno, and C. Hawblitzel, "Verus: Verifying Rust programs using linear ghost types," Proceedings of the ACM on Programming Languages 7(OOPSLA1), Article 85, 2023. doi:10.1145/3586037
- X. Denis, J.-H. Jourdan, and C. Marché, "Creusot: A foundry for the deductive verification of Rust programs," in 24th International Conference on Formal Engineering Methods (ICFEM), pp. 90–105, 2022.
- D. Merigoux, N. Kulatova, and K. Bhargavan, "Hacspec / hax: Succinct, executable, verifiable specifications for high-assurance Rust cryptography," Inria & Cryspen technical reports, 2021–2025. https://hacspec.org
- S. Ho and J. Protzenko, "Aeneas: Rust verification by functional translation (with the Charon MIR-to-LLBC extractor)," Proceedings of the ACM on Programming Languages 6(ICFP), Article 116, pp. 711–741, 2022. doi:10.1145/3547647
- Open Interface Engineering, "Horizons waiOS-H27 & waiOS-H28: Six-Kernel Choice-Free Lean 4.36.0 Suite, Zero-Axiom Charon/Aeneas Extraction, and JouleBit-LUT6 Real ornith-1.0-9B Evaluation," commit
59e855a, 2026. /data/ - Open Interface Engineering, "Downward LUT6 Compilation in a Mixture of Limits Cascade (`218` Six-Kernel Lean 4.36.0 Theorems),"
openIE-dev/lut-adapt-ai, 2026. /papers/lut-adapt/ - T. Sewell, M. Myreen, and G. Klein, "Translation validation for a verified OS kernel," in Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pp. 471–482, 2013. doi:10.1145/2491956.2462183