English · 简体中文
Open-Source Human-in-the-Loop Lean 4 Research Workbench & Modular Agent Runtime
Developed at
WestlakeNLP
(Natural Language Processing Lab, Westlake University)
⭐ Star · 1-Min Film · Proof Highlights · 5-Cmd Replay · Browse 29 Proofs · Cloud Workbench · M1–M5 Modules · Cite
TheoremOS is an open-source human-in-the-loop Lean 4 mathematical research workbench and modular agent runtime (AGPL-3.0-only). Instead of trusting black-box LLM claims of "proof complete", TheoremOS lets mathematicians review formal statements via blind back-translation, steer lemma decomposition, swap five versioned research policy modules (M1–M5), and enforce zero-trust independent Lean 4 kernel acceptance (S1 archives & S3 final verification).
| 🏆 10 Official Lean-Eval Passes | 📐 IMO 2026: 6/6 (15/15 Goals) |
🔬 18 OpenAI Math Trajectories |
|---|---|---|
| Officially accepted on frozen submission targets — incl. Unit Conjecture, Hopf–Rinow, Dimitrov, Improved Sunflower Bounds, Lorentzian Polynomials, and Optimal Paper Möbius Band (view table). | Verified on aligned AxiomMath formalizations (TheoremOS + GPT-5.6, 285.55 min total; local independent Lean kernel check, official: false). Full proofs & timing in examples/imo2026/RESULTS.md. |
Locally checked in Lean 4 with problem comparators (official: false) and full saved research trajectories — browseable with zero login in the Interactive Proof Archive. |
Note
All public records strictly separate official hosted evaluations (official: true) from local independent Lean kernel checks (official: false). Archived success chains and preview runs do not represent a general zero-shot pass rate.
Tip
Finding TheoremOS useful? Click ⭐ Star on HuggingMath/theorem-os to bookmark the open-source workbench, CLI, and M1–M5 runtime and follow upcoming releases from WestlakeNLP.
theoremos-promo-github.mp4
TheoremOS Overview Film (1:07 · EN narration & subtitles) — Conjecture → Lean Lemma Graph & Guidance → CLI Replay → Co-Authorship → M1–M5 Harness → S3 Kernel Acceptance → Public Archives & Solved Proof Trajectory · Download full-bitrate 1080p master (31 MB)
| Human-in-the-Loop Workbench | Zero-Trust Acceptance (S1 / S3) |
Replaceable M1–M5 Modules |
|---|---|---|
Built-in apps/web UI supporting natural language, TeX, or single-file Lean input, blind back-translation statement review, native Codex teams, optional initial route approval, and live Lean diagnostics. |
A model claiming completion or passing local helper lemmas never counts as theorem acceptance; evaluation.ts re-verifies the frozen original problem cleanly, while archive.ts checkpoints every attempt for pause and resume. |
Decouples proof construction, evidence checks, search scheduling, context assembly, and role assignment into 5 versioned TypeScript interfaces (M1–M5) so ablation runs stay reproducible on pinned revisions. |
| Repository | Role & Contents | License |
|---|---|---|
| HuggingMath/theorem-os (main open-source repo) | Web workbench (apps/web), CLI runner (bun run math), M1–M5 runtime, S1/S3 verifier & tests |
AGPL-3.0-only |
| HuggingMath/TheoremOS (archive & site) | Product website, 29 archived proof records, Dimitrov proof kit & bilingual guides | Rights reserved |
| What you want to do | Where to start | Requirements |
|---|---|---|
| Replay local Lean verification (no API key) | 5-Command Replay below · Getting-Started | Linux, Bun 1.2+, Lean 4.36.0 (stdlib only; zero LLM calls) |
| Browse 29 verified proofs & trajectories | Proof Archive (EN) · 中文档案 | Browser only (no account required) |
| Self-host the workbench via Docker Compose | Workbench Deployment Guide · compose.yml |
Linux, Docker Compose, /dev/fuse (full Mathlib image) |
| Try the hosted cloud workbench | Cloud Workbench · Request Access | Allowlisted email & Responses API key |
| Swap M1–M5 research policies & benchmark | Component Example · IMO2026 Guide | Codex CLI, Elan/Lean, Bubblewrap & FUSE |
Run the standalone standard-library example on your host (no Mathlib download or LLM credentials needed):
git clone https://github.com/HuggingMath/theorem-os.git && cd theorem-os
bun install --frozen-lockfile
elan toolchain install leanprover/lean4:v4.36.0
export THEOREMOS_REPLAY="$PWD/../theorem-os-runs/first-replay"
bun run math doctor --lean-only
bun run math example replay --dir "$THEOREMOS_REPLAY"
bun run math inspect --run "$THEOREMOS_REPLAY/result.json"The replay builds the pinned runtime, submits a deliberately failing candidate, inspects the Lean diagnostic, repairs it using Nat.zero_add, and runs independent whole-problem verification (evaluated_passed, modelInvoked: false, official: false). Once your model profile is ready, continue with bun run math example prepare / check / resume — see the Usage Guide.
2. Self-Host the Web Workbench with Docker Compose or GHCR Images
See the Web Workbench Guide and Operations Guide for host /dev/fuse requirements and disk headroom (~30 GiB recommended per concurrent Mathlib run):
# Option A: Build web, worker and tex locally, then start the workbench
THEOREMOS_SOURCE_COMMIT=$(git rev-parse HEAD) docker compose -f apps/web/compose.yml build worker web tex
docker compose -f apps/web/compose.yml up -d web
docker compose -f apps/web/compose.yml ps
# Option B: Pull all three images published by GitHub Actions for the same commit
export THEOREMOS_IMAGE_TAG=<full-40-char-commit-sha>
docker compose -f apps/web/compose.yml -f apps/web/compose.ghcr.yml pull worker web tex
bun scripts/web-operations.ts images --commit "$THEOREMOS_IMAGE_TAG"
docker compose -f apps/web/compose.yml -f apps/web/compose.ghcr.yml up -d --no-build web3. Scaffold and Check a Custom M1–M5 Research Module
Swap individual research policies without altering the host verification loop or S3 acceptance contract (details in Component Replacement Guide):
bun run math component init --name my-search
bun run math component check --name my-searchThe Codex Lead assigns work in current collaborative runs. You can still inspect older host-scheduled runs. Resume them and reproduce M3 scheduling experiments with their respective pinned historical revisions. Resume guide
|
|
| Modular Research Loop — Five swappable M1–M5 components separated from fixed S3 acceptance (中文图). | Live Lean Workspace — Per-task sealed environment, imports, and compiler diagnostics (中文截图). |
View verification replay output and strategy plan library screenshots
|
|
Preset Local Replay — Zero-model verification check showing evaluated_passed and zero sorry placeholders.
|
Strategy Plan Library — Save, switch, export, or import custom module configurations (中文截图). |
TheoremOS separates research decisions from proof verification. The table includes the historical M3 task ordering and M5 fixed-role contracts used to interpret scheduling experiments. The Codex Lead assigns work in current teams. Module guide
| Component / Layer | Responsibility | Implementation | Guide & Examples |
|---|---|---|---|
| M1 · Execution | Run bounded agent turns, candidate synthesis, and research notes in an isolated workspace | execution.ts |
Component Contracts |
| M2 · Evidence | Bind commits and declaration identity, run Lean candidate checks and compiler feedback | evidence.ts |
Formalization Guide |
| M3 · Search Scheduling | Select next actions, prioritize ready tasks, and manage recoverable retries | search.ts |
M3 Replacement Demo |
| M4 · Context Selection | Assemble version-consistent theorem statements, dependencies, and constraints within budgets | context.ts |
Recovery & Checkpoints |
| M5 · Organization | Assign tasks, engineers, and independent reviewers across isolated slots | organization.ts |
Module Boundaries |
| S1 / S3 · Host Acceptance | Archive all search attempts/receipts and re-verify the full original problem cleanly | archive.ts · evaluation.ts |
Usage Guide |
- IMO 2026 Public Comparison (
6/6problems /15/15goals): Verified on aligned AxiomMath formal statements (TheoremOS + GPT-5.6total 285.55 min, local Lean verificationofficial: false); methodology, timing definitions, and complete proofs are inexamples/imo2026/RESULTS.mdand the IMO2026 Guide. - Lean-Eval & Extended Benchmarks: Frozen archive provenance in
accepted/accepted.jsonandsubmitted/README.md, alongside PutnamBench and First Proof adapters. Browse all 29 interactive trajectories at theoremos.top/en/archive.html or HuggingMath/TheoremOS. - Technical Documentation: Formalization · Informalization · Website & Archive Architecture · Release Trial Notes · v0.1.0 Release Notes
View all 10 proofs officially accepted by Lean-Eval
| Proof Package | Area | Official Result |
|---|---|---|
| Unit conjecture: a nontrivial group-ring unit | Algebra | #1246 · pass |
| Rademacher type and Enflo type coincide | Functional analysis | #2115 · pass |
| Equiangular lines with a fixed angle | Discrete geometry | #2135 · pass |
| Fractional expectation thresholds | Probabilistic combinatorics | #2141 · pass |
| Dimitrov's lower bound for algebraic integers | Algebraic number theory | #2143 · pass |
| Hopf–Rinow theorem | Riemannian geometry | #2143 · pass |
| Improved bounds for the sunflower lemma | Combinatorics | #2144 · pass |
| Lorentzian polynomials | Algebraic combinatorics | #2144 · pass |
| The optimal paper Möbius band | Geometry | #2144 · pass |
| Algebraic integers: an upper bound for λ_SSS | Algebraic number theory | #2144 · pass |
|
TheoremOS is developed at WestlakeNLP, the Natural Language Processing Lab at Westlake University (founded in 2018 and led by Prof. Yue Zhang). The lab pursues fundamental and applied research in natural language processing, language-model reasoning, and AI for Science.
Website: westlakenlp.com · X (Twitter): @NlpWestlake · Contact: liuzhenhao@westlake.edu.cn |
- Project-authored source code in this repository is licensed under AGPL-3.0-only. Third-party notices—covering components adapted from DeepScientist (including
Apache-2.0files tracing back to AionUi), LeanAide, autoform-bot, bundled fonts, the 44 upstream Lean modules, Codex backend notices, and benchmark problem licenses—are detailed in NOTICE. - When citing TheoremOS in papers or evaluations, please follow CITATION.cff (including the release tag or commit used) and cite third-party software, problems, or datasets separately under their respective terms.
Cite TheoremOS (BibTeX)
@software{liu2026theoremos,
author = {Liu, Zhenhao},
title = {TheoremOS},
version = {0.1.0},
year = {2026},
month = nov,
note = {WestlakeNLP, Westlake University},
url = {https://github.com/HuggingMath/theorem-os}
}- ⭐ Star this repository — Bookmark HuggingMath/theorem-os for open-source workbench, CLI, and M1–M5 solver releases.
- 📚 Explore archived proofs — Visit HuggingMath/TheoremOS or theoremos.top/en/archive.html for the 29 archived proof records and standalone Dimitrov verification kit.
- 💬 Contribute & report issues — Open Pull Requests for solver module ideas and toolchain support, or share feedback and verification findings via GitHub Issues.
- 🤝 Research collaboration — Follow @NlpWestlake or email liuzhenhao@westlake.edu.cn to discuss multi-file Lake projects and joint evaluations.
⭐ Star TheoremOS · Browse 29 Proofs · Launch Cloud Workbench · Open an Issue



