[{"data":1,"prerenderedAt":4},["ShallowReactive",2],{"xOhrTbZTsw":3},"# Proof-of-concept infrastructure for verification of SP1 zk chips\n\nThis repository contains a proof-of-concept Lean infrastructure for verification of SP1 zk chips. It is organised as follows:\n- [`Sp1Poc/Wheels.lean`](Sp1Poc/Wheels.lean) contains auxiliary functions on Lean standard types;\n- [`Sp1Poc/Basic.lean`](Sp1Poc/Basic.lean) contains basic definitions, functions, and facts about the BabyBear field and conformance theorem templating, noting that the fact that 2013265921 is prime is axiomatised as there are issues with its automated proof on Mac M1-M4 machines;\n- [`Sp1Poc/Specs.lean`](Sp1Poc/Specs.lean) contains manually written specifications of chip behaviours---currently, it contains only the specification of wrap-around 32-bit addition;\n- [`Sp1Poc/Templater.lean`](Sp1Poc/Templater.lean) generates the conformance theorem templates;\n- [`Sp1Poc/Cli.lean`](Sp1Poc/Cli.lean) defines the command-line arguments for template generation;\n- [`Sp1Poc.lean`](Sp1Poc.lean) brings the previous modules together to define the main `Sp1Poc` module;\n- [`Main.lean`](Main.lean) defines the main user-facing function; and\n- [`Examples/AddSub.main.lean`](Examples/AddSub.main.lean) contains the proof that the constraints extracted from the \\texttt{AddSub} chip conform to the specification of wrap-around 32-bit addition, and is elaborated on in detail in \\S\\ref{sec:proof}.\n\nAssuming that an installation of a version of Lean is present on the system, the infrastructure can be built using the following commands:\n```\nlake clean\nlake update\nlake exe cache get!\nlake build\n```\nOnce the installation has completed, the infrastructure can be used to generate a conformance theorem template by running:\n```\nlake exe genTemplate path-to-constraints-file template-folder-name [-f]\n```\nwhere:\n- `path-to-constraints-file` is the path to a file that contains constraints extracted from an SP1 zk chip using the [extraction mechanism](https://github.com/NethermindEth/sp1-constraint-extractor);\n- the generated template will be stored in the `Generated/template-folder-name/main.lean` file;\n- `-f` is an optional argument to denote that generated files should be overwritten if they already exist.\n",1780846781578]