lean4-htt/tests/lean/run/allGoals.lean
Kim Morrison 3a457e6ad6
chore: use #guard_msgs in run tests (#4175)
Many of our tests in `tests/lean/run/` produce output from `#eval` (or
`#check`) statements, that is then ignored.

This PR tries to capture all the useful output using `#guard_msgs`. I've
only done a cursory check that the output is still sane --- there is a
chance that some "unchecked" tests have already accumulated regressions
and this just cements them!

In the other direction, I did identify two rotten tests:
* a minor one in `setStructInstNotation.lean`, where a comment says `Set
Nat`, but `#check` actually prints `?_`. Weird?
* `CompilerProbe.lean` is generating empty output, apparently indicating
that something is broken, but I don't know the signficance of this file.

In any case, I'll ask about these elsewhere.

(This started by noticing that a recent `grind` test file had an
untested `trace_state`, and then got carried away.)
2024-05-16 00:38:31 +00:00

130 lines
3.1 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
all_goals 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 => `(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
/--
info: case sunday
⊢ Weekday.sunday.previous.next = id Weekday.sunday
case monday
⊢ Weekday.monday.previous.next = id Weekday.monday
case tuesday
⊢ Weekday.tuesday.previous.next = id Weekday.tuesday
case wednesday
⊢ Weekday.wednesday.previous.next = id Weekday.wednesday
case thursday
⊢ Weekday.thursday.previous.next = id Weekday.thursday
case friday
⊢ Weekday.friday.previous.next = id Weekday.friday
case saturday
⊢ Weekday.saturday.previous.next = id Weekday.saturday
---
info: case sunday
⊢ Weekday.sunday.previous.next = Weekday.sunday
case monday
⊢ Weekday.monday.previous.next = Weekday.monday
case tuesday
⊢ Weekday.tuesday.previous.next = Weekday.tuesday
case wednesday
⊢ Weekday.wednesday.previous.next = Weekday.wednesday
case thursday
⊢ Weekday.thursday.previous.next = Weekday.thursday
case friday
⊢ Weekday.friday.previous.next = Weekday.friday
case saturday
⊢ Weekday.saturday.previous.next = Weekday.saturday
-/
#guard_msgs in
theorem Weekday.test (d : Weekday) : next (previous d) = id d := by
cases d
trace_state
all_goals rw [idEq]
trace_state
all_goals rfl
/--
info: case sunday
⊢ Weekday.sunday.previous.next = Weekday.sunday
case monday
⊢ Weekday.monday.previous.next = Weekday.monday
case tuesday
⊢ Weekday.tuesday.previous.next = Weekday.tuesday
case wednesday
⊢ Weekday.wednesday.previous.next = Weekday.wednesday
case thursday
⊢ Weekday.thursday.previous.next = Weekday.thursday
case friday
⊢ Weekday.friday.previous.next = Weekday.friday
case saturday
⊢ Weekday.saturday.previous.next = Weekday.saturday
-/
#guard_msgs in
theorem Weekday.test2 (d : Weekday) : next (previous d) = id d := by
cases d <;> rw [idEq]
trace_state
all_goals rfl
def bug {a b c : Nat} (h₁ : a = b) (h₂ : b = c) : a = c := by
apply Eq.trans <;> assumption