# o1-labs/proof-systems architecture

> Architecture diagram of the GitHub repository o1-labs/proof-systems, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/o1-labs/proof-systems
- Repository: https://github.com/o1-labs/proof-systems

## Overview

##### Main Components
- Core Proof System: At the heart is the “kimchi” crate, which implements a PLONK-based zero‐knowledge proof system.
- Cryptographic Primitives: Several crates provide the building blocks:
- curves – Includes elliptic curve implementations (Pasta curves).
- groupmap – For mapping between curve and field elements.
- hasher – Implements hashing functions used by Mina.
- poseidon – Provides the Poseidon hash function.
- poly-commitment – Implements polynomial commitment protocols.
- Auxiliary Tools and Libraries: These support various aspects of the system:
- signer – Contains signature schemes.
- utils – A collection of helper functions and traits.
- Additional math/crystallographic libraries such as folding, ivc, msm, mvpoly, turshi, etc., that support polynomial operations, field arithmetic, and circuit building for proofs.
- Documentation and Specifications:
- book – Contains the Mina book, technical specifications, and other supporting documents.
- Visualization & Debugging:
- tools/kimchi-visu – Provides tooling for visualizing aspects of the proof system.
- Other Supporting Components:
- o1vm – Implements a virtual machine (with interpreters for MIPS, RISC-V, and more) that likely ties into the proof system for verifying program executions.

##### Relationships and Interactions
- The “kimchi” proof system is central and depends on its underlying cryptographic libraries (curves, groupmap, hasher, poly-commitment, poseidon) for generating and verifying proofs.
- Additional libraries like folding, ivc, msm, and mvpoly provide support for polynomial arithmetic, constraint systems, and witness generation, interacting with the main “kimchi” and proof modules.
- The “signer” crate and “utils” provide supporting interfaces and common functionality to several modules.
- The “book” directory stands apart in that it documents the specifications and theoretical background; consider showing this as an external resource or documentation layer that feeds into the development and usage of the system.
- The “o1vm” component seems to be an execution engine (with its own set of interpreters and ELF loading infrastructure) which might interact with the proof system to verify program behavior.

##### Architectural Patterns and Design Principles
- Modular and Layered Design: Each crate is a self-contained module exposing a defined interface, allowing for separation of concerns (cryptography, arithmetic, signature handling, protocol logic, etc.).
- Library/Crate Dependency: Direct dependencies exist between the main proof system (kimchi) and the underlying mathematical and cryptographic libraries.
- Extensibility: The structure (with a dedicated “book” for specifications and tools directories) suggests that the system is designed for adaptability and continuous evolution (e.g., adding new curve implementations or proof schemes).
- Domain-Driven Design: The separation by functionality (hashing, commitments, arithmetic, VM interpretation) reflects a design focused on discrete responsibilities rooted in zero-knowledge proof theory and cryptographic systems.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["book"]:::doc
    B["kimchi"]:::core

    subgraph "Cryptographic Primitives"
        C["curves"]:::crypto
        D["groupmap"]:::crypto
        E["hasher"]:::crypto
        F["poseidon"]:::crypto
        G["poly-commitment"]:::crypto
    end

    subgraph "Auxiliary Libraries"
        H["folding"]:::support
        I["ivc"]:::support
        J["msm"]:::support
        K["mvpoly"]:::support
        L["turshi"]:::support
        M["signer"]:::support
        N["utils"]:::support
    end

    O["tools/kimchi-visu"]:::tool
    P["o1vm"]:::vm
    Q[".github/"]:::infra

    A --> B
    B --> C
    B --> D
    B --> E
    B --> F
    B --> G
    B --> H
    B --> I
    B --> J
    B --> K
    B --> L
    B --> M
    B --> N
    B --> O
    P --> B
    Q --> B

    click A "https://github.com/o1-labs/proof-systems/tree/master/book/"
    click B "https://github.com/o1-labs/proof-systems/tree/master/kimchi/"
    click C "https://github.com/o1-labs/proof-systems/tree/master/curves/"
    click D "https://github.com/o1-labs/proof-systems/tree/master/groupmap/"
    click E "https://github.com/o1-labs/proof-systems/tree/master/hasher/"
    click F "https://github.com/o1-labs/proof-systems/tree/master/poseidon/"
    click G "https://github.com/o1-labs/proof-systems/tree/master/poly-commitment/"
    click H "https://github.com/o1-labs/proof-systems/tree/master/folding/"
    click I "https://github.com/o1-labs/proof-systems/tree/master/ivc/"
    click J "https://github.com/o1-labs/proof-systems/tree/master/msm/"
    click K "https://github.com/o1-labs/proof-systems/tree/master/mvpoly/"
    click L "https://github.com/o1-labs/proof-systems/tree/master/turshi/"
    click M "https://github.com/o1-labs/proof-systems/tree/master/signer/"
    click N "https://github.com/o1-labs/proof-systems/tree/master/utils/"
    click O "https://github.com/o1-labs/proof-systems/tree/master/tools/kimchi-visu/"
    click P "https://github.com/o1-labs/proof-systems/tree/master/o1vm/"
    click Q "https://github.com/o1-labs/proof-systems/tree/master/.github/"

    classDef core fill:#ffcccc,stroke:#333,stroke-width:2px;
    classDef crypto fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef support fill:#ccccff,stroke:#333,stroke-width:2px;
    classDef doc fill:#ffffcc,stroke:#333,stroke-width:2px;
    classDef tool fill:#ccffff,stroke:#333,stroke-width:2px;
    classDef vm fill:#ffccff,stroke:#333,stroke-width:2px;
    classDef infra fill:#ffebcc,stroke:#333,stroke-width:2px;
```
