-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When `discharge?` failed, the `usedSimps` was being restored, but the cache wasn't. This bug was exposed by issue #3710. This PR makes the following changes: - We restore the `cache` at `discharge?`. We use `SMap` to ensure the operation is efficient. - We don't need the field `dischargeDepth` anymore at `Simp.Result`. - `UsedSimps` should use `PHashMap` since it is not used linearly. closes #3710
- Loading branch information
1 parent
0684c95
commit 9488a71
Showing
6 changed files
with
61 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
def Set := Nat → Prop | ||
|
||
namespace Set | ||
|
||
def singleton (a : Nat) : Set := fun b ↦ b = a | ||
|
||
def compl (s : Set) : Set := fun x ↦ ¬ s x | ||
|
||
@[simp] | ||
theorem compl_iff (s : Set) (x : Nat) : s.compl x ↔ ¬ s x := Iff.rfl | ||
|
||
@[simp] | ||
theorem singleton_iff {a b : Nat} : singleton b a ↔ a = b := Iff.rfl | ||
|
||
open Classical | ||
|
||
noncomputable def indicator (s : Set) (x : Nat) : Nat := if s x then 1 else 0 | ||
|
||
@[simp] -- remove `simp` attribute --> works (and the trace changes) | ||
theorem indicator_of {s : Set} {a : Nat} (h : s a) : indicator s a = 1 := if_pos h | ||
|
||
@[simp] | ||
theorem indicator_of_not {s : Set} {a : Nat} (h : ¬ s a) : indicator s a = 0 := if_neg h | ||
|
||
/-- | ||
info: Try this: simp only [compl_iff, singleton_iff, not_true_eq_false, not_false_eq_true, indicator_of_not] | ||
-/ | ||
#guard_msgs in | ||
theorem test : indicator (compl <| singleton 0) 0 = 0 := by | ||
simp? -- should not leave out `singleton_iff` | ||
|
||
theorem test' : indicator (compl <| singleton 0) 0 = 0 := by | ||
simp only [compl_iff, singleton_iff, not_true_eq_false, not_false_eq_true, indicator_of_not] |