Package set-fold: A fold operation on finite sets

Information

nameset-fold
version1.29
descriptionA fold operation on finite sets
authorJoe Hurd <joe@gilith.com>
licenseMIT
requiresbool
natural
set-finite
set-thm
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

finite

¬

¬

t. t t

p. p

x. ¬(x )

t. t ¬t

(¬) = λp. p

() = λ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 t

t. t

t. t t

t. t

t. t t

t. t

t. t

t. t t

t. t

n. ¬(suc n = 0)

t. ( t) ¬t

t. (t ) ¬t

t. t ¬t

() = λp q. p q p

t. (t ) (t )

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

t1 t2. (if 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

() = λ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. (x. y. p x y) y. x. p x (y x)

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