Finished Chapter 4
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user