fix: equation theorem for match with more than one "as" pattern

see #1195
see #1179
This commit is contained in:
Leonardo de Moura 2022-06-10 18:23:13 -07:00
parent 78c57161d8
commit 17db981880
2 changed files with 5 additions and 1 deletions

View file

@ -96,7 +96,8 @@ where
if lhs.isFVar && ys.contains lhs && args.contains lhs && isNamedPatternProof typeNew y then
let some i := ys.getIdx? lhs | unreachable!
let ys := ys.eraseIdx i
let mask := mask.set! i false
let some j := args.getIdx? lhs | unreachable!
let mask := mask.set! j false
let args := args.map fun arg => if arg == lhs then rhs else arg
let args := args.push (← mkEqRefl rhs)
let typeNew := typeNew.replaceFVar lhs rhs

View file

@ -0,0 +1,3 @@
@[simp] def foo: Nat → Nat → Nat
| p1@(t₁ + 1), p2@(t₂ + 1) => foo t₁ t₂
| _, _ => 0