zkc is a compiler for zero-knowledge proof protocols, written in Lean. The source language describes roles, the values each role holds, the messages they exchange, and the checks that decide acceptance. The Core gives these programs a meaning that Lean proofs can use.
The Core admits mixed programs of named functions and protocols. It checks each definition against earlier headers, proves function summaries on valid inputs satisfying their requirements, checks projected roles and records loop bounds. A checked transformation preserves function behavior under its input requirements.
The interactive source checks follow selected Sumcheck and GKR entries through frontend emission,
Core admission and role projection to the formal certificates. Run just test-interactive
for the verifier bound, honest Sumcheck completeness and the conditional four-round GKR bound.
The status gives their hypotheses and scope.
For the earlier full .zkc CLI, scheme construction and historical Schnorr and Sumcheck
formal examples, use the previous Lean compiler at 10ed903fc.
Those consumers still await a full port.
| Path | Content |
|---|---|
language/ |
the reference of the source language and its conformance tests |
libraries/ |
the library of the source language, in source |
examples/ |
worked programs |
lean/compiler/ |
the compiler, one Lake package: the core (Zkc.Core), the frontend (Zkc.Frontend), their tests and tools |
lean/formal/ |
a second Lake package: statements and proofs over the meaning of the core |
docs/ |
the status, the development guide and the specification of the core language |
scripts/ |
the document checker |
The Schnorr protocol of examples/schnorr.zkc proves knowledge of a
scalar whose multiple of base is point. Both roles hold base and point; only the prover
P holds scalar. The prover samples a secret nonce and sends a commitment, the verifier V
draws a public challenge, the prover sends a response, and the verifier's guard decides
acceptance:
pub protocol Schnorr<G: PrimeOrderGroup> roles(P, V)(
base: G @(P, V),
point: G @(P, V),
scalar: G::Scalar @P
):
nonce @P <- sample G::Scalar
commitment <- send base * nonce to V
challenge <- draw G::Scalar from V to P
response <- send nonce + challenge * scalar to V
guard @V base * response == commitment + point * challenge
examples/schnorr_example.zkc declares a non-interactive scheme
over the group G1 of BLS12-381. The declaration selects Fiat–Shamir with the suite
Merlin3Bls12381 and the canonical proof layout.
scheme Proof = Schnorr<G1>:
construction derived(Merlin3Bls12381)
Both packages pin Lean 4.36.0. The toolchain guide describes the audit.
The Lean toolchain is named in lean/compiler/lean-toolchain and installed by
elan. With elan, just
and python3, from the root of the repository:
just build # build the active compiler targets
just test # build, test and audit the active targets
just test-interactive # check the source certificates and audit the interactive proofs
just check # check the public tree, the documents and the generated Unicode tablesThe development guide describes the layout, every command and how to run part of the tests.
- The source language: its reference, its libraries and its conformance tests.
- The documentation index: the status, the development guide and the specification of the core language.
- The contribution guide.
Licensed under the Apache License, Version 2.0.