f x = f (g subtermOfX)
Is recursion only allowed if the arg to the function is a direct subterm of the arg passed so that Coq can see that it actually terminates?
f x = f (g subtermOfX)
Is recursion only allowed if the arg to the function is a direct subterm of the arg passed so that Coq can see that it actually terminates?
Copyright © 2021 Jogjafile Inc.
It's possible to write such function
fif functiongpreserves the property of being a subterm.Some of the standard functions have this property, e.g.
pred,sub:On the other hand some (standard) functions do not have this property, but can be rewritten to remedy this deficiency. E.g. the standard
tlfunction does not preserve the subterm property, so the following fails:but if we redefine the tail function like so
we can recover the desired property:
The only difference between
tlandnew_tlis that in the case of empty input listtlreturns[], butnew_tlreturns the original list.