summary |
shortlog |
changelog |
graph |
tags |
branches |
files |
changeset |
file |
revisions |
annotate |
diff |
raw

src/HOL/Probability/Regularity.thy

author | hoelzl |

Thu Apr 14 15:48:11 2016 +0200 (2016-04-14) | |

changeset 62975 | 1d066f6ab25d |

parent 62533 | bc25f3916a99 |

child 63040 | eb4ddd18d635 |

permissions | -rw-r--r-- |

Probability: move emeasure and nn_integral from ereal to ennreal

1 (* Title: HOL/Probability/Regularity.thy

2 Author: Fabian Immler, TU München

3 *)

5 section \<open>Regularity of Measures\<close>

7 theory Regularity

8 imports Measure_Space Borel_Space

9 begin

11 lemma

12 fixes M::"'a::{second_countable_topology, complete_space} measure"

13 assumes sb: "sets M = sets borel"

14 assumes "emeasure M (space M) \<noteq> \<infinity>"

15 assumes "B \<in> sets borel"

16 shows inner_regular: "emeasure M B =

17 (SUP K : {K. K \<subseteq> B \<and> compact K}. emeasure M K)" (is "?inner B")

18 and outer_regular: "emeasure M B =

19 (INF U : {U. B \<subseteq> U \<and> open U}. emeasure M U)" (is "?outer B")

20 proof -

21 have Us: "UNIV = space M" by (metis assms(1) sets_eq_imp_space_eq space_borel)

22 hence sU: "space M = UNIV" by simp

23 interpret finite_measure M by rule fact

24 have approx_inner: "\<And>A. A \<in> sets M \<Longrightarrow>

25 (\<And>e. e > 0 \<Longrightarrow> \<exists>K. K \<subseteq> A \<and> compact K \<and> emeasure M A \<le> emeasure M K + ennreal e) \<Longrightarrow> ?inner A"

26 by (rule ennreal_approx_SUP)

27 (force intro!: emeasure_mono simp: compact_imp_closed emeasure_eq_measure)+

28 have approx_outer: "\<And>A. A \<in> sets M \<Longrightarrow>

29 (\<And>e. e > 0 \<Longrightarrow> \<exists>B. A \<subseteq> B \<and> open B \<and> emeasure M B \<le> emeasure M A + ennreal e) \<Longrightarrow> ?outer A"

30 by (rule ennreal_approx_INF)

31 (force intro!: emeasure_mono simp: emeasure_eq_measure sb)+

32 from countable_dense_setE guess X::"'a set" . note X = this

33 {

34 fix r::real assume "r > 0" hence "\<And>y. open (ball y r)" "\<And>y. ball y r \<noteq> {}" by auto

35 with X(2)[OF this]

36 have x: "space M = (\<Union>x\<in>X. cball x r)"

37 by (auto simp add: sU) (metis dist_commute order_less_imp_le)

38 let ?U = "\<Union>k. (\<Union>n\<in>{0..k}. cball (from_nat_into X n) r)"

39 have "(\<lambda>k. emeasure M (\<Union>n\<in>{0..k}. cball (from_nat_into X n) r)) \<longlonglongrightarrow> M ?U"

40 by (rule Lim_emeasure_incseq) (auto intro!: borel_closed bexI simp: incseq_def Us sb)

41 also have "?U = space M"

42 proof safe

43 fix x from X(2)[OF open_ball[of x r]] \<open>r > 0\<close> obtain d where d: "d\<in>X" "d \<in> ball x r" by auto

44 show "x \<in> ?U"

45 using X(1) d

46 by simp (auto intro!: exI [where x = "to_nat_on X d"] simp: dist_commute Bex_def)

47 qed (simp add: sU)

48 finally have "(\<lambda>k. M (\<Union>n\<in>{0..k}. cball (from_nat_into X n) r)) \<longlonglongrightarrow> M (space M)" .

49 } note M_space = this

50 {

51 fix e ::real and n :: nat assume "e > 0" "n > 0"

52 hence "1/n > 0" "e * 2 powr - n > 0" by (auto)

53 from M_space[OF \<open>1/n>0\<close>]

54 have "(\<lambda>k. measure M (\<Union>i\<in>{0..k}. cball (from_nat_into X i) (1/real n))) \<longlonglongrightarrow> measure M (space M)"

55 unfolding emeasure_eq_measure by (auto simp: measure_nonneg)

56 from metric_LIMSEQ_D[OF this \<open>0 < e * 2 powr -n\<close>]

57 obtain k where "dist (measure M (\<Union>i\<in>{0..k}. cball (from_nat_into X i) (1/real n))) (measure M (space M)) <

58 e * 2 powr -n"

59 by auto

60 hence "measure M (\<Union>i\<in>{0..k}. cball (from_nat_into X i) (1/real n)) \<ge>

61 measure M (space M) - e * 2 powr -real n"

62 by (auto simp: dist_real_def)

63 hence "\<exists>k. measure M (\<Union>i\<in>{0..k}. cball (from_nat_into X i) (1/real n)) \<ge>

64 measure M (space M) - e * 2 powr - real n" ..

65 } note k=this

66 hence "\<forall>e\<in>{0<..}. \<forall>(n::nat)\<in>{0<..}. \<exists>k.

67 measure M (\<Union>i\<in>{0..k}. cball (from_nat_into X i) (1/real n)) \<ge> measure M (space M) - e * 2 powr - real n"

68 by blast

69 then obtain k where k: "\<forall>e\<in>{0<..}. \<forall>n\<in>{0<..}. measure M (space M) - e * 2 powr - real (n::nat)

70 \<le> measure M (\<Union>i\<in>{0..k e n}. cball (from_nat_into X i) (1 / n))"

71 by metis

72 hence k: "\<And>e n. e > 0 \<Longrightarrow> n > 0 \<Longrightarrow> measure M (space M) - e * 2 powr - n

73 \<le> measure M (\<Union>i\<in>{0..k e n}. cball (from_nat_into X i) (1 / n))"

74 unfolding Ball_def by blast

75 have approx_space:

76 "\<exists>K \<in> {K. K \<subseteq> space M \<and> compact K}. emeasure M (space M) \<le> emeasure M K + ennreal e"

77 (is "?thesis e") if "0 < e" for e :: real

78 proof -

79 def B \<equiv> "\<lambda>n. \<Union>i\<in>{0..k e (Suc n)}. cball (from_nat_into X i) (1 / Suc n)"

80 have "\<And>n. closed (B n)" by (auto simp: B_def)

81 hence [simp]: "\<And>n. B n \<in> sets M" by (simp add: sb)

82 from k[OF \<open>e > 0\<close> zero_less_Suc]

83 have "\<And>n. measure M (space M) - measure M (B n) \<le> e * 2 powr - real (Suc n)"

84 by (simp add: algebra_simps B_def finite_measure_compl)

85 hence B_compl_le: "\<And>n::nat. measure M (space M - B n) \<le> e * 2 powr - real (Suc n)"

86 by (simp add: finite_measure_compl)

87 def K \<equiv> "\<Inter>n. B n"

88 from \<open>closed (B _)\<close> have "closed K" by (auto simp: K_def)

89 hence [simp]: "K \<in> sets M" by (simp add: sb)

90 have "measure M (space M) - measure M K = measure M (space M - K)"

91 by (simp add: finite_measure_compl)

92 also have "\<dots> = emeasure M (\<Union>n. space M - B n)" by (auto simp: K_def emeasure_eq_measure)

93 also have "\<dots> \<le> (\<Sum>n. emeasure M (space M - B n))"

94 by (rule emeasure_subadditive_countably) (auto simp: summable_def)

95 also have "\<dots> \<le> (\<Sum>n. ennreal (e*2 powr - real (Suc n)))"

96 using B_compl_le by (intro suminf_le) (simp_all add: measure_nonneg emeasure_eq_measure ennreal_leI)

97 also have "\<dots> \<le> (\<Sum>n. ennreal (e * (1 / 2) ^ Suc n))"

98 by (simp add: powr_minus powr_realpow field_simps del: of_nat_Suc)

99 also have "\<dots> = ennreal e * (\<Sum>n. ennreal ((1 / 2) ^ Suc n))"

100 unfolding ennreal_power[symmetric]

101 using \<open>0 < e\<close>

102 by (simp add: ac_simps ennreal_mult' divide_ennreal[symmetric] divide_ennreal_def

103 ennreal_power[symmetric])

104 also have "\<dots> = e"

105 by (subst suminf_ennreal_eq[OF zero_le_power power_half_series]) auto

106 finally have "measure M (space M) \<le> measure M K + e"

107 using \<open>0 < e\<close> by simp

108 hence "emeasure M (space M) \<le> emeasure M K + e"

109 using \<open>0 < e\<close> by (simp add: emeasure_eq_measure measure_nonneg ennreal_plus[symmetric] del: ennreal_plus)

110 moreover have "compact K"

111 unfolding compact_eq_totally_bounded

112 proof safe

113 show "complete K" using \<open>closed K\<close> by (simp add: complete_eq_closed)

114 fix e'::real assume "0 < e'"

115 from nat_approx_posE[OF this] guess n . note n = this

116 let ?k = "from_nat_into X ` {0..k e (Suc n)}"

117 have "finite ?k" by simp

118 moreover have "K \<subseteq> (\<Union>x\<in>?k. ball x e')" unfolding K_def B_def using n by force

119 ultimately show "\<exists>k. finite k \<and> K \<subseteq> (\<Union>x\<in>k. ball x e')" by blast

120 qed

121 ultimately

122 show ?thesis by (auto simp: sU)

123 qed

124 { fix A::"'a set" assume "closed A" hence "A \<in> sets borel" by (simp add: compact_imp_closed)

125 hence [simp]: "A \<in> sets M" by (simp add: sb)

126 have "?inner A"

127 proof (rule approx_inner)

128 fix e::real assume "e > 0"

129 from approx_space[OF this] obtain K where

130 K: "K \<subseteq> space M" "compact K" "emeasure M (space M) \<le> emeasure M K + e"

131 by (auto simp: emeasure_eq_measure)

132 hence [simp]: "K \<in> sets M" by (simp add: sb compact_imp_closed)

133 have "measure M A - measure M (A \<inter> K) = measure M (A - A \<inter> K)"

134 by (subst finite_measure_Diff) auto

135 also have "A - A \<inter> K = A \<union> K - K" by auto

136 also have "measure M \<dots> = measure M (A \<union> K) - measure M K"

137 by (subst finite_measure_Diff) auto

138 also have "\<dots> \<le> measure M (space M) - measure M K"

139 by (simp add: emeasure_eq_measure sU sb finite_measure_mono)

140 also have "\<dots> \<le> e"

141 using K \<open>0 < e\<close> by (simp add: emeasure_eq_measure ennreal_plus[symmetric] measure_nonneg del: ennreal_plus)

142 finally have "emeasure M A \<le> emeasure M (A \<inter> K) + ennreal e"

143 using \<open>0<e\<close> by (simp add: emeasure_eq_measure algebra_simps ennreal_plus[symmetric] measure_nonneg del: ennreal_plus)

144 moreover have "A \<inter> K \<subseteq> A" "compact (A \<inter> K)" using \<open>closed A\<close> \<open>compact K\<close> by auto

145 ultimately show "\<exists>K \<subseteq> A. compact K \<and> emeasure M A \<le> emeasure M K + ennreal e"

146 by blast

147 qed simp

148 have "?outer A"

149 proof cases

150 assume "A \<noteq> {}"

151 let ?G = "\<lambda>d. {x. infdist x A < d}"

152 {

153 fix d

154 have "?G d = (\<lambda>x. infdist x A) -` {..<d}" by auto

155 also have "open \<dots>"

156 by (intro continuous_open_vimage) (auto intro!: continuous_infdist continuous_ident)

157 finally have "open (?G d)" .

158 } note open_G = this

159 from in_closed_iff_infdist_zero[OF \<open>closed A\<close> \<open>A \<noteq> {}\<close>]

160 have "A = {x. infdist x A = 0}" by auto

161 also have "\<dots> = (\<Inter>i. ?G (1/real (Suc i)))"

162 proof (auto simp del: of_nat_Suc, rule ccontr)

163 fix x

164 assume "infdist x A \<noteq> 0"

165 hence pos: "infdist x A > 0" using infdist_nonneg[of x A] by simp

166 from nat_approx_posE[OF this] guess n .

167 moreover

168 assume "\<forall>i. infdist x A < 1 / real (Suc i)"

169 hence "infdist x A < 1 / real (Suc n)" by auto

170 ultimately show False by simp

171 qed

172 also have "M \<dots> = (INF n. emeasure M (?G (1 / real (Suc n))))"

173 proof (rule INF_emeasure_decseq[symmetric], safe)

174 fix i::nat

175 from open_G[of "1 / real (Suc i)"]

176 show "?G (1 / real (Suc i)) \<in> sets M" by (simp add: sb borel_open)

177 next

178 show "decseq (\<lambda>i. {x. infdist x A < 1 / real (Suc i)})"

179 by (auto intro: less_trans intro!: divide_strict_left_mono

180 simp: decseq_def le_eq_less_or_eq)

181 qed simp

182 finally

183 have "emeasure M A = (INF n. emeasure M {x. infdist x A < 1 / real (Suc n)})" .

184 moreover

185 have "\<dots> \<ge> (INF U:{U. A \<subseteq> U \<and> open U}. emeasure M U)"

186 proof (intro INF_mono)

187 fix m

188 have "?G (1 / real (Suc m)) \<in> {U. A \<subseteq> U \<and> open U}" using open_G by auto

189 moreover have "M (?G (1 / real (Suc m))) \<le> M (?G (1 / real (Suc m)))" by simp

190 ultimately show "\<exists>U\<in>{U. A \<subseteq> U \<and> open U}.

191 emeasure M U \<le> emeasure M {x. infdist x A < 1 / real (Suc m)}"

192 by blast

193 qed

194 moreover

195 have "emeasure M A \<le> (INF U:{U. A \<subseteq> U \<and> open U}. emeasure M U)"

196 by (rule INF_greatest) (auto intro!: emeasure_mono simp: sb)

197 ultimately show ?thesis by simp

198 qed (auto intro!: INF_eqI)

199 note \<open>?inner A\<close> \<open>?outer A\<close> }

200 note closed_in_D = this

201 from \<open>B \<in> sets borel\<close>

202 have "Int_stable (Collect closed)" "Collect closed \<subseteq> Pow UNIV" "B \<in> sigma_sets UNIV (Collect closed)"

203 by (auto simp: Int_stable_def borel_eq_closed)

204 then show "?inner B" "?outer B"

205 proof (induct B rule: sigma_sets_induct_disjoint)

206 case empty

207 { case 1 show ?case by (intro SUP_eqI[symmetric]) auto }

208 { case 2 show ?case by (intro INF_eqI[symmetric]) (auto elim!: meta_allE[of _ "{}"]) }

209 next

210 case (basic B)

211 { case 1 from basic closed_in_D show ?case by auto }

212 { case 2 from basic closed_in_D show ?case by auto }

213 next

214 case (compl B)

215 note inner = compl(2) and outer = compl(3)

216 from compl have [simp]: "B \<in> sets M" by (auto simp: sb borel_eq_closed)

217 case 2

218 have "M (space M - B) = M (space M) - emeasure M B" by (auto simp: emeasure_compl)

219 also have "\<dots> = (INF K:{K. K \<subseteq> B \<and> compact K}. M (space M) - M K)"

220 by (subst ennreal_SUP_const_minus) (auto simp: less_top[symmetric] inner)

221 also have "\<dots> = (INF U:{U. U \<subseteq> B \<and> compact U}. M (space M - U))"

222 by (rule INF_cong) (auto simp add: emeasure_compl sb compact_imp_closed)

223 also have "\<dots> \<ge> (INF U:{U. U \<subseteq> B \<and> closed U}. M (space M - U))"

224 by (rule INF_superset_mono) (auto simp add: compact_imp_closed)

225 also have "(INF U:{U. U \<subseteq> B \<and> closed U}. M (space M - U)) =

226 (INF U:{U. space M - B \<subseteq> U \<and> open U}. emeasure M U)"

227 unfolding INF_image [of _ "\<lambda>u. space M - u" _, symmetric, unfolded comp_def]

228 by (rule INF_cong) (auto simp add: sU Compl_eq_Diff_UNIV [symmetric, simp])

229 finally have

230 "(INF U:{U. space M - B \<subseteq> U \<and> open U}. emeasure M U) \<le> emeasure M (space M - B)" .

231 moreover have

232 "(INF U:{U. space M - B \<subseteq> U \<and> open U}. emeasure M U) \<ge> emeasure M (space M - B)"

233 by (auto simp: sb sU intro!: INF_greatest emeasure_mono)

234 ultimately show ?case by (auto intro!: antisym simp: sets_eq_imp_space_eq[OF sb])

236 case 1

237 have "M (space M - B) = M (space M) - emeasure M B" by (auto simp: emeasure_compl)

238 also have "\<dots> = (SUP U: {U. B \<subseteq> U \<and> open U}. M (space M) - M U)"

239 unfolding outer by (subst ennreal_INF_const_minus) auto

240 also have "\<dots> = (SUP U:{U. B \<subseteq> U \<and> open U}. M (space M - U))"

241 by (rule SUP_cong) (auto simp add: emeasure_compl sb compact_imp_closed)

242 also have "\<dots> = (SUP K:{K. K \<subseteq> space M - B \<and> closed K}. emeasure M K)"

243 unfolding SUP_image [of _ "\<lambda>u. space M - u" _, symmetric, unfolded comp_def]

244 by (rule SUP_cong) (auto simp add: sU)

245 also have "\<dots> = (SUP K:{K. K \<subseteq> space M - B \<and> compact K}. emeasure M K)"

246 proof (safe intro!: antisym SUP_least)

247 fix K assume "closed K" "K \<subseteq> space M - B"

248 from closed_in_D[OF \<open>closed K\<close>]

249 have K_inner: "emeasure M K = (SUP K:{Ka. Ka \<subseteq> K \<and> compact Ka}. emeasure M K)" by simp

250 show "emeasure M K \<le> (SUP K:{K. K \<subseteq> space M - B \<and> compact K}. emeasure M K)"

251 unfolding K_inner using \<open>K \<subseteq> space M - B\<close>

252 by (auto intro!: SUP_upper SUP_least)

253 qed (fastforce intro!: SUP_least SUP_upper simp: compact_imp_closed)

254 finally show ?case by (auto intro!: antisym simp: sets_eq_imp_space_eq[OF sb])

255 next

256 case (union D)

257 then have "range D \<subseteq> sets M" by (auto simp: sb borel_eq_closed)

258 with union have M[symmetric]: "(\<Sum>i. M (D i)) = M (\<Union>i. D i)" by (intro suminf_emeasure)

259 also have "(\<lambda>n. \<Sum>i<n. M (D i)) \<longlonglongrightarrow> (\<Sum>i. M (D i))"

260 by (intro summable_LIMSEQ) auto

261 finally have measure_LIMSEQ: "(\<lambda>n. \<Sum>i<n. measure M (D i)) \<longlonglongrightarrow> measure M (\<Union>i. D i)"

262 by (simp add: emeasure_eq_measure measure_nonneg setsum_nonneg)

263 have "(\<Union>i. D i) \<in> sets M" using \<open>range D \<subseteq> sets M\<close> by auto

265 case 1

266 show ?case

267 proof (rule approx_inner)

268 fix e::real assume "e > 0"

269 with measure_LIMSEQ

270 have "\<exists>no. \<forall>n\<ge>no. \<bar>(\<Sum>i<n. measure M (D i)) -measure M (\<Union>x. D x)\<bar> < e/2"

271 by (auto simp: lim_sequentially dist_real_def simp del: less_divide_eq_numeral1)

272 hence "\<exists>n0. \<bar>(\<Sum>i<n0. measure M (D i)) - measure M (\<Union>x. D x)\<bar> < e/2" by auto

273 then obtain n0 where n0: "\<bar>(\<Sum>i<n0. measure M (D i)) - measure M (\<Union>i. D i)\<bar> < e/2"

274 unfolding choice_iff by blast

275 have "ennreal (\<Sum>i<n0. measure M (D i)) = (\<Sum>i<n0. M (D i))"

276 by (auto simp add: emeasure_eq_measure setsum_nonneg measure_nonneg)

277 also have "\<dots> \<le> (\<Sum>i. M (D i))" by (rule setsum_le_suminf) auto

278 also have "\<dots> = M (\<Union>i. D i)" by (simp add: M)

279 also have "\<dots> = measure M (\<Union>i. D i)" by (simp add: emeasure_eq_measure)

280 finally have n0: "measure M (\<Union>i. D i) - (\<Sum>i<n0. measure M (D i)) < e/2"

281 using n0 by (auto simp: measure_nonneg setsum_nonneg)

282 have "\<forall>i. \<exists>K. K \<subseteq> D i \<and> compact K \<and> emeasure M (D i) \<le> emeasure M K + e/(2*Suc n0)"

283 proof

284 fix i

285 from \<open>0 < e\<close> have "0 < e/(2*Suc n0)" by simp

286 have "emeasure M (D i) = (SUP K:{K. K \<subseteq> (D i) \<and> compact K}. emeasure M K)"

287 using union by blast

288 from SUP_approx_ennreal[OF \<open>0 < e/(2*Suc n0)\<close> _ this]

289 show "\<exists>K. K \<subseteq> D i \<and> compact K \<and> emeasure M (D i) \<le> emeasure M K + e/(2*Suc n0)"

290 by (auto simp: emeasure_eq_measure intro: less_imp_le compact_empty)

291 qed

292 then obtain K where K: "\<And>i. K i \<subseteq> D i" "\<And>i. compact (K i)"

293 "\<And>i. emeasure M (D i) \<le> emeasure M (K i) + e/(2*Suc n0)"

294 unfolding choice_iff by blast

295 let ?K = "\<Union>i\<in>{..<n0}. K i"

296 have "disjoint_family_on K {..<n0}" using K \<open>disjoint_family D\<close>

297 unfolding disjoint_family_on_def by blast

298 hence mK: "measure M ?K = (\<Sum>i<n0. measure M (K i))" using K

299 by (intro finite_measure_finite_Union) (auto simp: sb compact_imp_closed)

300 have "measure M (\<Union>i. D i) < (\<Sum>i<n0. measure M (D i)) + e/2" using n0 by simp

301 also have "(\<Sum>i<n0. measure M (D i)) \<le> (\<Sum>i<n0. measure M (K i) + e/(2*Suc n0))"

302 using K \<open>0 < e\<close>

303 by (auto intro: setsum_mono simp: emeasure_eq_measure measure_nonneg ennreal_plus[symmetric] simp del: ennreal_plus)

304 also have "\<dots> = (\<Sum>i<n0. measure M (K i)) + (\<Sum>i<n0. e/(2*Suc n0))"

305 by (simp add: setsum.distrib)

306 also have "\<dots> \<le> (\<Sum>i<n0. measure M (K i)) + e / 2" using \<open>0 < e\<close>

307 by (auto simp: field_simps intro!: mult_left_mono)

308 finally

309 have "measure M (\<Union>i. D i) < (\<Sum>i<n0. measure M (K i)) + e / 2 + e / 2"

310 by auto

311 hence "M (\<Union>i. D i) < M ?K + e"

312 using \<open>0<e\<close> by (auto simp: mK emeasure_eq_measure measure_nonneg setsum_nonneg ennreal_less_iff ennreal_plus[symmetric] simp del: ennreal_plus)

313 moreover

314 have "?K \<subseteq> (\<Union>i. D i)" using K by auto

315 moreover

316 have "compact ?K" using K by auto

317 ultimately

318 have "?K\<subseteq>(\<Union>i. D i) \<and> compact ?K \<and> emeasure M (\<Union>i. D i) \<le> emeasure M ?K + ennreal e" by simp

319 thus "\<exists>K\<subseteq>\<Union>i. D i. compact K \<and> emeasure M (\<Union>i. D i) \<le> emeasure M K + ennreal e" ..

320 qed fact

321 case 2

322 show ?case

323 proof (rule approx_outer[OF \<open>(\<Union>i. D i) \<in> sets M\<close>])

324 fix e::real assume "e > 0"

325 have "\<forall>i::nat. \<exists>U. D i \<subseteq> U \<and> open U \<and> e/(2 powr Suc i) > emeasure M U - emeasure M (D i)"

326 proof

327 fix i::nat

328 from \<open>0 < e\<close> have "0 < e/(2 powr Suc i)" by simp

329 have "emeasure M (D i) = (INF U:{U. (D i) \<subseteq> U \<and> open U}. emeasure M U)"

330 using union by blast

331 from INF_approx_ennreal[OF \<open>0 < e/(2 powr Suc i)\<close> this]

332 show "\<exists>U. D i \<subseteq> U \<and> open U \<and> e/(2 powr Suc i) > emeasure M U - emeasure M (D i)"

333 using \<open>0<e\<close>

334 by (auto simp: emeasure_eq_measure measure_nonneg setsum_nonneg ennreal_less_iff ennreal_plus[symmetric] ennreal_minus

335 finite_measure_mono sb

336 simp del: ennreal_plus)

337 qed

338 then obtain U where U: "\<And>i. D i \<subseteq> U i" "\<And>i. open (U i)"

339 "\<And>i. e/(2 powr Suc i) > emeasure M (U i) - emeasure M (D i)"

340 unfolding choice_iff by blast

341 let ?U = "\<Union>i. U i"

342 have "ennreal (measure M ?U - measure M (\<Union>i. D i)) = M ?U - M (\<Union>i. D i)"

343 using U(1,2)

344 by (subst ennreal_minus[symmetric])

345 (auto intro!: finite_measure_mono simp: sb measure_nonneg emeasure_eq_measure)

346 also have "\<dots> = M (?U - (\<Union>i. D i))" using U \<open>(\<Union>i. D i) \<in> sets M\<close>

347 by (subst emeasure_Diff) (auto simp: sb)

348 also have "\<dots> \<le> M (\<Union>i. U i - D i)" using U \<open>range D \<subseteq> sets M\<close>

349 by (intro emeasure_mono) (auto simp: sb intro!: sets.countable_nat_UN sets.Diff)

350 also have "\<dots> \<le> (\<Sum>i. M (U i - D i))" using U \<open>range D \<subseteq> sets M\<close>

351 by (intro emeasure_subadditive_countably) (auto intro!: sets.Diff simp: sb)

352 also have "\<dots> \<le> (\<Sum>i. ennreal e/(2 powr Suc i))" using U \<open>range D \<subseteq> sets M\<close>

353 using \<open>0<e\<close>

354 by (intro suminf_le, subst emeasure_Diff)

355 (auto simp: emeasure_Diff emeasure_eq_measure sb measure_nonneg ennreal_minus

356 finite_measure_mono divide_ennreal ennreal_less_iff

357 intro: less_imp_le)

358 also have "\<dots> \<le> (\<Sum>n. ennreal (e * (1 / 2) ^ Suc n))"

359 using \<open>0<e\<close>

360 by (simp add: powr_minus powr_realpow field_simps divide_ennreal del: of_nat_Suc)

361 also have "\<dots> = ennreal e * (\<Sum>n. ennreal ((1 / 2) ^ Suc n))"

362 unfolding ennreal_power[symmetric]

363 using \<open>0 < e\<close>

364 by (simp add: ac_simps ennreal_mult' divide_ennreal[symmetric] divide_ennreal_def

365 ennreal_power[symmetric])

366 also have "\<dots> = ennreal e"

367 by (subst suminf_ennreal_eq[OF zero_le_power power_half_series]) auto

368 finally have "emeasure M ?U \<le> emeasure M (\<Union>i. D i) + ennreal e"

369 using \<open>0<e\<close> by (simp add: emeasure_eq_measure ennreal_plus[symmetric] measure_nonneg del: ennreal_plus)

370 moreover

371 have "(\<Union>i. D i) \<subseteq> ?U" using U by auto

372 moreover

373 have "open ?U" using U by auto

374 ultimately

375 have "(\<Union>i. D i) \<subseteq> ?U \<and> open ?U \<and> emeasure M ?U \<le> emeasure M (\<Union>i. D i) + ennreal e" by simp

376 thus "\<exists>B. (\<Union>i. D i) \<subseteq> B \<and> open B \<and> emeasure M B \<le> emeasure M (\<Union>i. D i) + ennreal e" ..

377 qed

378 qed

379 qed

381 end