Skip to content

leonardopedro/kopperman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ALL IN THIS REPOSITORY IS WORK IN PROGRESS, MOSTLY AI GENERATED, PROBABLY NOTHING WORKS

Here is the complete, end-to-end tutorial for building the Kopperman-Delta-GPU Theorem Prover.

This implementation integrates all the advanced requirements: Dhall for logic, Haskell/Egison for algebraic optimization, FlatBuffers for serialization, Rust/Petgraph for verification, and a CubeCL GPU kernel featuring HVM pointer tagging and Warp-Level Primitives (Subgroup Operations) to minimize atomic contention.

Additionally, it now supports Collaborative Proof Editing via Loro CRDTs, mapping the Dhall AST directly to Loro's recursive container format.


Project Architecture

Create a root folder kopperman_prover/.

kopperman_prover/
├── schema/                 # Interface Definitions
│   └── protocol.fbs
├── theory/                 # High-Level Math (Dhall)
│   ├── ast.dhall
│   ├── hilbert.dhall
│   └── proof.dhall
├── compiler/               # Optimization & Serialization (Haskell)
│   ├── compiler.cabal
│   └── Main.hs
└── runtime/                # GPU Engine (Rust)
    ├── Cargo.toml
    └── src/
        ├── main.rs
        ├── kernel.rs       # CubeCL GPU Logic
        ├── loader.rs       # FlatBuffer -> HVM Mem
        ├── verifier.rs     # Petgraph Logic
        └── collab.rs       # Loro CRDT Integration (New)

Phase 1: The Protocol (FlatBuffers)

We define the binary format first so the Compiler and Runtime agree on the data structure.

File: schema/protocol.fbs

To generate Rust code: flatc --rust -o runtime/src/ schema/protocol.fbs To generate Haskell code: flatc --haskell -o compiler/ schema/protocol.fbs


Phase 2: High-Level Math (Dhall)

We define Kopperman's theory using specific algebraic nodes that will be optimized later.

File: theory/ast.dhall

File: theory/hilbert.dhall

File: theory/proof.dhall


Phase 3: The Compiler (Haskell + Egison)

This reads the Dhall, applies symbolic optimization (AC-matching), and writes the FlatBuffer.

File: compiler/Main.hs


Phase 4: The Runtime (Rust + CubeCL)

This is the most complex part. It implements HVM memory layout and Warp-Level primitives.

File: runtime/Cargo.toml

File: runtime/src/kernel.rs

File: runtime/src/verifier.rs

File: runtime/src/loader.rs

File: runtime/src/collab.rs (New: Collaborative AST Management)

File: runtime/src/main.rs


Phase 5: Collaborative Workflow (Loro CRDT)

Kopperman's proofs are now collaborative. Instead of editing text files, users can edit a Loro Document that represents the AST structure.

  1. AST Isomorphism: Map Dhall Records/Unions to Loro Maps/Lists.
  2. Conflict Resolution: Loro handles concurrent edits to the proof tree, ensuring a valid structure is always preserved.
  3. Dhall as the Linker: The collaborative state stores "User Intent", which is then expanded by Dhall using the standard library (hilbert.dhall) into the low-level AST for the GPU.

Build & Run Instructions

  1. Generate Protocol:

    flatc --rust -o runtime/src/ schema/protocol.fbs
    flatc --haskell -o compiler/ schema/protocol.fbs
  2. Compile Logic:

    cd compiler
    cabal run
    # Generates proof.bin
  3. Run Proof:

    cd runtime
    cargo run --release

Why this is the "Final" Version

This tutorial combines the Logic of Kopperman, the expressiveness of Dhall, the symbolic power of Egison, the serialization speed of FlatBuffers, the raw throughput of HVM-style GPU execution, and the collaborative power of Loro CRDTs. It effectively turns your GPU into a massively parallel machine for verifying infinite dimensional Hilbert spaces while allowing multiple researchers to work on the same proof simultaneously.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors