src/HOL/Analysis/Measure_Space.thy
 author immler Tue Jul 10 09:38:35 2018 +0200 (11 months ago) changeset 68607 67bb59e49834 parent 68532 f8b98d31ad45 child 68617 75129a73aca3 permissions -rw-r--r--
make theorem, corollary, and proposition %important for HOL-Analysis manual
 hoelzl@63627 1 (* Title: HOL/Analysis/Measure_Space.thy hoelzl@47694 2 Author: Lawrence C Paulson hoelzl@47694 3 Author: Johannes Hölzl, TU München hoelzl@47694 4 Author: Armin Heller, TU München hoelzl@47694 5 *) hoelzl@47694 6 wenzelm@61808 7 section \Measure spaces and their properties\ hoelzl@47694 8 hoelzl@47694 9 theory Measure_Space hoelzl@47694 10 imports wenzelm@66453 11 Measurable "HOL-Library.Extended_Nonnegative_Real" hoelzl@47694 12 begin hoelzl@47694 13 immler@67962 14 subsection%unimportant "Relate extended reals and the indicator function" hoelzl@50104 15 hoelzl@47694 16 lemma suminf_cmult_indicator: hoelzl@62975 17 fixes f :: "nat \ ennreal" hoelzl@62975 18 assumes "disjoint_family A" "x \ A i" hoelzl@47694 19 shows "(\n. f n * indicator (A n) x) = f i" hoelzl@47694 20 proof - hoelzl@62975 21 have **: "\n. f n * indicator (A n) x = (if n = i then f n else 0 :: ennreal)" wenzelm@61808 22 using \x \ A i\ assms unfolding disjoint_family_on_def indicator_def by auto hoelzl@62975 23 then have "\n. (\jn. n \ UNIV \ (if i < n then f i else 0) \ y" hoelzl@47694 28 from this[of "Suc i"] show "f i \ y" by auto hoelzl@63333 29 qed (insert assms, simp) hoelzl@47694 30 ultimately show ?thesis using assms hoelzl@62975 31 by (subst suminf_eq_SUP) (auto simp: indicator_def) hoelzl@47694 32 qed hoelzl@47694 33 hoelzl@47694 34 lemma suminf_indicator: hoelzl@47694 35 assumes "disjoint_family A" hoelzl@62975 36 shows "(\n. indicator (A n) x :: ennreal) = indicator (\i. A i) x" hoelzl@47694 37 proof cases hoelzl@47694 38 assume *: "x \ (\i. A i)" hoelzl@47694 39 then obtain i where "x \ A i" by auto wenzelm@61808 40 from suminf_cmult_indicator[OF assms(1), OF \x \ A i\, of "\k. 1"] hoelzl@47694 41 show ?thesis using * by simp hoelzl@47694 42 qed simp hoelzl@47694 43 nipkow@64267 44 lemma sum_indicator_disjoint_family: hoelzl@60727 45 fixes f :: "'d \ 'e::semiring_1" hoelzl@60727 46 assumes d: "disjoint_family_on A P" and "x \ A j" and "finite P" and "j \ P" hoelzl@60727 47 shows "(\i\P. f i * indicator (A i) x) = f j" hoelzl@60727 48 proof - hoelzl@60727 49 have "P \ {i. x \ A i} = {j}" wenzelm@61808 50 using d \x \ A j\ \j \ P\ unfolding disjoint_family_on_def hoelzl@60727 51 by auto hoelzl@60727 52 thus ?thesis hoelzl@60727 53 unfolding indicator_def nipkow@64267 54 by (simp add: if_distrib sum.If_cases[OF \finite P\]) hoelzl@60727 55 qed hoelzl@60727 56 wenzelm@61808 57 text \ wenzelm@68484 58 The type for emeasure spaces is already defined in @{theory "HOL-Analysis.Sigma_Algebra"}, as it wenzelm@68484 59 is also used to represent sigma algebras (with an arbitrary emeasure). wenzelm@61808 60 \ hoelzl@47694 61 immler@67962 62 subsection%unimportant "Extend binary sets" hoelzl@47694 63 hoelzl@47694 64 lemma LIMSEQ_binaryset: hoelzl@47694 65 assumes f: "f {} = 0" wenzelm@61969 66 shows "(\n. \i f A + f B" hoelzl@47694 67 proof - hoelzl@47694 68 have "(\n. \i < Suc (Suc n). f (binaryset A B i)) = (\n. f A + f B)" hoelzl@47694 69 proof hoelzl@47694 70 fix n hoelzl@47694 71 show "(\i < Suc (Suc n). f (binaryset A B i)) = f A + f B" hoelzl@47694 72 by (induct n) (auto simp add: binaryset_def f) hoelzl@47694 73 qed hoelzl@47694 74 moreover wenzelm@61969 75 have "... \ f A + f B" by (rule tendsto_const) hoelzl@47694 76 ultimately wenzelm@61969 77 have "(\n. \i< Suc (Suc n). f (binaryset A B i)) \ f A + f B" hoelzl@47694 78 by metis wenzelm@61969 79 hence "(\n. \i< n+2. f (binaryset A B i)) \ f A + f B" hoelzl@47694 80 by simp hoelzl@47694 81 thus ?thesis by (rule LIMSEQ_offset [where k=2]) hoelzl@47694 82 qed hoelzl@47694 83 hoelzl@47694 84 lemma binaryset_sums: hoelzl@47694 85 assumes f: "f {} = 0" hoelzl@47694 86 shows "(\n. f (binaryset A B n)) sums (f A + f B)" hoelzl@47694 87 by (simp add: sums_def LIMSEQ_binaryset [where f=f, OF f] atLeast0LessThan) hoelzl@47694 88 hoelzl@47694 89 lemma suminf_binaryset_eq: hoelzl@47694 90 fixes f :: "'a set \ 'b::{comm_monoid_add, t2_space}" hoelzl@47694 91 shows "f {} = 0 \ (\n. f (binaryset A B n)) = f A + f B" hoelzl@47694 92 by (metis binaryset_sums sums_unique) hoelzl@47694 93 immler@67962 94 subsection%unimportant \Properties of a premeasure @{term \}\ hoelzl@47694 95 wenzelm@61808 96 text \ hoelzl@47694 97 The definitions for @{const positive} and @{const countably_additive} should be here, by they are wenzelm@68484 98 necessary to define @{typ "'a measure"} in @{theory "HOL-Analysis.Sigma_Algebra"}. wenzelm@61808 99 \ hoelzl@47694 100 hoelzl@62975 101 definition subadditive where hoelzl@62975 102 "subadditive M f \ (\x\M. \y\M. x \ y = {} \ f (x \ y) \ f x + f y)" hoelzl@62975 103 hoelzl@62975 104 lemma subadditiveD: "subadditive M f \ x \ y = {} \ x \ M \ y \ M \ f (x \ y) \ f x + f y" hoelzl@62975 105 by (auto simp add: subadditive_def) hoelzl@62975 106 hoelzl@62975 107 definition countably_subadditive where hoelzl@62975 108 "countably_subadditive M f \ hoelzl@62975 109 (\A. range A \ M \ disjoint_family A \ (\i. A i) \ M \ (f (\i. A i) \ (\i. f (A i))))" hoelzl@62975 110 hoelzl@62975 111 lemma (in ring_of_sets) countably_subadditive_subadditive: hoelzl@62975 112 fixes f :: "'a set \ ennreal" hoelzl@62975 113 assumes f: "positive M f" and cs: "countably_subadditive M f" hoelzl@62975 114 shows "subadditive M f" hoelzl@62975 115 proof (auto simp add: subadditive_def) hoelzl@62975 116 fix x y hoelzl@62975 117 assume x: "x \ M" and y: "y \ M" and "x \ y = {}" hoelzl@62975 118 hence "disjoint_family (binaryset x y)" hoelzl@62975 119 by (auto simp add: disjoint_family_on_def binaryset_def) hoelzl@62975 120 hence "range (binaryset x y) \ M \ hoelzl@62975 121 (\i. binaryset x y i) \ M \ hoelzl@62975 122 f (\i. binaryset x y i) \ (\ n. f (binaryset x y n))" hoelzl@62975 123 using cs by (auto simp add: countably_subadditive_def) hoelzl@62975 124 hence "{x,y,{}} \ M \ x \ y \ M \ hoelzl@62975 125 f (x \ y) \ (\ n. f (binaryset x y n))" hoelzl@62975 126 by (simp add: range_binaryset_eq UN_binaryset_eq) hoelzl@62975 127 thus "f (x \ y) \ f x + f y" using f x y hoelzl@62975 128 by (auto simp add: Un o_def suminf_binaryset_eq positive_def) hoelzl@62975 129 qed hoelzl@62975 130 hoelzl@47694 131 definition additive where hoelzl@47694 132 "additive M \ \ (\x\M. \y\M. x \ y = {} \ \ (x \ y) = \ x + \ y)" hoelzl@47694 133 hoelzl@47694 134 definition increasing where hoelzl@47694 135 "increasing M \ \ (\x\M. \y\M. x \ y \ \ x \ \ y)" hoelzl@47694 136 hoelzl@49773 137 lemma positiveD1: "positive M f \ f {} = 0" by (auto simp: positive_def) hoelzl@49773 138 hoelzl@47694 139 lemma positiveD_empty: hoelzl@47694 140 "positive M f \ f {} = 0" hoelzl@47694 141 by (auto simp add: positive_def) hoelzl@47694 142 hoelzl@47694 143 lemma additiveD: hoelzl@47694 144 "additive M f \ x \ y = {} \ x \ M \ y \ M \ f (x \ y) = f x + f y" hoelzl@47694 145 by (auto simp add: additive_def) hoelzl@47694 146 hoelzl@47694 147 lemma increasingD: hoelzl@47694 148 "increasing M f \ x \ y \ x\M \ y\M \ f x \ f y" hoelzl@47694 149 by (auto simp add: increasing_def) hoelzl@47694 150 hoelzl@50104 151 lemma countably_additiveI[case_names countably]: hoelzl@47694 152 "(\A. range A \ M \ disjoint_family A \ (\i. A i) \ M \ (\i. f (A i)) = f (\i. A i)) hoelzl@47694 153 \ countably_additive M f" hoelzl@47694 154 by (simp add: countably_additive_def) hoelzl@47694 155 hoelzl@47694 156 lemma (in ring_of_sets) disjointed_additive: hoelzl@47694 157 assumes f: "positive M f" "additive M f" and A: "range A \ M" "incseq A" hoelzl@47694 158 shows "(\i\n. f (disjointed A i)) = f (A n)" hoelzl@47694 159 proof (induct n) hoelzl@47694 160 case (Suc n) hoelzl@47694 161 then have "(\i\Suc n. f (disjointed A i)) = f (A n) + f (disjointed A (Suc n))" hoelzl@47694 162 by simp hoelzl@47694 163 also have "\ = f (A n \ disjointed A (Suc n))" hoelzl@60727 164 using A by (subst f(2)[THEN additiveD]) (auto simp: disjointed_mono) hoelzl@47694 165 also have "A n \ disjointed A (Suc n) = A (Suc n)" wenzelm@61808 166 using \incseq A\ by (auto dest: incseq_SucD simp: disjointed_mono) hoelzl@47694 167 finally show ?case . hoelzl@47694 168 qed simp hoelzl@47694 169 hoelzl@47694 170 lemma (in ring_of_sets) additive_sum: hoelzl@47694 171 fixes A:: "'i \ 'a set" hoelzl@47694 172 assumes f: "positive M f" and ad: "additive M f" and "finite S" hoelzl@47694 173 and A: "A`S \ M" hoelzl@47694 174 and disj: "disjoint_family_on A S" hoelzl@47694 175 shows "(\i\S. f (A i)) = f (\i\S. A i)" wenzelm@61808 176 using \finite S\ disj A wenzelm@53374 177 proof induct hoelzl@47694 178 case empty show ?case using f by (simp add: positive_def) hoelzl@47694 179 next hoelzl@47694 180 case (insert s S) hoelzl@47694 181 then have "A s \ (\i\S. A i) = {}" hoelzl@47694 182 by (auto simp add: disjoint_family_on_def neq_iff) hoelzl@47694 183 moreover hoelzl@47694 184 have "A s \ M" using insert by blast hoelzl@47694 185 moreover have "(\i\S. A i) \ M" wenzelm@61808 186 using insert \finite S\ by auto hoelzl@47694 187 ultimately have "f (A s \ (\i\S. A i)) = f (A s) + f(\i\S. A i)" hoelzl@47694 188 using ad UNION_in_sets A by (auto simp add: additive_def) hoelzl@47694 189 with insert show ?case using ad disjoint_family_on_mono[of S "insert s S" A] hoelzl@47694 190 by (auto simp add: additive_def subset_insertI) hoelzl@47694 191 qed hoelzl@47694 192 hoelzl@47694 193 lemma (in ring_of_sets) additive_increasing: hoelzl@62975 194 fixes f :: "'a set \ ennreal" hoelzl@47694 195 assumes posf: "positive M f" and addf: "additive M f" hoelzl@47694 196 shows "increasing M f" hoelzl@47694 197 proof (auto simp add: increasing_def) hoelzl@47694 198 fix x y hoelzl@47694 199 assume xy: "x \ M" "y \ M" "x \ y" hoelzl@47694 200 then have "y - x \ M" by auto hoelzl@62975 201 then have "f x + 0 \ f x + f (y-x)" by (intro add_left_mono zero_le) hoelzl@47694 202 also have "... = f (x \ (y-x))" using addf hoelzl@47694 203 by (auto simp add: additive_def) (metis Diff_disjoint Un_Diff_cancel Diff xy(1,2)) hoelzl@47694 204 also have "... = f y" hoelzl@47694 205 by (metis Un_Diff_cancel Un_absorb1 xy(3)) hoelzl@47694 206 finally show "f x \ f y" by simp hoelzl@47694 207 qed hoelzl@47694 208 immler@50087 209 lemma (in ring_of_sets) subadditive: hoelzl@62975 210 fixes f :: "'a set \ ennreal" hoelzl@62975 211 assumes f: "positive M f" "additive M f" and A: "A`S \ M" and S: "finite S" immler@50087 212 shows "f (\i\S. A i) \ (\i\S. f (A i))" hoelzl@62975 213 using S A immler@50087 214 proof (induct S) immler@50087 215 case empty thus ?case using f by (auto simp: positive_def) immler@50087 216 next immler@50087 217 case (insert x F) wenzelm@60585 218 hence in_M: "A x \ M" "(\i\F. A i) \ M" "(\i\F. A i) - A x \ M" using A by force+ wenzelm@60585 219 have subs: "(\i\F. A i) - A x \ (\i\F. A i)" by auto wenzelm@60585 220 have "(\i\(insert x F). A i) = A x \ ((\i\F. A i) - A x)" by auto wenzelm@60585 221 hence "f (\i\(insert x F). A i) = f (A x \ ((\i\F. A i) - A x))" immler@50087 222 by simp wenzelm@60585 223 also have "\ = f (A x) + f ((\i\F. A i) - A x)" immler@50087 224 using f(2) by (rule additiveD) (insert in_M, auto) wenzelm@60585 225 also have "\ \ f (A x) + f (\i\F. A i)" immler@50087 226 using additive_increasing[OF f] in_M subs by (auto simp: increasing_def intro: add_left_mono) immler@50087 227 also have "\ \ f (A x) + (\i\F. f (A i))" using insert by (auto intro: add_left_mono) wenzelm@60585 228 finally show "f (\i\(insert x F). A i) \ (\i\(insert x F). f (A i))" using insert by simp immler@50087 229 qed immler@50087 230 hoelzl@47694 231 lemma (in ring_of_sets) countably_additive_additive: hoelzl@62975 232 fixes f :: "'a set \ ennreal" hoelzl@47694 233 assumes posf: "positive M f" and ca: "countably_additive M f" hoelzl@47694 234 shows "additive M f" hoelzl@47694 235 proof (auto simp add: additive_def) hoelzl@47694 236 fix x y hoelzl@47694 237 assume x: "x \ M" and y: "y \ M" and "x \ y = {}" hoelzl@47694 238 hence "disjoint_family (binaryset x y)" hoelzl@47694 239 by (auto simp add: disjoint_family_on_def binaryset_def) hoelzl@47694 240 hence "range (binaryset x y) \ M \ hoelzl@47694 241 (\i. binaryset x y i) \ M \ hoelzl@47694 242 f (\i. binaryset x y i) = (\ n. f (binaryset x y n))" hoelzl@47694 243 using ca hoelzl@47694 244 by (simp add: countably_additive_def) hoelzl@47694 245 hence "{x,y,{}} \ M \ x \ y \ M \ hoelzl@47694 246 f (x \ y) = (\n. f (binaryset x y n))" hoelzl@47694 247 by (simp add: range_binaryset_eq UN_binaryset_eq) hoelzl@47694 248 thus "f (x \ y) = f x + f y" using posf x y hoelzl@47694 249 by (auto simp add: Un suminf_binaryset_eq positive_def) hoelzl@47694 250 qed hoelzl@47694 251 hoelzl@47694 252 lemma (in algebra) increasing_additive_bound: hoelzl@62975 253 fixes A:: "nat \ 'a set" and f :: "'a set \ ennreal" hoelzl@47694 254 assumes f: "positive M f" and ad: "additive M f" hoelzl@47694 255 and inc: "increasing M f" hoelzl@47694 256 and A: "range A \ M" hoelzl@47694 257 and disj: "disjoint_family A" hoelzl@47694 258 shows "(\i. f (A i)) \ f \" hoelzl@62975 259 proof (safe intro!: suminf_le_const) hoelzl@47694 260 fix N hoelzl@47694 261 note disj_N = disjoint_family_on_mono[OF _ disj, of "{..ii\{.. f \" using space_closed A hoelzl@47694 265 by (intro increasingD[OF inc] finite_UN) auto hoelzl@47694 266 finally show "(\i f \" by simp hoelzl@47694 267 qed (insert f A, auto simp: positive_def) hoelzl@47694 268 hoelzl@47694 269 lemma (in ring_of_sets) countably_additiveI_finite: hoelzl@62975 270 fixes \ :: "'a set \ ennreal" hoelzl@47694 271 assumes "finite \" "positive M \" "additive M \" hoelzl@47694 272 shows "countably_additive M \" hoelzl@47694 273 proof (rule countably_additiveI) hoelzl@47694 274 fix F :: "nat \ 'a set" assume F: "range F \ M" "(\i. F i) \ M" and disj: "disjoint_family F" hoelzl@47694 275 hoelzl@47694 276 have "\i\{i. F i \ {}}. \x. x \ F i" by auto hoelzl@47694 277 from bchoice[OF this] obtain f where f: "\i. F i \ {} \ f i \ F i" by auto hoelzl@47694 278 hoelzl@47694 279 have inj_f: "inj_on f {i. F i \ {}}" hoelzl@47694 280 proof (rule inj_onI, simp) hoelzl@47694 281 fix i j a b assume *: "f i = f j" "F i \ {}" "F j \ {}" hoelzl@47694 282 then have "f i \ F i" "f j \ F j" using f by force+ hoelzl@47694 283 with disj * show "i = j" by (auto simp: disjoint_family_on_def) hoelzl@47694 284 qed hoelzl@47694 285 have "finite (\i. F i)" hoelzl@47694 286 by (metis F(2) assms(1) infinite_super sets_into_space) hoelzl@47694 287 hoelzl@47694 288 have F_subset: "{i. \ (F i) \ 0} \ {i. F i \ {}}" wenzelm@61808 289 by (auto simp: positiveD_empty[OF \positive M \\]) hoelzl@47694 290 moreover have fin_not_empty: "finite {i. F i \ {}}" hoelzl@47694 291 proof (rule finite_imageD) hoelzl@47694 292 from f have "f`{i. F i \ {}} \ (\i. F i)" by auto hoelzl@47694 293 then show "finite (f`{i. F i \ {}})" hoelzl@47694 294 by (rule finite_subset) fact hoelzl@47694 295 qed fact hoelzl@47694 296 ultimately have fin_not_0: "finite {i. \ (F i) \ 0}" hoelzl@47694 297 by (rule finite_subset) hoelzl@47694 298 hoelzl@47694 299 have disj_not_empty: "disjoint_family_on F {i. F i \ {}}" hoelzl@47694 300 using disj by (auto simp: disjoint_family_on_def) hoelzl@47694 301 hoelzl@47694 302 from fin_not_0 have "(\i. \ (F i)) = (\i | \ (F i) \ 0. \ (F i))" hoelzl@47761 303 by (rule suminf_finite) auto hoelzl@47694 304 also have "\ = (\i | F i \ {}. \ (F i))" nipkow@64267 305 using fin_not_empty F_subset by (rule sum.mono_neutral_left) auto hoelzl@47694 306 also have "\ = \ (\i\{i. F i \ {}}. F i)" wenzelm@61808 307 using \positive M \\ \additive M \\ fin_not_empty disj_not_empty F by (intro additive_sum) auto hoelzl@47694 308 also have "\ = \ (\i. F i)" hoelzl@47694 309 by (rule arg_cong[where f=\]) auto hoelzl@47694 310 finally show "(\i. \ (F i)) = \ (\i. F i)" . hoelzl@47694 311 qed hoelzl@47694 312 hoelzl@49773 313 lemma (in ring_of_sets) countably_additive_iff_continuous_from_below: hoelzl@62975 314 fixes f :: "'a set \ ennreal" hoelzl@49773 315 assumes f: "positive M f" "additive M f" hoelzl@49773 316 shows "countably_additive M f \ wenzelm@61969 317 (\A. range A \ M \ incseq A \ (\i. A i) \ M \ (\i. f (A i)) \ f (\i. A i))" hoelzl@49773 318 unfolding countably_additive_def hoelzl@49773 319 proof safe hoelzl@49773 320 assume count_sum: "\A. range A \ M \ disjoint_family A \ UNION UNIV A \ M \ (\i. f (A i)) = f (UNION UNIV A)" hoelzl@49773 321 fix A :: "nat \ 'a set" assume A: "range A \ M" "incseq A" "(\i. A i) \ M" hoelzl@49773 322 then have dA: "range (disjointed A) \ M" by (auto simp: range_disjointed_sets) hoelzl@49773 323 with count_sum[THEN spec, of "disjointed A"] A(3) hoelzl@49773 324 have f_UN: "(\i. f (disjointed A i)) = f (\i. A i)" hoelzl@49773 325 by (auto simp: UN_disjointed_eq disjoint_family_disjointed) wenzelm@61969 326 moreover have "(\n. (\i (\i. f (disjointed A i))" hoelzl@49773 327 using f(1)[unfolded positive_def] dA hoelzl@63333 328 by (auto intro!: summable_LIMSEQ) hoelzl@49773 329 from LIMSEQ_Suc[OF this] wenzelm@61969 330 have "(\n. (\i\n. f (disjointed A i))) \ (\i. f (disjointed A i))" hoelzl@56193 331 unfolding lessThan_Suc_atMost . hoelzl@49773 332 moreover have "\n. (\i\n. f (disjointed A i)) = f (A n)" hoelzl@49773 333 using disjointed_additive[OF f A(1,2)] . wenzelm@61969 334 ultimately show "(\i. f (A i)) \ f (\i. A i)" by simp hoelzl@49773 335 next wenzelm@61969 336 assume cont: "\A. range A \ M \ incseq A \ (\i. A i) \ M \ (\i. f (A i)) \ f (\i. A i)" hoelzl@49773 337 fix A :: "nat \ 'a set" assume A: "range A \ M" "disjoint_family A" "(\i. A i) \ M" hoelzl@57446 338 have *: "(\n. (\ii. A i)" by auto wenzelm@61969 339 have "(\n. f (\i f (\i. A i)" hoelzl@49773 340 proof (unfold *[symmetric], intro cont[rule_format]) wenzelm@60585 341 show "range (\i. \i M" "(\i. \i M" hoelzl@49773 342 using A * by auto hoelzl@49773 343 qed (force intro!: incseq_SucI) hoelzl@57446 344 moreover have "\n. f (\iii. f (A i)) sums f (\i. A i)" hoelzl@57446 350 unfolding sums_def by simp hoelzl@49773 351 from sums_unique[OF this] hoelzl@49773 352 show "(\i. f (A i)) = f (\i. A i)" by simp hoelzl@49773 353 qed hoelzl@49773 354 hoelzl@49773 355 lemma (in ring_of_sets) continuous_from_above_iff_empty_continuous: hoelzl@62975 356 fixes f :: "'a set \ ennreal" hoelzl@49773 357 assumes f: "positive M f" "additive M f" wenzelm@61969 358 shows "(\A. range A \ M \ decseq A \ (\i. A i) \ M \ (\i. f (A i) \ \) \ (\i. f (A i)) \ f (\i. A i)) wenzelm@61969 359 \ (\A. range A \ M \ decseq A \ (\i. A i) = {} \ (\i. f (A i) \ \) \ (\i. f (A i)) \ 0)" hoelzl@49773 360 proof safe wenzelm@61969 361 assume cont: "(\A. range A \ M \ decseq A \ (\i. A i) \ M \ (\i. f (A i) \ \) \ (\i. f (A i)) \ f (\i. A i))" hoelzl@49773 362 fix A :: "nat \ 'a set" assume A: "range A \ M" "decseq A" "(\i. A i) = {}" "\i. f (A i) \ \" wenzelm@61969 363 with cont[THEN spec, of A] show "(\i. f (A i)) \ 0" wenzelm@61808 364 using \positive M f\[unfolded positive_def] by auto hoelzl@49773 365 next wenzelm@61969 366 assume cont: "\A. range A \ M \ decseq A \ (\i. A i) = {} \ (\i. f (A i) \ \) \ (\i. f (A i)) \ 0" hoelzl@49773 367 fix A :: "nat \ 'a set" assume A: "range A \ M" "decseq A" "(\i. A i) \ M" "\i. f (A i) \ \" hoelzl@49773 368 hoelzl@49773 369 have f_mono: "\a b. a \ M \ b \ M \ a \ b \ f a \ f b" hoelzl@49773 370 using additive_increasing[OF f] unfolding increasing_def by simp hoelzl@49773 371 hoelzl@49773 372 have decseq_fA: "decseq (\i. f (A i))" hoelzl@49773 373 using A by (auto simp: decseq_def intro!: f_mono) hoelzl@49773 374 have decseq: "decseq (\i. A i - (\i. A i))" hoelzl@49773 375 using A by (auto simp: decseq_def) hoelzl@49773 376 then have decseq_f: "decseq (\i. f (A i - (\i. A i)))" hoelzl@49773 377 using A unfolding decseq_def by (auto intro!: f_mono Diff) hoelzl@49773 378 have "f (\x. A x) \ f (A 0)" hoelzl@49773 379 using A by (auto intro!: f_mono) hoelzl@49773 380 then have f_Int_fin: "f (\x. A x) \ \" hoelzl@62975 381 using A by (auto simp: top_unique) hoelzl@49773 382 { fix i hoelzl@49773 383 have "f (A i - (\i. A i)) \ f (A i)" using A by (auto intro!: f_mono) hoelzl@49773 384 then have "f (A i - (\i. A i)) \ \" hoelzl@62975 385 using A by (auto simp: top_unique) } hoelzl@49773 386 note f_fin = this wenzelm@61969 387 have "(\i. f (A i - (\i. A i))) \ 0" hoelzl@49773 388 proof (intro cont[rule_format, OF _ decseq _ f_fin]) hoelzl@49773 389 show "range (\i. A i - (\i. A i)) \ M" "(\i. A i - (\i. A i)) = {}" hoelzl@49773 390 using A by auto hoelzl@49773 391 qed lp15@68532 392 from INF_Lim[OF decseq_f this] hoelzl@49773 393 have "(INF n. f (A n - (\i. A i))) = 0" . hoelzl@49773 394 moreover have "(INF n. f (\i. A i)) = f (\i. A i)" hoelzl@49773 395 by auto hoelzl@49773 396 ultimately have "(INF n. f (A n - (\i. A i)) + f (\i. A i)) = 0 + f (\i. A i)" hoelzl@49773 397 using A(4) f_fin f_Int_fin hoelzl@62975 398 by (subst INF_ennreal_add_const) (auto simp: decseq_f) hoelzl@49773 399 moreover { hoelzl@49773 400 fix n hoelzl@49773 401 have "f (A n - (\i. A i)) + f (\i. A i) = f ((A n - (\i. A i)) \ (\i. A i))" hoelzl@49773 402 using A by (subst f(2)[THEN additiveD]) auto hoelzl@49773 403 also have "(A n - (\i. A i)) \ (\i. A i) = A n" hoelzl@49773 404 by auto hoelzl@49773 405 finally have "f (A n - (\i. A i)) + f (\i. A i) = f (A n)" . } hoelzl@49773 406 ultimately have "(INF n. f (A n)) = f (\i. A i)" hoelzl@49773 407 by simp hoelzl@51351 408 with LIMSEQ_INF[OF decseq_fA] wenzelm@61969 409 show "(\i. f (A i)) \ f (\i. A i)" by simp hoelzl@49773 410 qed hoelzl@49773 411 hoelzl@49773 412 lemma (in ring_of_sets) empty_continuous_imp_continuous_from_below: hoelzl@62975 413 fixes f :: "'a set \ ennreal" hoelzl@49773 414 assumes f: "positive M f" "additive M f" "\A\M. f A \ \" wenzelm@61969 415 assumes cont: "\A. range A \ M \ decseq A \ (\i. A i) = {} \ (\i. f (A i)) \ 0" hoelzl@49773 416 assumes A: "range A \ M" "incseq A" "(\i. A i) \ M" wenzelm@61969 417 shows "(\i. f (A i)) \ f (\i. A i)" hoelzl@49773 418 proof - wenzelm@61969 419 from A have "(\i. f ((\i. A i) - A i)) \ 0" hoelzl@49773 420 by (intro cont[rule_format]) (auto simp: decseq_def incseq_def) hoelzl@49773 421 moreover hoelzl@49773 422 { fix i hoelzl@62975 423 have "f ((\i. A i) - A i \ A i) = f ((\i. A i) - A i) + f (A i)" hoelzl@62975 424 using A by (intro f(2)[THEN additiveD]) auto hoelzl@62975 425 also have "((\i. A i) - A i) \ A i = (\i. A i)" hoelzl@49773 426 by auto hoelzl@62975 427 finally have "f ((\i. A i) - A i) = f (\i. A i) - f (A i)" hoelzl@62975 428 using f(3)[rule_format, of "A i"] A by (auto simp: ennreal_add_diff_cancel subset_eq) } hoelzl@62975 429 moreover have "\\<^sub>F i in sequentially. f (A i) \ f (\i. A i)" hoelzl@62975 430 using increasingD[OF additive_increasing[OF f(1, 2)], of "A _" "\i. A i"] A hoelzl@62975 431 by (auto intro!: always_eventually simp: subset_eq) hoelzl@62975 432 ultimately show "(\i. f (A i)) \ f (\i. A i)" hoelzl@62975 433 by (auto intro: ennreal_tendsto_const_minus) hoelzl@49773 434 qed hoelzl@49773 435 hoelzl@49773 436 lemma (in ring_of_sets) empty_continuous_imp_countably_additive: hoelzl@62975 437 fixes f :: "'a set \ ennreal" hoelzl@49773 438 assumes f: "positive M f" "additive M f" and fin: "\A\M. f A \ \" wenzelm@61969 439 assumes cont: "\A. range A \ M \ decseq A \ (\i. A i) = {} \ (\i. f (A i)) \ 0" hoelzl@49773 440 shows "countably_additive M f" hoelzl@49773 441 using countably_additive_iff_continuous_from_below[OF f] hoelzl@49773 442 using empty_continuous_imp_continuous_from_below[OF f fin] cont hoelzl@49773 443 by blast hoelzl@49773 444 immler@67962 445 subsection%unimportant \Properties of @{const emeasure}\ hoelzl@47694 446 hoelzl@47694 447 lemma emeasure_positive: "positive (sets M) (emeasure M)" hoelzl@47694 448 by (cases M) (auto simp: sets_def emeasure_def Abs_measure_inverse measure_space_def) hoelzl@47694 449 hoelzl@47694 450 lemma emeasure_empty[simp, intro]: "emeasure M {} = 0" hoelzl@47694 451 using emeasure_positive[of M] by (simp add: positive_def) hoelzl@47694 452 hoelzl@59000 453 lemma emeasure_single_in_space: "emeasure M {x} \ 0 \ x \ space M" hoelzl@62975 454 using emeasure_notin_sets[of "{x}" M] by (auto dest: sets.sets_into_space zero_less_iff_neq_zero[THEN iffD2]) hoelzl@59000 455 hoelzl@47694 456 lemma emeasure_countably_additive: "countably_additive (sets M) (emeasure M)" hoelzl@47694 457 by (cases M) (auto simp: sets_def emeasure_def Abs_measure_inverse measure_space_def) hoelzl@47694 458 hoelzl@47694 459 lemma suminf_emeasure: hoelzl@47694 460 "range A \ sets M \ disjoint_family A \ (\i. emeasure M (A i)) = emeasure M (\i. A i)" immler@50244 461 using sets.countable_UN[of A UNIV M] emeasure_countably_additive[of M] hoelzl@47694 462 by (simp add: countably_additive_def) hoelzl@47694 463 hoelzl@57447 464 lemma sums_emeasure: hoelzl@57447 465 "disjoint_family F \ (\i. F i \ sets M) \ (\i. emeasure M (F i)) sums emeasure M (\i. F i)" hoelzl@62975 466 unfolding sums_iff by (intro conjI suminf_emeasure) auto hoelzl@57447 467 hoelzl@47694 468 lemma emeasure_additive: "additive (sets M) (emeasure M)" immler@50244 469 by (metis sets.countably_additive_additive emeasure_positive emeasure_countably_additive) hoelzl@47694 470 hoelzl@47694 471 lemma plus_emeasure: hoelzl@47694 472 "a \ sets M \ b \ sets M \ a \ b = {} \ emeasure M a + emeasure M b = emeasure M (a \ b)" hoelzl@47694 473 using additiveD[OF emeasure_additive] .. hoelzl@47694 474 hoelzl@63968 475 lemma emeasure_Union: hoelzl@63968 476 "A \ sets M \ B \ sets M \ emeasure M (A \ B) = emeasure M A + emeasure M (B - A)" hoelzl@63968 477 using plus_emeasure[of A M "B - A"] by auto hoelzl@63968 478 nipkow@64267 479 lemma sum_emeasure: hoelzl@47694 480 "F`I \ sets M \ disjoint_family_on F I \ finite I \ hoelzl@47694 481 (\i\I. emeasure M (F i)) = emeasure M (\i\I. F i)" immler@50244 482 by (metis sets.additive_sum emeasure_positive emeasure_additive) hoelzl@47694 483 hoelzl@47694 484 lemma emeasure_mono: hoelzl@47694 485 "a \ b \ b \ sets M \ emeasure M a \ emeasure M b" hoelzl@62975 486 by (metis zero_le sets.additive_increasing emeasure_additive emeasure_notin_sets emeasure_positive increasingD) hoelzl@47694 487 hoelzl@47694 488 lemma emeasure_space: hoelzl@47694 489 "emeasure M A \ emeasure M (space M)" hoelzl@62975 490 by (metis emeasure_mono emeasure_notin_sets sets.sets_into_space sets.top zero_le) hoelzl@47694 491 hoelzl@47694 492 lemma emeasure_Diff: hoelzl@47694 493 assumes finite: "emeasure M B \ \" hoelzl@50002 494 and [measurable]: "A \ sets M" "B \ sets M" and "B \ A" hoelzl@47694 495 shows "emeasure M (A - B) = emeasure M A - emeasure M B" hoelzl@47694 496 proof - wenzelm@61808 497 have "(A - B) \ B = A" using \B \ A\ by auto hoelzl@47694 498 then have "emeasure M A = emeasure M ((A - B) \ B)" by simp hoelzl@47694 499 also have "\ = emeasure M (A - B) + emeasure M B" hoelzl@50002 500 by (subst plus_emeasure[symmetric]) auto hoelzl@47694 501 finally show "emeasure M (A - B) = emeasure M A - emeasure M B" hoelzl@62975 502 using finite by simp hoelzl@47694 503 qed hoelzl@47694 504 hoelzl@62975 505 lemma emeasure_compl: hoelzl@62975 506 "s \ sets M \ emeasure M s \ \ \ emeasure M (space M - s) = emeasure M (space M) - emeasure M s" hoelzl@62975 507 by (rule emeasure_Diff) (auto dest: sets.sets_into_space) hoelzl@62975 508 hoelzl@49773 509 lemma Lim_emeasure_incseq: wenzelm@61969 510 "range A \ sets M \ incseq A \ (\i. (emeasure M (A i))) \ emeasure M (\i. A i)" hoelzl@49773 511 using emeasure_countably_additive immler@50244 512 by (auto simp add: sets.countably_additive_iff_continuous_from_below emeasure_positive immler@50244 513 emeasure_additive) hoelzl@47694 514 hoelzl@47694 515 lemma incseq_emeasure: hoelzl@47694 516 assumes "range B \ sets M" "incseq B" hoelzl@47694 517 shows "incseq (\i. emeasure M (B i))" hoelzl@47694 518 using assms by (auto simp: incseq_def intro!: emeasure_mono) hoelzl@47694 519 hoelzl@49773 520 lemma SUP_emeasure_incseq: hoelzl@47694 521 assumes A: "range A \ sets M" "incseq A" hoelzl@49773 522 shows "(SUP n. emeasure M (A n)) = emeasure M (\i. A i)" hoelzl@51000 523 using LIMSEQ_SUP[OF incseq_emeasure, OF A] Lim_emeasure_incseq[OF A] hoelzl@49773 524 by (simp add: LIMSEQ_unique) hoelzl@47694 525 hoelzl@47694 526 lemma decseq_emeasure: hoelzl@47694 527 assumes "range B \ sets M" "decseq B" hoelzl@47694 528 shows "decseq (\i. emeasure M (B i))" hoelzl@47694 529 using assms by (auto simp: decseq_def intro!: emeasure_mono) hoelzl@47694 530 hoelzl@47694 531 lemma INF_emeasure_decseq: hoelzl@47694 532 assumes A: "range A \ sets M" and "decseq A" hoelzl@47694 533 and finite: "\i. emeasure M (A i) \ \" hoelzl@47694 534 shows "(INF n. emeasure M (A n)) = emeasure M (\i. A i)" hoelzl@47694 535 proof - hoelzl@47694 536 have le_MI: "emeasure M (\i. A i) \ emeasure M (A 0)" hoelzl@47694 537 using A by (auto intro!: emeasure_mono) hoelzl@62975 538 hence *: "emeasure M (\i. A i) \ \" using finite[of 0] by (auto simp: top_unique) hoelzl@47694 539 hoelzl@62975 540 have "emeasure M (A 0) - (INF n. emeasure M (A n)) = (SUP n. emeasure M (A 0) - emeasure M (A n))" hoelzl@62975 541 by (simp add: ennreal_INF_const_minus) hoelzl@47694 542 also have "\ = (SUP n. emeasure M (A 0 - A n))" wenzelm@61808 543 using A finite \decseq A\[unfolded decseq_def] by (subst emeasure_Diff) auto hoelzl@47694 544 also have "\ = emeasure M (\i. A 0 - A i)" hoelzl@47694 545 proof (rule SUP_emeasure_incseq) hoelzl@47694 546 show "range (\n. A 0 - A n) \ sets M" hoelzl@47694 547 using A by auto hoelzl@47694 548 show "incseq (\n. A 0 - A n)" wenzelm@61808 549 using \decseq A\ by (auto simp add: incseq_def decseq_def) hoelzl@47694 550 qed hoelzl@47694 551 also have "\ = emeasure M (A 0) - emeasure M (\i. A i)" hoelzl@47694 552 using A finite * by (simp, subst emeasure_Diff) auto hoelzl@47694 553 finally show ?thesis hoelzl@62975 554 by (rule ennreal_minus_cancel[rotated 3]) hoelzl@62975 555 (insert finite A, auto intro: INF_lower emeasure_mono) hoelzl@47694 556 qed hoelzl@47694 557 hoelzl@63940 558 lemma INF_emeasure_decseq': hoelzl@63940 559 assumes A: "\i. A i \ sets M" and "decseq A" hoelzl@63940 560 and finite: "\i. emeasure M (A i) \ \" hoelzl@63940 561 shows "(INF n. emeasure M (A n)) = emeasure M (\i. A i)" hoelzl@63940 562 proof - hoelzl@63940 563 from finite obtain i where i: "emeasure M (A i) < \" hoelzl@63940 564 by (auto simp: less_top) hoelzl@63940 565 have fin: "i \ j \ emeasure M (A j) < \" for j hoelzl@63940 566 by (rule le_less_trans[OF emeasure_mono i]) (auto intro!: decseqD[OF \decseq A\] A) hoelzl@63940 567 hoelzl@63940 568 have "(INF n. emeasure M (A n)) = (INF n. emeasure M (A (n + i)))" hoelzl@63940 569 proof (rule INF_eq) hoelzl@63940 570 show "\j\UNIV. emeasure M (A (j + i)) \ emeasure M (A i')" for i' hoelzl@63940 571 by (intro bexI[of _ i'] emeasure_mono decseqD[OF \decseq A\] A) auto hoelzl@63940 572 qed auto hoelzl@63940 573 also have "\ = emeasure M (INF n. (A (n + i)))" hoelzl@63940 574 using A \decseq A\ fin by (intro INF_emeasure_decseq) (auto simp: decseq_def less_top) hoelzl@63940 575 also have "(INF n. (A (n + i))) = (INF n. A n)" hoelzl@63940 576 by (meson INF_eq UNIV_I assms(2) decseqD le_add1) hoelzl@63940 577 finally show ?thesis . hoelzl@63940 578 qed hoelzl@63940 579 hoelzl@61359 580 lemma emeasure_INT_decseq_subset: hoelzl@61359 581 fixes F :: "nat \ 'a set" hoelzl@61359 582 assumes I: "I \ {}" and F: "\i j. i \ I \ j \ I \ i \ j \ F j \ F i" hoelzl@61359 583 assumes F_sets[measurable]: "\i. i \ I \ F i \ sets M" hoelzl@61359 584 and fin: "\i. i \ I \ emeasure M (F i) \ \" hoelzl@61359 585 shows "emeasure M (\i\I. F i) = (INF i:I. emeasure M (F i))" hoelzl@61359 586 proof cases hoelzl@61359 587 assume "finite I" hoelzl@61359 588 have "(\i\I. F i) = F (Max I)" hoelzl@61359 589 using I \finite I\ by (intro antisym INF_lower INF_greatest F) auto hoelzl@61359 590 moreover have "(INF i:I. emeasure M (F i)) = emeasure M (F (Max I))" hoelzl@61359 591 using I \finite I\ by (intro antisym INF_lower INF_greatest F emeasure_mono) auto hoelzl@61359 592 ultimately show ?thesis hoelzl@61359 593 by simp hoelzl@61359 594 next hoelzl@61359 595 assume "infinite I" wenzelm@63040 596 define L where "L n = (LEAST i. i \ I \ i \ n)" for n hoelzl@61359 597 have L: "L n \ I \ n \ L n" for n hoelzl@61359 598 unfolding L_def hoelzl@61359 599 proof (rule LeastI_ex) hoelzl@61359 600 show "\x. x \ I \ n \ x" hoelzl@61359 601 using \infinite I\ finite_subset[of I "{..< n}"] hoelzl@61359 602 by (rule_tac ccontr) (auto simp: not_le) hoelzl@61359 603 qed hoelzl@61359 604 have L_eq[simp]: "i \ I \ L i = i" for i hoelzl@61359 605 unfolding L_def by (intro Least_equality) auto hoelzl@61359 606 have L_mono: "i \ j \ L i \ L j" for i j hoelzl@61359 607 using L[of j] unfolding L_def by (intro Least_le) (auto simp: L_def) hoelzl@61359 608 hoelzl@61359 609 have "emeasure M (\i. F (L i)) = (INF i. emeasure M (F (L i)))" hoelzl@61359 610 proof (intro INF_emeasure_decseq[symmetric]) hoelzl@61359 611 show "decseq (\i. F (L i))" hoelzl@61359 612 using L by (intro antimonoI F L_mono) auto hoelzl@61359 613 qed (insert L fin, auto) hoelzl@61359 614 also have "\ = (INF i:I. emeasure M (F i))" hoelzl@61359 615 proof (intro antisym INF_greatest) hoelzl@61359 616 show "i \ I \ (INF i. emeasure M (F (L i))) \ emeasure M (F i)" for i hoelzl@61359 617 by (intro INF_lower2[of i]) auto hoelzl@61359 618 qed (insert L, auto intro: INF_lower) hoelzl@61359 619 also have "(\i. F (L i)) = (\i\I. F i)" hoelzl@61359 620 proof (intro antisym INF_greatest) hoelzl@61359 621 show "i \ I \ (\i. F (L i)) \ F i" for i hoelzl@61359 622 by (intro INF_lower2[of i]) auto hoelzl@61359 623 qed (insert L, auto) hoelzl@61359 624 finally show ?thesis . hoelzl@61359 625 qed hoelzl@61359 626 hoelzl@47694 627 lemma Lim_emeasure_decseq: hoelzl@47694 628 assumes A: "range A \ sets M" "decseq A" and fin: "\i. emeasure M (A i) \ \" wenzelm@61969 629 shows "(\i. emeasure M (A i)) \ emeasure M (\i. A i)" hoelzl@51351 630 using LIMSEQ_INF[OF decseq_emeasure, OF A] hoelzl@47694 631 using INF_emeasure_decseq[OF A fin] by simp hoelzl@47694 632 hoelzl@60636 633 lemma emeasure_lfp'[consumes 1, case_names cont measurable]: hoelzl@59000 634 assumes "P M" hoelzl@60172 635 assumes cont: "sup_continuous F" hoelzl@59000 636 assumes *: "\M A. P M \ (\N. P N \ Measurable.pred N A) \ Measurable.pred M (F A)" hoelzl@59000 637 shows "emeasure M {x\space M. lfp F x} = (SUP i. emeasure M {x\space M. (F ^^ i) (\x. False) x})" hoelzl@59000 638 proof - hoelzl@59000 639 have "emeasure M {x\space M. lfp F x} = emeasure M (\i. {x\space M. (F ^^ i) (\x. False) x})" hoelzl@60172 640 using sup_continuous_lfp[OF cont] by (auto simp add: bot_fun_def intro!: arg_cong2[where f=emeasure]) wenzelm@61808 641 moreover { fix i from \P M\ have "{x\space M. (F ^^ i) (\x. False) x} \ sets M" hoelzl@59000 642 by (induct i arbitrary: M) (auto simp add: pred_def[symmetric] intro: *) } hoelzl@59000 643 moreover have "incseq (\i. {x\space M. (F ^^ i) (\x. False) x})" hoelzl@59000 644 proof (rule incseq_SucI) hoelzl@59000 645 fix i hoelzl@59000 646 have "(F ^^ i) (\x. False) \ (F ^^ (Suc i)) (\x. False)" hoelzl@59000 647 proof (induct i) hoelzl@59000 648 case 0 show ?case by (simp add: le_fun_def) hoelzl@59000 649 next hoelzl@60172 650 case Suc thus ?case using monoD[OF sup_continuous_mono[OF cont] Suc] by auto hoelzl@59000 651 qed hoelzl@59000 652 then show "{x \ space M. (F ^^ i) (\x. False) x} \ {x \ space M. (F ^^ Suc i) (\x. False) x}" hoelzl@59000 653 by auto hoelzl@59000 654 qed hoelzl@59000 655 ultimately show ?thesis hoelzl@59000 656 by (subst SUP_emeasure_incseq) auto hoelzl@59000 657 qed hoelzl@59000 658 hoelzl@60636 659 lemma emeasure_lfp: hoelzl@60636 660 assumes [simp]: "\s. sets (M s) = sets N" hoelzl@60636 661 assumes cont: "sup_continuous F" "sup_continuous f" hoelzl@60636 662 assumes meas: "\P. Measurable.pred N P \ Measurable.pred N (F P)" hoelzl@60714 663 assumes iter: "\P s. Measurable.pred N P \ P \ lfp F \ emeasure (M s) {x\space N. F P x} = f (\s. emeasure (M s) {x\space N. P x}) s" hoelzl@60636 664 shows "emeasure (M s) {x\space N. lfp F x} = lfp f s" hoelzl@60636 665 proof (subst lfp_transfer_bounded[where \="\F s. emeasure (M s) {x\space N. F x}" and g=f and f=F and P="Measurable.pred N", symmetric]) hoelzl@60636 666 fix C assume "incseq C" "\i. Measurable.pred N (C i)" hoelzl@60636 667 then show "(\s. emeasure (M s) {x \ space N. (SUP i. C i) x}) = (SUP i. (\s. emeasure (M s) {x \ space N. C i x}))" hoelzl@60636 668 unfolding SUP_apply[abs_def] hoelzl@60636 669 by (subst SUP_emeasure_incseq) (auto simp: mono_def fun_eq_iff intro!: arg_cong2[where f=emeasure]) hoelzl@62975 670 qed (auto simp add: iter le_fun_def SUP_apply[abs_def] intro!: meas cont) hoelzl@47694 671 hoelzl@47694 672 lemma emeasure_subadditive_finite: hoelzl@62975 673 "finite I \ A ` I \ sets M \ emeasure M (\i\I. A i) \ (\i\I. emeasure M (A i))" hoelzl@62975 674 by (rule sets.subadditive[OF emeasure_positive emeasure_additive]) auto hoelzl@62975 675 hoelzl@62975 676 lemma emeasure_subadditive: hoelzl@62975 677 "A \ sets M \ B \ sets M \ emeasure M (A \ B) \ emeasure M A + emeasure M B" hoelzl@62975 678 using emeasure_subadditive_finite[of "{True, False}" "\True \ A | False \ B" M] by simp hoelzl@47694 679 hoelzl@47694 680 lemma emeasure_subadditive_countably: hoelzl@47694 681 assumes "range f \ sets M" hoelzl@47694 682 shows "emeasure M (\i. f i) \ (\i. emeasure M (f i))" hoelzl@47694 683 proof - hoelzl@47694 684 have "emeasure M (\i. f i) = emeasure M (\i. disjointed f i)" hoelzl@47694 685 unfolding UN_disjointed_eq .. hoelzl@47694 686 also have "\ = (\i. emeasure M (disjointed f i))" immler@50244 687 using sets.range_disjointed_sets[OF assms] suminf_emeasure[of "disjointed f"] hoelzl@47694 688 by (simp add: disjoint_family_disjointed comp_def) hoelzl@47694 689 also have "\ \ (\i. emeasure M (f i))" immler@50244 690 using sets.range_disjointed_sets[OF assms] assms hoelzl@62975 691 by (auto intro!: suminf_le emeasure_mono disjointed_subset) hoelzl@47694 692 finally show ?thesis . hoelzl@47694 693 qed hoelzl@47694 694 hoelzl@47694 695 lemma emeasure_insert: hoelzl@47694 696 assumes sets: "{x} \ sets M" "A \ sets M" and "x \ A" hoelzl@47694 697 shows "emeasure M (insert x A) = emeasure M {x} + emeasure M A" hoelzl@47694 698 proof - wenzelm@61808 699 have "{x} \ A = {}" using \x \ A\ by auto hoelzl@47694 700 from plus_emeasure[OF sets this] show ?thesis by simp hoelzl@47694 701 qed hoelzl@47694 702 hoelzl@57447 703 lemma emeasure_insert_ne: hoelzl@57447 704 "A \ {} \ {x} \ sets M \ A \ sets M \ x \ A \ emeasure M (insert x A) = emeasure M {x} + emeasure M A" lp15@61609 705 by (rule emeasure_insert) hoelzl@57447 706 nipkow@64267 707 lemma emeasure_eq_sum_singleton: hoelzl@47694 708 assumes "finite S" "\x. x \ S \ {x} \ sets M" hoelzl@47694 709 shows "emeasure M S = (\x\S. emeasure M {x})" nipkow@64267 710 using sum_emeasure[of "\x. {x}" S M] assms hoelzl@47694 711 by (auto simp: disjoint_family_on_def subset_eq) hoelzl@47694 712 nipkow@64267 713 lemma sum_emeasure_cover: hoelzl@47694 714 assumes "finite S" and "A \ sets M" and br_in_M: "B ` S \ sets M" hoelzl@47694 715 assumes A: "A \ (\i\S. B i)" hoelzl@47694 716 assumes disj: "disjoint_family_on B S" hoelzl@47694 717 shows "emeasure M A = (\i\S. emeasure M (A \ (B i)))" hoelzl@47694 718 proof - hoelzl@47694 719 have "(\i\S. emeasure M (A \ (B i))) = emeasure M (\i\S. A \ (B i))" nipkow@64267 720 proof (rule sum_emeasure) hoelzl@47694 721 show "disjoint_family_on (\i. A \ B i) S" wenzelm@61808 722 using \disjoint_family_on B S\ hoelzl@47694 723 unfolding disjoint_family_on_def by auto hoelzl@47694 724 qed (insert assms, auto) hoelzl@47694 725 also have "(\i\S. A \ (B i)) = A" hoelzl@47694 726 using A by auto hoelzl@47694 727 finally show ?thesis by simp hoelzl@47694 728 qed hoelzl@47694 729 hoelzl@47694 730 lemma emeasure_eq_0: hoelzl@47694 731 "N \ sets M \ emeasure M N = 0 \ K \ N \ emeasure M K = 0" hoelzl@62975 732 by (metis emeasure_mono order_eq_iff zero_le) hoelzl@47694 733 hoelzl@47694 734 lemma emeasure_UN_eq_0: hoelzl@47694 735 assumes "\i::nat. emeasure M (N i) = 0" and "range N \ sets M" wenzelm@60585 736 shows "emeasure M (\i. N i) = 0" hoelzl@47694 737 proof - hoelzl@62975 738 have "emeasure M (\i. N i) \ 0" hoelzl@47694 739 using emeasure_subadditive_countably[OF assms(2)] assms(1) by simp hoelzl@62975 740 then show ?thesis hoelzl@62975 741 by (auto intro: antisym zero_le) hoelzl@47694 742 qed hoelzl@47694 743 hoelzl@47694 744 lemma measure_eqI_finite: hoelzl@47694 745 assumes [simp]: "sets M = Pow A" "sets N = Pow A" and "finite A" hoelzl@47694 746 assumes eq: "\a. a \ A \ emeasure M {a} = emeasure N {a}" hoelzl@47694 747 shows "M = N" hoelzl@47694 748 proof (rule measure_eqI) hoelzl@47694 749 fix X assume "X \ sets M" hoelzl@47694 750 then have X: "X \ A" by auto hoelzl@47694 751 then have "emeasure M X = (\a\X. emeasure M {a})" nipkow@64267 752 using \finite A\ by (subst emeasure_eq_sum_singleton) (auto dest: finite_subset) hoelzl@47694 753 also have "\ = (\a\X. emeasure N {a})" nipkow@64267 754 using X eq by (auto intro!: sum.cong) hoelzl@47694 755 also have "\ = emeasure N X" nipkow@64267 756 using X \finite A\ by (subst emeasure_eq_sum_singleton) (auto dest: finite_subset) hoelzl@47694 757 finally show "emeasure M X = emeasure N X" . hoelzl@47694 758 qed simp hoelzl@47694 759 hoelzl@47694 760 lemma measure_eqI_generator_eq: hoelzl@47694 761 fixes M N :: "'a measure" and E :: "'a set set" and A :: "nat \ 'a set" hoelzl@47694 762 assumes "Int_stable E" "E \ Pow \" hoelzl@47694 763 and eq: "\X. X \ E \ emeasure M X = emeasure N X" hoelzl@47694 764 and M: "sets M = sigma_sets \ E" hoelzl@47694 765 and N: "sets N = sigma_sets \ E" hoelzl@49784 766 and A: "range A \ E" "(\i. A i) = \" "\i. emeasure M (A i) \ \" hoelzl@47694 767 shows "M = N" hoelzl@47694 768 proof - hoelzl@49773 769 let ?\ = "emeasure M" and ?\ = "emeasure N" hoelzl@47694 770 interpret S: sigma_algebra \ "sigma_sets \ E" by (rule sigma_algebra_sigma_sets) fact hoelzl@49789 771 have "space M = \" wenzelm@61808 772 using sets.top[of M] sets.space_closed[of M] S.top S.space_closed \sets M = sigma_sets \ E\ immler@50244 773 by blast hoelzl@49789 774 hoelzl@49789 775 { fix F D assume "F \ E" and "?\ F \ \" hoelzl@47694 776 then have [intro]: "F \ sigma_sets \ E" by auto wenzelm@61808 777 have "?\ F \ \" using \?\ F \ \\ \F \ E\ eq by simp hoelzl@49789 778 assume "D \ sets M" wenzelm@61808 779 with \Int_stable E\ \E \ Pow \\ have "emeasure M (F \ D) = emeasure N (F \ D)" hoelzl@49789 780 unfolding M hoelzl@49789 781 proof (induct rule: sigma_sets_induct_disjoint) hoelzl@49789 782 case (basic A) wenzelm@61808 783 then have "F \ A \ E" using \Int_stable E\ \F \ E\ by (auto simp: Int_stable_def) hoelzl@49789 784 then show ?case using eq by auto hoelzl@47694 785 next hoelzl@49789 786 case empty then show ?case by simp hoelzl@47694 787 next hoelzl@49789 788 case (compl A) hoelzl@47694 789 then have **: "F \ (\ - A) = F - (F \ A)" hoelzl@47694 790 and [intro]: "F \ A \ sigma_sets \ E" wenzelm@61808 791 using \F \ E\ S.sets_into_space by (auto simp: M) hoelzl@49773 792 have "?\ (F \ A) \ ?\ F" by (auto intro!: emeasure_mono simp: M N) hoelzl@62975 793 then have "?\ (F \ A) \ \" using \?\ F \ \\ by (auto simp: top_unique) hoelzl@49773 794 have "?\ (F \ A) \ ?\ F" by (auto intro!: emeasure_mono simp: M N) hoelzl@62975 795 then have "?\ (F \ A) \ \" using \?\ F \ \\ by (auto simp: top_unique) hoelzl@49773 796 then have "?\ (F \ (\ - A)) = ?\ F - ?\ (F \ A)" unfolding ** wenzelm@61808 797 using \F \ A \ sigma_sets \ E\ by (auto intro!: emeasure_Diff simp: M N) wenzelm@61808 798 also have "\ = ?\ F - ?\ (F \ A)" using eq \F \ E\ compl by simp hoelzl@49773 799 also have "\ = ?\ (F \ (\ - A))" unfolding ** wenzelm@61808 800 using \F \ A \ sigma_sets \ E\ \?\ (F \ A) \ \\ hoelzl@47694 801 by (auto intro!: emeasure_Diff[symmetric] simp: M N) hoelzl@49789 802 finally show ?case wenzelm@61808 803 using \space M = \\ by auto hoelzl@47694 804 next hoelzl@49789 805 case (union A) hoelzl@49773 806 then have "?\ (\x. F \ A x) = ?\ (\x. F \ A x)" hoelzl@49773 807 by (subst (1 2) suminf_emeasure[symmetric]) (auto simp: disjoint_family_on_def subset_eq M N) hoelzl@49789 808 with A show ?case hoelzl@49773 809 by auto hoelzl@49789 810 qed } hoelzl@47694 811 note * = this hoelzl@47694 812 show "M = N" hoelzl@47694 813 proof (rule measure_eqI) hoelzl@47694 814 show "sets M = sets N" hoelzl@47694 815 using M N by simp hoelzl@49784 816 have [simp, intro]: "\i. A i \ sets M" hoelzl@49784 817 using A(1) by (auto simp: subset_eq M) hoelzl@49773 818 fix F assume "F \ sets M" hoelzl@49784 819 let ?D = "disjointed (\i. F \ A i)" wenzelm@61808 820 from \space M = \\ have F_eq: "F = (\i. ?D i)" wenzelm@61808 821 using \F \ sets M\[THEN sets.sets_into_space] A(2)[symmetric] by (auto simp: UN_disjointed_eq) hoelzl@49784 822 have [simp, intro]: "\i. ?D i \ sets M" wenzelm@61808 823 using sets.range_disjointed_sets[of "\i. F \ A i" M] \F \ sets M\ hoelzl@49784 824 by (auto simp: subset_eq) hoelzl@49784 825 have "disjoint_family ?D" hoelzl@49784 826 by (auto simp: disjoint_family_disjointed) hoelzl@50002 827 moreover hoelzl@50002 828 have "(\i. emeasure M (?D i)) = (\i. emeasure N (?D i))" hoelzl@50002 829 proof (intro arg_cong[where f=suminf] ext) hoelzl@50002 830 fix i hoelzl@49784 831 have "A i \ ?D i = ?D i" hoelzl@49784 832 by (auto simp: disjointed_def) hoelzl@50002 833 then show "emeasure M (?D i) = emeasure N (?D i)" hoelzl@50002 834 using *[of "A i" "?D i", OF _ A(3)] A(1) by auto hoelzl@50002 835 qed hoelzl@50002 836 ultimately show "emeasure M F = emeasure N F" wenzelm@61808 837 by (simp add: image_subset_iff \sets M = sets N\[symmetric] F_eq[symmetric] suminf_emeasure) hoelzl@47694 838 qed hoelzl@47694 839 qed hoelzl@47694 840 hoelzl@64008 841 lemma space_empty: "space M = {} \ M = count_space {}" hoelzl@64008 842 by (rule measure_eqI) (simp_all add: space_empty_iff) hoelzl@64008 843 hoelzl@64008 844 lemma measure_eqI_generator_eq_countable: hoelzl@64008 845 fixes M N :: "'a measure" and E :: "'a set set" and A :: "'a set set" hoelzl@64008 846 assumes E: "Int_stable E" "E \ Pow \" "\X. X \ E \ emeasure M X = emeasure N X" hoelzl@64008 847 and sets: "sets M = sigma_sets \ E" "sets N = sigma_sets \ E" hoelzl@64008 848 and A: "A \ E" "(\A) = \" "countable A" "\a. a \ A \ emeasure M a \ \" hoelzl@64008 849 shows "M = N" hoelzl@64008 850 proof cases hoelzl@64008 851 assume "\ = {}" hoelzl@64008 852 have *: "sigma_sets \ E = sets (sigma \ E)" hoelzl@64008 853 using E(2) by simp hoelzl@64008 854 have "space M = \" "space N = \" hoelzl@64008 855 using sets E(2) unfolding * by (auto dest: sets_eq_imp_space_eq simp del: sets_measure_of) hoelzl@64008 856 then show "M = N" hoelzl@64008 857 unfolding \\ = {}\ by (auto dest: space_empty) hoelzl@64008 858 next hoelzl@64008 859 assume "\ \ {}" with \\A = \\ have "A \ {}" by auto hoelzl@64008 860 from this \countable A\ have rng: "range (from_nat_into A) = A" hoelzl@64008 861 by (rule range_from_nat_into) hoelzl@64008 862 show "M = N" hoelzl@64008 863 proof (rule measure_eqI_generator_eq[OF E sets]) hoelzl@64008 864 show "range (from_nat_into A) \ E" hoelzl@64008 865 unfolding rng using \A \ E\ . hoelzl@64008 866 show "(\i. from_nat_into A i) = \" hoelzl@64008 867 unfolding rng using \\A = \\ . hoelzl@64008 868 show "emeasure M (from_nat_into A i) \ \" for i hoelzl@64008 869 using rng by (intro A) auto hoelzl@64008 870 qed hoelzl@64008 871 qed hoelzl@64008 872 hoelzl@47694 873 lemma measure_of_of_measure: "measure_of (space M) (sets M) (emeasure M) = M" hoelzl@47694 874 proof (intro measure_eqI emeasure_measure_of_sigma) hoelzl@47694 875 show "sigma_algebra (space M) (sets M)" .. hoelzl@47694 876 show "positive (sets M) (emeasure M)" hoelzl@62975 877 by (simp add: positive_def) hoelzl@47694 878 show "countably_additive (sets M) (emeasure M)" hoelzl@47694 879 by (simp add: emeasure_countably_additive) hoelzl@47694 880 qed simp_all hoelzl@47694 881 wenzelm@61808 882 subsection \\\\-null sets\ hoelzl@47694 883 immler@67962 884 definition%important null_sets :: "'a measure \ 'a set set" where hoelzl@47694 885 "null_sets M = {N\sets M. emeasure M N = 0}" hoelzl@47694 886 hoelzl@47694 887 lemma null_setsD1[dest]: "A \ null_sets M \ emeasure M A = 0" hoelzl@47694 888 by (simp add: null_sets_def) hoelzl@47694 889 hoelzl@47694 890 lemma null_setsD2[dest]: "A \ null_sets M \ A \ sets M" hoelzl@47694 891 unfolding null_sets_def by simp hoelzl@47694 892 hoelzl@47694 893 lemma null_setsI[intro]: "emeasure M A = 0 \ A \ sets M \ A \ null_sets M" hoelzl@47694 894 unfolding null_sets_def by simp hoelzl@47694 895 hoelzl@47694 896 interpretation null_sets: ring_of_sets "space M" "null_sets M" for M hoelzl@47762 897 proof (rule ring_of_setsI) hoelzl@47694 898 show "null_sets M \ Pow (space M)" immler@50244 899 using sets.sets_into_space by auto hoelzl@47694 900 show "{} \ null_sets M" hoelzl@47694 901 by auto wenzelm@53374 902 fix A B assume null_sets: "A \ null_sets M" "B \ null_sets M" wenzelm@53374 903 then have sets: "A \ sets M" "B \ sets M" hoelzl@47694 904 by auto wenzelm@53374 905 then have *: "emeasure M (A \ B) \ emeasure M A + emeasure M B" hoelzl@47694 906 "emeasure M (A - B) \ emeasure M A" hoelzl@47694 907 by (auto intro!: emeasure_subadditive emeasure_mono) wenzelm@53374 908 then have "emeasure M B = 0" "emeasure M A = 0" wenzelm@53374 909 using null_sets by auto wenzelm@53374 910 with sets * show "A - B \ null_sets M" "A \ B \ null_sets M" hoelzl@62975 911 by (auto intro!: antisym zero_le) hoelzl@47694 912 qed hoelzl@47694 913 lp15@61609 914 lemma UN_from_nat_into: hoelzl@57275 915 assumes I: "countable I" "I \ {}" hoelzl@57275 916 shows "(\i\I. N i) = (\i. N (from_nat_into I i))" hoelzl@47694 917 proof - hoelzl@57275 918 have "(\i\I. N i) = \(N ` range (from_nat_into I))" hoelzl@57275 919 using I by simp hoelzl@57275 920 also have "\ = (\i. (N \ from_nat_into I) i)" haftmann@62343 921 by simp hoelzl@57275 922 finally show ?thesis by simp hoelzl@57275 923 qed hoelzl@57275 924 hoelzl@57275 925 lemma null_sets_UN': hoelzl@57275 926 assumes "countable I" hoelzl@57275 927 assumes "\i. i \ I \ N i \ null_sets M" hoelzl@57275 928 shows "(\i\I. N i) \ null_sets M" hoelzl@57275 929 proof cases hoelzl@57275 930 assume "I = {}" then show ?thesis by simp hoelzl@57275 931 next hoelzl@57275 932 assume "I \ {}" hoelzl@57275 933 show ?thesis hoelzl@57275 934 proof (intro conjI CollectI null_setsI) hoelzl@57275 935 show "(\i\I. N i) \ sets M" hoelzl@57275 936 using assms by (intro sets.countable_UN') auto hoelzl@57275 937 have "emeasure M (\i\I. N i) \ (\n. emeasure M (N (from_nat_into I n)))" wenzelm@61808 938 unfolding UN_from_nat_into[OF \countable I\ \I \ {}\] wenzelm@61808 939 using assms \I \ {}\ by (intro emeasure_subadditive_countably) (auto intro: from_nat_into) hoelzl@57275 940 also have "(\n. emeasure M (N (from_nat_into I n))) = (\_. 0)" wenzelm@61808 941 using assms \I \ {}\ by (auto intro: from_nat_into) hoelzl@57275 942 finally show "emeasure M (\i\I. N i) = 0" hoelzl@62975 943 by (intro antisym zero_le) simp hoelzl@57275 944 qed hoelzl@47694 945 qed hoelzl@47694 946 hoelzl@47694 947 lemma null_sets_UN[intro]: hoelzl@57275 948 "(\i::'i::countable. N i \ null_sets M) \ (\i. N i) \ null_sets M" hoelzl@57275 949 by (rule null_sets_UN') auto hoelzl@47694 950 hoelzl@47694 951 lemma null_set_Int1: hoelzl@47694 952 assumes "B \ null_sets M" "A \ sets M" shows "A \ B \ null_sets M" hoelzl@47694 953 proof (intro CollectI conjI null_setsI) hoelzl@47694 954 show "emeasure M (A \ B) = 0" using assms hoelzl@47694 955 by (intro emeasure_eq_0[of B _ "A \ B"]) auto hoelzl@47694 956 qed (insert assms, auto) hoelzl@47694 957 hoelzl@47694 958 lemma null_set_Int2: hoelzl@47694 959 assumes "B \ null_sets M" "A \ sets M" shows "B \ A \ null_sets M" hoelzl@47694 960 using assms by (subst Int_commute) (rule null_set_Int1) hoelzl@47694 961 hoelzl@47694 962 lemma emeasure_Diff_null_set: hoelzl@47694 963 assumes "B \ null_sets M" "A \ sets M" hoelzl@47694 964 shows "emeasure M (A - B) = emeasure M A" hoelzl@47694 965 proof - hoelzl@47694 966 have *: "A - B = (A - (A \ B))" by auto hoelzl@47694 967 have "A \ B \ null_sets M" using assms by (rule null_set_Int1) hoelzl@47694 968 then show ?thesis hoelzl@47694 969 unfolding * using assms hoelzl@47694 970 by (subst emeasure_Diff) auto hoelzl@47694 971 qed hoelzl@47694 972 hoelzl@47694 973 lemma null_set_Diff: hoelzl@47694 974 assumes "B \ null_sets M" "A \ sets M" shows "B - A \ null_sets M" hoelzl@47694 975 proof (intro CollectI conjI null_setsI) hoelzl@47694 976 show "emeasure M (B - A) = 0" using assms by (intro emeasure_eq_0[of B _ "B - A"]) auto hoelzl@47694 977 qed (insert assms, auto) hoelzl@47694 978 hoelzl@47694 979 lemma emeasure_Un_null_set: hoelzl@47694 980 assumes "A \ sets M" "B \ null_sets M" hoelzl@47694 981 shows "emeasure M (A \ B) = emeasure M A" hoelzl@47694 982 proof - hoelzl@47694 983 have *: "A \ B = A \ (B - A)" by auto hoelzl@47694 984 have "B - A \ null_sets M" using assms(2,1) by (rule null_set_Diff) hoelzl@47694 985 then show ?thesis hoelzl@47694 986 unfolding * using assms hoelzl@47694 987 by (subst plus_emeasure[symmetric]) auto hoelzl@47694 988 qed hoelzl@47694 989 wenzelm@61808 990 subsection \The almost everywhere filter (i.e.\ quantifier)\ hoelzl@47694 991 immler@67962 992 definition%important ae_filter :: "'a measure \ 'a filter" where hoelzl@57276 993 "ae_filter M = (INF N:null_sets M. principal (space M - N))" hoelzl@47694 994 hoelzl@57276 995 abbreviation almost_everywhere :: "'a measure \ ('a \ bool) \ bool" where hoelzl@47694 996 "almost_everywhere M P \ eventually P (ae_filter M)" hoelzl@47694 997 hoelzl@47694 998 syntax hoelzl@47694 999 "_almost_everywhere" :: "pttrn \ 'a \ bool \ bool" ("AE _ in _. _" [0,0,10] 10) hoelzl@47694 1000 hoelzl@47694 1001 translations hoelzl@62975 1002 "AE x in M. P" \ "CONST almost_everywhere M (\x. P)" hoelzl@47694 1003 hoelzl@63958 1004 abbreviation hoelzl@63958 1005 "set_almost_everywhere A M P \ AE x in M. x \ A \ P x" hoelzl@63958 1006 hoelzl@63958 1007 syntax hoelzl@63958 1008 "_set_almost_everywhere" :: "pttrn \ 'a set \ 'a \ bool \ bool" hoelzl@63958 1009 ("AE _\_ in _./ _" [0,0,0,10] 10) hoelzl@63958 1010 hoelzl@63958 1011 translations hoelzl@63958 1012 "AE x\A in M. P" \ "CONST set_almost_everywhere A M (\x. P)" hoelzl@63958 1013 hoelzl@57276 1014 lemma eventually_ae_filter: "eventually P (ae_filter M) \ (\N\null_sets M. {x \ space M. \ P x} \ N)" hoelzl@57276 1015 unfolding ae_filter_def by (subst eventually_INF_base) (auto simp: eventually_principal subset_eq) hoelzl@47694 1016 hoelzl@47694 1017 lemma AE_I': hoelzl@47694 1018 "N \ null_sets M \ {x\space M. \ P x} \ N \ (AE x in M. P x)" hoelzl@47694 1019 unfolding eventually_ae_filter by auto hoelzl@47694 1020 hoelzl@47694 1021 lemma AE_iff_null: hoelzl@47694 1022 assumes "{x\space M. \ P x} \ sets M" (is "?P \ sets M") hoelzl@47694 1023 shows "(AE x in M. P x) \ {x\space M. \ P x} \ null_sets M" hoelzl@47694 1024 proof hoelzl@47694 1025 assume "AE x in M. P x" then obtain N where N: "N \ sets M" "?P \ N" "emeasure M N = 0" hoelzl@47694 1026 unfolding eventually_ae_filter by auto hoelzl@62975 1027 have "emeasure M ?P \ emeasure M N" hoelzl@47694 1028 using assms N(1,2) by (auto intro: emeasure_mono) hoelzl@62975 1029 then have "emeasure M ?P = 0" hoelzl@62975 1030 unfolding \emeasure M N = 0\ by auto hoelzl@47694 1031 then show "?P \ null_sets M" using assms by auto hoelzl@47694 1032 next hoelzl@47694 1033 assume "?P \ null_sets M" with assms show "AE x in M. P x" by (auto intro: AE_I') hoelzl@47694 1034 qed hoelzl@47694 1035 hoelzl@47694 1036 lemma AE_iff_null_sets: hoelzl@47694 1037 "N \ sets M \ N \ null_sets M \ (AE x in M. x \ N)" immler@50244 1038 using Int_absorb1[OF sets.sets_into_space, of N M] hoelzl@47694 1039 by (subst AE_iff_null) (auto simp: Int_def[symmetric]) hoelzl@47694 1040 hoelzl@47761 1041 lemma AE_not_in: hoelzl@47761 1042 "N \ null_sets M \ AE x in M. x \ N" hoelzl@47761 1043 by (metis AE_iff_null_sets null_setsD2) hoelzl@47761 1044 hoelzl@47694 1045 lemma AE_iff_measurable: hoelzl@47694 1046 "N \ sets M \ {x\space M. \ P x} = N \ (AE x in M. P x) \ emeasure M N = 0" hoelzl@47694 1047 using AE_iff_null[of _ P] by auto hoelzl@47694 1048 hoelzl@47694 1049 lemma AE_E[consumes 1]: hoelzl@47694 1050 assumes "AE x in M. P x" hoelzl@47694 1051 obtains N where "{x \ space M. \ P x} \ N" "emeasure M N = 0" "N \ sets M" hoelzl@47694 1052 using assms unfolding eventually_ae_filter by auto hoelzl@47694 1053 hoelzl@47694 1054 lemma AE_E2: hoelzl@47694 1055 assumes "AE x in M. P x" "{x\space M. P x} \ sets M" hoelzl@47694 1056 shows "emeasure M {x\space M. \ P x} = 0" (is "emeasure M ?P = 0") hoelzl@47694 1057 proof - hoelzl@47694 1058 have "{x\space M. \ P x} = space M - {x\space M. P x}" by auto hoelzl@47694 1059 with AE_iff_null[of M P] assms show ?thesis by auto hoelzl@47694 1060 qed hoelzl@47694 1061 hoelzl@64283 1062 lemma AE_E3: hoelzl@64283 1063 assumes "AE x in M. P x" hoelzl@64283 1064 obtains N where "\x. x \ space M - N \ P x" "N \ null_sets M" hoelzl@64283 1065 using assms unfolding eventually_ae_filter by auto hoelzl@64283 1066 hoelzl@47694 1067 lemma AE_I: hoelzl@47694 1068 assumes "{x \ space M. \ P x} \ N" "emeasure M N = 0" "N \ sets M" hoelzl@47694 1069 shows "AE x in M. P x" hoelzl@47694 1070 using assms unfolding eventually_ae_filter by auto hoelzl@47694 1071 hoelzl@47694 1072 lemma AE_mp[elim!]: hoelzl@47694 1073 assumes AE_P: "AE x in M. P x" and AE_imp: "AE x in M. P x \ Q x" hoelzl@47694 1074 shows "AE x in M. Q x" hoelzl@47694 1075 proof - hoelzl@47694 1076 from AE_P obtain A where P: "{x\space M. \ P x} \ A" hoelzl@47694 1077 and A: "A \ sets M" "emeasure M A = 0" hoelzl@47694 1078 by (auto elim!: AE_E) hoelzl@47694 1079 hoelzl@47694 1080 from AE_imp obtain B where imp: "{x\space M. P x \ \ Q x} \ B" hoelzl@47694 1081 and B: "B \ sets M" "emeasure M B = 0" hoelzl@47694 1082 by (auto elim!: AE_E) hoelzl@47694 1083 hoelzl@47694 1084 show ?thesis hoelzl@47694 1085 proof (intro AE_I) hoelzl@62975 1086 have "emeasure M (A \ B) \ 0" hoelzl@47694 1087 using emeasure_subadditive[of A M B] A B by auto hoelzl@62975 1088 then show "A \ B \ sets M" "emeasure M (A \ B) = 0" hoelzl@62975 1089 using A B by auto hoelzl@47694 1090 show "{x\space M. \ Q x} \ A \ B" hoelzl@47694 1091 using P imp by auto hoelzl@47694 1092 qed hoelzl@47694 1093 qed hoelzl@47694 1094 wenzelm@64911 1095 text \The next lemma is convenient to combine with a lemma whose conclusion is of the hoelzl@64283 1096 form \AE x in M. P x = Q x\: for such a lemma, there is no \verb+[symmetric]+ variant, wenzelm@64911 1097 but using \AE_symmetric[OF...]\ will replace it.\ hoelzl@64283 1098 hoelzl@47694 1099 (* depricated replace by laws about eventually *) hoelzl@47694 1100 lemma hoelzl@47694 1101 shows AE_iffI: "AE x in M. P x \ AE x in M. P x \ Q x \ AE x in M. Q x" hoelzl@47694 1102 and AE_disjI1: "AE x in M. P x \ AE x in M. P x \ Q x" hoelzl@47694 1103 and AE_disjI2: "AE x in M. Q x \ AE x in M. P x \ Q x" hoelzl@47694 1104 and AE_conjI: "AE x in M. P x \ AE x in M. Q x \ AE x in M. P x \ Q x" hoelzl@47694 1105 and AE_conj_iff[simp]: "(AE x in M. P x \ Q x) \ (AE x in M. P x) \ (AE x in M. Q x)" hoelzl@47694 1106 by auto hoelzl@47694 1107 hoelzl@64283 1108 lemma AE_symmetric: hoelzl@64283 1109 assumes "AE x in M. P x = Q x" hoelzl@64283 1110 shows "AE x in M. Q x = P x" hoelzl@64283 1111 using assms by auto hoelzl@64283 1112 hoelzl@47694 1113 lemma AE_impI: hoelzl@47694 1114 "(P \ AE x in M. Q x) \ AE x in M. P \ Q x" hoelzl@47694 1115 by (cases P) auto hoelzl@47694 1116 hoelzl@47694 1117 lemma AE_measure: hoelzl@47694 1118 assumes AE: "AE x in M. P x" and sets: "{x\space M. P x} \ sets M" (is "?P \ sets M") hoelzl@47694 1119 shows "emeasure M {x\space M. P x} = emeasure M (space M)" hoelzl@47694 1120 proof - hoelzl@47694 1121 from AE_E[OF AE] guess N . note N = this hoelzl@47694 1122 with sets have "emeasure M (space M) \ emeasure M (?P \ N)" hoelzl@47694 1123 by (intro emeasure_mono) auto hoelzl@47694 1124 also have "\ \ emeasure M ?P + emeasure M N" hoelzl@47694 1125 using sets N by (intro emeasure_subadditive) auto hoelzl@47694 1126 also have "\ = emeasure M ?P" using N by simp hoelzl@47694 1127 finally show "emeasure M ?P = emeasure M (space M)" hoelzl@47694 1128 using emeasure_space[of M "?P"] by auto hoelzl@47694 1129 qed hoelzl@47694 1130 hoelzl@47694 1131 lemma AE_space: "AE x in M. x \ space M" hoelzl@47694 1132 by (rule AE_I[where N="{}"]) auto hoelzl@47694 1133 hoelzl@47694 1134 lemma AE_I2[simp, intro]: hoelzl@47694 1135 "(\x. x \ space M \ P x) \ AE x in M. P x" hoelzl@47694 1136 using AE_space by force hoelzl@47694 1137 hoelzl@47694 1138 lemma AE_Ball_mp: hoelzl@47694 1139 "\x\space M. P x \ AE x in M. P x \ Q x \ AE x in M. Q x" hoelzl@47694 1140 by auto hoelzl@47694 1141 hoelzl@47694 1142 lemma AE_cong[cong]: hoelzl@47694 1143 "(\x. x \ space M \ P x \ Q x) \ (AE x in M. P x) \ (AE x in M. Q x)" hoelzl@47694 1144 by auto hoelzl@47694 1145 hoelzl@64008 1146 lemma AE_cong_strong: "M = N \ (\x. x \ space N =simp=> P x = Q x) \ (AE x in M. P x) \ (AE x in N. Q x)" hoelzl@64008 1147 by (auto simp: simp_implies_def) hoelzl@64008 1148 hoelzl@47694 1149 lemma AE_all_countable: hoelzl@47694 1150 "(AE x in M. \i. P i x) \ (\i::'i::countable. AE x in M. P i x)" hoelzl@47694 1151 proof hoelzl@47694 1152 assume "\i. AE x in M. P i x" hoelzl@47694 1153 from this[unfolded eventually_ae_filter Bex_def, THEN choice] hoelzl@47694 1154 obtain N where N: "\i. N i \ null_sets M" "\i. {x\space M. \ P i x} \ N i" by auto hoelzl@47694 1155 have "{x\space M. \ (\i. P i x)} \ (\i. {x\space M. \ P i x})" by auto hoelzl@47694 1156 also have "\ \ (\i. N i)" using N by auto hoelzl@47694 1157 finally have "{x\space M. \ (\i. P i x)} \ (\i. N i)" . hoelzl@47694 1158 moreover from N have "(\i. N i) \ null_sets M" hoelzl@47694 1159 by (intro null_sets_UN) auto hoelzl@47694 1160 ultimately show "AE x in M. \i. P i x" hoelzl@47694 1161 unfolding eventually_ae_filter by auto hoelzl@47694 1162 qed auto hoelzl@47694 1163 lp15@61609 1164 lemma AE_ball_countable: hoelzl@59000 1165 assumes [intro]: "countable X" hoelzl@59000 1166 shows "(AE x in M. \y\X. P x y) \ (\y\X. AE x in M. P x y)" hoelzl@59000 1167 proof hoelzl@59000 1168 assume "\y\X. AE x in M. P x y" hoelzl@59000 1169 from this[unfolded eventually_ae_filter Bex_def, THEN bchoice] hoelzl@59000 1170 obtain N where N: "\y. y \ X \ N y \ null_sets M" "\y. y \ X \ {x\space M. \ P x y} \ N y" hoelzl@59000 1171 by auto hoelzl@59000 1172 have "{x\space M. \ (\y\X. P x y)} \ (\y\X. {x\space M. \ P x y})" hoelzl@59000 1173 by auto hoelzl@59000 1174 also have "\ \ (\y\X. N y)" hoelzl@59000 1175 using N by auto hoelzl@59000 1176 finally have "{x\space M. \ (\y\X. P x y)} \ (\y\X. N y)" . hoelzl@59000 1177 moreover from N have "(\y\X. N y) \ null_sets M" hoelzl@59000 1178 by (intro null_sets_UN') auto hoelzl@59000 1179 ultimately show "AE x in M. \y\X. P x y" hoelzl@59000 1180 unfolding eventually_ae_filter by auto hoelzl@59000 1181 qed auto hoelzl@59000 1182 hoelzl@64283 1183 lemma AE_ball_countable': hoelzl@64283 1184 "(\N. N \ I \ AE x in M. P N x) \ countable I \ AE x in M. \N \ I. P N x" hoelzl@64283 1185 unfolding AE_ball_countable by simp hoelzl@64283 1186 hoelzl@63959 1187 lemma pairwise_alt: "pairwise R S \ (\x\S. \y\S-{x}. R x y)" hoelzl@63959 1188 by (auto simp add: pairwise_def) hoelzl@63959 1189 hoelzl@63959 1190 lemma AE_pairwise: "countable F \ pairwise (\A B. AE x in M. R x A B) F \ (AE x in M. pairwise (R x) F)" hoelzl@63959 1191 unfolding pairwise_alt by (simp add: AE_ball_countable) hoelzl@63959 1192 hoelzl@57275 1193 lemma AE_discrete_difference: hoelzl@57275 1194 assumes X: "countable X" lp15@61609 1195 assumes null: "\x. x \ X \ emeasure M {x} = 0" hoelzl@57275 1196 assumes sets: "\x. x \ X \ {x} \ sets M" hoelzl@57275 1197 shows "AE x in M. x \ X" hoelzl@57275 1198 proof - hoelzl@57275 1199 have "(\x\X. {x}) \ null_sets M" hoelzl@57275 1200 using assms by (intro null_sets_UN') auto hoelzl@57275 1201 from AE_not_in[OF this] show "AE x in M. x \ X" hoelzl@57275 1202 by auto hoelzl@57275 1203 qed hoelzl@57275 1204 hoelzl@47694 1205 lemma AE_finite_all: hoelzl@47694 1206 assumes f: "finite S" shows "(AE x in M. \i\S. P i x) \ (\i\S. AE x in M. P i x)" hoelzl@47694 1207 using f by induct auto hoelzl@47694 1208 hoelzl@47694 1209 lemma AE_finite_allI: hoelzl@47694 1210 assumes "finite S" hoelzl@47694 1211 shows "(\s. s \ S \ AE x in M. Q s x) \ AE x in M. \s\S. Q s x" wenzelm@61808 1212 using AE_finite_all[OF \finite S\] by auto hoelzl@47694 1213 hoelzl@47694 1214 lemma emeasure_mono_AE: hoelzl@47694 1215 assumes imp: "AE x in M. x \ A \ x \ B" hoelzl@47694 1216 and B: "B \ sets M" hoelzl@47694 1217 shows "emeasure M A \ emeasure M B" hoelzl@47694 1218 proof cases hoelzl@47694 1219 assume A: "A \ sets M" hoelzl@47694 1220 from imp obtain N where N: "{x\space M. \ (x \ A \ x \ B)} \ N" "N \ null_sets M" hoelzl@47694 1221 by (auto simp: eventually_ae_filter) hoelzl@47694 1222 have "emeasure M A = emeasure M (A - N)" hoelzl@47694 1223 using N A by (subst emeasure_Diff_null_set) auto hoelzl@47694 1224 also have "emeasure M (A - N) \ emeasure M (B - N)" immler@50244 1225 using N A B sets.sets_into_space by (auto intro!: emeasure_mono) hoelzl@47694 1226 also have "emeasure M (B - N) = emeasure M B" hoelzl@47694 1227 using N B by (subst emeasure_Diff_null_set) auto hoelzl@47694 1228 finally show ?thesis . hoelzl@62975 1229 qed (simp add: emeasure_notin_sets) hoelzl@47694 1230 hoelzl@47694 1231 lemma emeasure_eq_AE: hoelzl@47694 1232 assumes iff: "AE x in M. x \ A \ x \ B" hoelzl@47694 1233 assumes A: "A \ sets M" and B: "B \ sets M" hoelzl@47694 1234 shows "emeasure M A = emeasure M B" hoelzl@47694 1235 using assms by (safe intro!: antisym emeasure_mono_AE) auto hoelzl@47694 1236 hoelzl@59000 1237 lemma emeasure_Collect_eq_AE: hoelzl@59000 1238 "AE x in M. P x \ Q x \ Measurable.pred M Q \ Measurable.pred M P \ hoelzl@59000 1239 emeasure M {x\space M. P x} = emeasure M {x\space M. Q x}" hoelzl@59000 1240 by (intro emeasure_eq_AE) auto hoelzl@59000 1241 hoelzl@59000 1242 lemma emeasure_eq_0_AE: "AE x in M. \ P x \ emeasure M {x\space M. P x} = 0" hoelzl@59000 1243 using AE_iff_measurable[OF _ refl, of M "\x. \ P x"] hoelzl@59000 1244 by (cases "{x\space M. P x} \ sets M") (simp_all add: emeasure_notin_sets) hoelzl@59000 1245 hoelzl@64283 1246 lemma emeasure_0_AE: hoelzl@64283 1247 assumes "emeasure M (space M) = 0" hoelzl@64283 1248 shows "AE x in M. P x" hoelzl@64283 1249 using eventually_ae_filter assms by blast hoelzl@64283 1250 hoelzl@60715 1251 lemma emeasure_add_AE: hoelzl@60715 1252 assumes [measurable]: "A \ sets M" "B \ sets M" "C \ sets M" hoelzl@60715 1253 assumes 1: "AE x in M. x \ C \ x \ A \ x \ B" hoelzl@60715 1254 assumes 2: "AE x in M. \ (x \ A \ x \ B)" hoelzl@60715 1255 shows "emeasure M C = emeasure M A + emeasure M B" hoelzl@60715 1256 proof - hoelzl@60715 1257 have "emeasure M C = emeasure M (A \ B)" hoelzl@60715 1258 by (rule emeasure_eq_AE) (insert 1, auto) hoelzl@60715 1259 also have "\ = emeasure M A + emeasure M (B - A)" hoelzl@60715 1260 by (subst plus_emeasure) auto hoelzl@60715 1261 also have "emeasure M (B - A) = emeasure M B" hoelzl@60715 1262 by (rule emeasure_eq_AE) (insert 2, auto) hoelzl@60715 1263 finally show ?thesis . hoelzl@60715 1264 qed hoelzl@60715 1265 wenzelm@61808 1266 subsection \\\\-finite Measures\ hoelzl@47694 1267 immler@67962 1268 locale%important sigma_finite_measure = hoelzl@47694 1269 fixes M :: "'a measure" hoelzl@57447 1270 assumes sigma_finite_countable: hoelzl@57447 1271 "\A::'a set set. countable A \ A \ sets M \ (\A) = space M \ (\a\A. emeasure M a \ \)" hoelzl@57447 1272 hoelzl@57447 1273 lemma (in sigma_finite_measure) sigma_finite: hoelzl@57447 1274 obtains A :: "nat \ 'a set" hoelzl@57447 1275 where "range A \ sets M" "(\i. A i) = space M" "\i. emeasure M (A i) \ \" hoelzl@57447 1276 proof - hoelzl@57447 1277 obtain A :: "'a set set" where hoelzl@57447 1278 [simp]: "countable A" and hoelzl@57447 1279 A: "A \ sets M" "(\A) = space M" "\a. a \ A \ emeasure M a \ \" hoelzl@57447 1280 using sigma_finite_countable by metis hoelzl@57447 1281 show thesis hoelzl@57447 1282 proof cases wenzelm@61808 1283 assume "A = {}" with \(\A) = space M\ show thesis hoelzl@57447 1284 by (intro that[of "\_. {}"]) auto hoelzl@57447 1285 next lp15@61609 1286 assume "A \ {}" hoelzl@57447 1287 show thesis hoelzl@57447 1288 proof hoelzl@57447 1289 show "range (from_nat_into A) \ sets M" wenzelm@61808 1290 using \A \ {}\ A by auto hoelzl@57447 1291 have "(\i. from_nat_into A i) = \A" wenzelm@61808 1292 using range_from_nat_into[OF \A \ {}\ \countable A\] by auto hoelzl@57447 1293 with A show "(\i. from_nat_into A i) = space M" hoelzl@57447 1294 by auto wenzelm@61808 1295 qed (intro A from_nat_into \A \ {}\) hoelzl@57447 1296 qed hoelzl@57447 1297 qed hoelzl@47694 1298 hoelzl@47694 1299 lemma (in sigma_finite_measure) sigma_finite_disjoint: hoelzl@47694 1300 obtains A :: "nat \ 'a set" hoelzl@47694 1301 where "range A \ sets M" "(\i. A i) = space M" "\i. emeasure M (A i) \ \" "disjoint_family A" wenzelm@60580 1302 proof - hoelzl@47694 1303 obtain A :: "nat \ 'a set" where hoelzl@47694 1304 range: "range A \ sets M" and hoelzl@47694 1305 space: "(\i. A i) = space M" and hoelzl@47694 1306 measure: "\i. emeasure M (A i) \ \" haftmann@62343 1307 using sigma_finite by blast wenzelm@60580 1308 show thesis wenzelm@60580 1309 proof (rule that[of "disjointed A"]) wenzelm@60580 1310 show "range (disjointed A) \ sets M" wenzelm@60580 1311 by (rule sets.range_disjointed_sets[OF range]) wenzelm@60580 1312 show "(\i. disjointed A i) = space M" wenzelm@60580 1313 and "disjoint_family (disjointed A)" wenzelm@60580 1314 using disjoint_family_disjointed UN_disjointed_eq[of A] space range wenzelm@60580 1315 by auto wenzelm@60580 1316 show "emeasure M (disjointed A i) \ \" for i wenzelm@60580 1317 proof - wenzelm@60580 1318 have "emeasure M (disjointed A i) \ emeasure M (A i)" wenzelm@60580 1319 using range disjointed_subset[of A i] by (auto intro!: emeasure_mono) hoelzl@62975 1320 then show ?thesis using measure[of i] by (auto simp: top_unique) wenzelm@60580 1321 qed wenzelm@60580 1322 qed hoelzl@47694 1323 qed hoelzl@47694 1324 hoelzl@47694 1325 lemma (in sigma_finite_measure) sigma_finite_incseq: hoelzl@47694 1326 obtains A :: "nat \ 'a set" hoelzl@47694 1327 where "range A \ sets M" "(\i. A i) = space M" "\i. emeasure M (A i) \ \" "incseq A" wenzelm@60580 1328 proof - hoelzl@47694 1329 obtain F :: "nat \ 'a set" where hoelzl@47694 1330 F: "range F \ sets M" "(\i. F i) = space M" "\i. emeasure M (F i) \ \" haftmann@62343 1331 using sigma_finite by blast wenzelm@60580 1332 show thesis wenzelm@60580 1333 proof (rule that[of "\n. \i\n. F i"]) wenzelm@60580 1334 show "range (\n. \i\n. F i) \ sets M" wenzelm@60580 1335 using F by (force simp: incseq_def) wenzelm@60580 1336 show "(\n. \i\n. F i) = space M" wenzelm@60580 1337 proof - wenzelm@60580 1338 from F have "\x. x \ space M \ \i. x \ F i" by auto wenzelm@60580 1339 with F show ?thesis by fastforce wenzelm@60580 1340 qed wenzelm@60585 1341 show "emeasure M (\i\n. F i) \ \" for n wenzelm@60580 1342 proof - wenzelm@60585 1343 have "emeasure M (\i\n. F i) \ (\i\n. emeasure M (F i))" wenzelm@60580 1344 using F by (auto intro!: emeasure_subadditive_finite) wenzelm@60580 1345 also have "\ < \" nipkow@64267 1346 using F by (auto simp: sum_Pinfty less_top) wenzelm@60580 1347 finally show ?thesis by simp wenzelm@60580 1348 qed wenzelm@60580 1349 show "incseq (\n. \i\n. F i)" wenzelm@60580 1350 by (force simp: incseq_def) wenzelm@60580 1351 qed hoelzl@47694 1352 qed hoelzl@47694 1353 hoelzl@64283 1354 lemma (in sigma_finite_measure) approx_PInf_emeasure_with_finite: hoelzl@64283 1355 fixes C::real hoelzl@64283 1356 assumes W_meas: "W \ sets M" hoelzl@64283 1357 and W_inf: "emeasure M W = \" hoelzl@64283 1358 obtains Z where "Z \ sets M" "Z \ W" "emeasure M Z < \" "emeasure M Z > C" hoelzl@64283 1359 proof - hoelzl@64283 1360 obtain A :: "nat \ 'a set" hoelzl@64283 1361 where A: "range A \ sets M" "(\i. A i) = space M" "\i. emeasure M (A i) \ \" "incseq A" hoelzl@64283 1362 using sigma_finite_incseq by blast hoelzl@64283 1363 define B where "B = (\i. W \ A i)" wenzelm@64911 1364 have B_meas: "\i. B i \ sets M" using W_meas \range A \ sets M\ B_def by blast hoelzl@64283 1365 have b: "\i. B i \ W" using B_def by blast hoelzl@64283 1366 hoelzl@64283 1367 { fix i hoelzl@64283 1368 have "emeasure M (B i) \ emeasure M (A i)" hoelzl@64283 1369 using A by (intro emeasure_mono) (auto simp: B_def) hoelzl@64283 1370 also have "emeasure M (A i) < \" wenzelm@64911 1371 using \\i. emeasure M (A i) \ \\ by (simp add: less_top) hoelzl@64283 1372 finally have "emeasure M (B i) < \" . } hoelzl@64283 1373 note c = this hoelzl@64283 1374 wenzelm@64911 1375 have "W = (\i. B i)" using B_def \(\i. A i) = space M\ W_meas by auto wenzelm@64911 1376 moreover have "incseq B" using B_def \incseq A\ by (simp add: incseq_def subset_eq) hoelzl@64283 1377 ultimately have "(\i. emeasure M (B i)) \ emeasure M W" using W_meas B_meas hoelzl@64283 1378 by (simp add: B_meas Lim_emeasure_incseq image_subset_iff) hoelzl@64283 1379 then have "(\i. emeasure M (B i)) \ \" using W_inf by simp hoelzl@64283 1380 from order_tendstoD(1)[OF this, of C] hoelzl@64283 1381 obtain i where d: "emeasure M (B i) > C" hoelzl@64283 1382 by (auto simp: eventually_sequentially) hoelzl@64283 1383 have "B i \ sets M" "B i \ W" "emeasure M (B i) < \" "emeasure M (B i) > C" hoelzl@64283 1384 using B_meas b c d by auto hoelzl@64283 1385 then show ?thesis using that by blast hoelzl@64283 1386 qed hoelzl@64283 1387 wenzelm@61808 1388 subsection \Measure space induced by distribution of @{const measurable}-functions\ hoelzl@47694 1389 immler@67962 1390 definition%important distr :: "'a measure \ 'b measure \ ('a \ 'b) \ 'b measure" where hoelzl@47694 1391 "distr M N f = measure_of (space N) (sets N) (\A. emeasure M (f -` A \ space M))" hoelzl@47694 1392 hoelzl@47694 1393 lemma hoelzl@59048 1394 shows sets_distr[simp, measurable_cong]: "sets (distr M N f) = sets N" hoelzl@47694 1395 and space_distr[simp]: "space (distr M N f) = space N" hoelzl@47694 1396 by (auto simp: distr_def) hoelzl@47694 1397 hoelzl@47694 1398 lemma hoelzl@47694 1399 shows measurable_distr_eq1[simp]: "measurable (distr Mf Nf f) Mf' = measurable Nf Mf'" hoelzl@47694 1400 and measurable_distr_eq2[simp]: "measurable Mg' (distr Mg Ng g) = measurable Mg' Ng" hoelzl@47694 1401 by (auto simp: measurable_def) hoelzl@47694 1402 hoelzl@54417 1403 lemma distr_cong: hoelzl@54417 1404 "M = K \ sets N = sets L \ (\x. x \ space M \ f x = g x) \ distr M N f = distr K L g" hoelzl@54417 1405 using sets_eq_imp_space_eq[of N L] by (simp add: distr_def Int_def cong: rev_conj_cong) hoelzl@54417 1406 hoelzl@47694 1407 lemma emeasure_distr: hoelzl@47694 1408 fixes f :: "'a \ 'b" hoelzl@47694 1409 assumes f: "f \ measurable M N" and A: "A \ sets N" hoelzl@47694 1410 shows "emeasure (distr M N f) A = emeasure M (f -` A \ space M)" (is "_ = ?\ A") hoelzl@47694 1411 unfolding distr_def hoelzl@47694 1412 proof (rule emeasure_measure_of_sigma) hoelzl@47694 1413 show "positive (sets N) ?\" hoelzl@47694 1414 by (auto simp: positive_def) hoelzl@47694 1415 hoelzl@47694 1416 show "countably_additive (sets N) ?\" hoelzl@47694 1417 proof (intro countably_additiveI) hoelzl@47694 1418 fix A :: "nat \ 'b set" assume "range A \ sets N" "disjoint_family A" hoelzl@47694 1419 then have A: "\i. A i \ sets N" "(\i. A i) \ sets N" by auto hoelzl@47694 1420 then have *: "range (\i. f -` (A i) \ space M) \ sets M" hoelzl@47694 1421 using f by (auto simp: measurable_def) hoelzl@47694 1422 moreover have "(\i. f -` A i \ space M) \ sets M" hoelzl@47694 1423 using * by blast hoelzl@47694 1424 moreover have **: "disjoint_family (\i. f -` A i \ space M)" wenzelm@61808 1425 using \disjoint_family A\ by (auto simp: disjoint_family_on_def) hoelzl@47694 1426 ultimately show "(\i. ?\ (A i)) = ?\ (\i. A i)" hoelzl@47694 1427 using suminf_emeasure[OF _ **] A f hoelzl@47694 1428 by (auto simp: comp_def vimage_UN) hoelzl@47694 1429 qed hoelzl@47694 1430 show "sigma_algebra (space N) (sets N)" .. hoelzl@47694 1431 qed fact hoelzl@47694 1432 hoelzl@59000 1433 lemma emeasure_Collect_distr: hoelzl@59000 1434 assumes X[measurable]: "X \ measurable M N" "Measurable.pred N P" hoelzl@59000 1435 shows "emeasure (distr M N X) {x\space N. P x} = emeasure M {x\space M. P (X x)}" hoelzl@59000 1436 by (subst emeasure_distr) hoelzl@59000 1437 (auto intro!: arg_cong2[where f=emeasure] X(1)[THEN measurable_space]) hoelzl@59000 1438 hoelzl@59000 1439 lemma emeasure_lfp2[consumes 1, case_names cont f measurable]: hoelzl@59000 1440 assumes "P M" hoelzl@60172 1441 assumes cont: "sup_continuous F" hoelzl@59000 1442 assumes f: "\M. P M \ f \ measurable M' M" hoelzl@59000 1443 assumes *: "\M A. P M \ (\N. P N \ Measurable.pred N A) \ Measurable.pred M (F A)" hoelzl@59000 1444 shows "emeasure M' {x\space M'. lfp F (f x)} = (SUP i. emeasure M' {x\space M'. (F ^^ i) (\x. False) (f x)})" hoelzl@59000 1445 proof (subst (1 2) emeasure_Collect_distr[symmetric, where X=f]) hoelzl@59000 1446 show "f \ measurable M' M" "f \ measurable M' M" wenzelm@61808 1447 using f[OF \P M\] by auto hoelzl@59000 1448 { fix i show "Measurable.pred M ((F ^^ i) (\x. False))" wenzelm@61808 1449 using \P M\ by (induction i arbitrary: M) (auto intro!: *) } hoelzl@59000 1450 show "Measurable.pred M (lfp F)" wenzelm@61808 1451 using \P M\ cont * by (rule measurable_lfp_coinduct[of P]) hoelzl@59000 1452 hoelzl@59000 1453 have "emeasure (distr M' M f) {x \ space (distr M' M f). lfp F x} = hoelzl@59000 1454 (SUP i. emeasure (distr M' M f) {x \ space (distr M' M f). (F ^^ i) (\x. False) x})" wenzelm@61808 1455 using \P M\ hoelzl@60636 1456 proof (coinduction arbitrary: M rule: emeasure_lfp') hoelzl@59000 1457 case (measurable A N) then have "\N. P N \ Measurable.pred (distr M' N f) A" hoelzl@59000 1458 by metis hoelzl@59000 1459 then have "\N. P N \ Measurable.pred N A" hoelzl@59000 1460 by simp wenzelm@61808 1461 with \P N\[THEN *] show ?case hoelzl@59000 1462 by auto hoelzl@59000 1463 qed fact hoelzl@59000 1464 then show "emeasure (distr M' M f) {x \ space M. lfp F x} = hoelzl@59000 1465 (SUP i. emeasure (distr M' M f) {x \ space M. (F ^^ i) (\x. False) x})" hoelzl@59000 1466 by simp hoelzl@59000 1467 qed hoelzl@59000 1468 hoelzl@50104 1469 lemma distr_id[simp]: "distr N N (\x. x) = N" hoelzl@50104 1470 by (rule measure_eqI) (auto simp: emeasure_distr) hoelzl@50104 1471 hoelzl@64320 1472 lemma distr_id2: "sets M = sets N \ distr N M (\x. x) = N" hoelzl@64320 1473 by (rule measure_eqI) (auto simp: emeasure_distr) hoelzl@64320 1474 hoelzl@50001 1475 lemma measure_distr: hoelzl@50001 1476 "f \ measurable M N \ S \ sets N \ measure (distr M N f) S = measure M (f -` S \ space M)" hoelzl@50001 1477 by (simp add: emeasure_distr measure_def) hoelzl@50001 1478 hoelzl@57447 1479 lemma distr_cong_AE: lp15@61609 1480 assumes 1: "M = K" "sets N = sets L" and hoelzl@57447 1481 2: "(AE x in M. f x = g x)" and "f \ measurable M N" and "g \ measurable K L" hoelzl@57447 1482 shows "distr M N f = distr K L g" hoelzl@57447 1483 proof (rule measure_eqI) hoelzl@57447 1484 fix A assume "A \ sets (distr M N f)" hoelzl@57447 1485 with assms show "emeasure (distr M N f) A = emeasure (distr K L g) A" hoelzl@57447 1486 by (auto simp add: emeasure_distr intro!: emeasure_eq_AE measurable_sets) hoelzl@57447 1487 qed (insert 1, simp) hoelzl@57447 1488 hoelzl@47694 1489 lemma AE_distrD: hoelzl@47694 1490 assumes f: "f \ measurable M M'" hoelzl@47694 1491 and AE: "AE x in distr M M' f. P x" hoelzl@47694 1492 shows "AE x in M. P (f x)" hoelzl@47694 1493 proof - hoelzl@47694 1494 from AE[THEN AE_E] guess N . hoelzl@47694 1495 with f show ?thesis hoelzl@47694 1496 unfolding eventually_ae_filter hoelzl@47694 1497 by (intro bexI[of _ "f -` N \ space M"]) hoelzl@47694 1498 (auto simp: emeasure_distr measurable_def) hoelzl@47694 1499 qed hoelzl@47694 1500 hoelzl@49773 1501 lemma AE_distr_iff: hoelzl@50002 1502 assumes f[measurable]: "f \ measurable M N" and P[measurable]: "{x \ space N. P x} \ sets N" hoelzl@49773 1503 shows "(AE x in distr M N f. P x) \ (AE x in M. P (f x))" hoelzl@49773 1504 proof (subst (1 2) AE_iff_measurable[OF _ refl]) hoelzl@50002 1505 have "f -` {x\space N. \ P x} \ space M = {x \ space M. \ P (f x)}" hoelzl@50002 1506 using f[THEN measurable_space] by auto hoelzl@50002 1507 then show "(emeasure (distr M N f) {x \ space (distr M N f). \ P x} = 0) = hoelzl@49773 1508 (emeasure M {x \ space M. \ P (f x)} = 0)" hoelzl@50002 1509 by (simp add: emeasure_distr) hoelzl@50002 1510 qed auto hoelzl@49773 1511 hoelzl@47694 1512 lemma null_sets_distr_iff: hoelzl@47694 1513 "f \ measurable M N \ A \ null_sets (distr M N f) \ f -` A \ space M \ null_sets M \ A \ sets N" hoelzl@50002 1514 by (auto simp add: null_sets_def emeasure_distr) hoelzl@47694 1515 immler@68607 1516 proposition distr_distr: hoelzl@50002 1517 "g \ measurable N L \ f \ measurable M N \ distr (distr M N f) L g = distr M L (g \ f)" hoelzl@50002 1518 by (auto simp add: emeasure_distr measurable_space hoelzl@47694 1519 intro!: arg_cong[where f="emeasure M"] measure_eqI) hoelzl@47694 1520 immler@67962 1521 subsection%unimportant \Real measure values\ hoelzl@47694 1522 hoelzl@62975 1523 lemma ring_of_finite_sets: "ring_of_sets (space M) {A\sets M. emeasure M A \ top}" hoelzl@62975 1524 proof (rule ring_of_setsI) hoelzl@62975 1525 show "a \ {A \ sets M. emeasure M A \ top} \ b \ {A \ sets M. emeasure M A \ top} \ hoelzl@62975 1526 a \ b \ {A \ sets M. emeasure M A \ top}" for a b hoelzl@62975 1527 using emeasure_subadditive[of a M b] by (auto simp: top_unique) hoelzl@62975 1528 hoelzl@62975 1529 show "a \ {A \ sets M. emeasure M A \ top} \ b \ {A \ sets M. emeasure M A \ top} \ hoelzl@62975 1530 a - b \ {A \ sets M. emeasure M A \ top}" for a b hoelzl@62975 1531 using emeasure_mono[of "a - b" a M] by (auto simp: Diff_subset top_unique) hoelzl@62975 1532 qed (auto dest: sets.sets_into_space) hoelzl@62975 1533 hoelzl@62975 1534 lemma measure_nonneg[simp]: "0 \ measure M A" hoelzl@63333 1535 unfolding measure_def by auto hoelzl@47694 1536 lp15@67982 1537 lemma measure_nonneg' [simp]: "\ measure M A < 0" lp15@67982 1538 using measure_nonneg not_le by blast lp15@67982 1539 hoelzl@61880 1540 lemma zero_less_measure_iff: "0 < measure M A \ measure M A \ 0" hoelzl@61880 1541 using measure_nonneg[of M A] by (auto simp add: le_less) hoelzl@61880 1542 hoelzl@59000 1543 lemma measure_le_0_iff: "measure M X \ 0 \ measure M X = 0" hoelzl@62975 1544 using measure_nonneg[of M X] by linarith hoelzl@59000 1545 hoelzl@47694 1546 lemma measure_empty[simp]: "measure M {} = 0" hoelzl@62975 1547 unfolding measure_def by (simp add: zero_ennreal.rep_eq) hoelzl@62975 1548 hoelzl@62975 1549 lemma emeasure_eq_ennreal_measure: hoelzl@62975 1550 "emeasure M A \ top \ emeasure M A = ennreal (measure M A)" hoelzl@62975 1551 by (cases "emeasure M A" rule: ennreal_cases) (auto simp: measure_def) hoelzl@47694 1552 hoelzl@62975 1553 lemma measure_zero_top: "emeasure M A = top \ measure M A = 0" hoelzl@62975 1554 by (simp add: measure_def enn2ereal_top) hoelzl@47694 1555 hoelzl@62975 1556 lemma measure_eq_emeasure_eq_ennreal: "0 \ x \ emeasure M A = ennreal x \ measure M A = x" hoelzl@62975 1557 using emeasure_eq_ennreal_measure[of M A] hoelzl@62975 1558 by (cases "A \ M") (auto simp: measure_notin_sets emeasure_notin_sets) hoelzl@62975 1559 hoelzl@62975 1560 lemma enn2real_plus:"a < top \ b < top \ enn2real (a + b) = enn2real a + enn2real b" hoelzl@63333 1561 by (simp add: enn2real_def plus_ennreal.rep_eq real_of_ereal_add less_top hoelzl@62975 1562 del: real_of_ereal_enn2ereal) Andreas@61633 1563 hoelzl@63959 1564 lemma measure_eq_AE: hoelzl@63959 1565 assumes iff: "AE x in M. x \ A \ x \ B" hoelzl@63959 1566 assumes A: "A \ sets M" and B: "B \ sets M" hoelzl@63959 1567 shows "measure M A = measure M B" hoelzl@63959 1568 using assms emeasure_eq_AE[OF assms] by (simp add: measure_def) hoelzl@63959 1569 hoelzl@47694 1570 lemma measure_Union: hoelzl@62975 1571 "emeasure M A \ \ \ emeasure M B \ \ \ A \ sets M \ B \ sets M \ A \ B = {} \ hoelzl@62975 1572 measure M (A \ B) = measure M A + measure M B" hoelzl@63333 1573 by (simp add: measure_def plus_emeasure[symmetric] enn2real_plus less_top) hoelzl@62975 1574 hoelzl@62975 1575 lemma disjoint_family_on_insert: hoelzl@62975 1576 "i \ I \ disjoint_family_on A (insert i I) \ A i \ (\i\I. A i) = {} \ disjoint_family_on A I" hoelzl@62975 1577 by (fastforce simp: disjoint_family_on_def) hoelzl@47694 1578 hoelzl@47694 1579 lemma measure_finite_Union: hoelzl@62975 1580 "finite S \ A`S \ sets M \ disjoint_family_on A S \ (\i. i \ S \ emeasure M (A i) \ \) \ hoelzl@62975 1581 measure M (\i\S. A i) = (\i\S. measure M (A i))" hoelzl@62975 1582 by (induction S rule: finite_induct) nipkow@64267 1583 (auto simp: disjoint_family_on_insert measure_Union sum_emeasure[symmetric] sets.countable_UN'[OF countable_finite]) hoelzl@47694 1584 hoelzl@47694 1585 lemma measure_Diff: hoelzl@47694 1586 assumes finite: "emeasure M A \ \" hoelzl@47694 1587 and measurable: "A \ sets M" "B \ sets M" "B \ A" hoelzl@47694 1588 shows "measure M (A - B) = measure M A - measure M B" hoelzl@47694 1589 proof - hoelzl@47694 1590 have "emeasure M (A - B) \ emeasure M A" "emeasure M B \ emeasure M A" hoelzl@47694 1591 using measurable by (auto intro!: emeasure_mono) hoelzl@47694 1592 hence "measure M ((A - B) \ B) = measure M (A - B) + measure M B" hoelzl@62975 1593 using measurable finite by (rule_tac measure_Union) (auto simp: top_unique) wenzelm@61808 1594 thus ?thesis using \B \ A\ by (auto simp: Un_absorb2) hoelzl@47694 1595 qed hoelzl@47694 1596 hoelzl@47694 1597 lemma measure_UNION: hoelzl@47694 1598 assumes measurable: "range A \ sets M" "disjoint_family A" hoelzl@47694 1599 assumes finite: "emeasure M (\i. A i) \ \" hoelzl@47694 1600 shows "(\i. measure M (A i)) sums (measure M (\i. A i))" hoelzl@47694 1601 proof - hoelzl@62975 1602 have "(\i. emeasure M (A i)) sums (emeasure M (\i. A i))" hoelzl@62975 1603 unfolding suminf_emeasure[OF measurable, symmetric] by (simp add: summable_sums) hoelzl@47694 1604 moreover hoelzl@47694 1605 { fix i hoelzl@47694 1606 have "emeasure M (A i) \ emeasure M (\i. A i)" hoelzl@47694 1607 using measurable by (auto intro!: emeasure_mono) hoelzl@62975 1608 then have "emeasure M (A i) = ennreal ((measure M (A i)))" hoelzl@62975 1609 using finite by (intro emeasure_eq_ennreal_measure) (auto simp: top_unique) } hoelzl@47694 1610 ultimately show ?thesis using finite hoelzl@63333 1611 by (subst (asm) (2) emeasure_eq_ennreal_measure) simp_all hoelzl@47694 1612 qed hoelzl@47694 1613 hoelzl@47694 1614 lemma measure_subadditive: hoelzl@47694 1615 assumes measurable: "A \ sets M" "B \ sets M" hoelzl@47694 1616 and fin: "emeasure M A \ \" "emeasure M B \ \" hoelzl@62975 1617 shows "measure M (A \ B) \ measure M A + measure M B" hoelzl@47694 1618 proof - hoelzl@47694 1619 have "emeasure M (A \ B) \ \" hoelzl@62975 1620 using emeasure_subadditive[OF measurable] fin by (auto simp: top_unique) hoelzl@47694 1621 then show "(measure M (A \ B)) \ (measure M A) + (measure M B)" hoelzl@47694 1622 using emeasure_subadditive[OF measurable] fin hoelzl@62975 1623 apply simp hoelzl@62975 1624 apply (subst (asm) (2 3 4) emeasure_eq_ennreal_measure) nipkow@68403 1625 apply (auto simp flip: ennreal_plus) hoelzl@62975 1626 done hoelzl@47694 1627 qed hoelzl@47694 1628 hoelzl@47694 1629 lemma measure_subadditive_finite: hoelzl@47694 1630 assumes A: "finite I" "A`I \ sets M" and fin: "\i. i \ I \ emeasure M (A i) \ \" hoelzl@47694 1631 shows "measure M (\i\I. A i) \ (\i\I. measure M (A i))" hoelzl@47694 1632 proof - hoelzl@47694 1633 { have "emeasure M (\i\I. A i) \ (\i\I. emeasure M (A i))" hoelzl@47694 1634 using emeasure_subadditive_finite[OF A] . hoelzl@47694 1635 also have "\ < \" hoelzl@62975 1636 using fin by (simp add: less_top A) hoelzl@62975 1637 finally have "emeasure M (\i\I. A i) \ top" by simp } hoelzl@62975 1638 note * = this hoelzl@62975 1639 show ?thesis hoelzl@47694 1640 using emeasure_subadditive_finite[OF A] fin hoelzl@62975 1641 unfolding emeasure_eq_ennreal_measure[OF *] nipkow@64267 1642 by (simp_all add: sum_nonneg emeasure_eq_ennreal_measure) hoelzl@47694 1643 qed hoelzl@47694 1644 hoelzl@47694 1645 lemma measure_subadditive_countably: hoelzl@47694 1646 assumes A: "range A \ sets M" and fin: "(\i. emeasure M (A i)) \ \" hoelzl@47694 1647 shows "measure M (\i. A i) \ (\i. measure M (A i))" hoelzl@47694 1648 proof - hoelzl@62975 1649 from fin have **: "\i. emeasure M (A i) \ top" hoelzl@62975 1650 using ennreal_suminf_lessD[of "\i. emeasure M (A i)"] by (simp add: less_top) hoelzl@47694 1651 { have "emeasure M (\i. A i) \ (\i. emeasure M (A i))" hoelzl@47694 1652 using emeasure_subadditive_countably[OF A] . hoelzl@47694 1653 also have "\ < \" hoelzl@62975 1654 using fin by (simp add: less_top) hoelzl@62975 1655 finally have "emeasure M (\i. A i) \ top" by simp } hoelzl@62975 1656 then have "ennreal (measure M (\i. A i)) = emeasure M (\i. A i)" hoelzl@62975 1657 by (rule emeasure_eq_ennreal_measure[symmetric]) hoelzl@62975 1658 also have "\ \ (\i. emeasure M (A i))" hoelzl@62975 1659 using emeasure_subadditive_countably[OF A] . hoelzl@62975 1660 also have "\ = ennreal (\i. measure M (A i))" hoelzl@62975 1661 using fin unfolding emeasure_eq_ennreal_measure[OF **] hoelzl@62975 1662 by (subst suminf_ennreal) (auto simp: **) hoelzl@62975 1663 finally show ?thesis hoelzl@62975 1664 apply (rule ennreal_le_iff[THEN iffD1, rotated]) hoelzl@62975 1665 apply (intro suminf_nonneg allI measure_nonneg summable_suminf_not_top) hoelzl@62975 1666 using fin hoelzl@62975 1667 apply (simp add: emeasure_eq_ennreal_measure[OF **]) hoelzl@62975 1668 done hoelzl@47694 1669 qed hoelzl@47694 1670 hoelzl@63959 1671 lemma measure_Un_null_set: "A \ sets M \ B \ null_sets M \ measure M (A \ B) = measure M A" hoelzl@63959 1672 by (simp add: measure_def emeasure_Un_null_set) hoelzl@63959 1673 hoelzl@63959 1674 lemma measure_Diff_null_set: "A \ sets M \ B \ null_sets M \ measure M (A - B) = measure M A" hoelzl@63959 1675 by (simp add: measure_def emeasure_Diff_null_set) hoelzl@63959 1676 nipkow@64267 1677 lemma measure_eq_sum_singleton: hoelzl@62975 1678 "finite S \ (\x. x \ S \ {x} \ sets M) \ (\x. x \ S \ emeasure M {x} \ \) \ hoelzl@62975 1679 measure M S = (\x\S. measure M {x})" nipkow@64267 1680 using emeasure_eq_sum_singleton[of S M] nipkow@64267 1681 by (intro measure_eq_emeasure_eq_ennreal) (auto simp: sum_nonneg emeasure_eq_ennreal_measure) hoelzl@47694 1682 hoelzl@47694 1683 lemma Lim_measure_incseq: hoelzl@47694 1684 assumes A: "range A \ sets M" "incseq A" and fin: "emeasure M (\i. A i) \ \" hoelzl@62975 1685 shows "(\i. measure M (A i)) \ measure M (\i. A i)" hoelzl@62975 1686 proof (rule tendsto_ennrealD) hoelzl@62975 1687 have "ennreal (measure M (\i. A i)) = emeasure M (\i. A i)" hoelzl@62975 1688 using fin by (auto simp: emeasure_eq_ennreal_measure) hoelzl@62975 1689 moreover have "ennreal (measure M (A i)) = emeasure M (A i)" for i hoelzl@62975 1690 using assms emeasure_mono[of "A _" "\i. A i" M] hoelzl@62975 1691 by (intro emeasure_eq_ennreal_measure[symmetric]) (auto simp: less_top UN_upper intro: le_less_trans) lp15@67982 1692 ultimately show "(\x. ennreal (measure M (A x))) \ ennreal (measure M (\i. A i))" hoelzl@62975 1693 using A by (auto intro!: Lim_emeasure_incseq) hoelzl@62975 1694 qed auto hoelzl@47694 1695 hoelzl@47694 1696 lemma Lim_measure_decseq: hoelzl@47694 1697 assumes A: "range A \ sets M" "decseq A" and fin: "\i. emeasure M (A i) \ \" wenzelm@61969 1698 shows "(\n. measure M (A n)) \ measure M (\i. A i)" hoelzl@62975 1699 proof (rule tendsto_ennrealD) hoelzl@62975 1700 have "ennreal (measure M (\i. A i)) = emeasure M (\i. A i)" hoelzl@62975 1701 using fin[of 0] A emeasure_mono[of "\i. A i" "A 0" M] hoelzl@62975 1702 by (auto intro!: emeasure_eq_ennreal_measure[symmetric] simp: INT_lower less_top intro: le_less_trans) hoelzl@62975 1703 moreover have "ennreal (measure M (A i)) = emeasure M (A i)" for i hoelzl@62975 1704 using A fin[of i] by (intro emeasure_eq_ennreal_measure[symmetric]) auto lp15@67982 1705 ultimately show "(\x. ennreal (measure M (A x))) \ ennreal (measure M (\i. A i))" hoelzl@62975 1706 using fin A by (auto intro!: Lim_emeasure_decseq) hoelzl@62975 1707 qed auto hoelzl@47694 1708 hoelzl@63958 1709 subsection \Set of measurable sets with finite measure\ hoelzl@63958 1710 immler@67962 1711 definition%important fmeasurable :: "'a measure \ 'a set set" hoelzl@63958 1712 where hoelzl@63958 1713 "fmeasurable M = {A\sets M. emeasure M A < \}" hoelzl@63958 1714 hoelzl@63958 1715 lemma fmeasurableD[dest, measurable_dest]: "A \ fmeasurable M \ A \ sets M" hoelzl@63958 1716 by (auto simp: fmeasurable_def) hoelzl@63958 1717 hoelzl@63959 1718 lemma fmeasurableD2: "A \ fmeasurable M \ emeasure M A \ top" hoelzl@63959 1719 by (auto simp: fmeasurable_def) hoelzl@63959 1720 hoelzl@63958 1721 lemma fmeasurableI: "A \ sets M \ emeasure M A < \ \ A \ fmeasurable M" hoelzl@63958 1722 by (auto simp: fmeasurable_def) hoelzl@63958 1723 hoelzl@63958 1724 lemma fmeasurableI_null_sets: "A \ null_sets M \ A \ fmeasurable M" hoelzl@63958 1725 by (auto simp: fmeasurable_def) hoelzl@63958 1726 hoelzl@63958 1727 lemma fmeasurableI2: "A \ fmeasurable M \ B \ A \ B \ sets M \ B \ fmeasurable M" hoelzl@63958 1728 using emeasure_mono[of B A M] by (auto simp: fmeasurable_def) hoelzl@63958 1729 hoelzl@63958 1730 lemma measure_mono_fmeasurable: hoelzl@63958 1731 "A \ B \ A \ sets M \ B \ fmeasurable M \ measure M A \ measure M B" hoelzl@63958 1732 by (auto simp: measure_def fmeasurable_def intro!: emeasure_mono enn2real_mono) hoelzl@63958 1733 hoelzl@63958 1734 lemma emeasure_eq_measure2: "A \ fmeasurable M \ emeasure M A = measure M A" hoelzl@63958 1735 by (simp add: emeasure_eq_ennreal_measure fmeasurable_def less_top) hoelzl@63958 1736 hoelzl@63958 1737 interpretation fmeasurable: ring_of_sets "space M" "fmeasurable M" hoelzl@63958 1738 proof (rule ring_of_setsI) hoelzl@63958 1739 show "fmeasurable M \ Pow (space M)" "{} \ fmeasurable M" hoelzl@63958 1740 by (auto simp: fmeasurable_def dest: sets.sets_into_space) hoelzl@63958 1741 fix a b assume *: "a \ fmeasurable M" "b \ fmeasurable M" hoelzl@63958 1742 then have "emeasure M (a \ b) \ emeasure M a + emeasure M b" hoelzl@63958 1743 by (intro emeasure_subadditive) auto hoelzl@63958 1744 also have "\ < top" hoelzl@63958 1745 using * by (auto simp: fmeasurable_def) hoelzl@63958 1746 finally show "a \ b \ fmeasurable M" hoelzl@63958 1747 using * by (auto intro: fmeasurableI) hoelzl@63958 1748 show "a - b \ fmeasurable M" hoelzl@63958 1749 using emeasure_mono[of "a - b" a M] * by (auto simp: fmeasurable_def Diff_subset) hoelzl@63958 1750 qed hoelzl@63958 1751 lp15@67989 1752 subsection\Measurable sets formed by unions and intersections\ lp15@67989 1753 hoelzl@63958 1754 lemma fmeasurable_Diff: "A \ fmeasurable M \ B \ sets M \ A - B \ fmeasurable M" hoelzl@63958 1755 using fmeasurableI2[of A M "A - B"] by auto hoelzl@63958 1756 lp15@67673 1757 lemma fmeasurable_Int_fmeasurable: lp15@67673 1758 "\S \ fmeasurable M; T \ sets M\ \ (S \ T) \ fmeasurable M" lp15@67673 1759 by (meson fmeasurableD fmeasurableI2 inf_le1 sets.Int) lp15@67673 1760 hoelzl@63958 1761 lemma fmeasurable_UN: hoelzl@63958 1762 assumes "countable I" "\i. i \ I \ F i \ A" "\i. i \ I \ F i \ sets M" "A \ fmeasurable M" hoelzl@63958 1763 shows "(\i\I. F i) \ fmeasurable M" hoelzl@63958 1764 proof (rule fmeasurableI2) hoelzl@63958 1765 show "A \ fmeasurable M" "(\i\I. F i) \ A" using assms by auto hoelzl@63958 1766 show "(\i\I. F i) \ sets M" hoelzl@63958 1767 using assms by (intro sets.countable_UN') auto hoelzl@63958 1768 qed hoelzl@63958 1769 hoelzl@63958 1770 lemma fmeasurable_INT: hoelzl@63958 1771 assumes "countable I" "i \ I" "\i. i \ I \ F i \ sets M" "F i \ fmeasurable M" hoelzl@63958 1772 shows "(\i\I. F i) \ fmeasurable M" hoelzl@63958 1773 proof (rule fmeasurableI2) hoelzl@63958 1774 show "F i \ fmeasurable M" "(\i\I. F i) \ F i" hoelzl@63958 1775 using assms by auto hoelzl@63958 1776 show "(\i\I. F i) \ sets M" hoelzl@63958 1777 using assms by (intro sets.countable_INT') auto hoelzl@63958 1778 qed hoelzl@63958 1779 lp15@67982 1780 lemma measurable_measure_Diff: lp15@67982 1781 assumes "A \ fmeasurable M" "B \ sets M" "B \ A" lp15@67982 1782 shows "measure M (A - B) = measure M A - measure M B" lp15@67982 1783 by (simp add: assms fmeasurableD fmeasurableD2 measure_Diff) lp15@67982 1784 lp15@67982 1785 lemma measurable_Un_null_set: lp15@67982 1786 assumes "B \ null_sets M" lp15@67982 1787 shows "(A \ B \ fmeasurable M \ A \ sets M) \ A \ fmeasurable M" lp15@67982 1788 using assms by (fastforce simp add: fmeasurable.Un fmeasurableI_null_sets intro: fmeasurableI2) lp15@67982 1789 lp15@67982 1790 lemma measurable_Diff_null_set: lp15@67982 1791 assumes "B \ null_sets M" lp15@67982 1792 shows "(A - B) \ fmeasurable M \ A \ sets M \ A \ fmeasurable M" lp15@67982 1793 using assms lp15@67982 1794 by (metis Un_Diff_cancel2 fmeasurable.Diff fmeasurableD fmeasurableI_null_sets measurable_Un_null_set) lp15@67982 1795 lp15@67982 1796 lemma fmeasurable_Diff_D: lp15@67982 1797 assumes m: "T - S \ fmeasurable M" "S \ fmeasurable M" and sub: "S \ T" lp15@67982 1798 shows "T \ fmeasurable M" lp15@67982 1799 proof - lp15@67982 1800 have "T = S \ (T - S)" lp15@67982 1801 using assms by blast lp15@67982 1802 then show ?thesis lp15@67982 1803 by (metis m fmeasurable.Un) lp15@67982 1804 qed lp15@67982 1805 hoelzl@63959 1806 lemma measure_Un2: hoelzl@63959 1807 "A \ fmeasurable M \ B \ fmeasurable M \ measure M (A \ B) = measure M A + measure M (B - A)" hoelzl@63959 1808 using measure_Union[of M A "B - A"] by (auto simp: fmeasurableD2 fmeasurable.Diff) hoelzl@63959 1809 hoelzl@63959 1810 lemma measure_Un3: hoelzl@63959 1811 assumes "A \ fmeasurable M" "B \ fmeasurable M" hoelzl@63959 1812 shows "measure M (A \ B) = measure M A + measure M B - measure M (A \ B)" hoelzl@63959 1813 proof - hoelzl@63959 1814 have "measure M (A \ B) = measure M A + measure M (B - A)" hoelzl@63959 1815 using assms by (rule measure_Un2) hoelzl@63959 1816 also have "B - A = B - (A \ B)" hoelzl@63959 1817 by auto hoelzl@63959 1818 also have "measure M (B - (A \ B)) = measure M B - measure M (A \ B)" hoelzl@63959 1819 using assms by (intro measure_Diff) (auto simp: fmeasurable_def) hoelzl@63959 1820 finally show ?thesis hoelzl@63959 1821 by simp hoelzl@63959 1822 qed hoelzl@63959 1823 hoelzl@63959 1824 lemma measure_Un_AE: hoelzl@63959 1825 "AE x in M. x \ A \ x \ B \ A \ fmeasurable M \ B \ fmeasurable M \ hoelzl@63959 1826 measure M (A \ B) = measure M A + measure M B" hoelzl@63959 1827 by (subst measure_Un2) (auto intro!: measure_eq_AE) hoelzl@63959 1828 hoelzl@63959 1829 lemma measure_UNION_AE: hoelzl@63959 1830 assumes I: "finite I" hoelzl@63959 1831 shows "(\i. i \ I \ F i \ fmeasurable M) \ pairwise (\i j. AE x in M. x \ F i \ x \ F j) I \ hoelzl@63959 1832 measure M (\i\I. F i) = (\i\I. measure M (F i))" hoelzl@63959 1833 unfolding AE_pairwise[OF countable_finite, OF I] hoelzl@63959 1834 using I lp15@67982 1835 proof (induction I rule: finite_induct) lp15@67982 1836 case (insert x I) lp15@67982 1837 have "measure M (F x \ UNION I F) = measure M (F x) + measure M (UNION I F)" lp15@67982 1838 by (rule measure_Un_AE) (use insert in \auto simp: pairwise_insert\) lp15@67982 1839 with insert show ?case lp15@67982 1840 by (simp add: pairwise_insert ) lp15@67982 1841 qed simp hoelzl@63959 1842 hoelzl@63959 1843 lemma measure_UNION': hoelzl@63959 1844 "finite I \ (\i. i \ I \ F i \ fmeasurable M) \ pairwise (\i j. disjnt (F i) (F j)) I \ hoelzl@63959 1845 measure M (\i\I. F i) = (\i\I. measure M (F i))" hoelzl@63959 1846 by (intro measure_UNION_AE) (auto simp: disjnt_def elim!: pairwise_mono intro!: always_eventually) hoelzl@63959 1847 hoelzl@63959 1848 lemma measure_Union_AE: hoelzl@63959 1849 "finite F \ (\S. S \ F \ S \ fmeasurable M) \ pairwise (\S T. AE x in M. x \ S \ x \ T) F \ hoelzl@63959 1850 measure M (\F) = (\S\F. measure M S)" hoelzl@63959 1851 using measure_UNION_AE[of F "\x. x" M] by simp hoelzl@63959 1852 hoelzl@63959 1853 lemma measure_Union': hoelzl@63959 1854 "finite F \ (\S. S \ F \ S \ fmeasurable M) \ pairwise disjnt F \ measure M (\F) = (\S\F. measure M S)" hoelzl@63959 1855 using measure_UNION'[of F "\x. x" M] by simp hoelzl@63959 1856 hoelzl@63959 1857 lemma measure_Un_le: hoelzl@63959 1858 assumes "A \ sets M" "B \ sets M" shows "measure M (A \ B) \ measure M A + measure M B" hoelzl@63959 1859 proof cases hoelzl@63959 1860 assume "A \ fmeasurable M \ B \ fmeasurable M" hoelzl@63959 1861 with measure_subadditive[of A M B] assms show ?thesis hoelzl@63959 1862 by (auto simp: fmeasurableD2) hoelzl@63959 1863 next hoelzl@63959 1864 assume "\ (A \ fmeasurable M \ B \ fmeasurable M)" hoelzl@63959 1865 then have "A \ B \ fmeasurable M" hoelzl@63959 1866 using fmeasurableI2[of "A \ B" M A] fmeasurableI2[of "A \ B" M B] assms by auto hoelzl@63959 1867 with assms show ?thesis hoelzl@63959 1868 by (auto simp: fmeasurable_def measure_def less_top[symmetric]) hoelzl@63959 1869 qed hoelzl@63959 1870 hoelzl@63959 1871 lemma measure_UNION_le: hoelzl@63959 1872 "finite I \ (\i. i \ I \ F i \ sets M) \ measure M (\i\I. F i) \ (\i\I. measure M (F i))" hoelzl@63959 1873 proof (induction I rule: finite_induct) hoelzl@63959 1874 case (insert i I) hoelzl@63959 1875 then have "measure M (\i\insert i I. F i) \ measure M (F i) + measure M (\i\I. F i)" hoelzl@63959 1876 by (auto intro!: measure_Un_le) hoelzl@63959 1877 also have "measure M (\i\I. F i) \ (\i\I. measure M (F i))" hoelzl@63959 1878 using insert by auto hoelzl@63959 1879 finally show ?case hoelzl@63959 1880 using insert by simp hoelzl@63959 1881 qed simp hoelzl@63959 1882 hoelzl@63959 1883 lemma measure_Union_le: hoelzl@63959 1884 "finite F \ (\S. S \ F \ S \ sets M) \ measure M (\F) \ (\S\F. measure M S)" hoelzl@63959 1885 using measure_UNION_le[of F "\x. x" M] by simp hoelzl@63959 1886 lp15@67989 1887 text\Version for indexed union over a countable set\ hoelzl@63968 1888 lemma hoelzl@63968 1889 assumes "countable I" and I: "\i. i \ I \ A i \ fmeasurable M" lp15@67989 1890 and bound: "\I'. I' \ I \ finite I' \ measure M (\i\I'. A i) \ B" hoelzl@63968 1891 shows fmeasurable_UN_bound: "(\i\I. A i) \ fmeasurable M" (is ?fm) hoelzl@63968 1892 and measure_UN_bound: "measure M (\i\I. A i) \ B" (is ?m) hoelzl@63968 1893 proof - lp15@67989 1894 have "B \ 0" lp15@67989 1895 using bound by force hoelzl@63968 1896 have "?fm \ ?m" hoelzl@63968 1897 proof cases lp15@67989 1898 assume "I = {}" lp15@67989 1899 with \B \ 0\ show ?thesis lp15@67989 1900 by simp hoelzl@63968 1901 next hoelzl@63968 1902 assume "I \ {}" hoelzl@63968 1903 have "(\i\I. A i) = (\i. (\n\i. A (from_nat_into I n)))" hoelzl@63968 1904 by (subst range_from_nat_into[symmetric, OF \I \ {}\ \countable I\]) auto hoelzl@63968 1905 then have "emeasure M (\i\I. A i) = emeasure M (\i. (\n\i. A (from_nat_into I n)))" by simp hoelzl@63968 1906 also have "\ = (SUP i. emeasure M (\n\i. A (from_nat_into I n)))" hoelzl@63968 1907 using I \I \ {}\[THEN from_nat_into] by (intro SUP_emeasure_incseq[symmetric]) (fastforce simp: incseq_Suc_iff)+ hoelzl@63968 1908 also have "\ \ B" hoelzl@63968 1909 proof (intro SUP_least) hoelzl@63968 1910 fix i :: nat hoelzl@63968 1911 have "emeasure M (\n\i. A (from_nat_into I n)) = measure M (\n\i. A (from_nat_into I n))" hoelzl@63968 1912 using I \I \ {}\[THEN from_nat_into] by (intro emeasure_eq_measure2 fmeasurable.finite_UN) auto hoelzl@63968 1913 also have "\ = measure M (\n\from_nat_into I ` {..i}. A n)" hoelzl@63968 1914 by simp hoelzl@63968 1915 also have "\ \ B" hoelzl@63968 1916 by (intro ennreal_leI bound) (auto intro: from_nat_into[OF \I \ {}\]) hoelzl@63968 1917 finally show "emeasure M (\n\i. A (from_nat_into I n)) \ ennreal B" . hoelzl@63968 1918 qed hoelzl@63968 1919 finally have *: "emeasure M (\i\I. A i) \ B" . hoelzl@63968 1920 then have ?fm hoelzl@63968 1921 using I \countable I\ by (intro fmeasurableI conjI) (auto simp: less_top[symmetric] top_unique) hoelzl@63968 1922 with * \0\B\ show ?thesis hoelzl@63968 1923 by (simp add: emeasure_eq_measure2) hoelzl@63968 1924 qed hoelzl@63968 1925 then show ?fm ?m by auto hoelzl@63968 1926 qed hoelzl@63968 1927 lp15@67989 1928 text\Version for big union of a countable set\ lp15@67989 1929 lemma lp15@67989 1930 assumes "countable \" lp15@67989 1931 and meas: "\D. D \ \ \ D \ fmeasurable M" lp15@67989 1932 and bound: "\\. \\ \ \; finite \\ \ measure M (\\) \ B" lp15@67989 1933 shows fmeasurable_Union_bound: "\\ \ fmeasurable M" (is ?fm) lp15@67989 1934 and measure_Union_bound: "measure M (\\) \ B" (is ?m) lp15@67989 1935 proof - lp15@67989 1936 have "B \ 0" lp15@67989 1937 using bound by force lp15@67989 1938 have "?fm \ ?m" lp15@67989 1939 proof (cases "\ = {}") lp15@67989 1940 case True lp15@67989 1941 with \B \ 0\ show ?thesis lp15@67989 1942 by auto lp15@67989 1943 next lp15@67989 1944 case False lp15@67989 1945 then obtain D :: "nat \ 'a set" where D: "\ = range D" lp15@67989 1946 using \countable \\ uncountable_def by force lp15@67989 1947 have 1: "\i. D i \ fmeasurable M" lp15@67989 1948 by (simp add: D meas) lp15@67989 1949 have 2: "\I'. finite I' \ measure M (\x\I'. D x) \ B" lp15@67989 1950 by (simp add: D bound image_subset_iff) lp15@67989 1951 show ?thesis lp15@67989 1952 unfolding D lp15@67989 1953 by (intro conjI fmeasurable_UN_bound [OF _ 1 2] measure_UN_bound [OF _ 1 2]) auto lp15@67989 1954 qed lp15@67989 1955 then show ?fm ?m by auto lp15@67989 1956 qed lp15@67989 1957 lp15@67989 1958 text\Version for indexed union over the type of naturals\ lp15@67989 1959 lemma lp15@67989 1960 fixes S :: "nat \ 'a set" lp15@67989 1961 assumes S: "\i. S i \ fmeasurable M" and B: "\n. measure M (\i\n. S i) \ B" lp15@67989 1962 shows fmeasurable_countable_Union: "(\i. S i) \ fmeasurable M" lp15@67989 1963 and measure_countable_Union_le: "measure M (\i. S i) \ B" lp15@67989 1964 proof - lp15@67989 1965 have mB: "measure M (\i\I. S i) \ B" if "finite I" for I lp15@67989 1966 proof - lp15@67989 1967 have "(\i\I. S i) \ (\i\Max I. S i)" lp15@67989 1968 using Max_ge that by force lp15@67989 1969 then have "measure M (\i\I. S i) \ measure M (\i \ Max I. S i)" lp15@67989 1970 by (rule measure_mono_fmeasurable) (use S in \blast+\) lp15@67989 1971 then show ?thesis lp15@67989 1972 using B order_trans by blast lp15@67989 1973 qed lp15@67989 1974 show "(\i. S i) \ fmeasurable M" lp15@67989 1975 by (auto intro: fmeasurable_UN_bound [OF _ S mB]) lp15@67989 1976 show "measure M (\n. S n) \ B" lp15@67989 1977 by (auto intro: measure_UN_bound [OF _ S mB]) lp15@67989 1978 qed lp15@67989 1979 lp15@67982 1980 lemma measure_diff_le_measure_setdiff: lp15@67982 1981 assumes "S \ fmeasurable M" "T \ fmeasurable M" lp15@67982 1982 shows "measure M S - measure M T \ measure M (S - T)" lp15@67982 1983 proof - lp15@67982 1984 have "measure M S \ measure M ((S - T) \ T)" lp15@67982 1985 by (simp add: assms fmeasurable.Un fmeasurableD measure_mono_fmeasurable) lp15@67982 1986 also have "\ \ measure M (S - T) + measure M T" lp15@67982 1987 using assms by (blast intro: measure_Un_le) lp15@67982 1988 finally show ?thesis lp15@67982 1989 by (simp add: algebra_simps) lp15@67982 1990 qed lp15@67982 1991 hoelzl@64283 1992 lemma suminf_exist_split2: hoelzl@64283 1993 fixes f :: "nat \ 'a::real_normed_vector" hoelzl@64283 1994 assumes "summable f" hoelzl@64283 1995 shows "(\n. (\k. f(k+n))) \ 0" hoelzl@64283 1996 by (subst lim_sequentially, auto simp add: dist_norm suminf_exist_split[OF _ assms]) hoelzl@64283 1997 hoelzl@64283 1998 lemma emeasure_union_summable: hoelzl@64283 1999 assumes [measurable]: "\n. A n \ sets M" hoelzl@64283 2000 and "\n. emeasure M (A n) < \" "summable (\n. measure M (A n))" hoelzl@64283 2001 shows "emeasure M (\n. A n) < \" "emeasure M (\n. A n) \ (\n. measure M (A n))" hoelzl@64283 2002 proof - hoelzl@64283 2003 define B where "B = (\N. (\n\{.. sets M" for N unfolding B_def by auto hoelzl@64283 2005 have "(\N. emeasure M (B N)) \ emeasure M (\N. B N)" hoelzl@64283 2006 apply (rule Lim_emeasure_incseq) unfolding B_def by (auto simp add: SUP_subset_mono incseq_def) hoelzl@64283 2007 moreover have "emeasure M (B N) \ ennreal (\n. measure M (A n))" for N hoelzl@64283 2008 proof - hoelzl@64283 2009 have *: "(\n\{.. (\n. measure M (A n))" hoelzl@64283 2010 using assms(3) measure_nonneg sum_le_suminf by blast hoelzl@64283 2011 hoelzl@64283 2012 have "emeasure M (B N) \ (\n\{..n\{..n\{.. ennreal (\n. measure M (A n))" hoelzl@64283 2019 using * by (auto simp: ennreal_leI) hoelzl@64283 2020 finally show ?thesis by simp hoelzl@64283 2021 qed hoelzl@64283 2022 ultimately have "emeasure M (\N. B N) \ ennreal (\n. measure M (A n))" lp15@68532 2023 by (simp add: Lim_bounded) hoelzl@64283 2024 then show "emeasure M (\n. A n) \ (\n. measure M (A n))" hoelzl@64283 2025 unfolding B_def by (metis UN_UN_flatten UN_lessThan_UNIV) hoelzl@64283 2026 then show "emeasure M (\n. A n) < \" hoelzl@64283 2027 by (auto simp: less_top[symmetric] top_unique) hoelzl@64283 2028 qed hoelzl@64283 2029 hoelzl@64283 2030 lemma borel_cantelli_limsup1: hoelzl@64283 2031 assumes [measurable]: "\n. A n \ sets M" hoelzl@64283 2032 and "\n. emeasure M (A n) < \" "summable (\n. measure M (A n))" hoelzl@64283 2033 shows "limsup A \ null_sets M" hoelzl@64283 2034 proof - hoelzl@64283 2035 have "emeasure M (limsup A) \ 0" hoelzl@64283 2036 proof (rule LIMSEQ_le_const) hoelzl@64283 2037 have "(\n. (\k. measure M (A (k+n)))) \ 0" by (rule suminf_exist_split2[OF assms(3)]) hoelzl@64283 2038 then show "(\n. ennreal (\k. measure M (A (k+n)))) \ 0" hoelzl@64283 2039 unfolding ennreal_0[symmetric] by (intro tendsto_ennrealI) hoelzl@64283 2040 have "emeasure M (limsup A) \ (\k. measure M (A (k+n)))" for n hoelzl@64283 2041 proof - hoelzl@64283 2042 have I: "(\k\{n..}. A k) = (\k. A (k+n))" by (auto, metis le_add_diff_inverse2, fastforce) hoelzl@64283 2043 have "emeasure M (limsup A) \ emeasure M (\k\{n..}. A k)" hoelzl@64283 2044 by (rule emeasure_mono, auto simp add: limsup_INF_SUP) hoelzl@64283 2045 also have "... = emeasure M (\k. A (k+n))" hoelzl@64283 2046 using I by auto hoelzl@64283 2047 also have "... \ (\k. measure M (A (k+n)))" hoelzl@64283 2048 apply (rule emeasure_union_summable) hoelzl@64283 2049 using assms summable_ignore_initial_segment[OF assms(3), of n] by auto hoelzl@64283 2050 finally show ?thesis by simp hoelzl@64283 2051 qed hoelzl@64283 2052 then show "\N. \n\N. emeasure M (limsup A) \ (\k. measure M (A (k+n)))" hoelzl@64283 2053 by auto hoelzl@64283 2054 qed hoelzl@64283 2055 then show ?thesis using assms(1) measurable_limsup by auto hoelzl@64283 2056 qed hoelzl@64283 2057 hoelzl@64283 2058 lemma borel_cantelli_AE1: hoelzl@64283 2059 assumes [measurable]: "\n. A n \ sets M" hoelzl@64283 2060 and "\n. emeasure M (A n) < \" "summable (\n. measure M (A n))" hoelzl@64283 2061 shows "AE x in M. eventually (\n. x \ space M - A n) sequentially" hoelzl@64283 2062 proof - hoelzl@64283 2063 have "AE x in M. x \ limsup A" hoelzl@64283 2064 using borel_cantelli_limsup1[OF assms] unfolding eventually_ae_filter by auto hoelzl@64283 2065 moreover hoelzl@64283 2066 { hoelzl@64283 2067 fix x assume "x \ limsup A" hoelzl@64283 2068 then obtain N where "x \ (\n\{N..}. A n)" unfolding limsup_INF_SUP by blast hoelzl@64283 2069 then have "eventually (\n. x \ A n) sequentially" using eventually_sequentially by auto hoelzl@64283 2070 } hoelzl@64283 2071 ultimately show ?thesis by auto hoelzl@64283 2072 qed hoelzl@64283 2073 wenzelm@61808 2074 subsection \Measure spaces with @{term "emeasure M (space M) < \"}\ hoelzl@47694 2075 immler@67962 2076 locale%important finite_measure = sigma_finite_measure M for M + hoelzl@62975 2077 assumes finite_emeasure_space: "emeasure M (space M) \ top" hoelzl@47694 2078 hoelzl@47694 2079 lemma finite_measureI[Pure.intro!]: hoelzl@57447 2080 "emeasure M (space M) \ \ \ finite_measure M" hoelzl@57447 2081 proof qed (auto intro!: exI[of _ "{space M}"]) hoelzl@47694 2082 hoelzl@62975 2083 lemma (in finite_measure) emeasure_finite[simp, intro]: "emeasure M A \ top" hoelzl@62975 2084 using finite_emeasure_space emeasure_space[of M A] by (auto simp: top_unique) hoelzl@47694 2085 hoelzl@63958 2086 lemma (in finite_measure) fmeasurable_eq_sets: "fmeasurable M = sets M" hoelzl@63958 2087 by (auto simp: fmeasurable_def less_top[symmetric]) hoelzl@63958 2088 hoelzl@62975 2089 lemma (in finite_measure) emeasure_eq_measure: "emeasure M A = ennreal (measure M A)" hoelzl@62975 2090 by (intro emeasure_eq_ennreal_measure) simp hoelzl@47694 2091 hoelzl@62975 2092 lemma (in finite_measure) emeasure_real: "\r. 0 \ r \ emeasure M A = ennreal r" hoelzl@62975 2093 using emeasure_finite[of A] by (cases "emeasure M A" rule: ennreal_cases) auto hoelzl@47694 2094 hoelzl@47694 2095 lemma (in finite_measure) bounded_measure: "measure M A \ measure M (space M)" hoelzl@47694 2096 using emeasure_space[of M A] emeasure_real[of A] emeasure_real[of "space M"] by (auto simp: measure_def) hoelzl@47694 2097 hoelzl@47694 2098 lemma (in finite_measure) finite_measure_Diff: hoelzl@47694 2099 assumes sets: "A \ sets M" "B \ sets M" and "B \ A" hoelzl@47694 2100 shows "measure M (A - B) = measure M A - measure M B" hoelzl@47694 2101 using measure_Diff[OF _ assms] by simp hoelzl@47694 2102 hoelzl@47694 2103 lemma (in finite_measure) finite_measure_Union: hoelzl@47694 2104 assumes sets: "A \ sets M" "B \ sets M" and "A \ B = {}" hoelzl@47694 2105 shows "measure M (A \ B) = measure M A + measure M B" hoelzl@47694 2106 using measure_Union[OF _ _ assms] by simp hoelzl@47694 2107 hoelzl@47694 2108 lemma (in finite_measure) finite_measure_finite_Union: hoelzl@62975 2109 assumes measurable: "finite S" "A`S \ sets M" "disjoint_family_on A S" hoelzl@47694 2110 shows "measure M (\i\S. A i) = (\i\S. measure M (A i))" hoelzl@47694 2111 using measure_finite_Union[OF assms] by simp hoelzl@47694 2112 hoelzl@47694 2113 lemma (in finite_measure) finite_measure_UNION: hoelzl@47694 2114 assumes A: "range A \ sets M" "disjoint_family A" hoelzl@47694 2115 shows "(\i. measure M (A i)) sums (measure M (\i. A i))" hoelzl@47694 2116 using measure_UNION[OF A] by simp hoelzl@47694 2117 hoelzl@47694 2118 lemma (in finite_measure) finite_measure_mono: hoelzl@47694 2119 assumes "A \ B" "B \ sets M" shows "measure M A \ measure M B" hoelzl@47694 2120 using emeasure_mono[OF assms] emeasure_real[of A] emeasure_real[of B] by (auto simp: measure_def) hoelzl@47694 2121 hoelzl@47694 2122 lemma (in finite_measure) finite_measure_subadditive: hoelzl@47694 2123 assumes m: "A \ sets M" "B \ sets M" hoelzl@47694 2124 shows "measure M (A \ B) \ measure M A + measure M B" hoelzl@47694 2125 using measure_subadditive[OF m] by simp hoelzl@47694 2126 hoelzl@47694 2127 lemma (in finite_measure) finite_measure_subadditive_finite: hoelzl@47694 2128 assumes "finite I" "A`I \ sets M" shows "measure M (\i\I. A i) \ (\i\I. measure M (A i))" hoelzl@47694 2129 using measure_subadditive_finite[OF assms] by simp hoelzl@47694 2130 hoelzl@47694 2131 lemma (in finite_measure) finite_measure_subadditive_countably: hoelzl@62975 2132 "range A \ sets M \ summable (\i. measure M (A i)) \ measure M (\i. A i) \ (\i. measure M (A i))" hoelzl@62975 2133 by (rule measure_subadditive_countably) hoelzl@62975 2134 (simp_all add: ennreal_suminf_neq_top emeasure_eq_measure) hoelzl@47694 2135 nipkow@64267 2136 lemma (in finite_measure) finite_measure_eq_sum_singleton: hoelzl@47694 2137 assumes "finite S" and *: "\x. x \ S \ {x} \ sets M" hoelzl@47694 2138 shows "measure M S = (\x\S. measure M {x})" nipkow@64267 2139 using measure_eq_sum_singleton[OF assms] by simp hoelzl@47694 2140 hoelzl@47694 2141 lemma (in finite_measure) finite_Lim_measure_incseq: hoelzl@47694 2142 assumes A: "range A \ sets M" "incseq A" wenzelm@61969 2143 shows "(\i. measure M (A i)) \ measure M (\i. A i)" hoelzl@47694 2144 using Lim_measure_incseq[OF A] by simp hoelzl@47694 2145 hoelzl@47694 2146 lemma (in finite_measure) finite_Lim_measure_decseq: hoelzl@47694 2147 assumes A: "range A \ sets M" "decseq A" wenzelm@61969 2148 shows "(\n. measure M (A n)) \ measure M (\i. A i)" hoelzl@47694 2149 using Lim_measure_decseq[OF A] by simp hoelzl@47694 2150 hoelzl@47694 2151 lemma (in finite_measure) finite_measure_compl: hoelzl@47694 2152 assumes S: "S \ sets M" hoelzl@47694 2153 shows "measure M (space M - S) = measure M (space M) - measure M S" immler@50244 2154 using measure_Diff[OF _ sets.top S sets.sets_into_space] S by simp hoelzl@47694 2155 hoelzl@47694 2156 lemma (in finite_measure) finite_measure_mono_AE: hoelzl@47694 2157 assumes imp: "AE x in M. x \ A \ x \ B" and B: "B \ sets M" hoelzl@47694 2158 shows "measure M A \ measure M B" hoelzl@47694 2159 using assms emeasure_mono_AE[OF imp B] hoelzl@47694 2160 by (simp add: emeasure_eq_measure) hoelzl@47694 2161 hoelzl@47694 2162 lemma (in finite_measure) finite_measure_eq_AE: hoelzl@47694 2163 assumes iff: "AE x in M. x \ A \ x \ B" hoelzl@47694 2164 assumes A: "A \ sets M" and B: "B \ sets M" hoelzl@47694 2165 shows "measure M A = measure M B" hoelzl@47694 2166 using assms emeasure_eq_AE[OF assms] by (simp add: emeasure_eq_measure) hoelzl@47694 2167 hoelzl@50104 2168 lemma (in finite_measure) measure_increasing: "increasing M (measure M)" hoelzl@50104 2169 by (auto intro!: finite_measure_mono simp: increasing_def) hoelzl@50104 2170 hoelzl@50104 2171 lemma (in finite_measure) measure_zero_union: hoelzl@50104 2172 assumes "s \ sets M" "t \ sets M" "measure M t = 0" hoelzl@50104 2173 shows "measure M (s \ t) = measure M s" hoelzl@50104 2174 using assms hoelzl@50104 2175 proof - hoelzl@50104 2176 have "measure M (s \ t) \ measure M s" hoelzl@50104 2177 using finite_measure_subadditive[of s t] assms by auto hoelzl@50104 2178 moreover have "measure M (s \ t) \ measure M s" hoelzl@50104 2179 using assms by (blast intro: finite_measure_mono) hoelzl@50104 2180 ultimately show ?thesis by simp hoelzl@50104 2181 qed hoelzl@50104 2182 hoelzl@50104 2183 lemma (in finite_measure) measure_eq_compl: hoelzl@50104 2184 assumes "s \ sets M" "t \ sets M" hoelzl@50104 2185 assumes "measure M (space M - s) = measure M (space M - t)" hoelzl@50104 2186 shows "measure M s = measure M t" hoelzl@50104 2187 using assms finite_measure_compl by auto hoelzl@50104 2188 hoelzl@50104 2189 lemma (in finite_measure) measure_eq_bigunion_image: hoelzl@50104 2190 assumes "range f \ sets M" "range g \ sets M" hoelzl@50104 2191 assumes "disjoint_family f" "disjoint_family g" hoelzl@50104 2192 assumes "\ n :: nat. measure M (f n) = measure M (g n)" wenzelm@60585 2193 shows "measure M (\i. f i) = measure M (\i. g i)" hoelzl@50104 2194 using assms hoelzl@50104 2195 proof - wenzelm@60585 2196 have a: "(\ i. measure M (f i)) sums (measure M (\i. f i))" hoelzl@50104 2197 by (rule finite_measure_UNION[OF assms(1,3)]) wenzelm@60585 2198 have b: "(\ i. measure M (g i)) sums (measure M (\i. g i))" hoelzl@50104 2199 by (rule finite_measure_UNION[OF assms(2,4)]) hoelzl@50104 2200 show ?thesis using sums_unique[OF b] sums_unique[OF a] assms by simp hoelzl@50104 2201 qed hoelzl@50104 2202 hoelzl@50104 2203 lemma (in finite_measure) measure_countably_zero: hoelzl@50104 2204 assumes "range c \ sets M" hoelzl@50104 2205 assumes "\ i. measure M (c i) = 0" wenzelm@60585 2206 shows "measure M (\i :: nat. c i) = 0" hoelzl@50104 2207 proof (rule antisym) wenzelm@60585 2208 show "measure M (\i :: nat. c i) \ 0" hoelzl@50104 2209 using finite_measure_subadditive_countably[OF assms(1)] by (simp add: assms(2)) hoelzl@62975 2210 qed simp hoelzl@50104 2211 hoelzl@50104 2212 lemma (in finite_measure) measure_space_inter: hoelzl@50104 2213 assumes events:"s \ sets M" "t \ sets M" hoelzl@50104 2214 assumes "measure M t = measure M (space M)" hoelzl@50104 2215 shows "measure M (s \ t) = measure M s" hoelzl@50104 2216 proof - hoelzl@50104 2217 have "measure M ((space M - s) \ (space M - t)) = measure M (space M - s)" hoelzl@50104 2218 using events assms finite_measure_compl[of "t"] by (auto intro!: measure_zero_union) hoelzl@50104 2219 also have "(space M - s) \ (space M - t) = space M - (s \ t)" hoelzl@50104 2220 by blast hoelzl@50104 2221 finally show "measure M (s \ t) = measure M s" hoelzl@50104 2222 using events by (auto intro!: measure_eq_compl[of "s \ t" s]) hoelzl@50104 2223 qed hoelzl@50104 2224 hoelzl@50104 2225 lemma (in finite_measure) measure_equiprobable_finite_unions: hoelzl@50104 2226 assumes s: "finite s" "\x. x \ s \ {x} \ sets M" hoelzl@50104 2227 assumes "\ x y. \x \ s; y \ s\ \ measure M {x} = measure M {y}" hoelzl@50104 2228 shows "measure M s = real (card s) * measure M {SOME x. x \ s}" hoelzl@50104 2229 proof cases hoelzl@50104 2230 assume "s \ {}" hoelzl@50104 2231 then have "\ x. x \ s" by blast hoelzl@50104 2232 from someI_ex[OF this] assms hoelzl@50104 2233 have prob_some: "\ x. x \ s \ measure M {x} = measure M {SOME y. y \ s}" by blast hoelzl@50104 2234 have "measure M s = (\ x \ s. measure M {x})" nipkow@64267 2235 using finite_measure_eq_sum_singleton[OF s] by simp hoelzl@50104 2236 also have "\ = (\ x \ s. measure M {SOME y. y \ s})" using prob_some by auto hoelzl@50104 2237 also have "\ = real (card s) * measure M {(SOME x. x \ s)}" nipkow@64267 2238 using sum_constant assms by simp hoelzl@50104 2239 finally show ?thesis by simp hoelzl@50104 2240 qed simp hoelzl@50104 2241 hoelzl@50104 2242 lemma (in finite_measure) measure_real_sum_image_fn: hoelzl@50104 2243 assumes "e \ sets M" hoelzl@50104 2244 assumes "\ x. x \ s \ e \ f x \ sets M" hoelzl@50104 2245 assumes "finite s" hoelzl@50104 2246 assumes disjoint: "\ x y. \x \ s ; y \ s ; x \ y\ \ f x \ f y = {}" wenzelm@60585 2247 assumes upper: "space M \ (\i \ s. f i)" hoelzl@50104 2248 shows "measure M e = (\ x \ s. measure M (e \ f x))" hoelzl@50104 2249 proof - haftmann@62343 2250 have "e \ (\i\s. f i)" wenzelm@61808 2251 using \e \ sets M\ sets.sets_into_space upper by blast haftmann@62343 2252 then have e: "e = (\i \ s. e \ f i)" haftmann@62343 2253 by auto wenzelm@60585 2254 hence "measure M e = measure M (\i \ s. e \ f i)" by simp hoelzl@50104 2255 also have "\ = (\ x \ s. measure M (e \ f x))" hoelzl@50104 2256 proof (rule finite_measure_finite_Union) hoelzl@50104 2257 show "finite s" by fact hoelzl@50104 2258 show "(\i. e \ f i)`s \ sets M" using assms(2) by auto hoelzl@50104 2259 show "disjoint_family_on (\i. e \ f i) s" hoelzl@50104 2260 using disjoint by (auto simp: disjoint_family_on_def) hoelzl@50104 2261 qed hoelzl@50104 2262 finally show ?thesis . hoelzl@50104 2263 qed hoelzl@50104 2264 hoelzl@50104 2265 lemma (in finite_measure) measure_exclude: hoelzl@50104 2266 assumes "A \ sets M" "B \ sets M" hoelzl@50104 2267 assumes "measure M A = measure M (space M)" "A \ B = {}" hoelzl@50104 2268 shows "measure M B = 0" hoelzl@50104 2269 using measure_space_inter[of B A] assms by (auto simp: ac_simps) hoelzl@57235 2270 lemma (in finite_measure) finite_measure_distr: lp15@61609 2271 assumes f: "f \ measurable M M'" hoelzl@57235 2272 shows "finite_measure (distr M M' f)" hoelzl@57235 2273 proof (rule finite_measureI) hoelzl@57235 2274 have "f -` space M' \ space M = space M" using f by (auto dest: measurable_space) hoelzl@57235 2275 with f show "emeasure (distr M M' f) (space (distr M M' f)) \ \" by (auto simp: emeasure_distr) hoelzl@57235 2276 qed hoelzl@57235 2277 hoelzl@60636 2278 lemma emeasure_gfp[consumes 1, case_names cont measurable]: hoelzl@60636 2279 assumes sets[simp]: "\s. sets (M s) = sets N" hoelzl@60636 2280 assumes "\s. finite_measure (M s)" hoelzl@60636 2281 assumes cont: "inf_continuous F" "inf_continuous f" hoelzl@60636 2282 assumes meas: "\P. Measurable.pred N P \ Measurable.pred N (F P)" hoelzl@60636 2283 assumes iter: "\P s. Measurable.pred N P \ emeasure (M s) {x\space N. F P x} = f (\s. emeasure (M s) {x\space N. P x}) s" hoelzl@60636 2284 assumes bound: "\P. f P \ f (\s. emeasure (M s) (space (M s)))" hoelzl@60636 2285 shows "emeasure (M s) {x\space N. gfp F x} = gfp f s" hoelzl@60636 2286 proof (subst gfp_transfer_bounded[where \="\F s. emeasure (M s) {x\space N. F x}" and g=f and f=F and hoelzl@60636 2287 P="Measurable.pred N", symmetric]) hoelzl@60636 2288 interpret finite_measure "M s" for s by fact hoelzl@60636 2289 fix C assume "decseq C" "\i. Measurable.pred N (C i)" hoelzl@60636 2290 then show "(\s. emeasure (M s) {x \ space N. (INF i. C i) x}) = (INF i. (\s. emeasure (M s) {x \ space N. C i x}))" hoelzl@60636 2291 unfolding INF_apply[abs_def] hoelzl@60636 2292 by (subst INF_emeasure_decseq) (auto simp: antimono_def fun_eq_iff intro!: arg_cong2[where f=emeasure]) hoelzl@60636 2293 next hoelzl@60636 2294 show "f x \ (\s. emeasure (M s) {x \ space N. F top x})" for x hoelzl@60636 2295 using bound[of x] sets_eq_imp_space_eq[OF sets] by (simp add: iter) hoelzl@60636 2296 qed (auto simp add: iter le_fun_def INF_apply[abs_def] intro!: meas cont) hoelzl@60636 2297 immler@67962 2298 subsection%unimportant \Counting space\ hoelzl@47694 2299 hoelzl@49773 2300 lemma strict_monoI_Suc: hoelzl@49773 2301 assumes ord [simp]: "(\n. f n < f (Suc n))" shows "strict_mono f" hoelzl@49773 2302 unfolding strict_mono_def hoelzl@49773 2303 proof safe hoelzl@49773 2304 fix n m :: nat assume "n < m" then show "f n < f m" hoelzl@49773 2305 by (induct m) (auto simp: less_Suc_eq intro: less_trans ord) hoelzl@49773 2306 qed hoelzl@49773 2307 hoelzl@47694 2308 lemma emeasure_count_space: hoelzl@62975 2309 assumes "X \ A" shows "emeasure (count_space A) X = (if finite X then of_nat (card X) else \)" hoelzl@47694 2310 (is "_ = ?M X") hoelzl@47694 2311 unfolding count_space_def hoelzl@47694 2312 proof (rule emeasure_measure_of_sigma) wenzelm@61808 2313 show "X \ Pow A" using \X \ A\ by auto