--verdict: two mutually recursive type-level defs that pass a kept parameter are rejected as "calls that descend"
What you did
bend kept.bend && bend kept.bend --verdictWhat happened
$ bend kept.bend
ALL PROOFS CHECK
Use --verdict for mathematical validity.
$ bend kept.bend --verdict
SOME PROOFS FAIL
Sorry - this is a mismatch between the TypeScript implementation, and the formalized BendTT kernel. [...]
$ bend kept.bend -o kept.bendtt && bendtt kept.bendtt # kernel built by --verdict for 2.0.34
SOME PROOFS FAIL
In A.group:
affine live code, calls that descendWith -c instead of +c in both defs (the parameter erased), both commands
print ALL PROOFS CHECK. With +c kept but moved to the last position
(B(f: Nat, +c: Nat), A(e: Nat, f: Nat, +c: Nat)), both commands also print
ALL PROOFS CHECK. The kernel built from PR #1173 (the fix for #1167) still
rejects kept.bend.
The file
import Base
def B(+c: Nat, f: Nat) -> Type:
match f:
case 0n: Empty
case 1n+g: {c == c : Nat} & A(c, 1n, g)
def A(+c: Nat, e: Nat, f: Nat) -> Type:
match e:
case 0n: Unit
case 1n+p: B(c, f)A matches e and passes f unchanged to B; B matches f and calls
A back on its smaller part g. Every cycle descends on f. The kept
parameter c is passed unchanged in both calls.
WONTFIX.txt says the termination check reads arguments left to right (#770):
an argument before the decreasing one must pass through unchanged. Here c
does pass through unchanged, and the same group is accepted when c is
erased or moved after f, so the rejection seems to come from the kept
leading parameter alone.
We met it on a relation that states that an unfolding of an expression is
faithful: ten mutually recursive -> Type defs that carry the catalogue
they read (+catalogue). Erasing that parameter lets the kernel accept them.
bend --version
bend 2.0.34
uname -sm
Darwin arm64
clang --version (the first line)
Apple clang version 21.0.0 (clang-2100.3.34.2)
Source: HigherOrderCO/Bend