lean4-htt/tests/lean/run/allGoals.lean
2021-03-12 17:48:33 -08:00

63 lines
1.6 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

inductive Weekday where
| sunday : Weekday
| monday : Weekday
| tuesday : Weekday
| wednesday : Weekday
| thursday : Weekday
| friday : Weekday
| saturday : Weekday
def Weekday.next : Weekday -> Weekday :=
fun d => match d with
| sunday => monday
| monday => tuesday
| tuesday => wednesday
| wednesday => thursday
| thursday => friday
| friday => saturday
| saturday => sunday
def Weekday.previous : Weekday -> Weekday
| sunday => saturday
| monday => sunday
| tuesday => monday
| wednesday => tuesday
| thursday => wednesday
| friday => thursday
| saturday => friday
theorem Weekday.nextOfPrevious (d : Weekday) : next (previous d) = d := by
cases d
allGoals rfl
theorem Weekday.nextOfPrevious' (d : Weekday) : previous (next d) = d ∧ next (previous d) = d := by
apply And.intro
cases d <;> rfl
cases d <;> rfl
theorem Weekday.nextOfPrevious'' (d : Weekday) : previous (next d) = d ∧ next (previous d) = d := by
apply And.intro <;> cases d <;> rfl
open Lean.Parser.Tactic in
macro "rwd " x:term : tactic => `(rw $x:term; done)
theorem ex (a b c : α) (h₁ : a = b) (h₂ : a = c) : b = a ∧ c = a := by
apply And.intro <;> first rwd h₁ | rwd h₂
theorem idEq (a : α) : id a = a :=
rfl
theorem Weekday.test (d : Weekday) : next (previous d) = id d := by
cases d
traceState
allGoals rw idEq
traceState
allGoals rfl
theorem Weekday.test2 (d : Weekday) : next (previous d) = id d := by
cases d <;> rw idEq
traceState
allGoals rfl
def bug {a b c : Nat} (h₁ : a = b) (h₂ : b = c) : a = c := by
apply Eq.trans <;> assumption