feat: add grind option abstractProof (#9574)

This PR adds the option `abstractProof` to control whether `grind`
automatically creates an auxiliary theorem for the generated proof or
not.
This commit is contained in:
Leonardo de Moura 2025-07-27 04:33:16 -07:00 committed by GitHub
parent 95e753c6b4
commit 30ba416fe3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View file

@ -120,6 +120,10 @@ structure Config where
the characteristic of a ring.
-/
exp : Nat := 2^20
/--
When `true` (default: `true`), automatically creates an auxiliary theorem to store the proof.
-/
abstractProof := true
deriving Inhabited, BEq
end Lean.Grind

View file

@ -161,8 +161,10 @@ def grind
if result.hasFailed then
throwError "`grind` failed\n{← result.toMessageData}"
trace[grind.debug.proof] "{← instantiateMVars mvar'}"
-- `grind` proofs are often big
let e ← if (← isProp type) then
-- `grind` proofs are often big, if `abstractProof` is true, we create an auxiliary theorem.
let e ← if !config.abstractProof then
instantiateMVarsProfiling mvar'
else if (← isProp type) then
mkAuxTheorem type (← instantiateMVarsProfiling mvar') (zetaDelta := true)
else
let auxName ← Term.mkAuxName `grind