2025-01-01 18:53:56 -06:00
|
|
|
false = t
|
2025-01-23 15:46:40 -06:00
|
|
|
_ = t
|
|
|
|
true = t t
|
2025-01-26 08:52:28 -06:00
|
|
|
id = \a : a
|
2025-01-30 17:56:46 -06:00
|
|
|
const = \a b : a
|
2025-01-23 15:46:40 -06:00
|
|
|
pair = t
|
2025-01-26 08:52:28 -06:00
|
|
|
if = \cond then else : t (t else (t t then)) t cond
|
2025-01-23 15:46:40 -06:00
|
|
|
|
2025-01-25 15:12:28 -06:00
|
|
|
y = ((\mut wait fun : wait mut (\x : fun (wait mut x)))
|
|
|
|
(\x : x x)
|
|
|
|
(\a0 a1 a2 : t (t a0) (t t a2) a1))
|
|
|
|
|
2025-01-30 14:19:30 -06:00
|
|
|
compose = \f g x : f (g x)
|
|
|
|
|
2025-01-26 08:52:28 -06:00
|
|
|
triage = \leaf stem fork : t (t leaf stem) fork
|
2025-01-23 15:46:40 -06:00
|
|
|
test = triage "Leaf" (\_ : "Stem") (\_ _ : "Fork")
|
2025-01-20 19:20:29 -06:00
|
|
|
|
2025-01-26 14:50:15 -06:00
|
|
|
matchBool = (\ot of : triage
|
|
|
|
of
|
|
|
|
(\_ : ot)
|
2025-01-20 19:20:29 -06:00
|
|
|
(\_ _ : ot)
|
|
|
|
)
|
|
|
|
|
2025-01-30 17:56:46 -06:00
|
|
|
lAnd = (triage
|
|
|
|
(\_ : false)
|
|
|
|
(\_ x : x)
|
|
|
|
(\_ _ x : x))
|
|
|
|
|
|
|
|
lOr = (triage
|
|
|
|
(\x : x)
|
|
|
|
(\_ _ : true)
|
|
|
|
(\_ _ _ : true))
|
2025-01-20 19:20:29 -06:00
|
|
|
|
2025-01-26 08:52:28 -06:00
|
|
|
matchPair = \a : triage _ _ a
|
2025-01-20 19:20:29 -06:00
|
|
|
|
2025-01-23 15:46:40 -06:00
|
|
|
not? = matchBool false true
|
|
|
|
and? = matchBool id (\_ : false)
|
2025-01-20 19:20:29 -06:00
|
|
|
|
2025-01-30 17:56:46 -06:00
|
|
|
or? = (\x z :
|
2025-01-30 17:17:07 -06:00
|
|
|
matchBool
|
2025-01-30 17:56:46 -06:00
|
|
|
(matchBool true true z)
|
|
|
|
(matchBool true false z)
|
2025-01-30 17:17:07 -06:00
|
|
|
x)
|
|
|
|
|
2025-01-30 17:56:46 -06:00
|
|
|
xor? = (\x z :
|
2025-01-30 17:17:07 -06:00
|
|
|
matchBool
|
2025-01-30 17:56:46 -06:00
|
|
|
(matchBool false true z)
|
|
|
|
(matchBool true false z)
|
2025-01-30 17:17:07 -06:00
|
|
|
x)
|
2025-01-30 14:19:30 -06:00
|
|
|
|
2025-01-26 14:50:15 -06:00
|
|
|
equal? = y (\self : triage
|
|
|
|
(triage
|
|
|
|
true
|
|
|
|
(\_ : false)
|
|
|
|
(\_ _ : false))
|
|
|
|
(\ax :
|
|
|
|
triage
|
|
|
|
false
|
|
|
|
(self ax)
|
|
|
|
(\_ _ : false))
|
|
|
|
(\ax ay :
|
|
|
|
triage
|
|
|
|
false
|
|
|
|
(\_ : false)
|
2025-01-23 15:46:40 -06:00
|
|
|
(\bx by : lAnd (self ax bx) (self ay by))))
|
2025-01-20 19:20:29 -06:00
|
|
|
|
2025-01-30 14:19:30 -06:00
|
|
|
succ = y (\self :
|
|
|
|
triage
|
|
|
|
1
|
|
|
|
t
|
|
|
|
(triage
|
|
|
|
(t (t t))
|
|
|
|
(\_ tail : t t (self tail))
|
|
|
|
t))
|