Files
lean4/tests/elab/fixedParamsStructDeps.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

34 lines
937 B
Lean4
Raw Permalink 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.
/-!
Testing a few more corner cases related to structural mutual recursion, parameters, indices,
dependencies.
-/
def const (x : α) (_ : β) : α := x
private axiom test_sorry : {α}, α
inductive T (p : Nat) : (i : Nat) Type where
| zero : T p i
| succ : T p i T p (i + p) T p i
/--
error: failed to infer structural recursion:
Cannot use parameters #4 of foo and #4 of bar:
its type is an inductive datatype and the datatype parameter
p1
which cannot be fixed as it is an index or depends on an index, and indices cannot be fixed parameters when using structural recursion.
-/
#guard_msgs in
mutual
def foo (i : Nat) (p1 : Nat) (p2 : const Nat i) : T p1 i Unit
| .zero => ()
| .succ t1 _ => bar i p2 p1 t1
termination_by structural t => t
def bar (i : Nat) (p2 : Nat) (p1 : const Nat p2) : T p1 i Unit
| .zero => ()
| .succ t1 _ => foo i p1 p2 t1
termination_by structural t => t
end