Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 115 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,95 @@
# TheoremOS
<div align="center">
<h1>TheoremOS</h1>
<p><strong>Open-Source Human-in-the-Loop Lean 4 Research Workbench &amp; Modular Agent Runtime</strong></p>
<p>
Built by <a href="https://westlakenlp.com/"><strong>WestlakeNLP</strong></a> (Natural Language Processing Lab, <a href="https://en.westlake.edu.cn/">Westlake University</a>)
</p>
<p>
English · <a href="./README.zh-CN.md" lang="zh-CN">简体中文</a>
</p>
<p>
<a href="https://github.com/HuggingMath/theorem-os-harness"><strong>⭐ Star</strong></a> ·
<a href="#overview-film">1-Min Demo</a> ·
<a href="https://theoremos.top/en/archive.html">Browse Proof Archive</a> ·
<a href="https://app.theoremos.top/">Cloud Workbench</a> ·
<a href="#quick-start">Quick Start</a> ·
<a href="https://github.com/HuggingMath/theorem-os-harness/releases/tag/rust-cli-v0.1.0">Rust CLI v0.1.0</a> ·
<a href="./docs/README.md">Docs</a> ·
<a href="./CITATION.cff">Cite</a>
</p>
<p>
<a href="https://github.com/HuggingMath/theorem-os-harness"><img alt="GitHub stars" src="https://img.shields.io/github/stars/HuggingMath/theorem-os-harness?style=flat&amp;labelColor=292524&amp;color=1e3a5f"></a>
<a href="https://westlakenlp.com/"><img alt="WestlakeNLP Lab" src="https://img.shields.io/badge/Lab-WestlakeNLP-1e3a5f?style=flat&amp;labelColor=292524"></a>
<a href="https://github.com/HuggingMath/theorem-os-harness/releases/tag/rust-cli-v0.1.0"><img alt="Rust CLI v0.1.0" src="https://img.shields.io/badge/Rust%20CLI-v0.1.0-57534e?style=flat&amp;labelColor=292524"></a>
<a href="https://github.com/HuggingMath/theorem-os-harness/actions/workflows/verify.yml"><img alt="Verify TheoremOS CI" src="https://img.shields.io/github/actions/workflow/status/HuggingMath/theorem-os-harness/verify.yml?branch=main&amp;style=flat&amp;labelColor=292524&amp;label=CI"></a>
<a href="./examples/README.md"><img alt="Lean 4.36.0" src="https://img.shields.io/badge/Lean-4.36.0-2f6f56?style=flat&amp;labelColor=292524"></a>
<a href="./LICENSE"><img alt="License AGPL-3.0-only" src="https://img.shields.io/badge/license-AGPL--3.0--only-c95633?style=flat&amp;labelColor=292524"></a>
</p>
<br>
<a href="https://app.theoremos.top/">
<img src="./docs/assets/workbench-desktop-en.png" alt="TheoremOS workbench with natural language, TeX, and Lean problem input, research mode selection, and budget controls" width="100%">
</a>
</div>

**TheoremOS** is an open-source **human-in-the-loop Lean 4 research workbench and modular agent harness** (`AGPL-3.0-only`). Start from natural language, TeX, or an incomplete Lean file, verify formal statement fidelity before spending search budget, steer lemma decomposition with a single agent or native research team, and enforce **zero-trust Lean 4 kernel acceptance** over the frozen original goal.

> [!TIP]
> **Finding TheoremOS useful?** Click **⭐ Star** on [**HuggingMath/theorem-os-harness**](https://github.com/HuggingMath/theorem-os-harness) to bookmark the open-source workbench, CLI, and M1–M5 runtime and follow updates from [WestlakeNLP](https://westlakenlp.com/). Join the community in [GitHub Discussions](https://github.com/HuggingMath/theorem-os-harness/discussions)!

---

The Rust CLI and its build instructions are maintained on the [migration/rust branch](https://github.com/HuggingMath/theorem-os-harness/tree/migration/rust).
<a id="verified-proof-highlights"></a>
<a id="lean-eval-and-public-records"></a>

## Proof Highlights

| 🏆 Lean-Eval Archive (10 Passes) | 📐 IMO 2026: `6/6` (`15/15` Goals) | 🔬 OpenAI Math Trajectories |
| :--- | :--- | :--- |
| **10 archived submissions** with official LeanEval passing responses (incl. *Unit Conjecture*, *Hopf–Rinow*, *Dimitrov*, *Improved Sunflower Bounds*, *Lorentzian Polynomials*). See [`accepted/README.md`](./accepted/README.md) for system attribution &amp; official links. | **`TheoremOS + GPT-5.6`** passed local Lean checks on all **15 goals across 6 formalized problems** (`official: false`). Full proof sources &amp; timing methodology in [`examples/imo2026/RESULTS.md`](./examples/imo2026/RESULTS.md). | Browse **OpenAI Math** formalizations, proofs, and local Lean checks (`official: false`) with **zero login** at the [Public Proof Archive](https://theoremos.top/en/archive.html) or in [`results/openai-math/`](./results/openai-math/README.md). |

> [!NOTE]
> These are historical results on fixed statements. Local Lean kernel checks (`official: false`) are strictly distinguished from official hosted passes (`official: true`); archived success chains do not measure the current solver's general zero-shot pass rate.

English · [简体中文](README.zh-CN.md)
---

TheoremOS is a Lean 4 research workbench from [WestlakeNLP, Westlake University](https://westlakenlp.com/). Start with a mathematical statement, review its formalization, then let a single agent or a team work on the proof. Each run preserves the source, attempts and Lean diagnostics. The host checks the complete original goal before it records a proof as accepted.
## Black-Box LLM Provers vs. TheoremOS

[Open the workbench](https://app.theoremos.top/) · [Browse proof records](https://theoremos.top/en/archive.html) · [Documentation](docs/README.md) · [Contributing](CONTRIBUTING.md) · [Star on GitHub](https://github.com/HuggingMath/theorem-os-harness)
| Dimension | Typical Black-Box Automated Provers | TheoremOS (`HuggingMath/theorem-os-harness`) |
| :--- | :--- | :--- |
| **Statement Fidelity** | Formalize silently; a subtle quantifier bug wastes the whole search budget | **Pre-search human review** via [formalization fidelity checks](./docs/formalization-fidelity.md) before proving |
| **Stalled Proofs** | Opaque search loop; hard to inspect or intervene mid-run | **Interactive lemma steering**, preserved source/attempts &amp; **resumable runs** |
| **Completion Trust** | Easy to be fooled by `sorry`, helper lemmas, or environment drift | **Zero-trust host acceptance** ([`evaluation.ts`](./src/solver/evaluation.ts)) re-verifies the frozen original goal cleanly |
| **Research Ablations** | Prompts, retrieval, and scheduling tangled inside one script | **Swappable `M1–M5` interfaces** ([`solver-modules.md`](./docs/solver-modules.md)) decoupled from fixed host verification |

---

<a id="overview-film"></a>

[![TheoremOS workbench with problem input and research settings](docs/assets/workbench-desktop-en.png)](https://app.theoremos.top/)
## 1-Minute Overview Film

[Watch the 1-minute TheoremOS overview film (1080p)](https://github.com/user-attachments/assets/57562769-aa15-474c-87ff-73265f097ec8) · [Self-host the workbench](./docs/web-workbench.md) · [Request hosted cloud access](https://github.com/HuggingMath/TheoremOS/issues/new?template=early-access.yml)

[Watch the one-minute demo](https://github.com/user-attachments/assets/57562769-aa15-474c-87ff-73265f097ec8) · [Self-host the workbench](docs/web-workbench.md) · [Request hosted access](https://github.com/HuggingMath/TheoremOS/issues/new?template=early-access.yml)
---

<a id="快速开始"></a>
<a id="quick-start"></a>

## Quick Start (Zero-Setup to Self-Hosted)

## Quick start
| What you want to do | Where to start | Requirements |
| :--- | :--- | :--- |
| **1. Browse proofs in browser (0 setup)** | [Public Proof Archive](https://theoremos.top/en/archive.html) · [Cloud Workbench](https://app.theoremos.top/) | Browser only (archive needs no login) |
| **2. Run prebuilt Rust CLI replay (Linux)** | [`rust-cli-v0.1.0` Release](https://github.com/HuggingMath/theorem-os-harness/releases/tag/rust-cli-v0.1.0) · [`migration/rust`](https://github.com/HuggingMath/theorem-os-harness/tree/migration/rust) | x86-64 Linux, Git, Bubblewrap, Lean 4.36.0 (no API key) |
| **3. Run TypeScript CLI replay from source** | [5-Command Replay below](#5-command-local-lean-replay-zero-api-keys) · [`docs/usage.md`](./docs/usage.md) | Linux, Bun, Git, Bubblewrap (`user_namespaces`), Elan |
| **4. Reproduce Dimitrov proof locally** | [Dimitrov Reproduction Guide](./examples/dimitrov/README.md) | Local Lean 4 (no model API key) |
| **5. Self-host web workbench or swap `M1–M5`** | [Web Workbench Guide](./docs/web-workbench.md) · [M1–M5 Interfaces](./docs/solver-modules.md) | Linux, Docker Compose + Responses API key |

Run a proof check without a model key or Mathlib. On Linux, install Bun, Git, Bubblewrap with user namespaces enabled, and Elan.
### 5-Command Local Lean Replay (Zero API Keys, Zero Mathlib)

Run a complete host-checked verification loop on your machine (requires Linux, Bun, Git, Bubblewrap with user namespaces enabled, and Elan):

```bash
git clone https://github.com/HuggingMath/theorem-os-harness.git && cd theorem-os-harness
bun install --frozen-lockfile
elan toolchain install leanprover/lean4:v4.36.0
bun run math doctor --lean-only
Expand All @@ -31,29 +100,48 @@ bun run math example replay --dir "$THEOREMOS_REPLAY"
bun run math inspect --run "$THEOREMOS_REPLAY/result.json"
```

Lean rejects the first candidate on `0 + n = n`. The second uses `Nat.zero_add` and passes both goals. A successful replay reports `evaluated_passed` and `official: false`. The example supplies both candidates (`modelInvoked: false`). To run an agent or a team on your own problem, follow the [CLI guide](docs/usage.md).
Lean rejects the first candidate on `0 + n = n`. The second uses `Nat.zero_add` and passes both goals (`evaluated_passed`, `official: false`, `modelInvoked: false`). To run an agent or native team on your own problem, follow the [CLI guide](./docs/usage.md).

<details>
<summary><b>Or download the prebuilt Linux Rust CLI binary (<code>rust-cli-v0.1.0</code>)</b></summary>

## Find your way around
The Rust CLI and its build instructions are maintained on the [`migration/rust` branch](https://github.com/HuggingMath/theorem-os-harness/tree/migration/rust) (see [`docs/rust-migration.md`](./docs/rust-migration.md)). To run the packaged x86-64 Linux offline replay directly from the [v0.1.0 release](https://github.com/HuggingMath/theorem-os-harness/releases/tag/rust-cli-v0.1.0):

```sh
sha256sum --check theorem-os-x86_64-linux-gnu-7fca2fe79ab2.tar.gz.sha256
tar -xzf theorem-os-x86_64-linux-gnu-7fca2fe79ab2.tar.gz
./theorem-os-x86_64-linux-gnu-7fca2fe79ab2/bin/theorem-os example replay --dir ./replay
```

</details>

---

## Find Your Way Around

| Task | Start here |
| --- | --- |
| Submit a problem, inspect diagnostics or resume a run | [CLI guide](docs/usage.md) · [Web workbench](docs/web-workbench.md) |
| Review a formal statement before proving it | [Formalization](docs/formalization.md) · [Statement fidelity](docs/formalization-fidelity.md) |
| Understand how the solver works | [Run lifecycle](src/solver/run.ts) · [Research sessions](src/solver/research.ts) · [Final acceptance](src/solver/evaluation.ts) |
| Change a research policy or run a benchmark | [M1–M5 interfaces](docs/solver-modules.md) · [Examples](examples/README.md) |
| Make and test a change | [Contributing](CONTRIBUTING.md) · [CI workflow](.github/workflows/verify.yml) |
| :--- | :--- |
| Submit a problem, inspect diagnostics, or resume a run | [CLI guide](./docs/usage.md) · [Web workbench](./docs/web-workbench.md) |
| Review a formal statement before proving it | [Formalization](./docs/formalization.md) · [Statement fidelity](./docs/formalization-fidelity.md) |
| Read the solver &amp; verification core | [Run lifecycle](./src/solver/run.ts) · [Research orchestration](./src/solver/research.ts) · [Final acceptance](./src/solver/evaluation.ts) · [Archive](./src/solver/archive.ts) |
| Swap `M1–M5` research policies or run benchmarks | [M1–M5 interfaces](./docs/solver-modules.md) · [Examples](./examples/README.md) |
| Contribute, pick up a `good first issue`, or run checks | [Contributing](./CONTRIBUTING.md) · [Good First Issues](https://github.com/HuggingMath/theorem-os-harness/labels/good%20first%20issue) · [CI workflow](./.github/workflows/verify.yml) |

<a id="verified-proof-highlights"></a>
<a id="lean-eval-and-public-records"></a>
---

## Repositories &amp; Community

| Repository | Scope &amp; Contents | License |
| :--- | :--- | :--- |
| [**HuggingMath/theorem-os-harness**](https://github.com/HuggingMath/theorem-os-harness) *(this repo)* | Open-source web workbench, TypeScript &amp; Rust CLIs, `M1–M5` harness, host verifier &amp; tests | [`AGPL-3.0-only`](./LICENSE) |
| [**HuggingMath/TheoremOS**](https://github.com/HuggingMath/TheoremOS) | Product site ([theoremos.top](https://theoremos.top/en/)), historical proof archive &amp; guides | [Rights reserved](https://github.com/HuggingMath/TheoremOS/blob/main/LICENSE) |

## Proof records
- **⭐ Star this repo** (`HuggingMath/theorem-os-harness`) to follow workbench, CLI, and `M1–M5` updates.
- **💬 Join Discussions** — Share your local replays, Lean 4 tips, or custom `M1–M5` policies in [GitHub Discussions](https://github.com/HuggingMath/theorem-os-harness/discussions).
- **🤝 Contribute** — Check [`CONTRIBUTING.md`](./CONTRIBUTING.md) or grab a [`good first issue`](https://github.com/HuggingMath/theorem-os-harness/labels/good%20first%20issue).

| Collection | What was verified |
| --- | --- |
| [Lean-Eval](accepted/README.md) | Ten archived submissions have official passing responses. The index links each response and identifies the system that produced the proof. To check one yourself, [reproduce the Dimitrov proof](examples/dimitrov/README.md) without a model key. |
| [IMO 2026](examples/imo2026/RESULTS.md) | TheoremOS + GPT-5.6 passed local Lean checks on all 15 goals across six formalized problems. The report gives the proof sources and explains how time was counted. |
| [Public proof archive](https://theoremos.top/en/archive.html) | Browse the OpenAI Math trajectories and their local checks. The [in-repository evidence](results/openai-math/README.md) documents individual targets and their provenance. |
---

These are historical results on fixed statements. Local verification is distinct from an official hosted pass; a collection of successful runs does not measure the current solver's pass rate.
## License, Attributions &amp; Citation

Project-authored code is licensed under [AGPL-3.0-only](LICENSE). See [NOTICE](NOTICE) for third-party software and problem sources, and [CITATION.cff](CITATION.cff) to cite the version used.
Project-authored code is licensed under **[AGPL-3.0-only](./LICENSE)**. See **[NOTICE](./NOTICE)** for third-party software and problem sources, and **[CITATION.cff](./CITATION.cff)** to cite the version used.
Loading
Loading