fix: type incorrect term produced by contradiction (#6387)

This PR fixes a type error in the proof generated by the `contradiction`
tactic.

closes #4851
This commit is contained in:
Leonardo de Moura 2024-12-15 01:21:15 +01:00 committed by GitHub
parent 94641e88cf
commit e08d35cea1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -160,7 +160,8 @@ def _root_.Lean.MVarId.contradictionCore (mvarId : MVarId) (config : Contradicti
-- (h : ¬ p) (h' : p)
if let some p ← matchNot? localDecl.type then
if let some pFVarId ← findLocalDeclWithType? p then
mvarId.assign (← mkAbsurd (← mvarId.getType) (mkFVar pFVarId) localDecl.toExpr)
-- We use `False.elim` because `p`'s type may be Type
mvarId.assign (← mkFalseElim (← mvarId.getType) (mkApp localDecl.toExpr (mkFVar pFVarId)))
return true
-- (h : x ≠ x)
if let some (_, lhs, rhs) ← matchNe? localDecl.type then

2
tests/lean/run/4851.lean Normal file
View file

@ -0,0 +1,2 @@
theorem T0 (α : Type) (x : α) (H: α → False) : False := by
contradiction