Repository navigation
Conversation
Use the actual verifier and physical tables for channel views. Separate generation inputs from evaluation data, share the generic ledger filter law in ToClean, and remove the unused five-channel footprint compatibility record. Strict affected build (2706 jobs), 12 lint roots, selected production/test trust scopes, and repository guards pass. Full adoption remains incomplete at eight migration roots; higher completeness consumers and fresh legacy export regeneration are not yet validated.
Read Clean revision from lake-manifest.json and regenerate the backend manifest. All 44 other generated files remain byte-identical. Strict driver build, deterministic fresh regeneration, 29 witnesses and 26 malformed mutations pass through the R1CS backend checks. Existing Rust interpreter tests (30) and all 857 migration fixture rows also pass; this does not validate the unfinished built-in ensemble export.
Decode Halt and StateBump rows at witness data and use the complete interaction ledger directly, removing the obsolete synthetic all-tables witness. Condense stale table-count documentation and distinguish assembly guarantees from arbitrary execution compilation. Strict affected build (2415 jobs), lint, guards and selected production/test trust scopes pass with no new exceptions. The strict full adoption scan now fails at seven remaining migration roots.
Transport fixed target lookups, Byte guarantees and exact receipt ledgers across the five-table view. Preserve final-record agreement with the existing grounding projection and supply concrete unique-name evidence. Evaluate the full physical regression through the canonical Clean ledger, share fixture work across rows, and separate finite lookup checking from the legacy exporter. Selected strict builds, production lint, both compiled trust scopes, backend comparisons and Rust migration checks pass. This remains an unpublished adoption checkpoint: the full build and fresh exports still have known migration blockers.
`docs/audits/2026-11-build-performance.md` records the method (solo sweep by instructions retired, proof-closure verdicts, CI job data), where the time goes (1,185 modules, 48.6 T instructions: 70 % on the headline closure, 15 % tests, 7 % generated model, 8 % off-path production modules), the top 40 modules, the fixes landed in #197–#201 with their measured effects, the mechanisms behind them, the open clusters and the upstream candidates under review. `docs/agents/build-profiling.md` points at the inventory and the generated-C check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`Installed`, `installed`, `SailTrace`, `Endpoint` and `sail_trace` take the supplied target `ExecutionSnapshot` instead of an outgoing memory snapshot and a final host bank: the target fixes both (`target.sail.memorySnapshot`, `target.host`). The statement is equally general, since every memory/bank pair is a target's projection, and the target's registers are what the ordinary observation mode and endpoints need. The trace's final state is now named `actual` throughout, as in `Endpoint.realize_eq`, which becomes `Endpoint source target final …`. The alignment fixtures carry the complete target snapshot (`Context.target : ExecutionSnapshot`); the separate `finalHost` field is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Installed, installed, SailTrace, Endpoint and sail_trace take the target snapshot; 13,947 dependencies (registration theorems now appear as Installed's auxiliary proofs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`Soundness/OrdinaryObservationResources` defines the two physical tables that join the host inventory: the ordered receipt consumer and its terminal at a static mode. The consumer's rows are demanded by receipts and indexed by the receipt's clock; its guard checks the complete receipt, so a misrouted private row cannot answer another receipt. Names and channels are stated once for every retirement flag and mode (`consumer_name`, `terminal_name`, `consumer_channels`, `terminal_channels`), since both are static data of the supplied snapshots. The consumer circuit gets its table name, "sp1.native.ordinary_observation" (it was anonymous), and `circuit_channels_subset`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rminal per mode The observation consumer and terminal took static data (the source's retirement flag and the target's mode), so installing them in the exact host resource list would have required generalizing the host-grounding chain first. They now take none: - `State` gains `enabled`, set by the verifier's start link (`flagFor source`) and carried unchanged by every consumer row, which checks it with Clean's `assertBool`. `Spec` advances the counter by `BitVec.ofNat 64 previous.enabled.val`; `ordered_history` proves the flag is preserved and `final = initial + length * flag`, and `retirement_fold` takes the semantic flag with the hypothesis that the chain's flag denotes it. - `Mode.sentinel` gives each mode a distinct sentinel clock at or above 2^48; the three terminals are separate tables (`terminalName mode`) that push `final mode …`, and `finalFor source target` closes at the sentinel of `Mode.of source target`, so a wrong mode's push cannot balance. - `OrdinaryObservationResources` is the four parameter-free tables. - The tests keep both flag values and reject a non-Boolean flag and a final link whose flag differs from the chain's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The registered observation channel's State gains its retirement flag: nine State/ProvableStruct declarations change; 13,947 dependencies (reviewed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…inventory The four parameter-free observation tables (the consumer and one terminal per mode) join `HostHintReadLocal.sourceResources`, now `bankResources hints ++ OrdinaryObservation.tables`, so the host-grounding chain keeps its statement: - `source_interface` composes the bank proof with `ExtensionInterface.appendResources`; the tables' facts come from `tables_channels`/`tables_silent`, and Byte through `AuxiliaryInterface.of_channels` (the consumer requests Byte checks but owes requirements only on its receipt and observation links). - Record authentication, queue silence and the registry's declaration rows gain the four tables; `HostFinalMemory.observation_lookupFree` proves the block lookup-free once. - The host block grows 31 → 35 tables and the installed assembly 95 → 99; positions after the bank terminals shift by four (checks 94–97, commitment declaration 98) in the fixtures, the example expectations, `coverage.json` (the four native entries, from releaseInventory) and the Rust comparison tests. With no producers or endpoint yet, an accepted witness leaves the tables empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The host inventory reaches the four observation tables: 98 dependencies added, sourceResources changed; 14,045 (reviewed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The exporter's HINT_READ mutations and the shared Rust assembly support addressed the register and RAM target checks, the provider-count probes and the commitment declaration by position. With the four observation tables installed those move by four (checks 94–97, declaration 98), and the assembly has 99 components. Fresh dual export, determinism check and all Rust fixture groups (default and mprotect) pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
feat(soundness): integrate target-indexed ordinary observation tables
…plete-observed-shard
feat(capstone): bind six-call execution to the installed SP1 assembly
feat(capstone): construct the private hint endpoint in the installed assembly
feat(capstone): prove observation completeness for the SP1 shard
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
Since #104, development moved through a stack of upstream PRs (#106–#117, #119–#122) and then, from September, to the fork, where it continued through dtumad#1–150. This PR is the single place to review all of it. The work falls into four groups.
sp1_machine_soundnessdepended on asorry(sp1_witness_decode) and concluded only that some sub-trail of rows is Sail-correct row by row. It is gone. In its place issupported_core_native_sound, a closed theorem over a 55-table native Clean ensemble. It applies to a single shard with no active syscall rows: COMMIT, HINT, WRITE and the other host calls are excluded. From constraints and channel balance, plus explicit semantic premises (provider truth and uniqueness, the start state, code/data separation), it derives an exhaustive, clock-ordered official-Sail execution.riscv-leanretired, a core/full build split, a compiled-library trust policy in place of the axiom census, zerosorry, zero hand-writtenmaxHeartbeats, and CI rewritten for GitHub-hosted runners.The repository is sorry-free. The hand-written libraries declare no axioms (gated); the vendored generated Sail model declares 75 extern axioms, 74 of them allowlisted by the trust policy. Every theorem below is labelled closed, conditional or open:
The boundaries are spelled out in Known limitations.
Why a fork. Stacking PRs on this repository blocked integration: each PR waited on the one below it, and CI ran on self-hosted runners we could not use from a fork. Moving to
dtumad/sp1-leangave the work its own PRs, issues and CI. This PR tracks the result for review and syncing.How to read this PR
The diff is not reviewable line by line. Most of it is generated, and much of the hand-written churn is in proofs whose statements are what matter. Sizes, measured from
git diff --numstat 512e944a bd7ecf1d:LeanRV64D/)export/: SP1 trace dumps, R1CS/WASM gadgets)SP1Clean/Extracted/)update_extracted.pynolints.json, deleted test vectors.gitattributesmarksLeanRV64D/**,SP1Clean/Extracted/**andexport/**aslinguist-generated.Suggested review route (the fork's own audit route lives in
docs/assurance.mdanddocs/semantics.md):What is proved now: the theorem table and the premises it lists.
SP1Clean/Soundness/AIR.lean: the closed AIR→Sail theorem and the exact relations it relates.One instruction end to end. ADD:
Native/Chips/AddChip/Defs.lean;FormalModel/Contracts/ChipAssumptions.lean;Alignment/Chips/AddChip/Bridge.lean;Faithful/AddChip.lean.For depth, DivRem:
Semantics/Specs/DivRem.lean.Faithful/ChipOracle.lean(ChipFaithful): exactly what is compared with SP1's Rust.FormalModel/Shard.leanandSoundness/Shard/Contract.lean: the full-state target, which is conditional.The new repository setup, then the trust policy
scripts/trust_policy.json.At a glance
Significance: ★★★ changes what is proved, or what SP1 must trust or review · ★★ major · ★ moderate. Size counts hand-written lines only: XL ≥ 20k · L 5–20k · M 1–5k · S < 1k.
supported_core_native_sound) replaces the sorry-backed GatedVm capstoneChipFaithfulfor all 25 instruction chips (SP1 v6.4.0 extraction); exact 34+6-table Core AIR relationShard.statement_iff(conditional), installed six-call host checkpoint (closed)supported_core_native_complete(restricted domain); generic Clean table builderdtumad/clean@c4abcbb9): built-in Rust export plus rewritten ensemble/verifier definitions used by every ensemble theoremsorrygateSemantics/Specs, bundledCircuits/Gadgets, explicit selectors, new system and host chipsriscv-leanretired; PolyFun addedSP1Core/SP1Cleansplit, strata,To*upstream-staging libraries, module system (partial)ubuntu-latestwith strict--wfail --iofail; build-time campaign;maxHeartbeats259 → 0What is proved now, compared with upstream
Upstream at
512e944a. There were 25 chips with per-chip soundness/completeness andcorrect_<op>_nativeSail bridges. Faithfulness anchors existed per operation: mostly stated only foris_real = 1, with syntactic interaction comparison for 4 chips. The machine theoremsp1_machine_soundnesscovered 25 tables and 4 channels, had no provider tables, and inherited onesorry.Target.sp1_target_executionwas conditional on an openTargetObligationsbundle. Witness generation was checked bynative_decidevectors for 10 chip traces and 13 operations. The audit allowed onesorryand ninesorryAxcarriers.At
bd7ecf1d. The main library has nosorry, no projectaxiom, nonative_decideand noskipKernelTC, all gated. Theorem dependencies are restricted to the trust policy.ChipKind.advance(one realtry_stepproduces the row's effect)Proofs/Chips/*,Alignment/Chips/*/Bridge.leanAssumptions(19 chips still assume operand/immediate ranges); channel guarantees discharged at machine level; 25 families, not all of RV64IMChipFaithfulfor 25/25 instruction chips, plus MemoryBump/StateBump (SyscallInstrs uses a factored variant)Faithful/ChipOracle.lean,Faithful/SupportedMachine.leansupported_core_native_sound: native 55-table relation ⇒ official-Sail run (ordinary, or ending in modeled HALT)Soundness/AIR.leanSailCodeMemoryCompatible,SyscallTableInactive; single shardsupported_core_boot_to_halt_single_shardSoundness/BootHalt.leanexists_exhaustiveTrail: balance + strict rank ⇒ walk whose multiset equals all edgesSoundness/RankedGrounding.leanExecutionSnapshot.equivalent_iff: executable comparison ⇔ equality of complete realized statesModel/Core/ExecutionSnapshot.leanHostHintReadCPU.source_execution_with_memory: raw constraints + balance of an 89-table host ensemble ⇒ anExecutionPathwith write permission and endpoint facts (PC/clock, memory/register frames, host) for an existential targetSoundness/HostHintReadFinalSnapshot.leansupported_core_native_complete: deterministicnativeTracecompiler onto the 55-table relationSoundness/NativeCompleteness.leanNativeTraceReady(13 fields, incl. syscall-free and exit 0) + channel capacity; noncomputable…_shard_correct_of_totality,…_language_eq_of_totalityNativeShardTraceTotal, which is openSoundness.Shard.statement_iff:ensemble.Statement header ↔ ∃ events, AdmissibleExecution …Soundness/Shard/Contract.leanSoundnessTarget/CompilerTargetare not instantiated; a CI manifest pins their typessp1_air_sound_of_obligations(exact upstream 34+6-table AIR ⇒ semantics)Soundness/CoreAIR.leansp1_air_soundis declaredCounterExample.statement_iff: a completeRealizesinstance (raw acceptance ⇔ semantic traces)Soundness/Examples/Counter.leanExplicitly not claimed:
verifyCore = true ⇒ execution);The new repository setup
Toolchain and dependencies
512e944abd7ecf1dVerified-zkEVM/clean@292b9cc3(an intermediate commit of Verified-zkEVM/clean#398, since merged)dtumad/clean@c4abcbb9rems-project/lean-sail@v4(transitive)dtumad/lean-sail@bde9ecc6= tagv5+ 1 lineopen PreSaildisambiguation; Lean 4.33'sambiguousOpenwarning otherwise breaks--wfail. Exit: rems-project/lean-sail#14succinctlabs/sail-riscv-lean@ moving branch, hand-editedLeanRV64D/(161 files)61266bd4with compiler41694abdplus a 2-key overlay (CLINT and the simple interrupt generator disabled; their windows sit inside SP1's RAM).sail-regen.ymlchecks byte-identical regenerationriscv-leansuccinctlabs/riscv-lean@ moving branchSemantics/ISA/RV64.lean(30 pure reference functions) and re-proved bridges inProofs/Sail/RV64Bridge.leanVerified-zkEVM/PolyFun@997828ceLabeledmachine-trace vocabulary for the shard target; its axiom-sweep script powerscheck_trust.pyThe Clean fork is the main new trust dependency.
c4abcbb9is 41 commits ahead of upstreamfba2a29f(84 files, +11.1k/−4.3k).p3-batch-starkverifier accepts public-only channels.FExpr,Component,Ensemble), so it cannot be an additive layer.supported_core_native_sound, is stated against the fork'sEnsemble/Statement/verifier definitions, so the fork matters for more than the Rust export.ToClean/under Clean's namespaces, with no SP1 imports.AgreesBelowto include data and hint agreement. Verified-zkEVM/clean#450 (AgreesBelowwith data/hints, staged here asToClean/Circuit/AgreesBelowWithData.lean) is approved but open;fba2a29fwith no fork.All pins are immutable commits or tags.
scripts/check_pins.pycross-checks the Lake manifest, the Cargo SP1 crates, the Sail tree hash andscripts/provenance.json. Do not run barelake update.Libraries and build targets
SP1Core(default)SP1Clean/Core.lean)lake buildToClean/ToMathlib/ToPolyFun(default)SP1Cleanlake buildSP1Cleanlake build SP1CleanSP1CoreTest/SP1CleanTestnative_decideis allowedlake test/lake build SP1CleanTestLeanRV64D,LeanRV64DRvfidoelaborator to dodge leanprover/lean4#13858: 718 s → 2.5 s)backendGadgets(exe)lake buildno longer checks faithfulness, machine soundness, the Sail bridges or completeness. Use the full command below. The old per-pillar libraries (SP1Math…SP1Proofs) andsp1Lintare gone, and linting is BatteriesrunLinterplus Mathlib's standard set. Strata are enforced byscripts/check_layering.sh(docs/layering.md).Directory map (
SP1Clean/)Math/Semantics/ISA/RV64.leanreference functions;Specs/pure semantic contracts for gadgets and chipsCircuits/Types/native column types;Gadgets/bundled gadget circuits + witness generation + proofs (Clean-style Specs/Types/Gadgets split)Model/Core/: the complete execution model (state, steps, paths, snapshots, host calls, write policy, resources);Semantics/: Sail step/frame/fetch vocabulary;Machine/: PolyFun machineExtracted/ChipOracle/(25),SystemOracle/(12), Core AIR manifest, opcode table, provenance. Upstream'sExtracted/Circuit/is goneFormalModel/Contracts/(chip/reader specs and assumptions),TraceGen/,Shard.lean(full-state target),CoreAIRRelation.leanNative/mains (now including Halt, SyscallInstrs, MemoryBump, StateBump, host chips), operations, readersProofs/Chips/<X>/{Formal,Complete,Witgen},Operations/,Completeness/(trace compiler, assembly, closure),Sail/(advance, decode, RV64 bridge)Alignment/Alignment/Chips/<X>/Bridge.lean(moved fromProofs/Chips/<X>/)Faithful/ChipFaithfulanchors,SupportedMachine.lean, exactCoreAIR.leanSoundness/AIR.lean, grounding (ranked/timed/typed), host assemblies,Shard/,NativeCompleteness.lean,Examples/Composition/Top level:
ToClean/(42 files),ToMathlib/(6),ToPolyFun/(2),LeanRV64D/(generated),rust/sp1-comparison(SP1 v6.9.0 inventory and export comparison),rust/witgen-interp(legacy JSON witness interpreter),export/(fixtures),tools/backend-gadgets(pinned Node/snarkjs),scripts/(9 → 60 files).SP1CleanTest/now holdsCore/,Alignment/and threeTraceGenTests/support files.Where did upstream things go?
512e944abd7ecf1dSoundness/SP1GatedVm.lean(sp1_machine_soundness, onesorry),GatedVm/*,TargetVm.leanSoundness/AIR.lean(+GroundingInternal,ProviderBindings,BootHalt).GatedVm/Chain→Soundness/Walk.lean;BalanceMod→Model/BalanceBridge.leanSoundness/{State,Byte,Program,Memory}Consistency.lean,InstructionTrace,Completeness,ChipAirProofs/Completeness/Proofs/Chips/<X>/Bridge.leanAlignment/Chips/<X>/Bridge.leanFaithful/<Op>.leanper-operation anchorsFaithful/<X>Chip.lean; 12 helper op anchors keptExtracted/<X>Chip.lean,Extracted/Circuit/*Extracted/ChipOracle/<X>.lean; generated circuits deleted (Mul's became the hand-writtenCircuits/Gadgets/Mul)Native/Operations/{IsZero,Lt*,U16*,Bitwise*,Mul}…,Proofs/Operations/*Semantics/Specs/*+Circuits/Gadgets/*+Circuits/Types/*FormalModel/Trace/GuestProgram.leanModel/Semantics/GuestProgram.lean(extended; namespace unchanged)SP1CleanTest/WitnessTests/*,TraceGenTests/*Trace{Vectors,Witness}(native_decide)export/sp1dump/(25 SP1 trace dumps) + a fail-closed export gate + Rust comparisonsscripts/axiom_probe.lean,gen_axiom_probe.py,docs/snapshots/axiom-*scripts/check_trust.py+trust_policy.jsondocs/release-audit.md,bus-model.md,snapshots/compile-profile*docs/{assurance,semantics,architecture}.md,docs/audits/*,docs/agents/*Comparison.lean,Math/Misc.lean,Math/GetElemFastPath.lean,Model/InteractionRecovery.leanToMathlib/General.lean/ToClean/Tactic/GetElemFastPath.lean/ToClean/Circuit/InteractionRecovery.leanBuild and verify
A cold CI run on a 4-vCPU
ubuntu-latestrunner takes about 2 h: core ≈ 32 min, full ≈ 31 min, full tests ≈ 14 min, examples ≈ 25 min. Warm runs take 20–70 min. UseLEAN_NUM_THREADS=3on 4 cores. Generated inputs:update_extracted.py(extraction),scripts/sail-config/generate_lean_rv64d.sh(Sail),scripts/update_sp1_dumps.sh(SP1 dumps).Headline changes
1. Native AIR→Sail soundness (replaces GatedVm)
Phases P1, P2, P6–P9; #106, #107, #115, #120–#122.
supported_core_native_soundis the closed theoremWitnessRelation.Sound SupportedCoreNativeRelation SupportedCoreSailRelation, stated for any field with2^25 < p. It is stated over a plain CleanEnsemble(Soundness/SP1Ensemble.lean).The ensemble has 55 tables and 7 channels (State, Byte, Program, Memory, Exit, Syscall, PublicValues). The tables are:
Premises. The input relation has three conjuncts: what the AIR checks (public input, constraints, balance), an explicit semantic boundary, and an interim
SyscallTableInactive. The boundary (ProviderBindings.lean) consists of:SailConfigured, which pins privilege, interrupts,misa.M/C, PMP off and PMA);SailCodeMemoryCompatible.Conclusion. Either a normally-retiring official-Sail run with exit code 0, or a retiring prefix to
SP1Haltedfollowed by modeled HALT (+264 ticks). Either way the run comes with a populated Memory boundary, covering canonically addressed, genesis-backed records only.Derived inside the proof, not assumed:
How it is proved.
exists_exhaustiveTrail(balance + strict ℕ rank ⇒ every edge exactly once). Balance alone admits disconnected cycles (Soundness/Examples/StateBalance.lean), and Clean's VM theorem permits them. The memory argument needs exhaustiveness.TimedGrounding,TouchChainsfor same-row aliases such asadd x1,x1,x2,RefreshEliminationfor MemoryBump), on top of per-chip grounding contracts for all 25 chips.Siblings, all closed:
supported_core_native_sound_scheduled,supported_core_native_grounding,supported_core_native_shard_execution, andsupported_core_boot_to_halt_single_shard.2. Whole-chip faithfulness to SP1's Rust AIR, and SP1 conformance
Phases P2, P5, P6, P14, P15; #107, #114, #115, dtumad#115, dtumad#129–143, dtumad#149.
Proved.
ChipFaithfulreplaces about 50 per-operation anchors. It states that SP1's complete extractedassertZerolist holds iff the native constraints hold on the reconstructed Clean row, for every Rust row including padding. On rows where SP1's asserts hold, the complete active interaction multisets are permutations of each other.FaithfulPropForbinds each proof to its table in the kernel, so a mispaired anchor is a type error.The exact Core AIR.
Faithful/CoreAIR.leandefines SP1's 34+6-table Core AIR as a Lean relation built from the extracted lists. On top of it:extracted_instructionTables_constraintsis closed: the exact relation yields the 25 native instruction tables.Composition/) andsp1_air_sound_of_obligationsare conditional.Extraction.
update_extracted.pywas rewritten to emit whole-chip and system oracles plus a manifest, and it no longer emits circuits. Provenance is pinned to SP1 v6.4.0 (semanticf66b4bff, extractorb5616f90).Tested against SP1 v6.9.0.
rust/sp1-comparison(pinned tob8387fa6) compiles Clean's built-in Rust export and compares it with SP1's live trace generator and AIR, for all 25 instruction families and the six byte providers, in supervisor mode with open buses. It checks three things, plus column-mutation batteries:(channel, mult, message)ledgers, including zero multiplicities.Comparison testing found and fixed three native discrepancies:
op_alink word (P5 dump gate, Exportable witness generation for all 25 chips, gated against SP1's real prover #114);The last two were found against v6.8.1, before the move to v6.9.0. A source review found no CPU-AIR change from v6.4.0 to v6.9.0 (dtumad#149), but nothing was re-extracted at v6.9.0. The docs label the extraction/
ChipFaithfullayer "legacy Rust alignment".For a few operations (the Addw/Subw/LtU own-asserts and the DivRem tail), the native constraint list is a transcription of the generated one. There,
ChipFaithfulacts as a pin-drift tripwire rather than independent cross-validation.Upstream's
native_decidevector batteries were replaced by 25 committed SP1generate_tracedumps (export/sp1dump/) and a fail-closed cell-for-cell generation gate.3. Full-state execution model and the shard target
Phases P10, P12; dtumad#1, dtumad#61–99.
The state.
ExecutionState(Model/Core/, 63 files) is one official Sail state, a concrete host state and a clock. The host state holds the hint queue, two eight-slot commitment banks, outputs, requests and exit.Steps.
SailRetiresNormallyand cost 8 ticks.Snapshots. Finite
ExecutionSnapshots compare exactly (equivalent_iff).Shard.Executesincludes byte-level write permission, and comes with three closed results:misa.C = 0);Resources.
nativeProfileadds data-onlyResourceLimitsplus encoding conditions: phase-one clock and aligned loads/stores. This replaced a freeProfilepredicate (dtumad#78–82). The 2026-09-19 review had shown that the free predicate let the target statement hold vacuously.The capstone statement.
Soundness.Shard.statement_iff(ensemble.Statement header ↔ ∃ events, AdmissibleExecution …) is fixed and checked, but it is conditional:SoundnessTargetandCompilerTargetare not instantiated.statement_iff_of_realizesderives the same statement throughAir.Flat.Realizeson PolyFun'ssp1Machine.scripts/capstoneContract.leanpins the statement's types and definition fingerprints (1,395 entries).Closed installed results.
HostHintReadCPU.source_execution_with_memoryworks over an 89-table assembly. From raw constraints and balance it derives a genuineExecutionPathto some target, withWritesPermitted, the PC/clock endpoint, all native memory and register frames, and host reconstruction.HostFinalMemory.source_checkFinal, 93 tables);HostSailBoundary.statement_iff);ResourceEnsemble.statement_iff);4. Completeness and witness construction
Phases P5–P8, P12, P13; #114–#117, #119–#121, dtumad#81, dtumad#103, dtumad#141.
Generic construction (ToClean).
ToClean/Air/TableBuild.leanruns each circuit's own witness generator with committed data and hints (staging Verified-zkEVM/clean#450) and proves the built rows satisfy the constraints and guarantees (buildRow_constraintsHold,build_constraints).Realizes/CompleteEnsemblegive a generic "raw acceptance ↔ admissible trace" interface.Per chip. All 25 instruction chips have IR-only witness generators with
computableWitnessesproofs (check_no_witness_native.shgate), plus table-completeness theorems. Since dtumad#141 no instruction chip reads prover hints.Whole machine.
nativeTrace(Proofs/Completeness/) is a deterministic compiler, andsupported_core_native_completeis closed. Its domain is the semantic relation restricted byNativeTraceReady(13 named premises, includingsyscallFreeandexitZero) and channel capacity.NativeShardTraceTotal, the claim that every ordinary shard satisfies those premises, is open, so correctness and language equality are conditional on it.Progress toward totality.
Examples.
Realizesinstance (closed, toy).native_decide).5. Instruction layer
Phases P1, P2, P6, P9, P10, P14, P15; #106, #107, #115, #122, dtumad#116–141.
The same 25 chips. The same 25 instruction chips are registered (
Soundness/ChipRegistry.lean), all with closed soundness and completeness. Each now also provescomputableWitnesses(honest witness generation from the IR) andtraceTable_constraints(well-formed events build a valid table). What changed for a reviewer:Sail link. Upstream's
correct_<op>_nativestatements are kept, but only as local helpers. Each chip now provesChipKind.advance: from a refining Sail state, one realtry_stepproduces exactly the row's committed PC/register/memory effect (Proofs/Sail/Advance.lean). Decoder agreement with Sail is proved inProofs/Sail/InstructionDecode.lean. The readiness premises ofadvanceare discharged by the grounding layer.Native gadgets, not extracted circuits.
Extracted/Circuit/*is gone. Gadgets are hand-written Lean over native column types (Circuits/Types), and native code may not importExtracted/. Contracts are split into pureSemantics/Specsand bundledCircuits/Gadgets:The Add/Sub/Address operations and the readers still use the older layout.
Assumptions became constraints:
2^16 ≤ addr < 2^48);op_a_0routing gates;isU64, now derived from Memory-pull guarantees, soAssumptions = Truefor Add, Sub, Subw, Bitwise, Mul and AluX0.The other 19 chips still assume operand/immediate ranges.
Explicit selectors. DivRem, Mul, Bitwise, Lt, ShiftLeft, ShiftRight and Branch take explicit opcode selectors, and no instruction chip reads prover hints. How the Specs handle selection varies:
advanceReadypremise discharged by grounding.New circuits:
Native-only additions not in SP1's AIR (to keep in mind when comparing):
Faithful/.Fixes:
6. Export and backends
Phases P5, P13, P15; #114, dtumad#104, dtumad#129–150.
Upstream had no export path. The fork has two, and both are tests, not lowering proofs.
(a) Witness-IR JSON (transitional). All 25 chips serialize their witness programs through Clean's IR.
rust/witgen-interpre-runs them, and the output is gated cell-for-cell against the v6.4.0-era SP1 dumps.(b) Clean's built-in Lean→Rust export. Via the Clean fork, it covers:
ToClean.Gadgets.BitwiseByte);The instruction components and byte providers are compared with SP1 v6.9.0 as described above. The register/RAM ensembles have native Clean-backend tests only (
clean_export.rs,ram_export.rs), with no SP1 comparison.Fixed-column authentication.
ToClean/Air/StaticProvider.leanreplaced legacy lookups for snapshot source/target registers and RAM in the host and local-core assemblies (dtumad#144–148, dtumad#150). The provider premises of the 55-table theorem are unchanged. Five legacy lookups remain: program, syscall code, write permission, hint nodes, hint words.Coverage. Of the 93 native components in
coverage.json:R1CS/WASM. Three gadgets (IsZero, IsZeroWord, WordRangeCheck) are checked through Clean's Circom/WASM backend over BN254 with pinned snarkjs: 29 inputs and 26 mutations (dtumad#104).
Removed from git. The downstream sharing pass (
WitgenShare) was replaced by Clean'sWitgen.M, and 101 regenerated export files were dropped from git (dtumad#129).Major infrastructure changes
Trust, tests and CI
The trust policy.
scripts/check_trust.pyscans the compiled main and test environments againstscripts/trust_policy.json(dtumad#66, dtumad#67). It replaces the committed#print axiomscensus, which removed about 101k generated lines. The policy permits:bv_decideproof owners, each a compiler-trusted native-evaluation axiom (12 Store bridges, 2 shift Sail lemmas,jump_to_of_mod4_eq_zero, and 2 inside pinned Clean);native_decide/bv_decide.sorryAx,trustCompiler,ofReduceBooland unknown axioms are rejected.[propext, Classical.choice, Quot.sound]". Upstream's stated goal was that; the fork's claim is policy compliance.scripts/run_audit.shrequires zerosorryand zerostop. Upstream allowed onesorryand ninesorryAxcarriers.Other gates:
check_release_surface.py, an inventory check of the 25-chip registry, oracles, anchors, dumps and Rust registrations;CI (
.github/workflows/) moved from upstream's self-hosted RunsOn runners to one GitHub-hosted runner. Every build uses--wfail --iofail. The steps are:It uses a lineage-selected cache (v2), a native-object cache, a PR→main build hand-off and rule-based cache GC. Additional workflows:
rust-comparison.yml(SP1 inventory, with and withoutmprotect);sail-regen.yml(byte-identical Sail regeneration);extraction_regen.yml(weekly);cache-cleanup.yml;build-experiment.yml.Tests.
SP1CoreTest/SP1CleanTesthold non-vacuity witnesses, adversarial and mutation fixtures, snapshot/host regressions, export fixtures and ensemble round-trips, about 570native_decidesites in all. Python tooling has 12 unittest modules.Toolchain, Sail and build performance
Four toolchain bumps. 4.30 (#106), 4.31 (#107), 4.32.2 (#110) and 4.33.1 (dtumad#31). In July the non-Mathlib dependencies were briefly local path dependencies; reproducible git pins came back in August.
The Sail model.
sail-riscv-leanbranch with a config-generated snapshot.riscv-lean.Elaboration budgets. Hand-written
set_option maxHeartbeatswent from 259 lines in 128 files to 0 (#108, #109).check_option_escapes.shnow prohibits new escapes instead of counting them.The build-time campaign (dtumad#44–60):
Registerlemmas by kerneldecide, −53% CPU;lethoisting: 62 s / 14 GB → 9 s / 3 GB;Mathlib.Tacticimports;-j2withLEAN_NUM_THREADS=3.Cold core builds after a toolchain bump went from 65–75 min to about 32 min.
Layout, modules and docs
Layout.
To*libraries started in P5 and were reshaped in Add the generic machine layer and instantiate the shard contract on it dtumad/sp1-lean#5 and Module system, tier 1: ToMathlib, ToPolyFun, ToClean as module files (issue #7 PR 5) dtumad/sp1-lean#32.Module system. All
To*files are modules, but only 77 of 1,122SP1Clean/test files are; the rest run underallowNonModules, tracked in dtumad#33. The docs call the Semantics/Circuits/Machine reorganisation "in progress".Lint.
autoImplicitis off, Mathlib's standard linter set is enabled package-wide with 9 measured opt-outs, andnolints.jsonholds 3,836 entries of known debt, mostlydocBlame.Docs. Maintained guides grew from 11 to 20 and generated snapshots were removed, so
docs/went from 44 to 28 files (dtumad#114 consolidated 37 down to 28). The current set:docs/{README,architecture,semantics,assurance,layering,export,examples,contributing,resource-contract,roadmap,witgen-wire-format}.md;docs/agents/*;docs/audits/*;docs/snapshots/capstone-contract.json.The top-level
READMEandAGENTSwere rewritten too.Maintained docs link to issues on the fork's tracker.
Review findings and known limitations
External and internal reviews:
bd7ecf1dRegisterAccessColslacking#[repr(C)], KoalaBear literals in the exact relation, …#[repr(C)], not yet filed with SP1), F7 (KoalaBear literals), F15 (language alignment)misa.Mcondition)Profilepredicate made the target vacuous;Executesadmitted self-modifying code; installed theorem is existential; no mixed compiler; duplicate carriersProfile→ data-only limits (fixed); self-modifying code excluded viaWritesPermitted(fixed); duplicate carrier fixed; existential target and mixed compiler openThe agent-authored audits are navigation aids, not independent human sign-off.
Restrictions of the closed results (these must not be glossed over):
JAL x0,0), which usenative_decide;misa.C = 0;ResourceLimitsis a free parameter, and limits are enforced at the endpoints only.Known issues at this head:
extraction-regenjob has failed since Oct 5.update_extracted.py'snative_structs()rejects the multipleColumnsstructures underCircuits/Types/. Until that is fixed, nothing re-derivesSP1Clean/Extracted/against the pin.does not close #12; GitHub most likely matched that text as a closing keyword. Items C2–C12 are unchecked and remain open: supplied-target equality, WRITE/VERIFY, resources, the mixed compiler andSoundnessTarget.Proofs/Completeness/Assembly.lean,Model/InstructionChipId.lean,Faithful/SupportedMachine.lean);layering.txtBridge paths;porting-recipe.mdstill describing the upstream four-artifact chain;resource-contract.md;ubuntu-latestmoves to Ubuntu 26 on 2026-10-19, and Node 20 is deprecated across the pinned actions. Neither is addressed yet.ChipFaithful/dump pipeline in favour of Rust tests. The docs say this would not be a formal lowering theorem.Upstream contributions and external status
AgreesBelowconstrains data/hints (staged inToClean)Witgen.Mopen PreSaildisambiguationdoworkaround for RvfiDii)RegisterAccessColslacks#[repr(C)](external-report F6)Chronological changelog (P1–P15)
1,148 of the 1,155 non-merge commits fall in P1–P15; the other 7 are pre-squash #104 history already in the base. ± counts hand-written lines only, measured between first-parent boundary commits.
The stacked upstream PRs #106–#110, #114–#117 and #119–#122 were superseded by this branch. Each head is an exact commit on it (#106 =
6c399dbd, #107 =c3c5cd4f, #115 =73344965, #122 =a1efce55). #111–#113 merged into stack branches, not intomain.P1 · Jun 26–Jul 12 · #106 · 123 commits · +25.0k/−4.8k.
main; Byte/Range and Program-ROM providers; Memory polarity flip.sp1Ensemblereplaced the GatedVm data layer. A CleanVmTablesmigration was tried here and abandoned in P2.GeneralFormalCircuits.try_stepreduction (fetch, minstret,SailConfigured).ChipKind.advancefor 25/25 chips; decode rework with image-guarded ROM decode.sailEquiv/reaches_sailpath was removed.P2 · Jul 16–27 · #107 · 69 commits · +116.8k/−23.8k.
TimedGrounding, touch chains) and per-chip grounding contracts.TypedProgram: 92 s → 4.5 s.DivRemCompare/DivRemCore; all 25 chips sound and complete.supported_core_native_sound, at that point over 36 tables.Faithful/CoreAIR.lean+CoreProfile; conditional*_of_obligations.ChipFaithful25/25 via generatedChipOracles.VmChannel,InstructionTraceand the per-op anchors.P3 · Jul 27–Aug 2 · #108, #109 · 167 commits · +12.7k/−17.5k.
ChipContractsmacros, 176 eval bridges replaced by one helper.maxHeartbeats→ 0;check_option_escapes.shallowlist.P4 · Aug 6–12 · #110–#113 · 13 commits · +6.4k/−2.0k.
P5 · Aug 12–19 · #114 (+11 commits of #115) · 66 commits · +17.1k/−3.3k (+268k generated).
ToClean/ToMathlibcreated.rust/witgen-interp.native_decideanchors retired. The new gate caught theop_adivergence.P6 · Aug 20–23 · #115 · 55 commits · +32.7k/−2.6k.
misa.Mpinned, which fixed vacuity for M rows; decode witnesses 18/18.GoodnessFilter,RefreshElimination, ensemble at 53 tables; memory-timestamp premise derived.Table.build+ per-chip completeness;supported_core_native_complete.Composition/).P7 · Aug 23–25 · #116, #117, #119 · 94 commits · +20.4k/−7.9k.
nativeTrace+ functional completeness;*Consistency/ChipAirshadows retired.Composition/as its own pillar.NativeShardTraceTotalnamed as the single gap.check_release_surface,check_current_docs.P8 · Aug 28–31 · #120, #121 · 39 commits · +11.2k/−1.8k.
SailRetireChain; model-freesupported_core_native_sound); boundary regrouped; Memory boundary populated;AIR.leancut from 1,202 to ~300 lines.OrdinaryRun ∨ HaltedRun;CommittedProgTruth.supported_core_boot_to_halt_single_shard.closingKeysfix.P9 · Sep 1–8 · #122 · 121 commits · +13.4k/−0.8k.
syscallInstrsChip_faithful.SyscallTableInactive.P10 · Sep 8–19 · dtumad#1 · 192 commits · +61.6k/−3.7k.
Model/Core/: state/step/path/snapshot, eight-call host, paired replay.HostHintReadCPU.source_execution_with_memory.Shard.statement_ifftarget.ubuntu-latest.P11 · Sep 19–22 · dtumad#2–60 · 63 commits · +15.9k/−4.3k (+174k vendored Sail).
runLinter(Bring the lakefile, lint driver and CI to the upstream idiom dtumad/sp1-lean#19);autoImplicitoff (Lakefile: auto-bound implicits off, instance budget at the default (the two decisions deferred from #19) dtumad/sp1-lean#35).LeanRV64D+ regeneration CI (Vendor the generated Sail model and verify regeneration is idempotent in CI dtumad/sp1-lean#14); riscv-lean retired (Retire the riscv-lean dependency dtumad/sp1-lean#15).main, Clean fork retired (Toolchain: Lean v4.33.1, upstream Clean main, Clean fork retired (issue #7) dtumad/sp1-lean#31).ToPolyFun+Realizes(Add the generic machine layer and instantiate the shard contract on it dtumad/sp1-lean#5).P12 · Sep 22–27 · dtumad#61–99 · 36 commits · +15.9k/−7.8k (−101k census).
WritesPermitted(Define ordinary store permissions and prove installed replay preserves ROM dtumad/sp1-lean#64, Require ordinary write permission throughout native shard execution dtumad/sp1-lean#65, Derive semantic path write permission from the installed AIR dtumad/sp1-lean#69).misa.C = 0(Make Sail fetch and retirement lemmas available to the semantic core dtumad/sp1-lean#70–77).nativeProfile(Share native ranges and specify numeric resource limits dtumad/sp1-lean#78–82).HostSailBoundary(Bind the supplied Sail frame and public endpoint dtumad/sp1-lean#94); ordinary State receipts (Publish ordinary State receipts from existing instruction rows dtumad/sp1-lean#95, Order ordinary receipts and construct retirement observations dtumad/sp1-lean#97, Install ordinary receipts without dropping store protection dtumad/sp1-lean#99).P13 · Sep 27–29 · dtumad#100–110 · 16 commits · +6.8k/−0.2k.
Realizes, ADD walkthrough, balanced-cycle counterexample (Add runnable AIR examples and a complete counter arithmetization dtumad/sp1-lean#100).LoadByteStaticChip(Verify a fixed-byte-table alternative for LoadByte dtumad/sp1-lean#109).P14 · Sep 29–Oct 1 · dtumad#114–128 · 17 commits · +14.9k/−15.5k.
rust/sp1-comparisoninventory crate (Track released SP1 inventory drift in Rust dtumad/sp1-lean#115).ProvableOptional(Add statically optional circuit columns without a Clean fork dtumad/sp1-lean#117).Semantics/Specs+Circuits/Gadgetsfor IsZero, word equality, DivRem, U16, Lt (Consolidate the zero-test contract and bundled circuit dtumad/sp1-lean#118–122, Give signed comparison a semantic contract and bundled gadget dtumad/sp1-lean#125); module-mode contracts (Isolate shared contract imports and use module mode dtumad/sp1-lean#126); transport consolidation (Consolidate transport proofs and provider examples dtumad/sp1-lean#127).P15 · Sep 30–Oct 15 · dtumad#129–150 · 77 commits · +35.5k/−32.1k.
Model/Core/Profile(Audit SP1 v6.9.0 and decouple the native execution profile dtumad/sp1-lean#149).Smaller changes
Correctness fixes:
misa.Munpinned (the capstone was vacuous for M rows, Exact-AIR alignment: external-audit response, machine completeness, and exportable witness generation #115) andmisa.Cunconstrained (Enforce fixed instruction alignment in the native Sail platform dtumad/sp1-lean#73).op_alink word whenrd = x0(Exportable witness generation for all 25 chips, gated against SP1's real prover #114).active(Unify native bus assembly and prove deterministic completeness for admissible shards #116);closingKeyscounting padding (Track 2: halting shards, the Exit hand-off, and the first boot-to-halt claim #121).import Mathlib.Tacticroots to the tactic modules they use dtumad/sp1-lean#54); census probe-loss regex (The full SyscallInstrsChip, with full semantics #122); oracle opcode renderer.autoImplicitsilently eating a theorem (Lakefile: auto-bound implicits off, instance budget at the default (the two decisions deferred from #19) dtumad/sp1-lean#35).Performance:
JalrChip110 s → 6 s;DivRemChip/Exact278 s → 10 s;MulOperation40M → 1M heartbeats.Globaloracle 62 s / 14 GB → 9 s / 3 GB (Extractor: hoist Global's let chains into top-level defs (62 s / 14 GB → 9 s / 3 GB) dtumad/sp1-lean#51); struct-eval −80% (provable_struct_eval_lemmas: per-field proofs by rfl and targeted rewrites (−80 % on DivRemColumns) dtumad/sp1-lean#52);ShiftRight−44% (ShiftRightChip/Core: omega and helper lemmas for the seven heaviest nlinarith sites (−44 % CPU) dtumad/sp1-lean#49).RTypeChips−84% (Kernel cliffs: RTypeChips and GroundingAdapter bus lemmas through scalar view projections (−84 % / −80 % CPU) dtumad/sp1-lean#55); destructuring −55% and −81% (Faithful/SyscallInstrsChip: chunk the two 80-conjunct rintro patterns (−55 % CPU) dtumad/sp1-lean#58, DivRemChip/Evidence: chunk the two 121-conjunct obtains (−81 % CPU) dtumad/sp1-lean#59).import Mathlib.Tacticroots to the tactic modules they use dtumad/sp1-lean#54).CI and tooling:
check_option_escapes,check_pins,check_root_index,check_no_witness_native,check_layering,check_release_surface,check_current_docs, the capstone manifest,check_trust.sail-regen,extraction_regen,rust-comparison,cache-cleanup(cache GC by rule),build-experiment(Build profiling toolkit: critical path, PR comparison, CPU sweep, experiment workflow dtumad/sp1-lean#44).Docs:
sail-model-provenance.md(Sail model: replace the hand-edited fork with a config-generated snapshot #111).resource-contract.md(Share native ranges and specify numeric resource limits dtumad/sp1-lean#78).docs/audits/*(unification architecture, capstone assessment, capstone review).Additions in
To*libraries:WitgenBridge,WitnessGenerationData,AgreesBelowWithData,StructEvalLemmas,IteDecide,GetElemFastPath;TableBuild,EnsembleBuild,CompleteEnsemble,Realizes,EnsembleCheck,FiniteLookup;PublicVerifier,Footprint,TableSlot,Receipt;ProvableOptional,StaticTable/StaticProvider,BitwiseByte.BitVec,ListChronology,ListFilterMap,ListMapMOption,ExtDHashMapOfFintype.Labeled,Orbit.Removals:
TargetVmand thesailEquivpath.VmChannel,InstructionTrace.*Consistencyshadows.native_decidevector batteries.sp1Lint; the census machinery (≈ −101k lines).WitgenShareand 101 generated files (Adopt Clean's canonical ensemble data and built-in export dtumad/sp1-lean#129).Open fork trackers relevant to review:
🤖 Generated with Claude Code