mirror of
https://github.com/leanprover/lean4.git
synced 2026-03-17 18:34:06 +00:00
This PR sets up the new integrated test/bench suite. It then migrates all benchmarks and some related tests to the new suite. There's also some documentation and some linting. For now, a lot of the old tests are left alone so this PR doesn't become even larger than it already is. Eventually, all tests should be migrated to the new suite though so there isn't a confusing mix of two systems.
42 lines
1009 B
Lean4
42 lines
1009 B
Lean4
namespace Ex1
|
||
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
|
||
|
||
/--
|
||
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
|
||
|
||
#guard f 5 'a' 'b' == 'a'
|
||
end Ex1
|