fix: do not split on if-then-else terms when generating equation theorems

Reason: avoid unnecessary case-analysis explosion
It is also unnecessary since we only refine the `below` and `F`
arguments over `match`-expressions.

This fixes the last case at issue #998
```
attribute [simp] BinaryHeap.heapifyDown
```

closes #998
This commit is contained in:
Leonardo de Moura 2022-02-09 17:43:35 -08:00
parent c685a2d9ed
commit 9fe0d28107
4 changed files with 4 additions and 4 deletions

View file

@ -154,7 +154,7 @@ where
go mvarId
else if let some mvarId ← simpMatch? mvarId then
go mvarId
else if let some mvarIds ← splitTarget? mvarId then
else if let some mvarIds ← splitTarget? mvarId (splitIte := false) then
mvarIds.forM go
else
saveEqn mvarId
@ -239,7 +239,7 @@ partial def mkUnfoldProof (declName : Name) (mvarId : MVarId) : MetaM Unit := do
go mvarId
else if let some mvarId ← simpMatch? mvarId then
go mvarId
else if let some mvarIds ← splitTarget? mvarId then
else if let some mvarIds ← splitTarget? mvarId (splitIte := false) then
mvarIds.forM go
else
throwError "failed to generate unfold theorem for '{declName}'\n{MessageData.ofGoal mvarId}"

View file

@ -174,3 +174,5 @@ decreasing_by assumption
attribute [simp] Array.heapSort.loop
#check @Array.heapSort.loop._eq_1
attribute [simp] BinaryHeap.heapifyDown

View file

@ -14,7 +14,6 @@ def g (i j : Nat) : Nat :=
#eval tst ``g
#check g._eq_1
#check g._eq_2
#check g._eq_3
#check g._unfold
def h (i j : Nat) : Nat :=

View file

@ -33,7 +33,6 @@ decreasing_by
#eval tst ``g
#check g._eq_1
#check g._eq_2
#check g._eq_3
#check g._unfold
#eval tst ``h
#check h._eq_1