-
Notifications
You must be signed in to change notification settings - Fork 449
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ematch theorem activation for
grind
(#6475)
This PR adds support for activating relevant theorems for the (WIP) `grind` tactic. We say a theorem is relevant to a `grind` goal if the symbols occurring in its patterns also occur in the goal.
- Loading branch information
1 parent
24a8561
commit 9b28c58
Showing
7 changed files
with
99 additions
and
15 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
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,39 @@ | ||
def Set (α : Type) := α → Bool | ||
|
||
def insertElem [DecidableEq α] (s : Set α) (a : α) : Set α := | ||
fun x => a = x || s x | ||
|
||
def contains (s : Set α) (a : α) : Bool := | ||
s a | ||
|
||
theorem contains_insert [DecidableEq α] (s : Set α) (a : α) : contains (insertElem s a) a := by | ||
simp [contains, insertElem] | ||
|
||
grind_pattern contains_insert => contains (insertElem s a) a | ||
|
||
-- TheoremPattern activation test | ||
|
||
set_option trace.grind.pattern true | ||
|
||
/-- | ||
warning: declaration uses 'sorry' | ||
--- | ||
info: [grind.pattern] activated `contains_insert` | ||
-/ | ||
#guard_msgs in | ||
example [DecidableEq α] (s₁ s₂ : Set α) (a₁ a₂ : α) : | ||
s₂ = insertElem s₁ a₁ → a₁ = a₂ → contains s₂ a₂ := by | ||
fail_if_success grind | ||
sorry | ||
|
||
/-- | ||
warning: declaration uses 'sorry' | ||
--- | ||
info: [grind.pattern] reinsert `contains_insert` | ||
[grind.pattern] activated `contains_insert` | ||
-/ | ||
#guard_msgs in | ||
example [DecidableEq α] (s₁ s₂ : Set α) (a₁ a₂ : α) : | ||
¬ contains s₂ a₂ → s₂ = insertElem s₁ a₁ → a₁ = a₂ → False := by | ||
fail_if_success grind | ||
sorry |