Package set-fold: A fold operation on finite sets

Information

nameset-fold
version1.20
descriptionA fold operation on finite sets
authorJoe Hurd <joe@gilith.com>
licenseMIT
requiresbool
natural
set-thm
set-finite
showData.Bool
Number.Natural
Set

Files

Defined Constant

Theorems

f b.
    (x y s. ¬(x = y) f x (f y s) = f y (f x s))
    fold f b = b
    x s.
      finite s
      fold f b (insert x s) =
      if x s then fold f b s else f x (fold f b s)

f b.
    (x y s. ¬(x = y) f x (f y s) = f y (f x s))
    fold f b = b
    x s.
      finite s
      fold f b s =
      if x s then f x (fold f b (delete s x)) else fold f b (delete s x)

f g b s.
    finite s (x. x s f x = g x)
    (x y s. ¬(x = y) f x (f y s) = f y (f x s))
    (x y s. ¬(x = y) g x (g y s) = g y (g x s))
    fold f b s = fold g b s

Input Type Operators

Input Constants

Assumptions

T

finite

¬F T

¬T F

t. t t

F p. p

x. ¬(x )

t. t ¬t

(¬) = λp. p F

() = λP. P ((select) P)

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. F t F

t. T t t

t. t F F

t. t T t

t. F t T

t. T t t

t. t T T

t. T t T

t. t F t

t. t T T

n. ¬(suc n = 0)

t. (F t) ¬t

t. (t F) ¬t

t. t F ¬t

() = λp q. p q p

t. (t T) (t F)

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

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

p x. p x p ((select) p)

x y. x = y y = x

t1 t2. t1 t2 t2 t1

s x. finite s finite (delete s x)

s x. finite (delete s x) finite s

s x. finite (insert x s) finite s

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

() = λP. q. (x. P x q) q

x s. x s insert x s = s

m n. suc m = suc n m = n

x s. delete s x = s ¬(x s)

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

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

x s. x s insert x (delete s x) = s

P. (x y. P x y) y x. P x y

x s. delete (insert x s) x = s ¬(x s)

P Q. (x. P Q x) P x. Q x

P Q. (x. P x) Q x. P x Q

x y s. delete (delete s x) y = delete (delete s y) x

p q r. p q r p q r

s t. (x. x s x t) s = t

P. P 0 (n. P n P (suc n)) n. P n

x y s. x insert y s x = y x s

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

s x y. x delete s y x s ¬(x = y)

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

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

P.
    P (x s. P s ¬(x s) finite s P (insert x s))
    s. finite s P s