Facilitate formal proof writing in Lean 4 through human-machine collaboration.
Demo.mp4
- Make sure you have already installed Github Copilot Chat in your Visual Studio Code.
- Download the VSIX package from the release page and install this extension.
- Open VSCode
- Go to the Extensions panel (Cmd+Shift+X or click the Extensions icon in the sidebar)
- Click the ... menu at the top right corner
- Select "Install from VSIX..."
- Choose the mozi-lean-copilot-x.x.x.vsix file
- Toggle Github Copilot Chat by
Ctrl+Shift+i. - Type
@mozi /settingsin the Copilot Chat, insert your api keyMozi-lean-copilot: Api Keyfield. You are all set!
Currently, Mozi provides 2 commands in writing Lean proofs:
-
/prove: Place your cursor after a Lean theorem statement and type@mozi /provein the Copilot Chat input box. Mozi will try to generate proof for the theorem.Example usage:
example (m n : ℕ) (h : m ≥ n) : card (range n ∪ (range n).image (fun i ↦ m + i)) = 2 * n := by /- place cursor here -/sorry
-
/fix: Select a block of proof code that contains errors, and type@mozi /fixin the Copilot Chat input box. Mozi will attempt to fix the errors in the selected proof code.
Mozi can be configured through typing the @mozi /settings command in the Copilot Chat input box.
The following settings are available:
Use Remote Verifier(Default tofalse): Enable or disable the use of a remote Lean verifier service.true: send proof obligations to the self-hosted remote service for verification.false: use feedback from your local Lean LSP(Language Server Protocol) server.
Prove Mode(Default toadvance):Basic: Rely only on compiler errors and warnings from the Lean to guide proof generation.Advance: Utilize additional information from LeanSearch to enhance proof generation.
Max Attempts: Set the maximum number of attempts Mozi will make to generate proof or fix errors.
- Remote verifier service may not be stable. If you encounter issues, please try switching to local verification by setting
Use Remote Verifiertofalse.