fix: simp fails to discharge autoParam premises even when it can reduce them to True (#3314)

closes #3257
This commit is contained in:
Leonardo de Moura 2024-02-17 05:41:48 -08:00 committed by GitHub
parent 496a8d578e
commit 678797b67b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View file

@ -471,6 +471,7 @@ where
return some mvarId
def dischargeDefault? (e : Expr) : SimpM (Option Expr) := do
let e := e.cleanupAnnotations
if isEqnThmHypothesis e then
if let some r ← dischargeUsingAssumption? e then
return some r

18
tests/lean/run/3257.lean Normal file
View file

@ -0,0 +1,18 @@
structure T : Prop
structure U : Prop
theorem foo : T → U := λ _ => {}
theorem bar : (_ : T := by trivial) → U := λ _ => {}
-- fails as expected
example : U := by
fail_if_success simp
sorry
-- works as expected, discharging `T` via `T.mk`
example : U := by
simp [foo, T.mk]
example : U := by
set_option trace.Meta.Tactic.simp true in
simp [bar, T.mk]