by showing the matrix of calls and measures, and what we know about that
call (=, <, ≤, ?), e.g.
guessLexFailures.lean:27:0-33:31: error: Could not find a decreasing
measure.
The arguments relate at each recursive call as follows:
(<, ≤, =: relation proved, ? all proofs failed, _: no proof attempted)
x1 x2 x3
1) 29:6-25 = = =
2) 30:6-23 = ? <
3) 31:6-23 < _ _
Please use `termination_by` to specify a decreasing measure
It’s a bit more verbose for mutual functions.
It will use the user-specified argument names for functions written
```
foo (n : Nat) := …
```
but not with pattern matching like
```
foo : Nat → …
| n => …
```
This can be refined later and separately (and maybe right away in
`expandMatchAltsWhereDecls`).
38 lines
1 KiB
Text
38 lines
1 KiB
Text
terminationFailure.lean:7:2-7:3: error: fail to show termination for
|
|
f.g
|
|
f
|
|
with errors
|
|
structural recursion does not handle mutually recursive functions
|
|
|
|
Could not find a decreasing measure.
|
|
The arguments relate at each recursive call as follows:
|
|
(<, ≤, =: relation proved, ? all proofs failed, _: no proof attempted)
|
|
Call from f.g to f at 9:9-12:
|
|
x1
|
|
x =
|
|
Call from f to f.g at 3:4-7:
|
|
x
|
|
x1 =
|
|
|
|
Please use `termination_by` to specify a decreasing measure.
|
|
f (x : Nat) : Nat
|
|
f.g (a✝ : Nat) : Nat
|
|
1
|
|
2
|
|
terminationFailure.lean:24:9-24:12: error: fail to show termination for
|
|
h
|
|
with errors
|
|
argument #1 was not used for structural recursion
|
|
failed to eliminate recursive application
|
|
h x
|
|
|
|
structural recursion cannot be used
|
|
|
|
failed to prove termination, possible solutions:
|
|
- Use `have`-expressions to prove the remaining goals
|
|
- Use `termination_by` to specify a different well-founded relation
|
|
- Use `decreasing_by` to specify your own tactic for discharging this kind of goal
|
|
x : Nat
|
|
⊢ False
|
|
h (x : Nat) : Foo
|
|
Foo.a
|