| author | wenzelm | 
| Fri, 17 Sep 2010 21:04:56 +0200 | |
| changeset 39510 | d9f5f01faa1b | 
| parent 39092 | 98de40859858 | 
| child 40859 | de0b30e6c2d2 | 
| permissions | -rw-r--r-- | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 1 | header {*Measures*}
 | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 2 | |
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 3 | theory Measure | 
| 38656 | 4 | imports Caratheodory | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 5 | begin | 
| 
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 | text{*From the Hurd/Coble measure theory development, translated by Lawrence Paulson.*}
 | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 8 | |
| 38656 | 9 | section {* Equations for the measure function @{text \<mu>} *}
 | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 10 | |
| 38656 | 11 | lemma (in measure_space) measure_countably_additive: | 
| 12 | assumes "range A \<subseteq> sets M" "disjoint_family A" | |
| 13 | shows "psuminf (\<lambda>i. \<mu> (A i)) = \<mu> (\<Union>i. A i)" | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 14 | proof - | 
| 38656 | 15 | have "(\<Union> i. A i) \<in> sets M" using assms(1) by (rule countable_UN) | 
| 16 | with ca assms show ?thesis by (simp add: countably_additive_def) | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 17 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 18 | |
| 38656 | 19 | lemma (in measure_space) measure_space_cong: | 
| 20 | assumes "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = \<mu> A" | |
| 21 | shows "measure_space M \<nu>" | |
| 22 | proof | |
| 23 |   show "\<nu> {} = 0" using assms by auto
 | |
| 24 | show "countably_additive M \<nu>" unfolding countably_additive_def | |
| 25 | proof safe | |
| 26 | fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> sets M" "disjoint_family A" | |
| 27 | then have "\<And>i. A i \<in> sets M" "(UNION UNIV A) \<in> sets M" by auto | |
| 28 | from this[THEN assms] measure_countably_additive[OF A] | |
| 29 | show "(\<Sum>\<^isub>\<infinity>n. \<nu> (A n)) = \<nu> (UNION UNIV A)" by simp | |
| 30 | qed | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 31 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 32 | |
| 38656 | 33 | lemma (in measure_space) additive: "additive M \<mu>" | 
| 34 | proof (rule algebra.countably_additive_additive [OF _ _ ca]) | |
| 35 | show "algebra M" by default | |
| 36 | show "positive \<mu>" by (simp add: positive_def) | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 37 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 38 | |
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 39 | lemma (in measure_space) measure_additive: | 
| 38656 | 40 |      "a \<in> sets M \<Longrightarrow> b \<in> sets M \<Longrightarrow> a \<inter> b = {}
 | 
| 41 | \<Longrightarrow> \<mu> a + \<mu> b = \<mu> (a \<union> b)" | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 42 | by (metis additiveD additive) | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 43 | |
| 36624 | 44 | lemma (in measure_space) measure_mono: | 
| 45 | assumes "a \<subseteq> b" "a \<in> sets M" "b \<in> sets M" | |
| 38656 | 46 | shows "\<mu> a \<le> \<mu> b" | 
| 36624 | 47 | proof - | 
| 48 | have "b = a \<union> (b - a)" using assms by auto | |
| 49 |   moreover have "{} = a \<inter> (b - a)" by auto
 | |
| 38656 | 50 | ultimately have "\<mu> b = \<mu> a + \<mu> (b - a)" | 
| 36624 | 51 | using measure_additive[of a "b - a"] local.Diff[of b a] assms by auto | 
| 38656 | 52 | moreover have "\<mu> (b - a) \<ge> 0" using assms by auto | 
| 53 | ultimately show "\<mu> a \<le> \<mu> b" by auto | |
| 36624 | 54 | qed | 
| 55 | ||
| 38656 | 56 | lemma (in measure_space) measure_compl: | 
| 57 | assumes s: "s \<in> sets M" and fin: "\<mu> s \<noteq> \<omega>" | |
| 58 | shows "\<mu> (space M - s) = \<mu> (space M) - \<mu> s" | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 59 | proof - | 
| 38656 | 60 | have s_less_space: "\<mu> s \<le> \<mu> (space M)" | 
| 61 | using s by (auto intro!: measure_mono sets_into_space) | |
| 62 | ||
| 63 | have "\<mu> (space M) = \<mu> (s \<union> (space M - s))" using s | |
| 64 | by (metis Un_Diff_cancel Un_absorb1 s sets_into_space) | |
| 65 | also have "... = \<mu> s + \<mu> (space M - s)" | |
| 66 | by (rule additiveD [OF additive]) (auto simp add: s) | |
| 67 | finally have "\<mu> (space M) = \<mu> s + \<mu> (space M - s)" . | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 68 | thus ?thesis | 
| 38656 | 69 | unfolding minus_pinfreal_eq2[OF s_less_space fin] | 
| 70 | by (simp add: ac_simps) | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 71 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 72 | |
| 38656 | 73 | lemma (in measure_space) measure_Diff: | 
| 74 | assumes finite: "\<mu> B \<noteq> \<omega>" | |
| 75 | and measurable: "A \<in> sets M" "B \<in> sets M" "B \<subseteq> A" | |
| 76 | shows "\<mu> (A - B) = \<mu> A - \<mu> B" | |
| 77 | proof - | |
| 78 | have *: "(A - B) \<union> B = A" using `B \<subseteq> A` by auto | |
| 79 | ||
| 80 | have "\<mu> ((A - B) \<union> B) = \<mu> (A - B) + \<mu> B" | |
| 81 | using measurable by (rule_tac measure_additive[symmetric]) auto | |
| 82 | thus ?thesis unfolding * using `\<mu> B \<noteq> \<omega>` | |
| 83 | by (simp add: pinfreal_cancel_plus_minus) | |
| 84 | qed | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 85 | |
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 86 | lemma (in measure_space) measure_countable_increasing: | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 87 | assumes A: "range A \<subseteq> sets M" | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 88 |       and A0: "A 0 = {}"
 | 
| 38656 | 89 | and ASuc: "\<And>n. A n \<subseteq> A (Suc n)" | 
| 90 | shows "(SUP n. \<mu> (A n)) = \<mu> (\<Union>i. A i)" | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 91 | proof - | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 92 |   {
 | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 93 | fix n | 
| 38656 | 94 | have "\<mu> (A n) = | 
| 95 |           setsum (\<mu> \<circ> (\<lambda>i. A (Suc i) - A i)) {..<n}"
 | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 96 | proof (induct n) | 
| 37032 | 97 | case 0 thus ?case by (auto simp add: A0) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 98 | next | 
| 38656 | 99 | case (Suc m) | 
| 33536 | 100 | have "A (Suc m) = A m \<union> (A (Suc m) - A m)" | 
| 101 | by (metis ASuc Un_Diff_cancel Un_absorb1) | |
| 38656 | 102 | hence "\<mu> (A (Suc m)) = | 
| 103 | \<mu> (A m) + \<mu> (A (Suc m) - A m)" | |
| 104 | by (subst measure_additive) | |
| 105 | (auto simp add: measure_additive range_subsetD [OF A]) | |
| 33536 | 106 | with Suc show ?case | 
| 107 | by simp | |
| 38656 | 108 | qed } | 
| 109 | note Meq = this | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 110 | have Aeq: "(\<Union>i. A (Suc i) - A i) = (\<Union>i. A i)" | 
| 38656 | 111 | proof (rule UN_finite2_eq [where k=1], simp) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 112 | fix i | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 113 |       show "(\<Union>i\<in>{0..<i}. A (Suc i) - A i) = (\<Union>i\<in>{0..<Suc i}. A i)"
 | 
| 33536 | 114 | proof (induct i) | 
| 115 | case 0 thus ?case by (simp add: A0) | |
| 116 | next | |
| 38656 | 117 | case (Suc i) | 
| 33536 | 118 | thus ?case | 
| 119 | by (auto simp add: atLeastLessThanSuc intro: subsetD [OF ASuc]) | |
| 120 | qed | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 121 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 122 | have A1: "\<And>i. A (Suc i) - A i \<in> sets M" | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 123 | by (metis A Diff range_subsetD) | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 124 | have A2: "(\<Union>i. A (Suc i) - A i) \<in> sets M" | 
| 37032 | 125 | by (blast intro: range_subsetD [OF A]) | 
| 38656 | 126 | have "psuminf ( (\<lambda>i. \<mu> (A (Suc i) - A i))) = \<mu> (\<Union>i. A (Suc i) - A i)" | 
| 127 | by (rule measure_countably_additive) | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 128 | (auto simp add: disjoint_family_Suc ASuc A1 A2) | 
| 38656 | 129 | also have "... = \<mu> (\<Union>i. A i)" | 
| 130 | by (simp add: Aeq) | |
| 131 | finally have "psuminf (\<lambda>i. \<mu> (A (Suc i) - A i)) = \<mu> (\<Union>i. A i)" . | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 132 | thus ?thesis | 
| 38656 | 133 | by (auto simp add: Meq psuminf_def) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 134 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 135 | |
| 38656 | 136 | lemma (in measure_space) continuity_from_below: | 
| 137 | assumes A: "range A \<subseteq> sets M" | |
| 138 | and ASuc: "!!n. A n \<subseteq> A (Suc n)" | |
| 139 | shows "(SUP n. \<mu> (A n)) = \<mu> (\<Union>i. A i)" | |
| 140 | proof - | |
| 141 |   have *: "(SUP n. \<mu> (nat_case {} A (Suc n))) = (SUP n. \<mu> (nat_case {} A n))"
 | |
| 142 | apply (rule Sup_mono_offset_Suc) | |
| 143 | apply (rule measure_mono) | |
| 144 | using assms by (auto split: nat.split) | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 145 | |
| 38656 | 146 |   have ueq: "(\<Union>i. nat_case {} A i) = (\<Union>i. A i)"
 | 
| 147 | by (auto simp add: split: nat.splits) | |
| 148 |   have meq: "\<And>n. \<mu> (A n) = (\<mu> \<circ> nat_case {} A) (Suc n)"
 | |
| 149 | by simp | |
| 150 |   have "(SUP n. \<mu> (nat_case {} A n)) = \<mu> (\<Union>i. nat_case {} A i)"
 | |
| 151 | by (rule measure_countable_increasing) | |
| 152 | (auto simp add: range_subsetD [OF A] subsetD [OF ASuc] split: nat.splits) | |
| 153 |   also have "\<mu> (\<Union>i. nat_case {} A i) = \<mu> (\<Union>i. A i)"
 | |
| 154 | by (simp add: ueq) | |
| 155 |   finally have "(SUP n. \<mu> (nat_case {} A n)) = \<mu> (\<Union>i. A i)" .
 | |
| 156 | thus ?thesis unfolding meq * comp_def . | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 157 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 158 | |
| 38656 | 159 | lemma (in measure_space) measure_up: | 
| 160 | assumes "P \<in> sets M" "\<And>i. B i \<in> sets M" "B \<up> P" | |
| 161 | shows "(\<lambda>i. \<mu> (B i)) \<up> \<mu> P" | |
| 162 | using assms unfolding isoton_def | |
| 163 | by (auto intro!: measure_mono continuity_from_below) | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 164 | |
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 165 | |
| 38656 | 166 | lemma (in measure_space) continuity_from_above: | 
| 167 | assumes A: "range A \<subseteq> sets M" | |
| 168 | and mono_Suc: "\<And>n. A (Suc n) \<subseteq> A n" | |
| 169 | and finite: "\<And>i. \<mu> (A i) \<noteq> \<omega>" | |
| 170 | shows "(INF n. \<mu> (A n)) = \<mu> (\<Inter>i. A i)" | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 171 | proof - | 
| 38656 | 172 |   { fix n have "A n \<subseteq> A 0" using mono_Suc by (induct n) auto }
 | 
| 173 | note mono = this | |
| 174 | ||
| 175 | have le_MI: "\<mu> (\<Inter>i. A i) \<le> \<mu> (A 0)" | |
| 176 | using A by (auto intro!: measure_mono) | |
| 177 | hence *: "\<mu> (\<Inter>i. A i) \<noteq> \<omega>" using finite[of 0] by auto | |
| 178 | ||
| 179 | have le_IM: "(INF n. \<mu> (A n)) \<le> \<mu> (A 0)" | |
| 180 | by (rule INF_leI) simp | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 181 | |
| 38656 | 182 | have "\<mu> (A 0) - (INF n. \<mu> (A n)) = (SUP n. \<mu> (A 0 - A n))" | 
| 183 | unfolding pinfreal_SUP_minus[symmetric] | |
| 184 | using mono A finite by (subst measure_Diff) auto | |
| 185 | also have "\<dots> = \<mu> (\<Union>i. A 0 - A i)" | |
| 186 | proof (rule continuity_from_below) | |
| 187 | show "range (\<lambda>n. A 0 - A n) \<subseteq> sets M" | |
| 188 | using A by auto | |
| 189 | show "\<And>n. A 0 - A n \<subseteq> A 0 - A (Suc n)" | |
| 190 | using mono_Suc by auto | |
| 191 | qed | |
| 192 | also have "\<dots> = \<mu> (A 0) - \<mu> (\<Inter>i. A i)" | |
| 193 | using mono A finite * by (simp, subst measure_Diff) auto | |
| 194 | finally show ?thesis | |
| 195 | by (rule pinfreal_diff_eq_diff_imp_eq[OF finite[of 0] le_IM le_MI]) | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 196 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 197 | |
| 38656 | 198 | lemma (in measure_space) measure_down: | 
| 199 | assumes "P \<in> sets M" "\<And>i. B i \<in> sets M" "B \<down> P" | |
| 200 | and finite: "\<And>i. \<mu> (B i) \<noteq> \<omega>" | |
| 201 | shows "(\<lambda>i. \<mu> (B i)) \<down> \<mu> P" | |
| 202 | using assms unfolding antiton_def | |
| 203 | by (auto intro!: measure_mono continuity_from_above) | |
| 204 | lemma (in measure_space) measure_insert: | |
| 205 |   assumes sets: "{x} \<in> sets M" "A \<in> sets M" and "x \<notin> A"
 | |
| 206 |   shows "\<mu> (insert x A) = \<mu> {x} + \<mu> A"
 | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 207 | proof - | 
| 38656 | 208 |   have "{x} \<inter> A = {}" using `x \<notin> A` by auto
 | 
| 209 | from measure_additive[OF sets this] show ?thesis by simp | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 210 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 211 | |
| 38656 | 212 | lemma (in measure_space) measure_finite_singleton: | 
| 213 | assumes fin: "finite S" | |
| 214 |   and ssets: "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
 | |
| 215 |   shows "\<mu> S = (\<Sum>x\<in>S. \<mu> {x})"
 | |
| 216 | using assms proof induct | |
| 217 | case (insert x S) | |
| 218 |   have *: "\<mu> S = (\<Sum>x\<in>S. \<mu> {x})" "{x} \<in> sets M"
 | |
| 219 | using insert.prems by (blast intro!: insert.hyps(3))+ | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 220 | |
| 38656 | 221 |   have "(\<Union>x\<in>S. {x}) \<in> sets M"
 | 
| 222 | using insert.prems `finite S` by (blast intro!: finite_UN) | |
| 223 | hence "S \<in> sets M" by auto | |
| 224 |   from measure_insert[OF `{x} \<in> sets M` this `x \<notin> S`]
 | |
| 225 | show ?case using `x \<notin> S` `finite S` * by simp | |
| 226 | qed simp | |
| 35582 | 227 | |
| 228 | lemma (in measure_space) measure_finitely_additive': | |
| 38656 | 229 |   assumes "f \<in> ({..< n :: nat} \<rightarrow> sets M)"
 | 
| 35582 | 230 |   assumes "\<And> a b. \<lbrakk>a < n ; b < n ; a \<noteq> b\<rbrakk> \<Longrightarrow> f a \<inter> f b = {}"
 | 
| 38656 | 231 |   assumes "s = \<Union> (f ` {..< n})"
 | 
| 232 | shows "(\<Sum>i<n. (\<mu> \<circ> f) i) = \<mu> s" | |
| 35582 | 233 | proof - | 
| 234 |   def f' == "\<lambda> i. (if i < n then f i else {})"
 | |
| 38656 | 235 | have rf: "range f' \<subseteq> sets M" unfolding f'_def | 
| 35582 | 236 | using assms empty_sets by auto | 
| 38656 | 237 | have df: "disjoint_family f'" unfolding f'_def disjoint_family_on_def | 
| 35582 | 238 | using assms by simp | 
| 38656 | 239 |   have "\<Union> range f' = (\<Union> i \<in> {..< n}. f i)"
 | 
| 35582 | 240 | unfolding f'_def by auto | 
| 38656 | 241 | then have "\<mu> s = \<mu> (\<Union> range f')" | 
| 35582 | 242 | using assms by simp | 
| 38656 | 243 | then have part1: "(\<Sum>\<^isub>\<infinity> i. \<mu> (f' i)) = \<mu> s" | 
| 35582 | 244 | using df rf ca[unfolded countably_additive_def, rule_format, of f'] | 
| 245 | by auto | |
| 246 | ||
| 38656 | 247 | have "(\<Sum>\<^isub>\<infinity> i. \<mu> (f' i)) = (\<Sum> i< n. \<mu> (f' i))" | 
| 248 | by (rule psuminf_finite) (simp add: f'_def) | |
| 249 | also have "\<dots> = (\<Sum>i<n. \<mu> (f i))" | |
| 35582 | 250 | unfolding f'_def by auto | 
| 38656 | 251 | finally have part2: "(\<Sum>\<^isub>\<infinity> i. \<mu> (f' i)) = (\<Sum>i<n. \<mu> (f i))" by simp | 
| 252 | show ?thesis using part1 part2 by auto | |
| 35582 | 253 | qed | 
| 254 | ||
| 255 | ||
| 256 | lemma (in measure_space) measure_finitely_additive: | |
| 257 | assumes "finite r" | |
| 258 | assumes "r \<subseteq> sets M" | |
| 259 |   assumes d: "\<And> a b. \<lbrakk>a \<in> r ; b \<in> r ; a \<noteq> b\<rbrakk> \<Longrightarrow> a \<inter> b = {}"
 | |
| 38656 | 260 | shows "(\<Sum> i \<in> r. \<mu> i) = \<mu> (\<Union> r)" | 
| 35582 | 261 | using assms | 
| 262 | proof - | |
| 263 | (* counting the elements in r is enough *) | |
| 38656 | 264 |   let ?R = "{..<card r}"
 | 
| 35582 | 265 | obtain f where f: "f ` ?R = r" "inj_on f ?R" | 
| 266 | using ex_bij_betw_nat_finite[unfolded bij_betw_def, OF `finite r`] | |
| 38656 | 267 | unfolding atLeast0LessThan by auto | 
| 35582 | 268 | hence f_into_sets: "f \<in> ?R \<rightarrow> sets M" using assms by auto | 
| 269 |   have disj: "\<And> a b. \<lbrakk>a \<in> ?R ; b \<in> ?R ; a \<noteq> b\<rbrakk> \<Longrightarrow> f a \<inter> f b = {}"
 | |
| 270 | proof - | |
| 271 | fix a b assume asm: "a \<in> ?R" "b \<in> ?R" "a \<noteq> b" | |
| 272 | hence neq: "f a \<noteq> f b" using f[unfolded inj_on_def, rule_format] by blast | |
| 273 | from asm have "f a \<in> r" "f b \<in> r" using f by auto | |
| 274 |     thus "f a \<inter> f b = {}" using d[of "f a" "f b"] f using neq by auto
 | |
| 275 | qed | |
| 276 | have "(\<Union> r) = (\<Union> i \<in> ?R. f i)" | |
| 277 | using f by auto | |
| 38656 | 278 | hence "\<mu> (\<Union> r)= \<mu> (\<Union> i \<in> ?R. f i)" by simp | 
| 279 | also have "\<dots> = (\<Sum> i \<in> ?R. \<mu> (f i))" | |
| 35582 | 280 | using measure_finitely_additive'[OF f_into_sets disj] by simp | 
| 38656 | 281 | also have "\<dots> = (\<Sum> a \<in> r. \<mu> a)" | 
| 282 | using f[rule_format] setsum_reindex[of f ?R "\<lambda> a. \<mu> a"] by auto | |
| 35582 | 283 | finally show ?thesis by simp | 
| 284 | qed | |
| 285 | ||
| 286 | lemma (in measure_space) measure_finitely_additive'': | |
| 287 | assumes "finite s" | |
| 288 | assumes "\<And> i. i \<in> s \<Longrightarrow> a i \<in> sets M" | |
| 289 | assumes d: "disjoint_family_on a s" | |
| 38656 | 290 | shows "(\<Sum> i \<in> s. \<mu> (a i)) = \<mu> (\<Union> i \<in> s. a i)" | 
| 35582 | 291 | using assms | 
| 292 | proof - | |
| 293 | (* counting the elements in s is enough *) | |
| 38656 | 294 |   let ?R = "{..< card s}"
 | 
| 35582 | 295 | obtain f where f: "f ` ?R = s" "inj_on f ?R" | 
| 296 | using ex_bij_betw_nat_finite[unfolded bij_betw_def, OF `finite s`] | |
| 38656 | 297 | unfolding atLeast0LessThan by auto | 
| 35582 | 298 | hence f_into_sets: "a \<circ> f \<in> ?R \<rightarrow> sets M" using assms unfolding o_def by auto | 
| 299 |   have disj: "\<And> i j. \<lbrakk>i \<in> ?R ; j \<in> ?R ; i \<noteq> j\<rbrakk> \<Longrightarrow> (a \<circ> f) i \<inter> (a \<circ> f) j = {}"
 | |
| 300 | proof - | |
| 301 | fix i j assume asm: "i \<in> ?R" "j \<in> ?R" "i \<noteq> j" | |
| 302 | hence neq: "f i \<noteq> f j" using f[unfolded inj_on_def, rule_format] by blast | |
| 303 | from asm have "f i \<in> s" "f j \<in> s" using f by auto | |
| 304 |     thus "(a \<circ> f) i \<inter> (a \<circ> f) j = {}"
 | |
| 305 | using d f neq unfolding disjoint_family_on_def by auto | |
| 306 | qed | |
| 307 | have "(\<Union> i \<in> s. a i) = (\<Union> i \<in> f ` ?R. a i)" using f by auto | |
| 308 | hence "(\<Union> i \<in> s. a i) = (\<Union> i \<in> ?R. a (f i))" by auto | |
| 38656 | 309 | hence "\<mu> (\<Union> i \<in> s. a i) = (\<Sum> i \<in> ?R. \<mu> (a (f i)))" | 
| 35582 | 310 | using measure_finitely_additive'[OF f_into_sets disj] by simp | 
| 38656 | 311 | also have "\<dots> = (\<Sum> i \<in> s. \<mu> (a i))" | 
| 312 | using f[rule_format] setsum_reindex[of f ?R "\<lambda> i. \<mu> (a i)"] by auto | |
| 35582 | 313 | finally show ?thesis by simp | 
| 314 | qed | |
| 315 | ||
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 316 | lemma (in sigma_algebra) finite_additivity_sufficient: | 
| 38656 | 317 | assumes fin: "finite (space M)" and pos: "positive \<mu>" and add: "additive M \<mu>" | 
| 318 | shows "measure_space M \<mu>" | |
| 319 | proof | |
| 320 |   show [simp]: "\<mu> {} = 0" using pos by (simp add: positive_def)
 | |
| 321 | show "countably_additive M \<mu>" | |
| 322 | proof (auto simp add: countably_additive_def) | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 323 | fix A :: "nat \<Rightarrow> 'a set" | 
| 38656 | 324 | assume A: "range A \<subseteq> sets M" | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 325 | and disj: "disjoint_family A" | 
| 38656 | 326 | and UnA: "(\<Union>i. A i) \<in> sets M" | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 327 |       def I \<equiv> "{i. A i \<noteq> {}}"
 | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 328 | have "Union (A ` I) \<subseteq> space M" using A | 
| 38656 | 329 | by auto (metis range_subsetD subsetD sets_into_space) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 330 | hence "finite (A ` I)" | 
| 38656 | 331 | by (metis finite_UnionD finite_subset fin) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 332 | moreover have "inj_on A I" using disj | 
| 38656 | 333 | by (auto simp add: I_def disjoint_family_on_def inj_on_def) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 334 | ultimately have finI: "finite I" | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 335 | by (metis finite_imageD) | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 336 |       hence "\<exists>N. \<forall>m\<ge>N. A m = {}"
 | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 337 |         proof (cases "I = {}")
 | 
| 38656 | 338 | case True thus ?thesis by (simp add: I_def) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 339 | next | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 340 | case False | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 341 | hence "\<forall>i\<in>I. i < Suc(Max I)" | 
| 38656 | 342 | by (simp add: Max_less_iff [symmetric] finI) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 343 |           hence "\<forall>m \<ge> Suc(Max I). A m = {}"
 | 
| 38656 | 344 | by (simp add: I_def) (metis less_le_not_le) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 345 | thus ?thesis | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 346 | by blast | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 347 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 348 |       then obtain N where N: "\<forall>m\<ge>N. A m = {}" by blast
 | 
| 38656 | 349 | then have "\<forall>m\<ge>N. \<mu> (A m) = 0" by simp | 
| 350 |       then have "(\<Sum>\<^isub>\<infinity> n. \<mu> (A n)) = setsum (\<lambda>m. \<mu> (A m)) {..<N}"
 | |
| 351 | by (simp add: psuminf_finite) | |
| 352 | also have "... = \<mu> (\<Union>i<N. A i)" | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 353 | proof (induct N) | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 354 | case 0 thus ?case by simp | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 355 | next | 
| 38656 | 356 | case (Suc n) | 
| 357 | have "\<mu> (A n \<union> (\<Union> x<n. A x)) = \<mu> (A n) + \<mu> (\<Union> i<n. A i)" | |
| 358 | proof (rule Caratheodory.additiveD [OF add]) | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 359 |               show "A n \<inter> (\<Union> x<n. A x) = {}" using disj
 | 
| 35582 | 360 | by (auto simp add: disjoint_family_on_def nat_less_le) blast | 
| 38656 | 361 | show "A n \<in> sets M" using A | 
| 362 | by force | |
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 363 | show "(\<Union>i<n. A i) \<in> sets M" | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 364 | proof (induct n) | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 365 | case 0 thus ?case by simp | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 366 | next | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 367 | case (Suc n) thus ?case using A | 
| 38656 | 368 | by (simp add: lessThan_Suc Un range_subsetD) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 369 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 370 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 371 | thus ?case using Suc | 
| 38656 | 372 | by (simp add: lessThan_Suc) | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 373 | qed | 
| 38656 | 374 | also have "... = \<mu> (\<Union>i. A i)" | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 375 | proof - | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 376 | have "(\<Union> i<N. A i) = (\<Union>i. A i)" using N | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 377 | by auto (metis Int_absorb N disjoint_iff_not_equal lessThan_iff not_leE) | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 378 | thus ?thesis by simp | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 379 | qed | 
| 38656 | 380 | finally show "(\<Sum>\<^isub>\<infinity> n. \<mu> (A n)) = \<mu> (\<Union>i. A i)" . | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 381 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 382 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: diff
changeset | 383 | |
| 35692 | 384 | lemma (in measure_space) measure_setsum_split: | 
| 385 | assumes "finite r" and "a \<in> sets M" and br_in_M: "b ` r \<subseteq> sets M" | |
| 386 | assumes "(\<Union>i \<in> r. b i) = space M" | |
| 387 | assumes "disjoint_family_on b r" | |
| 38656 | 388 | shows "\<mu> a = (\<Sum> i \<in> r. \<mu> (a \<inter> (b i)))" | 
| 35692 | 389 | proof - | 
| 38656 | 390 | have *: "\<mu> a = \<mu> (\<Union>i \<in> r. a \<inter> b i)" | 
| 35692 | 391 | using assms by auto | 
| 392 | show ?thesis unfolding * | |
| 393 | proof (rule measure_finitely_additive''[symmetric]) | |
| 394 | show "finite r" using `finite r` by auto | |
| 395 |     { fix i assume "i \<in> r"
 | |
| 396 | hence "b i \<in> sets M" using br_in_M by auto | |
| 397 | thus "a \<inter> b i \<in> sets M" using `a \<in> sets M` by auto | |
| 398 | } | |
| 399 | show "disjoint_family_on (\<lambda>i. a \<inter> b i) r" | |
| 400 | using `disjoint_family_on b r` | |
| 401 | unfolding disjoint_family_on_def by auto | |
| 402 | qed | |
| 403 | qed | |
| 404 | ||
| 38656 | 405 | lemma (in measure_space) measure_subadditive: | 
| 406 | assumes measurable: "A \<in> sets M" "B \<in> sets M" | |
| 407 | shows "\<mu> (A \<union> B) \<le> \<mu> A + \<mu> B" | |
| 408 | proof - | |
| 409 | from measure_additive[of A "B - A"] | |
| 410 | have "\<mu> (A \<union> B) = \<mu> A + \<mu> (B - A)" | |
| 411 | using assms by (simp add: Diff) | |
| 412 | also have "\<dots> \<le> \<mu> A + \<mu> B" | |
| 413 | using assms by (auto intro!: add_left_mono measure_mono) | |
| 414 | finally show ?thesis . | |
| 415 | qed | |
| 416 | ||
| 39092 | 417 | lemma (in measure_space) measure_finitely_subadditive: | 
| 418 | assumes "finite I" "A ` I \<subseteq> sets M" | |
| 419 | shows "\<mu> (\<Union>i\<in>I. A i) \<le> (\<Sum>i\<in>I. \<mu> (A i))" | |
| 420 | using assms proof induct | |
| 421 | case (insert i I) | |
| 422 | then have "(\<Union>i\<in>I. A i) \<in> sets M" by (auto intro: finite_UN) | |
| 423 | then have "\<mu> (\<Union>i\<in>insert i I. A i) \<le> \<mu> (A i) + \<mu> (\<Union>i\<in>I. A i)" | |
| 424 | using insert by (simp add: measure_subadditive) | |
| 425 | also have "\<dots> \<le> (\<Sum>i\<in>insert i I. \<mu> (A i))" | |
| 426 | using insert by (auto intro!: add_left_mono) | |
| 427 | finally show ?case . | |
| 428 | qed simp | |
| 429 | ||
| 38656 | 430 | lemma (in measure_space) measurable_countably_subadditive: | 
| 431 | assumes "range f \<subseteq> sets M" | |
| 432 | shows "\<mu> (\<Union>i. f i) \<le> (\<Sum>\<^isub>\<infinity> i. \<mu> (f i))" | |
| 433 | proof - | |
| 434 | have "\<mu> (\<Union>i. f i) = \<mu> (\<Union>i. disjointed f i)" | |
| 435 | unfolding UN_disjointed_eq .. | |
| 436 | also have "\<dots> = (\<Sum>\<^isub>\<infinity> i. \<mu> (disjointed f i))" | |
| 437 | using range_disjointed_sets[OF assms] measure_countably_additive | |
| 438 | by (simp add: disjoint_family_disjointed comp_def) | |
| 439 | also have "\<dots> \<le> (\<Sum>\<^isub>\<infinity> i. \<mu> (f i))" | |
| 440 | proof (rule psuminf_le, rule measure_mono) | |
| 441 | fix i show "disjointed f i \<subseteq> f i" by (rule disjointed_subset) | |
| 442 | show "f i \<in> sets M" "disjointed f i \<in> sets M" | |
| 443 | using assms range_disjointed_sets[OF assms] by auto | |
| 444 | qed | |
| 445 | finally show ?thesis . | |
| 446 | qed | |
| 447 | ||
| 39092 | 448 | lemma (in measure_space) measure_inter_full_set: | 
| 449 | assumes "S \<in> sets M" "T \<in> sets M" and not_\<omega>: "\<mu> (T - S) \<noteq> \<omega>" | |
| 450 | assumes T: "\<mu> T = \<mu> (space M)" | |
| 451 | shows "\<mu> (S \<inter> T) = \<mu> S" | |
| 452 | proof (rule antisym) | |
| 453 | show " \<mu> (S \<inter> T) \<le> \<mu> S" | |
| 454 | using assms by (auto intro!: measure_mono) | |
| 455 | ||
| 456 | show "\<mu> S \<le> \<mu> (S \<inter> T)" | |
| 457 | proof (rule ccontr) | |
| 458 | assume contr: "\<not> ?thesis" | |
| 459 | have "\<mu> (space M) = \<mu> ((T - S) \<union> (S \<inter> T))" | |
| 460 | unfolding T[symmetric] by (auto intro!: arg_cong[where f="\<mu>"]) | |
| 461 | also have "\<dots> \<le> \<mu> (T - S) + \<mu> (S \<inter> T)" | |
| 462 | using assms by (auto intro!: measure_subadditive) | |
| 463 | also have "\<dots> < \<mu> (T - S) + \<mu> S" | |
| 464 | by (rule pinfreal_less_add[OF not_\<omega>]) (insert contr, auto) | |
| 465 | also have "\<dots> = \<mu> (T \<union> S)" | |
| 466 | using assms by (subst measure_additive) auto | |
| 467 | also have "\<dots> \<le> \<mu> (space M)" | |
| 468 | using assms sets_into_space by (auto intro!: measure_mono) | |
| 469 | finally show False .. | |
| 470 | qed | |
| 471 | qed | |
| 472 | ||
| 38656 | 473 | lemma (in measure_space) restricted_measure_space: | 
| 474 | assumes "S \<in> sets M" | |
| 39092 | 475 | shows "measure_space (restricted_space S) \<mu>" | 
| 38656 | 476 | (is "measure_space ?r \<mu>") | 
| 477 | unfolding measure_space_def measure_space_axioms_def | |
| 478 | proof safe | |
| 479 | show "sigma_algebra ?r" using restricted_sigma_algebra[OF assms] . | |
| 480 |   show "\<mu> {} = 0" by simp
 | |
| 481 | show "countably_additive ?r \<mu>" | |
| 482 | unfolding countably_additive_def | |
| 483 | proof safe | |
| 484 | fix A :: "nat \<Rightarrow> 'a set" | |
| 485 | assume *: "range A \<subseteq> sets ?r" and **: "disjoint_family A" | |
| 486 | from restriction_in_sets[OF assms *[simplified]] ** | |
| 487 | show "(\<Sum>\<^isub>\<infinity> n. \<mu> (A n)) = \<mu> (\<Union>i. A i)" | |
| 488 | using measure_countably_additive by simp | |
| 489 | qed | |
| 490 | qed | |
| 491 | ||
| 39089 | 492 | lemma (in measure_space) measure_space_vimage: | 
| 493 | assumes "f \<in> measurable M M'" | |
| 494 | and "sigma_algebra M'" | |
| 495 | shows "measure_space M' (\<lambda>A. \<mu> (f -` A \<inter> space M))" (is "measure_space M' ?T") | |
| 496 | proof - | |
| 497 | interpret M': sigma_algebra M' by fact | |
| 498 | ||
| 499 | show ?thesis | |
| 500 | proof | |
| 501 |     show "?T {} = 0" by simp
 | |
| 502 | ||
| 503 | show "countably_additive M' ?T" | |
| 504 | proof (unfold countably_additive_def, safe) | |
| 505 | fix A :: "nat \<Rightarrow> 'c set" assume "range A \<subseteq> sets M'" "disjoint_family A" | |
| 506 | hence *: "\<And>i. f -` (A i) \<inter> space M \<in> sets M" | |
| 507 | using `f \<in> measurable M M'` by (auto simp: measurable_def) | |
| 508 | moreover have "(\<Union>i. f -` A i \<inter> space M) \<in> sets M" | |
| 509 | using * by blast | |
| 510 | moreover have **: "disjoint_family (\<lambda>i. f -` A i \<inter> space M)" | |
| 511 | using `disjoint_family A` by (auto simp: disjoint_family_on_def) | |
| 512 | ultimately show "(\<Sum>\<^isub>\<infinity> i. ?T (A i)) = ?T (\<Union>i. A i)" | |
| 513 | using measure_countably_additive[OF _ **] by (auto simp: comp_def vimage_UN) | |
| 514 | qed | |
| 515 | qed | |
| 516 | qed | |
| 517 | ||
| 39092 | 518 | lemma (in measure_space) measure_space_subalgebra: | 
| 519 | assumes "N \<subseteq> sets M" "sigma_algebra (M\<lparr> sets := N \<rparr>)" | |
| 520 | shows "measure_space (M\<lparr> sets := N \<rparr>) \<mu>" | |
| 521 | proof - | |
| 522 | interpret N: sigma_algebra "M\<lparr> sets := N \<rparr>" by fact | |
| 523 | show ?thesis | |
| 524 | proof | |
| 525 | show "countably_additive (M\<lparr>sets := N\<rparr>) \<mu>" | |
| 526 | using `N \<subseteq> sets M` | |
| 527 | by (auto simp add: countably_additive_def | |
| 528 | intro!: measure_countably_additive) | |
| 529 | qed simp | |
| 530 | qed | |
| 531 | ||
| 38656 | 532 | section "@{text \<sigma>}-finite Measures"
 | 
| 533 | ||
| 534 | locale sigma_finite_measure = measure_space + | |
| 535 | assumes sigma_finite: "\<exists>A::nat \<Rightarrow> 'a set. range A \<subseteq> sets M \<and> (\<Union>i. A i) = space M \<and> (\<forall>i. \<mu> (A i) \<noteq> \<omega>)" | |
| 536 | ||
| 537 | lemma (in sigma_finite_measure) restricted_sigma_finite_measure: | |
| 538 | assumes "S \<in> sets M" | |
| 39092 | 539 | shows "sigma_finite_measure (restricted_space S) \<mu>" | 
| 38656 | 540 | (is "sigma_finite_measure ?r _") | 
| 541 | unfolding sigma_finite_measure_def sigma_finite_measure_axioms_def | |
| 542 | proof safe | |
| 543 | show "measure_space ?r \<mu>" using restricted_measure_space[OF assms] . | |
| 544 | next | |
| 545 | obtain A :: "nat \<Rightarrow> 'a set" where | |
| 546 | "range A \<subseteq> sets M" "(\<Union>i. A i) = space M" "\<And>i. \<mu> (A i) \<noteq> \<omega>" | |
| 547 | using sigma_finite by auto | |
| 548 | show "\<exists>A::nat \<Rightarrow> 'a set. range A \<subseteq> sets ?r \<and> (\<Union>i. A i) = space ?r \<and> (\<forall>i. \<mu> (A i) \<noteq> \<omega>)" | |
| 549 | proof (safe intro!: exI[of _ "\<lambda>i. A i \<inter> S"] del: notI) | |
| 550 | fix i | |
| 551 | show "A i \<inter> S \<in> sets ?r" | |
| 552 | using `range A \<subseteq> sets M` `S \<in> sets M` by auto | |
| 553 | next | |
| 554 | fix x i assume "x \<in> S" thus "x \<in> space ?r" by simp | |
| 555 | next | |
| 556 | fix x assume "x \<in> space ?r" thus "x \<in> (\<Union>i. A i \<inter> S)" | |
| 557 | using `(\<Union>i. A i) = space M` `S \<in> sets M` by auto | |
| 558 | next | |
| 559 | fix i | |
| 560 | have "\<mu> (A i \<inter> S) \<le> \<mu> (A i)" | |
| 561 | using `range A \<subseteq> sets M` `S \<in> sets M` by (auto intro!: measure_mono) | |
| 562 | also have "\<dots> < \<omega>" using `\<mu> (A i) \<noteq> \<omega>` by (auto simp: pinfreal_less_\<omega>) | |
| 563 | finally show "\<mu> (A i \<inter> S) \<noteq> \<omega>" by (auto simp: pinfreal_less_\<omega>) | |
| 564 | qed | |
| 565 | qed | |
| 566 | ||
| 39092 | 567 | lemma (in sigma_finite_measure) disjoint_sigma_finite: | 
| 568 | "\<exists>A::nat\<Rightarrow>'a set. range A \<subseteq> sets M \<and> (\<Union>i. A i) = space M \<and> | |
| 569 | (\<forall>i. \<mu> (A i) \<noteq> \<omega>) \<and> disjoint_family A" | |
| 570 | proof - | |
| 571 | obtain A :: "nat \<Rightarrow> 'a set" where | |
| 572 | range: "range A \<subseteq> sets M" and | |
| 573 | space: "(\<Union>i. A i) = space M" and | |
| 574 | measure: "\<And>i. \<mu> (A i) \<noteq> \<omega>" | |
| 575 | using sigma_finite by auto | |
| 576 | note range' = range_disjointed_sets[OF range] range | |
| 577 |   { fix i
 | |
| 578 | have "\<mu> (disjointed A i) \<le> \<mu> (A i)" | |
| 579 | using range' disjointed_subset[of A i] by (auto intro!: measure_mono) | |
| 580 | then have "\<mu> (disjointed A i) \<noteq> \<omega>" | |
| 581 | using measure[of i] by auto } | |
| 582 | with disjoint_family_disjointed UN_disjointed_eq[of A] space range' | |
| 583 | show ?thesis by (auto intro!: exI[of _ "disjointed A"]) | |
| 584 | qed | |
| 585 | ||
| 38656 | 586 | section "Real measure values" | 
| 587 | ||
| 588 | lemma (in measure_space) real_measure_Union: | |
| 589 | assumes finite: "\<mu> A \<noteq> \<omega>" "\<mu> B \<noteq> \<omega>" | |
| 590 |   and measurable: "A \<in> sets M" "B \<in> sets M" "A \<inter> B = {}"
 | |
| 591 | shows "real (\<mu> (A \<union> B)) = real (\<mu> A) + real (\<mu> B)" | |
| 592 | unfolding measure_additive[symmetric, OF measurable] | |
| 593 | using finite by (auto simp: real_of_pinfreal_add) | |
| 594 | ||
| 595 | lemma (in measure_space) real_measure_finite_Union: | |
| 596 | assumes measurable: | |
| 597 | "finite S" "\<And>i. i \<in> S \<Longrightarrow> A i \<in> sets M" "disjoint_family_on A S" | |
| 598 | assumes finite: "\<And>i. i \<in> S \<Longrightarrow> \<mu> (A i) \<noteq> \<omega>" | |
| 599 | shows "real (\<mu> (\<Union>i\<in>S. A i)) = (\<Sum>i\<in>S. real (\<mu> (A i)))" | |
| 600 | using real_of_pinfreal_setsum[of S, OF finite] | |
| 601 | measure_finitely_additive''[symmetric, OF measurable] | |
| 602 | by simp | |
| 603 | ||
| 604 | lemma (in measure_space) real_measure_Diff: | |
| 605 | assumes finite: "\<mu> A \<noteq> \<omega>" | |
| 606 | and measurable: "A \<in> sets M" "B \<in> sets M" "B \<subseteq> A" | |
| 607 | shows "real (\<mu> (A - B)) = real (\<mu> A) - real (\<mu> B)" | |
| 608 | proof - | |
| 609 | have "\<mu> (A - B) \<le> \<mu> A" | |
| 610 | "\<mu> B \<le> \<mu> A" | |
| 611 | using measurable by (auto intro!: measure_mono) | |
| 612 | hence "real (\<mu> ((A - B) \<union> B)) = real (\<mu> (A - B)) + real (\<mu> B)" | |
| 613 | using measurable finite by (rule_tac real_measure_Union) auto | |
| 614 | thus ?thesis using `B \<subseteq> A` by (auto simp: Un_absorb2) | |
| 615 | qed | |
| 616 | ||
| 617 | lemma (in measure_space) real_measure_UNION: | |
| 618 | assumes measurable: "range A \<subseteq> sets M" "disjoint_family A" | |
| 619 | assumes finite: "\<mu> (\<Union>i. A i) \<noteq> \<omega>" | |
| 620 | shows "(\<lambda>i. real (\<mu> (A i))) sums (real (\<mu> (\<Union>i. A i)))" | |
| 621 | proof - | |
| 622 | have *: "(\<Sum>\<^isub>\<infinity> i. \<mu> (A i)) = \<mu> (\<Union>i. A i)" | |
| 623 | using measure_countably_additive[OF measurable] by (simp add: comp_def) | |
| 624 | hence "(\<Sum>\<^isub>\<infinity> i. \<mu> (A i)) \<noteq> \<omega>" using finite by simp | |
| 625 | from psuminf_imp_suminf[OF this] | |
| 626 | show ?thesis using * by simp | |
| 627 | qed | |
| 628 | ||
| 629 | lemma (in measure_space) real_measure_subadditive: | |
| 630 | assumes measurable: "A \<in> sets M" "B \<in> sets M" | |
| 631 | and fin: "\<mu> A \<noteq> \<omega>" "\<mu> B \<noteq> \<omega>" | |
| 632 | shows "real (\<mu> (A \<union> B)) \<le> real (\<mu> A) + real (\<mu> B)" | |
| 633 | proof - | |
| 634 | have "real (\<mu> (A \<union> B)) \<le> real (\<mu> A + \<mu> B)" | |
| 635 | using measure_subadditive[OF measurable] fin by (auto intro!: real_of_pinfreal_mono) | |
| 636 | also have "\<dots> = real (\<mu> A) + real (\<mu> B)" | |
| 637 | using fin by (simp add: real_of_pinfreal_add) | |
| 638 | finally show ?thesis . | |
| 639 | qed | |
| 640 | ||
| 641 | lemma (in measure_space) real_measurable_countably_subadditive: | |
| 642 | assumes "range f \<subseteq> sets M" and "(\<Sum>\<^isub>\<infinity> i. \<mu> (f i)) \<noteq> \<omega>" | |
| 643 | shows "real (\<mu> (\<Union>i. f i)) \<le> (\<Sum> i. real (\<mu> (f i)))" | |
| 644 | proof - | |
| 645 | have "real (\<mu> (\<Union>i. f i)) \<le> real (\<Sum>\<^isub>\<infinity> i. \<mu> (f i))" | |
| 646 | using assms by (auto intro!: real_of_pinfreal_mono measurable_countably_subadditive) | |
| 647 | also have "\<dots> = (\<Sum> i. real (\<mu> (f i)))" | |
| 648 | using assms by (auto intro!: sums_unique psuminf_imp_suminf) | |
| 649 | finally show ?thesis . | |
| 650 | qed | |
| 651 | ||
| 652 | lemma (in measure_space) real_measure_setsum_singleton: | |
| 653 |   assumes S: "finite S" "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
 | |
| 654 |   and fin: "\<And>x. x \<in> S \<Longrightarrow> \<mu> {x} \<noteq> \<omega>"
 | |
| 655 |   shows "real (\<mu> S) = (\<Sum>x\<in>S. real (\<mu> {x}))"
 | |
| 656 | using measure_finite_singleton[OF S] fin by (simp add: real_of_pinfreal_setsum) | |
| 657 | ||
| 658 | lemma (in measure_space) real_continuity_from_below: | |
| 659 | assumes A: "range A \<subseteq> sets M" "\<And>i. A i \<subseteq> A (Suc i)" and "\<mu> (\<Union>i. A i) \<noteq> \<omega>" | |
| 660 | shows "(\<lambda>i. real (\<mu> (A i))) ----> real (\<mu> (\<Union>i. A i))" | |
| 661 | proof (rule SUP_eq_LIMSEQ[THEN iffD1]) | |
| 662 |   { fix n have "\<mu> (A n) \<le> \<mu> (\<Union>i. A i)"
 | |
| 663 | using A by (auto intro!: measure_mono) | |
| 664 | hence "\<mu> (A n) \<noteq> \<omega>" using assms by auto } | |
| 665 | note this[simp] | |
| 666 | ||
| 667 | show "mono (\<lambda>i. real (\<mu> (A i)))" unfolding mono_iff_le_Suc using A | |
| 668 | by (auto intro!: real_of_pinfreal_mono measure_mono) | |
| 669 | ||
| 670 | show "(SUP n. Real (real (\<mu> (A n)))) = Real (real (\<mu> (\<Union>i. A i)))" | |
| 671 | using continuity_from_below[OF A(1), OF A(2)] | |
| 672 | using assms by (simp add: Real_real) | |
| 673 | qed simp_all | |
| 674 | ||
| 675 | lemma (in measure_space) real_continuity_from_above: | |
| 676 | assumes A: "range A \<subseteq> sets M" | |
| 677 | and mono_Suc: "\<And>n. A (Suc n) \<subseteq> A n" | |
| 678 | and finite: "\<And>i. \<mu> (A i) \<noteq> \<omega>" | |
| 679 | shows "(\<lambda>n. real (\<mu> (A n))) ----> real (\<mu> (\<Inter>i. A i))" | |
| 680 | proof (rule INF_eq_LIMSEQ[THEN iffD1]) | |
| 681 |   { fix n have "\<mu> (\<Inter>i. A i) \<le> \<mu> (A n)"
 | |
| 682 | using A by (auto intro!: measure_mono) | |
| 683 | hence "\<mu> (\<Inter>i. A i) \<noteq> \<omega>" using assms by auto } | |
| 684 | note this[simp] | |
| 685 | ||
| 686 | show "mono (\<lambda>i. - real (\<mu> (A i)))" unfolding mono_iff_le_Suc using assms | |
| 687 | by (auto intro!: real_of_pinfreal_mono measure_mono) | |
| 688 | ||
| 689 | show "(INF n. Real (real (\<mu> (A n)))) = | |
| 690 | Real (real (\<mu> (\<Inter>i. A i)))" | |
| 691 | using continuity_from_above[OF A, OF mono_Suc finite] | |
| 692 | using assms by (simp add: Real_real) | |
| 693 | qed simp_all | |
| 694 | ||
| 695 | locale finite_measure = measure_space + | |
| 696 | assumes finite_measure_of_space: "\<mu> (space M) \<noteq> \<omega>" | |
| 697 | ||
| 698 | sublocale finite_measure < sigma_finite_measure | |
| 699 | proof | |
| 700 | show "\<exists>A. range A \<subseteq> sets M \<and> (\<Union>i. A i) = space M \<and> (\<forall>i. \<mu> (A i) \<noteq> \<omega>)" | |
| 701 | using finite_measure_of_space by (auto intro!: exI[of _ "\<lambda>x. space M"]) | |
| 702 | qed | |
| 703 | ||
| 39092 | 704 | lemma (in finite_measure) finite_measure[simp, intro]: | 
| 38656 | 705 | assumes "A \<in> sets M" | 
| 706 | shows "\<mu> A \<noteq> \<omega>" | |
| 707 | proof - | |
| 708 | from `A \<in> sets M` have "A \<subseteq> space M" | |
| 709 | using sets_into_space by blast | |
| 710 | hence "\<mu> A \<le> \<mu> (space M)" | |
| 711 | using assms top by (rule measure_mono) | |
| 712 | also have "\<dots> < \<omega>" | |
| 713 | using finite_measure_of_space unfolding pinfreal_less_\<omega> . | |
| 714 | finally show ?thesis unfolding pinfreal_less_\<omega> . | |
| 715 | qed | |
| 716 | ||
| 717 | lemma (in finite_measure) restricted_finite_measure: | |
| 718 | assumes "S \<in> sets M" | |
| 39092 | 719 | shows "finite_measure (restricted_space S) \<mu>" | 
| 38656 | 720 | (is "finite_measure ?r _") | 
| 721 | unfolding finite_measure_def finite_measure_axioms_def | |
| 722 | proof (safe del: notI) | |
| 723 | show "measure_space ?r \<mu>" using restricted_measure_space[OF assms] . | |
| 724 | next | |
| 725 | show "\<mu> (space ?r) \<noteq> \<omega>" using finite_measure[OF `S \<in> sets M`] by auto | |
| 726 | qed | |
| 727 | ||
| 728 | lemma (in finite_measure) real_finite_measure_Diff: | |
| 729 | assumes "A \<in> sets M" "B \<in> sets M" "B \<subseteq> A" | |
| 730 | shows "real (\<mu> (A - B)) = real (\<mu> A) - real (\<mu> B)" | |
| 731 | using finite_measure[OF `A \<in> sets M`] by (rule real_measure_Diff[OF _ assms]) | |
| 732 | ||
| 733 | lemma (in finite_measure) real_finite_measure_Union: | |
| 734 |   assumes sets: "A \<in> sets M" "B \<in> sets M" and "A \<inter> B = {}"
 | |
| 735 | shows "real (\<mu> (A \<union> B)) = real (\<mu> A) + real (\<mu> B)" | |
| 736 | using sets by (auto intro!: real_measure_Union[OF _ _ assms] finite_measure) | |
| 737 | ||
| 738 | lemma (in finite_measure) real_finite_measure_finite_Union: | |
| 739 | assumes "finite S" and dis: "disjoint_family_on A S" | |
| 740 | and *: "\<And>i. i \<in> S \<Longrightarrow> A i \<in> sets M" | |
| 741 | shows "real (\<mu> (\<Union>i\<in>S. A i)) = (\<Sum>i\<in>S. real (\<mu> (A i)))" | |
| 742 | proof (rule real_measure_finite_Union[OF `finite S` _ dis]) | |
| 743 | fix i assume "i \<in> S" from *[OF this] show "A i \<in> sets M" . | |
| 744 | from finite_measure[OF this] show "\<mu> (A i) \<noteq> \<omega>" . | |
| 745 | qed | |
| 746 | ||
| 747 | lemma (in finite_measure) real_finite_measure_UNION: | |
| 748 | assumes measurable: "range A \<subseteq> sets M" "disjoint_family A" | |
| 749 | shows "(\<lambda>i. real (\<mu> (A i))) sums (real (\<mu> (\<Union>i. A i)))" | |
| 750 | proof (rule real_measure_UNION[OF assms]) | |
| 751 | have "(\<Union>i. A i) \<in> sets M" using measurable(1) by (rule countable_UN) | |
| 752 | thus "\<mu> (\<Union>i. A i) \<noteq> \<omega>" by (rule finite_measure) | |
| 753 | qed | |
| 754 | ||
| 755 | lemma (in finite_measure) real_measure_mono: | |
| 756 | "A \<in> sets M \<Longrightarrow> B \<in> sets M \<Longrightarrow> A \<subseteq> B \<Longrightarrow> real (\<mu> A) \<le> real (\<mu> B)" | |
| 757 | by (auto intro!: measure_mono real_of_pinfreal_mono finite_measure) | |
| 758 | ||
| 759 | lemma (in finite_measure) real_finite_measure_subadditive: | |
| 760 | assumes measurable: "A \<in> sets M" "B \<in> sets M" | |
| 761 | shows "real (\<mu> (A \<union> B)) \<le> real (\<mu> A) + real (\<mu> B)" | |
| 762 | using measurable measurable[THEN finite_measure] by (rule real_measure_subadditive) | |
| 763 | ||
| 764 | lemma (in finite_measure) real_finite_measurable_countably_subadditive: | |
| 765 | assumes "range f \<subseteq> sets M" and "summable (\<lambda>i. real (\<mu> (f i)))" | |
| 766 | shows "real (\<mu> (\<Union>i. f i)) \<le> (\<Sum> i. real (\<mu> (f i)))" | |
| 767 | proof (rule real_measurable_countably_subadditive[OF assms(1)]) | |
| 768 | have *: "\<And>i. f i \<in> sets M" using assms by auto | |
| 769 | have "(\<lambda>i. real (\<mu> (f i))) sums (\<Sum>i. real (\<mu> (f i)))" | |
| 770 | using assms(2) by (rule summable_sums) | |
| 771 | from suminf_imp_psuminf[OF this] | |
| 772 | have "(\<Sum>\<^isub>\<infinity>i. \<mu> (f i)) = Real (\<Sum>i. real (\<mu> (f i)))" | |
| 773 | using * by (simp add: Real_real finite_measure) | |
| 774 | thus "(\<Sum>\<^isub>\<infinity>i. \<mu> (f i)) \<noteq> \<omega>" by simp | |
| 775 | qed | |
| 776 | ||
| 777 | lemma (in finite_measure) real_finite_measure_finite_singelton: | |
| 778 |   assumes "finite S" and *: "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
 | |
| 779 |   shows "real (\<mu> S) = (\<Sum>x\<in>S. real (\<mu> {x}))"
 | |
| 780 | proof (rule real_measure_setsum_singleton[OF `finite S`]) | |
| 781 |   fix x assume "x \<in> S" thus "{x} \<in> sets M" by (rule *)
 | |
| 782 |   with finite_measure show "\<mu> {x} \<noteq> \<omega>" .
 | |
| 783 | qed | |
| 784 | ||
| 785 | lemma (in finite_measure) real_finite_continuity_from_below: | |
| 786 | assumes "range A \<subseteq> sets M" "\<And>i. A i \<subseteq> A (Suc i)" | |
| 787 | shows "(\<lambda>i. real (\<mu> (A i))) ----> real (\<mu> (\<Union>i. A i))" | |
| 788 | using real_continuity_from_below[OF assms(1), OF assms(2) finite_measure] assms by auto | |
| 789 | ||
| 790 | lemma (in finite_measure) real_finite_continuity_from_above: | |
| 791 | assumes A: "range A \<subseteq> sets M" | |
| 792 | and mono_Suc: "\<And>n. A (Suc n) \<subseteq> A n" | |
| 793 | shows "(\<lambda>n. real (\<mu> (A n))) ----> real (\<mu> (\<Inter>i. A i))" | |
| 794 | using real_continuity_from_above[OF A, OF mono_Suc finite_measure] A | |
| 795 | by auto | |
| 796 | ||
| 797 | lemma (in finite_measure) real_finite_measure_finite_Union': | |
| 798 | assumes "finite S" "A`S \<subseteq> sets M" "disjoint_family_on A S" | |
| 799 | shows "real (\<mu> (\<Union>i\<in>S. A i)) = (\<Sum>i\<in>S. real (\<mu> (A i)))" | |
| 800 | using assms real_finite_measure_finite_Union[of S A] by auto | |
| 801 | ||
| 802 | lemma (in finite_measure) finite_measure_compl: | |
| 803 | assumes s: "s \<in> sets M" | |
| 804 | shows "\<mu> (space M - s) = \<mu> (space M) - \<mu> s" | |
| 805 | using measure_compl[OF s, OF finite_measure, OF s] . | |
| 806 | ||
| 39092 | 807 | lemma (in finite_measure) finite_measure_inter_full_set: | 
| 808 | assumes "S \<in> sets M" "T \<in> sets M" | |
| 809 | assumes T: "\<mu> T = \<mu> (space M)" | |
| 810 | shows "\<mu> (S \<inter> T) = \<mu> S" | |
| 811 | using measure_inter_full_set[OF assms(1,2) finite_measure assms(3)] assms | |
| 812 | by auto | |
| 813 | ||
| 38656 | 814 | section {* Measure preserving *}
 | 
| 815 | ||
| 816 | definition "measure_preserving A \<mu> B \<nu> = | |
| 817 |     {f \<in> measurable A B. (\<forall>y \<in> sets B. \<mu> (f -` y \<inter> space A) = \<nu> y)}"
 | |
| 818 | ||
| 819 | lemma (in finite_measure) measure_preserving_lift: | |
| 820 |   fixes f :: "'a \<Rightarrow> 'a2" and A :: "('a2, 'b2) algebra_scheme"
 | |
| 821 | assumes "algebra A" | |
| 822 | assumes "finite_measure (sigma (space A) (sets A)) \<nu>" (is "finite_measure ?sA _") | |
| 823 | assumes fmp: "f \<in> measure_preserving M \<mu> A \<nu>" | |
| 824 | shows "f \<in> measure_preserving M \<mu> (sigma (space A) (sets A)) \<nu>" | |
| 825 | proof - | |
| 826 | interpret sA: finite_measure ?sA \<nu> by fact | |
| 827 | interpret A: algebra A by fact | |
| 828 | show ?thesis using fmp | |
| 829 | proof (clarsimp simp add: measure_preserving_def) | |
| 830 | assume fm: "f \<in> measurable M A" | |
| 831 | and meq: "\<forall>y\<in>sets A. \<mu> (f -` y \<inter> space M) = \<nu> y" | |
| 832 | have f12: "f \<in> measurable M ?sA" | |
| 833 | using measurable_subset[OF A.sets_into_space] fm by auto | |
| 834 | hence ffn: "f \<in> space M \<rightarrow> space A" | |
| 835 | by (simp add: measurable_def) | |
| 836 | have "space M \<subseteq> f -` (space A)" | |
| 837 | by auto (metis PiE ffn) | |
| 838 | hence fveq [simp]: "(f -` (space A)) \<inter> space M = space M" | |
| 839 | by blast | |
| 840 |       {
 | |
| 841 | fix y | |
| 842 | assume y: "y \<in> sets ?sA" | |
| 843 | have "sets ?sA = sigma_sets (space A) (sets A)" (is "_ = ?A") by (auto simp: sigma_def) | |
| 844 |         also have "\<dots> \<subseteq> {s . \<mu> ((f -` s) \<inter> space M) = \<nu> s}"
 | |
| 845 | proof (rule A.sigma_property_disjoint, auto) | |
| 846 | fix x assume "x \<in> sets A" then show "\<mu> (f -` x \<inter> space M) = \<nu> x" by (simp add: meq) | |
| 847 | next | |
| 848 | fix s | |
| 849 | assume eq: "\<mu> (f -` s \<inter> space M) = \<nu> s" and s: "s \<in> ?A" | |
| 850 | then have s': "s \<in> sets ?sA" by (simp add: sigma_def) | |
| 851 | show "\<mu> (f -` (space A - s) \<inter> space M) = \<nu> (space A - s)" | |
| 852 | using sA.finite_measure_compl[OF s'] | |
| 853 | using measurable_sets[OF f12 s'] meq[THEN bspec, OF A.top] | |
| 854 | by (simp add: vimage_Diff Diff_Int_distrib2 finite_measure_compl eq) | |
| 855 | next | |
| 856 | fix S | |
| 857 |             assume S0: "S 0 = {}"
 | |
| 858 | and SSuc: "\<And>n. S n \<subseteq> S (Suc n)" | |
| 859 |                and rS1: "range S \<subseteq> {s. \<mu> (f -` s \<inter> space M) = \<nu> s}"
 | |
| 860 | and "range S \<subseteq> ?A" | |
| 861 | hence rS2: "range S \<subseteq> sets ?sA" by (simp add: sigma_def) | |
| 862 | have eq1: "\<And>i. \<mu> (f -` S i \<inter> space M) = \<nu> (S i)" | |
| 863 | using rS1 by blast | |
| 864 | have *: "(\<lambda>n. \<nu> (S n)) = (\<lambda>n. \<mu> (f -` S n \<inter> space M))" | |
| 865 | by (simp add: eq1) | |
| 866 | have "(SUP n. ... n) = \<mu> (\<Union>i. f -` S i \<inter> space M)" | |
| 867 | proof (rule measure_countable_increasing) | |
| 868 | show "range (\<lambda>i. f -` S i \<inter> space M) \<subseteq> sets M" | |
| 869 | using f12 rS2 by (auto simp add: measurable_def) | |
| 870 |                 show "f -` S 0 \<inter> space M = {}" using S0
 | |
| 871 | by blast | |
| 872 | show "\<And>n. f -` S n \<inter> space M \<subseteq> f -` S (Suc n) \<inter> space M" | |
| 873 | using SSuc by auto | |
| 874 | qed | |
| 875 | also have "\<mu> (\<Union>i. f -` S i \<inter> space M) = \<mu> (f -` (\<Union>i. S i) \<inter> space M)" | |
| 876 | by (simp add: vimage_UN) | |
| 877 | finally have "(SUP n. \<nu> (S n)) = \<mu> (f -` (\<Union>i. S i) \<inter> space M)" unfolding * . | |
| 878 | moreover | |
| 879 | have "(SUP n. \<nu> (S n)) = \<nu> (\<Union>i. S i)" | |
| 880 | by (rule sA.measure_countable_increasing[OF rS2, OF S0 SSuc]) | |
| 881 | ultimately | |
| 882 | show "\<mu> (f -` (\<Union>i. S i) \<inter> space M) = \<nu> (\<Union>i. S i)" by simp | |
| 883 | next | |
| 884 | fix S :: "nat => 'a2 set" | |
| 885 | assume dS: "disjoint_family S" | |
| 886 |                  and rS1: "range S \<subseteq> {s. \<mu> (f -` s \<inter> space M) = \<nu> s}"
 | |
| 887 | and "range S \<subseteq> ?A" | |
| 888 | hence rS2: "range S \<subseteq> sets ?sA" by (simp add: sigma_def) | |
| 889 | have "\<And>i. \<mu> (f -` S i \<inter> space M) = \<nu> (S i)" | |
| 890 | using rS1 by blast | |
| 891 | hence *: "(\<lambda>i. \<nu> (S i)) = (\<lambda>n. \<mu> (f -` S n \<inter> space M))" | |
| 892 | by simp | |
| 893 | have "psuminf ... = \<mu> (\<Union>i. f -` S i \<inter> space M)" | |
| 894 | proof (rule measure_countably_additive) | |
| 895 | show "range (\<lambda>i. f -` S i \<inter> space M) \<subseteq> sets M" | |
| 896 | using f12 rS2 by (auto simp add: measurable_def) | |
| 897 | show "disjoint_family (\<lambda>i. f -` S i \<inter> space M)" using dS | |
| 898 | by (auto simp add: disjoint_family_on_def) | |
| 899 | qed | |
| 900 | hence "(\<Sum>\<^isub>\<infinity> i. \<nu> (S i)) = \<mu> (\<Union>i. f -` S i \<inter> space M)" unfolding * . | |
| 901 | with sA.measure_countably_additive [OF rS2 dS] | |
| 902 | have "\<mu> (\<Union>i. f -` S i \<inter> space M) = \<nu> (\<Union>i. S i)" | |
| 903 | by simp | |
| 904 | moreover have "\<mu> (f -` (\<Union>i. S i) \<inter> space M) = \<mu> (\<Union>i. f -` S i \<inter> space M)" | |
| 905 | by (simp add: vimage_UN) | |
| 906 | ultimately show "\<mu> (f -` (\<Union>i. S i) \<inter> space M) = \<nu> (\<Union>i. S i)" | |
| 907 | by metis | |
| 908 | qed | |
| 909 |         finally have "sets ?sA \<subseteq> {s . \<mu> ((f -` s) \<inter> space M) = \<nu> s}" .
 | |
| 910 | hence "\<mu> (f -` y \<inter> space M) = \<nu> y" using y by force | |
| 911 | } | |
| 912 | thus "f \<in> measurable M ?sA \<and> (\<forall>y\<in>sets ?sA. \<mu> (f -` y \<inter> space M) = \<nu> y)" | |
| 913 | by (blast intro: f12) | |
| 914 | qed | |
| 915 | qed | |
| 916 | ||
| 917 | section "Finite spaces" | |
| 918 | ||
| 36624 | 919 | locale finite_measure_space = measure_space + | 
| 920 | assumes finite_space: "finite (space M)" | |
| 921 | and sets_eq_Pow: "sets M = Pow (space M)" | |
| 38656 | 922 |   and finite_single_measure: "\<And>x. x \<in> space M \<Longrightarrow> \<mu> {x} \<noteq> \<omega>"
 | 
| 36624 | 923 | |
| 39092 | 924 | lemma (in finite_measure_space) sets_image_space_eq_Pow: | 
| 925 | "sets (image_space X) = Pow (space (image_space X))" | |
| 926 | proof safe | |
| 927 | fix x S assume "S \<in> sets (image_space X)" "x \<in> S" | |
| 928 | then show "x \<in> space (image_space X)" | |
| 929 | using sets_into_space by (auto intro!: imageI simp: image_space_def) | |
| 930 | next | |
| 931 | fix S assume "S \<subseteq> space (image_space X)" | |
| 932 | then obtain S' where "S = X`S'" "S'\<in>sets M" | |
| 933 | by (auto simp: subset_image_iff sets_eq_Pow image_space_def) | |
| 934 | then show "S \<in> sets (image_space X)" | |
| 935 | by (auto simp: image_space_def) | |
| 936 | qed | |
| 937 | ||
| 38656 | 938 | lemma (in finite_measure_space) sum_over_space: "(\<Sum>x\<in>space M. \<mu> {x}) = \<mu> (space M)"
 | 
| 36624 | 939 |   using measure_finitely_additive''[of "space M" "\<lambda>i. {i}"]
 | 
| 940 | by (simp add: sets_eq_Pow disjoint_family_on_def finite_space) | |
| 941 | ||
| 39092 | 942 | lemma finite_measure_spaceI: | 
| 943 | assumes "finite (space M)" "sets M = Pow(space M)" and space: "\<mu> (space M) \<noteq> \<omega>" | |
| 944 |     and add: "\<And>A B. A\<subseteq>space M \<Longrightarrow> B\<subseteq>space M \<Longrightarrow> A \<inter> B = {} \<Longrightarrow> \<mu> (A \<union> B) = \<mu> A + \<mu> B"
 | |
| 945 |     and "\<mu> {} = 0"
 | |
| 946 | shows "finite_measure_space M \<mu>" | |
| 947 | unfolding finite_measure_space_def finite_measure_space_axioms_def | |
| 948 | proof (safe del: notI) | |
| 949 | show "measure_space M \<mu>" | |
| 950 | proof (rule sigma_algebra.finite_additivity_sufficient) | |
| 951 | show "sigma_algebra M" | |
| 952 | apply (rule sigma_algebra_cong) | |
| 953 | apply (rule sigma_algebra_Pow[of "space M"]) | |
| 954 | using assms by simp_all | |
| 955 | show "finite (space M)" by fact | |
| 956 | show "positive \<mu>" unfolding positive_def by fact | |
| 957 | show "additive M \<mu>" unfolding additive_def using assms by simp | |
| 958 | qed | |
| 959 | show "finite (space M)" by fact | |
| 960 |   { fix A x assume "A \<in> sets M" "x \<in> A" then show "x \<in> space M"
 | |
| 961 | using assms by auto } | |
| 962 |   { fix A assume "A \<subseteq> space M" then show "A \<in> sets M"
 | |
| 963 | using assms by auto } | |
| 964 |   { fix x assume *: "x \<in> space M"
 | |
| 965 |     with add[of "{x}" "space M - {x}"] space
 | |
| 966 |     show "\<mu> {x} \<noteq> \<omega>" by (auto simp: insert_absorb[OF *] Diff_subset) }
 | |
| 967 | qed | |
| 968 | ||
| 38656 | 969 | sublocale finite_measure_space < finite_measure | 
| 970 | proof | |
| 971 | show "\<mu> (space M) \<noteq> \<omega>" | |
| 972 | unfolding sum_over_space[symmetric] setsum_\<omega> | |
| 973 | using finite_space finite_single_measure by auto | |
| 974 | qed | |
| 975 | ||
| 39092 | 976 | lemma finite_measure_space_iff: | 
| 977 | "finite_measure_space M \<mu> \<longleftrightarrow> | |
| 978 |     finite (space M) \<and> sets M = Pow(space M) \<and> \<mu> (space M) \<noteq> \<omega> \<and> \<mu> {} = 0 \<and>
 | |
| 979 |     (\<forall>A\<subseteq>space M. \<forall>B\<subseteq>space M. A \<inter> B = {} \<longrightarrow> \<mu> (A \<union> B) = \<mu> A + \<mu> B)"
 | |
| 980 | (is "_ = ?rhs") | |
| 981 | proof (intro iffI) | |
| 982 | assume "finite_measure_space M \<mu>" | |
| 983 | then interpret finite_measure_space M \<mu> . | |
| 984 | show ?rhs | |
| 985 | using finite_space sets_eq_Pow measure_additive empty_measure finite_measure | |
| 986 | by auto | |
| 987 | next | |
| 988 | assume ?rhs then show "finite_measure_space M \<mu>" | |
| 989 | by (auto intro!: finite_measure_spaceI) | |
| 990 | qed | |
| 991 | ||
| 38656 | 992 | lemma psuminf_cmult_indicator: | 
| 993 | assumes "disjoint_family A" "x \<in> A i" | |
| 994 | shows "(\<Sum>\<^isub>\<infinity> n. f n * indicator (A n) x) = f i" | |
| 995 | proof - | |
| 996 | have **: "\<And>n. f n * indicator (A n) x = (if n = i then f n else 0 :: pinfreal)" | |
| 997 | using `x \<in> A i` assms unfolding disjoint_family_on_def indicator_def by auto | |
| 998 | then have "\<And>n. (\<Sum>j<n. f j * indicator (A j) x) = (if i < n then f i else 0 :: pinfreal)" | |
| 999 | by (auto simp: setsum_cases) | |
| 1000 | moreover have "(SUP n. if i < n then f i else 0) = (f i :: pinfreal)" | |
| 1001 | proof (rule pinfreal_SUPI) | |
| 1002 | fix y :: pinfreal assume "\<And>n. n \<in> UNIV \<Longrightarrow> (if i < n then f i else 0) \<le> y" | |
| 1003 | from this[of "Suc i"] show "f i \<le> y" by auto | |
| 1004 | qed simp | |
| 1005 | ultimately show ?thesis using `x \<in> A i` unfolding psuminf_def by auto | |
| 1006 | qed | |
| 1007 | ||
| 1008 | lemma psuminf_indicator: | |
| 1009 | assumes "disjoint_family A" | |
| 1010 | shows "(\<Sum>\<^isub>\<infinity> n. indicator (A n) x) = indicator (\<Union>i. A i) x" | |
| 1011 | proof cases | |
| 1012 | assume *: "x \<in> (\<Union>i. A i)" | |
| 1013 | then obtain i where "x \<in> A i" by auto | |
| 1014 | from psuminf_cmult_indicator[OF assms, OF this, of "\<lambda>i. 1"] | |
| 1015 | show ?thesis using * by simp | |
| 1016 | qed simp | |
| 1017 | ||
| 35582 | 1018 | end |