Public Lean 4 / Mathlib formalization of parts of the Rand blockchain full node and its zero-knowledge circuits. Constraints of the Plonky3 AIRs are exported from the Rust source and soundness is proved against them; the first target is the RV32 ALU chip.
PROVEN.md: each published theorem, in plain English, with its Lean name, the Rust it models and the assumptions it takes.ASSUMPTIONS.md: everything taken on trust, including a known Poseidon2 constants gap.SOURCES.toml: the exact fullnode and circuits commits the model was checked against.
Requires elan. The toolchain is pinned in lean-toolchain.
lake exe cache get # prebuilt Mathlib; do not build Mathlib from source
lake build
lake build RandTest
scripts/audit.sh # no sorry/admit/axiom/native_decide; published theorems use only propext, Classical.choice, Quot.sound
Rand/Generated/ is printed by the Rust exporter in exporter/ (air2lean, Rust
1.98.1) from the circuits commit pinned in SOURCES.toml; never edit it by hand.
scripts/check-generated.sh fetches that commit, regenerates and diffs
(RAND_SOURCES_LOCAL_CIRCUITS=/path fetches from a local clone).
The field is Goldilocks, p = 2^64 - 2^32 + 1, modelled as ZMod p (Rand/Field.lean).
GPL-3.0, see LICENSE.