author  hoelzl 
Thu, 02 Sep 2010 17:28:00 +0200  
changeset 39096  111756225292 
parent 39092  98de40859858 
child 39097  943c7b348524 
permissions  rwrr 
35582  1 
theory Probability_Space 
39083  2 
imports Lebesgue_Integration Radon_Nikodym 
35582  3 
begin 
4 

39096  5 

6 

35582  7 
locale prob_space = measure_space + 
38656  8 
assumes measure_space_1: "\<mu> (space M) = 1" 
9 

10 
sublocale prob_space < finite_measure 

11 
proof 

12 
from measure_space_1 show "\<mu> (space M) \<noteq> \<omega>" by simp 

13 
qed 

14 

15 
context prob_space 

35582  16 
begin 
17 

18 
abbreviation "events \<equiv> sets M" 

38656  19 
abbreviation "prob \<equiv> \<lambda>A. real (\<mu> A)" 
35582  20 
abbreviation "prob_preserving \<equiv> measure_preserving" 
21 
abbreviation "random_variable \<equiv> \<lambda> s X. X \<in> measurable M s" 

22 
abbreviation "expectation \<equiv> integral" 

23 

24 
definition 

25 
"indep A B \<longleftrightarrow> A \<in> events \<and> B \<in> events \<and> prob (A \<inter> B) = prob A * prob B" 

26 

27 
definition 

28 
"indep_families F G \<longleftrightarrow> (\<forall> A \<in> F. \<forall> B \<in> G. indep A B)" 

29 

30 
definition 

38656  31 
"distribution X = (\<lambda>s. \<mu> ((X ` s) \<inter> (space M)))" 
35582  32 

36624  33 
abbreviation 
34 
"joint_distribution X Y \<equiv> distribution (\<lambda>x. (X x, Y x))" 

35582  35 

38656  36 
lemma prob_space: "prob (space M) = 1" 
37 
unfolding measure_space_1 by simp 

35582  38 

38656  39 
lemma measure_le_1[simp, intro]: 
40 
assumes "A \<in> events" shows "\<mu> A \<le> 1" 

41 
proof  

42 
have "\<mu> A \<le> \<mu> (space M)" 

43 
using assms sets_into_space by(auto intro!: measure_mono) 

44 
also note measure_space_1 

45 
finally show ?thesis . 

46 
qed 

35582  47 

48 
lemma prob_compl: 

38656  49 
assumes "A \<in> events" 
50 
shows "prob (space M  A) = 1  prob A" 

51 
using `A \<in> events`[THEN sets_into_space] `A \<in> events` measure_space_1 

52 
by (subst real_finite_measure_Diff) auto 

35582  53 

54 
lemma indep_space: 

55 
assumes "s \<in> events" 

56 
shows "indep (space M) s" 

38656  57 
using assms prob_space by (simp add: indep_def) 
35582  58 

38656  59 
lemma prob_space_increasing: "increasing M prob" 
60 
by (auto intro!: real_measure_mono simp: increasing_def) 

35582  61 

62 
lemma prob_zero_union: 

63 
assumes "s \<in> events" "t \<in> events" "prob t = 0" 

64 
shows "prob (s \<union> t) = prob s" 

38656  65 
using assms 
35582  66 
proof  
67 
have "prob (s \<union> t) \<le> prob s" 

38656  68 
using real_finite_measure_subadditive[of s t] assms by auto 
35582  69 
moreover have "prob (s \<union> t) \<ge> prob s" 
38656  70 
using assms by (blast intro: real_measure_mono) 
35582  71 
ultimately show ?thesis by simp 
72 
qed 

73 

74 
lemma prob_eq_compl: 

75 
assumes "s \<in> events" "t \<in> events" 

76 
assumes "prob (space M  s) = prob (space M  t)" 

77 
shows "prob s = prob t" 

38656  78 
using assms prob_compl by auto 
35582  79 

80 
lemma prob_one_inter: 

81 
assumes events:"s \<in> events" "t \<in> events" 

82 
assumes "prob t = 1" 

83 
shows "prob (s \<inter> t) = prob s" 

84 
proof  

38656  85 
have "prob ((space M  s) \<union> (space M  t)) = prob (space M  s)" 
86 
using events assms prob_compl[of "t"] by (auto intro!: prob_zero_union) 

87 
also have "(space M  s) \<union> (space M  t) = space M  (s \<inter> t)" 

88 
by blast 

89 
finally show "prob (s \<inter> t) = prob s" 

90 
using events by (auto intro!: prob_eq_compl[of "s \<inter> t" s]) 

35582  91 
qed 
92 

93 
lemma prob_eq_bigunion_image: 

94 
assumes "range f \<subseteq> events" "range g \<subseteq> events" 

95 
assumes "disjoint_family f" "disjoint_family g" 

96 
assumes "\<And> n :: nat. prob (f n) = prob (g n)" 

97 
shows "(prob (\<Union> i. f i) = prob (\<Union> i. g i))" 

98 
using assms 

99 
proof  

38656  100 
have a: "(\<lambda> i. prob (f i)) sums (prob (\<Union> i. f i))" 
101 
by (rule real_finite_measure_UNION[OF assms(1,3)]) 

102 
have b: "(\<lambda> i. prob (g i)) sums (prob (\<Union> i. g i))" 

103 
by (rule real_finite_measure_UNION[OF assms(2,4)]) 

104 
show ?thesis using sums_unique[OF b] sums_unique[OF a] assms by simp 

35582  105 
qed 
106 

107 
lemma prob_countably_zero: 

108 
assumes "range c \<subseteq> events" 

109 
assumes "\<And> i. prob (c i) = 0" 

38656  110 
shows "prob (\<Union> i :: nat. c i) = 0" 
111 
proof (rule antisym) 

112 
show "prob (\<Union> i :: nat. c i) \<le> 0" 

113 
using real_finite_measurable_countably_subadditive[OF assms(1)] 

114 
by (simp add: assms(2) suminf_zero summable_zero) 

115 
show "0 \<le> prob (\<Union> i :: nat. c i)" by (rule real_pinfreal_nonneg) 

35582  116 
qed 
117 

118 
lemma indep_sym: 

119 
"indep a b \<Longrightarrow> indep b a" 

120 
unfolding indep_def using Int_commute[of a b] by auto 

121 

122 
lemma indep_refl: 

123 
assumes "a \<in> events" 

124 
shows "indep a a = (prob a = 0) \<or> (prob a = 1)" 

125 
using assms unfolding indep_def by auto 

126 

127 
lemma prob_equiprobable_finite_unions: 

38656  128 
assumes "s \<in> events" 
129 
assumes s_finite: "finite s" "\<And>x. x \<in> s \<Longrightarrow> {x} \<in> events" 

35582  130 
assumes "\<And> x y. \<lbrakk>x \<in> s; y \<in> s\<rbrakk> \<Longrightarrow> (prob {x} = prob {y})" 
38656  131 
shows "prob s = real (card s) * prob {SOME x. x \<in> s}" 
35582  132 
proof (cases "s = {}") 
38656  133 
case False hence "\<exists> x. x \<in> s" by blast 
35582  134 
from someI_ex[OF this] assms 
135 
have prob_some: "\<And> x. x \<in> s \<Longrightarrow> prob {x} = prob {SOME y. y \<in> s}" by blast 

136 
have "prob s = (\<Sum> x \<in> s. prob {x})" 

38656  137 
using real_finite_measure_finite_singelton[OF s_finite] by simp 
35582  138 
also have "\<dots> = (\<Sum> x \<in> s. prob {SOME y. y \<in> s})" using prob_some by auto 
38656  139 
also have "\<dots> = real (card s) * prob {(SOME x. x \<in> s)}" 
140 
using setsum_constant assms by (simp add: real_eq_of_nat) 

35582  141 
finally show ?thesis by simp 
38656  142 
qed simp 
35582  143 

144 
lemma prob_real_sum_image_fn: 

145 
assumes "e \<in> events" 

146 
assumes "\<And> x. x \<in> s \<Longrightarrow> e \<inter> f x \<in> events" 

147 
assumes "finite s" 

38656  148 
assumes disjoint: "\<And> x y. \<lbrakk>x \<in> s ; y \<in> s ; x \<noteq> y\<rbrakk> \<Longrightarrow> f x \<inter> f y = {}" 
149 
assumes upper: "space M \<subseteq> (\<Union> i \<in> s. f i)" 

35582  150 
shows "prob e = (\<Sum> x \<in> s. prob (e \<inter> f x))" 
151 
proof  

38656  152 
have e: "e = (\<Union> i \<in> s. e \<inter> f i)" 
153 
using `e \<in> events` sets_into_space upper by blast 

154 
hence "prob e = prob (\<Union> i \<in> s. e \<inter> f i)" by simp 

155 
also have "\<dots> = (\<Sum> x \<in> s. prob (e \<inter> f x))" 

156 
proof (rule real_finite_measure_finite_Union) 

157 
show "finite s" by fact 

158 
show "\<And>i. i \<in> s \<Longrightarrow> e \<inter> f i \<in> events" by fact 

159 
show "disjoint_family_on (\<lambda>i. e \<inter> f i) s" 

160 
using disjoint by (auto simp: disjoint_family_on_def) 

161 
qed 

162 
finally show ?thesis . 

35582  163 
qed 
164 

165 
lemma distribution_prob_space: 

39089  166 
assumes S: "sigma_algebra S" "random_variable S X" 
38656  167 
shows "prob_space S (distribution X)" 
35582  168 
proof  
39089  169 
interpret S: measure_space S "distribution X" 
170 
using measure_space_vimage[OF S(2,1)] unfolding distribution_def . 

38656  171 
show ?thesis 
172 
proof 

173 
have "X ` space S \<inter> space M = space M" 

174 
using `random_variable S X` by (auto simp: measurable_def) 

39089  175 
then show "distribution X (space S) = 1" 
176 
using measure_space_1 by (simp add: distribution_def) 

35582  177 
qed 
178 
qed 

179 

180 
lemma distribution_lebesgue_thm1: 

181 
assumes "random_variable s X" 

182 
assumes "A \<in> sets s" 

38656  183 
shows "real (distribution X A) = expectation (indicator (X ` A \<inter> space M))" 
35582  184 
unfolding distribution_def 
185 
using assms unfolding measurable_def 

38656  186 
using integral_indicator by auto 
35582  187 

188 
lemma distribution_lebesgue_thm2: 

38656  189 
assumes "sigma_algebra S" "random_variable S X" and "A \<in> sets S" 
190 
shows "distribution X A = 

191 
measure_space.positive_integral S (distribution X) (indicator A)" 

192 
(is "_ = measure_space.positive_integral _ ?D _") 

35582  193 
proof  
38656  194 
interpret S: prob_space S "distribution X" using assms(1,2) by (rule distribution_prob_space) 
35582  195 

196 
show ?thesis 

38656  197 
using S.positive_integral_indicator(1) 
35582  198 
using assms unfolding distribution_def by auto 
199 
qed 

200 

201 
lemma finite_expectation1: 

38656  202 
assumes "finite (X`space M)" and rv: "random_variable borel_space X" 
35582  203 
shows "expectation X = (\<Sum> r \<in> X ` space M. r * prob (X ` {r} \<inter> space M))" 
38656  204 
proof (rule integral_on_finite(2)[OF assms(2,1)]) 
205 
fix x have "X ` {x} \<inter> space M \<in> sets M" 

206 
using rv unfolding measurable_def by auto 

207 
thus "\<mu> (X ` {x} \<inter> space M) \<noteq> \<omega>" using finite_measure by simp 

208 
qed 

35582  209 

210 
lemma finite_expectation: 

38656  211 
assumes "finite (space M)" "random_variable borel_space X" 
212 
shows "expectation X = (\<Sum> r \<in> X ` (space M). r * real (distribution X {r}))" 

213 
using assms unfolding distribution_def using finite_expectation1 by auto 

214 

35582  215 
lemma prob_x_eq_1_imp_prob_y_eq_0: 
216 
assumes "{x} \<in> events" 

38656  217 
assumes "prob {x} = 1" 
35582  218 
assumes "{y} \<in> events" 
219 
assumes "y \<noteq> x" 

220 
shows "prob {y} = 0" 

221 
using prob_one_inter[of "{y}" "{x}"] assms by auto 

222 

38656  223 
lemma distribution_empty[simp]: "distribution X {} = 0" 
224 
unfolding distribution_def by simp 

225 

226 
lemma distribution_space[simp]: "distribution X (X ` space M) = 1" 

227 
proof  

228 
have "X ` X ` space M \<inter> space M = space M" by auto 

229 
thus ?thesis unfolding distribution_def by (simp add: measure_space_1) 

230 
qed 

231 

232 
lemma distribution_one: 

233 
assumes "random_variable M X" and "A \<in> events" 

234 
shows "distribution X A \<le> 1" 

235 
proof  

236 
have "distribution X A \<le> \<mu> (space M)" unfolding distribution_def 

237 
using assms[unfolded measurable_def] by (auto intro!: measure_mono) 

238 
thus ?thesis by (simp add: measure_space_1) 

239 
qed 

240 

241 
lemma distribution_finite: 

242 
assumes "random_variable M X" and "A \<in> events" 

243 
shows "distribution X A \<noteq> \<omega>" 

244 
using distribution_one[OF assms] by auto 

245 

35582  246 
lemma distribution_x_eq_1_imp_distribution_y_eq_0: 
247 
assumes X: "random_variable \<lparr>space = X ` (space M), sets = Pow (X ` (space M))\<rparr> X" 

38656  248 
(is "random_variable ?S X") 
249 
assumes "distribution X {x} = 1" 

35582  250 
assumes "y \<noteq> x" 
251 
shows "distribution X {y} = 0" 

252 
proof  

38656  253 
have "sigma_algebra ?S" by (rule sigma_algebra_Pow) 
254 
from distribution_prob_space[OF this X] 

255 
interpret S: prob_space ?S "distribution X" by simp 

256 

257 
have x: "{x} \<in> sets ?S" 

258 
proof (rule ccontr) 

259 
assume "{x} \<notin> sets ?S" 

35582  260 
hence "X ` {x} \<inter> space M = {}" by auto 
38656  261 
thus "False" using assms unfolding distribution_def by auto 
262 
qed 

263 

264 
have [simp]: "{y} \<inter> {x} = {}" "{x}  {y} = {x}" using `y \<noteq> x` by auto 

265 

266 
show ?thesis 

267 
proof cases 

268 
assume "{y} \<in> sets ?S" 

269 
with `{x} \<in> sets ?S` assms show "distribution X {y} = 0" 

270 
using S.measure_inter_full_set[of "{y}" "{x}"] 

271 
by simp 

272 
next 

273 
assume "{y} \<notin> sets ?S" 

35582  274 
hence "X ` {y} \<inter> space M = {}" by auto 
38656  275 
thus "distribution X {y} = 0" unfolding distribution_def by auto 
276 
qed 

35582  277 
qed 
278 

279 
end 

280 

35977  281 
locale finite_prob_space = prob_space + finite_measure_space 
282 

36624  283 
lemma finite_prob_space_eq: 
38656  284 
"finite_prob_space M \<mu> \<longleftrightarrow> finite_measure_space M \<mu> \<and> \<mu> (space M) = 1" 
36624  285 
unfolding finite_prob_space_def finite_measure_space_def prob_space_def prob_space_axioms_def 
286 
by auto 

287 

288 
lemma (in prob_space) not_empty: "space M \<noteq> {}" 

289 
using prob_space empty_measure by auto 

290 

38656  291 
lemma (in finite_prob_space) sum_over_space_eq_1: "(\<Sum>x\<in>space M. \<mu> {x}) = 1" 
292 
using measure_space_1 sum_over_space by simp 

36624  293 

294 
lemma (in finite_prob_space) positive_distribution: "0 \<le> distribution X x" 

38656  295 
unfolding distribution_def by simp 
36624  296 

297 
lemma (in finite_prob_space) joint_distribution_restriction_fst: 

298 
"joint_distribution X Y A \<le> distribution X (fst ` A)" 

299 
unfolding distribution_def 

300 
proof (safe intro!: measure_mono) 

301 
fix x assume "x \<in> space M" and *: "(X x, Y x) \<in> A" 

302 
show "x \<in> X ` fst ` A" 

303 
by (auto intro!: image_eqI[OF _ *]) 

304 
qed (simp_all add: sets_eq_Pow) 

305 

306 
lemma (in finite_prob_space) joint_distribution_restriction_snd: 

307 
"joint_distribution X Y A \<le> distribution Y (snd ` A)" 

308 
unfolding distribution_def 

309 
proof (safe intro!: measure_mono) 

310 
fix x assume "x \<in> space M" and *: "(X x, Y x) \<in> A" 

311 
show "x \<in> Y ` snd ` A" 

312 
by (auto intro!: image_eqI[OF _ *]) 

313 
qed (simp_all add: sets_eq_Pow) 

314 

315 
lemma (in finite_prob_space) distribution_order: 

316 
shows "0 \<le> distribution X x'" 

317 
and "(distribution X x' \<noteq> 0) \<longleftrightarrow> (0 < distribution X x')" 

318 
and "r \<le> joint_distribution X Y {(x, y)} \<Longrightarrow> r \<le> distribution X {x}" 

319 
and "r \<le> joint_distribution X Y {(x, y)} \<Longrightarrow> r \<le> distribution Y {y}" 

320 
and "r < joint_distribution X Y {(x, y)} \<Longrightarrow> r < distribution X {x}" 

321 
and "r < joint_distribution X Y {(x, y)} \<Longrightarrow> r < distribution Y {y}" 

322 
and "distribution X {x} = 0 \<Longrightarrow> joint_distribution X Y {(x, y)} = 0" 

323 
and "distribution Y {y} = 0 \<Longrightarrow> joint_distribution X Y {(x, y)} = 0" 

324 
using positive_distribution[of X x'] 

325 
positive_distribution[of "\<lambda>x. (X x, Y x)" "{(x, y)}"] 

326 
joint_distribution_restriction_fst[of X Y "{(x, y)}"] 

327 
joint_distribution_restriction_snd[of X Y "{(x, y)}"] 

328 
by auto 

329 

39092  330 
lemma (in finite_prob_space) finite_prob_space_of_images: 
331 
"finite_prob_space \<lparr> space = X ` space M, sets = Pow (X ` space M)\<rparr> (distribution X)" 

332 
by (simp add: finite_prob_space_eq finite_measure_space) 

35977  333 

39092  334 
lemma (in finite_prob_space) finite_product_prob_space_of_images: 
335 
"finite_prob_space \<lparr> space = X ` space M \<times> Y ` space M, sets = Pow (X ` space M \<times> Y ` space M)\<rparr> 

336 
(joint_distribution X Y)" 

337 
(is "finite_prob_space ?S _") 

338 
proof (simp add: finite_prob_space_eq finite_product_measure_space_of_images) 

339 
have "X ` X ` space M \<inter> Y ` Y ` space M \<inter> space M = space M" by auto 

340 
thus "joint_distribution X Y (X ` space M \<times> Y ` space M) = 1" 

341 
by (simp add: distribution_def prob_space vimage_Times comp_def measure_space_1) 

342 
qed 

35977  343 

39092  344 
lemma (in prob_space) prob_space_subalgebra: 
345 
assumes "N \<subseteq> sets M" "sigma_algebra (M\<lparr> sets := N \<rparr>)" 

346 
shows "prob_space (M\<lparr> sets := N \<rparr>) \<mu>" 

347 
proof  

348 
interpret N: measure_space "M\<lparr> sets := N \<rparr>" \<mu> 

349 
using measure_space_subalgebra[OF assms] . 

350 
show ?thesis 

351 
proof qed (simp add: measure_space_1) 

35977  352 
qed 
353 

39092  354 
lemma (in prob_space) prob_space_of_restricted_space: 
355 
assumes "\<mu> A \<noteq> 0" "\<mu> A \<noteq> \<omega>" "A \<in> sets M" 

356 
shows "prob_space (restricted_space A) (\<lambda>S. \<mu> S / \<mu> A)" 

357 
unfolding prob_space_def prob_space_axioms_def 

358 
proof 

359 
show "\<mu> (space (restricted_space A)) / \<mu> A = 1" 

360 
using `\<mu> A \<noteq> 0` `\<mu> A \<noteq> \<omega>` by (auto simp: pinfreal_noteq_omega_Ex) 

361 
have *: "\<And>S. \<mu> S / \<mu> A = inverse (\<mu> A) * \<mu> S" by (simp add: mult_commute) 

362 
interpret A: measure_space "restricted_space A" \<mu> 

363 
using `A \<in> sets M` by (rule restricted_measure_space) 

364 
show "measure_space (restricted_space A) (\<lambda>S. \<mu> S / \<mu> A)" 

365 
proof 

366 
show "\<mu> {} / \<mu> A = 0" by auto 

367 
show "countably_additive (restricted_space A) (\<lambda>S. \<mu> S / \<mu> A)" 

368 
unfolding countably_additive_def psuminf_cmult_right * 

369 
using A.measure_countably_additive by auto 

370 
qed 

371 
qed 

372 

373 
lemma finite_prob_spaceI: 

374 
assumes "finite (space M)" "sets M = Pow(space M)" "\<mu> (space M) = 1" "\<mu> {} = 0" 

375 
and "\<And>A B. A\<subseteq>space M \<Longrightarrow> B\<subseteq>space M \<Longrightarrow> A \<inter> B = {} \<Longrightarrow> \<mu> (A \<union> B) = \<mu> A + \<mu> B" 

376 
shows "finite_prob_space M \<mu>" 

377 
unfolding finite_prob_space_eq 

378 
proof 

379 
show "finite_measure_space M \<mu>" using assms 

380 
by (auto intro!: finite_measure_spaceI) 

381 
show "\<mu> (space M) = 1" by fact 

382 
qed 

36624  383 

384 
lemma (in finite_prob_space) finite_measure_space: 

38656  385 
shows "finite_measure_space \<lparr>space = X ` space M, sets = Pow (X ` space M)\<rparr> (distribution X)" 
386 
(is "finite_measure_space ?S _") 

39092  387 
proof (rule finite_measure_spaceI, simp_all) 
36624  388 
show "finite (X ` space M)" using finite_space by simp 
389 

38656  390 
show "positive (distribution X)" 
391 
unfolding distribution_def positive_def using sets_eq_Pow by auto 

36624  392 

393 
show "additive ?S (distribution X)" unfolding additive_def distribution_def 

394 
proof (simp, safe) 

395 
fix x y 

396 
have x: "(X ` x) \<inter> space M \<in> sets M" 

397 
and y: "(X ` y) \<inter> space M \<in> sets M" using sets_eq_Pow by auto 

398 
assume "x \<inter> y = {}" 

38656  399 
hence "X ` x \<inter> space M \<inter> (X ` y \<inter> space M) = {}" by auto 
36624  400 
from additive[unfolded additive_def, rule_format, OF x y] this 
38656  401 
finite_measure[OF x] finite_measure[OF y] 
402 
have "\<mu> (((X ` x) \<union> (X ` y)) \<inter> space M) = 

403 
\<mu> ((X ` x) \<inter> space M) + \<mu> ((X ` y) \<inter> space M)" 

404 
by (subst Int_Un_distrib2) auto 

405 
thus "\<mu> ((X ` x \<union> X ` y) \<inter> space M) = \<mu> (X ` x \<inter> space M) + \<mu> (X ` y \<inter> space M)" 

36624  406 
by auto 
407 
qed 

38656  408 

409 
{ fix x assume "x \<in> X ` space M" thus "distribution X {x} \<noteq> \<omega>" 

410 
unfolding distribution_def by (auto intro!: finite_measure simp: sets_eq_Pow) } 

36624  411 
qed 
412 

39096  413 
lemma (in finite_prob_space) finite_product_measure_space: 
414 
assumes "finite s1" "finite s2" 

415 
shows "finite_measure_space \<lparr> space = s1 \<times> s2, sets = Pow (s1 \<times> s2)\<rparr> (joint_distribution X Y)" 

416 
(is "finite_measure_space ?M ?D") 

417 
proof (rule finite_Pow_additivity_sufficient) 

418 
show "positive ?D" 

419 
unfolding positive_def using assms sets_eq_Pow 

420 
by (simp add: distribution_def) 

421 

422 
show "additive ?M ?D" unfolding additive_def 

423 
proof safe 

424 
fix x y 

425 
have A: "((\<lambda>x. (X x, Y x)) ` x) \<inter> space M \<in> sets M" using assms sets_eq_Pow by auto 

426 
have B: "((\<lambda>x. (X x, Y x)) ` y) \<inter> space M \<in> sets M" using assms sets_eq_Pow by auto 

427 
assume "x \<inter> y = {}" 

428 
hence "(\<lambda>x. (X x, Y x)) ` x \<inter> space M \<inter> ((\<lambda>x. (X x, Y x)) ` y \<inter> space M) = {}" 

429 
by auto 

430 
from additive[unfolded additive_def, rule_format, OF A B] this 

431 
finite_measure[OF A] finite_measure[OF B] 

432 
show "?D (x \<union> y) = ?D x + ?D y" 

433 
apply (simp add: distribution_def) 

434 
apply (subst Int_Un_distrib2) 

435 
by (auto simp: real_of_pinfreal_add) 

436 
qed 

437 

438 
show "finite (space ?M)" 

439 
using assms by auto 

440 

441 
show "sets ?M = Pow (space ?M)" 

442 
by simp 

443 

444 
{ fix x assume "x \<in> space ?M" thus "?D {x} \<noteq> \<omega>" 

445 
unfolding distribution_def by (auto intro!: finite_measure simp: sets_eq_Pow) } 

446 
qed 

447 

448 
lemma (in finite_measure_space) finite_product_measure_space_of_images: 

449 
shows "finite_measure_space \<lparr> space = X ` space M \<times> Y ` space M, 

450 
sets = Pow (X ` space M \<times> Y ` space M) \<rparr> 

451 
(joint_distribution X Y)" 

452 
using finite_space by (auto intro!: finite_product_measure_space) 

453 

39085  454 
section "Conditional Expectation and Probability" 
455 

456 
lemma (in prob_space) conditional_expectation_exists: 

39083  457 
fixes X :: "'a \<Rightarrow> pinfreal" 
458 
assumes borel: "X \<in> borel_measurable M" 

459 
and N_subalgebra: "N \<subseteq> sets M" "sigma_algebra (M\<lparr> sets := N \<rparr>)" 

460 
shows "\<exists>Y\<in>borel_measurable (M\<lparr> sets := N \<rparr>). \<forall>C\<in>N. 

461 
positive_integral (\<lambda>x. Y x * indicator C x) = positive_integral (\<lambda>x. X x * indicator C x)" 

462 
proof  

463 
interpret P: prob_space "M\<lparr> sets := N \<rparr>" \<mu> 

464 
using prob_space_subalgebra[OF N_subalgebra] . 

465 

466 
let "?f A" = "\<lambda>x. X x * indicator A x" 

467 
let "?Q A" = "positive_integral (?f A)" 

468 

469 
from measure_space_density[OF borel] 

470 
have Q: "measure_space (M\<lparr> sets := N \<rparr>) ?Q" 

471 
by (rule measure_space.measure_space_subalgebra[OF _ N_subalgebra]) 

472 
then interpret Q: measure_space "M\<lparr> sets := N \<rparr>" ?Q . 

473 

474 
have "P.absolutely_continuous ?Q" 

475 
unfolding P.absolutely_continuous_def 

476 
proof (safe, simp) 

477 
fix A assume "A \<in> N" "\<mu> A = 0" 

478 
moreover then have f_borel: "?f A \<in> borel_measurable M" 

479 
using borel N_subalgebra by (auto intro: borel_measurable_indicator) 

480 
moreover have "{x\<in>space M. ?f A x \<noteq> 0} = (?f A ` {0<..} \<inter> space M) \<inter> A" 

481 
by (auto simp: indicator_def) 

482 
moreover have "\<mu> \<dots> \<le> \<mu> A" 

483 
using `A \<in> N` N_subalgebra f_borel 

484 
by (auto intro!: measure_mono Int[of _ A] measurable_sets) 

485 
ultimately show "?Q A = 0" 

486 
by (simp add: positive_integral_0_iff) 

487 
qed 

488 
from P.Radon_Nikodym[OF Q this] 

489 
obtain Y where Y: "Y \<in> borel_measurable (M\<lparr>sets := N\<rparr>)" 

490 
"\<And>A. A \<in> sets (M\<lparr>sets:=N\<rparr>) \<Longrightarrow> ?Q A = P.positive_integral (\<lambda>x. Y x * indicator A x)" 

491 
by blast 

39084  492 
with N_subalgebra show ?thesis 
493 
by (auto intro!: bexI[OF _ Y(1)]) 

39083  494 
qed 
495 

39085  496 
definition (in prob_space) 
497 
"conditional_expectation N X = (SOME Y. Y\<in>borel_measurable (M\<lparr>sets:=N\<rparr>) 

498 
\<and> (\<forall>C\<in>N. positive_integral (\<lambda>x. Y x * indicator C x) = positive_integral (\<lambda>x. X x * indicator C x)))" 

499 

500 
abbreviation (in prob_space) 

39092  501 
"conditional_prob N A \<equiv> conditional_expectation N (indicator A)" 
39085  502 

503 
lemma (in prob_space) 

504 
fixes X :: "'a \<Rightarrow> pinfreal" 

505 
assumes borel: "X \<in> borel_measurable M" 

506 
and N_subalgebra: "N \<subseteq> sets M" "sigma_algebra (M\<lparr> sets := N \<rparr>)" 

507 
shows borel_measurable_conditional_expectation: 

508 
"conditional_expectation N X \<in> borel_measurable (M\<lparr> sets := N \<rparr>)" 

509 
and conditional_expectation: "\<And>C. C \<in> N \<Longrightarrow> 

510 
positive_integral (\<lambda>x. conditional_expectation N X x * indicator C x) = 

511 
positive_integral (\<lambda>x. X x * indicator C x)" 

512 
(is "\<And>C. C \<in> N \<Longrightarrow> ?eq C") 

513 
proof  

514 
note CE = conditional_expectation_exists[OF assms, unfolded Bex_def] 

515 
then show "conditional_expectation N X \<in> borel_measurable (M\<lparr> sets := N \<rparr>)" 

516 
unfolding conditional_expectation_def by (rule someI2_ex) blast 

517 

518 
from CE show "\<And>C. C\<in>N \<Longrightarrow> ?eq C" 

519 
unfolding conditional_expectation_def by (rule someI2_ex) blast 

520 
qed 

521 

39091  522 
lemma (in sigma_algebra) factorize_measurable_function: 
523 
fixes Z :: "'a \<Rightarrow> pinfreal" and Y :: "'a \<Rightarrow> 'c" 

524 
assumes "sigma_algebra M'" and "Y \<in> measurable M M'" "Z \<in> borel_measurable M" 

525 
shows "Z \<in> borel_measurable (sigma_algebra.vimage_algebra M' (space M) Y) 

526 
\<longleftrightarrow> (\<exists>g\<in>borel_measurable M'. \<forall>x\<in>space M. Z x = g (Y x))" 

527 
proof safe 

528 
interpret M': sigma_algebra M' by fact 

529 
have Y: "Y \<in> space M \<rightarrow> space M'" using assms unfolding measurable_def by auto 

530 
from M'.sigma_algebra_vimage[OF this] 

531 
interpret va: sigma_algebra "M'.vimage_algebra (space M) Y" . 

532 

533 
{ fix g :: "'c \<Rightarrow> pinfreal" assume "g \<in> borel_measurable M'" 

534 
with M'.measurable_vimage_algebra[OF Y] 

535 
have "g \<circ> Y \<in> borel_measurable (M'.vimage_algebra (space M) Y)" 

536 
by (rule measurable_comp) 

537 
moreover assume "\<forall>x\<in>space M. Z x = g (Y x)" 

538 
then have "Z \<in> borel_measurable (M'.vimage_algebra (space M) Y) \<longleftrightarrow> 

539 
g \<circ> Y \<in> borel_measurable (M'.vimage_algebra (space M) Y)" 

540 
by (auto intro!: measurable_cong) 

541 
ultimately show "Z \<in> borel_measurable (M'.vimage_algebra (space M) Y)" 

542 
by simp } 

543 

544 
assume "Z \<in> borel_measurable (M'.vimage_algebra (space M) Y)" 

545 
from va.borel_measurable_implies_simple_function_sequence[OF this] 

546 
obtain f where f: "\<And>i. va.simple_function (f i)" and "f \<up> Z" by blast 

547 

548 
have "\<forall>i. \<exists>g. M'.simple_function g \<and> (\<forall>x\<in>space M. f i x = g (Y x))" 

549 
proof 

550 
fix i 

551 
from f[of i] have "finite (f i`space M)" and B_ex: 

552 
"\<forall>z\<in>(f i)`space M. \<exists>B. B \<in> sets M' \<and> (f i) ` {z} \<inter> space M = Y ` B \<inter> space M" 

553 
unfolding va.simple_function_def by auto 

554 
from B_ex[THEN bchoice] guess B .. note B = this 

555 

556 
let ?g = "\<lambda>x. \<Sum>z\<in>f i`space M. z * indicator (B z) x" 

557 

558 
show "\<exists>g. M'.simple_function g \<and> (\<forall>x\<in>space M. f i x = g (Y x))" 

559 
proof (intro exI[of _ ?g] conjI ballI) 

560 
show "M'.simple_function ?g" using B by auto 

561 

562 
fix x assume "x \<in> space M" 

563 
then have "\<And>z. z \<in> f i`space M \<Longrightarrow> indicator (B z) (Y x) = (indicator (f i ` {z} \<inter> space M) x::pinfreal)" 

564 
unfolding indicator_def using B by auto 

565 
then show "f i x = ?g (Y x)" using `x \<in> space M` f[of i] 

566 
by (subst va.simple_function_indicator_representation) auto 

567 
qed 

568 
qed 

569 
from choice[OF this] guess g .. note g = this 

570 

571 
show "\<exists>g\<in>borel_measurable M'. \<forall>x\<in>space M. Z x = g (Y x)" 

572 
proof (intro ballI bexI) 

573 
show "(SUP i. g i) \<in> borel_measurable M'" 

574 
using g by (auto intro: M'.borel_measurable_simple_function) 

575 
fix x assume "x \<in> space M" 

576 
have "Z x = (SUP i. f i) x" using `f \<up> Z` unfolding isoton_def by simp 

577 
also have "\<dots> = (SUP i. g i) (Y x)" unfolding SUPR_fun_expand 

578 
using g `x \<in> space M` by simp 

579 
finally show "Z x = (SUP i. g i) (Y x)" . 

580 
qed 

581 
qed 

39090
a2d38b8b693e
Introduced sigma algebra generated by function preimages.
hoelzl
parents:
39089
diff
changeset

582 

35582  583 
end 