Skip to content

Commit cf2b39a

Browse files
committed
Add comments for σ-algebras
1 parent d7a2b53 commit cf2b39a

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/Math/Measures.dfy

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,25 @@ module Measures {
1010

1111
type Probability = x: real | 0.0 <= x <= 1.0
1212

13+
// States that given collection of sets is σ-algebra on the set of values of type `T`.
14+
// In other words, the sample space is `SampleSpace<T>()`, i.e. the set of all values of type `T`,
15+
// and `eventSpace` is the collection of measurable subsets.
16+
ghost predicate IsSigmaAlgebra<T(!new)>(eventSpace: iset<iset<T>>) {
17+
&& (iset{}) in eventSpace
18+
&& (forall e | e in eventSpace :: Complement(e) in eventSpace)
19+
&& (forall f: nat -> iset<T> | (forall n :: f(n) in eventSpace) :: (CountableUnion(f) in eventSpace))
20+
}
21+
22+
// The set of all values of type `T` that are not in the given set.
1323
ghost function Complement<T(!new)>(event: iset<T>): iset<T> {
1424
iset x: T | x !in event
1525
}
1626

27+
// The set of all values of type `T`.
1728
ghost function SampleSpace<T(!new)>(): iset<T> {
1829
Complement(iset{})
1930
}
2031

21-
ghost predicate IsSigmaAlgebra<T(!new)>(eventSpace: iset<iset<T>>) {
22-
&& (iset{}) in eventSpace
23-
&& (forall e | e in eventSpace :: Complement(e) in eventSpace)
24-
&& (forall f: nat -> iset<T> | (forall n :: f(n) in eventSpace) :: (CountableUnion(f) in eventSpace))
25-
}
26-
2732
ghost function CountableUnion<T(!new)>(f: nat -> iset<T>, i: nat := 0): iset<T> {
2833
iset n: nat | n >= i, x <- f(n) :: x
2934
}
@@ -33,6 +38,7 @@ module Measures {
3338
f(i) + CountableSum(f, i+1)
3439
}
3540

41+
// The σ-algebra that contains all subsets.
3642
ghost function DiscreteSigmaAlgebra<A(!new)>(): iset<iset<A>> {
3743
iset _: iset<A>
3844
}

0 commit comments

Comments
 (0)