demo.mp4
Use reap tactic to leverage the power of LLM in your formal proof.
The reap tactic take advantages of our latest algebra & research level stepwise-prover Real-Prover to facilitate the proof-writing process.
To use reap in your project, just add a line to lakefile.lean or lakefile.toml. Please make sure reap is added before mathlib dependency to avoid cache issues.
If you are using lakefile.lean, replace
require "leanprover-community" / "mathlib"
with
require "reap" from git "https://github.com/frenzymath/reap.git" @ "main"
require "leanprover-community" / "mathlib"
Or if you are using lakefile.toml
replace
[[require]]
name = "mathlib"
scope = "leanprover-community"with
[[require]]
name = "reap"
git = "https://github.com/frenzymath/reap.git"
rev = "main"
[[require]]
name = "mathlib"
scope = "leanprover-community"Currently, our model is trained with Mathlib at v4.16.0, and reap is compatible with up to v4.24.0. As we are working on bridging version gap and further improvements, any feedbacks are welcomed.
To use the tactic, you need to import the module:
import Mathlib
import Reap
example (φ : G →* H) (S T : Subgroup G) (hST : S ≤ T) : map φ S ≤ map φ T := by
reap?
Here, reap? will toggle a trythis block, which suggests a possible next step.
There are also some variants of the reap tactic:
reaptries to push the goal one step further.reap!tries to close the goal within a single step, otherwise it will fail.
To do proof search with reap:
import Mathlib.Algebra.Order.Ring.Star
import Mathlib.Analysis.Normed.Ring.Lemmas
import Mathlib.Data.Int.Star
import Reap
theorem aux {m n : ℕ} (h₀ : m ∣ n) (h₁ : 2 ≤ m) (h₂ : m < n) : n / m ∣ n ∧ n / m < n := by
-- This can be solved by `reap!!`
reap!!
Here, reap!! take advantage of aesop.tacGen interface to do proof search with reap.
reap comes with a powerful premise selection engine, named LeanSearch-PS, which is trained on Mathlib and augmented corpus. We adapt this engine to work with official PremiseSelection interface, to get access:
import Mathlib
import Reap
-- Set `reap` as the default premise selector
set_premise_selector reapSelector
example (φ : G →* H) (S T : Subgroup G) (hST : S ≤ T) : map φ S ≤ map φ T := by
suggest_premises
As reap relies on a backend LLM service to provide tactic suggestions, we understand that privacy is a major concern for users. Here are some key points regarding data handling and privacy:
-
Which LLM is used / who runs it? The backend uses our own trained model named REAL-Prover. The 7B version is open-sourced on HuggingFace (link), while the hosted version we provide runs on our research cluster.
-
Does it require internet access? By default, yes — the default endpoint is our hosted cluster. However, you can override this by setting
tacticgenerator.llm_endpointto a locally served instance of REAL-Prover. In that case, no internet connection is needed. -
What API calls are made? When you call
reapto generate the next tactic, it sends the current proof state to the model endpoint you’ve configured (by default, our hosted cluster). -
What data is sent?
Only the proof state at the point of the call. No file paths, user identifiers, or other project metadata are transmitted. On our side, this data is processed statelessly by the model.