llmlean

llmlean

LLMs + Lean, on your laptop or in the cloud

Stars: 81

Visit
 screenshot

LLMLean integrates LLMs and Lean for tactic suggestions, proof completion, and more. Users can utilize LLMLean on problems from Mathematics in Lean by installing LLM on their laptop or using LLM from the Open AI API or Together.ai API. The tool provides tactics like `llmstep` for next-tactic suggestions and `llmqed` for completing proofs. For optimal performance, especially with `llmqed` tactic, it is recommended to use the Open AI API.

README:

LLMLean

LLMlean integrates LLMs and Lean for tactic suggestions, proof completion, and more.

Here's an example of using LLMLean on problems from Mathematics in Lean:

https://github.com/user-attachments/assets/284a8b32-b7a5-4606-8240-effe086f2b82

You can use an LLM running on your laptop, or an LLM from the Open AI API or Together.ai API:

LLM on your laptop:

  1. Install ollama.

  2. Pull a language model:

ollama pull wellecks/ntpctx-llama3-8b
  1. Add llmlean to lakefile:
require llmlean from git
  "https://github.com/cmu-l3/llmlean.git"
  1. Import:
import LLMlean

Now use a tactic described below.

LLM in the cloud (OpenAI):

  1. Get an OpenAI API key.

  2. Set 2 environment variables:

export LLMLEAN_API=openai
export LLMLEAN_API_KEY=your-openai-api-key

Then do steps (3) and (4) above. Now use a tactic described below.

LLM in the cloud (together.ai):

  1. Get a together.ai API key.

  2. Set 2 environment variables:

export LLMLEAN_API=together
export LLMLEAN_API_KEY=your-together-api-key

Then do steps (3) and (4) above. Now use a tactic described below.


llmstep tactic

Next-tactic suggestions via llmstep "{prefix}". Examples:

  • llmstep ""

  • llmstep "apply "

The suggestions are checked in Lean.

llmqed tactic

Complete the current proof via llmqed. Examples:

The suggestions are checked in Lean.

For the best performance, especially for the llmqed tactic, we recommend using the Open AI API.

Demo in PFR

As an example, we provide detailed instructions of using LLMLean in the Polynomial Freiman Ruzsa conjecture formalization. Please see the following:

Customization

Please see the following:

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for llmlean

Similar Open Source Tools

For similar tasks

For similar jobs