2015-04-28 00:46:13 +00:00
|
|
|
|
infixl `;`:15 := tactic.and_then
|
|
|
|
|
|
2015-04-22 02:33:21 +00:00
|
|
|
|
section
|
2015-02-28 00:39:39 +00:00
|
|
|
|
open tactic
|
|
|
|
|
definition cases_refl (e : expr) : tactic :=
|
2015-03-06 02:07:06 +00:00
|
|
|
|
cases e expr_list.nil; apply rfl
|
2015-02-28 00:39:39 +00:00
|
|
|
|
|
|
|
|
|
definition cases_lst_refl : expr_list → tactic
|
|
|
|
|
| cases_lst_refl expr_list.nil := apply rfl
|
2015-03-06 02:07:06 +00:00
|
|
|
|
| cases_lst_refl (expr_list.cons a l) := cases a expr_list.nil; cases_lst_refl l
|
2015-02-28 00:39:39 +00:00
|
|
|
|
|
|
|
|
|
-- Similar to cases_refl, but make sure the argument is not an arbitrary expression.
|
|
|
|
|
definition eq_rec {A : Type} {a b : A} (e : a = b) : tactic :=
|
2015-03-06 02:07:06 +00:00
|
|
|
|
cases e expr_list.nil; apply rfl
|
2015-02-28 00:39:39 +00:00
|
|
|
|
end
|
|
|
|
|
|
2015-04-28 00:46:13 +00:00
|
|
|
|
tactic_notation `cases_lst` l:(foldr `,` (h t, tactic.expr_list.cons h t) tactic.expr_list.nil) := cases_lst_refl l
|
2015-02-28 00:39:39 +00:00
|
|
|
|
|
|
|
|
|
open prod
|
|
|
|
|
theorem tst₁ (a : nat × nat) : (pr1 a, pr2 a) = a :=
|
|
|
|
|
by cases_refl a
|
|
|
|
|
|
|
|
|
|
theorem tst₂ (a b : nat × nat) (h₁ : pr₁ a = pr₁ b) (h₂ : pr₂ a = pr₂ b) : a = b :=
|
|
|
|
|
by cases_lst a, b, h₁, h₂
|
|
|
|
|
|
|
|
|
|
open nat
|
|
|
|
|
theorem tst₃ (a b : nat) (h : a = b) : a + b = b + a :=
|
|
|
|
|
by eq_rec h
|