risc0/risc0-lean4

A model of the RISC Zero zkVM and ecosystem in the Lean 4 Theorem Prover

Lean

83

281 commits

updated Feb 14, 2023

See the code

README

risc0-lean4

:warning: This repository contains research artifacts. It is a work in progress and should not be used for any purpose.

risc0-lean4 is a formal model of the RISC Zero zkVM, written in the Lean Theorem Prover (version 4). Its long-term goal is to support formal security and soundness proofs for the RISC Zero ecosystem.

Features

We have executable models for:

  • ELF file handling
  • RV32IM emulation
  • SHA2-256
  • Merkle tree parsing and inclusion proof verification
  • The Baby Bear field (and its degree 4 extension)
  • Number Theoretic transform (NTT)
  • FRI verification
  • Arithmetic circuit parsing and evaluation
  • zkVM receipt parsing and verification

We are currently developing the meta-theory of these systems.

Repo Organization

Compatibility

This repository trails behind the zkVM repository. Precise version information can be found in Cargo.lock.

Building

Getting Lean4

See the Quickstart guide.

Performing the build

First, check to see if lake is in your terminal's search path. If not, you either haven't installed Lean4 yet, or you haven't source'd the elan environment variables.

risc0-lean4$ source ~/.elan/env

Now you can perform the build:

risc0-lean4$ lake build

Running the tools

This repository includes various executables. These executables are currently used for testing, but will eventually be expanded to provide greater utility.

Receipt verifier

Verify a receipt generated by the zkVM:

risc0-lean4$ ./build/bin/zkvm-verify-lean4

zkVM emulator

Run a zkVM guest (without proof):

risc0-lean4$ ./build/bin/zkvm-emu-lean4

Elf dumper

Read the headers of an ELF binary:

risc0-lean4$ ./build/bin/elf-dump-lean4

Building the docs

$ lake -Kdoc=on update
$ lake -Kdoc=on build Zkvm:docs

The docs will be viewable at build/doc/index.html.

lean
lean4
risc0
risc-v
riscv
riscv32
riscv32im
zero-knowledge
zk-stark
zkvm

Contributors

intoverflow

218 commits

BoltonBailey

58 commits

pdg744

5 commits

risc0/risc0-lean4

A model of the RISC Zero zkVM and ecosystem in the Lean 4 Theorem Prover

Lean

83

281 commits

updated Feb 14, 2023

See the code

README

risc0-lean4

:warning: This repository contains research artifacts. It is a work in progress and should not be used for any purpose.

risc0-lean4 is a formal model of the RISC Zero zkVM, written in the Lean Theorem Prover (version 4). Its long-term goal is to support formal security and soundness proofs for the RISC Zero ecosystem.

Features

We have executable models for:

  • ELF file handling
  • RV32IM emulation
  • SHA2-256
  • Merkle tree parsing and inclusion proof verification
  • The Baby Bear field (and its degree 4 extension)
  • Number Theoretic transform (NTT)
  • FRI verification
  • Arithmetic circuit parsing and evaluation
  • zkVM receipt parsing and verification

We are currently developing the meta-theory of these systems.

Repo Organization

Compatibility

This repository trails behind the zkVM repository. Precise version information can be found in Cargo.lock.

Building

Getting Lean4

See the Quickstart guide.

Performing the build

First, check to see if lake is in your terminal's search path. If not, you either haven't installed Lean4 yet, or you haven't source'd the elan environment variables.

risc0-lean4$ source ~/.elan/env

Now you can perform the build:

risc0-lean4$ lake build

Running the tools

This repository includes various executables. These executables are currently used for testing, but will eventually be expanded to provide greater utility.

Receipt verifier

Verify a receipt generated by the zkVM:

risc0-lean4$ ./build/bin/zkvm-verify-lean4

zkVM emulator

Run a zkVM guest (without proof):

risc0-lean4$ ./build/bin/zkvm-emu-lean4

Elf dumper

Read the headers of an ELF binary:

risc0-lean4$ ./build/bin/elf-dump-lean4

Building the docs

$ lake -Kdoc=on update
$ lake -Kdoc=on build Zkvm:docs

The docs will be viewable at build/doc/index.html.

lean
lean4
risc0
risc-v
riscv
riscv32
riscv32im
zero-knowledge
zk-stark
zkvm

Contributors

intoverflow

218 commits

BoltonBailey

58 commits

pdg744

5 commits

Languages

Lean

94.0%

Rust

6.0%