Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reilabs/proven-zk
A support library for working with zero knowledge cryptography in Lean 4.
https://github.com/reilabs/proven-zk
formal-verification lean lean4 zero-knowledge
Last synced: 21 days ago
JSON representation
A support library for working with zero knowledge cryptography in Lean 4.
- Host: GitHub
- URL: https://github.com/reilabs/proven-zk
- Owner: reilabs
- License: apache-2.0
- Created: 2023-06-12T15:45:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-25T22:34:05.000Z (10 months ago)
- Last Synced: 2024-11-14T04:14:10.389Z (3 months ago)
- Topics: formal-verification, lean, lean4, zero-knowledge
- Language: Lean
- Homepage: https://reilabs.io
- Size: 173 KB
- Stars: 30
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# ProvenZK
This repository contains `proven-zk`, a library designed to assist in the
[Lean](https://leanprover.github.io)-based analysis and verification of
[zero-knowledge](https://en.wikipedia.org/wiki/Zero-knowledge_proof) (ZK)
circuits. It is currently developed to work with
[gnark](https://github.com/ConsenSys/gnark) circuits extracted from Go using
Reilabs' [Gnark Extractor](https://github.com/reilabs/gnark-lean-extractor), but
may be expanded to work with other ZK systems in the future.For an overview of how [how you can use](#how-to-use-the-library) the library,
and the [components](#components) it provides. If you would like to contribute,
or are looking for some resources on getting started with Lean, please see our
[contributing guide](./CONTRIBUTING.md).## How to Use the Library
We assume that you are building your lean projects using the `lake` tool, and
hence have a `lakefile.lean`. You can add the library as a dependency to that
file as follows.```lean
require ProvenZK from git
"https://github.com/reilabs/proven-zk.git"
```## Components
The library provides a number of components that are useful for the formal
verification of zero knowledge circuits.The basic definitions of the gates can be found in
[`Gates.lean`](./ProvenZk/Gates.lean), and
[`Vector.lean`](./ProvenZk/Ext/Vector.lean) and are the core components used to
represent gates and vectors in the formal representation of these circuits.You can import these as follows:
```lean
import ProvenZk.Gates
import ProvenZk.Ext.Vector
```The gates in ProvenZK are implemented using modular arithmetic using the
[`ZMod`](https://leanprover-community.github.io/mathlib4_docs/Mathlib/Data/ZMod/Defs.html#ZMod)
type from [Mathlib 4](https://leanprover-community.github.io/mathlib4_docs/).
For available operations please see the definitions in
[`Gates.lean`](./ProvenZk/Gates.lean).The other main components of the library contain of multiple theorems to assist
with the formal verification of circuits. These are as follows:- `import ProvenZK.Binary`: The definition of the `Bits` type, as well as
various theorems to assist in working with the `to_binary` and `from_binary`
functions.
- `import ProvenZK.Hash`: The definition of the
[perfect hash](https://en.wikipedia.org/wiki/Perfect_hash_function) to be used
for the purposes of formal verification.
- `import ProvenZK.Merkle`: The definition of the
[merkle tree](https://en.wikipedia.org/wiki/Merkle_tree) and associated
theorems that assist in the formal verification of circuits working with this
data type.In addition to these main interfaces to the library, there are additional helper
functions and theorems that can be found in the following files.```lean
import ProvenZk.Ext.Range
import ProvenZk.Ext.Matrix
import ProvenZk.Ext.List
```