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

106 lines
2.3 KiB
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.
private axiom test_sorry : {α}, α
set_option trace.Elab.definition.fixedParams true
namespace Ex1
/--
error: well-founded recursion cannot be used, `Ex1.foo` does not take any (non-fixed) arguments
---
trace: [Elab.definition.fixedParams] getFixedParams:
• ⏎
-/
#guard_msgs in
mutual
def foo : Nat := bar
def bar : Nat := foo
decreasing_by exact test_sorry
end
end Ex1
namespace Ex2
/--
error: well-founded recursion cannot be used, `Ex2.foo` does not take any (non-fixed) arguments
---
trace: [Elab.definition.fixedParams] getFixedParams:
• [#1 #1]
• [#1 #1]
-/
#guard_msgs in
mutual
def foo (n : Nat) : Nat := bar n
def bar (n : Nat) : Nat := foo n
decreasing_by exact test_sorry
end
end Ex2
namespace Ex3
/--
error: well-founded recursion cannot be used, `Ex3.foo` does not take any (non-fixed) arguments
---
trace: [Elab.definition.fixedParams] getFixedParams:
• [#1 #2] [#2 #1]
• [#2 #1] [#1 #2]
-/
#guard_msgs in
mutual
def foo (n : Nat) (m : Nat) : Nat := bar m n
decreasing_by all_goals exact test_sorry
def bar (n : Nat) (m : Nat) : Nat := foo m n
decreasing_by all_goals exact test_sorry
end
end Ex3
namespace Ex4
/--
trace: [Elab.definition.fixedParams] getFixedParams: notFixed 0 3:
In foo c n b m
m not matched
[Elab.definition.fixedParams] getFixedParams:
• [#1 #3] ❌ [#3 #1] ❌
• [#3 #1] ❌ [#1 #3] ❌
-/
#guard_msgs in
mutual
def foo (a : Nat) (n : Nat) (d : Nat) (m : Nat) : Nat := bar d m a n
decreasing_by exact test_sorry
def bar (b : Nat) (n : Nat) (c : Nat) (m : Nat) : Nat := foo c n b m
decreasing_by exact test_sorry
end
end Ex4
namespace Append1
/--
trace: [Elab.definition.fixedParams] getFixedParams: notFixed 0 1:
In app as bs
x✝¹ =/= as
[Elab.definition.fixedParams] getFixedParams: notFixed 0 2:
In app as bs
x✝ =/= bs
[Elab.definition.fixedParams] getFixedParams:
• [#1] ❌ ❌
-/
#guard_msgs(trace) in
def app : List α List α List α
| [], bs => bs
| a::as, bs => a :: app as bs
/--
trace: [Elab.definition.fixedParams] getFixedParams: notFixed 0 1:
In app' as bs
as✝ =/= as
[Elab.definition.fixedParams] getFixedParams:
• [#1] ❌ [#3]
-/
#guard_msgs(trace) in
def app' (as : List α) (bs : List α) : List α :=
match as with
| [] => bs
| a::as => a :: app' as bs
end Append1