-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArith.fs
100 lines (75 loc) · 3.05 KB
/
Arith.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
module CS220.Arith
/// Please use the builder to construct expressions.
open DeBruijnBuilder
/// True (λ λ 2).
let t: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// False (λ λ 1).
let f: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// If-then-else. (λ λ λ ((3 2) 1))
let ite: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Pair. (λ λ λ ((1 3) 2))
let pair: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Car. (λ (1 λ λ 2))
let fst: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Cdr. (λ (1 λ λ 1))
let snd: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Zero (ル ル 1).
let zero = f (* Zero = False *)
/// Successor (λ λ λ (2 ((3 2) 1))).
let succ: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// IsZero?
let isZero: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Church numeral: One.
let one: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Church numeral: Two.
let two: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Church numeral: Three.
let three: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Church numeral: Four.
let four: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Church numeral: Five.
let five: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Church numeral: Six.
let six: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Church numeral: Seven.
let seven: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Church numeral: Eight.
let eight: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Church numeral: Nine.
let nine: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Addition.
let add: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Predecessor.
let pred: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Subtraction.
let sub: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Convert a Church number to a natural number.
/// val toNatural: DeBruijnExpr -> int
let toNatural (dexpr: DeBruijnExpr) =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Multiplication.
let mul: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code
/// Factorial.
let factorial: DeBruijnExpr =
failwith "IMPLEMENT" // REMOVE this line when you implement your own code