-
Notifications
You must be signed in to change notification settings - Fork 10
/
timing.lam
26 lines (26 loc) · 862 Bytes
/
timing.lam
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
let False = \f.\t.f;
True = \f.\t.t;
if = \b.\t.\f.b f t;
Zero = \z.\s.z;
Succ = \n.\z.\s.s n;
one = Succ Zero;
two = Succ one;
three = Succ two;
isZero = \n.n True (\m.False);
const = \x.\y.x;
Pair = \a.\b.\p.p a b;
fst = \ab.ab (\a.\b.a);
snd = \ab.ab (\a.\b.b);
fix = \ g. (\ x. g (x x)) (\ x. g (x x));
add = fix (\radd.\x.\y. x y (\ n. Succ (radd n y)));
mul = fix (\rmul.\x.\y. x Zero (\ n. add y (rmul n y)));
fac = fix (\rfac.\x. x one (\ n. mul x (rfac n)));
eqnat = fix (\reqnat.\x.\y. x (y True (const False)) (\x1.y False (\y1.reqnat x1 y1)));
sumto = fix (\rsumto.\x. x Zero (\n.add x (rsumto n)));
n5 = add two three;
n6 = add three three;
n17 = add n6 (add n6 n5);
n37 = Succ (mul n6 n6);
n703 = sumto n37;
n720 = fac n6
in eqnat n720 (add n703 n17)