summaryrefslogtreecommitdiff
path: root/src/utils/lambdas.ts
blob: ef6b3998fbc587bc1cab5b22828a4942ab030327 (plain)
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
const succ = "(λ n.(λ f.(λ x.(f ((n f) x)))))";
const zero = "(λ g.(λ y.y))";
const one = "(λ g.(λ y.(g y)))";
const two = "(λ g.(λ y.(g (g y))))";
const three = "(λ g.(λ y.(g (g (g y)))))";
const four = "(λ g.(λ y.(g (g (g (g y))))))";
const five = "(λ g.(λ y.(g (g (g (g (g y)))))))";
const mult = "(λ m.(λ n.(λ f.(m (n f)))))";
const trueL = "(λ a.(λ b.a))";
const falseL = "(λ a.(λ b.b))";
const ifL = "(λ b.(λ n.(λ m.((b n) m))))";
const iszero = "(λ num.((num (λ x.false)) true))";
const not = "(λ b.((b false) true))";
const and = "(λ b.(λ c.((b c) false)))";
const or = "(λ b.(λ c.((b true) c)))";
const Y = "(λ h.((λ z.(h (z z))) (λ z.(h (z z)))))";

export const baseDefinitions = {
  iszero,
  succ,
  zero,
  one,
  two,
  three,
  four,
  five,
  mult,
  true: trueL,
  false: falseL,
  if: ifL,
  not,
  and,
  or,
  Y,
};