2 (** Some examples of mutual recursion and corresponding proofs of
7 (** This example is from the book "Program Proofs" by Rustan Leino *)
9 let rec f1 (n: int) : int
12 = if n = 0 then 0 else f2 n + 1
14 with f2 (n: int) : int
19 (** Hofstadter's Female and Male sequences *)
21 let rec function f (n: int) : int
24 ensures { if n = 0 then result = 1 else 1 <= result <= n }
25 = if n = 0 then 1 else n - m (f (n - 1))
27 with function m (n: int) : int
30 ensures { if n = 0 then result = 0 else 0 <= result < n }
31 = if n = 0 then 0 else n - f (m (n - 1))