RC RANDOM CHAOS

MathCode: a terminal agent that turns English math into machine-checked Lean 4 proofs

· via Hacker News

Original source

MathCode, Mathematical Coding Agent

Hacker News →

MathCode is a command-line AI assistant built specifically for formal mathematics. You state a problem in plain language and the tool translates it into a Lean 4 theorem, then works to construct a formal, machine-verified proof. Rather than treating proving as a single shot, it runs an agentic loop: the agent drafts proof candidates, reads the compiler’s structured error diagnostics, and recompiles until the proof checks out. It also hunts for existing verified lemmas by searching Mathlib via leansearch.net and Loogle, and it decomposes hard theorems into independent subgoals that are proven in parallel and stitched back together, with multiple planners exploring different strategies at once.

The engineering focus is on making formal proving fast and cumulative. A persistent Lean language server cuts compile-check latency from roughly 30 seconds to about 0.4 seconds after warmup, which matters a great deal in a tight write-error-recompile cycle. Every proven theorem is auto-named, stored, and made importable so later proofs can reuse it, and conversational assumptions can be saved as compile-checked, consistency-reviewed Lean declarations. The system also emits an Obsidian vault that renders theorem-to-lemma dependencies as a browsable knowledge graph.

Distributed as an open-source project on GitHub, MathCode targets macOS (arm64) and Linux (x86_64) and defaults to the codex CLI as its model backend, with a browser UI available alongside the terminal interface. Its formalization and proving pipeline builds on the AUTOLEAN project. The practical significance is that it packages the fiddly infrastructure of automated theorem proving — fast feedback, lemma reuse, parallel search, and dependency visualization — into a single agentic tool aimed at making Lean formalization accessible from natural-language prompts.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.