fix: grind canonicalizer (#10237)

This PR fixes a missing case in the `grind` canonicalizer. Some types
may include terms or propositions that are internalized later in the
`grind` state.

closes #10232
This commit is contained in:
Leonardo de Moura 2025-09-03 11:08:48 -07:00 committed by GitHub
parent 80df86dfdd
commit 320b02108b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View file

@ -233,7 +233,12 @@ where
let arg := args[i]
trace_goal[grind.debug.canon] "[{repr (← shouldCanon pinfos i arg)}]: {arg} : {← inferType arg}"
let arg' ← match (← shouldCanon pinfos i arg) with
| .canonType => canonType e f i arg
| .canonType =>
/-
The type may have nested propositions and terms that may need to be canonicalized too.
So, we must recurse over it. See issue #10232
-/
canonType e f i (← visit arg)
| .canonImplicit => canonImplicit e f i (← visit arg)
| .visit => visit arg
| .canonInst =>

View file

@ -0,0 +1,9 @@
def U {shape : Std.PRange.RangeShape} (b : Std.PRange.Bound shape.upper α) : Unit := sorry
structure T (l : α) : Type u where
def mysorry : α := sorry -- instead of `mysorry`, we could also use `sorry`.
example (inv : (T (U (shape := ⟨.closed, .closed⟩) 1)) → Prop)
(h : inv mysorry) : True := by
grind