| 
21341
 | 
     1  | 
structure HOL = 
  | 
| 
 | 
     2  | 
struct
  | 
| 
 | 
     3  | 
  | 
| 
24421
 | 
     4  | 
datatype boola = False | True;
  | 
| 
21341
 | 
     5  | 
  | 
| 
23107
 | 
     6  | 
fun anda x True = x
  | 
| 
 | 
     7  | 
  | anda x False = False
  | 
| 
 | 
     8  | 
  | anda True x = x
  | 
| 
 | 
     9  | 
  | anda False x = False;
  | 
| 
21341
 | 
    10  | 
  | 
| 
 | 
    11  | 
end; (*struct HOL*)
  | 
| 
 | 
    12  | 
  | 
| 
 | 
    13  | 
structure Nat = 
  | 
| 
 | 
    14  | 
struct
  | 
| 
 | 
    15  | 
  | 
| 
24421
 | 
    16  | 
datatype nat = Suc of nat | Zero_nat;
  | 
| 
21341
 | 
    17  | 
  | 
| 
26318
 | 
    18  | 
fun less_nat m (Suc n) = less_eq_nat m n
  | 
| 
21994
 | 
    19  | 
  | less_nat n Zero_nat = HOL.False
  | 
| 
26318
 | 
    20  | 
and less_eq_nat (Suc m) n = less_nat m n
  | 
| 
 | 
    21  | 
  | less_eq_nat Zero_nat n = HOL.True;
  | 
| 
21341
 | 
    22  | 
  | 
| 
 | 
    23  | 
end; (*struct Nat*)
  | 
| 
 | 
    24  | 
  | 
| 
 | 
    25  | 
structure Codegen = 
  | 
| 
 | 
    26  | 
struct
  | 
| 
 | 
    27  | 
  | 
| 
 | 
    28  | 
fun in_interval (k, l) n =
  | 
| 
23107
 | 
    29  | 
  HOL.anda (Nat.less_eq_nat k n) (Nat.less_eq_nat n l);
  | 
| 
21341
 | 
    30  | 
  | 
| 
 | 
    31  | 
end; (*struct Codegen*)
  |