fix: grind sort internalization (#10477)

This PR ensures sorts are internalized by `grind`.
This commit is contained in:
Leonardo de Moura 2025-09-20 11:31:20 -07:00 committed by GitHub
parent 6b92cbdfa4
commit 35764213fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 1 deletions

View file

@ -380,7 +380,13 @@ where
trace_goal[grind.internalize] "[{generation}] {e}"
match e with
| .bvar .. => unreachable!
| .sort .. => return ()
| .sort .. =>
/-
**Note**: It may seem wasteful to create ENodes for sorts, but it is useful for the E-matching module.
The E-matching module assumes that the arguments of an internalized application have also been internalized,
unless they are `grind` gadgets.
-/
mkENode' e generation
| .fvar .. =>
mkENode' e generation
checkAndAddSplitCandidate e

View file

@ -0,0 +1,16 @@
def f (α : Sort u) (_ : α) : Nat := 0
theorem feq : f (List α) x = 0 := rfl
/--
error: `grind` failed
case grind
h : ¬f Prop True = 0
⊢ False
-/
#guard_msgs in
example: f Prop True = 0 := by
grind -verbose [feq] -- must not produce error `Prop` has not been internalized
example: f Prop True = 0 := by
grind [f]