lean4-htt/tests/elab/issue2628.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
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.
2026-02-25 13:51:53 +00:00

116 lines
2.3 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.

/-!
Test that PackMutual isn't confused when a recursive call has more arguments than is packed
into the unary argument, which can happen if the retturn type is a function type.
-/
namespace Ex1
mutual
def foo : Nat → Nat
| .zero => 0
| .succ n => (id bar) n
decreasing_by sorry
def bar : Nat → Nat
| .zero => 0
| .succ n => foo n
decreasing_by sorry
end
end Ex1
-- Same for n-ary functions
opaque id' : ∀ {α}, αα := id
namespace Ex2
mutual
def foo : Nat → Nat → Nat
| .zero, _m => 0
| .succ n, .zero => (id' (bar n)) .zero
| .succ n, m => (id' bar) n m
termination_by n m => (n,m)
decreasing_by all_goals sorry
def bar : Nat → Nat → Nat
| .zero, _m => 0
| .succ n, m => foo n m
termination_by n m => (n,m)
decreasing_by all_goals sorry
end
end Ex2
-- With extra arguments
namespace Ex3
mutual
def foo : Nat → Nat → Nat
| .zero => fun _ => 0
| .succ n => fun m => (id bar) n m
decreasing_by all_goals sorry
def bar : Nat → Nat → Nat
| .zero => fun _ => 0
| .succ n => fun m => foo n m
decreasing_by all_goals sorry
end
end Ex3
-- n-ary and with extra arguments
namespace Ex4
mutual
def foo : Nat → Nat → Nat → Nat
| .zero, _m => fun _ => 0
| .succ n, .zero => fun k => (id' (bar n)) .zero k
| .succ n, m => fun k => (id' bar) n m k
termination_by n m => (n,m)
decreasing_by all_goals sorry
def bar : Nat → Nat → Nat → Nat
| .zero, _m => fun _ => 0
| .succ n, m => fun k => foo n m k
termination_by n m => (n,m)
decreasing_by all_goals sorry
end
end Ex4
-- Check that eta-expansion works even if the function does not
-- have a function type
namespace Ex5
def FunType := Nat → Nat
mutual
def foo : FunType
| .zero => 0
| .succ n => (id bar) n
decreasing_by all_goals sorry
def bar : Nat → Nat
| .zero => 0
| .succ n => foo n
decreasing_by all_goals sorry
end
end Ex5
namespace Ex6
def Fun3Type := Nat → Nat → Nat
mutual
def foo : Nat → Nat → Nat → Nat
| .zero, _m => fun _ => 0
| .succ n, .zero => fun k => (id' (bar n)) .zero k
| .succ n, m => fun k => (id' bar) n m k
termination_by n m => (n,m)
decreasing_by all_goals sorry
def bar : Nat → Fun3Type
| .zero, _m => fun _ => 0
| .succ n, m => fun k => foo n m k
termination_by n m => (n,m)
decreasing_by all_goals sorry
end
end Ex6