Files
Provable-Programming-exercises/chap_3/e3_2.dfy
2026-03-10 13:05:37 +01:00

18 lines
281 B
Plaintext

function M(x: int, b: bool): int
decreases !b
{
if b then x else M(x + 25, true)
}
function N(x: int, y: int, b: bool): int
decreases x, b
{
if x <= 0 || y <= 0 then
x + y
else if b then
N(x, y + 3, !b)
else
N(x - 1, y, true)
}