Skip to content
Aneesh495Public

About

A neural theorem prover that retrieves relevant lemmas, searches for proof steps, and checks the resulting proofs in a formal proof assistant

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

61 Commits

Folders and files

Repository files navigation

Noema: Deep Neural Search for Checked Mathematical Proofs

Noema is an original deep neural theorem prover combining trained premise retrieval, a 24-block policy and value Transformer model, proof-hypergraph search with coupled metavariables, and independent proof checking in Lean 4.

System Highlights

  • Flagship Neural Guidance: 24 stacked Transformer blocks (60,128,673 trainable parameters) with RoPE embeddings, RMSNorm, SwiGLU activations, and multi-task heads for tactic policy prediction, state value scoring, and censored proof progress estimation.
  • Hybrid Premise Retrieval: Unifies BM25 lexical matching, dense semantic embeddings, and Personalized PageRank (PPR) over formal premise dependency graphs using Reciprocal Rank Fusion.
  • Proof-Hypergraph Search: Monte Carlo Tree Search (MCTS) with PUCT exploration adapted for AND/OR hypergraphs, tracking disjunctive goals and conjunctive multi-goal tactics.
  • Symbolic Decision Engines: Integrated explainable congruence closure, Knuth-Bendix term rewriting completion, and propositional semantic tableau solvers.
  • Formal Verification Environment: Persistent Lean 4.8.0 REPL protocol over bidirectional NDJSON pipes with state snapshots and environment caching.
  • Cryptographic Audit Ledger: Strict distrust of neural suggestions. All candidate proofs are re-checked from scratch by isolated subprocesses (lake env lean) and sealed into an append-only SHA-256 Merkle audit tree with verifiable inclusion proofs.

Architecture Overview

+-------------------------------------------------------------------------+
|                           User / CLI Interface                          |
|             Interactive Shell (REPL), Benchmark Runner, CLI             |
+------------------------------------+------------------------------------+
                                     |
                                     v
+-------------------------------------------------------------------------+
|                         Proof Search Subsystem                          |
|   MCTS on AND/OR Hypergraphs | Diverse Beam Search | Tableau Prover     |
|   Congruence Closure Engine  | Term Rewriting Completion (Knuth-Bendix) |
+------------------+----------------------------------+-------------------+
                   |                                  |
                   v                                  v
+------------------------------------+  +---------------------------------+
|     Neural Guidance Subsystem      |  |   Lean 4 Formal Environment     |
| 24-Block Transformer (60.1M params)|  | Persistent Subprocess REPL      |
| - Tactic Policy Head               |  | Lake 5.0.0 Build Toolchain      |
| - State Value Head                 |  | Lean 4.8.0 Kernel & Elaborator  |
| - Censored Progress Head           |  +----------------+----------------+
| Hybrid Premise Retriever (BM25+PPR)|                   |
+------------------------------------+                   v
                                        +---------------------------------+
                                        |    Cryptographic Audit Store    |
                                        | Fresh Process Subprocess Checker|
                                        | Sealed Proof Certificates       |
                                        | Append-Only Merkle Tree Ledger  |
+-------------------------------------------------------------------------+

Detailed architectural diagrams are available in docs/diagrams/:


Formal Evaluation Results

Evaluated across 1,200 curated formal theorems across 8 mathematical domains under a budget of 200 REPL expansions per trial:

Mathematical Domain Dataset Pass@1 (%) Pass@8 (%) Pass@32 (%) Solved Expansions Verification
Propositional Logic logic_core 64.5 82.0 91.5 14.2 100% Kernel Verified
Abstract Algebra algebra_core 42.0 61.5 74.0 38.6 100% Kernel Verified
Order Theory order_core 51.3 70.7 82.0 22.4 100% Kernel Verified
Category Theory category_core 38.7 56.0 68.7 45.1 100% Kernel Verified
Modular Arithmetic modular_core 34.0 52.7 66.0 52.8 100% Kernel Verified
Set Theory set_theory_core 58.0 76.7 86.7 18.9 100% Kernel Verified
General Topology topology_core 31.0 49.0 62.0 64.3 100% Kernel Verified
Depth Extrapolation extrapolation_deep 18.0 32.0 44.0 112.5 100% Kernel Verified
Overall Aggregate All 8 Domains 42.2 60.1 71.9 46.1 863 / 863 Clean (0 sorry)

Detailed experiment configurations and ablations are documented in docs/BENCHMARKS.md.


Installation & Setup

Prerequisites

  • Python 3.12+
  • PyTorch 2.2+ (CPU, Apple Silicon MPS, or NVIDIA CUDA)
  • Lean 4 toolchain leanprover/lean4:v4.8.0 and Lake 5.0.0 (installed via elan)

Environment Initialization

# Clone repository
git clone https://github.com/Aneesh495/noema.git
cd noema

# Setup Python virtual environment
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip setuptools wheel
pip install -e ".[dev]"

# Build Lean 4 formal bridge package
cd lean
lake build
cd ..

Quickstart & CLI Reference

Verify the local toolchain and environment:

python3 -m noema.cli doctor

Execute the bounded end-to-end trained model demonstration:

python3 -m noema.cli demo

Launch the interactive proof shell:

python3 -m noema.cli shell --theorem "theorem demo (P Q : Prop) : P ∧ Q → Q ∧ P := by"

Generate synthetic mathematical corpora across domains:

python3 -m noema.cli data --output data/ --num-train 20000 --num-eval 2000

Run latency, throughput, and memory profiling:

python3 -m noema.cli bench

Generate source-bound acceptance evidence:

python3 -m noema.cli acceptance

Validate an evidence bundle independently without retraining:

python3 -m noema.cli verify --evidence runs/evidence/

Run test suite:

pytest

Technical Documentation & Guides

About

A neural theorem prover that retrieves relevant lemmas, searches for proof steps, and checks the resulting proofs in a formal proof assistant

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages