Overview
MathCode is simply a terminal AI coding adjunct pinch a built-in mathematics formalization engine. Give it a mathematics problem successful plain connection and it will automatically person it into a Lean 4 theorem and effort a general impervious — pinch a persistent Lean REPL, reusable theorem and axiom libraries, agentic proving, and an Obsidian knowledge graph.

Quick Start
Requires macOS (arm64) aliases Linux (x86_64), positive the codex CLI for the default backend.
git clone https://github.com/math-ai-org/mathcode.git cd mathcode bash setup.sh codex auth login mathcodesetup.sh prepares the merchandise checkout, downloads the bundled runtime and Lean toolchain, and installs a user-local mathcode launcher. Try it with:
mathcode -p "prove that the quadrate of an moreover number is even"Outputs are written to LeanFormalizations/. A browser UI is disposable via ./run webui.
Features
Persistent Lean REPL
A persistent Lean connection server brings compile checks to ~0.4s aft a one-time warmup, alternatively of ~30s.
Theorem Library
Every proved theorem is auto-named, stored, and made importable truthful the prover and planner tin reuse it.
Axiom Library
Store conversational assumptions arsenic persistent, compile-checked, consistency-reviewed Lean declarations.
Lean LSP Integration
Searches leansearch.net and Loogle for verified Mathlib lemmas and uses system LSP diagnostics for repairs.
Obsidian Theorem Graph
Generates an Obsidian vault that visualizes theorem-to-lemma limitations arsenic a knowledge graph.
Agent-Mode Proving
Each impervious becomes an interactive convention wherever the supplier writes candidates, sounds errors, and recompiles.
Tree-of-Subgoals
Decomposes analyzable theorems into independent subgoals and proves them successful parallel, past stitches them back.
Multi-Planner
Runs aggregate planners successful parallel for divers impervious strategies; the prover picks the champion approach.
Citation
If you usage MathCode successful research, please cite:
@misc{mathcode2026, title = {MathCode: A Frontier Mathematical Coding Agent}, writer = {Team Math-AI}, diary = {math-ai-org.github.io}, twelvemonth = {2026}, period = {April}, url = {https://github.com/math-ai-org/mathcode} }The mathematics formalization and proving pipeline is based connected the AUTOLEAN project.
English (US) ·
Indonesian (ID) ·