lean4-htt/tests/lean/run/premise_selection.lean
Kim Morrison cf22c367a1
feat: grind +premises (#10920)
This PR adds support for `grind +premises`, calling the currently
configured premise selection algorithm and including the results as
parameters to `grind`. (Recall that there is not currently a default
premise selector provided by Lean4: you need a downstream premise
selector to make use of this.)
2025-10-23 06:42:48 +00:00

39 lines
936 B
Text

import Lean.PremiseSelection
/--
error: Type mismatch
Nat
has type
Type
of sort `Type 1` but is expected to have type
Lean.PremiseSelection.Selector
of sort `Type`
---
error: Failed to elaborate Nat as a `MVarId → Config → MetaM (Array Suggestion)`.
-/
#guard_msgs in
set_premise_selector Nat
/--
error: No premise selector registered. (Note that Lean does not provide a default premise selector, these must be provided by a downstream library, and configured using `set_premise_selector`.)
-/
#guard_msgs in
example : True := by
suggest_premises
trivial
set_premise_selector (fun _ _ => pure #[])
/-- info: Premise suggestions: [] -/
#guard_msgs in
example : True := by
suggest_premises
trivial
set_premise_selector Lean.PremiseSelection.random ⟨1,1⟩
-- This would be an extremely fragile test (select 10 random constants!)
-- so we do not use #guard_msgs.
example : True := by
suggest_premises
trivial