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

96 lines
1.9 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.

namespace Ex1
mutual
def f : Nat → ααα
| 0, a, b => a
| n, a, b => g a n b |>.1
termination_by n _ _ => (n, 2)
decreasing_by
simp_wf
apply Prod.Lex.right
decide
def g : α → Nat → α → (α × α)
| a, 0, b => (a, b)
| a, n, b => (h a b n, a)
termination_by _ n _ => (n, 1)
decreasing_by
simp_wf
apply Prod.Lex.right
decide
def h : αα → Nat → α
| _a, b, 0 => b
| a, b, n+1 => f n a b
termination_by _ _ n => (n, 0)
decreasing_by
simp_wf
apply Prod.Lex.left
apply Nat.lt_succ_self
end
#guard f 5 'a' 'b' = 'a'
/--
info: @[irreducible] def Ex1.f.{u_1} : {α : Type u_1} → Nat → ααα :=
fun {α} a a_1 a_2 => f._mutual (PSum.inl ⟨a, ⟨a_1, a_2⟩⟩)
-/
#guard_msgs in
#print f
/--
info: @[irreducible] def Ex1.g.{u_1} : {α : Type u_1} → α → Nat → αα × α :=
fun {α} a a_1 a_2 => f._mutual (PSum.inr (PSum.inl ⟨a, ⟨a_1, a_2⟩⟩))
-/
#guard_msgs in
#print g
/--
info: @[irreducible] def Ex1.h.{u_1} : {α : Type u_1} → αα → Nat → α :=
fun {α} a a_1 a_2 => f._mutual (PSum.inr (PSum.inr ⟨a, ⟨a_1, a_2⟩⟩))
-/
#guard_msgs in
#print h
#print f._mutual
end Ex1
namespace Ex2
mutual
def f : Nat → ααα
| 0, a, b => a
| n, a, b => g a n b |>.1
termination_by n _ _ => (n, 2)
def g : α → Nat → α → (α × α)
| a, 0, b => (a, b)
| a, n, b => (h a b n, a)
termination_by _ n _ => (n, 1)
def h : αα → Nat → α
| a, b, 0 => b
| a, b, n+1 => f n a b
termination_by _ _ n => (n, 0)
end
#print f._mutual
end Ex2
namespace Ex3
mutual
def f : Nat → ααα
| 0, a, b => a
| n, a, b => g a n b |>.1
def g : α → Nat → α → (α × α)
| a, 0, b => (a, b)
| a, n, b => (h a b n, a)
def h : αα → Nat → α
| a, b, 0 => b
| a, b, n+1 => f n a b
end
#print f._mutual
end Ex3