Large language models have long struggled with mathematical rigor, often producing plausible but incorrect proofs that slip past human review. QED, a new open-source toolchain released on December 2, 2026, aims to solve this by pairing coding agents like Claude Code with a formal verification pipeline. The system forces agents to generate proofs in Lean 4, a functional programming language and proof assistant, ensuring that every step is mathematically valid before it reaches the researcher.
The Verification Loop
At its core, QED operates on a 'conjecture-to-audit' workflow. The agent receives a mathematical statement, searches for counterexamples using Python-based falsification, and then attempts to write a Lean 4 proof. If the proof compiles and passes a six-gate auditβincluding checks for sorry placeholders, forbidden axioms, and kernel replayβQED generates a LaTeX manuscript with verification badges. This creates an 'audit trail' that is machine-readable and reproducible, addressing the black-box nature of typical LLM outputs.
Overhead vs. Accuracy
The trade-off for this rigor is significant computational overhead. In a benchmark involving the 'kite lemma,' QED required approximately 10 times the time and 15 times the tokens of a plain agent workflow. While a standard agent might prove a lemma in 3 minutes, QED took 32 minutes to reach acceptance, largely due to the strict requirements of the Lean kernel and the adversarial review process. However, the system successfully refuted seven neighboring claims that the plain agent missed, demonstrating that the extra cost buys substantial depth in verification.
Integration and Requirements
QED v0.2 is distributed as an npm package (qed-agents) and supports installation via macOS, Linux, or WSL2. It requires Node.js 18+ and Python 3.9+, with setup profiles ranging from a quick 3 GB install to a full 7 GB cache for Mathlib. The toolchain integrates directly with Claude Code 2.1.332 via a plugin, allowing users to invoke skills like qed-research to handle complex proofs. The system also includes a 'ledger' of kernel-verified lemmas, preventing the reuse of unverified intermediate results.
Key Takeaways
- QED enforces formal verification by requiring Lean 4 proofs to pass six distinct audit gates, including kernel replay and axiom checks.
- The toolchain significantly increases resource usage, costing ~10x time and ~15x tokens compared to standard agent workflows.
- It supports integration with Claude Code via a plugin and manages dependencies through a shared Mathlib cache to minimize build times.
- The system can generate publishable LaTeX manuscripts with embedded verification badges, bridging the gap between LLM exploration and formal mathematics.
The Bottom Line
QED proves that LLMs can be trusted with formal mathematics only if we stop treating them as oracles and start treating them as junior researchers who need their work checked. The overhead is steep, but for high-stakes math, hallucinations are no longer acceptable.