ch:well-founded-recursion: ch:well-founded-recursion
Problem and result. Implement a Kappa checker whose accepted recursive calls carry a strictly smaller natural measure. The finished corpus accepts the Euclidean trace
Representation. Represent every successful edge by MkDecrease oldMeasure newMeasure. An accepted gcd result carries a list of these certificates; a failed edge carries Nondecreasing oldMeasure newMeasure. A bare Boolean comparison would discard the two measures needed to replay either verdict.
First complete version. Use Kappa’s natural remainder and implement one transition that records the old and new second components only when the latter is smaller. Drive it with structurally decreasing fuel so the Kappa program is independently total, and print the
Remaining cases. Add complete gcd evaluation for
A failing version. Replace the Euclidean recursive call
Acceptance test. Run the four commands in appendix E. Require the four exact PASS lines, the final summary, and the empty audit recorded there.
Mathematical boundary. The program replays the measures in example 82.21. It does not prove accessibility induction, certificate independence, or completeness of any termination checker.