author  hoelzl 
Wed, 25 Apr 2012 19:26:00 +0200  
changeset 47761  dfe747e72fa8 
parent 47694  05663f75964c 
child 49774  dfa8ddb874ce 
permissions  rwrr 
42150  1 
(* Title: HOL/Probability/Borel_Space.thy 
42067  2 
Author: Johannes Hölzl, TU München 
3 
Author: Armin Heller, TU München 

4 
*) 

38656  5 

6 
header {*Borel spaces*} 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

7 

40859  8 
theory Borel_Space 
45288  9 
imports Sigma_Algebra "~~/src/HOL/Multivariate_Analysis/Multivariate_Analysis" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

10 
begin 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

11 

38656  12 
section "Generic Borel spaces" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

13 

47694  14 
definition borel :: "'a::topological_space measure" where 
15 
"borel = sigma UNIV {S. open S}" 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

16 

47694  17 
abbreviation "borel_measurable M \<equiv> measurable M borel" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

18 

40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

19 
lemma in_borel_measurable: 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

20 
"f \<in> borel_measurable M \<longleftrightarrow> 
47694  21 
(\<forall>S \<in> sigma_sets UNIV {S. open S}. f ` S \<inter> space M \<in> sets M)" 
40859  22 
by (auto simp add: measurable_def borel_def) 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

23 

40859  24 
lemma in_borel_measurable_borel: 
38656  25 
"f \<in> borel_measurable M \<longleftrightarrow> 
40859  26 
(\<forall>S \<in> sets borel. 
38656  27 
f ` S \<inter> space M \<in> sets M)" 
40859  28 
by (auto simp add: measurable_def borel_def) 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

29 

40859  30 
lemma space_borel[simp]: "space borel = UNIV" 
31 
unfolding borel_def by auto 

38656  32 

40859  33 
lemma borel_open[simp]: 
34 
assumes "open A" shows "A \<in> sets borel" 

38656  35 
proof  
44537
c10485a6a7af
make HOLProbability respect set/pred distinction
huffman
parents:
44282
diff
changeset

36 
have "A \<in> {S. open S}" unfolding mem_Collect_eq using assms . 
47694  37 
thus ?thesis unfolding borel_def by auto 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

38 
qed 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

39 

40859  40 
lemma borel_closed[simp]: 
41 
assumes "closed A" shows "A \<in> sets borel" 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

42 
proof  
40859  43 
have "space borel  ( A) \<in> sets borel" 
44 
using assms unfolding closed_def by (blast intro: borel_open) 

38656  45 
thus ?thesis by simp 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

46 
qed 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

47 

41830  48 
lemma borel_comp[intro,simp]: "A \<in> sets borel \<Longrightarrow>  A \<in> sets borel" 
47694  49 
unfolding Compl_eq_Diff_UNIV by (intro Diff) auto 
41830  50 

47694  51 
lemma borel_measurable_vimage: 
38656  52 
fixes f :: "'a \<Rightarrow> 'x::t2_space" 
53 
assumes borel: "f \<in> borel_measurable M" 

54 
shows "f ` {x} \<inter> space M \<in> sets M" 

55 
proof (cases "x \<in> f ` space M") 

56 
case True then obtain y where "x = f y" by auto 

41969  57 
from closed_singleton[of "f y"] 
40859  58 
have "{f y} \<in> sets borel" by (rule borel_closed) 
38656  59 
with assms show ?thesis 
40859  60 
unfolding in_borel_measurable_borel `x = f y` by auto 
38656  61 
next 
62 
case False hence "f ` {x} \<inter> space M = {}" by auto 

63 
thus ?thesis by auto 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

64 
qed 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

65 

47694  66 
lemma borel_measurableI: 
38656  67 
fixes f :: "'a \<Rightarrow> 'x\<Colon>topological_space" 
68 
assumes "\<And>S. open S \<Longrightarrow> f ` S \<inter> space M \<in> sets M" 

69 
shows "f \<in> borel_measurable M" 

40859  70 
unfolding borel_def 
47694  71 
proof (rule measurable_measure_of, simp_all) 
44537
c10485a6a7af
make HOLProbability respect set/pred distinction
huffman
parents:
44282
diff
changeset

72 
fix S :: "'x set" assume "open S" thus "f ` S \<inter> space M \<in> sets M" 
c10485a6a7af
make HOLProbability respect set/pred distinction
huffman
parents:
44282
diff
changeset

73 
using assms[of S] by simp 
40859  74 
qed 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

75 

40859  76 
lemma borel_singleton[simp, intro]: 
38656  77 
fixes x :: "'a::t1_space" 
40859  78 
shows "A \<in> sets borel \<Longrightarrow> insert x A \<in> sets borel" 
47694  79 
proof (rule insert_in_sets) 
40859  80 
show "{x} \<in> sets borel" 
41969  81 
using closed_singleton[of x] by (rule borel_closed) 
38656  82 
qed simp 
83 

47694  84 
lemma borel_measurable_const[simp, intro]: 
38656  85 
"(\<lambda>x. c) \<in> borel_measurable M" 
47694  86 
by auto 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

87 

47694  88 
lemma borel_measurable_indicator[simp, intro!]: 
38656  89 
assumes A: "A \<in> sets M" 
90 
shows "indicator A \<in> borel_measurable M" 

46905  91 
unfolding indicator_def [abs_def] using A 
47694  92 
by (auto intro!: measurable_If_set) 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

93 

47694  94 
lemma borel_measurable_indicator_iff: 
40859  95 
"(indicator A :: 'a \<Rightarrow> 'x::{t1_space, zero_neq_one}) \<in> borel_measurable M \<longleftrightarrow> A \<inter> space M \<in> sets M" 
96 
(is "?I \<in> borel_measurable M \<longleftrightarrow> _") 

97 
proof 

98 
assume "?I \<in> borel_measurable M" 

99 
then have "?I ` {1} \<inter> space M \<in> sets M" 

100 
unfolding measurable_def by auto 

101 
also have "?I ` {1} \<inter> space M = A \<inter> space M" 

46905  102 
unfolding indicator_def [abs_def] by auto 
40859  103 
finally show "A \<inter> space M \<in> sets M" . 
104 
next 

105 
assume "A \<inter> space M \<in> sets M" 

106 
moreover have "?I \<in> borel_measurable M \<longleftrightarrow> 

107 
(indicator (A \<inter> space M) :: 'a \<Rightarrow> 'x) \<in> borel_measurable M" 

108 
by (intro measurable_cong) (auto simp: indicator_def) 

109 
ultimately show "?I \<in> borel_measurable M" by auto 

110 
qed 

111 

47694  112 
lemma borel_measurable_subalgebra: 
41545  113 
assumes "sets N \<subseteq> sets M" "space N = space M" "f \<in> borel_measurable N" 
39092  114 
shows "f \<in> borel_measurable M" 
115 
using assms unfolding measurable_def by auto 

116 

38656  117 
section "Borel spaces on euclidean spaces" 
118 

119 
lemma lessThan_borel[simp, intro]: 

120 
fixes a :: "'a\<Colon>ordered_euclidean_space" 

40859  121 
shows "{..< a} \<in> sets borel" 
122 
by (blast intro: borel_open) 

38656  123 

124 
lemma greaterThan_borel[simp, intro]: 

125 
fixes a :: "'a\<Colon>ordered_euclidean_space" 

40859  126 
shows "{a <..} \<in> sets borel" 
127 
by (blast intro: borel_open) 

38656  128 

129 
lemma greaterThanLessThan_borel[simp, intro]: 

130 
fixes a b :: "'a\<Colon>ordered_euclidean_space" 

40859  131 
shows "{a<..<b} \<in> sets borel" 
132 
by (blast intro: borel_open) 

38656  133 

134 
lemma atMost_borel[simp, intro]: 

135 
fixes a :: "'a\<Colon>ordered_euclidean_space" 

40859  136 
shows "{..a} \<in> sets borel" 
137 
by (blast intro: borel_closed) 

38656  138 

139 
lemma atLeast_borel[simp, intro]: 

140 
fixes a :: "'a\<Colon>ordered_euclidean_space" 

40859  141 
shows "{a..} \<in> sets borel" 
142 
by (blast intro: borel_closed) 

38656  143 

144 
lemma atLeastAtMost_borel[simp, intro]: 

145 
fixes a b :: "'a\<Colon>ordered_euclidean_space" 

40859  146 
shows "{a..b} \<in> sets borel" 
147 
by (blast intro: borel_closed) 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

148 

38656  149 
lemma greaterThanAtMost_borel[simp, intro]: 
150 
fixes a b :: "'a\<Colon>ordered_euclidean_space" 

40859  151 
shows "{a<..b} \<in> sets borel" 
38656  152 
unfolding greaterThanAtMost_def by blast 
153 

154 
lemma atLeastLessThan_borel[simp, intro]: 

155 
fixes a b :: "'a\<Colon>ordered_euclidean_space" 

40859  156 
shows "{a..<b} \<in> sets borel" 
38656  157 
unfolding atLeastLessThan_def by blast 
158 

159 
lemma hafspace_less_borel[simp, intro]: 

160 
fixes a :: real 

40859  161 
shows "{x::'a::euclidean_space. a < x $$ i} \<in> sets borel" 
162 
by (auto intro!: borel_open open_halfspace_component_gt) 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

163 

38656  164 
lemma hafspace_greater_borel[simp, intro]: 
165 
fixes a :: real 

40859  166 
shows "{x::'a::euclidean_space. x $$ i < a} \<in> sets borel" 
167 
by (auto intro!: borel_open open_halfspace_component_lt) 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

168 

38656  169 
lemma hafspace_less_eq_borel[simp, intro]: 
170 
fixes a :: real 

40859  171 
shows "{x::'a::euclidean_space. a \<le> x $$ i} \<in> sets borel" 
172 
by (auto intro!: borel_closed closed_halfspace_component_ge) 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

173 

38656  174 
lemma hafspace_greater_eq_borel[simp, intro]: 
175 
fixes a :: real 

40859  176 
shows "{x::'a::euclidean_space. x $$ i \<le> a} \<in> sets borel" 
177 
by (auto intro!: borel_closed closed_halfspace_component_le) 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

178 

47694  179 
lemma borel_measurable_less[simp, intro]: 
38656  180 
fixes f :: "'a \<Rightarrow> real" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

181 
assumes f: "f \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

182 
assumes g: "g \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

183 
shows "{w \<in> space M. f w < g w} \<in> sets M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

184 
proof  
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

185 
have "{w \<in> space M. f w < g w} = 
38656  186 
(\<Union>r. (f ` {..< of_rat r} \<inter> space M) \<inter> (g ` {of_rat r <..} \<inter> space M))" 
187 
using Rats_dense_in_real by (auto simp add: Rats_def) 

188 
then show ?thesis using f g 

189 
by simp (blast intro: measurable_sets) 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

190 
qed 
38656  191 

47694  192 
lemma borel_measurable_le[simp, intro]: 
38656  193 
fixes f :: "'a \<Rightarrow> real" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

194 
assumes f: "f \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

195 
assumes g: "g \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

196 
shows "{w \<in> space M. f w \<le> g w} \<in> sets M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

197 
proof  
38656  198 
have "{w \<in> space M. f w \<le> g w} = space M  {w \<in> space M. g w < f w}" 
199 
by auto 

200 
thus ?thesis using f g 

201 
by simp blast 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

202 
qed 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

203 

47694  204 
lemma borel_measurable_eq[simp, intro]: 
38656  205 
fixes f :: "'a \<Rightarrow> real" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

206 
assumes f: "f \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

207 
assumes g: "g \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

208 
shows "{w \<in> space M. f w = g w} \<in> sets M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

209 
proof  
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

210 
have "{w \<in> space M. f w = g w} = 
33536  211 
{w \<in> space M. f w \<le> g w} \<inter> {w \<in> space M. g w \<le> f w}" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

212 
by auto 
38656  213 
thus ?thesis using f g by auto 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

214 
qed 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

215 

47694  216 
lemma borel_measurable_neq[simp, intro]: 
38656  217 
fixes f :: "'a \<Rightarrow> real" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

218 
assumes f: "f \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

219 
assumes g: "g \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

220 
shows "{w \<in> space M. f w \<noteq> g w} \<in> sets M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

221 
proof  
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

222 
have "{w \<in> space M. f w \<noteq> g w} = space M  {w \<in> space M. f w = g w}" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

223 
by auto 
38656  224 
thus ?thesis using f g by auto 
225 
qed 

226 

227 
subsection "Borel space equals sigma algebras over intervals" 

228 

229 
lemma rational_boxes: 

230 
fixes x :: "'a\<Colon>ordered_euclidean_space" 

231 
assumes "0 < e" 

232 
shows "\<exists>a b. (\<forall>i. a $$ i \<in> \<rat>) \<and> (\<forall>i. b $$ i \<in> \<rat>) \<and> x \<in> {a <..< b} \<and> {a <..< b} \<subseteq> ball x e" 

233 
proof  

234 
def e' \<equiv> "e / (2 * sqrt (real (DIM ('a))))" 

235 
then have e: "0 < e'" using assms by (auto intro!: divide_pos_pos) 

236 
have "\<forall>i. \<exists>y. y \<in> \<rat> \<and> y < x $$ i \<and> x $$ i  y < e'" (is "\<forall>i. ?th i") 

237 
proof 

238 
fix i from Rats_dense_in_real[of "x $$ i  e'" "x $$ i"] e 

239 
show "?th i" by auto 

240 
qed 

241 
from choice[OF this] guess a .. note a = this 

242 
have "\<forall>i. \<exists>y. y \<in> \<rat> \<and> x $$ i < y \<and> y  x $$ i < e'" (is "\<forall>i. ?th i") 

243 
proof 

244 
fix i from Rats_dense_in_real[of "x $$ i" "x $$ i + e'"] e 

245 
show "?th i" by auto 

246 
qed 

247 
from choice[OF this] guess b .. note b = this 

248 
{ fix y :: 'a assume *: "Chi a < y" "y < Chi b" 

249 
have "dist x y = sqrt (\<Sum>i<DIM('a). (dist (x $$ i) (y $$ i))\<twosuperior>)" 

250 
unfolding setL2_def[symmetric] by (rule euclidean_dist_l2) 

251 
also have "\<dots> < sqrt (\<Sum>i<DIM('a). e^2 / real (DIM('a)))" 

252 
proof (rule real_sqrt_less_mono, rule setsum_strict_mono) 

253 
fix i assume i: "i \<in> {..<DIM('a)}" 

254 
have "a i < y$$i \<and> y$$i < b i" using * i eucl_less[where 'a='a] by auto 

255 
moreover have "a i < x$$i" "x$$i  a i < e'" using a by auto 

256 
moreover have "x$$i < b i" "b i  x$$i < e'" using b by auto 

257 
ultimately have "\<bar>x$$i  y$$i\<bar> < 2 * e'" by auto 

258 
then have "dist (x $$ i) (y $$ i) < e/sqrt (real (DIM('a)))" 

259 
unfolding e'_def by (auto simp: dist_real_def) 

260 
then have "(dist (x $$ i) (y $$ i))\<twosuperior> < (e/sqrt (real (DIM('a))))\<twosuperior>" 

261 
by (rule power_strict_mono) auto 

262 
then show "(dist (x $$ i) (y $$ i))\<twosuperior> < e\<twosuperior> / real DIM('a)" 

263 
by (simp add: power_divide) 

264 
qed auto 

265 
also have "\<dots> = e" using `0 < e` by (simp add: real_eq_of_nat DIM_positive) 

266 
finally have "dist x y < e" . } 

267 
with a b show ?thesis 

268 
apply (rule_tac exI[of _ "Chi a"]) 

269 
apply (rule_tac exI[of _ "Chi b"]) 

270 
using eucl_less[where 'a='a] by auto 

271 
qed 

272 

273 
lemma ex_rat_list: 

274 
fixes x :: "'a\<Colon>ordered_euclidean_space" 

275 
assumes "\<And> i. x $$ i \<in> \<rat>" 

276 
shows "\<exists> r. length r = DIM('a) \<and> (\<forall> i < DIM('a). of_rat (r ! i) = x $$ i)" 

277 
proof  

278 
have "\<forall>i. \<exists>r. x $$ i = of_rat r" using assms unfolding Rats_def by blast 

279 
from choice[OF this] guess r .. 

280 
then show ?thesis by (auto intro!: exI[of _ "map r [0 ..< DIM('a)]"]) 

281 
qed 

282 

283 
lemma open_UNION: 

284 
fixes M :: "'a\<Colon>ordered_euclidean_space set" 

285 
assumes "open M" 

286 
shows "M = UNION {(a, b)  a b. {Chi (of_rat \<circ> op ! a) <..< Chi (of_rat \<circ> op ! b)} \<subseteq> M} 

287 
(\<lambda> (a, b). {Chi (of_rat \<circ> op ! a) <..< Chi (of_rat \<circ> op ! b)})" 

288 
(is "M = UNION ?idx ?box") 

289 
proof safe 

290 
fix x assume "x \<in> M" 

291 
obtain e where e: "e > 0" "ball x e \<subseteq> M" 

292 
using openE[OF assms `x \<in> M`] by auto 

293 
then obtain a b where ab: "x \<in> {a <..< b}" "\<And>i. a $$ i \<in> \<rat>" "\<And>i. b $$ i \<in> \<rat>" "{a <..< b} \<subseteq> ball x e" 

294 
using rational_boxes[OF e(1)] by blast 

295 
then obtain p q where pq: "length p = DIM ('a)" 

296 
"length q = DIM ('a)" 

297 
"\<forall> i < DIM ('a). of_rat (p ! i) = a $$ i \<and> of_rat (q ! i) = b $$ i" 

298 
using ex_rat_list[OF ab(2)] ex_rat_list[OF ab(3)] by blast 

299 
hence p: "Chi (of_rat \<circ> op ! p) = a" 

300 
using euclidean_eq[of "Chi (of_rat \<circ> op ! p)" a] 

301 
unfolding o_def by auto 

302 
from pq have q: "Chi (of_rat \<circ> op ! q) = b" 

303 
using euclidean_eq[of "Chi (of_rat \<circ> op ! q)" b] 

304 
unfolding o_def by auto 

305 
have "x \<in> ?box (p, q)" 

306 
using p q ab by auto 

307 
thus "x \<in> UNION ?idx ?box" using ab e p q exI[of _ p] exI[of _ q] by auto 

308 
qed auto 

309 

47694  310 
lemma borel_sigma_sets_subset: 
311 
"A \<subseteq> sets borel \<Longrightarrow> sigma_sets UNIV A \<subseteq> sets borel" 

312 
using sigma_sets_subset[of A borel] by simp 

313 

314 
lemma borel_eq_sigmaI1: 

315 
fixes F :: "'i \<Rightarrow> 'a::topological_space set" and X :: "'a::topological_space set set" 

316 
assumes borel_eq: "borel = sigma UNIV X" 

317 
assumes X: "\<And>x. x \<in> X \<Longrightarrow> x \<in> sets (sigma UNIV (range F))" 

318 
assumes F: "\<And>i. F i \<in> sets borel" 

319 
shows "borel = sigma UNIV (range F)" 

320 
unfolding borel_def 

321 
proof (intro sigma_eqI antisym) 

322 
have borel_rev_eq: "sigma_sets UNIV {S::'a set. open S} = sets borel" 

323 
unfolding borel_def by simp 

324 
also have "\<dots> = sigma_sets UNIV X" 

325 
unfolding borel_eq by simp 

326 
also have "\<dots> \<subseteq> sigma_sets UNIV (range F)" 

327 
using X by (intro sigma_algebra.sigma_sets_subset[OF sigma_algebra_sigma_sets]) auto 

328 
finally show "sigma_sets UNIV {S. open S} \<subseteq> sigma_sets UNIV (range F)" . 

329 
show "sigma_sets UNIV (range F) \<subseteq> sigma_sets UNIV {S. open S}" 

330 
unfolding borel_rev_eq using F by (intro borel_sigma_sets_subset) auto 

331 
qed auto 

38656  332 

47694  333 
lemma borel_eq_sigmaI2: 
334 
fixes F :: "'i \<Rightarrow> 'j \<Rightarrow> 'a::topological_space set" 

335 
and G :: "'l \<Rightarrow> 'k \<Rightarrow> 'a::topological_space set" 

336 
assumes borel_eq: "borel = sigma UNIV (range (\<lambda>(i, j). G i j))" 

337 
assumes X: "\<And>i j. G i j \<in> sets (sigma UNIV (range (\<lambda>(i, j). F i j)))" 

338 
assumes F: "\<And>i j. F i j \<in> sets borel" 

339 
shows "borel = sigma UNIV (range (\<lambda>(i, j). F i j))" 

340 
using assms by (intro borel_eq_sigmaI1[where X="range (\<lambda>(i, j). G i j)" and F="(\<lambda>(i, j). F i j)"]) auto 

341 

342 
lemma borel_eq_sigmaI3: 

343 
fixes F :: "'i \<Rightarrow> 'j \<Rightarrow> 'a::topological_space set" and X :: "'a::topological_space set set" 

344 
assumes borel_eq: "borel = sigma UNIV X" 

345 
assumes X: "\<And>x. x \<in> X \<Longrightarrow> x \<in> sets (sigma UNIV (range (\<lambda>(i, j). F i j)))" 

346 
assumes F: "\<And>i j. F i j \<in> sets borel" 

347 
shows "borel = sigma UNIV (range (\<lambda>(i, j). F i j))" 

348 
using assms by (intro borel_eq_sigmaI1[where X=X and F="(\<lambda>(i, j). F i j)"]) auto 

349 

350 
lemma borel_eq_sigmaI4: 

351 
fixes F :: "'i \<Rightarrow> 'a::topological_space set" 

352 
and G :: "'l \<Rightarrow> 'k \<Rightarrow> 'a::topological_space set" 

353 
assumes borel_eq: "borel = sigma UNIV (range (\<lambda>(i, j). G i j))" 

354 
assumes X: "\<And>i j. G i j \<in> sets (sigma UNIV (range F))" 

355 
assumes F: "\<And>i. F i \<in> sets borel" 

356 
shows "borel = sigma UNIV (range F)" 

357 
using assms by (intro borel_eq_sigmaI1[where X="range (\<lambda>(i, j). G i j)" and F=F]) auto 

358 

359 
lemma borel_eq_sigmaI5: 

360 
fixes F :: "'i \<Rightarrow> 'j \<Rightarrow> 'a::topological_space set" and G :: "'l \<Rightarrow> 'a::topological_space set" 

361 
assumes borel_eq: "borel = sigma UNIV (range G)" 

362 
assumes X: "\<And>i. G i \<in> sets (sigma UNIV (range (\<lambda>(i, j). F i j)))" 

363 
assumes F: "\<And>i j. F i j \<in> sets borel" 

364 
shows "borel = sigma UNIV (range (\<lambda>(i, j). F i j))" 

365 
using assms by (intro borel_eq_sigmaI1[where X="range G" and F="(\<lambda>(i, j). F i j)"]) auto 

38656  366 

367 
lemma halfspace_gt_in_halfspace: 

47694  368 
"{x\<Colon>'a. a < x $$ i} \<in> sigma_sets UNIV (range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i < a}))" 
369 
(is "?set \<in> ?SIGMA") 

38656  370 
proof  
47694  371 
interpret sigma_algebra UNIV ?SIGMA 
372 
by (intro sigma_algebra_sigma_sets) simp_all 

373 
have *: "?set = (\<Union>n. UNIV  {x\<Colon>'a. x $$ i < a + 1 / real (Suc n)})" 

38656  374 
proof (safe, simp_all add: not_less) 
375 
fix x assume "a < x $$ i" 

376 
with reals_Archimedean[of "x $$ i  a"] 

377 
obtain n where "a + 1 / real (Suc n) < x $$ i" 

378 
by (auto simp: inverse_eq_divide field_simps) 

379 
then show "\<exists>n. a + 1 / real (Suc n) \<le> x $$ i" 

380 
by (blast intro: less_imp_le) 

381 
next 

382 
fix x n 

383 
have "a < a + 1 / real (Suc n)" by auto 

384 
also assume "\<dots> \<le> x" 

385 
finally show "a < x" . 

386 
qed 

47694  387 
show "?set \<in> ?SIGMA" unfolding * 
388 
by (auto intro!: Diff) 

40859  389 
qed 
38656  390 

47694  391 
lemma borel_eq_halfspace_less: 
392 
"borel = sigma UNIV (range (\<lambda>(a, i). {x::'a::ordered_euclidean_space. x $$ i < a}))" 

393 
(is "_ = ?SIGMA") 

394 
proof (rule borel_eq_sigmaI3[OF borel_def]) 

395 
fix S :: "'a set" assume "S \<in> {S. open S}" 

396 
then have "open S" by simp 

397 
from open_UNION[OF this] 

398 
obtain I where *: "S = 

399 
(\<Union>(a, b)\<in>I. 

400 
(\<Inter> i<DIM('a). {x. (Chi (real_of_rat \<circ> op ! a)::'a) $$ i < x $$ i}) \<inter> 

401 
(\<Inter> i<DIM('a). {x. x $$ i < (Chi (real_of_rat \<circ> op ! b)::'a) $$ i}))" 

402 
unfolding greaterThanLessThan_def 

403 
unfolding eucl_greaterThan_eq_halfspaces[where 'a='a] 

404 
unfolding eucl_lessThan_eq_halfspaces[where 'a='a] 

405 
by blast 

406 
show "S \<in> ?SIGMA" 

407 
unfolding * 

408 
by (safe intro!: countable_UN Int countable_INT) (auto intro!: halfspace_gt_in_halfspace) 

409 
qed auto 

38656  410 

47694  411 
lemma borel_eq_halfspace_le: 
412 
"borel = sigma UNIV (range (\<lambda> (a, i). {x::'a::ordered_euclidean_space. x $$ i \<le> a}))" 

413 
(is "_ = ?SIGMA") 

414 
proof (rule borel_eq_sigmaI2[OF borel_eq_halfspace_less]) 

415 
fix a i 

416 
have *: "{x::'a. x$$i < a} = (\<Union>n. {x. x$$i \<le> a  1/real (Suc n)})" 

417 
proof (safe, simp_all) 

418 
fix x::'a assume *: "x$$i < a" 

419 
with reals_Archimedean[of "a  x$$i"] 

420 
obtain n where "x $$ i < a  1 / (real (Suc n))" 

421 
by (auto simp: field_simps inverse_eq_divide) 

422 
then show "\<exists>n. x $$ i \<le> a  1 / (real (Suc n))" 

423 
by (blast intro: less_imp_le) 

424 
next 

425 
fix x::'a and n 

426 
assume "x$$i \<le> a  1 / real (Suc n)" 

427 
also have "\<dots> < a" by auto 

428 
finally show "x$$i < a" . 

429 
qed 

430 
show "{x. x$$i < a} \<in> ?SIGMA" unfolding * 

431 
by (safe intro!: countable_UN) auto 

432 
qed auto 

38656  433 

47694  434 
lemma borel_eq_halfspace_ge: 
435 
"borel = sigma UNIV (range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. a \<le> x $$ i}))" 

436 
(is "_ = ?SIGMA") 

437 
proof (rule borel_eq_sigmaI2[OF borel_eq_halfspace_less]) 

438 
fix a i have *: "{x::'a. x$$i < a} = space ?SIGMA  {x::'a. a \<le> x$$i}" by auto 

439 
show "{x. x$$i < a} \<in> ?SIGMA" unfolding * 

440 
by (safe intro!: compl_sets) auto 

441 
qed auto 

38656  442 

47694  443 
lemma borel_eq_halfspace_greater: 
444 
"borel = sigma UNIV (range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. a < x $$ i}))" 

445 
(is "_ = ?SIGMA") 

446 
proof (rule borel_eq_sigmaI2[OF borel_eq_halfspace_le]) 

447 
fix a i have *: "{x::'a. x$$i \<le> a} = space ?SIGMA  {x::'a. a < x$$i}" by auto 

448 
show "{x. x$$i \<le> a} \<in> ?SIGMA" unfolding * 

449 
by (safe intro!: compl_sets) auto 

450 
qed auto 

451 

452 
lemma borel_eq_atMost: 

453 
"borel = sigma UNIV (range (\<lambda>a. {..a\<Colon>'a\<Colon>ordered_euclidean_space}))" 

454 
(is "_ = ?SIGMA") 

455 
proof (rule borel_eq_sigmaI4[OF borel_eq_halfspace_le]) 

456 
fix a i show "{x. x$$i \<le> a} \<in> ?SIGMA" 

38656  457 
proof cases 
47694  458 
assume "i < DIM('a)" 
38656  459 
then have *: "{x::'a. x$$i \<le> a} = (\<Union>k::nat. {.. (\<chi>\<chi> n. if n = i then a else real k)})" 
460 
proof (safe, simp_all add: eucl_le[where 'a='a] split: split_if_asm) 

461 
fix x 

462 
from real_arch_simple[of "Max ((\<lambda>i. x$$i)`{..<DIM('a)})"] guess k::nat .. 

463 
then have "\<And>i. i < DIM('a) \<Longrightarrow> x$$i \<le> real k" 

464 
by (subst (asm) Max_le_iff) auto 

465 
then show "\<exists>k::nat. \<forall>ia. ia \<noteq> i \<longrightarrow> ia < DIM('a) \<longrightarrow> x $$ ia \<le> real k" 

466 
by (auto intro!: exI[of _ k]) 

467 
qed 

47694  468 
show "{x. x$$i \<le> a} \<in> ?SIGMA" unfolding * 
469 
by (safe intro!: countable_UN) auto 

470 
qed (auto intro: sigma_sets_top sigma_sets.Empty) 

471 
qed auto 

38656  472 

47694  473 
lemma borel_eq_greaterThan: 
474 
"borel = sigma UNIV (range (\<lambda>a\<Colon>'a\<Colon>ordered_euclidean_space. {a<..}))" 

475 
(is "_ = ?SIGMA") 

476 
proof (rule borel_eq_sigmaI4[OF borel_eq_halfspace_le]) 

477 
fix a i show "{x. x$$i \<le> a} \<in> ?SIGMA" 

38656  478 
proof cases 
47694  479 
assume "i < DIM('a)" 
480 
have "{x::'a. x$$i \<le> a} = UNIV  {x::'a. a < x$$i}" by auto 

38656  481 
also have *: "{x::'a. a < x$$i} = (\<Union>k::nat. {(\<chi>\<chi> n. if n = i then a else real k) <..})" using `i <DIM('a)` 
482 
proof (safe, simp_all add: eucl_less[where 'a='a] split: split_if_asm) 

483 
fix x 

44666  484 
from reals_Archimedean2[of "Max ((\<lambda>i. x$$i)`{..<DIM('a)})"] 
38656  485 
guess k::nat .. note k = this 
486 
{ fix i assume "i < DIM('a)" 

487 
then have "x$$i < real k" 

488 
using k by (subst (asm) Max_less_iff) auto 

489 
then have " real k < x$$i" by simp } 

490 
then show "\<exists>k::nat. \<forall>ia. ia \<noteq> i \<longrightarrow> ia < DIM('a) \<longrightarrow> real k < x $$ ia" 

491 
by (auto intro!: exI[of _ k]) 

492 
qed 

47694  493 
finally show "{x. x$$i \<le> a} \<in> ?SIGMA" 
38656  494 
apply (simp only:) 
495 
apply (safe intro!: countable_UN Diff) 

47694  496 
apply (auto intro: sigma_sets_top) 
46731  497 
done 
47694  498 
qed (auto intro: sigma_sets_top sigma_sets.Empty) 
499 
qed auto 

40859  500 

47694  501 
lemma borel_eq_lessThan: 
502 
"borel = sigma UNIV (range (\<lambda>a\<Colon>'a\<Colon>ordered_euclidean_space. {..<a}))" 

503 
(is "_ = ?SIGMA") 

504 
proof (rule borel_eq_sigmaI4[OF borel_eq_halfspace_ge]) 

505 
fix a i show "{x. a \<le> x$$i} \<in> ?SIGMA" 

40859  506 
proof cases 
507 
fix a i assume "i < DIM('a)" 

47694  508 
have "{x::'a. a \<le> x$$i} = UNIV  {x::'a. x$$i < a}" by auto 
40859  509 
also have *: "{x::'a. x$$i < a} = (\<Union>k::nat. {..< (\<chi>\<chi> n. if n = i then a else real k)})" using `i <DIM('a)` 
510 
proof (safe, simp_all add: eucl_less[where 'a='a] split: split_if_asm) 

511 
fix x 

44666  512 
from reals_Archimedean2[of "Max ((\<lambda>i. x$$i)`{..<DIM('a)})"] 
40859  513 
guess k::nat .. note k = this 
514 
{ fix i assume "i < DIM('a)" 

515 
then have "x$$i < real k" 

516 
using k by (subst (asm) Max_less_iff) auto 

517 
then have "x$$i < real k" by simp } 

518 
then show "\<exists>k::nat. \<forall>ia. ia \<noteq> i \<longrightarrow> ia < DIM('a) \<longrightarrow> x $$ ia < real k" 

519 
by (auto intro!: exI[of _ k]) 

520 
qed 

47694  521 
finally show "{x. a \<le> x$$i} \<in> ?SIGMA" 
40859  522 
apply (simp only:) 
523 
apply (safe intro!: countable_UN Diff) 

47694  524 
apply (auto intro: sigma_sets_top) 
46731  525 
done 
47694  526 
qed (auto intro: sigma_sets_top sigma_sets.Empty) 
40859  527 
qed auto 
528 

529 
lemma borel_eq_atLeastAtMost: 

47694  530 
"borel = sigma UNIV (range (\<lambda>(a,b). {a..b} \<Colon>'a\<Colon>ordered_euclidean_space set))" 
531 
(is "_ = ?SIGMA") 

532 
proof (rule borel_eq_sigmaI5[OF borel_eq_atMost]) 

533 
fix a::'a 

534 
have *: "{..a} = (\<Union>n::nat. { real n *\<^sub>R One .. a})" 

535 
proof (safe, simp_all add: eucl_le[where 'a='a]) 

536 
fix x 

537 
from real_arch_simple[of "Max ((\<lambda>i.  x$$i)`{..<DIM('a)})"] 

538 
guess k::nat .. note k = this 

539 
{ fix i assume "i < DIM('a)" 

540 
with k have " x$$i \<le> real k" 

541 
by (subst (asm) Max_le_iff) (auto simp: field_simps) 

542 
then have " real k \<le> x$$i" by simp } 

543 
then show "\<exists>n::nat. \<forall>i<DIM('a).  real n \<le> x $$ i" 

544 
by (auto intro!: exI[of _ k]) 

545 
qed 

546 
show "{..a} \<in> ?SIGMA" unfolding * 

547 
by (safe intro!: countable_UN) 

548 
(auto intro!: sigma_sets_top) 

40859  549 
qed auto 
550 

551 
lemma borel_eq_greaterThanLessThan: 

47694  552 
"borel = sigma UNIV (range (\<lambda> (a, b). {a <..< b} :: 'a \<Colon> ordered_euclidean_space set))" 
40859  553 
(is "_ = ?SIGMA") 
47694  554 
proof (rule borel_eq_sigmaI1[OF borel_def]) 
555 
fix M :: "'a set" assume "M \<in> {S. open S}" 

556 
then have "open M" by simp 

557 
show "M \<in> ?SIGMA" 

558 
apply (subst open_UNION[OF `open M`]) 

559 
apply (safe intro!: countable_UN) 

560 
apply auto 

561 
done 

38656  562 
qed auto 
563 

42862  564 
lemma borel_eq_atLeastLessThan: 
47694  565 
"borel = sigma UNIV (range (\<lambda>(a, b). {a ..< b :: real}))" (is "_ = ?SIGMA") 
566 
proof (rule borel_eq_sigmaI5[OF borel_eq_lessThan]) 

567 
have move_uminus: "\<And>x y::real. x \<le> y \<longleftrightarrow> y \<le> x" by auto 

568 
fix x :: real 

569 
have "{..<x} = (\<Union>i::nat. {real i ..< x})" 

570 
by (auto simp: move_uminus real_arch_simple) 

571 
then show "{..< x} \<in> ?SIGMA" 

572 
by (auto intro: sigma_sets.intros) 

40859  573 
qed auto 
574 

47694  575 
lemma borel_measurable_halfspacesI: 
38656  576 
fixes f :: "'a \<Rightarrow> 'c\<Colon>ordered_euclidean_space" 
47694  577 
assumes F: "borel = sigma UNIV (range F)" 
578 
and S_eq: "\<And>a i. S a i = f ` F (a,i) \<inter> space M" 

579 
and S: "\<And>a i. \<not> i < DIM('c) \<Longrightarrow> S a i \<in> sets M" 

38656  580 
shows "f \<in> borel_measurable M = (\<forall>i<DIM('c). \<forall>a::real. S a i \<in> sets M)" 
581 
proof safe 

582 
fix a :: real and i assume i: "i < DIM('c)" and f: "f \<in> borel_measurable M" 

583 
then show "S a i \<in> sets M" unfolding assms 

47694  584 
by (auto intro!: measurable_sets sigma_sets.Basic simp: assms(1)) 
38656  585 
next 
586 
assume a: "\<forall>i<DIM('c). \<forall>a. S a i \<in> sets M" 

587 
{ fix a i have "S a i \<in> sets M" 

588 
proof cases 

589 
assume "i < DIM('c)" 

590 
with a show ?thesis unfolding assms(2) by simp 

591 
next 

592 
assume "\<not> i < DIM('c)" 

47694  593 
from S[OF this] show ?thesis . 
38656  594 
qed } 
47694  595 
then show "f \<in> borel_measurable M" 
596 
by (auto intro!: measurable_measure_of simp: S_eq F) 

38656  597 
qed 
598 

47694  599 
lemma borel_measurable_iff_halfspace_le: 
38656  600 
fixes f :: "'a \<Rightarrow> 'c\<Colon>ordered_euclidean_space" 
601 
shows "f \<in> borel_measurable M = (\<forall>i<DIM('c). \<forall>a. {w \<in> space M. f w $$ i \<le> a} \<in> sets M)" 

40859  602 
by (rule borel_measurable_halfspacesI[OF borel_eq_halfspace_le]) auto 
38656  603 

47694  604 
lemma borel_measurable_iff_halfspace_less: 
38656  605 
fixes f :: "'a \<Rightarrow> 'c\<Colon>ordered_euclidean_space" 
606 
shows "f \<in> borel_measurable M \<longleftrightarrow> (\<forall>i<DIM('c). \<forall>a. {w \<in> space M. f w $$ i < a} \<in> sets M)" 

40859  607 
by (rule borel_measurable_halfspacesI[OF borel_eq_halfspace_less]) auto 
38656  608 

47694  609 
lemma borel_measurable_iff_halfspace_ge: 
38656  610 
fixes f :: "'a \<Rightarrow> 'c\<Colon>ordered_euclidean_space" 
611 
shows "f \<in> borel_measurable M = (\<forall>i<DIM('c). \<forall>a. {w \<in> space M. a \<le> f w $$ i} \<in> sets M)" 

40859  612 
by (rule borel_measurable_halfspacesI[OF borel_eq_halfspace_ge]) auto 
38656  613 

47694  614 
lemma borel_measurable_iff_halfspace_greater: 
38656  615 
fixes f :: "'a \<Rightarrow> 'c\<Colon>ordered_euclidean_space" 
616 
shows "f \<in> borel_measurable M \<longleftrightarrow> (\<forall>i<DIM('c). \<forall>a. {w \<in> space M. a < f w $$ i} \<in> sets M)" 

47694  617 
by (rule borel_measurable_halfspacesI[OF borel_eq_halfspace_greater]) auto 
38656  618 

47694  619 
lemma borel_measurable_iff_le: 
38656  620 
"(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. f w \<le> a} \<in> sets M)" 
621 
using borel_measurable_iff_halfspace_le[where 'c=real] by simp 

622 

47694  623 
lemma borel_measurable_iff_less: 
38656  624 
"(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. f w < a} \<in> sets M)" 
625 
using borel_measurable_iff_halfspace_less[where 'c=real] by simp 

626 

47694  627 
lemma borel_measurable_iff_ge: 
38656  628 
"(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. a \<le> f w} \<in> sets M)" 
629 
using borel_measurable_iff_halfspace_ge[where 'c=real] by simp 

630 

47694  631 
lemma borel_measurable_iff_greater: 
38656  632 
"(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. a < f w} \<in> sets M)" 
633 
using borel_measurable_iff_halfspace_greater[where 'c=real] by simp 

634 

41025  635 
lemma borel_measurable_euclidean_component: 
40859  636 
"(\<lambda>x::'a::euclidean_space. x $$ i) \<in> borel_measurable borel" 
47694  637 
proof (rule borel_measurableI) 
44537
c10485a6a7af
make HOLProbability respect set/pred distinction
huffman
parents:
44282
diff
changeset

638 
fix S::"real set" assume "open S" 
39087
96984bf6fa5b
Measurable on euclidean space is equiv. to measurable components
hoelzl
parents:
39083
diff
changeset

639 
from open_vimage_euclidean_component[OF this] 
47694  640 
show "(\<lambda>x. x $$ i) ` S \<inter> space borel \<in> sets borel" 
40859  641 
by (auto intro: borel_open) 
642 
qed 

39087
96984bf6fa5b
Measurable on euclidean space is equiv. to measurable components
hoelzl
parents:
39083
diff
changeset

643 

47694  644 
lemma borel_measurable_euclidean_space: 
39087
96984bf6fa5b
Measurable on euclidean space is equiv. to measurable components
hoelzl
parents:
39083
diff
changeset

645 
fixes f :: "'a \<Rightarrow> 'c::ordered_euclidean_space" 
96984bf6fa5b
Measurable on euclidean space is equiv. to measurable components
hoelzl
parents:
39083
diff
changeset

646 
shows "f \<in> borel_measurable M \<longleftrightarrow> (\<forall>i<DIM('c). (\<lambda>x. f x $$ i) \<in> borel_measurable M)" 
96984bf6fa5b
Measurable on euclidean space is equiv. to measurable components
hoelzl
parents:
39083
diff
changeset

647 
proof safe 
96984bf6fa5b
Measurable on euclidean space is equiv. to measurable components
hoelzl
parents:
39083
diff
changeset

648 
fix i assume "f \<in> borel_measurable M" 
96984bf6fa5b
Measurable on euclidean space is equiv. to measurable components
hoelzl
parents:
39083
diff
changeset

649 
then show "(\<lambda>x. f x $$ i) \<in> borel_measurable M" 
96984bf6fa5b
Measurable on euclidean space is equiv. to measurable components
hoelzl
parents:
39083
diff
changeset

650 
using measurable_comp[of f _ _ "\<lambda>x. x $$ i", unfolded comp_def] 
41025  651 
by (auto intro: borel_measurable_euclidean_component) 
39087
96984bf6fa5b
Measurable on euclidean space is equiv. to measurable components
hoelzl
parents:
39083
diff
changeset

652 
next 
96984bf6fa5b
Measurable on euclidean space is equiv. to measurable components
hoelzl
parents:
39083
diff
changeset

653 
assume f: "\<forall>i<DIM('c). (\<lambda>x. f x $$ i) \<in> borel_measurable M" 
96984bf6fa5b
Measurable on euclidean space is equiv. to measurable components
hoelzl
parents:
39083
diff
changeset

654 
then show "f \<in> borel_measurable M" 
96984bf6fa5b
Measurable on euclidean space is equiv. to measurable components
hoelzl
parents:
39083
diff
changeset

655 
unfolding borel_measurable_iff_halfspace_le by auto 
96984bf6fa5b
Measurable on euclidean space is equiv. to measurable components
hoelzl
parents:
39083
diff
changeset

656 
qed 
96984bf6fa5b
Measurable on euclidean space is equiv. to measurable components
hoelzl
parents:
39083
diff
changeset

657 

38656  658 
subsection "Borel measurable operators" 
659 

47694  660 
lemma affine_borel_measurable_vector: 
38656  661 
fixes f :: "'a \<Rightarrow> 'x::real_normed_vector" 
662 
assumes "f \<in> borel_measurable M" 

663 
shows "(\<lambda>x. a + b *\<^sub>R f x) \<in> borel_measurable M" 

664 
proof (rule borel_measurableI) 

665 
fix S :: "'x set" assume "open S" 

666 
show "(\<lambda>x. a + b *\<^sub>R f x) ` S \<inter> space M \<in> sets M" 

667 
proof cases 

668 
assume "b \<noteq> 0" 

44537
c10485a6a7af
make HOLProbability respect set/pred distinction
huffman
parents:
44282
diff
changeset

669 
with `open S` have "open ((\<lambda>x. ( a + x) /\<^sub>R b) ` S)" (is "open ?S") 
c10485a6a7af
make HOLProbability respect set/pred distinction
huffman
parents:
44282
diff
changeset

670 
by (auto intro!: open_affinity simp: scaleR_add_right) 
47694  671 
hence "?S \<in> sets borel" by auto 
38656  672 
moreover 
673 
from `b \<noteq> 0` have "(\<lambda>x. a + b *\<^sub>R f x) ` S = f ` ?S" 

674 
apply auto by (rule_tac x="a + b *\<^sub>R f x" in image_eqI, simp_all) 

40859  675 
ultimately show ?thesis using assms unfolding in_borel_measurable_borel 
38656  676 
by auto 
677 
qed simp 

678 
qed 

679 

47694  680 
lemma affine_borel_measurable: 
38656  681 
fixes g :: "'a \<Rightarrow> real" 
682 
assumes g: "g \<in> borel_measurable M" 

683 
shows "(\<lambda>x. a + (g x) * b) \<in> borel_measurable M" 

684 
using affine_borel_measurable_vector[OF assms] by (simp add: mult_commute) 

685 

47694  686 
lemma borel_measurable_add[simp, intro]: 
38656  687 
fixes f :: "'a \<Rightarrow> real" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

688 
assumes f: "f \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

689 
assumes g: "g \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

690 
shows "(\<lambda>x. f x + g x) \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

691 
proof  
38656  692 
have 1: "\<And>a. {w\<in>space M. a \<le> f w + g w} = {w \<in> space M. a + g w * 1 \<le> f w}" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

693 
by auto 
38656  694 
have "\<And>a. (\<lambda>w. a + (g w) * 1) \<in> borel_measurable M" 
695 
by (rule affine_borel_measurable [OF g]) 

696 
then have "\<And>a. {w \<in> space M. (\<lambda>w. a + (g w) * 1)(w) \<le> f w} \<in> sets M" using f 

697 
by auto 

698 
then have "\<And>a. {w \<in> space M. a \<le> f w + g w} \<in> sets M" 

699 
by (simp add: 1) 

700 
then show ?thesis 

701 
by (simp add: borel_measurable_iff_ge) 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

702 
qed 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

703 

47694  704 
lemma borel_measurable_setsum[simp, intro]: 
41026
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

705 
fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> real" 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

706 
assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M" 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

707 
shows "(\<lambda>x. \<Sum>i\<in>S. f i x) \<in> borel_measurable M" 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

708 
proof cases 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

709 
assume "finite S" 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

710 
thus ?thesis using assms by induct auto 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

711 
qed simp 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

712 

47694  713 
lemma borel_measurable_square: 
38656  714 
fixes f :: "'a \<Rightarrow> real" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

715 
assumes f: "f \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

716 
shows "(\<lambda>x. (f x)^2) \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

717 
proof  
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

718 
{ 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

719 
fix a 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

720 
have "{w \<in> space M. (f w)\<twosuperior> \<le> a} \<in> sets M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

721 
proof (cases rule: linorder_cases [of a 0]) 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

722 
case less 
38656  723 
hence "{w \<in> space M. (f w)\<twosuperior> \<le> a} = {}" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

724 
by auto (metis less order_le_less_trans power2_less_0) 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

725 
also have "... \<in> sets M" 
38656  726 
by (rule empty_sets) 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

727 
finally show ?thesis . 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

728 
next 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

729 
case equal 
38656  730 
hence "{w \<in> space M. (f w)\<twosuperior> \<le> a} = 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

731 
{w \<in> space M. f w \<le> 0} \<inter> {w \<in> space M. 0 \<le> f w}" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

732 
by auto 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

733 
also have "... \<in> sets M" 
38656  734 
apply (insert f) 
735 
apply (rule Int) 

736 
apply (simp add: borel_measurable_iff_le) 

737 
apply (simp add: borel_measurable_iff_ge) 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

738 
done 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

739 
finally show ?thesis . 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

740 
next 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

741 
case greater 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

742 
have "\<forall>x. (f x ^ 2 \<le> sqrt a ^ 2) = ( sqrt a \<le> f x & f x \<le> sqrt a)" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

743 
by (metis abs_le_interval_iff abs_of_pos greater real_sqrt_abs 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

744 
real_sqrt_le_iff real_sqrt_power) 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

745 
hence "{w \<in> space M. (f w)\<twosuperior> \<le> a} = 
38656  746 
{w \<in> space M. (sqrt a) \<le> f w} \<inter> {w \<in> space M. f w \<le> sqrt a}" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

747 
using greater by auto 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

748 
also have "... \<in> sets M" 
38656  749 
apply (insert f) 
750 
apply (rule Int) 

751 
apply (simp add: borel_measurable_iff_ge) 

752 
apply (simp add: borel_measurable_iff_le) 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

753 
done 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

754 
finally show ?thesis . 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

755 
qed 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

756 
} 
38656  757 
thus ?thesis by (auto simp add: borel_measurable_iff_le) 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

758 
qed 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

759 

40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

760 
lemma times_eq_sum_squares: 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

761 
fixes x::real 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

762 
shows"x*y = ((x+y)^2)/4  ((xy)^ 2)/4" 
38656  763 
by (simp add: power2_eq_square ring_distribs diff_divide_distrib [symmetric]) 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

764 

47694  765 
lemma borel_measurable_uminus[simp, intro]: 
38656  766 
fixes g :: "'a \<Rightarrow> real" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

767 
assumes g: "g \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

768 
shows "(\<lambda>x.  g x) \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

769 
proof  
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

770 
have "(\<lambda>x.  g x) = (\<lambda>x. 0 + (g x) * 1)" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

771 
by simp 
38656  772 
also have "... \<in> borel_measurable M" 
773 
by (fast intro: affine_borel_measurable g) 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

774 
finally show ?thesis . 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

775 
qed 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

776 

47694  777 
lemma borel_measurable_times[simp, intro]: 
38656  778 
fixes f :: "'a \<Rightarrow> real" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

779 
assumes f: "f \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

780 
assumes g: "g \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

781 
shows "(\<lambda>x. f x * g x) \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

782 
proof  
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

783 
have 1: "(\<lambda>x. 0 + (f x + g x)\<twosuperior> * inverse 4) \<in> borel_measurable M" 
38656  784 
using assms by (fast intro: affine_borel_measurable borel_measurable_square) 
785 
have "(\<lambda>x. ((f x + g x) ^ 2 * inverse 4)) = 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

786 
(\<lambda>x. 0 + ((f x + g x) ^ 2 * inverse 4))" 
35582  787 
by (simp add: minus_divide_right) 
38656  788 
also have "... \<in> borel_measurable M" 
789 
using f g by (fast intro: affine_borel_measurable borel_measurable_square f g) 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

790 
finally have 2: "(\<lambda>x. ((f x + g x) ^ 2 * inverse 4)) \<in> borel_measurable M" . 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

791 
show ?thesis 
38656  792 
apply (simp add: times_eq_sum_squares diff_minus) 
793 
using 1 2 by simp 

33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

794 
qed 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

795 

47694  796 
lemma borel_measurable_setprod[simp, intro]: 
41026
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

797 
fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> real" 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

798 
assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M" 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

799 
shows "(\<lambda>x. \<Prod>i\<in>S. f i x) \<in> borel_measurable M" 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

800 
proof cases 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

801 
assume "finite S" 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

802 
thus ?thesis using assms by induct auto 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

803 
qed simp 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

804 

47694  805 
lemma borel_measurable_diff[simp, intro]: 
38656  806 
fixes f :: "'a \<Rightarrow> real" 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

807 
assumes f: "f \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

808 
assumes g: "g \<in> borel_measurable M" 
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

809 
shows "(\<lambda>x. f x  g x) \<in> borel_measurable M" 
38656  810 
unfolding diff_minus using assms by fast 
33533
40b44cb20c8c
New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff
changeset

811 

47694  812 
lemma borel_measurable_inverse[simp, intro]: 
38656  813 
fixes f :: "'a \<Rightarrow> real" 
35692  814 
assumes "f \<in> borel_measurable M" 
815 
shows "(\<lambda>x. inverse (f x)) \<in> borel_measurable M" 

38656  816 
unfolding borel_measurable_iff_ge unfolding inverse_eq_divide 
817 
proof safe 

818 
fix a :: real 

819 
have *: "{w \<in> space M. a \<le> 1 / f w} = 

820 
({w \<in> space M. 0 < f w} \<inter> {w \<in> space M. a * f w \<le> 1}) \<union> 

821 
({w \<in> space M. f w < 0} \<inter> {w \<in> space M. 1 \<le> a * f w}) \<union> 

822 
({w \<in> space M. f w = 0} \<inter> {w \<in> space M. a \<le> 0})" by (auto simp: le_divide_eq) 

823 
show "{w \<in> space M. a \<le> 1 / f w} \<in> sets M" using assms unfolding * 

824 
by (auto intro!: Int Un) 

35692  825 
qed 
826 

47694  827 
lemma borel_measurable_divide[simp, intro]: 
38656  828 
fixes f :: "'a \<Rightarrow> real" 
35692  829 
assumes "f \<in> borel_measurable M" 
830 
and "g \<in> borel_measurable M" 

831 
shows "(\<lambda>x. f x / g x) \<in> borel_measurable M" 

832 
unfolding field_divide_inverse 

38656  833 
by (rule borel_measurable_inverse borel_measurable_times assms)+ 
834 

47694  835 
lemma borel_measurable_max[intro, simp]: 
38656  836 
fixes f g :: "'a \<Rightarrow> real" 
837 
assumes "f \<in> borel_measurable M" 

838 
assumes "g \<in> borel_measurable M" 

839 
shows "(\<lambda>x. max (g x) (f x)) \<in> borel_measurable M" 

840 
unfolding borel_measurable_iff_le 

841 
proof safe 

842 
fix a 

843 
have "{x \<in> space M. max (g x) (f x) \<le> a} = 

844 
{x \<in> space M. g x \<le> a} \<inter> {x \<in> space M. f x \<le> a}" by auto 

845 
thus "{x \<in> space M. max (g x) (f x) \<le> a} \<in> sets M" 

846 
using assms unfolding borel_measurable_iff_le 

847 
by (auto intro!: Int) 

848 
qed 

849 

47694  850 
lemma borel_measurable_min[intro, simp]: 
38656  851 
fixes f g :: "'a \<Rightarrow> real" 
852 
assumes "f \<in> borel_measurable M" 

853 
assumes "g \<in> borel_measurable M" 

854 
shows "(\<lambda>x. min (g x) (f x)) \<in> borel_measurable M" 

855 
unfolding borel_measurable_iff_ge 

856 
proof safe 

857 
fix a 

858 
have "{x \<in> space M. a \<le> min (g x) (f x)} = 

859 
{x \<in> space M. a \<le> g x} \<inter> {x \<in> space M. a \<le> f x}" by auto 

860 
thus "{x \<in> space M. a \<le> min (g x) (f x)} \<in> sets M" 

861 
using assms unfolding borel_measurable_iff_ge 

862 
by (auto intro!: Int) 

863 
qed 

864 

47694  865 
lemma borel_measurable_abs[simp, intro]: 
38656  866 
assumes "f \<in> borel_measurable M" 
867 
shows "(\<lambda>x. \<bar>f x :: real\<bar>) \<in> borel_measurable M" 

868 
proof  

869 
have *: "\<And>x. \<bar>f x\<bar> = max 0 (f x) + max 0 ( f x)" by (simp add: max_def) 

870 
show ?thesis unfolding * using assms by auto 

871 
qed 

872 

41026
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

873 
lemma borel_measurable_nth[simp, intro]: 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

874 
"(\<lambda>x::real^'n. x $ i) \<in> borel_measurable borel" 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

875 
using borel_measurable_euclidean_component 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

876 
unfolding nth_conv_component by auto 
bea75746dc9d
folding on arbitrary Lebesgue integrable functions
hoelzl
parents:
41025
diff
changeset

877 

41830  878 
lemma borel_measurable_continuous_on1: 
879 
fixes f :: "'a::topological_space \<Rightarrow> 'b::t1_space" 

880 
assumes "continuous_on UNIV f" 

881 
shows "f \<in> borel_measurable borel" 

47694  882 
apply(rule borel_measurableI) 
41830  883 
using continuous_open_preimage[OF assms] unfolding vimage_def by auto 
884 

885 
lemma borel_measurable_continuous_on: 

886 
fixes f :: "'a::topological_space \<Rightarrow> 'b::t1_space" 

42990
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

887 
assumes cont: "continuous_on A f" "open A" 
41830  888 
shows "(\<lambda>x. if x \<in> A then f x else c) \<in> borel_measurable borel" (is "?f \<in> _") 
47694  889 
proof (rule borel_measurableI) 
41830  890 
fix S :: "'b set" assume "open S" 
42990
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

891 
then have "open {x\<in>A. f x \<in> S}" 
41830  892 
by (intro continuous_open_preimage[OF cont]) auto 
42990
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

893 
then have *: "{x\<in>A. f x \<in> S} \<in> sets borel" by auto 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

894 
have "?f ` S \<inter> space borel = 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

895 
{x\<in>A. f x \<in> S} \<union> (if c \<in> S then space borel  A else {})" 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

896 
by (auto split: split_if_asm) 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

897 
also have "\<dots> \<in> sets borel" 
47694  898 
using * `open A` by (auto simp del: space_borel intro!: Un) 
42990
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

899 
finally show "?f ` S \<inter> space borel \<in> sets borel" . 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

900 
qed 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

901 

47694  902 
lemma convex_measurable: 
42990
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

903 
fixes a b :: real 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

904 
assumes X: "X \<in> borel_measurable M" "X ` space M \<subseteq> { a <..< b}" 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

905 
assumes q: "convex_on { a <..< b} q" 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

906 
shows "q \<circ> X \<in> borel_measurable M" 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

907 
proof  
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

908 
have "(\<lambda>x. if x \<in> {a <..< b} then q x else 0) \<in> borel_measurable borel" 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

909 
proof (rule borel_measurable_continuous_on) 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

910 
show "open {a<..<b}" by auto 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

911 
from this q show "continuous_on {a<..<b} q" 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

912 
by (rule convex_on_continuous) 
41830  913 
qed 
42990
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

914 
then have "(\<lambda>x. if x \<in> {a <..< b} then q x else 0) \<circ> X \<in> borel_measurable M" (is ?qX) 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

915 
using X by (intro measurable_comp) auto 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

916 
moreover have "?qX \<longleftrightarrow> q \<circ> X \<in> borel_measurable M" 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

917 
using X by (intro measurable_cong) auto 
3706951a6421
composition of convex and measurable function is measurable
hoelzl
parents:
42950
diff
changeset

918 
ultimately show ?thesis by simp 
41830  919 
qed 
920 

921 
lemma borel_measurable_borel_log: assumes "1 < b" shows "log b \<in> borel_measurable borel" 

922 
proof  

923 
{ fix x :: real assume x: "x \<le> 0" 

924 
{ fix x::real assume "x \<le> 0" then have "\<And>u. exp u = x \<longleftrightarrow> False" by auto } 

925 
from this[of x] x this[of 0] have "log b 0 = log b x" 

926 
by (auto simp: ln_def log_def) } 

927 
note log_imp = this 

928 
have "(\<lambda>x. if x \<in> {0<..} then log b x else log b 0) \<in> borel_measurable borel" 

929 
proof (rule borel_measurable_continuous_on) 

930 
show "continuous_on {0<..} (log b)" 

931 
by (auto intro!: continuous_at_imp_continuous_on DERIV_log DERIV_isCont 

932 
simp: continuous_isCont[symmetric]) 

933 
show "open ({0<..}::real set)" by auto 

934 
qed 

935 
also have "(\<lambda>x. if x \<in> {0<..} then log b x else log b 0) = log b" 

936 
by (simp add: fun_eq_iff not_less log_imp) 

937 
finally show ?thesis . 

938 
qed 

939 

47694  940 
lemma borel_measurable_log[simp,intro]: 
41830  941 
assumes f: "f \<in> borel_measurable M" and "1 < b" 
942 
shows "(\<lambda>x. log b (f x)) \<in> borel_measurable M" 

943 
using measurable_comp[OF f borel_measurable_borel_log[OF `1 < b`]] 

944 
by (simp add: comp_def) 

945 

47761  946 
lemma borel_measurable_real_floor: 
947 
"(\<lambda>x::real. real \<lfloor>x\<rfloor>) \<in> borel_measurable borel" 

948 
unfolding borel_measurable_iff_ge 

949 
proof (intro allI) 

950 
fix a :: real 

951 
{ fix x have "a \<le> real \<lfloor>x\<rfloor> \<longleftrightarrow> real \<lceil>a\<rceil> \<le> x" 

952 
using le_floor_eq[of "\<lceil>a\<rceil>" x] ceiling_le_iff[of a "\<lfloor>x\<rfloor>"] 

953 
unfolding real_eq_of_int by simp } 

954 
then have "{w::real \<in> space borel. a \<le> real \<lfloor>w\<rfloor>} = {real \<lceil>a\<rceil>..}" by auto 

955 
then show "{w::real \<in> space borel. a \<le> real \<lfloor>w\<rfloor>} \<in> sets borel" by auto 

956 
qed 

957 

958 
lemma borel_measurable_real_natfloor[intro, simp]: 

959 
assumes "f \<in> borel_measurable M" 

960 
shows "(\<lambda>x. real (natfloor (f x))) \<in> borel_measurable M" 

961 
proof  

962 
have "\<And>x. real (natfloor (f x)) = max 0 (real \<lfloor>f x\<rfloor>)" 

963 
by (auto simp: max_def natfloor_def) 

964 
with borel_measurable_max[OF measurable_comp[OF assms borel_measurable_real_floor] borel_measurable_const] 

965 
show ?thesis by (simp add: comp_def) 

966 
qed 

967 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

968 
subsection "Borel space on the extended reals" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

969 

43920  970 
lemma borel_measurable_ereal_borel: 
971 
"ereal \<in> borel_measurable borel" 

47694  972 
proof (rule borel_measurableI) 
973 
fix X :: "ereal set" assume "open X" 

43920  974 
then have "open (ereal ` X \<inter> space borel)" 
975 
by (simp add: open_ereal_vimage) 

976 
then show "ereal ` X \<inter> space borel \<in> sets borel" by auto 

47694  977 
qed 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

978 

47694  979 
lemma borel_measurable_ereal[simp, intro]: 
43920  980 
assumes f: "f \<in> borel_measurable M" shows "(\<lambda>x. ereal (f x)) \<in> borel_measurable M" 
981 
using measurable_comp[OF f borel_measurable_ereal_borel] unfolding comp_def . 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

982 

43920  983 
lemma borel_measurable_real_of_ereal_borel: 
984 
"(real :: ereal \<Rightarrow> real) \<in> borel_measurable borel" 

47694  985 
proof (rule borel_measurableI) 
986 
fix B :: "real set" assume "open B" 

43920  987 
have *: "ereal ` real ` (B  {0}) = B  {0}" by auto 
988 
have open_real: "open (real ` (B  {0}) :: ereal set)" 

989 
unfolding open_ereal_def * using `open B` by auto 

990 
show "(real ` B \<inter> space borel :: ereal set) \<in> sets borel" 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

991 
proof cases 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

992 
assume "0 \<in> B" 
43923  993 
then have *: "real ` B = real ` (B  {0}) \<union> {\<infinity>, \<infinity>, 0::ereal}" 
43920  994 
by (auto simp add: real_of_ereal_eq_0) 
995 
then show "(real ` B :: ereal set) \<inter> space borel \<in> sets borel" 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

996 
using open_real by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

997 
next 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

998 
assume "0 \<notin> B" 
43920  999 
then have *: "(real ` B :: ereal set) = real ` (B  {0})" 
1000 
by (auto simp add: real_of_ereal_eq_0) 

1001 
then show "(real ` B :: ereal set) \<inter> space borel \<in> sets borel" 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1002 
using open_real by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1003 
qed 
47694  1004 
qed 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1005 

47694  1006 
lemma borel_measurable_real_of_ereal[simp, intro]: 
43920  1007 
assumes f: "f \<in> borel_measurable M" shows "(\<lambda>x. real (f x :: ereal)) \<in> borel_measurable M" 
1008 
using measurable_comp[OF f borel_measurable_real_of_ereal_borel] unfolding comp_def . 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1009 

47694  1010 
lemma borel_measurable_ereal_iff: 
43920  1011 
shows "(\<lambda>x. ereal (f x)) \<in> borel_measurable M \<longleftrightarrow> f \<in> borel_measurable M" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1012 
proof 
43920  1013 
assume "(\<lambda>x. ereal (f x)) \<in> borel_measurable M" 
1014 
from borel_measurable_real_of_ereal[OF this] 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1015 
show "f \<in> borel_measurable M" by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1016 
qed auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1017 

47694  1018 
lemma borel_measurable_ereal_iff_real: 
43923  1019 
fixes f :: "'a \<Rightarrow> ereal" 
1020 
shows "f \<in> borel_measurable M \<longleftrightarrow> 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1021 
((\<lambda>x. real (f x)) \<in> borel_measurable M \<and> f ` {\<infinity>} \<inter> space M \<in> sets M \<and> f ` {\<infinity>} \<inter> space M \<in> sets M)" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1022 
proof safe 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1023 
assume *: "(\<lambda>x. real (f x)) \<in> borel_measurable M" "f ` {\<infinity>} \<inter> space M \<in> sets M" "f ` {\<infinity>} \<inter> space M \<in> sets M" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1024 
have "f ` {\<infinity>} \<inter> space M = {x\<in>space M. f x = \<infinity>}" "f ` {\<infinity>} \<inter> space M = {x\<in>space M. f x = \<infinity>}" by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1025 
with * have **: "{x\<in>space M. f x = \<infinity>} \<in> sets M" "{x\<in>space M. f x = \<infinity>} \<in> sets M" by simp_all 
46731  1026 
let ?f = "\<lambda>x. if f x = \<infinity> then \<infinity> else if f x = \<infinity> then \<infinity> else ereal (real (f x))" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1027 
have "?f \<in> borel_measurable M" using * ** by (intro measurable_If) auto 
43920  1028 
also have "?f = f" by (auto simp: fun_eq_iff ereal_real) 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1029 
finally show "f \<in> borel_measurable M" . 
43920  1030 
qed (auto intro: measurable_sets borel_measurable_real_of_ereal) 
41830  1031 

47694  1032 
lemma less_eq_ge_measurable: 
38656  1033 
fixes f :: "'a \<Rightarrow> 'c::linorder" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1034 
shows "f ` {a <..} \<inter> space M \<in> sets M \<longleftrightarrow> f ` {..a} \<inter> space M \<in> sets M" 
38656  1035 
proof 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1036 
assume "f ` {a <..} \<inter> space M \<in> sets M" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1037 
moreover have "f ` {..a} \<inter> space M = space M  f ` {a <..} \<inter> space M" by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1038 
ultimately show "f ` {..a} \<inter> space M \<in> sets M" by auto 
38656  1039 
next 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1040 
assume "f ` {..a} \<inter> space M \<in> sets M" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1041 
moreover have "f ` {a <..} \<inter> space M = space M  f ` {..a} \<inter> space M" by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1042 
ultimately show "f ` {a <..} \<inter> space M \<in> sets M" by auto 
38656  1043 
qed 
35692  1044 

47694  1045 
lemma greater_eq_le_measurable: 
38656  1046 
fixes f :: "'a \<Rightarrow> 'c::linorder" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1047 
shows "f ` {..< a} \<inter> space M \<in> sets M \<longleftrightarrow> f ` {a ..} \<inter> space M \<in> sets M" 
38656  1048 
proof 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1049 
assume "f ` {a ..} \<inter> space M \<in> sets M" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1050 
moreover have "f ` {..< a} \<inter> space M = space M  f ` {a ..} \<inter> space M" by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1051 
ultimately show "f ` {..< a} \<inter> space M \<in> sets M" by auto 
38656  1052 
next 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1053 
assume "f ` {..< a} \<inter> space M \<in> sets M" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1054 
moreover have "f ` {a ..} \<inter> space M = space M  f ` {..< a} \<inter> space M" by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1055 
ultimately show "f ` {a ..} \<inter> space M \<in> sets M" by auto 
38656  1056 
qed 
1057 

47694  1058 
lemma borel_measurable_uminus_borel_ereal: 
43920  1059 
"(uminus :: ereal \<Rightarrow> ereal) \<in> borel_measurable borel" 
47694  1060 
proof (rule borel_measurableI) 
1061 
fix X :: "ereal set" assume "open X" 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1062 
have "uminus ` X = uminus ` X" by (force simp: image_iff) 
43920  1063 
then have "open (uminus ` X)" using `open X` ereal_open_uminus by auto 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1064 
then show "uminus ` X \<inter> space borel \<in> sets borel" by auto 
47694  1065 
qed 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1066 

47694  1067 
lemma borel_measurable_uminus_ereal[intro]: 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1068 
assumes "f \<in> borel_measurable M" 
43920  1069 
shows "(\<lambda>x.  f x :: ereal) \<in> borel_measurable M" 
1070 
using measurable_comp[OF assms borel_measurable_uminus_borel_ereal] by (simp add: comp_def) 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1071 

47694  1072 
lemma borel_measurable_uminus_eq_ereal[simp]: 
43920  1073 
"(\<lambda>x.  f x :: ereal) \<in> borel_measurable M \<longleftrightarrow> f \<in> borel_measurable M" (is "?l = ?r") 
38656  1074 
proof 
43920  1075 
assume ?l from borel_measurable_uminus_ereal[OF this] show ?r by simp 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1076 
qed auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1077 

47694  1078 
lemma borel_measurable_eq_atMost_ereal: 
43923  1079 
fixes f :: "'a \<Rightarrow> ereal" 
1080 
shows "f \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. f ` {..a} \<inter> space M \<in> sets M)" 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1081 
proof (intro iffI allI) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1082 
assume pos[rule_format]: "\<forall>a. f ` {..a} \<inter> space M \<in> sets M" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1083 
show "f \<in> borel_measurable M" 
43920  1084 
unfolding borel_measurable_ereal_iff_real borel_measurable_iff_le 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1085 
proof (intro conjI allI) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1086 
fix a :: real 
43920  1087 
{ fix x :: ereal assume *: "\<forall>i::nat. real i < x" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1088 
have "x = \<infinity>" 
43920  1089 
proof (rule ereal_top) 
44666  1090 
fix B from reals_Archimedean2[of B] guess n .. 
43920  1091 
then have "ereal B < real n" by auto 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1092 
with * show "B \<le> x" by (metis less_trans less_imp_le) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1093 
qed } 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1094 
then have "f ` {\<infinity>} \<inter> space M = space M  (\<Union>i::nat. f ` {.. real i} \<inter> space M)" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1095 
by (auto simp: not_le) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1096 
then show "f ` {\<infinity>} \<inter> space M \<in> sets M" using pos by (auto simp del: UN_simps intro!: Diff) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1097 
moreover 
43923  1098 
have "{\<infinity>::ereal} = {..\<infinity>}" by auto 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1099 
then show "f ` {\<infinity>} \<inter> space M \<in> sets M" using pos by auto 
43920  1100 
moreover have "{x\<in>space M. f x \<le> ereal a} \<in> sets M" 
1101 
using pos[of "ereal a"] by (simp add: vimage_def Int_def conj_commute) 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1102 
moreover have "{w \<in> space M. real (f w) \<le> a} = 
43920  1103 
(if a < 0 then {w \<in> space M. f w \<le> ereal a}  f ` {\<infinity>} \<inter> space M 
1104 
else {w \<in> space M. f w \<le> ereal a} \<union> (f ` {\<infinity>} \<inter> space M) \<union> (f ` {\<infinity>} \<inter> space M))" (is "?l = ?r") 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1105 
proof (intro set_eqI) fix x show "x \<in> ?l \<longleftrightarrow> x \<in> ?r" by (cases "f x") auto qed 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1106 
ultimately show "{w \<in> space M. real (f w) \<le> a} \<in> sets M" by auto 
35582  1107 
qed 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1108 
qed (simp add: measurable_sets) 
35582  1109 

47694  1110 
lemma borel_measurable_eq_atLeast_ereal: 
43920  1111 
"(f::'a \<Rightarrow> ereal) \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. f ` {a..} \<inter> space M \<in> sets M)" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1112 
proof 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1113 
assume pos: "\<forall>a. f ` {a..} \<inter> space M \<in> sets M" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1114 
moreover have "\<And>a. (\<lambda>x.  f x) ` {..a} = f ` {a ..}" 
43920  1115 
by (auto simp: ereal_uminus_le_reorder) 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1116 
ultimately have "(\<lambda>x.  f x) \<in> borel_measurable M" 
43920  1117 
unfolding borel_measurable_eq_atMost_ereal by auto 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1118 
then show "f \<in> borel_measurable M" by simp 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1119 
qed (simp add: measurable_sets) 
35582  1120 

47694  1121 
lemma borel_measurable_ereal_iff_less: 
43920  1122 
"(f::'a \<Rightarrow> ereal) \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. f ` {..< a} \<inter> space M \<in> sets M)" 
1123 
unfolding borel_measurable_eq_atLeast_ereal greater_eq_le_measurable .. 

38656  1124 

47694  1125 
lemma borel_measurable_ereal_iff_ge: 
43920  1126 
"(f::'a \<Rightarrow> ereal) \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. f ` {a <..} \<inter> space M \<in> sets M)" 
1127 
unfolding borel_measurable_eq_atMost_ereal less_eq_ge_measurable .. 

38656  1128 

47694  1129 
lemma borel_measurable_ereal_eq_const: 
43920  1130 
fixes f :: "'a \<Rightarrow> ereal" assumes "f \<in> borel_measurable M" 
38656  1131 
shows "{x\<in>space M. f x = c} \<in> sets M" 
1132 
proof  

1133 
have "{x\<in>space M. f x = c} = (f ` {c} \<inter> space M)" by auto 

1134 
then show ?thesis using assms by (auto intro!: measurable_sets) 

1135 
qed 

1136 

47694  1137 
lemma borel_measurable_ereal_neq_const: 
43920  1138 
fixes f :: "'a \<Rightarrow> ereal" assumes "f \<in> borel_measurable M" 
38656  1139 
shows "{x\<in>space M. f x \<noteq> c} \<in> sets M" 
1140 
proof  

1141 
have "{x\<in>space M. f x \<noteq> c} = space M  (f ` {c} \<inter> space M)" by auto 

1142 
then show ?thesis using assms by (auto intro!: measurable_sets) 

1143 
qed 

1144 

47694  1145 
lemma borel_measurable_ereal_le[intro,simp]: 
43920  1146 
fixes f g :: "'a \<Rightarrow> ereal" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1147 
assumes f: "f \<in> borel_measurable M" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1148 
assumes g: "g \<in> borel_measurable M" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1149 
shows "{x \<in> space M. f x \<le> g x} \<in> sets M" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1150 
proof  
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1151 
have "{x \<in> space M. f x \<le> g x} = 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1152 
{x \<in> space M. real (f x) \<le> real (g x)}  (f ` {\<infinity>, \<infinity>} \<inter> space M \<union> g ` {\<infinity>, \<infinity>} \<inter> space M) \<union> 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1153 
f ` {\<infinity>} \<inter> space M \<union> g ` {\<infinity>} \<inter> space M" (is "?l = ?r") 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1154 
proof (intro set_eqI) 
43920  1155 
fix x show "x \<in> ?l \<longleftrightarrow> x \<in> ?r" by (cases rule: ereal2_cases[of "f x" "g x"]) auto 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1156 
qed 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1157 
with f g show ?thesis by (auto intro!: Un simp: measurable_sets) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1158 
qed 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1159 

47694  1160 
lemma borel_measurable_ereal_less[intro,simp]: 
43920  1161 
fixes f :: "'a \<Rightarrow> ereal" 
38656  1162 
assumes f: "f \<in> borel_measurable M" 
1163 
assumes g: "g \<in> borel_measurable M" 

1164 
shows "{x \<in> space M. f x < g x} \<in> sets M" 

1165 
proof  

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1166 
have "{x \<in> space M. f x < g x} = space M  {x \<in> space M. g x \<le> f x}" by auto 
38656  1167 
then show ?thesis using g f by auto 
1168 
qed 

1169 

47694  1170 
lemma borel_measurable_ereal_eq[intro,simp]: 
43920  1171 
fixes f :: "'a \<Rightarrow> ereal" 
38656  1172 
assumes f: "f \<in> borel_measurable M" 
1173 
assumes g: "g \<in> borel_measurable M" 

1174 
shows "{w \<in> space M. f w = g w} \<in> sets M" 

1175 
proof  

1176 
have "{x \<in> space M. f x = g x} = {x \<in> space M. g x \<le> f x} \<inter> {x \<in> space M. f x \<le> g x}" by auto 

1177 
then show ?thesis using g f by auto 

1178 
qed 

1179 

47694  1180 
lemma borel_measurable_ereal_neq[intro,simp]: 
43920  1181 
fixes f :: "'a \<Rightarrow> ereal" 
38656  1182 
assumes f: "f \<in> borel_measurable M" 
1183 
assumes g: "g \<in> borel_measurable M" 

1184 
shows "{w \<in> space M. f w \<noteq> g w} \<in> sets M" 

35692  1185 
proof  
38656  1186 
have "{w \<in> space M. f w \<noteq> g w} = space M  {w \<in> space M. f w = g w}" by auto 
1187 
thus ?thesis using f g by auto 

1188 
qed 

1189 

47694  1190 
lemma split_sets: 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1191 
"{x\<in>space M. P x \<or> Q x} = {x\<in>space M. P x} \<union> {x\<in>space M. Q x}" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1192 
"{x\<in>space M. P x \<and> Q x} = {x\<in>space M. P x} \<inter> {x\<in>space M. Q x}" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1193 
by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1194 

47694  1195 
lemma borel_measurable_ereal_add[intro, simp]: 
43920  1196 
fixes f :: "'a \<Rightarrow> ereal" 
41025  1197 
assumes "f \<in> borel_measurable M" "g \<in> borel_measurable M" 
38656  1198 
shows "(\<lambda>x. f x + g x) \<in> borel_measurable M" 
1199 
proof  

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1200 
{ fix x assume "x \<in> space M" then have "f x + g x = 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1201 
(if f x = \<infinity> \<or> g x = \<infinity> then \<infinity> 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1202 
else if f x = \<infinity> \<or> g x = \<infinity> then \<infinity> 
43920  1203 
else ereal (real (f x) + real (g x)))" 
1204 
by (cases rule: ereal2_cases[of "f x" "g x"]) auto } 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1205 
with assms show ?thesis 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1206 
by (auto cong: measurable_cong simp: split_sets 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1207 
intro!: Un measurable_If measurable_sets) 
38656  1208 
qed 
1209 

47694  1210 
lemma borel_measurable_ereal_setsum[simp, intro]: 
43920  1211 
fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> ereal" 
41096  1212 
assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M" 
1213 
shows "(\<lambda>x. \<Sum>i\<in>S. f i x) \<in> borel_measurable M" 

1214 
proof cases 

1215 
assume "finite S" 

1216 
thus ?thesis using assms 

1217 
by induct auto 

1218 
qed (simp add: borel_measurable_const) 

1219 

47694  1220 
lemma borel_measurable_ereal_abs[intro, simp]: 
43920  1221 
fixes f :: "'a \<Rightarrow> ereal" assumes "f \<in> borel_measurable M" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1222 
shows "(\<lambda>x. \<bar>f x\<bar>) \<in> borel_measurable M" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1223 
proof  
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1224 
{ fix x have "\<bar>f x\<bar> = (if 0 \<le> f x then f x else  f x)" by auto } 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1225 
then show ?thesis using assms by (auto intro!: measurable_If) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1226 
qed 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1227 

47694  1228 
lemma borel_measurable_ereal_times[intro, simp]: 
43920  1229 
fixes f :: "'a \<Rightarrow> ereal" assumes "f \<in> borel_measurable M" "g \<in> borel_measurable M" 
38656  1230 
shows "(\<lambda>x. f x * g x) \<in> borel_measurable M" 
1231 
proof  

43920  1232 
{ fix f g :: "'a \<Rightarrow> ereal" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1233 
assume b: "f \<in> borel_measurable M" "g \<in> borel_measurable M" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1234 
and pos: "\<And>x. 0 \<le> f x" "\<And>x. 0 \<le> g x" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1235 
{ fix x have *: "f x * g x = (if f x = 0 \<or> g x = 0 then 0 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1236 
else if f x = \<infinity> \<or> g x = \<infinity> then \<infinity> 
43920  1237 
else ereal (real (f x) * real (g x)))" 
1238 
apply (cases rule: ereal2_cases[of "f x" "g x"]) 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1239 
using pos[of x] by auto } 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41969
diff
changeset

1240 
with b have "(\<lambda>x. f x * g x) \<in> borel_measurable M" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
