-
Notifications
You must be signed in to change notification settings - Fork 0
/
lambdaCalculusTools.txt
35 lines (35 loc) · 1.53 KB
/
lambdaCalculusTools.txt
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
0 := lambda f. lambda x. x
1 := lambda f. lambda x. f x
2 := lambda f. lambda x. f f x
3 := lambda f. lambda x. f f f x
4 := lambda f. lambda x. f f f f x
5 := lambda f. lambda x. f f f f f x
### .... Similarly ->
m := lambda f. lambda x. f^m x
SUCC := lambda m. lambda f. lambda x. f (m f x)
PLUS := lambda m, n, f, x. m f n f x
MULT := lambda m, n, f, x. m n f x
TRUE := lambda x, y. x
FALSE := lambda x, y. y
EXP := lambda m, n. m (MULT n) 1
AND := lambda p, q. p q p
OR := lambda p, q. p p q
NOT := lambda p, q. p FALSE TRUE
ISZERO := lambda n. n (lambda x. FALSE) TRUE
PRED := lambda n. n (lambda g. lambda k. ISZERO(g 1) k(PLUS(g k) 1)) (lambda v. 0) 0
IFTHENELSE := lambda p, a, b. p a b
NEGCHECK := lambda m, n. IFTHENELSE ISZERO PLUS m n m FALSE
SUB := lambda m, n. PLUS m NEGCHECK -n n
PRED1 := lambda m. SUB m 1
Y := lambda g. (lambda x.g(x x))(lambda x. g(x x))
### .... Construction of a register here ....CLOCK_ITER := lambda x. IFTHENELSE x FALSE TRUE
CLOCK := (Y CLOCK_ITER) 0
Q1SRNAND := lambda Qp, R, S. IFTHENELSE AND R S Qp NOT S
Q2SRNAND := lambda Qp, R, S. IFTHENELSE AND R S Qp NOT R
QDFLIP := lambda C, D. Q1SRNANA OR NOT C D NOT AND C D
TUPLE_GEN := lambda M1,M2,M3,...,Mn,z. z M1 M2 M3 ... Mn
REG_1 := QDFLIP CLOCK TUPLE_GEN 0100101000111001
NIL := lambda x, y. y
FOREST := lambda f. IFTHENELSE ISZERO SUB f NIL NIL f
ITER_FIND := lambda f, x. IFTHENELSE ISZERO SUB x['parent'] x x x['parent'] = ITER_FIND(x['parent'])
FIND := lambda x. (Y ITER_FIND) x MAKE_SET := lambda x, f. IFTHENELSE FIND x f TUPLE_GEN x 'parent'->x 'rank'->0