Skip to content

JoltConstraints side of #39, and re-pin of both libraries to Jolt ff6fc6568 with no temporary restrictions - #73

Open
quangvdao wants to merge 84 commits into
split/b-bytecodefrom
split/c-constraints
Open

quangvdao wants to merge 84 commits into
split/b-bytecodefrom
split/c-constraints

Conversation

@quangvdao

@quangvdao quangvdao commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

This is PR C of the three-way split of #39 that Ari asked for: the JoltConstraints side. From #39 it adds the whole-run theorems that connect Jolt's constraints to the Sail model, weakens the field premise so that Jolt's 128-bit Akita field qualifies, and adds Jolt's constraint (63) for that field.

Since the split, this PR also re-pins both libraries, JoltBytecode and JoltConstraints, to a16z/jolt ff6fc6568. #72 carried the bytecode part of the re-pin for a while. It moved here because the re-pinned bytecode model breaks JoltConstraints, and CI can pass only with both parts together. #72 reverted those commits (b41b311), and this PR keeps them. The main results of the re-pin:

  • JoltInstance.soundness and JoltInstance.sail_soundness take no temporary restriction. All six fields of TemporaryRestrictions are gone, and so is the structure.
  • The constraints follow ff6fc6568: a halt-lane row binds the claimed panic flag to the kind of halt, two new RAM claims check protected words and the number of RAM accesses, and the RAM Hamming-weight constraints and the panic and termination words are gone.
  • The whole-run theorems stop at the first explicit halt (jolt.success or EBREAK), compare outputs read from shared memory, and derive the panic flag from the halt kind. BlockConforms keeps one of its six fields, riscv.
  • DecodedFrom transcribes decode_elf at ff6fc6568, and RowsAligned and BlockConforms.no_code_store are no longer premises: the proofs derive them from DecodedFrom and from the tracer's protected-store check.
  • The two RAM-history completeness theorems, (37) and (38), are now proved.
  • The constraint generator from Track T: decoder sweep (T2), R1CS generation (T3), lookup tables (T4) and provenance gates (T7) #56 is ported and regenerated at ff6fc6568, with proofs that the generated rows and relations equal the handwritten ones.

Stack: main ← #71 (Sail model) ← #72 (JoltBytecode) ← this PR (JoltConstraints). #44 and the PRs above it are still based on #39's branch and are to move onto this PR.

Re-pin to Jolt ff6fc6568

The Jolt changes behind the re-pin are a16z/jolt#2417 and #2451 (runs end at jolt.success or EBREAK, the halt lane, the panic and termination words deleted), #2418 and #2408 (stores to protected words must keep their value, and the verifier checks this), #2509 (the I/O gap and heap padding become ordinary memory) and #2410 (host calls never fail). The first four subsections cover the bytecode model, and the rest cover JoltConstraints.

Bytecode model (JoltBytecode/)

  • Memory layout. MemoryLayout.new (JoltISA/JoltDevice.lean) follows MemoryLayout::try_new. The layout has no panic or termination word, and io_end is output_end. RAM is backed up to the padded power-of-two domain (max_ram_k?, Mmu.ram_backing_end), and the gap between io_end and RAM and the heap padding are ordinary readable and writable memory.
  • Shared memory. JoltDevice now has only memory_layout and the panic flag. Inputs, advice and outputs are bytes of sail.mem, like RAM. JoltDevice.initialMem writes the inputs and both advice buffers at their layout addresses, and JoltDevice.outputsOf reads the full output region from final memory (outputsOf_size gives its length). A missing byte reads as zero, as in the tracer's zero-filled storage.
  • Protected stores. SailJoltState.codeRegion records the code span, computed as Jolt's code_region does. A store into a code, input, trusted-advice, untrusted-advice or canary word succeeds only if every protected byte it touches keeps its old value (Mmu.protected_store_ok). This replaces the old rejection of stores to the input and advice regions and the old canary exclusion.
  • Halts. CPU state gains halted : Option JoltHaltKind, with kinds success and panic. The decoder accepts jolt.success only as the word 0x0000305B (Decode.decodeJoltSuccess_some_iff), and EBREAK now lowers to a single Panic row. execHalt writes the link register, sets nextPC to the instruction's own address, and records the halt kind and the panic flag. Decode.SourceInstruction.tick does nothing once the state has halted (SourceInstruction.tick_halted).
  • Host calls (JoltISA/HostIO.lean). readHostBytes is now a pure, all-or-nothing read of a byte range through the guest's own load check (Mmu.load?). An unknown call, an invalid event or a rejected range retires with no state change, and an advice call appends the bytes it read to the advice tape in both live and replay mode. JoltHostIOConfig loses its overflowChecks field.

Bytecode premises

JoltRamLoadOk uses the padded backing bound instead of heap_end:

-- old
structure JoltRamLoadOk (addr : BitVec 64) (js : SailJoltState) : Prop where
  below_heap_end : addr.toNat < js.jolt_device.memory_layout.heap_end.toNat
-- new
structure JoltRamLoadOk (addr : BitVec 64) (js : SailJoltState) : Prop where
  below_backing_end : addr.toNat < JoltISA.Mmu.ram_backing_end js.jolt_device

JoltRamStoreOk takes the stored value and width, and replaces the canary exclusion with the value-preservation check:

-- old
structure JoltRamStoreOk (addr : BitVec 64) (js : SailJoltState) : Prop where
  below_heap_end : addr.toNat < js.jolt_device.memory_layout.heap_end.toNat
  outside_canary :
    addr.toNat < js.jolt_device.memory_layout.stack_end.toNat ∨
      js.jolt_device.memory_layout.stack_end.toNat + JoltISA.STACK_CANARY_SIZE ≤ addr.toNat
-- new
structure JoltRamStoreOk (addr : BitVec 64) (js : SailJoltState)
    (value : BitVec 64) (width : Nat) : Prop where
  below_backing_end : addr.toNat < JoltISA.Mmu.ram_backing_end js.jolt_device
  preserves_protected : JoltISA.Mmu.protected_store_ok js addr.toNat value width = true

The old store premise was false for some stores that Jolt's tracer accepts at ff6fc6568. For example, an aligned store of a different value into an instruction word passed the address check but fails Jolt's assert_write_protected_store.

The bundles pass the value that the lowered rows actually write:

  • StoreProgramEqSailAssumptions gains a storeWidth parameter (default 8). Its jolt_ram_store field checks the merged doubleword that SB, SH and SW write, not only the address. RiscvInstruction.equivAssumptions selects widths 1, 2 and 4 for SB, SH and SW; SD keeps 8.
  • AmoDwordProgramEqSailAssumptions and AmoWordProgramEqSailAssumptions check the doubleword that holds the atomic's result. SC checks the doubleword it selects, including the unchanged value that a failed SC writes back.
  • Moving setup facts across an intermediate state now needs equal code regions as well as equal layouts (SetupSame). The word-atomic prelude theorems now conclude SetupSame, which is stronger than the old layout-only conclusion.
  • The generic instruction frame (ProofSupport/InstructionFrame.lean) now allows only Sail effects that preserve memory, where the old frame allowed any replacement of Sail state. Its store obligation is a checked MMU doubleword store, and it gains a rule for the halt fields.

No exported instruction-equivalence theorem gains an unrelated premise.

Bytecode theorem statements

  • 63 theorem headers change directly, in the store, atomic and SC proofs and in the frame and memory support files. reports/2026-11-24-bytecode-repin-statements.md gives the old and new text of each, with its location.

  • RiscvInstruction.joltRun_eq_execute, joltStep_eq_try_step_base, joltStep_eq_try_step_compressed and joltStep_stepInvariant keep their text, but their memory cases now take the value-dependent store premise and the padded load bound through equivAssumptions.

  • The device-array interfaces are removed: storeDeviceByte_same, storeDeviceByte_outputs_fit and three unused device-relation wrappers. store_raw_same, JoltDevice.outputsOf_size and the shared frame replace them.

  • The host-call reader changes its interface:

    -- old
    def readHostBytes (loadByte : BitVec 64 → JoltMonad (Result (BitVec 8) ExecutionResult))
        (overflowChecks incrementAfterLast : Bool) {width : Nat}
        (pointer : BitVec width) : Nat → Array (BitVec 8) →
          JoltMonad (Option (Array (BitVec 8)))
    -- new
    def readHostBytes (loadByte : Nat → Option (BitVec 8))
        (pointer count addressLimit : Nat) (bytes : Array (BitVec 8)) :
        Option (Array (BitVec 8))

    execHostIOWith now takes SailJoltState → Nat → Option (BitVec 8) instead of a monadic byte loader. execHostIO keeps its type. The frame lemmas InstructionFrame.execHostIO_rule and Step.frames_hostIO keep their statements, and four private helpers that framed the old stateful reader are deleted.

  • New theorems include:

    theorem execHostIO_result (state : SailJoltState) :
        execHostIO state = .ok RETIRE_SUCCESS state ∨
          ∃ bytes, execHostIO state = .ok RETIRE_SUCCESS
            { state with adviceTape :=
                { state.adviceTape with bytes := state.adviceTape.bytes ++ bytes } }
    
    theorem execHostIO_succeeds (state : SailJoltState) :
        ∃ post, execHostIO state = .ok RETIRE_SUCCESS post

    and Decode.decodeJoltSuccess_some_iff, Decode.SourceInstruction.tick_halted, JoltISA.execHalt_vreg_run, JoltISA.Mmu.store_raw_existing (a store that writes back the existing byte is accepted, even at a protected address), and execInstr_memory and execProgram_memory (successful execution preserves every protected byte). This PR uses execHostIO_succeeds to remove the HostCallsSucceed restriction from JoltInstance.soundness (below).

Bytecode modelling choices and limits

  • Host allocation always succeeds in the model. When Jolt's tracer fails to reserve memory while reading an advice range (try_reserve), it ignores that advice write, while the model appends the bytes. Host out-of-memory aborts are not modelled as guest outcomes.
  • Stdout, logs, cycle-marker tables and other host state stay outside the model.
  • The source step still takes the decoded instruction from its caller and does not model the tracer's fetch cache. The whole-run proofs supply the instruction at the fetched PC.

reports/2026-11-24-bytecode-repin.md and reports/2026-11-24-hostio-repin.md give the Jolt source locations for each choice.

Constraints

Constraint Old New
Row 14 nextUnexpandedPCEqLookupIfShouldJump: ShouldJump(t) · (NextUnexpandedPC(t) − LookupOutput(t)) = 0 nextUnexpandedPCEqLookupIfJump: Jump(t) · (NextUnexpandedPC(t) − LookupOutput(t)) = 0
Row 21 shouldJumpEqJumpMulNotNextIsNoop: ShouldJump(t) = Jump(t) · (1 − NextIsNoop(t)) haltEndRule io.panic: 2 · (NextIsNoop(t) − IsNoop(t)) = (2 − Π) · Halt(t) + HaltPanic(t), where Π is 1 when the instance claims a panic and 0 otherwise
RAM claim 2 (new) none ramWriteProtected: 0 = Σ_k C(k) · RamRa(k, t) · RamInc(t), where C (ramWriteProtectedMask) marks the words of the code region, the inputs, both advice regions and the stack canary
RAM claim 3 (new) none ramAccessCount: Load(t) + Store(t) = Σ_k RamRa(k, t)
RAM Hamming weights ramHammingWeightBooleanity, ramRaChunkHammingWeight removed, as in #2408
RAM output check ramPublicIoMask covers [input_start, RAM_START_ADDRESS), and ramPublicIoWord includes the panic and termination words the mask covers [input_start, output_end), and the public words are the inputs and outputs only

The witness gains the circuit flags Halt and HaltPanic (CircuitFlags grows from 14 to 16 constructors) and loses the ShouldJump and RamHammingWeight columns. ConstraintContext.io and JoltInstance.public_io now use JoltPublicIo (layout, inputs, outputs and the panic claim) instead of JoltDevice. JoltInstance.validate_inputs adds Jolt's checks that the entry address is nonzero and that the code region is well formed (validate_code_region).

Temporary restrictions removed

Removed field of TemporaryRestrictions What it required Why it is no longer needed
tracerAddressChecks Every load and store the program attempts passes the tracer's address checks The tracer now accepts value-preserving stores to protected words. Layer5/SharedMemoryChecks derives the selected row's address and protected-value checks from ramWriteProtected and ramAccessCount
hostCallsSucceed Every attempted VirtualHostIO call succeeds The host-call model is total, as Jolt's tracer is (see the bytecode model above). host_call_exec_sail_frame uses execHostIO_succeeds
noMaxLengthTrace No trace fills the largest power-of-two domain within the instance maximum Jolt's prover at ff6fc6568 rounds the row count itself up to a power of two and adds no padding row. The prover and the verifier therefore agree on the maximum
terminationThenStall After a store to the termination word, the next jump is the stall There is no termination word; a run ends at an explicit halt row
panicStoresOne Every store to the panic word stores 1 There is no panic word; the panic flag comes from the halt kind
claimsNoPanic The instance claims no panic haltEndRule binds the claimed panic flag to the halt kind, and Layer7/Stopping proves soundness for both claims

The HostCallsSucceed definition that was removed last:

def JoltInstance.HostCallsSucceed (joltInstance : JoltInstance SourceInstruction) : Prop :=
  ∀ (privateInputs : JoltPrivateInputs)
    (run : JoltConstraints.Soundness.UntrustedAnswerRun joltInstance privateInputs)
    (next : Fin run.bytecode.size) (pre : SailJoltState),
    run.NextStep next pre →
      match run.bytecode[next].instruction with
      | .VirtualHostIO => ∃ post, execHostIO pre = .ok RETIRE_SUCCESS post
      | _ => True

Soundness statement

JoltInstance.soundness drops the (restrictions : joltInstance.TemporaryRestrictions) and (assumptions : joltInstance.SoundnessAssumptions) premises:

theorem JoltInstance.soundness {F : Type} [Field F] (joltField : JoltField F)
    (joltInstance : JoltInstance SourceInstruction)
    {params : WitnessParams} (privateInputs : JoltPrivateInputs)
    (witness : WitnessType F params)
    (satisfied : JoltConstraints.AllConstraints joltInstance privateInputs witness) :
    joltInstance.InLanguage

Its only premise about the field or the instance is now JoltField F. The conclusion InLanguage has the same text, but the definitions under it follow the new pin:

  • HonestTrace.stops: the last row is an explicit halt (TraceRow.Halts), where it used to be a self-jump that repeats (StableStall). runs_until_stop now says that no earlier row is a halt.
  • Trace.matches_outputs reads the outputs from the final shared memory with outputsOf, where it used to read the device's output array.
  • padded_trace_length is max 256 (2 ^ Nat.clog 2 rows), where it used to be 2 ^ Nat.clog 2 (rows + 1) for 256 rows or more. JoltISA.Instr.is_jump now includes both halt instructions.

The restrictions premise is dropped from soundness_reconstruct_trace, soundness_execution_prefix_agreement, JoltInstance.boundary_step, JoltInstance.row_step, row_extension, host_row_step, jal_row_step, jalr_row_step and append_host_row. append_host_row also drops its honestAdvice premise, which only served the removed restriction. host_call_exec_sail_frame and host_call_selected_step drop HostCallsSucceed and their NextStep premise. soundness_prover_accepts drops noMaxLengthTrace. No conclusion of these theorems changes. reports/2026-11-24-constraints-repin.md lists the interface changes made earlier in the re-pin.

Whole-run statements

HonestTrace.sail_reproduces drops (hrows : joltInstance.program.RowsAligned). JoltInstance.sail_soundness drops the same premise and (restrictions : joltInstance.TemporaryRestrictions). HaltPrefix.sailRun and BlockConforms.simulates also drop their RowsAligned premise. Both conclusions change in the same way. The old conclusion of sail_reproduces ended with:

      trimTrailingZeros (sailOutputs trace.initialState.jolt_device s) =
        trimTrailingZeros final.jolt_device.outputs ∧
      (sailPanicWord trace.initialState.jolt_device s ≠ 0 ↔ final.jolt_device.panic = true) ∧
      (SailHalted joltInstance.program s ∨ halt = final)

and the new one ends with:

      trimTrailingZeros (halt.jolt_device.outputsOf s.mem) =
        trimTrailingZeros (final.jolt_device.outputsOf final.sail.mem) ∧
      ∃ kind, final.halted = some kind ∧
        final.jolt_device.panic = (kind == JoltHaltKind.panic) ∧
        (SailHalted joltInstance.program s kind ∨ halt = final)

sail_soundness has the same change with joltInstance.outputs and joltInstance.panic on the right-hand sides. After the review below, both theorems also drop the unused configuration premise hcfg, and their conclusions start with the exact step count, ∃ s, sailRun pre.length (sailInit trace.initialState) = .ok () s ∧ Related halt s ∧ …, where they had ∃ n s, sailRun n ….

  • The halt prefix (HaltPrefix) is now the list of blocks before the first explicit halt, jolt.success or EBREAK.
  • Related.ram now equates Sail's memory with Jolt's shared byte memory at every address, including the I/O region. The old io, panic and outputs_size fields of Related are gone.
  • BlockConforms keeps only riscv. It loses no_flag_word_load, panic_store_nonzero and amo_no_flag_word, because the flag words no longer exist, and no_zero_doubleword_load, because the tracer now rejects loads below the mapped I/O regions and read_lower derives the lower bound from the checked read.
  • BlockConforms also loses no_code_store. The code region that JoltInstance.initial_state computes covers every row byte that the image loads (codeRegionAt_covers), execution preserves every protected byte (JoltIOSetupFrame.execProgram_memory), and Jolt's tracer rejects a store that changes one. JoltCodeIntact.of_block (WholeRun/CodeInv.lean) derives from these facts that every block keeps the code bytes. JoltISA.codeRegionOf is now codeRegionAt at the layout's lowest address, so the tracer model and the ELF loader share one transcription of Jolt's code_region.
  • DecodedFrom (WholeRun/Elf.lean) now transcribes decode_elf at ff6fc6568, where it transcribed c336a6da7. The new version skips the data ranges that $d mapping symbols mark inside text sections, rejects an instruction at an odd address, and rejects a writable section that overlaps the code region. It is not weaker than the old premise: the new checks reject some ELFs that the old one accepted. Every program that Jolt's loader accepts at ff6fc6568 satisfies it. Rv64ProgramImage.DecodedFrom.rowsAligned derives RowsAligned from the odd-address check.

docs/whole-run-theorem.md states both theorems at this head and explains every premise.

Proofs

  • The whole-run proofs use the shared byte memory: SharedMemorySim and AtomicMemorySim compare the actual stores at every address and replace Prove that Sail reproduces every honest Jolt run, with the fp128 field and the ELF loader #39's separate I/O modules.
  • The soundness proof derives the selected word's address and protected-value checks from the RAM constraints (Layer5/SharedMemoryChecks), proves that code is unchanged (Layer5/CodeRegionFrame), and proves the stopping argument from the halt lane (Layer5/Halt, Layer7/Stopping).
  • Completeness proves the new constraints (HaltEndRule, RamAccessCount, RamWriteProtected) for the honest witness. It also proves honestWitness_ramValEqInitialPlusPrefixRamInc (37) and honestWitness_ramValFinalEqInitialPlusRamInc (38) with unchanged statements. Both were false in the old device model, which ignored stores to the termination word and set its final value from the panic flag (A store that the device ignores breaks the RAM history constraint a16z/jolt#1950, #1951 item 1).
  • The host-call frame proofs case on execHostIO_result. The helpers that framed the old byte reader are deleted: JoltHostFrame.{pure_rule, bind_rule, read_rule, get_rule, throw_rule, modifyAdvice_rule, loadByte_rule, readHostBytes_frame}, the same eight in Register42VRegs, the SailAndVRegsUnchanged and SailUnchanged namespaces, JoltNextPCFrame.readHostBytes_frame and JoltNextPCFrame.execHostIOWith_frame. None had a caller outside these proofs.
  • Soundness/Layer5/DeviceMemoryObstruction.lean, which described the removed flag words, is deleted, and with it its two decide +kernel commands.

Constraint generator

  • scripts/expansion-parity/ gains constraint-gen, ported from Track T: decoder sweep (T2), R1CS generation (T3), lookup tables (T4) and provenance gates (T7) #56. It reads Jolt's R1CS rows, the four relations (RAM read-write checking, register read-write checking, instruction-input virtualization, Spartan shift) and the per-kind flag and lookup tables, and writes JoltConstraints/ConstraintGen/Generated/. The committed files are generated at ff6fc6568: 22 rows, four relations and 96 instruction kinds.
  • ConstraintGen/Equiv.lean proves each generated row and relation equivalent to the handwritten constraint, and that Lean's per-instruction flags and tables equal Jolt's for every modelled kind. It has no sorry. The coverage check excludes exactly VirtualXORROT2 and VirtualXORROT61, two inline-only kinds that the model does not have.
  • .github/workflows/constraint-generation.yml checks out Jolt at ff6fc6568, regenerates the files, fails if they differ from the committed ones, and builds ConstraintGen.Equiv.

Assumptions the pin already implied

An audit of every premise against ff6fc6568 found four that the pinned Jolt no longer needs. The model already transcribed the Jolt check behind each one, and commit 06a1b1b removes them:

Assumption Jolt check that makes it true Proof that replaces it
JoltInstance.HeapNoWrap (whole-run premise) MemoryLayout::validate_heap_end, a16z/jolt#2415; in Lean, the first guard of MemoryLayout.max_ram_k? new_heap_end_le (theorems/layout_facts.lean)
Rv64ProgramImage.ImageNonempty (completeness premise, through CompletenessAssumptions) derive_from_dimensions rejects an empty trace (TraceDoesNotEndInHalt) HonestTrace.prover_config_image_nonempty, using the new image field instruction_loaded: decode_text_section emits an instruction only when its first halfword is nonzero, which puts a nonzero byte of each instruction in memory_init
JoltInstance.RamRegionFits (soundness premise, through SoundnessAssumptions) MemoryLayout::max_ram_k rejects a padded region past 2^64; in Lean, the last guard of max_ram_k? JoltInstance.ramRegionFits (Soundness/Layer3/Layout.lean)
No RAM 2 GiB above RAM_START (documented only) a16z/jolt#2509 removed the branch of final_ram_state that misfiled such words none needed; removed from model_review.md

SoundnessAssumptions and CompletenessAssumptions (Completeness/Assumptions.lean, deleted) had no other fields and are gone. JoltInstance.completeness now takes no premise about the instance. The same commit deletes StableStall and selfJumpRepeats, which described the old stopping rule, and updates the comments, docs/whole-run-theorem.md, methods/soundness.md, model_review.md and the bug-report statuses that still described the removed premises. reports/2026-11-25-stale-assumptions.md explains how the premises outlived the Jolt changes and proposes checks that catch this automatically on the next re-pin.

Completeness without sorry

Commit db02bb9 proves the three completeness obligations that waited on a16z/jolt#1949, so JoltInstance.completeness depends only on propext, Classical.choice and Quot.sound. Jolt's R1CS adds rs1 + imm in the field, while the tracer computes it modulo 2^64, and the two differ only when the sum wraps. No honest row wraps:

  • The tracer accepts a memory address only in [0x40000000, 2^63 + 2^31) (Mmu.effective_address_window, from effective_address_ok and the layout bounds).
  • Every memory and ShiftData offset in Jolt's expansions is a sign-extended 12-bit value. MemoryExpansionFacts.lean checks this for every expansion (expand_memoryOk, expand_program_rowImmOk).
  • A retired load or store therefore has 0 ≤ base + imm < 2^64 (HonestTrace.access_noWrap, Completeness/Helpers/AddressWindow.lean).
  • A ShiftData row accesses no memory, but the expansion always places a store with the same base register and offset two rows later, and the base register is unchanged in between (expand_program_triples, HonestTrace.shiftData_store). Its sum is therefore the store's sum.

These close (08) HonestTrace.floorAccess_address_nonneg, (11) HonestTrace.shiftData_address_noWrap and the full proof of (01) honestWitness_ramAddrEqRs1PlusImmMinusLookupIfLoadStore. The (01) theorem's three hypotheses that its proof no longer uses are renamed with a leading underscore; their types are unchanged. constraints.md now lists all 63 constraints as checked, and model_review.md, methods/soundness.md and docs/riscv-alignment.md no longer list the obligations as open. a16z/jolt#1949 itself is still open; the proofs need only checks that Jolt already has.

Fixes from the external review of 2026-11-25

An external review of this stack at 2bdbf41 reported thirteen findings. This PR fixes the ones in the model and the docs; #74 fixes the ones in the checks. Each row says what was wrong and what changed.

Finding Change in this PR
F1 DecodedFrom checked only the address and width of a row of Jolt's own instructions, so a row labelled jolt.success could sit on the bytes of an ordinary ADDI, and SailHalted would read that address as a success halt. RowFromParcel now requires every row, including the terminal one, to decode from its bytes: a RISC-V row through Decode.joltDecode, a Jolt row through JoltCustomInstruction.decode?, a full transcription of decode_custom (crates/jolt-program/src/image/decode.rs). DecodedFrom.joltSuccess_word and SailHalted.success_word prove that a success halt sits on the word 0x0000305B. WholeRun/ElfRegression.lean keeps the reviewer's ADDI example and shows that DecodedFrom now rejects it.
F2 JoltInstance.initial_state rejected input and advice longer than the raw MemoryConfig.max_* sizes, while Jolt checks the sizes rounded up to 8 bytes (JoltDevice::try_with_io). The three raw checks are gone; JoltDevice.initialMem keeps the rounded ones. theorems/layout_facts.lean proves initial_state_isSome_iff and checks raw sizes 0, 1, 7, 8 and 9.
F3 The model loads memory as preprocessing does (memory_init); the tracer's loader skips some section types and caps memory for a tohost symbol. Documented: the theorems follow preprocessing, which is what the verifier commits to. A program on which the two differ is a Jolt completeness problem, not a soundness gap (docs/whole-run-theorem.md, model_review.md). The docstrings of JoltInstance.initial_state and initial_state_isSome_iff no longer claim to match create_emulator exactly; they say which checks agree.
F4 The README said the theorems cover both of Jolt's fields, but the configuration and sizing model (minimum padded trace 256, chunk policy, setup bound) is Dory's; with the akita feature Jolt pads to at least 4096 rows. Documented: the field premise and the constraint algebra cover Akita's field, the sizing model covers only the base Dory build (README.md, docs/whole-run-theorem.md).
F11 rewriteNative turned VirtualLoadB/H/W into a no-op when the destination is x0, dropping the load and its possible fault. The three loads are side-effecting cases, as in crates/jolt-riscv/src/kind.rs.
F12 HaltPrefix.sailRun and HonestTrace.sail_reproduces took an unused configuration premise, and the theorems hid the step count under ∃ n. The premise is gone, and both theorems now state sailRun pre.length (sailInit trace.initialState) = .ok () s: Sail takes exactly one step per block before the halt.
F13 Stale documentation: an advice example that the pin blocks, LR/SC status, the I/O lower bound, the stopping rule, memory guards, the generator's coverage, the maxRecDepth count and the proving status. All corrected. The docs also state that five generated Sail declarations raise maxRecDepth and that the floating-point axioms of RiscvExtras.lean stay outside the headline theorems.

The review's other points about this PR (host allocation, the halt = final alternative, the derivable WitnessParams fields, file sizes) are listed under Known open items.

Every Jolt source file cited in a Lean comment now exists at ff6fc6568: fork URLs, stale paths (expand/memory/store.rs, crates/jolt-common/) and file names that match several files are replaced by full paths at the pin (ce6993c).

Fixes from the second external review of 2026-11-25

A second external review, of the definitions at an earlier commit, reported findings that were still present at 45d484e. Commits 1b5226d to 652da52 fix them.

Finding Change in this PR
S1-01 A verifier built with a larger Dory setup than the default accepts chunk widths that AllConstraints rejects. from_shared_parts (crates/jolt-prover/src/dory/preprocessing.rs) takes any setup, and JoltVerifierPreprocessing::new (crates/jolt-verifier/src/preprocessing.rs) never compares its size with the default. Not fixed here: the verifier's own checks do not bound the chunk width. Dory rejects an opening only when ceil(n / 2) > max_log_n / 2, and JoltFormulaDimensions::try_from (crates/jolt-claims/src/protocols/jolt/geometry/dimensions.rs) allows a committed chunk width of 128. With logT = 8, both chunk widths 128 and max_log_n = 136, every check passes, and 2^128 exceeds Akita's field. The soundness theorem therefore covers only verifiers built with the default setup. #74 registers this as DefaultDorySetup. Only width 128 is unsafe, and Dory accepts it only with max_log_n ≥ 136. A weak instance condition on the setup size therefore closes the gap without a Jolt change. #76 records that design and its Akita counterpart.
S1-02 dorySetupLogN returned a number for every maximum trace length, while setup_total_vars panics above 2^63. dorySetupLogN returns Option Nat and one_hot_fits_setup is false without a setup. Completeness, completeness_someWitness and HonestTrace.allConstraints_prover_sizes gain the premise setupSized : joltInstance.max_padded_trace_length.toNat ≤ 2 ^ 63.
S1-03 InLanguage said "Jolt's prover accepts the trace", but prover_config checks only that derive_from_dimensions succeeds. Docstrings and docs say "the prover's sizing succeeds" and that stage 0 can still refuse when an advice grid is wider than the main grid (crates/jolt-prover/src/dory/stages/stage0.rs). InLanguage itself is unchanged.
S2-01 lrwProgramAuto tagged its loads with the AMO alignment fault; Sail and the pinned generator give LR the load fault. Regenerated with the pinned generator: LR.W's two loads raise E_Load_Addr_Align. LR.D is still open (below).
A2-01 The word-shift helpers shift by ctz mask, which can reach 32 or more. Docstrings state the domain (masks 2^32 - 2^s with s < 32), and ValueLemmas.lean proves the shift count is below 32 for every mask the expansions emit.
A2-02 The large inline register allocator wrapped to register 0 when the pool was full. allocateLargeInlineRegister returns Option and fails on a full pool, like Rust's allocate_for_inline.
S3-X1, S3-D1 TraceBackendGridFits was unused and incomplete; the Product and LeftInstructionInput comments were wrong for floor loads and stores. The predicate is deleted and the comments corrected.
S4-1, S4-2 PROVENANCE.toml did not name Sail initialization as a caller of the dropped extension checks; patchAdvice silently tolerates a wrong advice count. Both are documented: the theorems start from WholeRun.sailInit, not sail_model_init, and Rust panics where patchAdvice pads or drops.
43 comments cited Jolt through a local checkout path; the README said Sail reproduces every run of Jolt's tracer; four other comments were stale. Citations use paths at the pin. The README says Sail reproduces the modelled execution up to its first explicit halt and names what applying it to a real run needs.

Known open items

  • The model assumes host allocation succeeds. Jolt's tracer ignores an advice write when try_reserve fails, while the model appends the bytes. Add an assumption registry and a nightly drift check against Jolt main #74 registers this as HostAllocation.
  • The model's initial memory follows preprocessing, not the tracer's loader (F3 above). Add an assumption registry and a nightly drift check against Jolt main #74 registers this as TracerInitialization.
  • The configuration and sizing model covers only the base Dory build (F4 above). Add an assumption registry and a nightly drift check against Jolt main #74 registers this as DoryConfiguration.
  • The whole-run conclusions keep the alternative halt = final next to SailHalted. Removing it needs a classification of which expansions contain a halt row.
  • The two positivity fields of WitnessParams follow from its divisibility fields and could be derived.
  • Soundness covers only verifiers built with the default Dory setup (S1-01 above). Closing the gap needs no Jolt change: Sizing model: cover non-default Dory setups and the Akita build #76 records a Lean-side design with the weak condition setupLogN ≤ 135, and the same for the Akita build.
  • LR.D's loads still raise E_SAMO_Addr_Align, where Sail gives E_Load_Addr_Align: the generator emits LD with the AMO class and no explicit fault.
  • No theorem proves that the honest advice list has exactly as many values as the expansion has VirtualAdvice rows.
  • Standard Sail initialization (sail_model_init) fails an assertion about the dropped Zicbom and Zicboz extensions. Restoring their clauses needs a Sail regeneration.
  • Three proof files exceed 3,000 lines (AtomicFamily/Dword, AtomicFamily/Word, WordSelectRust). Splitting them would speed up full and CI builds, not typical edits, since they are leaves of the import graph.

Changes from #39

Field premise (JoltConstraints/theorems/Soundness/Assumptions.lean)

  • JoltField F is weakened from 2^128 < ringChar F to 2^128 - 2^64 < ringChar F. Akita's modulus p = 2^128 - 1780711455, Jolt's production field since feat(algebra)!: make Prime128Offset6A23801F the production field a16z/jolt#2403, is below 2^128. The old premise therefore excluded it.
  • JoltField.of_two_pow_128_lt shows that the old premise implies the new one. Every field that qualified before therefore still qualifies.
  • New definitions akitaModulus and bn254ScalarModulus, and the facts JoltField.akita and JoltField.bn254 that both of Jolt's fields satisfy JoltField. Soundness/FieldModuli.lean proves both moduli prime with the Lucas test from Vendor/PrattCertificate.lean, vendored verbatim from CompPoly e28da34.
  • Every soundness proof that took 2^128 < ringChar F now takes the weaker bound (files in Layer0/ to Layer7/). Most use only 2^127 < ringChar F, which both bounds imply.

New constraint (63) InstructionAddressCanonical

  • Statement: InstructionRafFlag(t) · Σ_x LookupRa(x, t) · U(x) = 0, where U(x) is 1 when the upper 64 bits of the 128-bit lookup address x are all ones. It applies only when ringChar F < 2^128.
  • Reason: Jolt's verifier adds γ³ · upper_half_all_ones(r_address) to the EqRafFlag output term in the akita build (CANONICAL_INSTRUCTION_ADDRESS, still present at ff6fc6568) and leaves it out on BN254. The model ties the check to the field the same way.
  • Use: in a field below 2^128, an identity-RAF lookup address could alias a small one (for example p + 5 and 5). Constraint (63) rules out every address at or above 2^128 - 2^64, and the field premise puts the characteristic above every other address. identityAddress_lt_char (Layer1/InstructionReads.lean) combines the two.
  • Files: translation/Constraints/InstructionAddressCanonical.lean, added to Constraints/All.lean. The completeness proof is honestWitness_instructionAddressCanonical in theorems/Completeness/InstructionAddressCanonical.lean.

Whole-run theorems (JoltConstraints/theorems/WholeRun/, docs/whole-run-theorem.md)

  • WholeRun.HonestTrace.sail_reproduces: Sail runs the halt prefix of an honest Jolt trace and reaches a state related to Jolt's state before the halt, with the same outputs, and the halt kind fixes the panic flag.
  • JoltInstance.sail_soundness: if a witness satisfies all the constraints, some honest trace matches the claimed outputs, and if its halt prefix conforms, Sail's run reaches the claimed outputs, and the halt kind fixes the claimed panic flag.
  • Their premises, each explained in docs/whole-run-theorem.md:
    • a platform premise, true of Jolt's platform but not checked by Jolt: DecodedFrom (the program is what Jolt's decode_elf at ff6fc6568 makes of the ELF);
    • a scope premise, BlockConforms.riscv: every block runs a RISC-V instruction, because Jolt's own instructions on opcode 0x5B have no block theorem yet;
    • for sail_soundness only, the premise of JoltInstance.soundness: JoltField.

Instance changes without a change in meaning

  • translation/program.lean and translation/witness.lean replace the derived Fintype instances, which needed maxRecDepth 4096 and backward.isDefEq.respectTransparency false, with instances built from ctorIdx.
  • Completeness/Helpers/LookupWriteProofHelpers.lean and TracePCProofHelpers.lean drop a file-wide maxHeartbeats (1000000 and 400000).
  • JoltBytecode and JoltConstraints files import only the Mathlib and JoltConstraints modules they use (new JoltBytecode/MathlibTactics.lean). Two simp calls in WholeRun/NonInterference.lean gain the lemmas they need after the trim.

Sail model check

  • scripts/check-sail-model.sh gains step 2b: the memory regions in sail-import/rv64d_jolt.json must equal platformPma in JoltConstraints/theorems/WholeRun/Relation.lean, field by field. The Lean side reads its regions from Relation.lean, not from the configuration.
  • .github/workflows/lean.yml runs the model check when Relation.lean changes.
  • Both were in Prove that Sail reproduces every honest Jolt run, with the fp128 field and the ELF loader #39 and wait until this PR because Relation.lean arrives here.

File map

479 files change against #72: 73 added, 16 deleted, 1 renamed, 389 modified.

  • JoltConstraints/theorems/WholeRun/ (27 files, new): the whole-run proofs. Elf.lean transcribes Jolt's decode_elf and proves DecodedFrom.imageDecoded. Relation.lean holds the Jolt-to-Sail state relation and platformPma. SharedMemorySim.lean, AtomicMemorySim.lean, PlatformMemory.lean and PlatformStore.lean relate the shared memory to Sail's. Halt.lean and Top.lean hold the halt prefix and the two theorems.
  • Constraints: translation/Constraints/ adds HaltEndRule, RamAccessCount, RamWriteProtected, InstructionAddressCanonical and the renamed NextUnexpandedPCEqLookupIfJump, deletes ShouldJumpEqJumpMulNotNextIsNoop, RamHammingWeightBooleanity and RamRaChunkHammingWeight, and changes RamReadData and All. translation/witness.lean, program.lean, honest_trace.lean and witness_helpers/ follow the new witness columns and shared memory.
  • Soundness (127 files): new FieldModuli.lean, Layer1/HaltEndRule.lean, Layer5/ (CodeRegionFrame, Halt, SharedMemoryChecks, TapePrefix) and Layer6/SelectedRows.lean; deleted Layer5/ (DeviceMemory, DeviceMemoryObstruction, HostCallRestriction, PanicRestriction, TerminationRestriction) and Layer7/TerminationStore.lean; the rest are the field-bound rename and the re-pin.
  • Completeness (91 files): proofs of the new constraints and of (37) and (38), with helpers PrefixSum, RamHistoryProofHelpers, RamHistoryReplay and RamValReplay.
  • JoltConstraints/theorems/: new DeviceFrame, HaltFlags, MemoryRowExecution, SharedMemoryExecution, SharedMemoryInitialization; deleted advice_below_input.
  • JoltConstraints/ConstraintGen/, scripts/expansion-parity/, .github/workflows/constraint-generation.yml: the constraint generator.
  • Vendor/PrattCertificate.lean (new, vendored).
  • JoltBytecode (57 files): the bytecode re-pin above, and import trimming in 9 files.
  • Docs: docs/whole-run-theorem.md (new); docs/riscv-alignment.md (explicit halts, shared memory, and the whole-run parts that JoltBytecode side of #39: system expansions, Jolt decoder and try_step lifting #72 left out); methods/soundness.md; JoltConstraints/documentation/constraints.md (constraint (63), the field premise, the new constraints (64) haltEndRule, (65) ramWriteProtected and (66) ramAccessCount, and the removal of (22), (57) and (62)); JoltConstraints/documentation/model_review.md (open issues at ff6fc6568); README.md (the Main result section, which now ends at the first explicit halt); AGENTS.md (the Jolt pin and the stopping rule).
  • reports/2026-11-24-constraints-repin.md and reports/2026-11-24-constraint-repin-diff.md: the re-pin and generator reports, with the statement changes. reports/2026-11-24-bytecode-repin.md, reports/2026-11-24-bytecode-repin-statements.md and reports/2026-11-24-hostio-repin.md: the bytecode re-pin reports, with every changed statement and the Jolt source behind each change.
  • scripts/check-sail-model.sh, .github/workflows/lean.yml: above.

Validation

  • The second review fixes (1b5226d to 652da52): lake build JoltBytecode JoltConstraints succeeds locally (2479 jobs), and #print axioms lists only propext, Classical.choice and Quot.sound for JoltInstance.soundness, JoltInstance.completeness, completeness_someWitness, JoltInstance.sail_soundness and WholeRun.HonestTrace.sail_reproduces. Add an assumption registry and a nightly drift check against Jolt main #74's #audit_statements also passes on top of this branch. All 291 cited Jolt files resolve at the pin. The last commit changes only comments and Markdown; I rebuilt the four touched modules.
  • The review fixes (f1536bd to 45d484e): lake build JoltConstraints succeeds locally at Add an assumption registry and a nightly drift check against Jolt main #74's head 20b949b, which contains this branch's head 45d484e (2482 jobs). That build runs Add an assumption registry and a nightly drift check against Jolt main #74's #audit_statements, which fails unless JoltInstance.soundness, JoltInstance.completeness, JoltInstance.sail_soundness and WholeRun.HonestTrace.sail_reproduces depend only on propext, Classical.choice and Quot.sound. At e91e7ff, #print axioms listed only those three for the same four theorems. The commits after e91e7ff change only comments and Markdown.
  • WholeRun/ElfRegression.lean builds: the reviewer's ADDI example satisfies the old relation and not DecodedFrom.
  • Every Jolt file cited in a Lean comment exists at ff6fc6568 (scripts/jolt_citations.py --check on Add an assumption registry and a nightly drift check against Jolt main #74: 291 files, none unresolved).
  • At db02bb9, lake build JoltConstraints succeeds locally, and #print axioms JoltInstance.completeness lists only propext, Classical.choice and Quot.sound. At 06a1b1b the build succeeded (2474 jobs), and #print axioms listed only those three for JoltInstance.soundness and JoltInstance.sail_soundness.
  • CI's build job (lake build of both libraries) and the constraint-generation job passed at 36c47d6. 7baacf6 has the same tree plus Sail side of #39: configure the Sail model as Jolt's hart #71's new report: it merges Sail side of #39: configure the Sail model as Jolt's hart #71's report commit and JoltBytecode side of #39: system expansions, Jolt decoder and try_step lifting #72's revert, keeping this branch's files.
  • The last three commits (448e596, 8fb40a4, 99d08bd) remove no_code_store and RowsAligned and re-transcribe DecodedFrom. At 99d08bd, lake build JoltConstraints.theorems.WholeRun.Top JoltConstraints.theorems.Soundness.soundness succeeds locally (2028 jobs), and #print axioms lists only propext, Classical.choice and Quot.sound for JoltInstance.sail_soundness, WholeRun.HonestTrace.sail_reproduces, JoltInstance.soundness, Rv64ProgramImage.DecodedFrom.rowsAligned and WholeRun.JoltCodeIntact.of_block. CI builds the rest.
  • lake build JoltConstraints succeeds locally at bbe02b6 (2475 jobs), with a thread-capped build wrapper, and lake build JoltBytecode succeeded on the bytecode re-pin (9365 jobs). The later commits dfe65e3 and 36c47d6 change only Markdown files, Lean comments and a workflow comment. After the comment edit in soundness.lean, I rebuilt JoltConstraints.theorems.Soundness.soundness (1918 jobs).
  • #print axioms lists only propext, Classical.choice and Quot.sound for JoltInstance.soundness, JoltInstance.sail_soundness and WholeRun.HonestTrace.sail_reproduces.
  • The diff adds no sorry, admit, native_decide, bv_decide, decide +kernel, axiom, or maxHeartbeats, maxRecDepth or synthInstance option. It removes the five limit options above and two decide +kernel commands.
  • The libraries have no sorry; JoltBytecode side of #39: system expansions, Jolt decoder and try_step lifting #72 had five. The remaining matches of sorry in .lean files are docstrings and five lines of commented-out code in the vendored PrattCertificate.lean.
  • Temporary #print axioms checks during the bytecode re-pin listed only propext, Classical.choice and Quot.sound for JoltISA.execHostIO_succeeds, JoltISA.execHostIO_result, JoltISA.Mmu.store_raw_existing, JoltISA.execHalt_vreg_run, JoltIOSetupFrame.execProgram_memory and Decode.SourceInstruction.tick_halted, and only propext for Decode.decodeJoltSuccess_some_iff.
  • Several intermediate commits do not build on their own. Bytecode commit 3cefd41 fails until 9b9948c fixes its proofs. In particular the merge 6f1b2b2, which brings in the total host-call model from the bytecode branch, and the commits up to 94ae194 fail until 8e7dae3 ports the host-call proofs. Please review the whole diff rather than commit by commit.
  • I did not run a JoltAudit build, because the repository has no such target.

Placement notes

🤖 Generated with Claude Code

…aint (63)

The tree is exactly split/merged (2537b0d), the merge of #39 and main.
Relative to split/b-bytecode it adds theorems/WholeRun/ (21 files), the
Akita field premise and constraint (63) InstructionAddressCanonical with
its completeness proof, the field-moduli primality proofs, and the
memory-region check in check-sail-model.sh with its CI trigger.
Jolt's tracer rejects every store that changes a byte of its protected code
region, and JoltInstance.initial_state computes that region from the
program's rows. The whole-run proof now uses this check instead of the
documented deviation BlockConforms.no_code_store.

- Elf.lean: add codeRegionAt, Jolt's code_region with an explicit lowest
  address, prove codeRegionOf_eq and codeRegionAt_covers (the region
  covers every doubleword of every nonzero source).
- CodeInv.lean: JoltCodeIntact now also records that every code byte is
  protected, and reads memory with ram_byte. JoltCodeIntact.of_block
  follows from JoltIOSetupFrame.execProgram_memory and needs no premise.
  The store-footprint frame lemmas (storeBase, block_mem, NoCodeStore)
  are deleted.
- Top.lean: BlockConforms keeps only riscv.
- docs: describe the derivation and drop the deviation premise.
DecodedFrom now follows decode_elf at a16z/jolt ff6fc6568 instead of
c336a6da7. The new decode_elf

- skips the data ranges that $d mapping symbols mark inside text
  sections (ElfSection.mappingSymbols, ElfSection.dataRanges,
  textSegments);
- rejects an odd instruction address in decode_text_section
  (decodeText);
- rejects a writable section that overlaps the code region of the
  decoded instructions (ElfSection.isWritable, overlapsCode,
  codeRegionAt 0).

uncompress.rs is unchanged between the two commits, and decode.rs only
adds jolt.success to decode_custom, which DecodedFrom does not
transcribe.

DecodedFrom.imageDecoded is re-proved through the new lemma
ElfSections.layout?_parcel and textSegments_within. The new lemma
DecodedFrom.rowsAligned derives RowsAligned from the odd-address check,
so BlockConforms.simulates, HaltPrefix.sailRun, sail_reproduces and
sail_soundness no longer take the RowsAligned premise. The docs describe
the new transcription and drop the premise.
… drop dead store lemmas

codeRegionAt moves to JoltISA/Core.lean and codeRegionOf becomes codeRegionAt at
the layout's lowest address, so code_region has one transcription. The store
plan and no-store lemmas in WholeRun/Bundles.lean lost their last user when
no_code_store was derived, and are deleted. Docs: the README pin for decode_elf,
the object crate version Jolt locks at ff6fc6568 (0.41.0), the full list of
decode_elf checks in DecodedFrom, and the exact coverage of codeRegionAt_covers.
Jolt at ff6fc6568 already makes each of these true, and the Lean model
already transcribes the Jolt check that does it:

- HeapNoWrap (whole-run premise): MemoryLayout::validate_heap_end, the
  first guard of max_ram_k?. Proved by new_heap_end_le.
- ImageNonempty (completeness premise): derive_from_dimensions rejects an
  empty trace. Proved by HonestTrace.prover_config_image_nonempty, with the
  new decoder field Rv64ProgramImage.instruction_loaded.
- RamRegionFits (soundness premise): max_ram_k rejects a padded region past
  2^64. Proved by JoltInstance.ramRegionFits.
- No RAM 2 GiB above RAM_START (documented only): a16z/jolt#2509.

JoltInstance.soundness now takes only JoltField F, and
JoltInstance.completeness takes nothing about the instance. The bundles
SoundnessAssumptions and CompletenessAssumptions are deleted.

Also delete the unused TraceRow.StableStall and selfJumpRepeats, and fix
the comments and docs that still described code-store and HeapNoWrap as
assumptions. reports/2026-11-25-stale-assumptions.md records the audit and
a design for catching such drift automatically.
Honest memory rows never wrap their effective address. The tracer accepts
an address only in [0x40000000, 2^63 + 2^31), and every memory and
ShiftData offset in Jolt's expansions is a sign-extended 12-bit value, so
the integer sum base + imm of a retired row lies in [0, 2^64).

- MemoryExpansionFacts.lean checks every expansion: offsets are small, and
  each ShiftData row is followed two rows later by a floor store with the
  same base register and offset.
- Completeness/Helpers/AddressWindow.lean proves the address window, the
  no-wrap lemma HonestTrace.access_noWrap and HonestTrace.shiftData_store.
- (01), HonestTrace.floorAccess_address_nonneg (08) and
  HonestTrace.shiftData_address_noWrap (11) are proved from these.

JoltInstance.completeness now depends only on propext, Classical.choice
and Quot.sound. The docs no longer list these as owed proofs.
Fix stale text found by the 2026-11-25 audit (F3, F4, F13 and the
floating-point axiom note). Documentation and comments only; no Lean code
changes.

- README, model_review.md, constraint_proving.md: no `sorry` remains;
  all 63 constraints have completeness proofs.
- Qualify the Akita claim: the field premise and constraint algebra cover
  Akita's field, but the prover configuration and sizing model is base
  Dory only (Akita pads to 4096 rows and keeps 4/16-bit chunks).
- model_review.md: state the tracer-initialization gaps precisely
  (section types and file offsets, the `tohost` cap, host allocation),
  replace the LD/MULHU advice attack with the remaining advice-word
  obligation, retire the LR/SC reservation item, record that
  RiscvExtras.lean declares 67 floating-point axioms outside the
  headline closures.
- riscv-alignment.md: halt-only run end, derived I/O lower bound, the
  current RAM checks, and the five current maxRecDepth limits.
- soundness.md, CONSTRAINT-GEN.md, AGENTS.md and Lean comments: remove
  stall, termination-word and repin-mismatch remnants; mark the dated
  sections as history.
JoltInstance.initial_state compared the inputs and both advice arrays
with the raw MemoryConfig maxima before JoltISA.initialState compared
them again with the layout's capacities. Jolt's create_emulator calls
only JoltDevice::try_with_io, which checks the capacities that
MemoryLayout::try_new rounds up to a multiple of 8. The raw guards
rejected runs that Jolt accepts, such as two input bytes with
max_input_size = 1.

This commit removes the raw guards, so JoltDevice.initialMem is the only
size check. initial_state_build and initial_state_device now state the
bounds against the layout's capacities. New lemmas give the capacities
(new_capacities), the size facts of a successful installation
(initialState_fits) and an exact characterization
(initial_state_isSome_iff), with examples for raw sizes 0, 1, 7, 8, 9
and for two and nine input bytes at max_input_size = 1.

Jolt at ff6fc6568: tracer/src/lib.rs (create_emulator),
common/src/jolt_device.rs (JoltDevice::try_with_io, MemoryLayout::try_new).
Rust's has_side_effects includes the floor loads, whose read can fault,
so an x0 destination is redirected to a temporary instead of turning the
row into a no-op. Instr.rewriteNative now matches that rule and has a
docstring with an example. No source instruction currently reaches
rewriteNative as a floor load, so no proof changed.

Jolt at ff6fc6568: crates/jolt-program/src/expand/mod.rs
(expand_source_instruction_with_provider), crates/jolt-riscv/src/kind.rs.
…un theorems

DecodedFrom constrained a row of one of Jolt's own instructions only in
address and width. A program could therefore put a jolt.success row on
the ADDI bytes 93 00 10 00, and the whole-run theorems would read that
address as a success halt. JoltCustomInstruction.decode? now transcribes
Jolt's decode_custom, and every row must decode from its parcel's word
(SourceInstruction.DecodesFrom). A jolt.success row must sit on the exact
word 0x0000305B (DecodedFrom.joltSuccess_word, SailHalted.success_word).
WholeRun/ElfRegression.lean keeps the auditor's example: it satisfies the
old relation and fails the new one.

HonestTrace.sail_reproduces and HaltPrefix.sailRun drop the unused
prover-acceptance premise hcfg. The whole-run conclusions now state the
exact step count, sailRun pre.length, instead of some n.
sail_soundness keeps its premises and still returns prover acceptance.

Jolt at ff6fc6568: crates/jolt-program/src/image/decode.rs (decode_custom).
Replace fork URLs and stale paths (expand/memory/store.rs, crates/jolt-common)
with paths at the pin, and qualify short file names that match several files.
Update the whole-run docs for the success-word check, the exact step count,
the generated maxRecDepth options, Akita sizing, initial memory, host
allocation and the floating-point axioms.
…ansion functions by name

JoltInstance.initial_state and initial_state_isSome_iff claimed to match
create_emulator exactly, but the model loads preprocessing's memory_init while
the tracer loads only some section types and caps memory for a tohost symbol.
The docstrings now say which checks agree and point to the documented
difference. The AMOSWAP citations name expand_amoswapd/expand_amoswapw, and the
division-file citation fits on one line.
Replace the 43 comment lines that cited Jolt as
/Users/ari.biswas/Work-with-A16z/jolt/... with the path from the Jolt
repository root at ff6fc6568. Citations that carried a line number now
name the function or impl instead, since the line numbers had moved.
scripts/jolt_citations.py --unresolved --check (from 6763e65) still
resolves 291 cited files and reports no unresolved citation.
Floor-addressed loads and stores select rs1 and the signed immediate,
and ShiftDataB/H/W add the signed immediate to rs2, so the right input
and the product can be negative. The comments said both inputs were
unsigned and grouped loads and stores with the zero-left-input
instructions. They now follow crates/jolt-witness/src/witnesses/operands.rs
and crates/jolt-lookup-tables/src/instructions/virt/floor_access.rs at
ff6fc6568, and say when the untruncated field product equals Rust's
128-bit-magnitude product.
Nothing used it, and it omitted the virtual instruction-selector grids
(2^virtualChunkBits addresses) that Jolt's dense trace backend also
allocates (crates/jolt-witness/src/backend/trace/{oracle,cycle,mod}.rs
at ff6fc6568).
firstFreeLargeInlineIndex and allocateLargeInlineRegister now return
Option and scan the numLargeInlineRegisters (80) registers from v48,
mirroring allocateInstructionRegister. Before, 80 live registers gave
index 48 + 80, which truncates to register 0 in 7 bits. Rust's
ExpansionAllocator::allocate_for_inline returns VirtualRegisterExhausted
there (crates/jolt-program/src/expand/allocator.rs at ff6fc6568).
Nothing uses these functions.
sail_model_init (LeanRV64D.lean:223) calls legalize_senvcfg, which asks
whether Zicboz and Zicbom are enabled (LeanRV64D/Types.lean:833-841), so
the translated initialization fails a Sail assertion. Say so in
sail-import/PROVENANCE.toml, and say in PROVENANCE.toml and
docs/whole-run-theorem.md that the theorems start from WholeRun.sailInit.
The Sail translation is not regenerated.
Rust's trace_inline_sequence_with_advice (tracer/src/instruction/mod.rs:
226-249) panics when a VirtualAdvice row finds no value left, and when it
filled some rows but fewer than there are values. patchAdvice keeps the
placeholder and drops extra values. The docstring says when the two agree.
No theorem proves the division expansions meet that condition.
jolt_virtual_sraiw_value, jolt_virtual_srlw_value and
jolt_virtual_sraw_value match Rust (tracer/src/instruction/
virtual_{sraiw,srlw,sraw}.rs) only for masks with fewer than 32 trailing
zeros. The docstrings now say what each does outside that domain and
that Rust panics there under overflow checks. New lemmas prove that the
masks the expansions supply stay in the domain:
ctz_jolt_virtual_shift_right_bitmaskw_value(_lt) and
ctz_word_shift_immediate_lt.
Sail raises E_Load_Addr_Align for a misaligned LR
(alignmentFaultFromAccessType, LeanRV64D/MemTypeUtils.lean:227), but
lrwProgramAuto tagged its VirtualLoadW with E_SAMO_Addr_Align. The load
keeps the .amo class. The tags were regenerated with the pinned
generator (jolt-lean-gen at ff6fc6568), whose output differs from the
committed file only in dropping the unused _rs2 binder of lrw and lrd,
which is kept. lrReadRows follows, and amo_word_floor_load_aligned_run
now takes the fault as an argument defaulting to E_SAMO_Addr_Align.

LR.D is unchanged: the generator emits LD .amo with no explicit fault,
which maps to E_SAMO while Sail gives E_Load. Fixing it needs a
generator change or a new load class.

The whole-run reservation proof (WholeRun/Bundles.lean) matched LR.W's
load against a row with the AMO fault. reservedLoadRow and
ReservationLoadPlan.load now take the word load's fault, so LR.W
(E_Load) and SC.W (E_SAMO) both fit.
VerifierSizes.dorySetupLogN now rounds the maximum padded trace length
with checkedNextPowerOfTwo and takes Nat.log 2 of the result, as Rust's
setup_total_vars does with next_power_of_two().ilog2()
(crates/jolt-prover/src/dory/preprocessing.rs:196-210). It is none
when the maximum exceeds 2^63, where Rust panics.
JoltInstance.one_hot_fits_setup fails when there is no setup, and its
docstring now cites the pinned dory-pcs-0.5.0 check and Jolt's matrix
shape (crates/jolt-dory/src/scheme.rs).

dorySetupLogN_le_72 now takes the computed setup and needs no length
premise. Completeness needs the default setup to exist, so
JoltInstance.completeness, completeness_someWitness and
HonestTrace.allConstraints_prover_sizes gain the premise
setupSized : joltInstance.max_padded_trace_length.toNat ≤ 2 ^ 63.
model_review.md lists it.
The InLanguage conjunct (trace.prover_config joltInstance).isSome models
only ProverConfig::derive_from_dimensions. Jolt's prover can still
refuse a trace that passes sizing: stage 0 returns
ProverError::Unsupported when an advice grid is wider than the main
commitment grid (crates/jolt-prover/src/dory/stages/stage0.rs:134-156).
Reword InLanguage, its comments, the completeness docstrings and
helper docstrings, model_review.md and docs/whole-run-theorem.md, and
say that stage 0 can still refuse. InLanguage itself is unchanged.
README: the lead now says that Sail reproduces the modelled Jolt
execution up to its first explicit halt, one Sail step per conforming
source instruction. Applying it to a real Jolt run needs the
correspondence between preprocessing's initial memory and the memory
the tracer loads, and the stated scope. The paragraph links both to
docs/whole-run-theorem.md.

initialRam (translation/program.lean): replace the TODO with a note
that the two initial memories do not always agree, pointing at the
same doc section.

JoltBytecode/Bundles.lean: the header no longer claims that
Assumptions.lean is the whole assumption surface. It names the MRET,
CSR and LR/SC bundles that add their own premises, and says that
WholeRun.equivAssumptions_of_retire discharges them.

JoltISA/SystemCSR.lean: the comment pointed at a nonexistent
ProofSupport/SystemCSR.lean. It now points at ProofSupport/Projection.lean
and Instructions/System/Csr.lean.

MemoryExpansionFacts.lean: SW expands to six rows, not three.
quangvdao added a commit that referenced this pull request Nov 26, 2026
Completeness gains the setupSized premise (registry entry SetupSized). The new scope
entry DefaultDorySetup records that soundness covers verifiers built with Jolt's default
Dory setup: the verifier checks neither the setup size nor an upper bound on the committed
chunk width. The statement table changes only for dorySetupLogN, one_hot_fits_setup,
lrwProgramAuto and the two completeness theorems.
abiswas3 added a commit that referenced this pull request Nov 27, 2026
ECALL is stated like MRET: Jolt's ECALL rows, projected, end in the same
state as Sail's execute_ECALL followed by try_step's trap entry
(set_next_pc after exception_handler). The new bundle
EcallProgramEqSailAssumptions uses only existing assumptions.

SailMret.lean becomes SailTrap.lean and gains the ECALL trap-entry lemmas;
the trap and MRET mstatus updates share one lemma again, as in #73.
jalr_zero_target moves to Common.lean for MRET and ECALL.

Co-authored-by: Quang Dao <qvd@andrew.cmu.edu>
abiswas3 added a commit that referenced this pull request Nov 27, 2026
Quang Dao's JoltConstraints re-pin from PR #73 (652da52), without
theorems/WholeRun, adapted to this branch's JoltBytecode: halt rows are
format-I and record only `halted`, input and advice stores are no-ops as
in Jolt's tracer, and the code guard is Jolt's CodeGuard. Adds his
constraint generator (scripts/expansion-parity), regenerated at 504dd78a2.

Co-authored-by: Ari <software@randomwalks.xyz>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant