Package set-fold: A fold operation on finite sets
Information
name | set-fold |
version | 1.42 |
description | A fold operation on finite sets |
author | Joe Leslie-Hurd <joe@gilith.com> |
license | MIT |
requires | bool natural set-finite set-thm |
show | Data.Bool Number.Natural Set |
Files
- Package tarball set-fold-1.42.tgz
- Theory source file set-fold.thy (included in the package tarball)
Defined Constant
- Set
- fold
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
External Type Operators
- →
- bool
- Number
- Natural
- natural
- Natural
- Set
- set
External Constants
- =
- select
- Data
- Bool
- ∀
- ∧
- ⇒
- ∃
- ∃!
- ∨
- ¬
- cond
- ⊥
- ⊤
- Bool
- Number
- Natural
- suc
- zero
- Natural
- Set
- ∅
- delete
- finite
- insert
- ∈
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
⊦ ∀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
⊦ ∀r. (∀x. ∃y. r x y) ⇔ ∃f. ∀x. r x (f 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