lean-dojo/LeanCopilot

LLMs as Copilots for Theorem Proving in Lean

What it solves

Lean Copilot integrates Large Language Models (LLMs) directly into the Lean theorem prover to automate the tedious parts of formal proof construction. It helps users overcome the "blank page" problem by suggesting the next steps in a proof or searching for complete proofs automatically.

How it works

The project provides a native bridge between Lean and LLMs. It allows users to run models locally via CTranslate2 or connect to remote models via an API. It implements three primary functions:

  • Tactic Suggestion: Generates potential next tactics to advance a proof, which users can click to apply.
  • Proof Search: Combines LLM-generated tactics with the aesop search engine to find multi-step proofs.
  • Premise Selection: Uses a retriever model to identify useful mathematical premises from Lean and mathlib4 that are relevant to the current goal.

Who it’s for

It is designed for mathematicians and computer scientists working with the Lean theorem prover who want to accelerate their formalization efforts using AI assistance.

Highlights

  • Flexible Model Support: Supports built-in models from LeanDojo, local models (with or without GPUs), and custom remote models.
  • Native Integration: Works as a Lean dependency, allowing LLM inference to be triggered directly from within the Lean editor.
  • Extensible API: Provides TextToText and TextToVec interfaces, enabling developers to build custom proof automation or other LLM-based applications in Lean.
  • Cross-Platform: Supports Linux, macOS, and Windows (including WSL).

Related

  • Project
  • Project
  • Project
  • Project
  • Project