lean4-htt/tests/lean/run/1234.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

78 lines
2.7 KiB
Text

theorem le_of_not_lt {a b : Nat} (_: ¬ a < b): b ≤ a := sorry
theorem lt_of_succ_lt (_: a + 1 < b): a < b := sorry
theorem succ_pred_eq_of_pos (_: 0 < v): v - 1 + 1 = v := sorry
set_option trace.Meta.Tactic.simp true
--set_option trace.Debug.Meta.Tactic.simp true
/--
warning: declaration uses 'sorry'
---
info: [Meta.Tactic.simp.rewrite] h₁:1000, k ≤ v - 1 ==> True
[Meta.Tactic.simp.discharge] @succ_pred_eq_of_pos discharge ✅
0 < v
[Meta.Tactic.simp.rewrite] h₂:1000, 0 < v ==> True
[Meta.Tactic.simp.rewrite] @succ_pred_eq_of_pos:1000, v - 1 + 1 ==> v
[Meta.Tactic.simp.rewrite] @ite_true:1000, if True then ⟨v, ⋯⟩ else ⟨v - 1, ⋯⟩ ==> ⟨v, ⋯⟩
[Meta.Tactic.simp.rewrite] @eq_self:1000, ⟨v, ⋯⟩ = ⟨v, ⋯⟩ ==> True
-/
#guard_msgs in
example (h₁: k ≤ v - 1) (h₂: 0 < v):
(if k ≤ v - 1 then Fin.mk (v-1+1) sorry else Fin.mk (v-1) sorry) = Fin.mk v sorry (n:=n) := by
simp only [
h₁, h₂,
ite_true,
succ_pred_eq_of_pos
----------------
, le_of_not_lt
, lt_of_succ_lt
]
-- it works
/--
warning: declaration uses 'sorry'
---
info: [Meta.Tactic.simp.rewrite] h₁:1000, k ≤ v - 1 ==> True
[Meta.Tactic.simp.discharge] @succ_pred_eq_of_pos discharge ✅
0 < v
[Meta.Tactic.simp.rewrite] h₂:1000, 0 < v ==> True
[Meta.Tactic.simp.rewrite] @succ_pred_eq_of_pos:1000, v - 1 + 1 ==> v
[Meta.Tactic.simp.rewrite] @ite_true:1000, if True then ⟨v, ⋯⟩ else ⟨v - 1, ⋯⟩ ==> ⟨v, ⋯⟩
[Meta.Tactic.simp.rewrite] @eq_self:1000, ⟨v, ⋯⟩ = ⟨v, ⋯⟩ ==> True
-/
#guard_msgs in
example (h₁: k ≤ v - 1) (h₂: 0 < v):
(if k ≤ v - 1 then Fin.mk (v-1+1) sorry else Fin.mk (v-1) sorry) = Fin.mk v sorry (n:=n) := by
simp (config := { memoize := false}) only [
h₁, h₂,
ite_true,
succ_pred_eq_of_pos
----------------
, le_of_not_lt
, lt_of_succ_lt
]
/--
warning: declaration uses 'sorry'
---
info: [Meta.Tactic.simp.rewrite] h₁:1000, k ≤ v - 1 ==> True
[Meta.Tactic.simp.discharge] @succ_pred_eq_of_pos discharge ✅
0 < v
[Meta.Tactic.simp.rewrite] h₂:1000, 0 < v ==> True
[Meta.Tactic.simp.rewrite] @succ_pred_eq_of_pos:1000, v - 1 + 1 ==> v
[Meta.Tactic.simp.rewrite] @ite_true:1000, if True then ⟨v, ⋯⟩ else ⟨v - 1, ⋯⟩ ==> ⟨v, ⋯⟩
[Meta.Tactic.simp.rewrite] @eq_self:1000, ⟨v, ⋯⟩ = ⟨v, ⋯⟩ ==> True
-/
#guard_msgs in
example (h₁: k ≤ v - 1) (h₂: 0 < v):
(if k ≤ v - 1 then Fin.mk (v-1+1) sorry else Fin.mk (v-1) sorry) = Fin.mk v sorry (n:=n) := by
simp only [
h₁, h₂,
ite_true,
succ_pred_eq_of_pos
----------------
--, le_of_not_lt
--, lt_of_succ_lt
]