Open-source, model-agnostic Lean 4 automated theorem-proving & formal verification harness for pequalnp.com (P vs NP).
Reproducible Lean 4 proof generation, zero-token deterministic C++20/Python circuit-complexity solvers, zero-day wave autoprobing, solve-ahead PR racing, multi-node SSH fleets, pluggable AI agents (ollama, openai, claude, codex), Shipping curses TUI, and a SHA-256 verifiable research ledger for collaborative mathematics.
pequalnp.com breaks P vs NP research into bite-sized Lean 4 theorems. Every proof only counts when Lean 4's kernel independently verifies it.
Zama turns that into a clean, reproducible workbench anyone can run in 3 minutes:
- Fast math tools first (0 tokens): Before calling any AI, Zama checks if a deterministic C++20/Python solver in
solvers/already cracks that theorem family. - Zero-day wave autoprobe: When a new wave drops on the board,
./zama autoprobetests existing solvers in isolated directories, verifies exact statement predicates (ReadsBack,Fin,notCount,Monotone2,FanInTwo), imports, pre-lint, and Lean 4, then hot-registers winning patterns intoruns/auto_waves.jsonwith zero restarts. - Any AI model second (no lock-in): Only when a theorem family is genuinely new or stuck does Zama call your chosen provider (local Ollama, OpenAI-compatible API, Claude CLI, or Codex CLI) to explore or distill a new solver plugin.
- One official referee: Zama delegates directly to
pequalnp's officialtools/pnp.shand Lean 4 toolchain, enforcingCONTRIBUTING.mdrules locally before Lean even starts. - Shared memory of wins and dead ends: Every attempt—verified proof or failed hypothesis—is hashed (SHA-256) into a local SQLite ledger and exported as portable JSONL so researchers don't waste compute repeating dead ends.
- Portable & dependency-free: Python 3.10+ standard library only + C++20 native solvers. Works on macOS and Linux with zero cloud lock-in.
- Upstream-native & Zero-Duplicate PR Guard: Wraps
<PNP_REPO>/tools/pnp.sh(setup,next,check,submit,release) with bounded submit concurrency, automatic retry on transient GitHub push errors, and a strict pre-submit guard (has_existing_pr) checking both live GitHub GraphQL (OPEN/MERGEDPRs) andpequalnp.com/desk/rowright before submission so Zama never opens duplicate PRs. - Drop-in solver plugins: Add a folder under
solvers/<name>/with asolver.jsonmanifest; Zama auto-discovers, builds, pre-lints, and verifies it. - Verifiable collective intelligence: Export
receipts.jsonl, share it with peers, and import theirs with automatic deduplication by statement + proof hash.
- Clone your fork of
pequalnpand set up Lean 4 once:git clone https://github.com/<you>/pequalnp ../pequalnp (cd ../pequalnp && tools/pnp.sh setup)
- Initialize Zama, compile native solvers, and verify your environment:
make init # creates .env from .env.example — edit PNP_REPO and PNP_HANDLE make build # compiles native C/C++20 solvers (foud6, sixl, onerow, onerowl, value6/cgp6) make bench # runs reproducible 10-unit value6 (HasCircuitSize 6) benchmark make test # runs the full unit & integration test suite make doctor # verifies python3, c++, lake, gh, upstream repo, and solvers
- Run a local reproducible Lean 4 check on the included fixture (no desk lease needed):
make verify-fixture
- Launch the full Shipping stack in 1 command (parallel race + zero-day autoprobe + auto-distiller + watchdog/Lean guard + live TUI):
./zama ship # dry-run by default (no PR submission) ./zama ship --submit # full autonomous mode with PR submission ./zama ship --submit --detach
- Or run individual subsystems separately:
./zama race --workers 6 --lean-slots 3 --submit-slots 1 --once ./zama autoprobe --once # probe uncovered waves with existing solvers ./zama distill --once # synthesize Lean-verified solvers for novel families ./zama vigia --once # silent event-driven lookout (CHAMBA, PIPE_CAIDO, etc.) ./zama stealth on|off|status # pause/resume solve & submit while lookouts stay on ./zama fleet # check configured multi-node SSH fleet health ./zama watch --guard-only --dry-run # watchdog + Lean RSS/timeout guard ./zama ui # live Shipping TUI (stage bars, telemetry, [s] stealth) ./zama run --once # single sequential tools/pnp.sh next cycle
- Inspect or share your verifiable research ledger:
./zama ledger ./zama export receipts.jsonl ./zama import peer_receipts.jsonl
| Solver | Type | Target family |
|---|---|---|
value6 |
C + Python + Lean | 6-input exact AND/OR/NOT fan-in-2 circuit size (HasCircuitSize 6, native u64 CGP + slice-cut kernel certificate) |
value7 |
C + Python + Lean | 7-input exact AND/OR/NOT fan-in-2 circuit size (HasCircuitSize 7, native u128 CGP + LRAT-free cut oracle) |
notcover6 |
Python | 6-bit subcube non-coverability (pigeonhole clique + LP dual) |
cover6 |
Python | 6-bit exact minimum axis-aligned subcube cover |
foud6 |
C++20 + Lean | 6x6 circuits (≤1 NOT, ≤2 NOT, or unrestricted NOT) via compact bitLane DAG |
sixl |
C++20 + Lean | 6x6 monotone one-active-row-and-column (LiveL+gkey DAG) |
onerow |
C++20 + Lean | 5x5 one-active-row-and-column exact circuit size |
onerowl |
C++20 + Lean | 5x5 one-active-row-and-column LiveL+gkey (k=2..12) |
andcount |
Python + Lean | Partial-function AND-gate lower bounds via MIS |
oneside |
Python + Lean | One-a-side bipartite graph AND/OR lower bounds via induced P4 |
twolit |
Python + Lean | Two-literal monotone function refute certificates |
hull |
Python | Affine hull modulo k decision & certificates |
Run the 10-unit corpus from wave e2c6b99338 (benchmarks/corpus_value6.json) in one command:
make bench # fast generation + pre-lint (~38s for all 10 units)
./zama bench --lean ../pequalnp-proofs/lean # add independent Lean 4 kernel verificationMeasured on Apple M4 against the pre-refactor kissat + unpatched gen10 baseline (all 10 units previously failed in production):
- Solved + pre-linted: 10/10 (baseline: 0/10)
- Total wall time: 37.52 s vs 501.1 s baseline (13.4× faster)
- Independent Lean 4 kernel checks (
lake env lean,rc=0):L-meta-125881(k=10, 151 KB): generated in3.62 s, kernel-verified in16.2 sL-meta-125860(k=8, 147 KB): generated in3.42 s, kernel-verified in11.6 sL-meta-125861(k=10, 203 KB): generated in4.22 s, kernel-verified in24.9 s
- Key engineering fixes: native 64-bit
cgp6.cupper-bound search (~0.3–1.1 s vs 20–85 s SAT), XOR non-unate boundary edges (u ^ (1 << PHYS[i])ingen10_dev.py, fixingproper_failGand shrinking proofs 37–80%), andsubs[:8]bit-pack guard infind_cut(eliminatingAssertionErroronk=10).
pequalnp.com (tools/pnp.sh + /desk/board)
│
├──▶ Autoprobe (zero-day wave hunter) ──▶ runs/auto_waves.json (hot-reloaded)
▼
┌───────────┐ match? ┌──────────────────────────────┐
│ Zama │ ─── yes ───▶ │ Deterministic Solvers (0 tok)│
│Race/Runner│ │ solvers/notcover6, foud6... │
└───────────┘ └──────────────┬───────────────┘
│ no / fail │
▼ ▼
┌─────────────────────────┐ ┌────────────────────────┐
│ Model-Agnostic Adapters │ ───▶ │ Statement + Pre-Lint + │
│ ollama · openai · cli │ │ Lean 4 Verification │
└─────────────────────────┘ └───────────┬────────────┘
▼
┌────────────────────────┐
│ Bounded Submit + Retry │
│ SQLite + JSONL Ledger │
└────────────────────────┘
Configure ZAMA_AI_PROVIDERS in .env in priority order (leave empty for 100% deterministic mode):
ollama— local models viaOLLAMA_HOSTandOLLAMA_MODELopenai— any OpenAI-compatible API (vLLM, LM Studio, OpenRouter, OpenAI) viaOPENAI_BASE_URL,OPENAI_API_KEY,OPENAI_MODELclaude— localclaudeCLIcodex— localcodexCLI
See CONTRIBUTING.md for the solver plugin contract, Lean 4 compliance rules, and PR checklist.
make build && make test
./zama verify <unit_id> <path/to/proof.lean> --standaloneMIT — see LICENSE.
Topics: Lean 4 automated theorem proving · formal verification · P vs NP · pequalnp.com harness · Boolean circuit complexity lower bounds · deterministic C++20 solvers · zero-dependency Python CLI · local LLM theorem prover (Ollama, OpenAI, Claude, Codex) · reproducible open-science ledger.