fix: missing proof hints in grind propagators (#13623)

This PR fixes proof construction issues in the `grind` projection
propagators.
This commit is contained in:
Leonardo de Moura 2026-05-03 07:51:03 -07:00 committed by GitHub
parent 2d79ec2883
commit 1b23b051f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 44 additions and 3 deletions

View file

@ -23,12 +23,14 @@ private partial def propagateInjEqs (eqs : Expr) (proof : Expr) (generation : Na
let rhs ← preprocessLight rhs
internalize lhs generation
internalize rhs generation
let proof := mkExpectedPropHint proof (← mkEq lhs rhs)
pushEq lhs rhs proof
| HEq _ lhs _ rhs =>
let lhs ← preprocessLight lhs
let rhs ← preprocessLight rhs
internalize lhs generation
internalize rhs generation
let proof := mkExpectedPropHint proof (← mkHEq lhs rhs)
pushHEq lhs rhs proof
| _ =>
reportIssue! "unexpected injectivity theorem result type{indentExpr eqs}"

View file

@ -45,6 +45,8 @@ def propagateProjEq (parent : Expr) : GoalM Unit := do
let idx := info.numParams + info.i
unless idx < ctor.getAppNumArgs do return ()
let v := ctor.getArg! idx
pushEq parentNew v (← mkEqRefl v)
let h ← mkEqRefl v
let h := mkExpectedPropHint h (← mkEq parentNew v)
pushEq parentNew v h
end Lean.Meta.Grind

View file

@ -0,0 +1,36 @@
namespace Sigma
def map (f₁ : α₁ → α₂) (f₂ : ∀ a, β₁ a → β₂ (f₁ a)) (x : Sigma β₁) : Sigma β₂ :=
⟨f₁ x.1, f₂ x.1 x.2⟩
end Sigma
public section
namespace List
variable {α : Type} {α' : Type} {β : α → Type} {β' : α' → Type} {l l₁ l₂ : List (Sigma β)}
opaque keys : List (Sigma β) → List α
variable [DecidableEq α] [DecidableEq α']
/--
error: `grind` failed
case grind
α : Type
β β' : α → Type
f : (a : α) → β a → β' a
head : (a : α) × β a
tail : List ((a : α) × β a)
tail_ih : (map (Sigma.map id f) tail).keys = tail.keys
h : ¬(map (Sigma.map id f) (head :: tail)).keys = (head :: tail).keys
⊢ False
-/
#guard_msgs in
set_option grind.debug true in
omit [DecidableEq α] in
theorem map₂_keys {β β' : α → Type} (f : (a : α) → β a → β' a) (l : List (Σ a, β a)) :
(l.map (.map id f)).keys = l.keys := by
induction l
· sorry
· grind -verbose [Sigma.map]

View file

@ -43,11 +43,12 @@ fun {α} {x} {xs} {y} {ys} h =>
fun h_1 =>
id
(Eq.mp
(Eq.trans (Eq.symm (eq_true (L.cons.inj (id h)).1))
(Eq.trans (Eq.symm (eq_true (id (L.cons.inj (id h)).1)))
(Lean.Grind.eq_false_of_not_eq_true
(Eq.trans
(Eq.symm
(Lean.Grind.or_eq_of_eq_false_right (Lean.Grind.not_eq_of_eq_true (eq_true (L.cons.inj (id h)).2))))
(Lean.Grind.or_eq_of_eq_false_right
(Lean.Grind.not_eq_of_eq_true (eq_true (id (L.cons.inj (id h)).2)))))
(eq_true h_1))))
True.intro))
-/