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