This PR modifies `elabTerminationByHints` in a way that the type of the recursive function used for elaboration of the termination measure is striped of from optional parameters. It prevents introducing dependencies between the default values for arguments, that can cause the termination checker to fail. Closes https://github.com/leanprover/lean4/issues/6351.
9 lines
290 B
Text
9 lines
290 B
Text
-- This used to cause
|
|
-- error: The termination argument's type must not depend on the function's varying parameters
|
|
|
|
def foo (as : Array Nat) (i := 0) (j := as.size - 1) : Array Nat :=
|
|
if j ≤ i then as
|
|
else
|
|
let newas := as.set! 0 0
|
|
foo newas (i+1) (j-1)
|
|
termination_by j - i
|