-
Notifications
You must be signed in to change notification settings - Fork 9
Home
The end goal of this repository is to:
- Content-address every Lean 4 environment, declaration, expression and universe level via using the IPLD data format, with a name-irrelevant representation similar to the Unison language
- Independently evaluate and typecheck Lean 4 programs with a kernel implemented in Lean 4
- Compile Lean programs to the Lurk zk-SNARK language, so that we can generate zero-knowledge proof, which can be verified in constant-time and space, that a Lean program
f
, with inputx
, evaluates toy
- Compile the Yatima typechecker itself to Lurk, so we can generate zero-knowledge proofs that our Lean typechecker, with inputs
env : Yatima.Environment
andconst : Yatima.Constant
, returns successfully without error. For example, we can produce a cryptographic witness that some definitiondef foo : M := N
correctly typechecks, which can be validated without re-running the typechecker.
This will enable us to produce a succinct and efficiently verifiable correctness certificate for e.g. Lean's mathematical library (and for each of its declarations) once it's ported to Lean 4, which currently takes over 4 hours to be typechecked by the Lean 3 kernel (as of May '22).
-
Since we want to build on top of Lean 4 source files, we can take advantage from the fact that its API becomes available for any Lean 4 code that does
import Lean
. Thus, we are creating an application in Lean 4 to make use of itsLean.Elab.runFrontend
function, which can parse the source files and instantiate aLean.Environment
for us. Then with aLean.Environment
at hand, we can translate its declarations to our own content-addressed types and populate aYatima.Store
, our intermediate representation of Lean 4 objects -
The objects in
Yatima.Store
are glued together via CID references, but we can convert them to raw types that use direct references that simplify and speed up the next steps -
We're going to build a typechecker, that calls the converter mentioned in the previous item and then operates on the resulting (simplified) types
-
We're going to build a transpiler, which also calls the converter and then is able to output Lurk code
Finally, and this is where the pieces of the puzzle come together, we are going to compile our own typechecker and then transpile it to Lurk. That is, we're going to have a powerful typechecker written in Lurk that's capable of generating cryptographic certificates that the original Lean 4 code typechecks.
The four steps above are implemented in the following modules, respectively:
-
Created by the team
-
Official documentation
-
Literature, books, repositories, videos, pages etc