Package sum: Sum types

Information

namesum
version1.61
descriptionSum types
authorJoe Leslie-Hurd <joe@gilith.com>
licenseMIT
checksumb308349b08d4b77294d83a789a1ecb56a7359c44
requiresbool
natural
pair
showData.Bool
Data.Pair
Data.Sum
Number.Natural

Files

Defined Type Operator

Defined Constants

Theorems

a. isLeft (left a)

b. isRight (right b)

a. ¬isRight (left a)

b. ¬isLeft (right b)

a. destLeft (left a) = a

b. destRight (right b) = b

x. case left right x = x

a b. ¬(left a = right b)

a b. left a = left b a = b

a b. right a = right b a = b

f g a. case f g (left a) = f a

f g b. case f g (right b) = g b

x. (a. x = left a) b. x = right b

f g x. isLeft x case f g x = f (destLeft x)

f g x. isRight x case f g x = g (destRight x)

p. (a. p (left a)) (b. p (right b)) x. p x

f g. fn. (a. fn (left a) = f a) b. fn (right b) = g b

External Type Operators

External Constants

Assumptions

¬

¬

bit0 0 = 0

t. t t

n. 0 n

p. p

(¬) = λp. p

() = λp. p ((select) p)

a. ∃!x. x = a

t. (x. t) t

t. (x. t) t

t. (λx. t x) = t

() = λp. p = λx.

t. ¬¬t t

t. ( t) t

t. (t ) t

t. t

t. t t

t. t t

t. t

t. t t

t. t

t. t t

t. t

t. t t

n. ¬(suc n = 0)

n. 0 + n = n

t. ( t) ¬t

t. (t ) ¬t

t. t ¬t

n. even (2 * n)

n. bit1 n = suc (bit0 n)

m. m 0 = 1

() = λp q. p q p

t. (t ) (t )

n. even (suc n) ¬even n

m. m 0 m = 0

t1 t2. (if then t1 else t2) = t2

t1 t2. (if then t1 else t2) = t1

a b. fst (a, b) = a

a b. snd (a, b) = b

n. bit0 (suc n) = suc (suc (bit0 n))

f y. (let x y in f x) = f y

x y. x = y y = x

t1 t2. t1 t2 t2 t1

m n. m + n = n + m

n. 2 * n = n + n

m n. ¬(m < n n m)

m n. ¬(m n n < m)

m n. ¬(m n) n < m

m n. suc m n m < n

() = λp q. (λf. f p q) = λf. f

p. ¬(x. p x) x. ¬p x

() = λp. q. (x. p x q) q

m n. m + suc n = suc (m + n)

m n. suc m + n = suc (m + n)

m n. suc m = suc n m = n

t1 t2. ¬(t1 t2) ¬t1 ¬t2

m n. even (m * n) even m even n

m n. even (m + n) even m even n

m n. m suc n = m * m n

f g. (x. f x = g x) f = g

p a. (x. a = x p x) p a

() = λp q. r. (p r) (q r) r

m n. m n m < n m = n

m n. m n n m m = n

m n. m < n d. n = m + suc d

p q. (x. p q x) p x. q x

t1 t2 t3. (t1 t2) t3 t1 t2 t3

m n p. m * (n * p) = m * n * p

p m n. m + p = n + p m = n

p x. (y. p y y = x) (select) p = x

r. (x. y. r x y) f. x. r x (f x)

m n. m suc n m = suc n m n

m n. m * n = 0 m = 0 n = 0

p. p 0 (n. p n p (suc n)) n. p n

m n. m n = 0 m = 0 ¬(n = 0)

(∃!) = λp. () p x y. p x p y x = y

p q. (x. p x q x) (x. p x) x. q x

p q. (x. p x q x) (x. p x) x. q x

p q. (x. p x q x) (x. p x) x. q x

p q. (x. p x) (x. q x) x. p x q x

e f. ∃!fn. fn 0 = e n. fn (suc n) = f (fn n) n

m n p. m * n = m * p m = 0 n = p

m n p. m * n m * p m = 0 n p

m n p. m * n < m * p ¬(m = 0) n < p

p1 p2 q1 q2. (p1 p2) (q1 q2) p1 q1 p2 q2

p1 p2 q1 q2. (p1 p2) (q1 q2) p1 q1 p2 q2

p. (x. ∃!y. p x y) f. x y. p x y f x = y

p c x y. p (if c then x else y) (c p x) (¬c p y)

p. (∃!x. p x) (x. p x) x x'. p x p x' x = x'