-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR enhances the `cases` tactic used in the `grind` tactic and ensures that it can be applied to arbitrary expressions.
- Loading branch information
1 parent
10b2f6b
commit 7b496bf
Showing
4 changed files
with
109 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import Lean | ||
|
||
open Lean Meta Grind Elab Tactic in | ||
elab "cases' " e:term : tactic => withMainContext do | ||
let e ← elabTerm e none | ||
setGoals (← Grind.cases (← getMainGoal) e) | ||
|
||
inductive Vec (α : Type u) : Nat → Type u | ||
| nil : Vec α 0 | ||
| cons : α → Vec α n → Vec α (n+1) | ||
|
||
def f (v : Vec α n) : Bool := | ||
match v with | ||
| .nil => true | ||
| .cons .. => false | ||
|
||
/-- | ||
info: n : Nat | ||
v : Vec Nat n | ||
h : f v ≠ false | ||
⊢ n + 1 = 0 → HEq (Vec.cons 10 v) Vec.nil → False | ||
--- | ||
info: n : Nat | ||
v : Vec Nat n | ||
h : f v ≠ false | ||
⊢ ∀ {n_1 : Nat} (a : Nat) (a_1 : Vec Nat n_1), n + 1 = n_1 + 1 → HEq (Vec.cons 10 v) (Vec.cons a a_1) → False | ||
-/ | ||
#guard_msgs (info) in | ||
example (v : Vec Nat n) (h : f v ≠ false) : False := by | ||
cases' (Vec.cons 10 v) | ||
next => trace_state; sorry | ||
next => trace_state; sorry | ||
|
||
/-- | ||
info: ⊢ False → False | ||
--- | ||
info: ⊢ True → False | ||
-/ | ||
#guard_msgs (info) in | ||
example : False := by | ||
cases' (Or.inr (a := False) True.intro) | ||
next => trace_state; sorry | ||
next => trace_state; sorry |