cl-asm is a Lean 4 development that writes a RISC-V program as a list of instructions and proves a step-bounded contract about it. The machine model and the program logic are those of riscv-zkvm: a computable RV64IM semantics, separation logic over the machine state, and CPS-style Hoare triples. That stack comes from evm-asm, an experimental Lean 4 macro assembler for building a zkEVM on an RV64IM backend. The prior idea is to write the program as RISC-V and prove it in Lean, so a later cryptographic proof that the program ran does not have to rest on a compiler. cl-asm reuses the method for a small Ethereum consensus-layer routine, without taking on EVM programs.
A zkVM is a virtual machine that can produce a short cryptographic proof that a particular program ran. Lean proves that this program implements a specified transition. Neither claim then depends on a particular client implementation.
The Ethereum consensus layer is the part of the protocol that decides which blocks the network has agreed on, and when that agreement is final. The first target is weigh_justification_and_finalization: it records that conclusion, and it contains no hashing and no signature checks, so the whole pipeline can be exercised end to end.
The L1 Strawmap already lists an item named “real-time cl-asm proofs” among later work, around mid-2030. This repository is a proof of concept for that item: a Lean-proved RISC-V routine that also runs as a zkVM guest. It is not a real-time prover, and it is not a production system.

Source: strawmap.org, 27 November 2026 revision.
The same approach is being factored into LeanAsm, a reusable Lean 4 foundation for typed RV64 and x86-64 assembly, intended for cl-asm and its siblings. The v0 proofs in this repository still use riscv-zkvm as the proof frontend.
The diagram below shows how the pieces fit together. In Lean, a List Instr program is assembled from verified macros and proved, as program_spec (cpsTripleWithin), to implement the function transition on the RV64IM model from riscv-zkvm: it returns within 175 steps and preserves disjoint memory. transition is a direct translation of the justification-finalization rules, with helpers such as EpochAtSlot.
The same instruction bytes also run as a ZisK zkVM guest; ELF generation, loading, and the zkVM wrapper are checked by tests, not proved, and the official Python reference is related to transition by review and comparison tests rather than a machine-checked proof.

How the RISC-V is modeled
In the pinned model, a program is a list of real RV64 instructions. This is real code from RiscvZkvm/Rv64/Program.lean:
abbrev Program := List InstrExecution is step / stepN on a MachineState. Contracts are written as cpsTripleWithin: from a precondition P at an entry address, the machine reaches a postcondition Q at an exit address in at most nSteps steps, and any disjoint frame is preserved. This is real code from RiscvZkvm/Rv64/Logic/CPSSpec.lean:
def cpsTripleWithin (nSteps : Nat) (entry exit_ : Word) (cr : CodeReq)
(P Q : Assertion) : Prop :=
∀ (R : Assertion), R.pcFree → ∀ s, cr.SatisfiedBy s → (P ** R).holdsFor s → s.pc = entry →
∃ k, k ≤ nSteps ∧ ∃ s', stepN k s = some s' ∧ s'.pc = exit_ ∧ (Q ** R).holdsFor s'A small piece of real code
The routine works in epochs of 32 slots (a slot is the protocol’s basic time step). Because that size is a fixed positive constant, epoch-from-slot is a right shift by 5. This is real code from ClAsm/EpochAtSlot.lean:
def program (state dst : Reg) : Program :=
[.LD dst state 0, .SRLI dst dst 5]
def epoch (slot : Word) : Word := slot >>> (5 : Nat)
theorem epoch_toNat (slot : Word) :
(epoch slot).toNat = slot.toNat / Layout.slotsPerEpoch := by
simp [epoch, Layout.slotsPerEpoch, BitVec.toNat_ushiftRight, Nat.shiftRight_eq_div_pow]The layout constants that this theorem refers to are also real code, from ClAsm/Layout.lean:
def slotsPerEpoch : Nat := 32
def slotsPerHistoricalRoot : Nat := 8192
def stateBytes : Nat := 136The same file records that the state, root array and scratch regions are pairwise disjoint and 8-byte aligned, and that executable code sits outside the model’s writable data windows.
The weigh contract
The v0 routine is 175 RV64 instructions (700 bytes). It is assembled from smaller macros: a prologue, two justification updates, four finalization checks, a store, and a return. A checkpoint is a named point on the chain, an epoch together with a block root. Justification and finalization are the rules that mark a checkpoint as having enough votes, and then as settled. This is real code from ClAsm/Weigh/Program.lean:
def program : Program :=
prologue ++ justify .x13 .x17 2 ++ justify .x14 .x16 1 ++
finalize 0 3 14 ++ finalize 0 2 6 ++ finalize 40 2 7 ++ finalize 40 1 3 ++
[.SD .x10 .x28 8, .JALR .x0 .x1 0]
def stepBound : Nat := program.length
theorem program_length : program.length = 175 := by decideThe whole-routine theorem says that this program implements the specified transition, returns within 175 steps, and preserves every disjoint caller-owned frame. This is the statement of real code from ClAsm/Weigh/Correctness.lean; the proof continues in the file:
theorem program_spec (a : Addresses) (state : State) (balances : Balances) (r : Registers)
(roots : RootArray) (scratch0 scratch1 : Checkpoint)
(addresses : ValidAddresses a) (valid : ValidInput state balances) :
cpsTripleWithin stepBound a.entry a.returnAddress (CodeReq.ofProg a.entry program)
(precondition a state balances r roots scratch0 scratch1)
(postcondition a state balances roots)The Lean function transition is a direct translation of the reference rules. A meaning theorem identifies the machine-level result with that function. The routine itself performs no cryptography: it receives three vote balances and a compact 136-byte state, reads at most two block roots as opaque 32-byte values, and writes the justification bits and the checkpoints in place. Signature checks and balance aggregation happen in the caller.
What is proved, and what is only tested
The same 175 instruction bytes run as a ZisK zkVM guest.
A standalone aggregate routine computes the caller’s three balances in 78 RV64 instructions (312 bytes), with a proved bound of steps. Its generated ELF is checked against the pinned official reference. Its ZisK integration is not yet included.
The Lean proofs cover the modeled instruction sequence. ELF generation, loading, the interpreter conversion, and the ZisK wrapper are checked by tests, not proved. The accurate description of the artifact is an ELF generated from instruction sequences proved in the model and validated through tests, not an ELF whose correctness is formally proved. The correspondence between the official Python operation and the Lean conditions is also not claimed to be machine-proved; that translation is validated by a mapping to the reference, review of the conditions, and comparison tests.
The reference function is pinned to the Phase 0 specification at consensus-specs 530cf56. Referencing this function does not mean implementing all of Phase 0 or the entire current consensus layer.
Why this shape, and what is next
weigh was a good first target because the pipeline could be closed without waiting on hash precompiles or signature verification. The next cost driver, recorded in the repository roadmap, is loops over the validator set — the participants that vote. aggregate already has a Lean proof and an ELF runner; integrating that proved routine into the zkVM guest is the first recommended step.
The longer direction, as the cl-asm repository roadmap states it, changes two of the remaining obstacles. Execution would be proved by a zkEVM, so a node verifies a proof instead of running the payload. Signatures would be hash-based, with verification aggregated in a minimal zkVM. What would still be performed unproven is the consensus-layer transition itself: counting votes, justifying, finalizing, and updating the validator set, together with recursive verification of the other proofs. That is a statement of direction in the repository, not a claim that this work is done. The strawmap item named above is real-time proofs of that transition, not merely a proved routine. This repository is a proof of concept on the way there.
ssz-asm is a sibling development that emits serialize, deserialize and hash_tree_root on RV64. It is experimental and unproved: its execution tests are not Lean correctness proofs.
To build and check cl-asm locally, the repository README lists the commands (lake build, axiom check, official-reference tests). Lean 4.33.0 is pinned, and GNU RISC-V binutils plus a RISC-V clang are required for the ZisK guest.