| author | wenzelm | 
| Sun, 29 Sep 2024 21:16:17 +0200 | |
| changeset 81008 | d0cd220d8e8b | 
| parent 80914 | d97fdabd9e2b | 
| child 82513 | 8281047b896d | 
| permissions | -rw-r--r-- | 
| 63627 | 1 | (* Title: HOL/Analysis/Sigma_Algebra.thy | 
| 42067 | 2 | Author: Stefan Richter, Markus Wenzel, TU München | 
| 3 | Author: Johannes Hölzl, TU München | |
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41959diff
changeset | 4 | Plus material from the Hurd/Coble measure theory development, | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41959diff
changeset | 5 | translated by Lawrence Paulson. | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 6 | *) | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 7 | |
| 69676 | 8 | chapter \<open>Measure and Integration Theory\<close> | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 9 | |
| 41413 
64cd30d6b0b8
explicit file specifications -- avoid secondary load path;
 wenzelm parents: 
41095diff
changeset | 10 | theory Sigma_Algebra | 
| 
64cd30d6b0b8
explicit file specifications -- avoid secondary load path;
 wenzelm parents: 
41095diff
changeset | 11 | imports | 
| 42145 | 12 | Complex_Main | 
| 66453 
cc19f7ca2ed6
session-qualified theory imports: isabelle imports -U -i -d '~~/src/Benchmarks' -a;
 wenzelm parents: 
64008diff
changeset | 13 | "HOL-Library.Countable_Set" | 
| 68188 
2af1f142f855
move FuncSet back to HOL-Library (amending 493b818e8e10)
 immler parents: 
68073diff
changeset | 14 | "HOL-Library.FuncSet" | 
| 66453 
cc19f7ca2ed6
session-qualified theory imports: isabelle imports -U -i -d '~~/src/Benchmarks' -a;
 wenzelm parents: 
64008diff
changeset | 15 | "HOL-Library.Indicator_Function" | 
| 
cc19f7ca2ed6
session-qualified theory imports: isabelle imports -U -i -d '~~/src/Benchmarks' -a;
 wenzelm parents: 
64008diff
changeset | 16 | "HOL-Library.Extended_Nonnegative_Real" | 
| 
cc19f7ca2ed6
session-qualified theory imports: isabelle imports -U -i -d '~~/src/Benchmarks' -a;
 wenzelm parents: 
64008diff
changeset | 17 | "HOL-Library.Disjoint_Sets" | 
| 41413 
64cd30d6b0b8
explicit file specifications -- avoid secondary load path;
 wenzelm parents: 
41095diff
changeset | 18 | begin | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 19 | |
| 69676 | 20 | |
| 21 | section \<open>Sigma Algebra\<close> | |
| 22 | ||
| 61808 | 23 | text \<open>Sigma algebras are an elementary concept in measure | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 24 | theory. To measure --- that is to integrate --- functions, we first have | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 25 | to measure sets. Unfortunately, when dealing with a large universe, | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 26 | it is often not possible to consistently assign a measure to every | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 27 | subset. Therefore it is necessary to define the set of measurable | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 28 | subsets of the universe. A sigma algebra is such a set that has | 
| 61808 | 29 | three very natural and desirable properties.\<close> | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 30 | |
| 61808 | 31 | subsection \<open>Families of sets\<close> | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 32 | |
| 70136 | 33 | locale\<^marker>\<open>tag important\<close> subset_class = | 
| 47694 | 34 | fixes \<Omega> :: "'a set" and M :: "'a set set" | 
| 35 | assumes space_closed: "M \<subseteq> Pow \<Omega>" | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 36 | |
| 47694 | 37 | lemma (in subset_class) sets_into_space: "x \<in> M \<Longrightarrow> x \<subseteq> \<Omega>" | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 38 | by (metis PowD contra_subsetD space_closed) | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 39 | |
| 61808 | 40 | subsubsection \<open>Semiring of sets\<close> | 
| 47762 | 41 | |
| 70136 | 42 | locale\<^marker>\<open>tag important\<close> semiring_of_sets = subset_class + | 
| 47762 | 43 |   assumes empty_sets[iff]: "{} \<in> M"
 | 
| 44 | assumes Int[intro]: "\<And>a b. a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> a \<inter> b \<in> M" | |
| 45 | assumes Diff_cover: | |
| 46 | "\<And>a b. a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> \<exists>C\<subseteq>M. finite C \<and> disjoint C \<and> a - b = \<Union>C" | |
| 47 | ||
| 48 | lemma (in semiring_of_sets) finite_INT[intro]: | |
| 49 |   assumes "finite I" "I \<noteq> {}" "\<And>i. i \<in> I \<Longrightarrow> A i \<in> M"
 | |
| 50 | shows "(\<Inter>i\<in>I. A i) \<in> M" | |
| 51 | using assms by (induct rule: finite_ne_induct) auto | |
| 52 | ||
| 53 | lemma (in semiring_of_sets) Int_space_eq1 [simp]: "x \<in> M \<Longrightarrow> \<Omega> \<inter> x = x" | |
| 54 | by (metis Int_absorb1 sets_into_space) | |
| 55 | ||
| 56 | lemma (in semiring_of_sets) Int_space_eq2 [simp]: "x \<in> M \<Longrightarrow> x \<inter> \<Omega> = x" | |
| 57 | by (metis Int_absorb2 sets_into_space) | |
| 58 | ||
| 59 | lemma (in semiring_of_sets) sets_Collect_conj: | |
| 60 |   assumes "{x\<in>\<Omega>. P x} \<in> M" "{x\<in>\<Omega>. Q x} \<in> M"
 | |
| 61 |   shows "{x\<in>\<Omega>. Q x \<and> P x} \<in> M"
 | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 62 | proof - | 
| 47762 | 63 |   have "{x\<in>\<Omega>. Q x \<and> P x} = {x\<in>\<Omega>. Q x} \<inter> {x\<in>\<Omega>. P x}"
 | 
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 64 | by auto | 
| 47762 | 65 | with assms show ?thesis by auto | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 66 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 67 | |
| 50002 
ce0d316b5b44
add measurability prover; add support for Borel sets
 hoelzl parents: 
49834diff
changeset | 68 | lemma (in semiring_of_sets) sets_Collect_finite_All': | 
| 47762 | 69 |   assumes "\<And>i. i \<in> S \<Longrightarrow> {x\<in>\<Omega>. P i x} \<in> M" "finite S" "S \<noteq> {}"
 | 
| 70 |   shows "{x\<in>\<Omega>. \<forall>i\<in>S. P i x} \<in> M"
 | |
| 71 | proof - | |
| 72 |   have "{x\<in>\<Omega>. \<forall>i\<in>S. P i x} = (\<Inter>i\<in>S. {x\<in>\<Omega>. P i x})"
 | |
| 61808 | 73 |     using \<open>S \<noteq> {}\<close> by auto
 | 
| 47762 | 74 | with assms show ?thesis by auto | 
| 75 | qed | |
| 76 | ||
| 67962 | 77 | subsubsection \<open>Ring of sets\<close> | 
| 78 | ||
| 70136 | 79 | locale\<^marker>\<open>tag important\<close> ring_of_sets = semiring_of_sets + | 
| 47762 | 80 | assumes Un [intro]: "\<And>a b. a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> a \<union> b \<in> M" | 
| 81 | ||
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 82 | lemma (in ring_of_sets) finite_Union [intro]: | 
| 61952 | 83 | "finite X \<Longrightarrow> X \<subseteq> M \<Longrightarrow> \<Union>X \<in> M" | 
| 38656 | 84 | by (induct set: finite) (auto simp add: Un) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 85 | |
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 86 | lemma (in ring_of_sets) finite_UN[intro]: | 
| 47694 | 87 | assumes "finite I" and "\<And>i. i \<in> I \<Longrightarrow> A i \<in> M" | 
| 88 | shows "(\<Union>i\<in>I. A i) \<in> M" | |
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41959diff
changeset | 89 | using assms by induct auto | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41959diff
changeset | 90 | |
| 47762 | 91 | lemma (in ring_of_sets) Diff [intro]: | 
| 92 | assumes "a \<in> M" "b \<in> M" shows "a - b \<in> M" | |
| 93 | using Diff_cover[OF assms] by auto | |
| 94 | ||
| 95 | lemma ring_of_setsI: | |
| 96 | assumes space_closed: "M \<subseteq> Pow \<Omega>" | |
| 97 |   assumes empty_sets[iff]: "{} \<in> M"
 | |
| 98 | assumes Un[intro]: "\<And>a b. a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> a \<union> b \<in> M" | |
| 99 | assumes Diff[intro]: "\<And>a b. a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> a - b \<in> M" | |
| 100 | shows "ring_of_sets \<Omega> M" | |
| 101 | proof | |
| 102 | fix a b assume ab: "a \<in> M" "b \<in> M" | |
| 103 | from ab show "\<exists>C\<subseteq>M. finite C \<and> disjoint C \<and> a - b = \<Union>C" | |
| 104 |     by (intro exI[of _ "{a - b}"]) (auto simp: disjoint_def)
 | |
| 105 | have "a \<inter> b = a - (a - b)" by auto | |
| 106 | also have "\<dots> \<in> M" using ab by auto | |
| 107 | finally show "a \<inter> b \<in> M" . | |
| 108 | qed fact+ | |
| 109 | ||
| 110 | lemma ring_of_sets_iff: "ring_of_sets \<Omega> M \<longleftrightarrow> M \<subseteq> Pow \<Omega> \<and> {} \<in> M \<and> (\<forall>a\<in>M. \<forall>b\<in>M. a \<union> b \<in> M) \<and> (\<forall>a\<in>M. \<forall>b\<in>M. a - b \<in> M)"
 | |
| 111 | proof | |
| 112 | assume "ring_of_sets \<Omega> M" | |
| 113 | then interpret ring_of_sets \<Omega> M . | |
| 114 |   show "M \<subseteq> Pow \<Omega> \<and> {} \<in> M \<and> (\<forall>a\<in>M. \<forall>b\<in>M. a \<union> b \<in> M) \<and> (\<forall>a\<in>M. \<forall>b\<in>M. a - b \<in> M)"
 | |
| 115 | using space_closed by auto | |
| 116 | qed (auto intro!: ring_of_setsI) | |
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41959diff
changeset | 117 | |
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 118 | lemma (in ring_of_sets) insert_in_sets: | 
| 47694 | 119 |   assumes "{x} \<in> M" "A \<in> M" shows "insert x A \<in> M"
 | 
| 38656 | 120 | proof - | 
| 47694 | 121 |   have "{x} \<union> A \<in> M" using assms by (rule Un)
 | 
| 38656 | 122 | thus ?thesis by auto | 
| 123 | qed | |
| 124 | ||
| 42867 | 125 | lemma (in ring_of_sets) sets_Collect_disj: | 
| 47694 | 126 |   assumes "{x\<in>\<Omega>. P x} \<in> M" "{x\<in>\<Omega>. Q x} \<in> M"
 | 
| 127 |   shows "{x\<in>\<Omega>. Q x \<or> P x} \<in> M"
 | |
| 42867 | 128 | proof - | 
| 47694 | 129 |   have "{x\<in>\<Omega>. Q x \<or> P x} = {x\<in>\<Omega>. Q x} \<union> {x\<in>\<Omega>. P x}"
 | 
| 42867 | 130 | by auto | 
| 131 | with assms show ?thesis by auto | |
| 132 | qed | |
| 133 | ||
| 134 | lemma (in ring_of_sets) sets_Collect_finite_Ex: | |
| 47694 | 135 |   assumes "\<And>i. i \<in> S \<Longrightarrow> {x\<in>\<Omega>. P i x} \<in> M" "finite S"
 | 
| 136 |   shows "{x\<in>\<Omega>. \<exists>i\<in>S. P i x} \<in> M"
 | |
| 42867 | 137 | proof - | 
| 47694 | 138 |   have "{x\<in>\<Omega>. \<exists>i\<in>S. P i x} = (\<Union>i\<in>S. {x\<in>\<Omega>. P i x})"
 | 
| 42867 | 139 | by auto | 
| 140 | with assms show ?thesis by auto | |
| 141 | qed | |
| 142 | ||
| 67962 | 143 | subsubsection \<open>Algebra of sets\<close> | 
| 144 | ||
| 70136 | 145 | locale\<^marker>\<open>tag important\<close> algebra = ring_of_sets + | 
| 47694 | 146 | assumes top [iff]: "\<Omega> \<in> M" | 
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 147 | |
| 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 148 | lemma (in algebra) compl_sets [intro]: | 
| 47694 | 149 | "a \<in> M \<Longrightarrow> \<Omega> - a \<in> M" | 
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 150 | by auto | 
| 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 151 | |
| 68607 
67bb59e49834
make theorem, corollary, and proposition %important for HOL-Analysis manual
 immler parents: 
68403diff
changeset | 152 | proposition algebra_iff_Un: | 
| 47694 | 153 | "algebra \<Omega> M \<longleftrightarrow> | 
| 154 | M \<subseteq> Pow \<Omega> \<and> | |
| 155 |     {} \<in> M \<and>
 | |
| 156 | (\<forall>a \<in> M. \<Omega> - a \<in> M) \<and> | |
| 157 | (\<forall>a \<in> M. \<forall> b \<in> M. a \<union> b \<in> M)" (is "_ \<longleftrightarrow> ?Un") | |
| 68607 
67bb59e49834
make theorem, corollary, and proposition %important for HOL-Analysis manual
 immler parents: 
68403diff
changeset | 158 | proof | 
| 47694 | 159 | assume "algebra \<Omega> M" | 
| 160 | then interpret algebra \<Omega> M . | |
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 161 | show ?Un using sets_into_space by auto | 
| 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 162 | next | 
| 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 163 | assume ?Un | 
| 47762 | 164 | then have "\<Omega> \<in> M" by auto | 
| 165 | interpret ring_of_sets \<Omega> M | |
| 166 | proof (rule ring_of_setsI) | |
| 167 |     show \<Omega>: "M \<subseteq> Pow \<Omega>" "{} \<in> M"
 | |
| 61808 | 168 | using \<open>?Un\<close> by auto | 
| 47694 | 169 | fix a b assume a: "a \<in> M" and b: "b \<in> M" | 
| 61808 | 170 | then show "a \<union> b \<in> M" using \<open>?Un\<close> by auto | 
| 47694 | 171 | have "a - b = \<Omega> - ((\<Omega> - a) \<union> b)" | 
| 172 | using \<Omega> a b by auto | |
| 173 | then show "a - b \<in> M" | |
| 61808 | 174 | using a b \<open>?Un\<close> by auto | 
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 175 | qed | 
| 47762 | 176 | show "algebra \<Omega> M" proof qed fact | 
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 177 | qed | 
| 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 178 | |
| 68607 
67bb59e49834
make theorem, corollary, and proposition %important for HOL-Analysis manual
 immler parents: 
68403diff
changeset | 179 | proposition algebra_iff_Int: | 
| 47694 | 180 | "algebra \<Omega> M \<longleftrightarrow> | 
| 181 |        M \<subseteq> Pow \<Omega> & {} \<in> M &
 | |
| 182 | (\<forall>a \<in> M. \<Omega> - a \<in> M) & | |
| 183 | (\<forall>a \<in> M. \<forall> b \<in> M. a \<inter> b \<in> M)" (is "_ \<longleftrightarrow> ?Int") | |
| 68607 
67bb59e49834
make theorem, corollary, and proposition %important for HOL-Analysis manual
 immler parents: 
68403diff
changeset | 184 | proof | 
| 47694 | 185 | assume "algebra \<Omega> M" | 
| 186 | then interpret algebra \<Omega> M . | |
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 187 | show ?Int using sets_into_space by auto | 
| 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 188 | next | 
| 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 189 | assume ?Int | 
| 47694 | 190 | show "algebra \<Omega> M" | 
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 191 | proof (unfold algebra_iff_Un, intro conjI ballI) | 
| 47694 | 192 |     show \<Omega>: "M \<subseteq> Pow \<Omega>" "{} \<in> M"
 | 
| 61808 | 193 | using \<open>?Int\<close> by auto | 
| 194 | from \<open>?Int\<close> show "\<And>a. a \<in> M \<Longrightarrow> \<Omega> - a \<in> M" by auto | |
| 47694 | 195 | fix a b assume M: "a \<in> M" "b \<in> M" | 
| 196 | hence "a \<union> b = \<Omega> - ((\<Omega> - a) \<inter> (\<Omega> - b))" | |
| 197 | using \<Omega> by blast | |
| 198 | also have "... \<in> M" | |
| 61808 | 199 | using M \<open>?Int\<close> by auto | 
| 47694 | 200 | finally show "a \<union> b \<in> M" . | 
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 201 | qed | 
| 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 202 | qed | 
| 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 203 | |
| 42867 | 204 | lemma (in algebra) sets_Collect_neg: | 
| 47694 | 205 |   assumes "{x\<in>\<Omega>. P x} \<in> M"
 | 
| 206 |   shows "{x\<in>\<Omega>. \<not> P x} \<in> M"
 | |
| 42867 | 207 | proof - | 
| 47694 | 208 |   have "{x\<in>\<Omega>. \<not> P x} = \<Omega> - {x\<in>\<Omega>. P x}" by auto
 | 
| 42867 | 209 | with assms show ?thesis by auto | 
| 210 | qed | |
| 211 | ||
| 212 | lemma (in algebra) sets_Collect_imp: | |
| 47694 | 213 |   "{x\<in>\<Omega>. P x} \<in> M \<Longrightarrow> {x\<in>\<Omega>. Q x} \<in> M \<Longrightarrow> {x\<in>\<Omega>. Q x \<longrightarrow> P x} \<in> M"
 | 
| 42867 | 214 | unfolding imp_conv_disj by (intro sets_Collect_disj sets_Collect_neg) | 
| 215 | ||
| 216 | lemma (in algebra) sets_Collect_const: | |
| 47694 | 217 |   "{x\<in>\<Omega>. P} \<in> M"
 | 
| 42867 | 218 | by (cases P) auto | 
| 219 | ||
| 42984 | 220 | lemma algebra_single_set: | 
| 47762 | 221 |   "X \<subseteq> S \<Longrightarrow> algebra S { {}, X, S - X, S }"
 | 
| 222 | by (auto simp: algebra_iff_Int) | |
| 42984 | 223 | |
| 70136 | 224 | subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Restricted algebras\<close> | 
| 39092 | 225 | |
| 226 | abbreviation (in algebra) | |
| 67399 | 227 | "restricted_space A \<equiv> ((\<inter>) A) ` M" | 
| 39092 | 228 | |
| 38656 | 229 | lemma (in algebra) restricted_algebra: | 
| 47694 | 230 | assumes "A \<in> M" shows "algebra A (restricted_space A)" | 
| 47762 | 231 | using assms by (auto simp: algebra_iff_Int) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 232 | |
| 61808 | 233 | subsubsection \<open>Sigma Algebras\<close> | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 234 | |
| 70136 | 235 | locale\<^marker>\<open>tag important\<close> sigma_algebra = algebra + | 
| 47694 | 236 | assumes countable_nat_UN [intro]: "\<And>A. range A \<subseteq> M \<Longrightarrow> (\<Union>i::nat. A i) \<in> M" | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 237 | |
| 42984 | 238 | lemma (in algebra) is_sigma_algebra: | 
| 47694 | 239 | assumes "finite M" | 
| 240 | shows "sigma_algebra \<Omega> M" | |
| 42984 | 241 | proof | 
| 47694 | 242 | fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> M" | 
| 243 | then have "(\<Union>i. A i) = (\<Union>s\<in>M \<inter> range A. s)" | |
| 42984 | 244 | by auto | 
| 47694 | 245 | also have "(\<Union>s\<in>M \<inter> range A. s) \<in> M" | 
| 61808 | 246 | using \<open>finite M\<close> by auto | 
| 47694 | 247 | finally show "(\<Union>i. A i) \<in> M" . | 
| 42984 | 248 | qed | 
| 249 | ||
| 38656 | 250 | lemma countable_UN_eq: | 
| 251 | fixes A :: "'i::countable \<Rightarrow> 'a set" | |
| 47694 | 252 | shows "(range A \<subseteq> M \<longrightarrow> (\<Union>i. A i) \<in> M) \<longleftrightarrow> | 
| 253 | (range (A \<circ> from_nat) \<subseteq> M \<longrightarrow> (\<Union>i. (A \<circ> from_nat) i) \<in> M)" | |
| 38656 | 254 | proof - | 
| 255 | let ?A' = "A \<circ> from_nat" | |
| 256 | have *: "(\<Union>i. ?A' i) = (\<Union>i. A i)" (is "?l = ?r") | |
| 257 | proof safe | |
| 258 | fix x i assume "x \<in> A i" thus "x \<in> ?l" | |
| 259 | by (auto intro!: exI[of _ "to_nat i"]) | |
| 260 | next | |
| 261 | fix x i assume "x \<in> ?A' i" thus "x \<in> ?r" | |
| 262 | by (auto intro!: exI[of _ "from_nat i"]) | |
| 263 | qed | |
| 69661 | 264 | have "A ` range from_nat = range A" | 
| 265 | using surj_from_nat by simp | |
| 266 | then have **: "range ?A' = range A" | |
| 267 | by (simp only: image_comp [symmetric]) | |
| 38656 | 268 | show ?thesis unfolding * ** .. | 
| 269 | qed | |
| 270 | ||
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 271 | lemma (in sigma_algebra) countable_Union [intro]: | 
| 61952 | 272 | assumes "countable X" "X \<subseteq> M" shows "\<Union>X \<in> M" | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 273 | proof cases | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 274 |   assume "X \<noteq> {}"
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 275 | hence "\<Union>X = (\<Union>n. from_nat_into X n)" | 
| 69661 | 276 | using assms by (auto cong del: SUP_cong) | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 277 | also have "\<dots> \<in> M" using assms | 
| 69712 | 278 |     by (auto intro!: countable_nat_UN) (metis \<open>X \<noteq> {}\<close> from_nat_into subsetD)
 | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 279 | finally show ?thesis . | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 280 | qed simp | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 281 | |
| 38656 | 282 | lemma (in sigma_algebra) countable_UN[intro]: | 
| 283 | fixes A :: "'i::countable \<Rightarrow> 'a set" | |
| 47694 | 284 | assumes "A`X \<subseteq> M" | 
| 285 | shows "(\<Union>x\<in>X. A x) \<in> M" | |
| 38656 | 286 | proof - | 
| 46731 | 287 |   let ?A = "\<lambda>i. if i \<in> X then A i else {}"
 | 
| 47694 | 288 | from assms have "range ?A \<subseteq> M" by auto | 
| 38656 | 289 | with countable_nat_UN[of "?A \<circ> from_nat"] countable_UN_eq[of ?A M] | 
| 47694 | 290 | have "(\<Union>x. ?A x) \<in> M" by auto | 
| 62390 | 291 | moreover have "(\<Union>x. ?A x) = (\<Union>x\<in>X. A x)" by (auto split: if_split_asm) | 
| 38656 | 292 | ultimately show ?thesis by simp | 
| 293 | qed | |
| 294 | ||
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 295 | lemma (in sigma_algebra) countable_UN': | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 296 | fixes A :: "'i \<Rightarrow> 'a set" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 297 | assumes X: "countable X" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 298 | assumes A: "A`X \<subseteq> M" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 299 | shows "(\<Union>x\<in>X. A x) \<in> M" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 300 | proof - | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 301 | have "(\<Union>x\<in>X. A x) = (\<Union>i\<in>to_nat_on X ` X. A (from_nat_into X i))" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 302 | using X by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 303 | also have "\<dots> \<in> M" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 304 | using A X | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 305 | by (intro countable_UN) auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 306 | finally show ?thesis . | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 307 | qed | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 308 | |
| 61633 | 309 | lemma (in sigma_algebra) countable_UN'': | 
| 310 | "\<lbrakk> countable X; \<And>x y. x \<in> X \<Longrightarrow> A x \<in> M \<rbrakk> \<Longrightarrow> (\<Union>x\<in>X. A x) \<in> M" | |
| 311 | by(erule countable_UN')(auto) | |
| 312 | ||
| 33533 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
 paulson parents: 
33271diff
changeset | 313 | lemma (in sigma_algebra) countable_INT [intro]: | 
| 38656 | 314 | fixes A :: "'i::countable \<Rightarrow> 'a set" | 
| 47694 | 315 |   assumes A: "A`X \<subseteq> M" "X \<noteq> {}"
 | 
| 316 | shows "(\<Inter>i\<in>X. A i) \<in> M" | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 317 | proof - | 
| 47694 | 318 | from A have "\<forall>i\<in>X. A i \<in> M" by fast | 
| 319 | hence "\<Omega> - (\<Union>i\<in>X. \<Omega> - A i) \<in> M" by blast | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 320 | moreover | 
| 47694 | 321 | have "(\<Inter>i\<in>X. A i) = \<Omega> - (\<Union>i\<in>X. \<Omega> - A i)" using space_closed A | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 322 | by blast | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 323 | ultimately show ?thesis by metis | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 324 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 325 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 326 | lemma (in sigma_algebra) countable_INT': | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 327 | fixes A :: "'i \<Rightarrow> 'a set" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 328 |   assumes X: "countable X" "X \<noteq> {}"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 329 | assumes A: "A`X \<subseteq> M" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 330 | shows "(\<Inter>x\<in>X. A x) \<in> M" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 331 | proof - | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 332 | have "(\<Inter>x\<in>X. A x) = (\<Inter>i\<in>to_nat_on X ` X. A (from_nat_into X i))" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 333 | using X by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 334 | also have "\<dots> \<in> M" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 335 | using A X | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 336 | by (intro countable_INT) auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 337 | finally show ?thesis . | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 338 | qed | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 339 | |
| 59088 
ff2bd4a14ddb
generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
 hoelzl parents: 
59048diff
changeset | 340 | lemma (in sigma_algebra) countable_INT'': | 
| 
ff2bd4a14ddb
generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
 hoelzl parents: 
59048diff
changeset | 341 | "UNIV \<in> M \<Longrightarrow> countable I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> F i \<in> M) \<Longrightarrow> (\<Inter>i\<in>I. F i) \<in> M" | 
| 
ff2bd4a14ddb
generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
 hoelzl parents: 
59048diff
changeset | 342 |   by (cases "I = {}") (auto intro: countable_INT')
 | 
| 57275 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57138diff
changeset | 343 | |
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57138diff
changeset | 344 | lemma (in sigma_algebra) countable: | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57138diff
changeset | 345 |   assumes "\<And>a. a \<in> A \<Longrightarrow> {a} \<in> M" "countable A"
 | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57138diff
changeset | 346 | shows "A \<in> M" | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57138diff
changeset | 347 | proof - | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57138diff
changeset | 348 |   have "(\<Union>a\<in>A. {a}) \<in> M"
 | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57138diff
changeset | 349 | using assms by (intro countable_UN') auto | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57138diff
changeset | 350 |   also have "(\<Union>a\<in>A. {a}) = A" by auto
 | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57138diff
changeset | 351 | finally show ?thesis by auto | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57138diff
changeset | 352 | qed | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57138diff
changeset | 353 | |
| 47694 | 354 | lemma ring_of_sets_Pow: "ring_of_sets sp (Pow sp)" | 
| 47762 | 355 | by (auto simp: ring_of_sets_iff) | 
| 42145 | 356 | |
| 47694 | 357 | lemma algebra_Pow: "algebra sp (Pow sp)" | 
| 47762 | 358 | by (auto simp: algebra_iff_Un) | 
| 38656 | 359 | |
| 360 | lemma sigma_algebra_iff: | |
| 47694 | 361 | "sigma_algebra \<Omega> M \<longleftrightarrow> | 
| 362 | algebra \<Omega> M \<and> (\<forall>A. range A \<subseteq> M \<longrightarrow> (\<Union>i::nat. A i) \<in> M)" | |
| 38656 | 363 | by (simp add: sigma_algebra_def sigma_algebra_axioms_def) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 364 | |
| 47762 | 365 | lemma sigma_algebra_Pow: "sigma_algebra sp (Pow sp)" | 
| 366 | by (auto simp: sigma_algebra_iff algebra_iff_Int) | |
| 367 | ||
| 42867 | 368 | lemma (in sigma_algebra) sets_Collect_countable_All: | 
| 47694 | 369 |   assumes "\<And>i. {x\<in>\<Omega>. P i x} \<in> M"
 | 
| 370 |   shows "{x\<in>\<Omega>. \<forall>i::'i::countable. P i x} \<in> M"
 | |
| 42867 | 371 | proof - | 
| 47694 | 372 |   have "{x\<in>\<Omega>. \<forall>i::'i::countable. P i x} = (\<Inter>i. {x\<in>\<Omega>. P i x})" by auto
 | 
| 42867 | 373 | with assms show ?thesis by auto | 
| 374 | qed | |
| 375 | ||
| 376 | lemma (in sigma_algebra) sets_Collect_countable_Ex: | |
| 47694 | 377 |   assumes "\<And>i. {x\<in>\<Omega>. P i x} \<in> M"
 | 
| 378 |   shows "{x\<in>\<Omega>. \<exists>i::'i::countable. P i x} \<in> M"
 | |
| 42867 | 379 | proof - | 
| 47694 | 380 |   have "{x\<in>\<Omega>. \<exists>i::'i::countable. P i x} = (\<Union>i. {x\<in>\<Omega>. P i x})" by auto
 | 
| 42867 | 381 | with assms show ?thesis by auto | 
| 382 | qed | |
| 383 | ||
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 384 | lemma (in sigma_algebra) sets_Collect_countable_Ex': | 
| 54418 | 385 |   assumes "\<And>i. i \<in> I \<Longrightarrow> {x\<in>\<Omega>. P i x} \<in> M"
 | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 386 | assumes "countable I" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 387 |   shows "{x\<in>\<Omega>. \<exists>i\<in>I. P i x} \<in> M"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 388 | proof - | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 389 |   have "{x\<in>\<Omega>. \<exists>i\<in>I. P i x} = (\<Union>i\<in>I. {x\<in>\<Omega>. P i x})" by auto
 | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 390 | with assms show ?thesis | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 391 | by (auto intro!: countable_UN') | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 392 | qed | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50387diff
changeset | 393 | |
| 54418 | 394 | lemma (in sigma_algebra) sets_Collect_countable_All': | 
| 395 |   assumes "\<And>i. i \<in> I \<Longrightarrow> {x\<in>\<Omega>. P i x} \<in> M"
 | |
| 396 | assumes "countable I" | |
| 397 |   shows "{x\<in>\<Omega>. \<forall>i\<in>I. P i x} \<in> M"
 | |
| 398 | proof - | |
| 399 |   have "{x\<in>\<Omega>. \<forall>i\<in>I. P i x} = (\<Inter>i\<in>I. {x\<in>\<Omega>. P i x}) \<inter> \<Omega>" by auto
 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 400 | with assms show ?thesis | 
| 54418 | 401 |     by (cases "I = {}") (auto intro!: countable_INT')
 | 
| 402 | qed | |
| 403 | ||
| 404 | lemma (in sigma_algebra) sets_Collect_countable_Ex1': | |
| 405 |   assumes "\<And>i. i \<in> I \<Longrightarrow> {x\<in>\<Omega>. P i x} \<in> M"
 | |
| 406 | assumes "countable I" | |
| 407 |   shows "{x\<in>\<Omega>. \<exists>!i\<in>I. P i x} \<in> M"
 | |
| 408 | proof - | |
| 409 |   have "{x\<in>\<Omega>. \<exists>!i\<in>I. P i x} = {x\<in>\<Omega>. \<exists>i\<in>I. P i x \<and> (\<forall>j\<in>I. P j x \<longrightarrow> i = j)}"
 | |
| 410 | by auto | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 411 | with assms show ?thesis | 
| 54418 | 412 | by (auto intro!: sets_Collect_countable_All' sets_Collect_countable_Ex' sets_Collect_conj sets_Collect_imp sets_Collect_const) | 
| 413 | qed | |
| 414 | ||
| 42867 | 415 | lemmas (in sigma_algebra) sets_Collect = | 
| 416 | sets_Collect_imp sets_Collect_disj sets_Collect_conj sets_Collect_neg sets_Collect_const | |
| 417 | sets_Collect_countable_All sets_Collect_countable_Ex sets_Collect_countable_All | |
| 418 | ||
| 47694 | 419 | lemma (in sigma_algebra) sets_Collect_countable_Ball: | 
| 420 |   assumes "\<And>i. {x\<in>\<Omega>. P i x} \<in> M"
 | |
| 421 |   shows "{x\<in>\<Omega>. \<forall>i::'i::countable\<in>X. P i x} \<in> M"
 | |
| 422 | unfolding Ball_def by (intro sets_Collect assms) | |
| 423 | ||
| 424 | lemma (in sigma_algebra) sets_Collect_countable_Bex: | |
| 425 |   assumes "\<And>i. {x\<in>\<Omega>. P i x} \<in> M"
 | |
| 426 |   shows "{x\<in>\<Omega>. \<exists>i::'i::countable\<in>X. P i x} \<in> M"
 | |
| 427 | unfolding Bex_def by (intro sets_Collect assms) | |
| 428 | ||
| 42984 | 429 | lemma sigma_algebra_single_set: | 
| 430 | assumes "X \<subseteq> S" | |
| 47694 | 431 |   shows "sigma_algebra S { {}, X, S - X, S }"
 | 
| 61808 | 432 | using algebra.is_sigma_algebra[OF algebra_single_set[OF \<open>X \<subseteq> S\<close>]] by simp | 
| 42984 | 433 | |
| 70136 | 434 | subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Binary Unions\<close> | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 435 | |
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 436 | definition binary :: "'a \<Rightarrow> 'a \<Rightarrow> nat \<Rightarrow> 'a" | 
| 50252 | 437 | where "binary a b = (\<lambda>x. b)(0 := a)" | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 438 | |
| 38656 | 439 | lemma range_binary_eq: "range(binary a b) = {a,b}"
 | 
| 440 | by (auto simp add: binary_def) | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 441 | |
| 38656 | 442 | lemma Un_range_binary: "a \<union> b = (\<Union>i::nat. binary a b i)" | 
| 69546 
27dae626822b
prefer naming convention from datatype package for strong congruence rules
 haftmann parents: 
69313diff
changeset | 443 | by (simp add: range_binary_eq cong del: SUP_cong_simp) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 444 | |
| 38656 | 445 | lemma Int_range_binary: "a \<inter> b = (\<Inter>i::nat. binary a b i)" | 
| 69546 
27dae626822b
prefer naming convention from datatype package for strong congruence rules
 haftmann parents: 
69313diff
changeset | 446 | by (simp add: range_binary_eq cong del: INF_cong_simp) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 447 | |
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 448 | lemma sigma_algebra_iff2: | 
| 69768 | 449 | "sigma_algebra \<Omega> M \<longleftrightarrow> | 
| 450 |     M \<subseteq> Pow \<Omega> \<and> {} \<in> M \<and> (\<forall>s \<in> M. \<Omega> - s \<in> M)
 | |
| 451 | \<and> (\<forall>A. range A \<subseteq> M \<longrightarrow>(\<Union> i::nat. A i) \<in> M)" (is "?P \<longleftrightarrow> ?R \<and> ?S \<and> ?V \<and> ?W") | |
| 452 | proof | |
| 453 | assume ?P | |
| 454 | then interpret sigma_algebra \<Omega> M . | |
| 455 | from space_closed show "?R \<and> ?S \<and> ?V \<and> ?W" | |
| 456 | by auto | |
| 457 | next | |
| 458 | assume "?R \<and> ?S \<and> ?V \<and> ?W" | |
| 459 | then have ?R ?S ?V ?W | |
| 460 | by simp_all | |
| 461 | show ?P | |
| 462 | proof (rule sigma_algebra.intro) | |
| 463 | show "sigma_algebra_axioms M" | |
| 464 | by standard (use \<open>?W\<close> in simp) | |
| 465 | from \<open>?W\<close> have *: "range (binary a b) \<subseteq> M \<Longrightarrow> \<Union> (range (binary a b)) \<in> M" for a b | |
| 466 | by auto | |
| 467 | show "algebra \<Omega> M" | |
| 468 | unfolding algebra_iff_Un using \<open>?R\<close> \<open>?S\<close> \<open>?V\<close> * | |
| 469 | by (auto simp add: range_binary_eq) | |
| 470 | qed | |
| 471 | qed | |
| 472 | ||
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 473 | |
| 61808 | 474 | subsubsection \<open>Initial Sigma Algebra\<close> | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 475 | |
| 70136 | 476 | text\<^marker>\<open>tag important\<close> \<open>Sigma algebras can naturally be created as the closure of any set of | 
| 61808 | 477 | M with regard to the properties just postulated.\<close> | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 478 | |
| 70136 | 479 | inductive_set\<^marker>\<open>tag important\<close> sigma_sets :: "'a set \<Rightarrow> 'a set set \<Rightarrow> 'a set set" | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 480 | for sp :: "'a set" and A :: "'a set set" | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 481 | where | 
| 47694 | 482 | Basic[intro, simp]: "a \<in> A \<Longrightarrow> a \<in> sigma_sets sp A" | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 483 |   | Empty: "{} \<in> sigma_sets sp A"
 | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 484 | | Compl: "a \<in> sigma_sets sp A \<Longrightarrow> sp - a \<in> sigma_sets sp A" | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 485 | | Union: "(\<And>i::nat. a i \<in> sigma_sets sp A) \<Longrightarrow> (\<Union>i. a i) \<in> sigma_sets sp A" | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 486 | |
| 41543 | 487 | lemma (in sigma_algebra) sigma_sets_subset: | 
| 47694 | 488 | assumes a: "a \<subseteq> M" | 
| 489 | shows "sigma_sets \<Omega> a \<subseteq> M" | |
| 41543 | 490 | proof | 
| 491 | fix x | |
| 47694 | 492 | assume "x \<in> sigma_sets \<Omega> a" | 
| 493 | from this show "x \<in> M" | |
| 41543 | 494 | by (induct rule: sigma_sets.induct, auto) (metis a subsetD) | 
| 495 | qed | |
| 496 | ||
| 497 | lemma sigma_sets_into_sp: "A \<subseteq> Pow sp \<Longrightarrow> x \<in> sigma_sets sp A \<Longrightarrow> x \<subseteq> sp" | |
| 498 | by (erule sigma_sets.induct, auto) | |
| 499 | ||
| 79583 
a521c241e946
Further lemmas concerning complexity and measures
 paulson <lp15@cam.ac.uk> parents: 
76834diff
changeset | 500 | lemma sigma_sets_finite: "\<lbrakk>x \<in> sigma_sets \<Omega> (Pow \<Omega>); finite \<Omega>\<rbrakk> \<Longrightarrow> finite x" | 
| 
a521c241e946
Further lemmas concerning complexity and measures
 paulson <lp15@cam.ac.uk> parents: 
76834diff
changeset | 501 | by (meson finite_subset order.refl sigma_sets_into_sp) | 
| 
a521c241e946
Further lemmas concerning complexity and measures
 paulson <lp15@cam.ac.uk> parents: 
76834diff
changeset | 502 | |
| 41543 | 503 | lemma sigma_algebra_sigma_sets: | 
| 47694 | 504 | "a \<subseteq> Pow \<Omega> \<Longrightarrow> sigma_algebra \<Omega> (sigma_sets \<Omega> a)" | 
| 41543 | 505 | by (auto simp add: sigma_algebra_iff2 dest: sigma_sets_into_sp | 
| 506 | intro!: sigma_sets.Union sigma_sets.Empty sigma_sets.Compl) | |
| 507 | ||
| 508 | lemma sigma_sets_least_sigma_algebra: | |
| 509 | assumes "A \<subseteq> Pow S" | |
| 47694 | 510 |   shows "sigma_sets S A = \<Inter>{B. A \<subseteq> B \<and> sigma_algebra S B}"
 | 
| 41543 | 511 | proof safe | 
| 47694 | 512 | fix B X assume "A \<subseteq> B" and sa: "sigma_algebra S B" | 
| 41543 | 513 | and X: "X \<in> sigma_sets S A" | 
| 61808 | 514 | from sigma_algebra.sigma_sets_subset[OF sa, simplified, OF \<open>A \<subseteq> B\<close>] X | 
| 41543 | 515 | show "X \<in> B" by auto | 
| 516 | next | |
| 47694 | 517 |   fix X assume "X \<in> \<Inter>{B. A \<subseteq> B \<and> sigma_algebra S B}"
 | 
| 518 | then have [intro!]: "\<And>B. A \<subseteq> B \<Longrightarrow> sigma_algebra S B \<Longrightarrow> X \<in> B" | |
| 41543 | 519 | by simp | 
| 47694 | 520 | have "A \<subseteq> sigma_sets S A" using assms by auto | 
| 521 | moreover have "sigma_algebra S (sigma_sets S A)" | |
| 41543 | 522 | using assms by (intro sigma_algebra_sigma_sets[of A]) auto | 
| 523 | ultimately show "X \<in> sigma_sets S A" by auto | |
| 524 | qed | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 525 | |
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 526 | lemma sigma_sets_top: "sp \<in> sigma_sets sp A" | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 527 | by (metis Diff_empty sigma_sets.Compl sigma_sets.Empty) | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 528 | |
| 69661 | 529 | lemma binary_in_sigma_sets: | 
| 530 | "binary a b i \<in> sigma_sets sp A" if "a \<in> sigma_sets sp A" and "b \<in> sigma_sets sp A" | |
| 531 | using that by (simp add: binary_def) | |
| 532 | ||
| 38656 | 533 | lemma sigma_sets_Un: | 
| 69661 | 534 | "a \<union> b \<in> sigma_sets sp A" if "a \<in> sigma_sets sp A" and "b \<in> sigma_sets sp A" | 
| 535 | using that by (simp add: Un_range_binary binary_in_sigma_sets Union) | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 536 | |
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 537 | lemma sigma_sets_Inter: | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 538 | assumes Asb: "A \<subseteq> Pow sp" | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 539 | shows "(\<And>i::nat. a i \<in> sigma_sets sp A) \<Longrightarrow> (\<Inter>i. a i) \<in> sigma_sets sp A" | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 540 | proof - | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 541 | assume ai: "\<And>i::nat. a i \<in> sigma_sets sp A" | 
| 38656 | 542 | hence "\<And>i::nat. sp-(a i) \<in> sigma_sets sp A" | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 543 | by (rule sigma_sets.Compl) | 
| 38656 | 544 | hence "(\<Union>i. sp-(a i)) \<in> sigma_sets sp A" | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 545 | by (rule sigma_sets.Union) | 
| 38656 | 546 | hence "sp-(\<Union>i. sp-(a i)) \<in> sigma_sets sp A" | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 547 | by (rule sigma_sets.Compl) | 
| 38656 | 548 | also have "sp-(\<Union>i. sp-(a i)) = sp Int (\<Inter>i. a i)" | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 549 | by auto | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 550 | also have "... = (\<Inter>i. a i)" using ai | 
| 38656 | 551 | by (blast dest: sigma_sets_into_sp [OF Asb]) | 
| 552 | finally show ?thesis . | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 553 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 554 | |
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 555 | lemma sigma_sets_INTER: | 
| 38656 | 556 | assumes Asb: "A \<subseteq> Pow sp" | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 557 |       and ai: "\<And>i::nat. i \<in> S \<Longrightarrow> a i \<in> sigma_sets sp A" and non: "S \<noteq> {}"
 | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 558 | shows "(\<Inter>i\<in>S. a i) \<in> sigma_sets sp A" | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 559 | proof - | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 560 | from ai have "\<And>i. (if i\<in>S then a i else sp) \<in> sigma_sets sp A" | 
| 47694 | 561 | by (simp add: sigma_sets.intros(2-) sigma_sets_top) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 562 | hence "(\<Inter>i. (if i\<in>S then a i else sp)) \<in> sigma_sets sp A" | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 563 | by (rule sigma_sets_Inter [OF Asb]) | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 564 | also have "(\<Inter>i. (if i\<in>S then a i else sp)) = (\<Inter>i\<in>S. a i)" | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 565 | by auto (metis ai non sigma_sets_into_sp subset_empty subset_iff Asb)+ | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 566 | finally show ?thesis . | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 567 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 568 | |
| 62343 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 haftmann parents: 
62083diff
changeset | 569 | lemma sigma_sets_UNION: | 
| 69661 | 570 | "countable B \<Longrightarrow> (\<And>b. b \<in> B \<Longrightarrow> b \<in> sigma_sets X A) \<Longrightarrow> \<Union> B \<in> sigma_sets X A" | 
| 62343 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 haftmann parents: 
62083diff
changeset | 571 | using from_nat_into [of B] range_from_nat_into [of B] sigma_sets.Union [of "from_nat_into B" X A] | 
| 69661 | 572 |   by (cases "B = {}") (simp_all add: sigma_sets.Empty cong del: SUP_cong)
 | 
| 51683 
baefa3b461c2
generalize Borel-set properties from real/ereal/ordered_euclidean_spaces to order_topology and real_normed_vector
 hoelzl parents: 
50526diff
changeset | 573 | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 574 | lemma (in sigma_algebra) sigma_sets_eq: | 
| 47694 | 575 | "sigma_sets \<Omega> M = M" | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 576 | proof | 
| 47694 | 577 | show "M \<subseteq> sigma_sets \<Omega> M" | 
| 37032 | 578 | by (metis Set.subsetI sigma_sets.Basic) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 579 | next | 
| 47694 | 580 | show "sigma_sets \<Omega> M \<subseteq> M" | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 581 | by (metis sigma_sets_subset subset_refl) | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 582 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 583 | |
| 42981 | 584 | lemma sigma_sets_eqI: | 
| 585 | assumes A: "\<And>a. a \<in> A \<Longrightarrow> a \<in> sigma_sets M B" | |
| 586 | assumes B: "\<And>b. b \<in> B \<Longrightarrow> b \<in> sigma_sets M A" | |
| 587 | shows "sigma_sets M A = sigma_sets M B" | |
| 588 | proof (intro set_eqI iffI) | |
| 589 | fix a assume "a \<in> sigma_sets M A" | |
| 590 | from this A show "a \<in> sigma_sets M B" | |
| 47694 | 591 | by induct (auto intro!: sigma_sets.intros(2-) del: sigma_sets.Basic) | 
| 42981 | 592 | next | 
| 593 | fix b assume "b \<in> sigma_sets M B" | |
| 594 | from this B show "b \<in> sigma_sets M A" | |
| 47694 | 595 | by induct (auto intro!: sigma_sets.intros(2-) del: sigma_sets.Basic) | 
| 42981 | 596 | qed | 
| 597 | ||
| 42984 | 598 | lemma sigma_sets_subseteq: assumes "A \<subseteq> B" shows "sigma_sets X A \<subseteq> sigma_sets X B" | 
| 599 | proof | |
| 600 | fix x assume "x \<in> sigma_sets X A" then show "x \<in> sigma_sets X B" | |
| 61808 | 601 | by induct (insert \<open>A \<subseteq> B\<close>, auto intro: sigma_sets.intros(2-)) | 
| 42984 | 602 | qed | 
| 603 | ||
| 47762 | 604 | lemma sigma_sets_mono: assumes "A \<subseteq> sigma_sets X B" shows "sigma_sets X A \<subseteq> sigma_sets X B" | 
| 605 | proof | |
| 606 | fix x assume "x \<in> sigma_sets X A" then show "x \<in> sigma_sets X B" | |
| 61808 | 607 | by induct (insert \<open>A \<subseteq> sigma_sets X B\<close>, auto intro: sigma_sets.intros(2-)) | 
| 47762 | 608 | qed | 
| 609 | ||
| 610 | lemma sigma_sets_mono': assumes "A \<subseteq> B" shows "sigma_sets X A \<subseteq> sigma_sets X B" | |
| 611 | proof | |
| 612 | fix x assume "x \<in> sigma_sets X A" then show "x \<in> sigma_sets X B" | |
| 61808 | 613 | by induct (insert \<open>A \<subseteq> B\<close>, auto intro: sigma_sets.intros(2-)) | 
| 47762 | 614 | qed | 
| 615 | ||
| 616 | lemma sigma_sets_superset_generator: "A \<subseteq> sigma_sets X A" | |
| 617 | by (auto intro: sigma_sets.Basic) | |
| 618 | ||
| 38656 | 619 | lemma (in sigma_algebra) restriction_in_sets: | 
| 620 | fixes A :: "nat \<Rightarrow> 'a set" | |
| 47694 | 621 | assumes "S \<in> M" | 
| 622 | and *: "range A \<subseteq> (\<lambda>A. S \<inter> A) ` M" (is "_ \<subseteq> ?r") | |
| 623 | shows "range A \<subseteq> M" "(\<Union>i. A i) \<in> (\<lambda>A. S \<inter> A) ` M" | |
| 38656 | 624 | proof - | 
| 625 |   { fix i have "A i \<in> ?r" using * by auto
 | |
| 47694 | 626 | hence "\<exists>B. A i = B \<inter> S \<and> B \<in> M" by auto | 
| 61808 | 627 | hence "A i \<subseteq> S" "A i \<in> M" using \<open>S \<in> M\<close> by auto } | 
| 47694 | 628 | thus "range A \<subseteq> M" "(\<Union>i. A i) \<in> (\<lambda>A. S \<inter> A) ` M" | 
| 38656 | 629 | by (auto intro!: image_eqI[of _ _ "(\<Union>i. A i)"]) | 
| 630 | qed | |
| 631 | ||
| 632 | lemma (in sigma_algebra) restricted_sigma_algebra: | |
| 47694 | 633 | assumes "S \<in> M" | 
| 634 | shows "sigma_algebra S (restricted_space S)" | |
| 38656 | 635 | unfolding sigma_algebra_def sigma_algebra_axioms_def | 
| 636 | proof safe | |
| 47694 | 637 | show "algebra S (restricted_space S)" using restricted_algebra[OF assms] . | 
| 38656 | 638 | next | 
| 47694 | 639 | fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> restricted_space S" | 
| 38656 | 640 | from restriction_in_sets[OF assms this[simplified]] | 
| 47694 | 641 | show "(\<Union>i. A i) \<in> restricted_space S" by simp | 
| 38656 | 642 | qed | 
| 643 | ||
| 40859 | 644 | lemma sigma_sets_Int: | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41543diff
changeset | 645 | assumes "A \<in> sigma_sets sp st" "A \<subseteq> sp" | 
| 67399 | 646 | shows "(\<inter>) A ` sigma_sets sp st = sigma_sets A ((\<inter>) A ` st)" | 
| 40859 | 647 | proof (intro equalityI subsetI) | 
| 67399 | 648 | fix x assume "x \<in> (\<inter>) A ` sigma_sets sp st" | 
| 40859 | 649 | then obtain y where "y \<in> sigma_sets sp st" "x = y \<inter> A" by auto | 
| 67399 | 650 | then have "x \<in> sigma_sets (A \<inter> sp) ((\<inter>) A ` st)" | 
| 40859 | 651 | proof (induct arbitrary: x) | 
| 652 | case (Compl a) | |
| 653 | then show ?case | |
| 654 | by (force intro!: sigma_sets.Compl simp: Diff_Int_distrib ac_simps) | |
| 655 | next | |
| 656 | case (Union a) | |
| 657 | then show ?case | |
| 658 | by (auto intro!: sigma_sets.Union | |
| 659 | simp add: UN_extend_simps simp del: UN_simps) | |
| 47694 | 660 | qed (auto intro!: sigma_sets.intros(2-)) | 
| 67399 | 661 | then show "x \<in> sigma_sets A ((\<inter>) A ` st)" | 
| 61808 | 662 | using \<open>A \<subseteq> sp\<close> by (simp add: Int_absorb2) | 
| 40859 | 663 | next | 
| 67399 | 664 | fix x assume "x \<in> sigma_sets A ((\<inter>) A ` st)" | 
| 665 | then show "x \<in> (\<inter>) A ` sigma_sets sp st" | |
| 40859 | 666 | proof induct | 
| 667 | case (Compl a) | |
| 668 | then obtain x where "a = A \<inter> x" "x \<in> sigma_sets sp st" by auto | |
| 61808 | 669 | then show ?case using \<open>A \<subseteq> sp\<close> | 
| 40859 | 670 | by (force simp add: image_iff intro!: bexI[of _ "sp - x"] sigma_sets.Compl) | 
| 671 | next | |
| 672 | case (Union a) | |
| 673 | then have "\<forall>i. \<exists>x. x \<in> sigma_sets sp st \<and> a i = A \<inter> x" | |
| 674 | by (auto simp: image_iff Bex_def) | |
| 74362 | 675 | then obtain f where "\<forall>x. f x \<in> sigma_sets sp st \<and> a x = A \<inter> f x" | 
| 676 | by metis | |
| 40859 | 677 | then show ?case | 
| 678 | by (auto intro!: bexI[of _ "(\<Union>x. f x)"] sigma_sets.Union | |
| 679 | simp add: image_iff) | |
| 47694 | 680 | qed (auto intro!: sigma_sets.intros(2-)) | 
| 40859 | 681 | qed | 
| 682 | ||
| 47694 | 683 | lemma sigma_sets_empty_eq: "sigma_sets A {} = {{}, A}"
 | 
| 40859 | 684 | proof (intro set_eqI iffI) | 
| 47694 | 685 |   fix a assume "a \<in> sigma_sets A {}" then show "a \<in> {{}, A}"
 | 
| 686 | by induct blast+ | |
| 687 | qed (auto intro: sigma_sets.Empty sigma_sets_top) | |
| 688 | ||
| 689 | lemma sigma_sets_single[simp]: "sigma_sets A {A} = {{}, A}"
 | |
| 690 | proof (intro set_eqI iffI) | |
| 691 |   fix x assume "x \<in> sigma_sets A {A}"
 | |
| 692 |   then show "x \<in> {{}, A}"
 | |
| 693 | by induct blast+ | |
| 40859 | 694 | next | 
| 47694 | 695 |   fix x assume "x \<in> {{}, A}"
 | 
| 696 |   then show "x \<in> sigma_sets A {A}"
 | |
| 40859 | 697 | by (auto intro: sigma_sets.Empty sigma_sets_top) | 
| 698 | qed | |
| 699 | ||
| 42987 | 700 | lemma sigma_sets_sigma_sets_eq: | 
| 701 | "M \<subseteq> Pow S \<Longrightarrow> sigma_sets S (sigma_sets S M) = sigma_sets S M" | |
| 47694 | 702 | by (rule sigma_algebra.sigma_sets_eq[OF sigma_algebra_sigma_sets, of M S]) auto | 
| 42987 | 703 | |
| 42984 | 704 | lemma sigma_sets_singleton: | 
| 705 | assumes "X \<subseteq> S" | |
| 706 |   shows "sigma_sets S { X } = { {}, X, S - X, S }"
 | |
| 707 | proof - | |
| 47694 | 708 |   interpret sigma_algebra S "{ {}, X, S - X, S }"
 | 
| 42984 | 709 | by (rule sigma_algebra_single_set) fact | 
| 710 |   have "sigma_sets S { X } \<subseteq> sigma_sets S { {}, X, S - X, S }"
 | |
| 711 | by (rule sigma_sets_subseteq) simp | |
| 712 |   moreover have "\<dots> = { {}, X, S - X, S }"
 | |
| 47694 | 713 | using sigma_sets_eq by simp | 
| 42984 | 714 | moreover | 
| 715 |   { fix A assume "A \<in> { {}, X, S - X, S }"
 | |
| 716 |     then have "A \<in> sigma_sets S { X }"
 | |
| 47694 | 717 | by (auto intro: sigma_sets.intros(2-) sigma_sets_top) } | 
| 42984 | 718 |   ultimately have "sigma_sets S { X } = sigma_sets S { {}, X, S - X, S }"
 | 
| 719 | by (intro antisym) auto | |
| 47694 | 720 | with sigma_sets_eq show ?thesis by simp | 
| 42984 | 721 | qed | 
| 722 | ||
| 42863 | 723 | lemma restricted_sigma: | 
| 47694 | 724 | assumes S: "S \<in> sigma_sets \<Omega> M" and M: "M \<subseteq> Pow \<Omega>" | 
| 725 | shows "algebra.restricted_space (sigma_sets \<Omega> M) S = | |
| 726 | sigma_sets S (algebra.restricted_space M S)" | |
| 42863 | 727 | proof - | 
| 728 | from S sigma_sets_into_sp[OF M] | |
| 47694 | 729 | have "S \<in> sigma_sets \<Omega> M" "S \<subseteq> \<Omega>" by auto | 
| 42863 | 730 | from sigma_sets_Int[OF this] | 
| 47694 | 731 | show ?thesis by simp | 
| 42863 | 732 | qed | 
| 733 | ||
| 42987 | 734 | lemma sigma_sets_vimage_commute: | 
| 47694 | 735 | assumes X: "X \<in> \<Omega> \<rightarrow> \<Omega>'" | 
| 736 |   shows "{X -` A \<inter> \<Omega> |A. A \<in> sigma_sets \<Omega>' M'}
 | |
| 737 |        = sigma_sets \<Omega> {X -` A \<inter> \<Omega> |A. A \<in> M'}" (is "?L = ?R")
 | |
| 42987 | 738 | proof | 
| 739 | show "?L \<subseteq> ?R" | |
| 740 | proof clarify | |
| 47694 | 741 | fix A assume "A \<in> sigma_sets \<Omega>' M'" | 
| 742 | then show "X -` A \<inter> \<Omega> \<in> ?R" | |
| 42987 | 743 | proof induct | 
| 744 | case Empty then show ?case | |
| 745 | by (auto intro!: sigma_sets.Empty) | |
| 746 | next | |
| 747 | case (Compl B) | |
| 47694 | 748 | have [simp]: "X -` (\<Omega>' - B) \<inter> \<Omega> = \<Omega> - (X -` B \<inter> \<Omega>)" | 
| 42987 | 749 | by (auto simp add: funcset_mem [OF X]) | 
| 750 | with Compl show ?case | |
| 751 | by (auto intro!: sigma_sets.Compl) | |
| 752 | next | |
| 753 | case (Union F) | |
| 754 | then show ?case | |
| 755 | by (auto simp add: vimage_UN UN_extend_simps(4) simp del: UN_simps | |
| 756 | intro!: sigma_sets.Union) | |
| 47694 | 757 | qed auto | 
| 42987 | 758 | qed | 
| 759 | show "?R \<subseteq> ?L" | |
| 760 | proof clarify | |
| 761 | fix A assume "A \<in> ?R" | |
| 47694 | 762 | then show "\<exists>B. A = X -` B \<inter> \<Omega> \<and> B \<in> sigma_sets \<Omega>' M'" | 
| 42987 | 763 | proof induct | 
| 764 | case (Basic B) then show ?case by auto | |
| 765 | next | |
| 766 | case Empty then show ?case | |
| 47694 | 767 |         by (auto intro!: sigma_sets.Empty exI[of _ "{}"])
 | 
| 42987 | 768 | next | 
| 769 | case (Compl B) | |
| 47694 | 770 | then obtain A where A: "B = X -` A \<inter> \<Omega>" "A \<in> sigma_sets \<Omega>' M'" by auto | 
| 771 | then have [simp]: "\<Omega> - B = X -` (\<Omega>' - A) \<inter> \<Omega>" | |
| 42987 | 772 | by (auto simp add: funcset_mem [OF X]) | 
| 773 | with A(2) show ?case | |
| 47694 | 774 | by (auto intro: sigma_sets.Compl) | 
| 42987 | 775 | next | 
| 776 | case (Union F) | |
| 47694 | 777 | then have "\<forall>i. \<exists>B. F i = X -` B \<inter> \<Omega> \<and> B \<in> sigma_sets \<Omega>' M'" by auto | 
| 74362 | 778 | then obtain A where "\<forall>x. F x = X -` A x \<inter> \<Omega> \<and> A x \<in> sigma_sets \<Omega>' M'" | 
| 779 | by metis | |
| 780 | then show ?case | |
| 47694 | 781 | by (auto simp: vimage_UN[symmetric] intro: sigma_sets.Union) | 
| 42987 | 782 | qed | 
| 783 | qed | |
| 784 | qed | |
| 785 | ||
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 786 | lemma (in ring_of_sets) UNION_in_sets: | 
| 38656 | 787 | fixes A:: "nat \<Rightarrow> 'a set" | 
| 47694 | 788 | assumes A: "range A \<subseteq> M" | 
| 789 |   shows  "(\<Union>i\<in>{0..<n}. A i) \<in> M"
 | |
| 38656 | 790 | proof (induct n) | 
| 791 | case 0 show ?case by simp | |
| 792 | next | |
| 793 | case (Suc n) | |
| 794 | thus ?case | |
| 795 | by (simp add: atLeastLessThanSuc) (metis A Un UNIV_I image_subset_iff) | |
| 796 | qed | |
| 797 | ||
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 798 | lemma (in ring_of_sets) range_disjointed_sets: | 
| 47694 | 799 | assumes A: "range A \<subseteq> M" | 
| 800 | shows "range (disjointed A) \<subseteq> M" | |
| 38656 | 801 | proof (auto simp add: disjointed_def) | 
| 802 | fix n | |
| 47694 | 803 |   show "A n - (\<Union>i\<in>{0..<n}. A i) \<in> M" using UNION_in_sets
 | 
| 38656 | 804 | by (metis A Diff UNIV_I image_subset_iff) | 
| 805 | qed | |
| 806 | ||
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 807 | lemma (in algebra) range_disjointed_sets': | 
| 47694 | 808 | "range A \<subseteq> M \<Longrightarrow> range (disjointed A) \<subseteq> M" | 
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 809 | using range_disjointed_sets . | 
| 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 810 | |
| 38656 | 811 | lemma sigma_algebra_disjoint_iff: | 
| 47694 | 812 | "sigma_algebra \<Omega> M \<longleftrightarrow> algebra \<Omega> M \<and> | 
| 813 | (\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> (\<Union>i::nat. A i) \<in> M)" | |
| 38656 | 814 | proof (auto simp add: sigma_algebra_iff) | 
| 815 | fix A :: "nat \<Rightarrow> 'a set" | |
| 47694 | 816 | assume M: "algebra \<Omega> M" | 
| 817 | and A: "range A \<subseteq> M" | |
| 818 | and UnA: "\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> (\<Union>i::nat. A i) \<in> M" | |
| 819 | hence "range (disjointed A) \<subseteq> M \<longrightarrow> | |
| 38656 | 820 | disjoint_family (disjointed A) \<longrightarrow> | 
| 47694 | 821 | (\<Union>i. disjointed A i) \<in> M" by blast | 
| 822 | hence "(\<Union>i. disjointed A i) \<in> M" | |
| 823 | by (simp add: algebra.range_disjointed_sets'[of \<Omega>] M A disjoint_family_disjointed) | |
| 824 | thus "(\<Union>i::nat. A i) \<in> M" by (simp add: UN_disjointed_eq) | |
| 825 | qed | |
| 826 | ||
| 70136 | 827 | subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Ring generated by a semiring\<close> | 
| 47762 | 828 | |
| 69554 | 829 | definition (in semiring_of_sets) generated_ring :: "'a set set" where | 
| 47762 | 830 |   "generated_ring = { \<Union>C | C. C \<subseteq> M \<and> finite C \<and> disjoint C }"
 | 
| 831 | ||
| 832 | lemma (in semiring_of_sets) generated_ringE[elim?]: | |
| 833 | assumes "a \<in> generated_ring" | |
| 834 | obtains C where "finite C" "disjoint C" "C \<subseteq> M" "a = \<Union>C" | |
| 835 | using assms unfolding generated_ring_def by auto | |
| 836 | ||
| 837 | lemma (in semiring_of_sets) generated_ringI[intro?]: | |
| 838 | assumes "finite C" "disjoint C" "C \<subseteq> M" "a = \<Union>C" | |
| 839 | shows "a \<in> generated_ring" | |
| 840 | using assms unfolding generated_ring_def by auto | |
| 841 | ||
| 842 | lemma (in semiring_of_sets) generated_ringI_Basic: | |
| 843 | "A \<in> M \<Longrightarrow> A \<in> generated_ring" | |
| 844 |   by (rule generated_ringI[of "{A}"]) (auto simp: disjoint_def)
 | |
| 845 | ||
| 846 | lemma (in semiring_of_sets) generated_ring_disjoint_Un[intro]: | |
| 847 | assumes a: "a \<in> generated_ring" and b: "b \<in> generated_ring" | |
| 848 |   and "a \<inter> b = {}"
 | |
| 849 | shows "a \<union> b \<in> generated_ring" | |
| 850 | proof - | |
| 74362 | 851 | from a b obtain Ca Cb | 
| 852 | where Ca: "finite Ca" "disjoint Ca" "Ca \<subseteq> M" "a = \<Union> Ca" | |
| 853 | and Cb: "finite Cb" "disjoint Cb" "Cb \<subseteq> M" "b = \<Union> Cb" | |
| 854 | using generated_ringE by metis | |
| 47762 | 855 | show ?thesis | 
| 856 | proof | |
| 74362 | 857 |     from \<open>a \<inter> b = {}\<close> Ca Cb show "disjoint (Ca \<union> Cb)"
 | 
| 858 | by (auto intro!: disjoint_union) | |
| 859 | qed (use Ca Cb in auto) | |
| 47762 | 860 | qed | 
| 861 | ||
| 862 | lemma (in semiring_of_sets) generated_ring_empty: "{} \<in> generated_ring"
 | |
| 863 | by (auto simp: generated_ring_def disjoint_def) | |
| 864 | ||
| 865 | lemma (in semiring_of_sets) generated_ring_disjoint_Union: | |
| 866 | assumes "finite A" shows "A \<subseteq> generated_ring \<Longrightarrow> disjoint A \<Longrightarrow> \<Union>A \<in> generated_ring" | |
| 867 | using assms by (induct A) (auto simp: disjoint_def intro!: generated_ring_disjoint_Un generated_ring_empty) | |
| 868 | ||
| 869 | lemma (in semiring_of_sets) generated_ring_disjoint_UNION: | |
| 69313 | 870 | "finite I \<Longrightarrow> disjoint (A ` I) \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> A i \<in> generated_ring) \<Longrightarrow> \<Union>(A ` I) \<in> generated_ring" | 
| 62343 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 haftmann parents: 
62083diff
changeset | 871 | by (intro generated_ring_disjoint_Union) auto | 
| 47762 | 872 | |
| 873 | lemma (in semiring_of_sets) generated_ring_Int: | |
| 874 | assumes a: "a \<in> generated_ring" and b: "b \<in> generated_ring" | |
| 875 | shows "a \<inter> b \<in> generated_ring" | |
| 876 | proof - | |
| 74362 | 877 | from a b obtain Ca Cb | 
| 878 | where Ca: "finite Ca" "disjoint Ca" "Ca \<subseteq> M" "a = \<Union> Ca" | |
| 879 | and Cb: "finite Cb" "disjoint Cb" "Cb \<subseteq> M" "b = \<Union> Cb" | |
| 880 | using generated_ringE by metis | |
| 63040 | 881 | define C where "C = (\<lambda>(a,b). a \<inter> b)` (Ca\<times>Cb)" | 
| 47762 | 882 | show ?thesis | 
| 883 | proof | |
| 884 | show "disjoint C" | |
| 885 | proof (simp add: disjoint_def C_def, intro ballI impI) | |
| 886 | fix a1 b1 a2 b2 assume sets: "a1 \<in> Ca" "b1 \<in> Cb" "a2 \<in> Ca" "b2 \<in> Cb" | |
| 887 | assume "a1 \<inter> b1 \<noteq> a2 \<inter> b2" | |
| 888 | then have "a1 \<noteq> a2 \<or> b1 \<noteq> b2" by auto | |
| 889 |       then show "(a1 \<inter> b1) \<inter> (a2 \<inter> b2) = {}"
 | |
| 890 | proof | |
| 891 | assume "a1 \<noteq> a2" | |
| 892 |         with sets Ca have "a1 \<inter> a2 = {}"
 | |
| 893 | by (auto simp: disjoint_def) | |
| 894 | then show ?thesis by auto | |
| 895 | next | |
| 896 | assume "b1 \<noteq> b2" | |
| 897 |         with sets Cb have "b1 \<inter> b2 = {}"
 | |
| 898 | by (auto simp: disjoint_def) | |
| 899 | then show ?thesis by auto | |
| 900 | qed | |
| 901 | qed | |
| 74362 | 902 | qed (use Ca Cb in \<open>auto simp: C_def\<close>) | 
| 47762 | 903 | qed | 
| 904 | ||
| 905 | lemma (in semiring_of_sets) generated_ring_Inter: | |
| 906 |   assumes "finite A" "A \<noteq> {}" shows "A \<subseteq> generated_ring \<Longrightarrow> \<Inter>A \<in> generated_ring"
 | |
| 907 | using assms by (induct A rule: finite_ne_induct) (auto intro: generated_ring_Int) | |
| 908 | ||
| 909 | lemma (in semiring_of_sets) generated_ring_INTER: | |
| 69313 | 910 |   "finite I \<Longrightarrow> I \<noteq> {} \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> A i \<in> generated_ring) \<Longrightarrow> \<Inter>(A ` I) \<in> generated_ring"
 | 
| 62343 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 haftmann parents: 
62083diff
changeset | 911 | by (intro generated_ring_Inter) auto | 
| 47762 | 912 | |
| 913 | lemma (in semiring_of_sets) generating_ring: | |
| 914 | "ring_of_sets \<Omega> generated_ring" | |
| 915 | proof (rule ring_of_setsI) | |
| 916 | let ?R = generated_ring | |
| 917 | show "?R \<subseteq> Pow \<Omega>" | |
| 918 | using sets_into_space by (auto simp: generated_ring_def generated_ring_empty) | |
| 919 |   show "{} \<in> ?R" by (rule generated_ring_empty)
 | |
| 920 | ||
| 74362 | 921 |   {
 | 
| 922 | fix a b assume "a \<in> ?R" "b \<in> ?R" | |
| 923 | then obtain Ca Cb | |
| 924 | where Ca: "finite Ca" "disjoint Ca" "Ca \<subseteq> M" "a = \<Union> Ca" | |
| 925 | and Cb: "finite Cb" "disjoint Cb" "Cb \<subseteq> M" "b = \<Union> Cb" | |
| 926 | using generated_ringE by metis | |
| 47762 | 927 | show "a - b \<in> ?R" | 
| 928 | proof cases | |
| 61808 | 929 |       assume "Cb = {}" with Cb \<open>a \<in> ?R\<close> show ?thesis
 | 
| 47762 | 930 | by simp | 
| 931 | next | |
| 932 |       assume "Cb \<noteq> {}"
 | |
| 933 | with Ca Cb have "a - b = (\<Union>a'\<in>Ca. \<Inter>b'\<in>Cb. a' - b')" by auto | |
| 934 | also have "\<dots> \<in> ?R" | |
| 935 | proof (intro generated_ring_INTER generated_ring_disjoint_UNION) | |
| 936 | fix a b assume "a \<in> Ca" "b \<in> Cb" | |
| 937 | with Ca Cb Diff_cover[of a b] show "a - b \<in> ?R" | |
| 938 | by (auto simp add: generated_ring_def) | |
| 62343 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 haftmann parents: 
62083diff
changeset | 939 | (metis DiffI Diff_eq_empty_iff empty_iff) | 
| 47762 | 940 | next | 
| 941 | show "disjoint ((\<lambda>a'. \<Inter>b'\<in>Cb. a' - b')`Ca)" | |
| 61808 | 942 |           using Ca by (auto simp add: disjoint_def \<open>Cb \<noteq> {}\<close>)
 | 
| 47762 | 943 | next | 
| 944 |         show "finite Ca" "finite Cb" "Cb \<noteq> {}" by fact+
 | |
| 945 | qed | |
| 946 | finally show "a - b \<in> ?R" . | |
| 74362 | 947 | qed | 
| 948 | } | |
| 47762 | 949 | note Diff = this | 
| 950 | ||
| 951 | fix a b assume sets: "a \<in> ?R" "b \<in> ?R" | |
| 952 | have "a \<union> b = (a - b) \<union> (a \<inter> b) \<union> (b - a)" by auto | |
| 953 | also have "\<dots> \<in> ?R" | |
| 954 | by (intro sets generated_ring_disjoint_Un generated_ring_Int Diff) auto | |
| 955 | finally show "a \<union> b \<in> ?R" . | |
| 956 | qed | |
| 957 | ||
| 958 | lemma (in semiring_of_sets) sigma_sets_generated_ring_eq: "sigma_sets \<Omega> generated_ring = sigma_sets \<Omega> M" | |
| 959 | proof | |
| 960 | interpret M: sigma_algebra \<Omega> "sigma_sets \<Omega> M" | |
| 961 | using space_closed by (rule sigma_algebra_sigma_sets) | |
| 962 | show "sigma_sets \<Omega> generated_ring \<subseteq> sigma_sets \<Omega> M" | |
| 963 | by (blast intro!: sigma_sets_mono elim: generated_ringE) | |
| 964 | qed (auto intro!: generated_ringI_Basic sigma_sets_mono) | |
| 965 | ||
| 70136 | 966 | subsubsection\<^marker>\<open>tag unimportant\<close> \<open>A Two-Element Series\<close> | 
| 38656 | 967 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 968 | definition binaryset :: "'a set \<Rightarrow> 'a set \<Rightarrow> nat \<Rightarrow> 'a set" | 
| 50252 | 969 |   where "binaryset A B = (\<lambda>x. {})(0 := A, Suc 0 := B)"
 | 
| 38656 | 970 | |
| 971 | lemma range_binaryset_eq: "range(binaryset A B) = {A,B,{}}"
 | |
| 972 | apply (simp add: binaryset_def) | |
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39092diff
changeset | 973 | apply (rule set_eqI) | 
| 38656 | 974 | apply (auto simp add: image_iff) | 
| 975 | done | |
| 976 | ||
| 977 | lemma UN_binaryset_eq: "(\<Union>i. binaryset A B i) = A \<union> B" | |
| 69546 
27dae626822b
prefer naming convention from datatype package for strong congruence rules
 haftmann parents: 
69313diff
changeset | 978 | by (simp add: range_binaryset_eq cong del: SUP_cong_simp) | 
| 38656 | 979 | |
| 61808 | 980 | subsubsection \<open>Closed CDI\<close> | 
| 38656 | 981 | |
| 70136 | 982 | definition\<^marker>\<open>tag important\<close> closed_cdi :: "'a set \<Rightarrow> 'a set set \<Rightarrow> bool" where | 
| 47694 | 983 | "closed_cdi \<Omega> M \<longleftrightarrow> | 
| 984 | M \<subseteq> Pow \<Omega> & | |
| 985 | (\<forall>s \<in> M. \<Omega> - s \<in> M) & | |
| 986 |    (\<forall>A. (range A \<subseteq> M) & (A 0 = {}) & (\<forall>n. A n \<subseteq> A (Suc n)) \<longrightarrow>
 | |
| 987 | (\<Union>i. A i) \<in> M) & | |
| 988 | (\<forall>A. (range A \<subseteq> M) & disjoint_family A \<longrightarrow> (\<Union>i::nat. A i) \<in> M)" | |
| 38656 | 989 | |
| 990 | inductive_set | |
| 47694 | 991 | smallest_ccdi_sets :: "'a set \<Rightarrow> 'a set set \<Rightarrow> 'a set set" | 
| 992 | for \<Omega> M | |
| 38656 | 993 | where | 
| 994 | Basic [intro]: | |
| 47694 | 995 | "a \<in> M \<Longrightarrow> a \<in> smallest_ccdi_sets \<Omega> M" | 
| 38656 | 996 | | Compl [intro]: | 
| 47694 | 997 | "a \<in> smallest_ccdi_sets \<Omega> M \<Longrightarrow> \<Omega> - a \<in> smallest_ccdi_sets \<Omega> M" | 
| 38656 | 998 | | Inc: | 
| 47694 | 999 |       "range A \<in> Pow(smallest_ccdi_sets \<Omega> M) \<Longrightarrow> A 0 = {} \<Longrightarrow> (\<And>n. A n \<subseteq> A (Suc n))
 | 
| 1000 | \<Longrightarrow> (\<Union>i. A i) \<in> smallest_ccdi_sets \<Omega> M" | |
| 38656 | 1001 | | Disj: | 
| 47694 | 1002 | "range A \<in> Pow(smallest_ccdi_sets \<Omega> M) \<Longrightarrow> disjoint_family A | 
| 1003 | \<Longrightarrow> (\<Union>i::nat. A i) \<in> smallest_ccdi_sets \<Omega> M" | |
| 38656 | 1004 | |
| 47694 | 1005 | lemma (in subset_class) smallest_closed_cdi1: "M \<subseteq> smallest_ccdi_sets \<Omega> M" | 
| 1006 | by auto | |
| 38656 | 1007 | |
| 47694 | 1008 | lemma (in subset_class) smallest_ccdi_sets: "smallest_ccdi_sets \<Omega> M \<subseteq> Pow \<Omega>" | 
| 38656 | 1009 | apply (rule subsetI) | 
| 1010 | apply (erule smallest_ccdi_sets.induct) | |
| 1011 | apply (auto intro: range_subsetD dest: sets_into_space) | |
| 1012 | done | |
| 1013 | ||
| 47694 | 1014 | lemma (in subset_class) smallest_closed_cdi2: "closed_cdi \<Omega> (smallest_ccdi_sets \<Omega> M)" | 
| 1015 | apply (auto simp add: closed_cdi_def smallest_ccdi_sets) | |
| 38656 | 1016 | apply (blast intro: smallest_ccdi_sets.Inc smallest_ccdi_sets.Disj) + | 
| 1017 | done | |
| 1018 | ||
| 47694 | 1019 | lemma closed_cdi_subset: "closed_cdi \<Omega> M \<Longrightarrow> M \<subseteq> Pow \<Omega>" | 
| 38656 | 1020 | by (simp add: closed_cdi_def) | 
| 1021 | ||
| 47694 | 1022 | lemma closed_cdi_Compl: "closed_cdi \<Omega> M \<Longrightarrow> s \<in> M \<Longrightarrow> \<Omega> - s \<in> M" | 
| 38656 | 1023 | by (simp add: closed_cdi_def) | 
| 1024 | ||
| 1025 | lemma closed_cdi_Inc: | |
| 47694 | 1026 |   "closed_cdi \<Omega> M \<Longrightarrow> range A \<subseteq> M \<Longrightarrow> A 0 = {} \<Longrightarrow> (!!n. A n \<subseteq> A (Suc n)) \<Longrightarrow> (\<Union>i. A i) \<in> M"
 | 
| 38656 | 1027 | by (simp add: closed_cdi_def) | 
| 1028 | ||
| 1029 | lemma closed_cdi_Disj: | |
| 47694 | 1030 | "closed_cdi \<Omega> M \<Longrightarrow> range A \<subseteq> M \<Longrightarrow> disjoint_family A \<Longrightarrow> (\<Union>i::nat. A i) \<in> M" | 
| 38656 | 1031 | by (simp add: closed_cdi_def) | 
| 1032 | ||
| 1033 | lemma closed_cdi_Un: | |
| 47694 | 1034 |   assumes cdi: "closed_cdi \<Omega> M" and empty: "{} \<in> M"
 | 
| 1035 | and A: "A \<in> M" and B: "B \<in> M" | |
| 38656 | 1036 |       and disj: "A \<inter> B = {}"
 | 
| 47694 | 1037 | shows "A \<union> B \<in> M" | 
| 38656 | 1038 | proof - | 
| 47694 | 1039 | have ra: "range (binaryset A B) \<subseteq> M" | 
| 38656 | 1040 | by (simp add: range_binaryset_eq empty A B) | 
| 1041 | have di: "disjoint_family (binaryset A B)" using disj | |
| 1042 | by (simp add: disjoint_family_on_def binaryset_def Int_commute) | |
| 1043 | from closed_cdi_Disj [OF cdi ra di] | |
| 1044 | show ?thesis | |
| 1045 | by (simp add: UN_binaryset_eq) | |
| 1046 | qed | |
| 1047 | ||
| 1048 | lemma (in algebra) smallest_ccdi_sets_Un: | |
| 47694 | 1049 | assumes A: "A \<in> smallest_ccdi_sets \<Omega> M" and B: "B \<in> smallest_ccdi_sets \<Omega> M" | 
| 38656 | 1050 |       and disj: "A \<inter> B = {}"
 | 
| 47694 | 1051 | shows "A \<union> B \<in> smallest_ccdi_sets \<Omega> M" | 
| 38656 | 1052 | proof - | 
| 47694 | 1053 | have ra: "range (binaryset A B) \<in> Pow (smallest_ccdi_sets \<Omega> M)" | 
| 38656 | 1054 | by (simp add: range_binaryset_eq A B smallest_ccdi_sets.Basic) | 
| 1055 | have di: "disjoint_family (binaryset A B)" using disj | |
| 1056 | by (simp add: disjoint_family_on_def binaryset_def Int_commute) | |
| 1057 | from Disj [OF ra di] | |
| 1058 | show ?thesis | |
| 1059 | by (simp add: UN_binaryset_eq) | |
| 1060 | qed | |
| 1061 | ||
| 1062 | lemma (in algebra) smallest_ccdi_sets_Int1: | |
| 47694 | 1063 | assumes a: "a \<in> M" | 
| 1064 | shows "b \<in> smallest_ccdi_sets \<Omega> M \<Longrightarrow> a \<inter> b \<in> smallest_ccdi_sets \<Omega> M" | |
| 38656 | 1065 | proof (induct rule: smallest_ccdi_sets.induct) | 
| 1066 | case (Basic x) | |
| 1067 | thus ?case | |
| 1068 | by (metis a Int smallest_ccdi_sets.Basic) | |
| 1069 | next | |
| 1070 | case (Compl x) | |
| 47694 | 1071 | have "a \<inter> (\<Omega> - x) = \<Omega> - ((\<Omega> - a) \<union> (a \<inter> x))" | 
| 38656 | 1072 | by blast | 
| 47694 | 1073 | also have "... \<in> smallest_ccdi_sets \<Omega> M" | 
| 38656 | 1074 | by (metis smallest_ccdi_sets.Compl a Compl(2) Diff_Int2 Diff_Int_distrib2 | 
| 47694 | 1075 | Diff_disjoint Int_Diff Int_empty_right smallest_ccdi_sets_Un | 
| 1076 | smallest_ccdi_sets.Basic smallest_ccdi_sets.Compl) | |
| 38656 | 1077 | finally show ?case . | 
| 1078 | next | |
| 1079 | case (Inc A) | |
| 1080 | have 1: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) = a \<inter> (\<Union>i. A i)" | |
| 1081 | by blast | |
| 47694 | 1082 | have "range (\<lambda>i. a \<inter> A i) \<in> Pow(smallest_ccdi_sets \<Omega> M)" using Inc | 
| 38656 | 1083 | by blast | 
| 1084 |   moreover have "(\<lambda>i. a \<inter> A i) 0 = {}"
 | |
| 1085 | by (simp add: Inc) | |
| 1086 | moreover have "!!n. (\<lambda>i. a \<inter> A i) n \<subseteq> (\<lambda>i. a \<inter> A i) (Suc n)" using Inc | |
| 1087 | by blast | |
| 47694 | 1088 | ultimately have 2: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) \<in> smallest_ccdi_sets \<Omega> M" | 
| 38656 | 1089 | by (rule smallest_ccdi_sets.Inc) | 
| 1090 | show ?case | |
| 1091 | by (metis 1 2) | |
| 1092 | next | |
| 1093 | case (Disj A) | |
| 1094 | have 1: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) = a \<inter> (\<Union>i. A i)" | |
| 1095 | by blast | |
| 47694 | 1096 | have "range (\<lambda>i. a \<inter> A i) \<in> Pow(smallest_ccdi_sets \<Omega> M)" using Disj | 
| 38656 | 1097 | by blast | 
| 1098 | moreover have "disjoint_family (\<lambda>i. a \<inter> A i)" using Disj | |
| 1099 | by (auto simp add: disjoint_family_on_def) | |
| 47694 | 1100 | ultimately have 2: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) \<in> smallest_ccdi_sets \<Omega> M" | 
| 38656 | 1101 | by (rule smallest_ccdi_sets.Disj) | 
| 1102 | show ?case | |
| 1103 | by (metis 1 2) | |
| 1104 | qed | |
| 1105 | ||
| 1106 | ||
| 1107 | lemma (in algebra) smallest_ccdi_sets_Int: | |
| 47694 | 1108 | assumes b: "b \<in> smallest_ccdi_sets \<Omega> M" | 
| 1109 | shows "a \<in> smallest_ccdi_sets \<Omega> M \<Longrightarrow> a \<inter> b \<in> smallest_ccdi_sets \<Omega> M" | |
| 38656 | 1110 | proof (induct rule: smallest_ccdi_sets.induct) | 
| 1111 | case (Basic x) | |
| 1112 | thus ?case | |
| 1113 | by (metis b smallest_ccdi_sets_Int1) | |
| 1114 | next | |
| 1115 | case (Compl x) | |
| 47694 | 1116 | have "(\<Omega> - x) \<inter> b = \<Omega> - (x \<inter> b \<union> (\<Omega> - b))" | 
| 38656 | 1117 | by blast | 
| 47694 | 1118 | also have "... \<in> smallest_ccdi_sets \<Omega> M" | 
| 38656 | 1119 | by (metis Compl(2) Diff_disjoint Int_Diff Int_commute Int_empty_right b | 
| 1120 | smallest_ccdi_sets.Compl smallest_ccdi_sets_Un) | |
| 1121 | finally show ?case . | |
| 1122 | next | |
| 1123 | case (Inc A) | |
| 1124 | have 1: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) = (\<Union>i. A i) \<inter> b" | |
| 1125 | by blast | |
| 47694 | 1126 | have "range (\<lambda>i. A i \<inter> b) \<in> Pow(smallest_ccdi_sets \<Omega> M)" using Inc | 
| 38656 | 1127 | by blast | 
| 1128 |   moreover have "(\<lambda>i. A i \<inter> b) 0 = {}"
 | |
| 1129 | by (simp add: Inc) | |
| 1130 | moreover have "!!n. (\<lambda>i. A i \<inter> b) n \<subseteq> (\<lambda>i. A i \<inter> b) (Suc n)" using Inc | |
| 1131 | by blast | |
| 47694 | 1132 | ultimately have 2: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) \<in> smallest_ccdi_sets \<Omega> M" | 
| 38656 | 1133 | by (rule smallest_ccdi_sets.Inc) | 
| 1134 | show ?case | |
| 1135 | by (metis 1 2) | |
| 1136 | next | |
| 1137 | case (Disj A) | |
| 1138 | have 1: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) = (\<Union>i. A i) \<inter> b" | |
| 1139 | by blast | |
| 47694 | 1140 | have "range (\<lambda>i. A i \<inter> b) \<in> Pow(smallest_ccdi_sets \<Omega> M)" using Disj | 
| 38656 | 1141 | by blast | 
| 1142 | moreover have "disjoint_family (\<lambda>i. A i \<inter> b)" using Disj | |
| 1143 | by (auto simp add: disjoint_family_on_def) | |
| 47694 | 1144 | ultimately have 2: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) \<in> smallest_ccdi_sets \<Omega> M" | 
| 38656 | 1145 | by (rule smallest_ccdi_sets.Disj) | 
| 1146 | show ?case | |
| 1147 | by (metis 1 2) | |
| 1148 | qed | |
| 1149 | ||
| 1150 | lemma (in algebra) sigma_property_disjoint_lemma: | |
| 47694 | 1151 | assumes sbC: "M \<subseteq> C" | 
| 1152 | and ccdi: "closed_cdi \<Omega> C" | |
| 1153 | shows "sigma_sets \<Omega> M \<subseteq> C" | |
| 38656 | 1154 | proof - | 
| 47694 | 1155 |   have "smallest_ccdi_sets \<Omega> M \<in> {B . M \<subseteq> B \<and> sigma_algebra \<Omega> B}"
 | 
| 38656 | 1156 | apply (auto simp add: sigma_algebra_disjoint_iff algebra_iff_Int | 
| 1157 | smallest_ccdi_sets_Int) | |
| 1158 | apply (metis Union_Pow_eq Union_upper subsetD smallest_ccdi_sets) | |
| 1159 | apply (blast intro: smallest_ccdi_sets.Disj) | |
| 1160 | done | |
| 47694 | 1161 | hence "sigma_sets (\<Omega>) (M) \<subseteq> smallest_ccdi_sets \<Omega> M" | 
| 38656 | 1162 | by clarsimp | 
| 47694 | 1163 | (drule sigma_algebra.sigma_sets_subset [where a="M"], auto) | 
| 38656 | 1164 | also have "... \<subseteq> C" | 
| 1165 | proof | |
| 1166 | fix x | |
| 47694 | 1167 | assume x: "x \<in> smallest_ccdi_sets \<Omega> M" | 
| 38656 | 1168 | thus "x \<in> C" | 
| 1169 | proof (induct rule: smallest_ccdi_sets.induct) | |
| 1170 | case (Basic x) | |
| 1171 | thus ?case | |
| 1172 | by (metis Basic subsetD sbC) | |
| 1173 | next | |
| 1174 | case (Compl x) | |
| 1175 | thus ?case | |
| 1176 | by (blast intro: closed_cdi_Compl [OF ccdi, simplified]) | |
| 1177 | next | |
| 1178 | case (Inc A) | |
| 1179 | thus ?case | |
| 1180 | by (auto intro: closed_cdi_Inc [OF ccdi, simplified]) | |
| 1181 | next | |
| 1182 | case (Disj A) | |
| 1183 | thus ?case | |
| 1184 | by (auto intro: closed_cdi_Disj [OF ccdi, simplified]) | |
| 1185 | qed | |
| 1186 | qed | |
| 1187 | finally show ?thesis . | |
| 1188 | qed | |
| 1189 | ||
| 1190 | lemma (in algebra) sigma_property_disjoint: | |
| 47694 | 1191 | assumes sbC: "M \<subseteq> C" | 
| 1192 | and compl: "!!s. s \<in> C \<inter> sigma_sets (\<Omega>) (M) \<Longrightarrow> \<Omega> - s \<in> C" | |
| 1193 | and inc: "!!A. range A \<subseteq> C \<inter> sigma_sets (\<Omega>) (M) | |
| 38656 | 1194 |                      \<Longrightarrow> A 0 = {} \<Longrightarrow> (!!n. A n \<subseteq> A (Suc n))
 | 
| 1195 | \<Longrightarrow> (\<Union>i. A i) \<in> C" | |
| 47694 | 1196 | and disj: "!!A. range A \<subseteq> C \<inter> sigma_sets (\<Omega>) (M) | 
| 38656 | 1197 | \<Longrightarrow> disjoint_family A \<Longrightarrow> (\<Union>i::nat. A i) \<in> C" | 
| 47694 | 1198 | shows "sigma_sets (\<Omega>) (M) \<subseteq> C" | 
| 38656 | 1199 | proof - | 
| 47694 | 1200 | have "sigma_sets (\<Omega>) (M) \<subseteq> C \<inter> sigma_sets (\<Omega>) (M)" | 
| 38656 | 1201 | proof (rule sigma_property_disjoint_lemma) | 
| 47694 | 1202 | show "M \<subseteq> C \<inter> sigma_sets (\<Omega>) (M)" | 
| 38656 | 1203 | by (metis Int_greatest Set.subsetI sbC sigma_sets.Basic) | 
| 1204 | next | |
| 47694 | 1205 | show "closed_cdi \<Omega> (C \<inter> sigma_sets (\<Omega>) (M))" | 
| 38656 | 1206 | by (simp add: closed_cdi_def compl inc disj) | 
| 1207 | (metis PowI Set.subsetI le_infI2 sigma_sets_into_sp space_closed | |
| 1208 | IntE sigma_sets.Compl range_subsetD sigma_sets.Union) | |
| 1209 | qed | |
| 1210 | thus ?thesis | |
| 1211 | by blast | |
| 1212 | qed | |
| 1213 | ||
| 61808 | 1214 | subsubsection \<open>Dynkin systems\<close> | 
| 40859 | 1215 | |
| 70136 | 1216 | locale\<^marker>\<open>tag important\<close> Dynkin_system = subset_class + | 
| 47694 | 1217 | assumes space: "\<Omega> \<in> M" | 
| 1218 | and compl[intro!]: "\<And>A. A \<in> M \<Longrightarrow> \<Omega> - A \<in> M" | |
| 1219 | and UN[intro!]: "\<And>A. disjoint_family A \<Longrightarrow> range A \<subseteq> M | |
| 1220 | \<Longrightarrow> (\<Union>i::nat. A i) \<in> M" | |
| 40859 | 1221 | |
| 69555 | 1222 | lemma (in Dynkin_system) empty[intro, simp]: "{} \<in> M"
 | 
| 47694 | 1223 | using space compl[of "\<Omega>"] by simp | 
| 40859 | 1224 | |
| 69555 | 1225 | lemma (in Dynkin_system) diff: | 
| 47694 | 1226 | assumes sets: "D \<in> M" "E \<in> M" and "D \<subseteq> E" | 
| 1227 | shows "E - D \<in> M" | |
| 40859 | 1228 | proof - | 
| 47694 | 1229 |   let ?f = "\<lambda>x. if x = 0 then D else if x = Suc 0 then \<Omega> - E else {}"
 | 
| 1230 |   have "range ?f = {D, \<Omega> - E, {}}"
 | |
| 40859 | 1231 | by (auto simp: image_iff) | 
| 47694 | 1232 | moreover have "D \<union> (\<Omega> - E) = (\<Union>i. ?f i)" | 
| 62390 | 1233 | by (auto simp: image_iff split: if_split_asm) | 
| 40859 | 1234 | moreover | 
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
51683diff
changeset | 1235 | have "disjoint_family ?f" unfolding disjoint_family_on_def | 
| 61808 | 1236 | using \<open>D \<in> M\<close>[THEN sets_into_space] \<open>D \<subseteq> E\<close> by auto | 
| 47694 | 1237 | ultimately have "\<Omega> - (D \<union> (\<Omega> - E)) \<in> M" | 
| 69768 | 1238 | using sets UN by auto fastforce | 
| 47694 | 1239 | also have "\<Omega> - (D \<union> (\<Omega> - E)) = E - D" | 
| 40859 | 1240 | using assms sets_into_space by auto | 
| 1241 | finally show ?thesis . | |
| 1242 | qed | |
| 1243 | ||
| 69555 | 1244 | lemma Dynkin_systemI: | 
| 47694 | 1245 | assumes "\<And> A. A \<in> M \<Longrightarrow> A \<subseteq> \<Omega>" "\<Omega> \<in> M" | 
| 1246 | assumes "\<And> A. A \<in> M \<Longrightarrow> \<Omega> - A \<in> M" | |
| 1247 | assumes "\<And> A. disjoint_family A \<Longrightarrow> range A \<subseteq> M | |
| 1248 | \<Longrightarrow> (\<Union>i::nat. A i) \<in> M" | |
| 69555 | 1249 | shows "Dynkin_system \<Omega> M" | 
| 1250 | using assms by (auto simp: Dynkin_system_def Dynkin_system_axioms_def subset_class_def) | |
| 40859 | 1251 | |
| 69555 | 1252 | lemma Dynkin_systemI': | 
| 47694 | 1253 | assumes 1: "\<And> A. A \<in> M \<Longrightarrow> A \<subseteq> \<Omega>" | 
| 1254 |   assumes empty: "{} \<in> M"
 | |
| 1255 | assumes Diff: "\<And> A. A \<in> M \<Longrightarrow> \<Omega> - A \<in> M" | |
| 1256 | assumes 2: "\<And> A. disjoint_family A \<Longrightarrow> range A \<subseteq> M | |
| 1257 | \<Longrightarrow> (\<Union>i::nat. A i) \<in> M" | |
| 69555 | 1258 | shows "Dynkin_system \<Omega> M" | 
| 42988 | 1259 | proof - | 
| 47694 | 1260 | from Diff[OF empty] have "\<Omega> \<in> M" by auto | 
| 42988 | 1261 | from 1 this Diff 2 show ?thesis | 
| 69555 | 1262 | by (intro Dynkin_systemI) auto | 
| 42988 | 1263 | qed | 
| 1264 | ||
| 69555 | 1265 | lemma Dynkin_system_trivial: | 
| 1266 | shows "Dynkin_system A (Pow A)" | |
| 1267 | by (rule Dynkin_systemI) auto | |
| 40859 | 1268 | |
| 69555 | 1269 | lemma sigma_algebra_imp_Dynkin_system: | 
| 1270 | assumes "sigma_algebra \<Omega> M" shows "Dynkin_system \<Omega> M" | |
| 40859 | 1271 | proof - | 
| 47694 | 1272 | interpret sigma_algebra \<Omega> M by fact | 
| 69555 | 1273 | show ?thesis using sets_into_space by (fastforce intro!: Dynkin_systemI) | 
| 40859 | 1274 | qed | 
| 1275 | ||
| 56994 | 1276 | subsubsection "Intersection sets systems" | 
| 40859 | 1277 | |
| 70136 | 1278 | definition\<^marker>\<open>tag important\<close> Int_stable :: "'a set set \<Rightarrow> bool" where | 
| 69554 | 1279 | "Int_stable M \<longleftrightarrow> (\<forall> a \<in> M. \<forall> b \<in> M. a \<inter> b \<in> M)" | 
| 40859 | 1280 | |
| 1281 | lemma (in algebra) Int_stable: "Int_stable M" | |
| 1282 | unfolding Int_stable_def by auto | |
| 1283 | ||
| 64008 
17a20ca86d62
HOL-Probability: more about probability, prepare for Markov processes in the AFP
 hoelzl parents: 
63627diff
changeset | 1284 | lemma Int_stableI_image: | 
| 
17a20ca86d62
HOL-Probability: more about probability, prepare for Markov processes in the AFP
 hoelzl parents: 
63627diff
changeset | 1285 | "(\<And>i j. i \<in> I \<Longrightarrow> j \<in> I \<Longrightarrow> \<exists>k\<in>I. A i \<inter> A j = A k) \<Longrightarrow> Int_stable (A ` I)" | 
| 
17a20ca86d62
HOL-Probability: more about probability, prepare for Markov processes in the AFP
 hoelzl parents: 
63627diff
changeset | 1286 | by (auto simp: Int_stable_def image_def) | 
| 
17a20ca86d62
HOL-Probability: more about probability, prepare for Markov processes in the AFP
 hoelzl parents: 
63627diff
changeset | 1287 | |
| 42981 | 1288 | lemma Int_stableI: | 
| 47694 | 1289 | "(\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> a \<inter> b \<in> A) \<Longrightarrow> Int_stable A" | 
| 42981 | 1290 | unfolding Int_stable_def by auto | 
| 1291 | ||
| 1292 | lemma Int_stableD: | |
| 47694 | 1293 | "Int_stable M \<Longrightarrow> a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> a \<inter> b \<in> M" | 
| 42981 | 1294 | unfolding Int_stable_def by auto | 
| 1295 | ||
| 69555 | 1296 | lemma (in Dynkin_system) sigma_algebra_eq_Int_stable: | 
| 47694 | 1297 | "sigma_algebra \<Omega> M \<longleftrightarrow> Int_stable M" | 
| 40859 | 1298 | proof | 
| 47694 | 1299 | assume "sigma_algebra \<Omega> M" then show "Int_stable M" | 
| 40859 | 1300 | unfolding sigma_algebra_def using algebra.Int_stable by auto | 
| 1301 | next | |
| 1302 | assume "Int_stable M" | |
| 47694 | 1303 | show "sigma_algebra \<Omega> M" | 
| 42065 
2b98b4c2e2f1
add ring_of_sets and subset_class as basis for algebra
 hoelzl parents: 
41983diff
changeset | 1304 | unfolding sigma_algebra_disjoint_iff algebra_iff_Un | 
| 40859 | 1305 | proof (intro conjI ballI allI impI) | 
| 47694 | 1306 | show "M \<subseteq> Pow (\<Omega>)" using sets_into_space by auto | 
| 40859 | 1307 | next | 
| 47694 | 1308 | fix A B assume "A \<in> M" "B \<in> M" | 
| 1309 | then have "A \<union> B = \<Omega> - ((\<Omega> - A) \<inter> (\<Omega> - B))" | |
| 1310 | "\<Omega> - A \<in> M" "\<Omega> - B \<in> M" | |
| 40859 | 1311 | using sets_into_space by auto | 
| 47694 | 1312 | then show "A \<union> B \<in> M" | 
| 61808 | 1313 | using \<open>Int_stable M\<close> unfolding Int_stable_def by auto | 
| 40859 | 1314 | qed auto | 
| 1315 | qed | |
| 1316 | ||
| 56994 | 1317 | subsubsection "Smallest Dynkin systems" | 
| 40859 | 1318 | |
| 70136 | 1319 | definition\<^marker>\<open>tag important\<close> Dynkin :: "'a set \<Rightarrow> 'a set set \<Rightarrow> 'a set set" where | 
| 69555 | 1320 |   "Dynkin \<Omega> M =  (\<Inter>{D. Dynkin_system \<Omega> D \<and> M \<subseteq> D})"
 | 
| 40859 | 1321 | |
| 69555 | 1322 | lemma Dynkin_system_Dynkin: | 
| 47694 | 1323 | assumes "M \<subseteq> Pow (\<Omega>)" | 
| 69555 | 1324 | shows "Dynkin_system \<Omega> (Dynkin \<Omega> M)" | 
| 1325 | proof (rule Dynkin_systemI) | |
| 1326 | fix A assume "A \<in> Dynkin \<Omega> M" | |
| 40859 | 1327 | moreover | 
| 69555 | 1328 |   { fix D assume "A \<in> D" and d: "Dynkin_system \<Omega> D"
 | 
| 1329 | then have "A \<subseteq> \<Omega>" by (auto simp: Dynkin_system_def subset_class_def) } | |
| 1330 |   moreover have "{D. Dynkin_system \<Omega> D \<and> M \<subseteq> D} \<noteq> {}"
 | |
| 1331 | using assms Dynkin_system_trivial by fastforce | |
| 47694 | 1332 | ultimately show "A \<subseteq> \<Omega>" | 
| 69555 | 1333 | unfolding Dynkin_def using assms | 
| 47694 | 1334 | by auto | 
| 40859 | 1335 | next | 
| 69555 | 1336 | show "\<Omega> \<in> Dynkin \<Omega> M" | 
| 1337 | unfolding Dynkin_def using Dynkin_system.space by fastforce | |
| 40859 | 1338 | next | 
| 69555 | 1339 | fix A assume "A \<in> Dynkin \<Omega> M" | 
| 1340 | then show "\<Omega> - A \<in> Dynkin \<Omega> M" | |
| 1341 | unfolding Dynkin_def using Dynkin_system.compl by force | |
| 40859 | 1342 | next | 
| 1343 | fix A :: "nat \<Rightarrow> 'a set" | |
| 69555 | 1344 | assume A: "disjoint_family A" "range A \<subseteq> Dynkin \<Omega> M" | 
| 1345 | show "(\<Union>i. A i) \<in> Dynkin \<Omega> M" unfolding Dynkin_def | |
| 40859 | 1346 | proof (simp, safe) | 
| 69555 | 1347 | fix D assume "Dynkin_system \<Omega> D" "M \<subseteq> D" | 
| 47694 | 1348 | with A have "(\<Union>i. A i) \<in> D" | 
| 69555 | 1349 | by (intro Dynkin_system.UN) (auto simp: Dynkin_def) | 
| 40859 | 1350 | then show "(\<Union>i. A i) \<in> D" by auto | 
| 1351 | qed | |
| 1352 | qed | |
| 1353 | ||
| 69555 | 1354 | lemma Dynkin_Basic[intro]: "A \<in> M \<Longrightarrow> A \<in> Dynkin \<Omega> M" | 
| 1355 | unfolding Dynkin_def by auto | |
| 40859 | 1356 | |
| 69555 | 1357 | lemma (in Dynkin_system) restricted_Dynkin_system: | 
| 47694 | 1358 | assumes "D \<in> M" | 
| 69555 | 1359 |   shows "Dynkin_system \<Omega> {Q. Q \<subseteq> \<Omega> \<and> Q \<inter> D \<in> M}"
 | 
| 1360 | proof (rule Dynkin_systemI, simp_all) | |
| 47694 | 1361 | have "\<Omega> \<inter> D = D" | 
| 61808 | 1362 | using \<open>D \<in> M\<close> sets_into_space by auto | 
| 47694 | 1363 | then show "\<Omega> \<inter> D \<in> M" | 
| 61808 | 1364 | using \<open>D \<in> M\<close> by auto | 
| 40859 | 1365 | next | 
| 47694 | 1366 | fix A assume "A \<subseteq> \<Omega> \<and> A \<inter> D \<in> M" | 
| 1367 | moreover have "(\<Omega> - A) \<inter> D = (\<Omega> - (A \<inter> D)) - (\<Omega> - D)" | |
| 40859 | 1368 | by auto | 
| 69284 | 1369 | ultimately show "(\<Omega> - A) \<inter> D \<in> M" | 
| 61808 | 1370 | using \<open>D \<in> M\<close> by (auto intro: diff) | 
| 40859 | 1371 | next | 
| 1372 | fix A :: "nat \<Rightarrow> 'a set" | |
| 47694 | 1373 |   assume "disjoint_family A" "range A \<subseteq> {Q. Q \<subseteq> \<Omega> \<and> Q \<inter> D \<in> M}"
 | 
| 1374 | then have "\<And>i. A i \<subseteq> \<Omega>" "disjoint_family (\<lambda>i. A i \<inter> D)" | |
| 1375 | "range (\<lambda>i. A i \<inter> D) \<subseteq> M" "(\<Union>x. A x) \<inter> D = (\<Union>x. A x \<inter> D)" | |
| 44890 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 nipkow parents: 
44537diff
changeset | 1376 | by ((fastforce simp: disjoint_family_on_def)+) | 
| 47694 | 1377 | then show "(\<Union>x. A x) \<subseteq> \<Omega> \<and> (\<Union>x. A x) \<inter> D \<in> M" | 
| 40859 | 1378 | by (auto simp del: UN_simps) | 
| 1379 | qed | |
| 1380 | ||
| 69555 | 1381 | lemma (in Dynkin_system) Dynkin_subset: | 
| 47694 | 1382 | assumes "N \<subseteq> M" | 
| 69555 | 1383 | shows "Dynkin \<Omega> N \<subseteq> M" | 
| 40859 | 1384 | proof - | 
| 69555 | 1385 | have "Dynkin_system \<Omega> M" .. | 
| 1386 | then have "Dynkin_system \<Omega> M" | |
| 1387 | using assms unfolding Dynkin_system_def Dynkin_system_axioms_def subset_class_def by simp | |
| 1388 | with \<open>N \<subseteq> M\<close> show ?thesis by (auto simp add: Dynkin_def) | |
| 40859 | 1389 | qed | 
| 1390 | ||
| 69555 | 1391 | lemma sigma_eq_Dynkin: | 
| 47694 | 1392 | assumes sets: "M \<subseteq> Pow \<Omega>" | 
| 40859 | 1393 | assumes "Int_stable M" | 
| 69555 | 1394 | shows "sigma_sets \<Omega> M = Dynkin \<Omega> M" | 
| 40859 | 1395 | proof - | 
| 69555 | 1396 | have "Dynkin \<Omega> M \<subseteq> sigma_sets (\<Omega>) (M)" | 
| 1397 | using sigma_algebra_imp_Dynkin_system | |
| 1398 | unfolding Dynkin_def sigma_sets_least_sigma_algebra[OF sets] by auto | |
| 40859 | 1399 | moreover | 
| 69555 | 1400 | interpret Dynkin_system \<Omega> "Dynkin \<Omega> M" | 
| 1401 | using Dynkin_system_Dynkin[OF sets] . | |
| 1402 | have "sigma_algebra \<Omega> (Dynkin \<Omega> M)" | |
| 40859 | 1403 | unfolding sigma_algebra_eq_Int_stable Int_stable_def | 
| 1404 | proof (intro ballI) | |
| 69555 | 1405 | fix A B assume "A \<in> Dynkin \<Omega> M" "B \<in> Dynkin \<Omega> M" | 
| 1406 |     let ?D = "\<lambda>E. {Q. Q \<subseteq> \<Omega> \<and> Q \<inter> E \<in> Dynkin \<Omega> M}"
 | |
| 47694 | 1407 | have "M \<subseteq> ?D B" | 
| 40859 | 1408 | proof | 
| 47694 | 1409 | fix E assume "E \<in> M" | 
| 69555 | 1410 | then have "M \<subseteq> ?D E" "E \<in> Dynkin \<Omega> M" | 
| 61808 | 1411 | using sets_into_space \<open>Int_stable M\<close> by (auto simp: Int_stable_def) | 
| 69555 | 1412 | then have "Dynkin \<Omega> M \<subseteq> ?D E" | 
| 1413 | using restricted_Dynkin_system \<open>E \<in> Dynkin \<Omega> M\<close> | |
| 1414 | by (intro Dynkin_system.Dynkin_subset) simp_all | |
| 47694 | 1415 | then have "B \<in> ?D E" | 
| 69555 | 1416 | using \<open>B \<in> Dynkin \<Omega> M\<close> by auto | 
| 1417 | then have "E \<inter> B \<in> Dynkin \<Omega> M" | |
| 40859 | 1418 | by (subst Int_commute) simp | 
| 47694 | 1419 | then show "E \<in> ?D B" | 
| 61808 | 1420 | using sets \<open>E \<in> M\<close> by auto | 
| 40859 | 1421 | qed | 
| 69555 | 1422 | then have "Dynkin \<Omega> M \<subseteq> ?D B" | 
| 1423 | using restricted_Dynkin_system \<open>B \<in> Dynkin \<Omega> M\<close> | |
| 1424 | by (intro Dynkin_system.Dynkin_subset) simp_all | |
| 1425 | then show "A \<inter> B \<in> Dynkin \<Omega> M" | |
| 1426 | using \<open>A \<in> Dynkin \<Omega> M\<close> sets_into_space by auto | |
| 40859 | 1427 | qed | 
| 47694 | 1428 | from sigma_algebra.sigma_sets_subset[OF this, of "M"] | 
| 69555 | 1429 | have "sigma_sets (\<Omega>) (M) \<subseteq> Dynkin \<Omega> M" by auto | 
| 1430 | ultimately have "sigma_sets (\<Omega>) (M) = Dynkin \<Omega> M" by auto | |
| 40859 | 1431 | then show ?thesis | 
| 69555 | 1432 | by (auto simp: Dynkin_def) | 
| 40859 | 1433 | qed | 
| 1434 | ||
| 69555 | 1435 | lemma (in Dynkin_system) Dynkin_idem: | 
| 1436 | "Dynkin \<Omega> M = M" | |
| 40859 | 1437 | proof - | 
| 69555 | 1438 | have "Dynkin \<Omega> M = M" | 
| 40859 | 1439 | proof | 
| 69555 | 1440 | show "M \<subseteq> Dynkin \<Omega> M" | 
| 1441 | using Dynkin_Basic by auto | |
| 1442 | show "Dynkin \<Omega> M \<subseteq> M" | |
| 1443 | by (intro Dynkin_subset) auto | |
| 40859 | 1444 | qed | 
| 1445 | then show ?thesis | |
| 69555 | 1446 | by (auto simp: Dynkin_def) | 
| 40859 | 1447 | qed | 
| 1448 | ||
| 69555 | 1449 | lemma (in Dynkin_system) Dynkin_lemma: | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41543diff
changeset | 1450 | assumes "Int_stable E" | 
| 47694 | 1451 | and E: "E \<subseteq> M" "M \<subseteq> sigma_sets \<Omega> E" | 
| 1452 | shows "sigma_sets \<Omega> E = M" | |
| 40859 | 1453 | proof - | 
| 47694 | 1454 | have "E \<subseteq> Pow \<Omega>" | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41543diff
changeset | 1455 | using E sets_into_space by force | 
| 69555 | 1456 | then have *: "sigma_sets \<Omega> E = Dynkin \<Omega> E" | 
| 1457 | using \<open>Int_stable E\<close> by (rule sigma_eq_Dynkin) | |
| 1458 | then have "Dynkin \<Omega> E = M" | |
| 1459 | using assms Dynkin_subset[OF E(1)] by simp | |
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
51683diff
changeset | 1460 | with * show ?thesis | 
| 69555 | 1461 | using assms by (auto simp: Dynkin_def) | 
| 42864 | 1462 | qed | 
| 1463 | ||
| 61808 | 1464 | subsubsection \<open>Induction rule for intersection-stable generators\<close> | 
| 56994 | 1465 | |
| 70136 | 1466 | text\<^marker>\<open>tag important\<close> \<open>The reason to introduce Dynkin-systems is the following induction rules for \<open>\<sigma>\<close>-algebras | 
| 61808 | 1467 | generated by a generator closed under intersection.\<close> | 
| 56994 | 1468 | |
| 68607 
67bb59e49834
make theorem, corollary, and proposition %important for HOL-Analysis manual
 immler parents: 
68403diff
changeset | 1469 | proposition sigma_sets_induct_disjoint[consumes 3, case_names basic empty compl union]: | 
| 49789 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1470 | assumes "Int_stable G" | 
| 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1471 | and closed: "G \<subseteq> Pow \<Omega>" | 
| 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1472 | and A: "A \<in> sigma_sets \<Omega> G" | 
| 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1473 | assumes basic: "\<And>A. A \<in> G \<Longrightarrow> P A" | 
| 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1474 |     and empty: "P {}"
 | 
| 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1475 | and compl: "\<And>A. A \<in> sigma_sets \<Omega> G \<Longrightarrow> P A \<Longrightarrow> P (\<Omega> - A)" | 
| 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1476 | and union: "\<And>A. disjoint_family A \<Longrightarrow> range A \<subseteq> sigma_sets \<Omega> G \<Longrightarrow> (\<And>i. P (A i)) \<Longrightarrow> P (\<Union>i::nat. A i)" | 
| 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1477 | shows "P A" | 
| 68607 
67bb59e49834
make theorem, corollary, and proposition %important for HOL-Analysis manual
 immler parents: 
68403diff
changeset | 1478 | proof - | 
| 49789 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1479 |   let ?D = "{ A \<in> sigma_sets \<Omega> G. P A }"
 | 
| 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1480 | interpret sigma_algebra \<Omega> "sigma_sets \<Omega> G" | 
| 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1481 | using closed by (rule sigma_algebra_sigma_sets) | 
| 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1482 | from compl[OF _ empty] closed have space: "P \<Omega>" by simp | 
| 69555 | 1483 | interpret Dynkin_system \<Omega> ?D | 
| 61169 | 1484 | by standard (auto dest: sets_into_space intro!: space compl union) | 
| 49789 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1485 | have "sigma_sets \<Omega> G = ?D" | 
| 69555 | 1486 | by (rule Dynkin_lemma) (auto simp: basic \<open>Int_stable G\<close>) | 
| 49789 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1487 | with A show ?thesis by auto | 
| 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1488 | qed | 
| 
e0a4cb91a8a9
add induction rule for intersection-stable sigma-sets
 hoelzl parents: 
49782diff
changeset | 1489 | |
| 61808 | 1490 | subsection \<open>Measure type\<close> | 
| 56994 | 1491 | |
| 70136 | 1492 | definition\<^marker>\<open>tag important\<close> positive :: "'a set set \<Rightarrow> ('a set \<Rightarrow> ennreal) \<Rightarrow> bool" where
 | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1493 |   "positive M \<mu> \<longleftrightarrow> \<mu> {} = 0"
 | 
| 56994 | 1494 | |
| 70136 | 1495 | definition\<^marker>\<open>tag important\<close> countably_additive :: "'a set set \<Rightarrow> ('a set \<Rightarrow> ennreal) \<Rightarrow> bool" where
 | 
| 69554 | 1496 | "countably_additive M f \<longleftrightarrow> | 
| 1497 | (\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> (\<Union>i. A i) \<in> M \<longrightarrow> | |
| 56994 | 1498 | (\<Sum>i. f (A i)) = f (\<Union>i. A i))" | 
| 1499 | ||
| 70136 | 1500 | definition\<^marker>\<open>tag important\<close> measure_space :: "'a set \<Rightarrow> 'a set set \<Rightarrow> ('a set \<Rightarrow> ennreal) \<Rightarrow> bool" where
 | 
| 69554 | 1501 | "measure_space \<Omega> A \<mu> \<longleftrightarrow> | 
| 1502 | sigma_algebra \<Omega> A \<and> positive A \<mu> \<and> countably_additive A \<mu>" | |
| 56994 | 1503 | |
| 70136 | 1504 | typedef\<^marker>\<open>tag important\<close> 'a measure = | 
| 69554 | 1505 |   "{(\<Omega>::'a set, A, \<mu>). (\<forall>a\<in>-A. \<mu> a = 0) \<and> measure_space \<Omega> A \<mu> }"
 | 
| 70136 | 1506 | proof | 
| 56994 | 1507 |   have "sigma_algebra UNIV {{}, UNIV}"
 | 
| 1508 | by (auto simp: sigma_algebra_iff2) | |
| 1509 |   then show "(UNIV, {{}, UNIV}, \<lambda>A. 0) \<in> {(\<Omega>, A, \<mu>). (\<forall>a\<in>-A. \<mu> a = 0) \<and> measure_space \<Omega> A \<mu>} "
 | |
| 1510 | by (auto simp: measure_space_def positive_def countably_additive_def) | |
| 1511 | qed | |
| 1512 | ||
| 70136 | 1513 | definition\<^marker>\<open>tag important\<close> space :: "'a measure \<Rightarrow> 'a set" where | 
| 56994 | 1514 | "space M = fst (Rep_measure M)" | 
| 1515 | ||
| 70136 | 1516 | definition\<^marker>\<open>tag important\<close> sets :: "'a measure \<Rightarrow> 'a set set" where | 
| 56994 | 1517 | "sets M = fst (snd (Rep_measure M))" | 
| 1518 | ||
| 70136 | 1519 | definition\<^marker>\<open>tag important\<close> emeasure :: "'a measure \<Rightarrow> 'a set \<Rightarrow> ennreal" where | 
| 56994 | 1520 | "emeasure M = snd (snd (Rep_measure M))" | 
| 1521 | ||
| 70136 | 1522 | definition\<^marker>\<open>tag important\<close> measure :: "'a measure \<Rightarrow> 'a set \<Rightarrow> real" where | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1523 | "measure M A = enn2real (emeasure M A)" | 
| 56994 | 1524 | |
| 1525 | declare [[coercion sets]] | |
| 1526 | ||
| 1527 | declare [[coercion measure]] | |
| 1528 | ||
| 1529 | declare [[coercion emeasure]] | |
| 1530 | ||
| 1531 | lemma measure_space: "measure_space (space M) (sets M) (emeasure M)" | |
| 1532 | by (cases M) (auto simp: space_def sets_def emeasure_def Abs_measure_inverse) | |
| 1533 | ||
| 61605 | 1534 | interpretation sets: sigma_algebra "space M" "sets M" for M :: "'a measure" | 
| 56994 | 1535 | using measure_space[of M] by (auto simp: measure_space_def) | 
| 1536 | ||
| 70136 | 1537 | definition\<^marker>\<open>tag important\<close> measure_of :: "'a set \<Rightarrow> 'a set set \<Rightarrow> ('a set \<Rightarrow> ennreal) \<Rightarrow> 'a measure"
 | 
| 69554 | 1538 | where | 
| 1539 | "measure_of \<Omega> A \<mu> = | |
| 1540 |   Abs_measure (\<Omega>, if A \<subseteq> Pow \<Omega> then sigma_sets \<Omega> A else {{}, \<Omega>},
 | |
| 56994 | 1541 | \<lambda>a. if a \<in> sigma_sets \<Omega> A \<and> measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> then \<mu> a else 0)" | 
| 1542 | ||
| 1543 | abbreviation "sigma \<Omega> A \<equiv> measure_of \<Omega> A (\<lambda>x. 0)" | |
| 1544 | ||
| 1545 | lemma measure_space_0: "A \<subseteq> Pow \<Omega> \<Longrightarrow> measure_space \<Omega> (sigma_sets \<Omega> A) (\<lambda>x. 0)" | |
| 1546 | unfolding measure_space_def | |
| 1547 | by (auto intro!: sigma_algebra_sigma_sets simp: positive_def countably_additive_def) | |
| 1548 | ||
| 1549 | lemma sigma_algebra_trivial: "sigma_algebra \<Omega> {{}, \<Omega>}"
 | |
| 1550 | by unfold_locales(fastforce intro: exI[where x="{{}}"] exI[where x="{\<Omega>}"])+
 | |
| 1551 | ||
| 1552 | lemma measure_space_0': "measure_space \<Omega> {{}, \<Omega>} (\<lambda>x. 0)"
 | |
| 1553 | by(simp add: measure_space_def positive_def countably_additive_def sigma_algebra_trivial) | |
| 1554 | ||
| 1555 | lemma measure_space_closed: | |
| 1556 | assumes "measure_space \<Omega> M \<mu>" | |
| 1557 | shows "M \<subseteq> Pow \<Omega>" | |
| 1558 | proof - | |
| 1559 | interpret sigma_algebra \<Omega> M using assms by(simp add: measure_space_def) | |
| 1560 | show ?thesis by(rule space_closed) | |
| 1561 | qed | |
| 1562 | ||
| 1563 | lemma (in ring_of_sets) positive_cong_eq: | |
| 1564 | "(\<And>a. a \<in> M \<Longrightarrow> \<mu>' a = \<mu> a) \<Longrightarrow> positive M \<mu>' = positive M \<mu>" | |
| 1565 | by (auto simp add: positive_def) | |
| 1566 | ||
| 1567 | lemma (in sigma_algebra) countably_additive_eq: | |
| 1568 | "(\<And>a. a \<in> M \<Longrightarrow> \<mu>' a = \<mu> a) \<Longrightarrow> countably_additive M \<mu>' = countably_additive M \<mu>" | |
| 1569 | unfolding countably_additive_def | |
| 1570 | by (intro arg_cong[where f=All] ext) (auto simp add: countably_additive_def subset_eq) | |
| 1571 | ||
| 1572 | lemma measure_space_eq: | |
| 1573 | assumes closed: "A \<subseteq> Pow \<Omega>" and eq: "\<And>a. a \<in> sigma_sets \<Omega> A \<Longrightarrow> \<mu> a = \<mu>' a" | |
| 1574 | shows "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> = measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>'" | |
| 1575 | proof - | |
| 1576 | interpret sigma_algebra \<Omega> "sigma_sets \<Omega> A" using closed by (rule sigma_algebra_sigma_sets) | |
| 1577 | from positive_cong_eq[OF eq, of "\<lambda>i. i"] countably_additive_eq[OF eq, of "\<lambda>i. i"] show ?thesis | |
| 1578 | by (auto simp: measure_space_def) | |
| 1579 | qed | |
| 1580 | ||
| 1581 | lemma measure_of_eq: | |
| 1582 | assumes closed: "A \<subseteq> Pow \<Omega>" and eq: "(\<And>a. a \<in> sigma_sets \<Omega> A \<Longrightarrow> \<mu> a = \<mu>' a)" | |
| 1583 | shows "measure_of \<Omega> A \<mu> = measure_of \<Omega> A \<mu>'" | |
| 1584 | proof - | |
| 1585 | have "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> = measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>'" | |
| 1586 | using assms by (rule measure_space_eq) | |
| 1587 | with eq show ?thesis | |
| 1588 | by (auto simp add: measure_of_def intro!: arg_cong[where f=Abs_measure]) | |
| 1589 | qed | |
| 1590 | ||
| 79583 
a521c241e946
Further lemmas concerning complexity and measures
 paulson <lp15@cam.ac.uk> parents: 
76834diff
changeset | 1591 | lemma measure_space_Pow_eq: | 
| 
a521c241e946
Further lemmas concerning complexity and measures
 paulson <lp15@cam.ac.uk> parents: 
76834diff
changeset | 1592 | assumes "\<And>X. X \<in> Pow \<Omega> \<Longrightarrow> \<mu> X = \<mu>' X" | 
| 
a521c241e946
Further lemmas concerning complexity and measures
 paulson <lp15@cam.ac.uk> parents: 
76834diff
changeset | 1593 | shows "measure_space \<Omega> (Pow \<Omega>) \<mu> = measure_space \<Omega> (Pow \<Omega>) \<mu>'" | 
| 
a521c241e946
Further lemmas concerning complexity and measures
 paulson <lp15@cam.ac.uk> parents: 
76834diff
changeset | 1594 | by (smt (verit, best) assms measure_space_eq sigma_algebra.sigma_sets_eq sigma_algebra_Pow subset_eq) | 
| 
a521c241e946
Further lemmas concerning complexity and measures
 paulson <lp15@cam.ac.uk> parents: 
76834diff
changeset | 1595 | |
| 56994 | 1596 | lemma | 
| 76834 | 1597 | shows space_measure_of_conv: "space (measure_of \<Omega> A \<mu>) = \<Omega>" (is ?space) | 
| 56994 | 1598 | and sets_measure_of_conv: | 
| 1599 |   "sets (measure_of \<Omega> A \<mu>) = (if A \<subseteq> Pow \<Omega> then sigma_sets \<Omega> A else {{}, \<Omega>})" (is ?sets)
 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1600 | and emeasure_measure_of_conv: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1601 | "emeasure (measure_of \<Omega> A \<mu>) = | 
| 56994 | 1602 | (\<lambda>B. if B \<in> sigma_sets \<Omega> A \<and> measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> then \<mu> B else 0)" (is ?emeasure) | 
| 1603 | proof - | |
| 1604 | have "?space \<and> ?sets \<and> ?emeasure" | |
| 1605 | proof(cases "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>") | |
| 1606 | case True | |
| 1607 | from measure_space_closed[OF this] sigma_sets_superset_generator[of A \<Omega>] | |
| 1608 | have "A \<subseteq> Pow \<Omega>" by simp | |
| 1609 | hence "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> = measure_space \<Omega> (sigma_sets \<Omega> A) | |
| 1610 | (\<lambda>a. if a \<in> sigma_sets \<Omega> A then \<mu> a else 0)" | |
| 1611 | by(rule measure_space_eq) auto | |
| 61808 | 1612 | with True \<open>A \<subseteq> Pow \<Omega>\<close> show ?thesis | 
| 56994 | 1613 | by(simp add: measure_of_def space_def sets_def emeasure_def Abs_measure_inverse) | 
| 1614 | next | |
| 1615 | case False thus ?thesis | |
| 1616 | by(cases "A \<subseteq> Pow \<Omega>")(simp_all add: Abs_measure_inverse measure_of_def sets_def space_def emeasure_def measure_space_0 measure_space_0') | |
| 1617 | qed | |
| 1618 | thus ?space ?sets ?emeasure by simp_all | |
| 1619 | qed | |
| 1620 | ||
| 1621 | lemma [simp]: | |
| 1622 | assumes A: "A \<subseteq> Pow \<Omega>" | |
| 1623 | shows sets_measure_of: "sets (measure_of \<Omega> A \<mu>) = sigma_sets \<Omega> A" | |
| 1624 | and space_measure_of: "space (measure_of \<Omega> A \<mu>) = \<Omega>" | |
| 1625 | using assms | |
| 1626 | by(simp_all add: sets_measure_of_conv space_measure_of_conv) | |
| 1627 | ||
| 64008 
17a20ca86d62
HOL-Probability: more about probability, prepare for Markov processes in the AFP
 hoelzl parents: 
63627diff
changeset | 1628 | lemma space_in_measure_of[simp]: "\<Omega> \<in> sets (measure_of \<Omega> M \<mu>)" | 
| 
17a20ca86d62
HOL-Probability: more about probability, prepare for Markov processes in the AFP
 hoelzl parents: 
63627diff
changeset | 1629 | by (subst sets_measure_of_conv) (auto simp: sigma_sets_top) | 
| 
17a20ca86d62
HOL-Probability: more about probability, prepare for Markov processes in the AFP
 hoelzl parents: 
63627diff
changeset | 1630 | |
| 56994 | 1631 | lemma (in sigma_algebra) sets_measure_of_eq[simp]: "sets (measure_of \<Omega> M \<mu>) = M" | 
| 1632 | using space_closed by (auto intro!: sigma_sets_eq) | |
| 1633 | ||
| 1634 | lemma (in sigma_algebra) space_measure_of_eq[simp]: "space (measure_of \<Omega> M \<mu>) = \<Omega>" | |
| 1635 | by (rule space_measure_of_conv) | |
| 1636 | ||
| 1637 | lemma measure_of_subset: "M \<subseteq> Pow \<Omega> \<Longrightarrow> M' \<subseteq> M \<Longrightarrow> sets (measure_of \<Omega> M' \<mu>) \<subseteq> sets (measure_of \<Omega> M \<mu>')" | |
| 1638 | by (auto intro!: sigma_sets_subseteq) | |
| 1639 | ||
| 59000 | 1640 | lemma emeasure_sigma: "emeasure (sigma \<Omega> A) = (\<lambda>x. 0)" | 
| 1641 | unfolding measure_of_def emeasure_def | |
| 1642 | by (subst Abs_measure_inverse) | |
| 1643 | (auto simp: measure_space_def positive_def countably_additive_def | |
| 1644 | intro!: sigma_algebra_sigma_sets sigma_algebra_trivial) | |
| 1645 | ||
| 56994 | 1646 | lemma sigma_sets_mono'': | 
| 1647 | assumes "A \<in> sigma_sets C D" | |
| 1648 | assumes "B \<subseteq> D" | |
| 1649 | assumes "D \<subseteq> Pow C" | |
| 1650 | shows "sigma_sets A B \<subseteq> sigma_sets C D" | |
| 1651 | proof | |
| 1652 | fix x assume "x \<in> sigma_sets A B" | |
| 1653 | thus "x \<in> sigma_sets C D" | |
| 1654 | proof induct | |
| 1655 | case (Basic a) with assms have "a \<in> D" by auto | |
| 1656 | thus ?case .. | |
| 1657 | next | |
| 1658 | case Empty show ?case by (rule sigma_sets.Empty) | |
| 1659 | next | |
| 61808 | 1660 | from assms have "A \<in> sets (sigma C D)" by (subst sets_measure_of[OF \<open>D \<subseteq> Pow C\<close>]) | 
| 1661 | moreover case (Compl a) hence "a \<in> sets (sigma C D)" by (subst sets_measure_of[OF \<open>D \<subseteq> Pow C\<close>]) | |
| 56994 | 1662 | ultimately have "A - a \<in> sets (sigma C D)" .. | 
| 61808 | 1663 | thus ?case by (subst (asm) sets_measure_of[OF \<open>D \<subseteq> Pow C\<close>]) | 
| 56994 | 1664 | next | 
| 1665 | case (Union a) | |
| 1666 | thus ?case by (intro sigma_sets.Union) | |
| 1667 | qed | |
| 1668 | qed | |
| 1669 | ||
| 1670 | lemma in_measure_of[intro, simp]: "M \<subseteq> Pow \<Omega> \<Longrightarrow> A \<in> M \<Longrightarrow> A \<in> sets (measure_of \<Omega> M \<mu>)" | |
| 1671 | by auto | |
| 1672 | ||
| 58606 | 1673 | lemma space_empty_iff: "space N = {} \<longleftrightarrow> sets N = {{}}"
 | 
| 1674 | by (metis Pow_empty Sup_bot_conv(1) cSup_singleton empty_iff | |
| 1675 | sets.sigma_sets_eq sets.space_closed sigma_sets_top subset_singletonD) | |
| 1676 | ||
| 69597 | 1677 | subsubsection \<open>Constructing simple \<^typ>\<open>'a measure\<close>\<close> | 
| 56994 | 1678 | |
| 68607 
67bb59e49834
make theorem, corollary, and proposition %important for HOL-Analysis manual
 immler parents: 
68403diff
changeset | 1679 | proposition emeasure_measure_of: | 
| 56994 | 1680 | assumes M: "M = measure_of \<Omega> A \<mu>" | 
| 1681 | assumes ms: "A \<subseteq> Pow \<Omega>" "positive (sets M) \<mu>" "countably_additive (sets M) \<mu>" | |
| 1682 | assumes X: "X \<in> sets M" | |
| 1683 | shows "emeasure M X = \<mu> X" | |
| 68607 
67bb59e49834
make theorem, corollary, and proposition %important for HOL-Analysis manual
 immler parents: 
68403diff
changeset | 1684 | proof - | 
| 56994 | 1685 | interpret sigma_algebra \<Omega> "sigma_sets \<Omega> A" by (rule sigma_algebra_sigma_sets) fact | 
| 1686 | have "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>" | |
| 1687 | using ms M by (simp add: measure_space_def sigma_algebra_sigma_sets) | |
| 1688 | thus ?thesis using X ms | |
| 1689 | by(simp add: M emeasure_measure_of_conv sets_measure_of_conv) | |
| 1690 | qed | |
| 1691 | ||
| 1692 | lemma emeasure_measure_of_sigma: | |
| 1693 | assumes ms: "sigma_algebra \<Omega> M" "positive M \<mu>" "countably_additive M \<mu>" | |
| 1694 | assumes A: "A \<in> M" | |
| 1695 | shows "emeasure (measure_of \<Omega> M \<mu>) A = \<mu> A" | |
| 1696 | proof - | |
| 1697 | interpret sigma_algebra \<Omega> M by fact | |
| 1698 | have "measure_space \<Omega> (sigma_sets \<Omega> M) \<mu>" | |
| 1699 | using ms sigma_sets_eq by (simp add: measure_space_def) | |
| 1700 | thus ?thesis by(simp add: emeasure_measure_of_conv A) | |
| 1701 | qed | |
| 1702 | ||
| 1703 | lemma measure_cases[cases type: measure]: | |
| 1704 | obtains (measure) \<Omega> A \<mu> where "x = Abs_measure (\<Omega>, A, \<mu>)" "\<forall>a\<in>-A. \<mu> a = 0" "measure_space \<Omega> A \<mu>" | |
| 1705 | by atomize_elim (cases x, auto) | |
| 1706 | ||
| 60772 | 1707 | lemma sets_le_imp_space_le: "sets A \<subseteq> sets B \<Longrightarrow> space A \<subseteq> space B" | 
| 1708 | by (auto dest: sets.sets_into_space) | |
| 1709 | ||
| 1710 | lemma sets_eq_imp_space_eq: "sets M = sets M' \<Longrightarrow> space M = space M'" | |
| 1711 | by (auto intro!: antisym sets_le_imp_space_le) | |
| 56994 | 1712 | |
| 1713 | lemma emeasure_notin_sets: "A \<notin> sets M \<Longrightarrow> emeasure M A = 0" | |
| 1714 | by (cases M) (auto simp: sets_def emeasure_def Abs_measure_inverse measure_space_def) | |
| 1715 | ||
| 1716 | lemma emeasure_neq_0_sets: "emeasure M A \<noteq> 0 \<Longrightarrow> A \<in> sets M" | |
| 1717 | using emeasure_notin_sets[of A M] by blast | |
| 1718 | ||
| 1719 | lemma measure_notin_sets: "A \<notin> sets M \<Longrightarrow> measure M A = 0" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1720 | by (simp add: measure_def emeasure_notin_sets zero_ennreal.rep_eq) | 
| 56994 | 1721 | |
| 1722 | lemma measure_eqI: | |
| 1723 | fixes M N :: "'a measure" | |
| 1724 | assumes "sets M = sets N" and eq: "\<And>A. A \<in> sets M \<Longrightarrow> emeasure M A = emeasure N A" | |
| 1725 | shows "M = N" | |
| 1726 | proof (cases M N rule: measure_cases[case_product measure_cases]) | |
| 1727 | case (measure_measure \<Omega> A \<mu> \<Omega>' A' \<mu>') | |
| 1728 | interpret M: sigma_algebra \<Omega> A using measure_measure by (auto simp: measure_space_def) | |
| 1729 | interpret N: sigma_algebra \<Omega>' A' using measure_measure by (auto simp: measure_space_def) | |
| 1730 | have "A = sets M" "A' = sets N" | |
| 1731 | using measure_measure by (simp_all add: sets_def Abs_measure_inverse) | |
| 61808 | 1732 | with \<open>sets M = sets N\<close> have AA': "A = A'" by simp | 
| 56994 | 1733 | moreover from M.top N.top M.space_closed N.space_closed AA' have "\<Omega> = \<Omega>'" by auto | 
| 1734 |   moreover { fix B have "\<mu> B = \<mu>' B"
 | |
| 1735 | proof cases | |
| 1736 | assume "B \<in> A" | |
| 61808 | 1737 | with eq \<open>A = sets M\<close> have "emeasure M B = emeasure N B" by simp | 
| 56994 | 1738 | with measure_measure show "\<mu> B = \<mu>' B" | 
| 1739 | by (simp add: emeasure_def Abs_measure_inverse) | |
| 1740 | next | |
| 1741 | assume "B \<notin> A" | |
| 61808 | 1742 | with \<open>A = sets M\<close> \<open>A' = sets N\<close> \<open>A = A'\<close> have "B \<notin> sets M" "B \<notin> sets N" | 
| 56994 | 1743 | by auto | 
| 1744 | then have "emeasure M B = 0" "emeasure N B = 0" | |
| 1745 | by (simp_all add: emeasure_notin_sets) | |
| 1746 | with measure_measure show "\<mu> B = \<mu>' B" | |
| 1747 | by (simp add: emeasure_def Abs_measure_inverse) | |
| 1748 | qed } | |
| 1749 | then have "\<mu> = \<mu>'" by auto | |
| 1750 | ultimately show "M = N" | |
| 1751 | by (simp add: measure_measure) | |
| 1752 | qed | |
| 1753 | ||
| 1754 | lemma sigma_eqI: | |
| 1755 | assumes [simp]: "M \<subseteq> Pow \<Omega>" "N \<subseteq> Pow \<Omega>" "sigma_sets \<Omega> M = sigma_sets \<Omega> N" | |
| 1756 | shows "sigma \<Omega> M = sigma \<Omega> N" | |
| 1757 | by (rule measure_eqI) (simp_all add: emeasure_sigma) | |
| 1758 | ||
| 61808 | 1759 | subsubsection \<open>Measurable functions\<close> | 
| 56994 | 1760 | |
| 70136 | 1761 | definition\<^marker>\<open>tag important\<close> measurable :: "'a measure \<Rightarrow> 'b measure \<Rightarrow> ('a \<Rightarrow> 'b) set"
 | 
| 80914 
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
 wenzelm parents: 
79583diff
changeset | 1762 | (infixr \<open>\<rightarrow>\<^sub>M\<close> 60) where | 
| 69554 | 1763 | "measurable A B = {f \<in> space A \<rightarrow> space B. \<forall>y \<in> sets B. f -` y \<inter> space A \<in> sets A}"
 | 
| 56994 | 1764 | |
| 59415 | 1765 | lemma measurableI: | 
| 1766 | "(\<And>x. x \<in> space M \<Longrightarrow> f x \<in> space N) \<Longrightarrow> (\<And>A. A \<in> sets N \<Longrightarrow> f -` A \<inter> space M \<in> sets M) \<Longrightarrow> | |
| 1767 | f \<in> measurable M N" | |
| 1768 | by (auto simp: measurable_def) | |
| 1769 | ||
| 56994 | 1770 | lemma measurable_space: | 
| 1771 | "f \<in> measurable M A \<Longrightarrow> x \<in> space M \<Longrightarrow> f x \<in> space A" | |
| 1772 | unfolding measurable_def by auto | |
| 1773 | ||
| 1774 | lemma measurable_sets: | |
| 1775 | "f \<in> measurable M A \<Longrightarrow> S \<in> sets A \<Longrightarrow> f -` S \<inter> space M \<in> sets M" | |
| 1776 | unfolding measurable_def by auto | |
| 1777 | ||
| 1778 | lemma measurable_sets_Collect: | |
| 1779 |   assumes f: "f \<in> measurable M N" and P: "{x\<in>space N. P x} \<in> sets N" shows "{x\<in>space M. P (f x)} \<in> sets M"
 | |
| 1780 | proof - | |
| 1781 |   have "f -` {x \<in> space N. P x} \<inter> space M = {x\<in>space M. P (f x)}"
 | |
| 1782 | using measurable_space[OF f] by auto | |
| 1783 | with measurable_sets[OF f P] show ?thesis | |
| 1784 | by simp | |
| 1785 | qed | |
| 1786 | ||
| 1787 | lemma measurable_sigma_sets: | |
| 1788 | assumes B: "sets N = sigma_sets \<Omega> A" "A \<subseteq> Pow \<Omega>" | |
| 1789 | and f: "f \<in> space M \<rightarrow> \<Omega>" | |
| 1790 | and ba: "\<And>y. y \<in> A \<Longrightarrow> (f -` y) \<inter> space M \<in> sets M" | |
| 1791 | shows "f \<in> measurable M N" | |
| 1792 | proof - | |
| 1793 | interpret A: sigma_algebra \<Omega> "sigma_sets \<Omega> A" using B(2) by (rule sigma_algebra_sigma_sets) | |
| 1794 | from B sets.top[of N] A.top sets.space_closed[of N] A.space_closed have \<Omega>: "\<Omega> = space N" by force | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1795 | |
| 56994 | 1796 |   { fix X assume "X \<in> sigma_sets \<Omega> A"
 | 
| 1797 | then have "f -` X \<inter> space M \<in> sets M \<and> X \<subseteq> \<Omega>" | |
| 1798 | proof induct | |
| 1799 | case (Basic a) then show ?case | |
| 1800 | by (auto simp add: ba) (metis B(2) subsetD PowD) | |
| 1801 | next | |
| 1802 | case (Compl a) | |
| 1803 | have [simp]: "f -` \<Omega> \<inter> space M = space M" | |
| 1804 | by (auto simp add: funcset_mem [OF f]) | |
| 1805 | then show ?case | |
| 1806 | by (auto simp add: vimage_Diff Diff_Int_distrib2 sets.compl_sets Compl) | |
| 1807 | next | |
| 1808 | case (Union a) | |
| 1809 | then show ?case | |
| 1810 | by (simp add: vimage_UN, simp only: UN_extend_simps(4)) blast | |
| 1811 | qed auto } | |
| 1812 | with f show ?thesis | |
| 1813 | by (auto simp add: measurable_def B \<Omega>) | |
| 1814 | qed | |
| 1815 | ||
| 1816 | lemma measurable_measure_of: | |
| 1817 | assumes B: "N \<subseteq> Pow \<Omega>" | |
| 1818 | and f: "f \<in> space M \<rightarrow> \<Omega>" | |
| 1819 | and ba: "\<And>y. y \<in> N \<Longrightarrow> (f -` y) \<inter> space M \<in> sets M" | |
| 1820 | shows "f \<in> measurable M (measure_of \<Omega> N \<mu>)" | |
| 1821 | proof - | |
| 1822 | have "sets (measure_of \<Omega> N \<mu>) = sigma_sets \<Omega> N" | |
| 1823 | using B by (rule sets_measure_of) | |
| 1824 | from this assms show ?thesis by (rule measurable_sigma_sets) | |
| 1825 | qed | |
| 1826 | ||
| 1827 | lemma measurable_iff_measure_of: | |
| 1828 | assumes "N \<subseteq> Pow \<Omega>" "f \<in> space M \<rightarrow> \<Omega>" | |
| 1829 | shows "f \<in> measurable M (measure_of \<Omega> N \<mu>) \<longleftrightarrow> (\<forall>A\<in>N. f -` A \<inter> space M \<in> sets M)" | |
| 1830 | by (metis assms in_measure_of measurable_measure_of assms measurable_sets) | |
| 1831 | ||
| 1832 | lemma measurable_cong_sets: | |
| 1833 | assumes sets: "sets M = sets M'" "sets N = sets N'" | |
| 1834 | shows "measurable M N = measurable M' N'" | |
| 1835 | using sets[THEN sets_eq_imp_space_eq] sets by (simp add: measurable_def) | |
| 1836 | ||
| 1837 | lemma measurable_cong: | |
| 59415 | 1838 | assumes "\<And>w. w \<in> space M \<Longrightarrow> f w = g w" | 
| 56994 | 1839 | shows "f \<in> measurable M M' \<longleftrightarrow> g \<in> measurable M M'" | 
| 1840 | unfolding measurable_def using assms | |
| 1841 | by (simp cong: vimage_inter_cong Pi_cong) | |
| 1842 | ||
| 59415 | 1843 | lemma measurable_cong': | 
| 1844 | assumes "\<And>w. w \<in> space M =simp=> f w = g w" | |
| 1845 | shows "f \<in> measurable M M' \<longleftrightarrow> g \<in> measurable M M'" | |
| 1846 | unfolding measurable_def using assms | |
| 1847 | by (simp cong: vimage_inter_cong Pi_cong add: simp_implies_def) | |
| 1848 | ||
| 69546 
27dae626822b
prefer naming convention from datatype package for strong congruence rules
 haftmann parents: 
69313diff
changeset | 1849 | lemma measurable_cong_simp: | 
| 56994 | 1850 | "M = N \<Longrightarrow> M' = N' \<Longrightarrow> (\<And>w. w \<in> space M \<Longrightarrow> f w = g w) \<Longrightarrow> | 
| 1851 | f \<in> measurable M M' \<longleftrightarrow> g \<in> measurable N N'" | |
| 1852 | by (metis measurable_cong) | |
| 1853 | ||
| 1854 | lemma measurable_compose: | |
| 1855 | assumes f: "f \<in> measurable M N" and g: "g \<in> measurable N L" | |
| 1856 | shows "(\<lambda>x. g (f x)) \<in> measurable M L" | |
| 1857 | proof - | |
| 1858 | have "\<And>A. (\<lambda>x. g (f x)) -` A \<inter> space M = f -` (g -` A \<inter> space N) \<inter> space M" | |
| 1859 | using measurable_space[OF f] by auto | |
| 1860 | with measurable_space[OF f] measurable_space[OF g] show ?thesis | |
| 1861 | by (auto intro: measurable_sets[OF f] measurable_sets[OF g] | |
| 1862 | simp del: vimage_Int simp add: measurable_def) | |
| 1863 | qed | |
| 1864 | ||
| 1865 | lemma measurable_comp: | |
| 1866 | "f \<in> measurable M N \<Longrightarrow> g \<in> measurable N L \<Longrightarrow> g \<circ> f \<in> measurable M L" | |
| 1867 | using measurable_compose[of f M N g L] by (simp add: comp_def) | |
| 1868 | ||
| 1869 | lemma measurable_const: | |
| 1870 | "c \<in> space M' \<Longrightarrow> (\<lambda>x. c) \<in> measurable M M'" | |
| 1871 | by (auto simp add: measurable_def) | |
| 1872 | ||
| 1873 | lemma measurable_ident: "id \<in> measurable M M" | |
| 1874 | by (auto simp add: measurable_def) | |
| 1875 | ||
| 59048 | 1876 | lemma measurable_id: "(\<lambda>x. x) \<in> measurable M M" | 
| 1877 | by (simp add: measurable_def) | |
| 1878 | ||
| 56994 | 1879 | lemma measurable_ident_sets: | 
| 1880 | assumes eq: "sets M = sets M'" shows "(\<lambda>x. x) \<in> measurable M M'" | |
| 1881 | using measurable_ident[of M] | |
| 1882 | unfolding id_def measurable_def eq sets_eq_imp_space_eq[OF eq] . | |
| 1883 | ||
| 1884 | lemma sets_Least: | |
| 1885 |   assumes meas: "\<And>i::nat. {x\<in>space M. P i x} \<in> M"
 | |
| 1886 | shows "(\<lambda>x. LEAST j. P j x) -` A \<inter> space M \<in> sets M" | |
| 1887 | proof - | |
| 1888 |   { fix i have "(\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M \<in> sets M"
 | |
| 1889 | proof cases | |
| 1890 | assume i: "(LEAST j. False) = i" | |
| 1891 |       have "(\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M =
 | |
| 1892 |         {x\<in>space M. P i x} \<inter> (space M - (\<Union>j<i. {x\<in>space M. P j x})) \<union> (space M - (\<Union>i. {x\<in>space M. P i x}))"
 | |
| 1893 | by (simp add: set_eq_iff, safe) | |
| 1894 | (insert i, auto dest: Least_le intro: LeastI intro!: Least_equality) | |
| 1895 | with meas show ?thesis | |
| 1896 | by (auto intro!: sets.Int) | |
| 1897 | next | |
| 1898 | assume i: "(LEAST j. False) \<noteq> i" | |
| 1899 |       then have "(\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M =
 | |
| 1900 |         {x\<in>space M. P i x} \<inter> (space M - (\<Union>j<i. {x\<in>space M. P j x}))"
 | |
| 1901 | proof (simp add: set_eq_iff, safe) | |
| 1902 | fix x assume neq: "(LEAST j. False) \<noteq> (LEAST j. P j x)" | |
| 1903 | have "\<exists>j. P j x" | |
| 1904 | by (rule ccontr) (insert neq, auto) | |
| 1905 | then show "P (LEAST j. P j x) x" by (rule LeastI_ex) | |
| 1906 | qed (auto dest: Least_le intro!: Least_equality) | |
| 1907 | with meas show ?thesis | |
| 1908 | by auto | |
| 1909 | qed } | |
| 1910 |   then have "(\<Union>i\<in>A. (\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M) \<in> sets M"
 | |
| 1911 | by (intro sets.countable_UN) auto | |
| 1912 |   moreover have "(\<Union>i\<in>A. (\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M) =
 | |
| 1913 | (\<lambda>x. LEAST j. P j x) -` A \<inter> space M" by auto | |
| 1914 | ultimately show ?thesis by auto | |
| 1915 | qed | |
| 1916 | ||
| 1917 | lemma measurable_mono1: | |
| 1918 | "M' \<subseteq> Pow \<Omega> \<Longrightarrow> M \<subseteq> M' \<Longrightarrow> | |
| 1919 | measurable (measure_of \<Omega> M \<mu>) N \<subseteq> measurable (measure_of \<Omega> M' \<mu>') N" | |
| 1920 | using measure_of_subset[of M' \<Omega> M] by (auto simp add: measurable_def) | |
| 1921 | ||
| 61808 | 1922 | subsubsection \<open>Counting space\<close> | 
| 56994 | 1923 | |
| 70136 | 1924 | definition\<^marker>\<open>tag important\<close> count_space :: "'a set \<Rightarrow> 'a measure" where | 
| 69554 | 1925 | "count_space \<Omega> = measure_of \<Omega> (Pow \<Omega>) (\<lambda>A. if finite A then of_nat (card A) else \<infinity>)" | 
| 56994 | 1926 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1927 | lemma | 
| 56994 | 1928 | shows space_count_space[simp]: "space (count_space \<Omega>) = \<Omega>" | 
| 1929 | and sets_count_space[simp]: "sets (count_space \<Omega>) = Pow \<Omega>" | |
| 1930 | using sigma_sets_into_sp[of "Pow \<Omega>" \<Omega>] | |
| 1931 | by (auto simp: count_space_def) | |
| 1932 | ||
| 1933 | lemma measurable_count_space_eq1[simp]: | |
| 1934 | "f \<in> measurable (count_space A) M \<longleftrightarrow> f \<in> A \<rightarrow> space M" | |
| 1935 | unfolding measurable_def by simp | |
| 1936 | ||
| 79583 
a521c241e946
Further lemmas concerning complexity and measures
 paulson <lp15@cam.ac.uk> parents: 
76834diff
changeset | 1937 | lemma finite_count_space: "finite \<Omega> \<Longrightarrow> count_space \<Omega> = measure_of \<Omega> (Pow \<Omega>) card" | 
| 
a521c241e946
Further lemmas concerning complexity and measures
 paulson <lp15@cam.ac.uk> parents: 
76834diff
changeset | 1938 | unfolding count_space_def | 
| 
a521c241e946
Further lemmas concerning complexity and measures
 paulson <lp15@cam.ac.uk> parents: 
76834diff
changeset | 1939 | by (smt (verit, best) PowD Pow_top count_space_def finite_subset measure_of_eq sets_count_space sets_measure_of) | 
| 
a521c241e946
Further lemmas concerning complexity and measures
 paulson <lp15@cam.ac.uk> parents: 
76834diff
changeset | 1940 | |
| 59000 | 1941 | lemma measurable_compose_countable': | 
| 1942 | assumes f: "\<And>i. i \<in> I \<Longrightarrow> (\<lambda>x. f i x) \<in> measurable M N" | |
| 1943 | and g: "g \<in> measurable M (count_space I)" and I: "countable I" | |
| 56994 | 1944 | shows "(\<lambda>x. f (g x) x) \<in> measurable M N" | 
| 1945 | unfolding measurable_def | |
| 1946 | proof safe | |
| 1947 | fix x assume "x \<in> space M" then show "f (g x) x \<in> space N" | |
| 59000 | 1948 | using measurable_space[OF f] g[THEN measurable_space] by auto | 
| 56994 | 1949 | next | 
| 1950 | fix A assume A: "A \<in> sets N" | |
| 59000 | 1951 |   have "(\<lambda>x. f (g x) x) -` A \<inter> space M = (\<Union>i\<in>I. (g -` {i} \<inter> space M) \<inter> (f i -` A \<inter> space M))"
 | 
| 1952 | using measurable_space[OF g] by auto | |
| 59415 | 1953 | also have "\<dots> \<in> sets M" | 
| 1954 | using f[THEN measurable_sets, OF _ A] g[THEN measurable_sets] | |
| 1955 | by (auto intro!: sets.countable_UN' I intro: sets.Int[OF measurable_sets measurable_sets]) | |
| 56994 | 1956 | finally show "(\<lambda>x. f (g x) x) -` A \<inter> space M \<in> sets M" . | 
| 1957 | qed | |
| 1958 | ||
| 1959 | lemma measurable_count_space_eq_countable: | |
| 1960 | assumes "countable A" | |
| 1961 |   shows "f \<in> measurable M (count_space A) \<longleftrightarrow> (f \<in> space M \<rightarrow> A \<and> (\<forall>a\<in>A. f -` {a} \<inter> space M \<in> sets M))"
 | |
| 1962 | proof - | |
| 1963 |   { fix X assume "X \<subseteq> A" "f \<in> space M \<rightarrow> A"
 | |
| 61808 | 1964 |     with \<open>countable A\<close> have "f -` X \<inter> space M = (\<Union>a\<in>X. f -` {a} \<inter> space M)" "countable X"
 | 
| 56994 | 1965 | by (auto dest: countable_subset) | 
| 1966 |     moreover assume "\<forall>a\<in>A. f -` {a} \<inter> space M \<in> sets M"
 | |
| 1967 | ultimately have "f -` X \<inter> space M \<in> sets M" | |
| 61808 | 1968 | using \<open>X \<subseteq> A\<close> by (auto intro!: sets.countable_UN' simp del: UN_simps) } | 
| 56994 | 1969 | then show ?thesis | 
| 1970 | unfolding measurable_def by auto | |
| 1971 | qed | |
| 1972 | ||
| 59415 | 1973 | lemma measurable_count_space_eq2: | 
| 1974 |   "finite A \<Longrightarrow> f \<in> measurable M (count_space A) \<longleftrightarrow> (f \<in> space M \<rightarrow> A \<and> (\<forall>a\<in>A. f -` {a} \<inter> space M \<in> sets M))"
 | |
| 1975 | by (intro measurable_count_space_eq_countable countable_finite) | |
| 1976 | ||
| 1977 | lemma measurable_count_space_eq2_countable: | |
| 1978 | fixes f :: "'a => 'c::countable" | |
| 1979 |   shows "f \<in> measurable M (count_space A) \<longleftrightarrow> (f \<in> space M \<rightarrow> A \<and> (\<forall>a\<in>A. f -` {a} \<inter> space M \<in> sets M))"
 | |
| 1980 | by (intro measurable_count_space_eq_countable countableI_type) | |
| 1981 | ||
| 1982 | lemma measurable_compose_countable: | |
| 1983 | assumes f: "\<And>i::'i::countable. (\<lambda>x. f i x) \<in> measurable M N" and g: "g \<in> measurable M (count_space UNIV)" | |
| 1984 | shows "(\<lambda>x. f (g x) x) \<in> measurable M N" | |
| 1985 | by (rule measurable_compose_countable'[OF assms]) auto | |
| 1986 | ||
| 1987 | lemma measurable_count_space_const: | |
| 1988 | "(\<lambda>x. c) \<in> measurable M (count_space UNIV)" | |
| 1989 | by (simp add: measurable_const) | |
| 1990 | ||
| 1991 | lemma measurable_count_space: | |
| 1992 | "f \<in> measurable (count_space A) (count_space UNIV)" | |
| 1993 | by simp | |
| 1994 | ||
| 1995 | lemma measurable_compose_rev: | |
| 1996 | assumes f: "f \<in> measurable L N" and g: "g \<in> measurable M L" | |
| 1997 | shows "(\<lambda>x. f (g x)) \<in> measurable M N" | |
| 1998 | using measurable_compose[OF g f] . | |
| 1999 | ||
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2000 | lemma measurable_empty_iff: | 
| 58606 | 2001 |   "space N = {} \<Longrightarrow> f \<in> measurable M N \<longleftrightarrow> space M = {}"
 | 
| 2002 | by (auto simp add: measurable_def Pi_iff) | |
| 2003 | ||
| 70136 | 2004 | subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Extend measure\<close> | 
| 56994 | 2005 | |
| 69554 | 2006 | definition extend_measure :: "'a set \<Rightarrow> 'b set \<Rightarrow> ('b \<Rightarrow> 'a set) \<Rightarrow> ('b \<Rightarrow> ennreal) \<Rightarrow> 'a measure"
 | 
| 2007 | where | |
| 2008 | "extend_measure \<Omega> I G \<mu> = | |
| 56994 | 2009 | (if (\<exists>\<mu>'. (\<forall>i\<in>I. \<mu>' (G i) = \<mu> i) \<and> measure_space \<Omega> (sigma_sets \<Omega> (G`I)) \<mu>') \<and> \<not> (\<forall>i\<in>I. \<mu> i = 0) | 
| 2010 | then measure_of \<Omega> (G`I) (SOME \<mu>'. (\<forall>i\<in>I. \<mu>' (G i) = \<mu> i) \<and> measure_space \<Omega> (sigma_sets \<Omega> (G`I)) \<mu>') | |
| 2011 | else measure_of \<Omega> (G`I) (\<lambda>_. 0))" | |
| 2012 | ||
| 2013 | lemma space_extend_measure: "G ` I \<subseteq> Pow \<Omega> \<Longrightarrow> space (extend_measure \<Omega> I G \<mu>) = \<Omega>" | |
| 2014 | unfolding extend_measure_def by simp | |
| 2015 | ||
| 2016 | lemma sets_extend_measure: "G ` I \<subseteq> Pow \<Omega> \<Longrightarrow> sets (extend_measure \<Omega> I G \<mu>) = sigma_sets \<Omega> (G`I)" | |
| 2017 | unfolding extend_measure_def by simp | |
| 2018 | ||
| 2019 | lemma emeasure_extend_measure: | |
| 2020 | assumes M: "M = extend_measure \<Omega> I G \<mu>" | |
| 2021 | and eq: "\<And>i. i \<in> I \<Longrightarrow> \<mu>' (G i) = \<mu> i" | |
| 2022 | and ms: "G ` I \<subseteq> Pow \<Omega>" "positive (sets M) \<mu>'" "countably_additive (sets M) \<mu>'" | |
| 2023 | and "i \<in> I" | |
| 2024 | shows "emeasure M (G i) = \<mu> i" | |
| 2025 | proof cases | |
| 2026 | assume *: "(\<forall>i\<in>I. \<mu> i = 0)" | |
| 2027 | with M have M_eq: "M = measure_of \<Omega> (G`I) (\<lambda>_. 0)" | |
| 2028 | by (simp add: extend_measure_def) | |
| 61808 | 2029 | from measure_space_0[OF ms(1)] ms \<open>i\<in>I\<close> | 
| 56994 | 2030 | have "emeasure M (G i) = 0" | 
| 2031 | by (intro emeasure_measure_of[OF M_eq]) (auto simp add: M measure_space_def sets_extend_measure) | |
| 61808 | 2032 | with \<open>i\<in>I\<close> * show ?thesis | 
| 56994 | 2033 | by simp | 
| 2034 | next | |
| 63040 | 2035 | define P where "P \<mu>' \<longleftrightarrow> (\<forall>i\<in>I. \<mu>' (G i) = \<mu> i) \<and> measure_space \<Omega> (sigma_sets \<Omega> (G`I)) \<mu>'" for \<mu>' | 
| 56994 | 2036 | assume "\<not> (\<forall>i\<in>I. \<mu> i = 0)" | 
| 2037 | moreover | |
| 2038 | have "measure_space (space M) (sets M) \<mu>'" | |
| 61169 | 2039 | using ms unfolding measure_space_def by auto standard | 
| 56994 | 2040 | with ms eq have "\<exists>\<mu>'. P \<mu>'" | 
| 2041 | unfolding P_def | |
| 2042 | by (intro exI[of _ \<mu>']) (auto simp add: M space_extend_measure sets_extend_measure) | |
| 2043 | ultimately have M_eq: "M = measure_of \<Omega> (G`I) (Eps P)" | |
| 2044 | by (simp add: M extend_measure_def P_def[symmetric]) | |
| 2045 | ||
| 61808 | 2046 | from \<open>\<exists>\<mu>'. P \<mu>'\<close> have P: "P (Eps P)" by (rule someI_ex) | 
| 56994 | 2047 | show "emeasure M (G i) = \<mu> i" | 
| 2048 | proof (subst emeasure_measure_of[OF M_eq]) | |
| 2049 | have sets_M: "sets M = sigma_sets \<Omega> (G`I)" | |
| 2050 | using M_eq ms by (auto simp: sets_extend_measure) | |
| 61808 | 2051 | then show "G i \<in> sets M" using \<open>i \<in> I\<close> by auto | 
| 56994 | 2052 | show "positive (sets M) (Eps P)" "countably_additive (sets M) (Eps P)" "Eps P (G i) = \<mu> i" | 
| 61808 | 2053 | using P \<open>i\<in>I\<close> by (auto simp add: sets_M measure_space_def P_def) | 
| 56994 | 2054 | qed fact | 
| 2055 | qed | |
| 2056 | ||
| 2057 | lemma emeasure_extend_measure_Pair: | |
| 2058 |   assumes M: "M = extend_measure \<Omega> {(i, j). I i j} (\<lambda>(i, j). G i j) (\<lambda>(i, j). \<mu> i j)"
 | |
| 2059 | and eq: "\<And>i j. I i j \<Longrightarrow> \<mu>' (G i j) = \<mu> i j" | |
| 2060 | and ms: "\<And>i j. I i j \<Longrightarrow> G i j \<in> Pow \<Omega>" "positive (sets M) \<mu>'" "countably_additive (sets M) \<mu>'" | |
| 2061 | and "I i j" | |
| 2062 | shows "emeasure M (G i j) = \<mu> i j" | |
| 61808 | 2063 | using emeasure_extend_measure[OF M _ _ ms(2,3), of "(i,j)"] eq ms(1) \<open>I i j\<close> | 
| 56994 | 2064 | by (auto simp: subset_eq) | 
| 2065 | ||
| 69566 | 2066 | subsection \<open>The smallest \<open>\<sigma>\<close>-algebra regarding a function\<close> | 
| 56994 | 2067 | |
| 70136 | 2068 | definition\<^marker>\<open>tag important\<close> vimage_algebra :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b measure \<Rightarrow> 'a measure" where
 | 
| 58588 | 2069 |   "vimage_algebra X f M = sigma X {f -` A \<inter> X | A. A \<in> sets M}"
 | 
| 2070 | ||
| 2071 | lemma space_vimage_algebra[simp]: "space (vimage_algebra X f M) = X" | |
| 2072 | unfolding vimage_algebra_def by (rule space_measure_of) auto | |
| 56994 | 2073 | |
| 58588 | 2074 | lemma sets_vimage_algebra: "sets (vimage_algebra X f M) = sigma_sets X {f -` A \<inter> X | A. A \<in> sets M}"
 | 
| 2075 | unfolding vimage_algebra_def by (rule sets_measure_of) auto | |
| 2076 | ||
| 2077 | lemma sets_vimage_algebra2: | |
| 2078 |   "f \<in> X \<rightarrow> space M \<Longrightarrow> sets (vimage_algebra X f M) = {f -` A \<inter> X | A. A \<in> sets M}"
 | |
| 2079 | using sigma_sets_vimage_commute[of f X "space M" "sets M"] | |
| 2080 | unfolding sets_vimage_algebra sets.sigma_sets_eq by simp | |
| 56994 | 2081 | |
| 59092 
d469103c0737
add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
 hoelzl parents: 
59088diff
changeset | 2082 | lemma sets_vimage_algebra_cong: "sets M = sets N \<Longrightarrow> sets (vimage_algebra X f M) = sets (vimage_algebra X f N)" | 
| 59000 | 2083 | by (simp add: sets_vimage_algebra) | 
| 2084 | ||
| 59092 
d469103c0737
add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
 hoelzl parents: 
59088diff
changeset | 2085 | lemma vimage_algebra_cong: | 
| 
d469103c0737
add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
 hoelzl parents: 
59088diff
changeset | 2086 | assumes "X = Y" | 
| 
d469103c0737
add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
 hoelzl parents: 
59088diff
changeset | 2087 | assumes "\<And>x. x \<in> Y \<Longrightarrow> f x = g x" | 
| 
d469103c0737
add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
 hoelzl parents: 
59088diff
changeset | 2088 | assumes "sets M = sets N" | 
| 
d469103c0737
add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
 hoelzl parents: 
59088diff
changeset | 2089 | shows "vimage_algebra X f M = vimage_algebra Y g N" | 
| 
d469103c0737
add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
 hoelzl parents: 
59088diff
changeset | 2090 | by (auto simp: vimage_algebra_def assms intro!: arg_cong2[where f=sigma]) | 
| 
d469103c0737
add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
 hoelzl parents: 
59088diff
changeset | 2091 | |
| 58588 | 2092 | lemma in_vimage_algebra: "A \<in> sets M \<Longrightarrow> f -` A \<inter> X \<in> sets (vimage_algebra X f M)" | 
| 2093 | by (auto simp: vimage_algebra_def) | |
| 2094 | ||
| 2095 | lemma sets_image_in_sets: | |
| 2096 | assumes N: "space N = X" | |
| 2097 | assumes f: "f \<in> measurable N M" | |
| 2098 | shows "sets (vimage_algebra X f M) \<subseteq> sets N" | |
| 2099 | unfolding sets_vimage_algebra N[symmetric] | |
| 2100 | by (rule sets.sigma_sets_subset) (auto intro!: measurable_sets f) | |
| 2101 | ||
| 2102 | lemma measurable_vimage_algebra1: "f \<in> X \<rightarrow> space M \<Longrightarrow> f \<in> measurable (vimage_algebra X f M) M" | |
| 2103 | unfolding measurable_def by (auto intro: in_vimage_algebra) | |
| 2104 | ||
| 2105 | lemma measurable_vimage_algebra2: | |
| 2106 | assumes g: "g \<in> space N \<rightarrow> X" and f: "(\<lambda>x. f (g x)) \<in> measurable N M" | |
| 2107 | shows "g \<in> measurable N (vimage_algebra X f M)" | |
| 2108 | unfolding vimage_algebra_def | |
| 2109 | proof (rule measurable_measure_of) | |
| 2110 |   fix A assume "A \<in> {f -` A \<inter> X | A. A \<in> sets M}"
 | |
| 2111 | then obtain Y where Y: "Y \<in> sets M" and A: "A = f -` Y \<inter> X" | |
| 2112 | by auto | |
| 2113 | then have "g -` A \<inter> space N = (\<lambda>x. f (g x)) -` Y \<inter> space N" | |
| 2114 | using g by auto | |
| 2115 | also have "\<dots> \<in> sets N" | |
| 2116 | using f Y by (rule measurable_sets) | |
| 2117 | finally show "g -` A \<inter> space N \<in> sets N" . | |
| 2118 | qed (insert g, auto) | |
| 56994 | 2119 | |
| 59088 
ff2bd4a14ddb
generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
 hoelzl parents: 
59048diff
changeset | 2120 | lemma vimage_algebra_sigma: | 
| 
ff2bd4a14ddb
generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
 hoelzl parents: 
59048diff
changeset | 2121 | assumes X: "X \<subseteq> Pow \<Omega>'" and f: "f \<in> \<Omega> \<rightarrow> \<Omega>'" | 
| 
ff2bd4a14ddb
generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
 hoelzl parents: 
59048diff
changeset | 2122 |   shows "vimage_algebra \<Omega> f (sigma \<Omega>' X) = sigma \<Omega> {f -` A \<inter> \<Omega> | A. A \<in> X }" (is "?V = ?S")
 | 
| 
ff2bd4a14ddb
generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
 hoelzl parents: 
59048diff
changeset | 2123 | proof (rule measure_eqI) | 
| 
ff2bd4a14ddb
generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
 hoelzl parents: 
59048diff
changeset | 2124 |   have \<Omega>: "{f -` A \<inter> \<Omega> |A. A \<in> X} \<subseteq> Pow \<Omega>" by auto
 | 
| 
ff2bd4a14ddb
generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
 hoelzl parents: 
59048diff
changeset | 2125 | show "sets ?V = sets ?S" | 
| 
ff2bd4a14ddb
generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
 hoelzl parents: 
59048diff
changeset | 2126 | using sigma_sets_vimage_commute[OF f, of X] | 
| 
ff2bd4a14ddb
generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
 hoelzl parents: 
59048diff
changeset | 2127 | by (simp add: space_measure_of_conv f sets_vimage_algebra2 \<Omega> X) | 
| 
ff2bd4a14ddb
generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
 hoelzl parents: 
59048diff
changeset | 2128 | qed (simp add: vimage_algebra_def emeasure_sigma) | 
| 
ff2bd4a14ddb
generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
 hoelzl parents: 
59048diff
changeset | 2129 | |
| 59000 | 2130 | lemma vimage_algebra_vimage_algebra_eq: | 
| 2131 | assumes *: "f \<in> X \<rightarrow> Y" "g \<in> Y \<rightarrow> space M" | |
| 2132 | shows "vimage_algebra X f (vimage_algebra Y g M) = vimage_algebra X (\<lambda>x. g (f x)) M" | |
| 59088 
ff2bd4a14ddb
generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
 hoelzl parents: 
59048diff
changeset | 2133 | (is "?VV = ?V") | 
| 59000 | 2134 | proof (rule measure_eqI) | 
| 2135 | have "(\<lambda>x. g (f x)) \<in> X \<rightarrow> space M" "\<And>A. A \<inter> f -` Y \<inter> X = A \<inter> X" | |
| 2136 | using * by auto | |
| 2137 | with * show "sets ?VV = sets ?V" | |
| 68403 | 2138 | by (simp add: sets_vimage_algebra2 vimage_comp comp_def flip: ex_simps) | 
| 59000 | 2139 | qed (simp add: vimage_algebra_def emeasure_sigma) | 
| 2140 | ||
| 61808 | 2141 | subsubsection \<open>Restricted Space Sigma Algebra\<close> | 
| 56994 | 2142 | |
| 69554 | 2143 | definition restrict_space :: "'a measure \<Rightarrow> 'a set \<Rightarrow> 'a measure" where | 
| 67399 | 2144 | "restrict_space M \<Omega> = measure_of (\<Omega> \<inter> space M) (((\<inter>) \<Omega>) ` sets M) (emeasure M)" | 
| 56994 | 2145 | |
| 57025 | 2146 | lemma space_restrict_space: "space (restrict_space M \<Omega>) = \<Omega> \<inter> space M" | 
| 2147 | using sets.sets_into_space unfolding restrict_space_def by (subst space_measure_of) auto | |
| 2148 | ||
| 67982 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 2149 | lemma space_restrict_space2 [simp]: "\<Omega> \<in> sets M \<Longrightarrow> space (restrict_space M \<Omega>) = \<Omega>" | 
| 57025 | 2150 | by (simp add: space_restrict_space sets.sets_into_space) | 
| 56994 | 2151 | |
| 67399 | 2152 | lemma sets_restrict_space: "sets (restrict_space M \<Omega>) = ((\<inter>) \<Omega>) ` sets M" | 
| 58588 | 2153 | unfolding restrict_space_def | 
| 2154 | proof (subst sets_measure_of) | |
| 67399 | 2155 | show "(\<inter>) \<Omega> ` sets M \<subseteq> Pow (\<Omega> \<inter> space M)" | 
| 58588 | 2156 | by (auto dest: sets.sets_into_space) | 
| 2157 |   have "sigma_sets (\<Omega> \<inter> space M) {((\<lambda>x. x) -` X) \<inter> (\<Omega> \<inter> space M) | X. X \<in> sets M} =
 | |
| 57025 | 2158 | (\<lambda>X. X \<inter> (\<Omega> \<inter> space M)) ` sets M" | 
| 58588 | 2159 | by (subst sigma_sets_vimage_commute[symmetric, where \<Omega>' = "space M"]) | 
| 2160 | (auto simp add: sets.sigma_sets_eq) | |
| 2161 |   moreover have "{((\<lambda>x. x) -` X) \<inter> (\<Omega> \<inter> space M) | X. X \<in> sets M} = (\<lambda>X. X \<inter> (\<Omega> \<inter> space M)) `  sets M"
 | |
| 2162 | by auto | |
| 67399 | 2163 | moreover have "(\<lambda>X. X \<inter> (\<Omega> \<inter> space M)) ` sets M = ((\<inter>) \<Omega>) ` sets M" | 
| 58588 | 2164 | by (intro image_cong) (auto dest: sets.sets_into_space) | 
| 67399 | 2165 | ultimately show "sigma_sets (\<Omega> \<inter> space M) ((\<inter>) \<Omega> ` sets M) = (\<inter>) \<Omega> ` sets M" | 
| 58588 | 2166 | by simp | 
| 57025 | 2167 | qed | 
| 56994 | 2168 | |
| 62083 | 2169 | lemma restrict_space_sets_cong: | 
| 2170 | "A = B \<Longrightarrow> sets M = sets N \<Longrightarrow> sets (restrict_space M A) = sets (restrict_space N B)" | |
| 2171 | by (auto simp: sets_restrict_space) | |
| 2172 | ||
| 60063 | 2173 | lemma sets_restrict_space_count_space : | 
| 2174 | "sets (restrict_space (count_space A) B) = sets (count_space (A \<inter> B))" | |
| 2175 | by(auto simp add: sets_restrict_space) | |
| 2176 | ||
| 59361 
fd5da2434be4
piecewise measurability using restrict_space; cleanup Borel_Space
 hoelzl parents: 
59092diff
changeset | 2177 | lemma sets_restrict_UNIV[simp]: "sets (restrict_space M UNIV) = sets M" | 
| 
fd5da2434be4
piecewise measurability using restrict_space; cleanup Borel_Space
 hoelzl parents: 
59092diff
changeset | 2178 | by (auto simp add: sets_restrict_space) | 
| 
fd5da2434be4
piecewise measurability using restrict_space; cleanup Borel_Space
 hoelzl parents: 
59092diff
changeset | 2179 | |
| 59415 | 2180 | lemma sets_restrict_restrict_space: | 
| 2181 | "sets (restrict_space (restrict_space M A) B) = sets (restrict_space M (A \<inter> B))" | |
| 2182 | unfolding sets_restrict_space image_comp by (intro image_cong) auto | |
| 2183 | ||
| 56994 | 2184 | lemma sets_restrict_space_iff: | 
| 57025 | 2185 | "\<Omega> \<inter> space M \<in> sets M \<Longrightarrow> A \<in> sets (restrict_space M \<Omega>) \<longleftrightarrow> (A \<subseteq> \<Omega> \<and> A \<in> sets M)" | 
| 2186 | proof (subst sets_restrict_space, safe) | |
| 2187 | fix A assume "\<Omega> \<inter> space M \<in> sets M" and A: "A \<in> sets M" | |
| 2188 | then have "(\<Omega> \<inter> space M) \<inter> A \<in> sets M" | |
| 2189 | by rule | |
| 2190 | also have "(\<Omega> \<inter> space M) \<inter> A = \<Omega> \<inter> A" | |
| 2191 | using sets.sets_into_space[OF A] by auto | |
| 2192 | finally show "\<Omega> \<inter> A \<in> sets M" | |
| 2193 | by auto | |
| 2194 | qed auto | |
| 56994 | 2195 | |
| 59000 | 2196 | lemma sets_restrict_space_cong: "sets M = sets N \<Longrightarrow> sets (restrict_space M \<Omega>) = sets (restrict_space N \<Omega>)" | 
| 2197 | by (simp add: sets_restrict_space) | |
| 2198 | ||
| 2199 | lemma restrict_space_eq_vimage_algebra: | |
| 2200 | "\<Omega> \<subseteq> space M \<Longrightarrow> sets (restrict_space M \<Omega>) = sets (vimage_algebra \<Omega> (\<lambda>x. x) M)" | |
| 2201 | unfolding restrict_space_def | |
| 2202 | apply (subst sets_measure_of) | |
| 2203 | apply (auto simp add: image_subset_iff dest: sets.sets_into_space) [] | |
| 2204 | apply (auto simp add: sets_vimage_algebra intro!: arg_cong2[where f=sigma_sets]) | |
| 2205 | done | |
| 2206 | ||
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2207 | lemma sets_Collect_restrict_space_iff: | 
| 59000 | 2208 | assumes "S \<in> sets M" | 
| 2209 |   shows "{x\<in>space (restrict_space M S). P x} \<in> sets (restrict_space M S) \<longleftrightarrow> {x\<in>space M. x \<in> S \<and> P x} \<in> sets M"
 | |
| 2210 | proof - | |
| 2211 |   have "{x\<in>S. P x} = {x\<in>space M. x \<in> S \<and> P x}"
 | |
| 2212 | using sets.sets_into_space[OF assms] by auto | |
| 2213 | then show ?thesis | |
| 2214 | by (subst sets_restrict_space_iff) (auto simp add: space_restrict_space assms) | |
| 2215 | qed | |
| 2216 | ||
| 56994 | 2217 | lemma measurable_restrict_space1: | 
| 59415 | 2218 | assumes f: "f \<in> measurable M N" | 
| 57025 | 2219 | shows "f \<in> measurable (restrict_space M \<Omega>) N" | 
| 56994 | 2220 | unfolding measurable_def | 
| 2221 | proof (intro CollectI conjI ballI) | |
| 2222 | show sp: "f \<in> space (restrict_space M \<Omega>) \<rightarrow> space N" | |
| 59415 | 2223 | using measurable_space[OF f] by (auto simp: space_restrict_space) | 
| 56994 | 2224 | |
| 2225 | fix A assume "A \<in> sets N" | |
| 57025 | 2226 | have "f -` A \<inter> space (restrict_space M \<Omega>) = (f -` A \<inter> space M) \<inter> (\<Omega> \<inter> space M)" | 
| 59415 | 2227 | by (auto simp: space_restrict_space) | 
| 56994 | 2228 | also have "\<dots> \<in> sets (restrict_space M \<Omega>)" | 
| 59415 | 2229 | unfolding sets_restrict_space | 
| 61808 | 2230 | using measurable_sets[OF f \<open>A \<in> sets N\<close>] by blast | 
| 56994 | 2231 | finally show "f -` A \<inter> space (restrict_space M \<Omega>) \<in> sets (restrict_space M \<Omega>)" . | 
| 2232 | qed | |
| 2233 | ||
| 59415 | 2234 | lemma measurable_restrict_space2_iff: | 
| 2235 | "f \<in> measurable M (restrict_space N \<Omega>) \<longleftrightarrow> (f \<in> measurable M N \<and> f \<in> space M \<rightarrow> \<Omega>)" | |
| 2236 | proof - | |
| 2237 | have "\<And>A. f \<in> space M \<rightarrow> \<Omega> \<Longrightarrow> f -` \<Omega> \<inter> f -` A \<inter> space M = f -` A \<inter> space M" | |
| 2238 | by auto | |
| 2239 | then show ?thesis | |
| 2240 | by (auto simp: measurable_def space_restrict_space Pi_Int[symmetric] sets_restrict_space) | |
| 2241 | qed | |
| 2242 | ||
| 56994 | 2243 | lemma measurable_restrict_space2: | 
| 59415 | 2244 | "f \<in> space M \<rightarrow> \<Omega> \<Longrightarrow> f \<in> measurable M N \<Longrightarrow> f \<in> measurable M (restrict_space N \<Omega>)" | 
| 2245 | by (simp add: measurable_restrict_space2_iff) | |
| 56994 | 2246 | |
| 59415 | 2247 | lemma measurable_piecewise_restrict: | 
| 2248 | assumes I: "countable C" | |
| 2249 | and X: "\<And>\<Omega>. \<Omega> \<in> C \<Longrightarrow> \<Omega> \<inter> space M \<in> sets M" "space M \<subseteq> \<Union>C" | |
| 2250 | and f: "\<And>\<Omega>. \<Omega> \<in> C \<Longrightarrow> f \<in> measurable (restrict_space M \<Omega>) N" | |
| 2251 | shows "f \<in> measurable M N" | |
| 2252 | proof (rule measurableI) | |
| 2253 | fix x assume "x \<in> space M" | |
| 2254 | with X obtain \<Omega> where "\<Omega> \<in> C" "x \<in> \<Omega>" "x \<in> space M" by auto | |
| 2255 | then show "f x \<in> space N" | |
| 2256 | by (auto simp: space_restrict_space intro: f measurable_space) | |
| 57138 
7b3146180291
generalizd measurability on restricted space; rule for integrability on compact sets
 hoelzl parents: 
57137diff
changeset | 2257 | next | 
| 59415 | 2258 | fix A assume A: "A \<in> sets N" | 
| 2259 | have "f -` A \<inter> space M = (\<Union>\<Omega>\<in>C. (f -` A \<inter> (\<Omega> \<inter> space M)))" | |
| 2260 | using X by (auto simp: subset_eq) | |
| 57138 
7b3146180291
generalizd measurability on restricted space; rule for integrability on compact sets
 hoelzl parents: 
57137diff
changeset | 2261 | also have "\<dots> \<in> sets M" | 
| 59415 | 2262 | using measurable_sets[OF f A] X I | 
| 2263 | by (intro sets.countable_UN') (auto simp: sets_restrict_space_iff space_restrict_space) | |
| 2264 | finally show "f -` A \<inter> space M \<in> sets M" . | |
| 57138 
7b3146180291
generalizd measurability on restricted space; rule for integrability on compact sets
 hoelzl parents: 
57137diff
changeset | 2265 | qed | 
| 
7b3146180291
generalizd measurability on restricted space; rule for integrability on compact sets
 hoelzl parents: 
57137diff
changeset | 2266 | |
| 59415 | 2267 | lemma measurable_piecewise_restrict_iff: | 
| 2268 | "countable C \<Longrightarrow> (\<And>\<Omega>. \<Omega> \<in> C \<Longrightarrow> \<Omega> \<inter> space M \<in> sets M) \<Longrightarrow> space M \<subseteq> (\<Union>C) \<Longrightarrow> | |
| 2269 | f \<in> measurable M N \<longleftrightarrow> (\<forall>\<Omega>\<in>C. f \<in> measurable (restrict_space M \<Omega>) N)" | |
| 2270 | by (auto intro: measurable_piecewise_restrict measurable_restrict_space1) | |
| 2271 | ||
| 2272 | lemma measurable_If_restrict_space_iff: | |
| 2273 |   "{x\<in>space M. P x} \<in> sets M \<Longrightarrow>
 | |
| 2274 | (\<lambda>x. if P x then f x else g x) \<in> measurable M N \<longleftrightarrow> | |
| 2275 |     (f \<in> measurable (restrict_space M {x. P x}) N \<and> g \<in> measurable (restrict_space M {x. \<not> P x}) N)"
 | |
| 2276 |   by (subst measurable_piecewise_restrict_iff[where C="{{x. P x}, {x. \<not> P x}}"])
 | |
| 2277 | (auto simp: Int_def sets.sets_Collect_neg space_restrict_space conj_commute[of _ "x \<in> space M" for x] | |
| 2278 | cong: measurable_cong') | |
| 2279 | ||
| 2280 | lemma measurable_If: | |
| 2281 |   "f \<in> measurable M M' \<Longrightarrow> g \<in> measurable M M' \<Longrightarrow> {x\<in>space M. P x} \<in> sets M \<Longrightarrow>
 | |
| 2282 | (\<lambda>x. if P x then f x else g x) \<in> measurable M M'" | |
| 2283 | unfolding measurable_If_restrict_space_iff by (auto intro: measurable_restrict_space1) | |
| 2284 | ||
| 2285 | lemma measurable_If_set: | |
| 2286 | assumes measure: "f \<in> measurable M M'" "g \<in> measurable M M'" | |
| 2287 | assumes P: "A \<inter> space M \<in> sets M" | |
| 2288 | shows "(\<lambda>x. if x \<in> A then f x else g x) \<in> measurable M M'" | |
| 2289 | proof (rule measurable_If[OF measure]) | |
| 2290 |   have "{x \<in> space M. x \<in> A} = A \<inter> space M" by auto
 | |
| 61808 | 2291 |   thus "{x \<in> space M. x \<in> A} \<in> sets M" using \<open>A \<inter> space M \<in> sets M\<close> by auto
 | 
| 59415 | 2292 | qed | 
| 59361 
fd5da2434be4
piecewise measurability using restrict_space; cleanup Borel_Space
 hoelzl parents: 
59092diff
changeset | 2293 | |
| 59415 | 2294 | lemma measurable_restrict_space_iff: | 
| 2295 | "\<Omega> \<inter> space M \<in> sets M \<Longrightarrow> c \<in> space N \<Longrightarrow> | |
| 2296 | f \<in> measurable (restrict_space M \<Omega>) N \<longleftrightarrow> (\<lambda>x. if x \<in> \<Omega> then f x else c) \<in> measurable M N" | |
| 2297 | by (subst measurable_If_restrict_space_iff) | |
| 2298 | (simp_all add: Int_def conj_commute measurable_const) | |
| 2299 | ||
| 2300 | lemma restrict_space_singleton: "{x} \<in> sets M \<Longrightarrow> sets (restrict_space M {x}) = sets (count_space {x})"
 | |
| 2301 |   using sets_restrict_space_iff[of "{x}" M]
 | |
| 2302 | by (auto simp add: sets_restrict_space_iff dest!: subset_singletonD) | |
| 2303 | ||
| 2304 | lemma measurable_restrict_countable: | |
| 2305 | assumes X[intro]: "countable X" | |
| 2306 |   assumes sets[simp]: "\<And>x. x \<in> X \<Longrightarrow> {x} \<in> sets M"
 | |
| 2307 | assumes space[simp]: "\<And>x. x \<in> X \<Longrightarrow> f x \<in> space N" | |
| 2308 | assumes f: "f \<in> measurable (restrict_space M (- X)) N" | |
| 2309 | shows "f \<in> measurable M N" | |
| 2310 | using f sets.countable[OF sets X] | |
| 2311 |   by (intro measurable_piecewise_restrict[where M=M and C="{- X} \<union> ((\<lambda>x. {x}) ` X)"])
 | |
| 2312 | (auto simp: Diff_Int_distrib2 Compl_eq_Diff_UNIV Int_insert_left sets.Diff restrict_space_singleton | |
| 2313 | simp del: sets_count_space cong: measurable_cong_sets) | |
| 2314 | ||
| 2315 | lemma measurable_discrete_difference: | |
| 2316 | assumes f: "f \<in> measurable M N" | |
| 2317 |   assumes X: "countable X" "\<And>x. x \<in> X \<Longrightarrow> {x} \<in> sets M" "\<And>x. x \<in> X \<Longrightarrow> g x \<in> space N"
 | |
| 2318 | assumes eq: "\<And>x. x \<in> space M \<Longrightarrow> x \<notin> X \<Longrightarrow> f x = g x" | |
| 2319 | shows "g \<in> measurable M N" | |
| 2320 | by (rule measurable_restrict_countable[OF X]) | |
| 2321 | (auto simp: eq[symmetric] space_restrict_space cong: measurable_cong' intro: f measurable_restrict_space1) | |
| 59361 
fd5da2434be4
piecewise measurability using restrict_space; cleanup Borel_Space
 hoelzl parents: 
59092diff
changeset | 2322 | |
| 64008 
17a20ca86d62
HOL-Probability: more about probability, prepare for Markov processes in the AFP
 hoelzl parents: 
63627diff
changeset | 2323 | lemma measurable_count_space_extend: "A \<subseteq> B \<Longrightarrow> f \<in> space M \<rightarrow> A \<Longrightarrow> f \<in> M \<rightarrow>\<^sub>M count_space B \<Longrightarrow> f \<in> M \<rightarrow>\<^sub>M count_space A" | 
| 
17a20ca86d62
HOL-Probability: more about probability, prepare for Markov processes in the AFP
 hoelzl parents: 
63627diff
changeset | 2324 | by (auto simp: measurable_def) | 
| 
17a20ca86d62
HOL-Probability: more about probability, prepare for Markov processes in the AFP
 hoelzl parents: 
63627diff
changeset | 2325 | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 2326 | end |