Given this:
dataprop R(i:int) =
| R1(1)
| {i > 1} RN(i) of R(i-1)
One may have this:
prfun f {i:int; i >= 1} .<i>. (pf:R(i)): int =
case+ pf of
| R1() => 1
| RN(pf':R(i-1)) => f(pf') + 1
However, given this:
dataprop R =
| R1
| RN of R
One can't have this:
prfun f .<>. (pf:R): int =
case+ pf of
| R1() => 1
| RN(pf') => f(pf') + 1
Is there a way to have a termination metric for this?
I feel to guess the answer is likely “no”, and I feel to know why: Isabelle/HOL, has something looking like `dataprop` which is checked to be inductive (based on a well founded recursion). ATS does not check it (it has general recursive definitions, not checked to be inductive definitions), so that may be the reason why it can't handle such a case without an explicit index.
While I feel to guess the answer, I prefer to ask, in case of I just missed something. If the answer is “yes”, then that would be nice as more natural.