Sets
Unless otherwise specified, you may use Python lists to represent sets.
Given a set \(A\), the powerset of \(A\), denoted by \(\mathcal{P}(A)\), is the set of all subsets of \(A\).
Define a function powerset(s) that takes a set s and returns its
powerset.
Given a set \(A\), a partition of \(A\) is a set of sets \(\{A_1, A_2, \ldots, A_k\}\) such that, \(\bigcup_{i=1}^k A_i = A\) and \(A_i \cap A_j = \emptyset\) for all \(i \neq j\).
Define a function random_partition(s) that takes a set s and returns a
random partition of it.
A field of sets is a pair \(\langle\Omega, \mathcal{F}\rangle\) where \(\Omega\) is a set and \(\mathcal{F}\) is a family of sets such that:
- \(\Omega \in \mathcal{F}\).
- Closure under complementation: If \(A \in \mathcal{F}\), then \(\Omega \setminus A \in \mathcal{F}\).
- Closure under finite unions: If \(A_1, A_2,\ldots,A_n \in \mathcal{F}\) with \(n\geq 1\), then \(\bigcup_{i=1}^n A_i \in \mathcal{F}\).
The set \(\mathcal{F}\) is called a field on \(\Omega\).
Define a function is_field(omega, F) that takes a set omega and a
set of sets F, and returns True if F is a field on omega,
and False otherwise.
A field of sets \(\langle\Omega, \mathcal{F}\rangle\) is a \(\sigma\)-field of sets if it is closed under countable unions, i.e., If \(A_1, A_2, \ldots \in \mathcal{F}\), then \(\bigcup_{i=1}^{\infty} A_i \in \mathcal{F}\).
The notion of a \(\sigma\)-field requires some grasp of infinite sets, and can be left for more advanced study of probability.