Zing Forum

Reading

Lean4-Skills: A Theorem Proving Workflow Suite Built for AI Programming Assistants

A cross-platform compatible Lean 4 theorem proving skill suite that provides a complete workflow from draft generation to proof optimization, supporting mainstream AI programming tools like Claude Code, Codex, and Gemini.

Lean 4定理证明AI编程助手形式化数学mathlibMCPClaude CodeCodex工作流自动化
Published 2026-04-22 05:43Recent activity 2026-04-22 05:52Estimated read 6 min
Lean4-Skills: A Theorem Proving Workflow Suite Built for AI Programming Assistants
1

Section 01

Lean4-Skills: AI-Assisted Theorem Proving Workflow Suite

Lean4-Skills: AI-Assisted Theorem Proving Workflow Suite

Lean4-Skills is a cross-platform compatible Lean 4 theorem proof workflow suite designed for AI programming assistants. It provides a complete lifecycle from draft generation to proof optimization, supporting mainstream tools like Claude Code, Codex, and Gemini. The suite aims to lower the barrier to formalized mathematics by enabling AI agents to assist in Lean 4 proof processes, integrating with mathlib and MCP for efficient feedback.

2

Section 02

Background: Formal Proof Challenges & AI Potential

Background: Formal Proof Challenges & AI Potential

Formal mathematical proof requires rigorous machine-verified reasoning, but Lean 4's complex syntax, mathlib mastery, and proof strategies create high barriers for researchers. With the rise of AI programming assistants, Lean4-Skills addresses the question: Can AI automate or assist Lean 4 formal proof? It offers a systematic solution to let AI play a practical role in theorem proving.

3

Section 03

Workflow Design: Structured Loop & Core Skills

Workflow Design: Structured Loop & Core Skills

Lean4-Skills uses a 'structured loop' design—breaking proof into repeatable stages with clear inputs/outputs and checkpoints. It includes 11 core workflows covering the full lifecycle: draft (skeleton code from informal statements), formalize (interactive formality), autoformalize (end-to-end autonomous), prove (guided proof), autoprove (budget-controlled loops), checkpoint (save & verify), review (quality check), refactor (mathlib-based optimization), golf (conciseness), learn (mathlib exploration), and doctor (diagnosis/migration).

4

Section 04

Cross-Platform Compatibility

Cross-Platform Compatibility

Lean4-Skills features a host-agnostic design, working with Claude Code, OpenAI Codex, Google Gemini CLI, Cursor, and Windsurf. Claude Code users can call workflows via /lean4:<name> commands; others use SKILL.md configurations. This avoids skill fragmentation, allowing seamless tool migration. Detailed installation guides are provided for each tool, including environment variables and path settings.

5

Section 05

Proof Engine & MCP Integration

Proof Engine & MCP Integration

The prove/autoprove engine uses a 5-stage loop: Plan → Work → Checkpoint → Review → Replan → Continue/Stop. It analyzes goal states, searches mathlib for strategies, and parallel-tests approaches for sorry placeholders. Integration with lean-lsp-mcp provides sub-second feedback (replacing 30+ second lake builds) via tools like lean_goal (target state), lean_multi_attempt (parallel strategy testing), and lean_diagnostic_messages (error checks without full builds). Claude Code users are recommended to install MCP at user scope for visibility.

6

Section 06

Application Scenarios

Application Scenarios

Typical use flow: Generate initial statements via draft/autoformalize → complete proof with prove/autoprove → review quality → refactor with mathlib → optimize via golf → save via checkpoint. Benefits: Researchers focus on mathematical insights (not formal details), educators get interactive mathlib learning tools, formal verification projects gain scalable automation.

7

Section 07

Future Directions & Community Engagement

Future Directions & Community Engagement

Current limitations: Primarily tested on Pythia/Llama models; Breaking Change handling needs user attention. Future plans: Support Coq/Isabelle, integrate ATPs (Z3/CVC5), domain-specific workflows. Community feedback is enabled via lean4-contribute plugin: bug-report, feature-request, share-insight—all confirmed by users before submission to ensure privacy and intent.