Package probability: Probability
Information
name | probability |
version | 1.22 |
description | Probability |
author | Joe Hurd <joe@gilith.com> |
license | MIT |
requires | bool list natural pair relation |
show | Data.Bool Data.List Data.Pair Data.Stream Number.Natural Probability.Random |
Files
- Package tarball probability-1.22.tgz
- Theory file probability.thy (included in the package tarball)
Defined Type Operator
- Probability
- Random
- random
- Random
Defined Constants
- Data
- List
- fromRandom
- Geometric
- Geometric.fromRandom
- List
- Number
- Natural
- Geometric
- Geometric.fromRandom
- Geometric.fromRandom.loop
- Geometric.fromRandom
- Geometric
- Natural
- Probability
- Random
- bit
- bits
- fromStream
- split
- toStream
- Random
Theorems
⊦ bits = fromRandom bit
⊦ ∀r. fromStream (toStream r) = r
⊦ ∀s. toStream (fromStream s) = s
⊦ ∀n r. length (fst (bits n r)) = n
⊦ ∀d r. fromRandom d 0 r = ([], r)
⊦ ∀r. bit r = (head (toStream r), fromStream (tail (toStream r)))
⊦ ∀d n r. length (fst (fromRandom d n r)) = n
⊦ ∀r.
Geometric.fromRandom r =
let (r1, r2) ← split r in (Geometric.fromRandom.loop 0 r1, r2)
⊦ ∀r.
split r =
let (s1, s2) ← split (toStream r) in (fromStream s1, fromStream s2)
⊦ ∀d r.
Geometric.fromRandom d r =
let (n, r') ← Geometric.fromRandom r in fromRandom d n r'
⊦ ∀n r.
Geometric.fromRandom.loop n r =
let (b, r') ← bit r in
if b then n else Geometric.fromRandom.loop (suc n) r'
⊦ ∀d r n.
fromRandom d (suc n) r =
let (h, r') ← d r in let (t, r'') ← fromRandom d n r' in (h :: t, r'')
Input Type Operators
- →
- bool
- Data
- List
- list
- Pair
- ×
- Stream
- stream
- List
- Number
- Natural
- natural
- Natural
Input Constants
- =
- select
- Data
- Bool
- ∀
- ∧
- ⇒
- ∃
- ∃!
- ∨
- ¬
- cond
- ⊥
- ⊤
- List
- ::
- []
- length
- Pair
- ,
- fst
- Stream
- head
- split
- tail
- Bool
- Number
- Natural
- suc
- zero
- Natural
Assumptions
⊦ ⊤
⊦ ¬⊥ ⇔ ⊤
⊦ ¬⊤ ⇔ ⊥
⊦ length [] = 0
⊦ ∀t. t ⇒ t
⊦ (∃) = λ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 ⇒ ⊤ ⇔ ⊤
⊦ (⇒) = λp q. p ∧ q ⇔ p
⊦ ∀t. (t ⇔ ⊤) ∨ (t ⇔ ⊥)
⊦ ∀t1 t2. (if ⊥ then t1 else t2) = t2
⊦ ∀t1 t2. (if ⊤ then t1 else t2) = t1
⊦ ∀x y. fst (x, y) = x
⊦ ∀p x. p x ⇒ p ((select) p)
⊦ ∀xy. ∃x y. xy = (x, y)
⊦ ∀h t. length (h :: t) = suc (length t)
⊦ (∧) = λp q. (λf. f p q) = λf. f ⊤ ⊤
⊦ (∃) = λp. ∀q. (∀x. p x ⇒ q) ⇒ q
⊦ ∀m n. suc m = suc n ⇔ m = n
⊦ (∨) = λp q. ∀r. (p ⇒ r) ⇒ (q ⇒ r) ⇒ r
⊦ ∀f. ∃fn. ∀x y. fn (x, y) = f x y
⊦ ∀p. (∀x. ∃y. p x y) ⇔ ∃y. ∀x. p x (y x)
⊦ ∀p. p 0 ∧ (∀n. p n ⇒ p (suc n)) ⇒ ∀n. p n
⊦ (∃!) = λp. (∃) p ∧ ∀x y. p x ∧ p y ⇒ x = y
⊦ ∀p g h. ∃f. ∀x. f x = if p x then f (g x) else h x
⊦ ∀e f. ∃!fn. fn 0 = e ∧ ∀n. fn (suc n) = f (fn n) n