author | hoelzl |
Wed, 02 Feb 2011 12:34:45 +0100 | |
changeset 41689 | 3e39b0e730d6 |
parent 41661 | baf1964bc468 |
child 41831 | 91a2b435dd7a |
permissions | -rw-r--r-- |
35582 | 1 |
theory Probability_Space |
40859 | 2 |
imports Lebesgue_Integration Radon_Nikodym Product_Measure |
35582 | 3 |
begin |
4 |
||
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
5 |
lemma real_of_pextreal_inverse[simp]: |
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
6 |
fixes X :: pextreal |
40859 | 7 |
shows "real (inverse X) = 1 / real X" |
8 |
by (cases X) (auto simp: inverse_eq_divide) |
|
9 |
||
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
10 |
lemma real_of_pextreal_le_0[simp]: "real (X :: pextreal) \<le> 0 \<longleftrightarrow> (X = 0 \<or> X = \<omega>)" |
40859 | 11 |
by (cases X) auto |
12 |
||
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
13 |
lemma real_of_pextreal_less_0[simp]: "\<not> (real (X :: pextreal) < 0)" |
40859 | 14 |
by (cases X) auto |
15 |
||
35582 | 16 |
locale prob_space = measure_space + |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
17 |
assumes measure_space_1: "measure M (space M) = 1" |
38656 | 18 |
|
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
19 |
lemma abs_real_of_pextreal[simp]: "\<bar>real (X :: pextreal)\<bar> = real X" |
40859 | 20 |
by simp |
21 |
||
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
22 |
lemma zero_less_real_of_pextreal: "0 < real (X :: pextreal) \<longleftrightarrow> X \<noteq> 0 \<and> X \<noteq> \<omega>" |
40859 | 23 |
by (cases X) auto |
24 |
||
38656 | 25 |
sublocale prob_space < finite_measure |
26 |
proof |
|
27 |
from measure_space_1 show "\<mu> (space M) \<noteq> \<omega>" by simp |
|
28 |
qed |
|
29 |
||
40859 | 30 |
abbreviation (in prob_space) "events \<equiv> sets M" |
31 |
abbreviation (in prob_space) "prob \<equiv> \<lambda>A. real (\<mu> A)" |
|
32 |
abbreviation (in prob_space) "prob_preserving \<equiv> measure_preserving" |
|
33 |
abbreviation (in prob_space) "random_variable M' X \<equiv> sigma_algebra M' \<and> X \<in> measurable M M'" |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
34 |
abbreviation (in prob_space) "expectation \<equiv> integral\<^isup>L M" |
35582 | 35 |
|
40859 | 36 |
definition (in prob_space) |
35582 | 37 |
"indep A B \<longleftrightarrow> A \<in> events \<and> B \<in> events \<and> prob (A \<inter> B) = prob A * prob B" |
38 |
||
40859 | 39 |
definition (in prob_space) |
35582 | 40 |
"indep_families F G \<longleftrightarrow> (\<forall> A \<in> F. \<forall> B \<in> G. indep A B)" |
41 |
||
40859 | 42 |
definition (in prob_space) |
38656 | 43 |
"distribution X = (\<lambda>s. \<mu> ((X -` s) \<inter> (space M)))" |
35582 | 44 |
|
40859 | 45 |
abbreviation (in prob_space) |
36624 | 46 |
"joint_distribution X Y \<equiv> distribution (\<lambda>x. (X x, Y x))" |
35582 | 47 |
|
39097 | 48 |
lemma (in prob_space) distribution_cong: |
49 |
assumes "\<And>x. x \<in> space M \<Longrightarrow> X x = Y x" |
|
50 |
shows "distribution X = distribution Y" |
|
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
51 |
unfolding distribution_def fun_eq_iff |
39097 | 52 |
using assms by (auto intro!: arg_cong[where f="\<mu>"]) |
53 |
||
54 |
lemma (in prob_space) joint_distribution_cong: |
|
55 |
assumes "\<And>x. x \<in> space M \<Longrightarrow> X x = X' x" |
|
56 |
assumes "\<And>x. x \<in> space M \<Longrightarrow> Y x = Y' x" |
|
57 |
shows "joint_distribution X Y = joint_distribution X' Y'" |
|
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
58 |
unfolding distribution_def fun_eq_iff |
39097 | 59 |
using assms by (auto intro!: arg_cong[where f="\<mu>"]) |
60 |
||
40859 | 61 |
lemma (in prob_space) distribution_id[simp]: |
62 |
assumes "N \<in> sets M" shows "distribution (\<lambda>x. x) N = \<mu> N" |
|
63 |
using assms by (auto simp: distribution_def intro!: arg_cong[where f=\<mu>]) |
|
64 |
||
65 |
lemma (in prob_space) prob_space: "prob (space M) = 1" |
|
38656 | 66 |
unfolding measure_space_1 by simp |
35582 | 67 |
|
40859 | 68 |
lemma (in prob_space) measure_le_1[simp, intro]: |
38656 | 69 |
assumes "A \<in> events" shows "\<mu> A \<le> 1" |
70 |
proof - |
|
71 |
have "\<mu> A \<le> \<mu> (space M)" |
|
72 |
using assms sets_into_space by(auto intro!: measure_mono) |
|
73 |
also note measure_space_1 |
|
74 |
finally show ?thesis . |
|
75 |
qed |
|
35582 | 76 |
|
40859 | 77 |
lemma (in prob_space) prob_compl: |
38656 | 78 |
assumes "A \<in> events" |
79 |
shows "prob (space M - A) = 1 - prob A" |
|
80 |
using `A \<in> events`[THEN sets_into_space] `A \<in> events` measure_space_1 |
|
81 |
by (subst real_finite_measure_Diff) auto |
|
35582 | 82 |
|
40859 | 83 |
lemma (in prob_space) indep_space: |
35582 | 84 |
assumes "s \<in> events" |
85 |
shows "indep (space M) s" |
|
38656 | 86 |
using assms prob_space by (simp add: indep_def) |
35582 | 87 |
|
40859 | 88 |
lemma (in prob_space) prob_space_increasing: "increasing M prob" |
38656 | 89 |
by (auto intro!: real_measure_mono simp: increasing_def) |
35582 | 90 |
|
40859 | 91 |
lemma (in prob_space) prob_zero_union: |
35582 | 92 |
assumes "s \<in> events" "t \<in> events" "prob t = 0" |
93 |
shows "prob (s \<union> t) = prob s" |
|
38656 | 94 |
using assms |
35582 | 95 |
proof - |
96 |
have "prob (s \<union> t) \<le> prob s" |
|
38656 | 97 |
using real_finite_measure_subadditive[of s t] assms by auto |
35582 | 98 |
moreover have "prob (s \<union> t) \<ge> prob s" |
38656 | 99 |
using assms by (blast intro: real_measure_mono) |
35582 | 100 |
ultimately show ?thesis by simp |
101 |
qed |
|
102 |
||
40859 | 103 |
lemma (in prob_space) prob_eq_compl: |
35582 | 104 |
assumes "s \<in> events" "t \<in> events" |
105 |
assumes "prob (space M - s) = prob (space M - t)" |
|
106 |
shows "prob s = prob t" |
|
38656 | 107 |
using assms prob_compl by auto |
35582 | 108 |
|
40859 | 109 |
lemma (in prob_space) prob_one_inter: |
35582 | 110 |
assumes events:"s \<in> events" "t \<in> events" |
111 |
assumes "prob t = 1" |
|
112 |
shows "prob (s \<inter> t) = prob s" |
|
113 |
proof - |
|
38656 | 114 |
have "prob ((space M - s) \<union> (space M - t)) = prob (space M - s)" |
115 |
using events assms prob_compl[of "t"] by (auto intro!: prob_zero_union) |
|
116 |
also have "(space M - s) \<union> (space M - t) = space M - (s \<inter> t)" |
|
117 |
by blast |
|
118 |
finally show "prob (s \<inter> t) = prob s" |
|
119 |
using events by (auto intro!: prob_eq_compl[of "s \<inter> t" s]) |
|
35582 | 120 |
qed |
121 |
||
40859 | 122 |
lemma (in prob_space) prob_eq_bigunion_image: |
35582 | 123 |
assumes "range f \<subseteq> events" "range g \<subseteq> events" |
124 |
assumes "disjoint_family f" "disjoint_family g" |
|
125 |
assumes "\<And> n :: nat. prob (f n) = prob (g n)" |
|
126 |
shows "(prob (\<Union> i. f i) = prob (\<Union> i. g i))" |
|
127 |
using assms |
|
128 |
proof - |
|
38656 | 129 |
have a: "(\<lambda> i. prob (f i)) sums (prob (\<Union> i. f i))" |
130 |
by (rule real_finite_measure_UNION[OF assms(1,3)]) |
|
131 |
have b: "(\<lambda> i. prob (g i)) sums (prob (\<Union> i. g i))" |
|
132 |
by (rule real_finite_measure_UNION[OF assms(2,4)]) |
|
133 |
show ?thesis using sums_unique[OF b] sums_unique[OF a] assms by simp |
|
35582 | 134 |
qed |
135 |
||
40859 | 136 |
lemma (in prob_space) prob_countably_zero: |
35582 | 137 |
assumes "range c \<subseteq> events" |
138 |
assumes "\<And> i. prob (c i) = 0" |
|
38656 | 139 |
shows "prob (\<Union> i :: nat. c i) = 0" |
140 |
proof (rule antisym) |
|
141 |
show "prob (\<Union> i :: nat. c i) \<le> 0" |
|
40859 | 142 |
using real_finite_measure_countably_subadditive[OF assms(1)] |
38656 | 143 |
by (simp add: assms(2) suminf_zero summable_zero) |
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
144 |
show "0 \<le> prob (\<Union> i :: nat. c i)" by (rule real_pextreal_nonneg) |
35582 | 145 |
qed |
146 |
||
40859 | 147 |
lemma (in prob_space) indep_sym: |
35582 | 148 |
"indep a b \<Longrightarrow> indep b a" |
149 |
unfolding indep_def using Int_commute[of a b] by auto |
|
150 |
||
40859 | 151 |
lemma (in prob_space) indep_refl: |
35582 | 152 |
assumes "a \<in> events" |
153 |
shows "indep a a = (prob a = 0) \<or> (prob a = 1)" |
|
154 |
using assms unfolding indep_def by auto |
|
155 |
||
40859 | 156 |
lemma (in prob_space) prob_equiprobable_finite_unions: |
38656 | 157 |
assumes "s \<in> events" |
158 |
assumes s_finite: "finite s" "\<And>x. x \<in> s \<Longrightarrow> {x} \<in> events" |
|
35582 | 159 |
assumes "\<And> x y. \<lbrakk>x \<in> s; y \<in> s\<rbrakk> \<Longrightarrow> (prob {x} = prob {y})" |
38656 | 160 |
shows "prob s = real (card s) * prob {SOME x. x \<in> s}" |
35582 | 161 |
proof (cases "s = {}") |
38656 | 162 |
case False hence "\<exists> x. x \<in> s" by blast |
35582 | 163 |
from someI_ex[OF this] assms |
164 |
have prob_some: "\<And> x. x \<in> s \<Longrightarrow> prob {x} = prob {SOME y. y \<in> s}" by blast |
|
165 |
have "prob s = (\<Sum> x \<in> s. prob {x})" |
|
38656 | 166 |
using real_finite_measure_finite_singelton[OF s_finite] by simp |
35582 | 167 |
also have "\<dots> = (\<Sum> x \<in> s. prob {SOME y. y \<in> s})" using prob_some by auto |
38656 | 168 |
also have "\<dots> = real (card s) * prob {(SOME x. x \<in> s)}" |
169 |
using setsum_constant assms by (simp add: real_eq_of_nat) |
|
35582 | 170 |
finally show ?thesis by simp |
38656 | 171 |
qed simp |
35582 | 172 |
|
40859 | 173 |
lemma (in prob_space) prob_real_sum_image_fn: |
35582 | 174 |
assumes "e \<in> events" |
175 |
assumes "\<And> x. x \<in> s \<Longrightarrow> e \<inter> f x \<in> events" |
|
176 |
assumes "finite s" |
|
38656 | 177 |
assumes disjoint: "\<And> x y. \<lbrakk>x \<in> s ; y \<in> s ; x \<noteq> y\<rbrakk> \<Longrightarrow> f x \<inter> f y = {}" |
178 |
assumes upper: "space M \<subseteq> (\<Union> i \<in> s. f i)" |
|
35582 | 179 |
shows "prob e = (\<Sum> x \<in> s. prob (e \<inter> f x))" |
180 |
proof - |
|
38656 | 181 |
have e: "e = (\<Union> i \<in> s. e \<inter> f i)" |
182 |
using `e \<in> events` sets_into_space upper by blast |
|
183 |
hence "prob e = prob (\<Union> i \<in> s. e \<inter> f i)" by simp |
|
184 |
also have "\<dots> = (\<Sum> x \<in> s. prob (e \<inter> f x))" |
|
185 |
proof (rule real_finite_measure_finite_Union) |
|
186 |
show "finite s" by fact |
|
187 |
show "\<And>i. i \<in> s \<Longrightarrow> e \<inter> f i \<in> events" by fact |
|
188 |
show "disjoint_family_on (\<lambda>i. e \<inter> f i) s" |
|
189 |
using disjoint by (auto simp: disjoint_family_on_def) |
|
190 |
qed |
|
191 |
finally show ?thesis . |
|
35582 | 192 |
qed |
193 |
||
40859 | 194 |
lemma (in prob_space) distribution_prob_space: |
195 |
assumes "random_variable S X" |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
196 |
shows "prob_space (S\<lparr>measure := distribution X\<rparr>)" |
35582 | 197 |
proof - |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
198 |
interpret S: measure_space "S\<lparr>measure := distribution X\<rparr>" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
199 |
unfolding distribution_def using assms |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
200 |
by (intro measure_space_vimage) |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
201 |
(auto intro!: sigma_algebra.sigma_algebra_cong[of S]) |
38656 | 202 |
show ?thesis |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
203 |
proof (default, simp) |
38656 | 204 |
have "X -` space S \<inter> space M = space M" |
205 |
using `random_variable S X` by (auto simp: measurable_def) |
|
39089 | 206 |
then show "distribution X (space S) = 1" |
207 |
using measure_space_1 by (simp add: distribution_def) |
|
35582 | 208 |
qed |
209 |
qed |
|
210 |
||
40859 | 211 |
lemma (in prob_space) AE_distribution: |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
212 |
assumes X: "random_variable MX X" and "measure_space.almost_everywhere (MX\<lparr>measure := distribution X\<rparr>) (\<lambda>x. Q x)" |
40859 | 213 |
shows "AE x. Q (X x)" |
214 |
proof - |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
215 |
interpret X: prob_space "MX\<lparr>measure := distribution X\<rparr>" using X by (rule distribution_prob_space) |
40859 | 216 |
obtain N where N: "N \<in> sets MX" "distribution X N = 0" "{x\<in>space MX. \<not> Q x} \<subseteq> N" |
217 |
using assms unfolding X.almost_everywhere_def by auto |
|
218 |
show "AE x. Q (X x)" |
|
219 |
using X[unfolded measurable_def] N unfolding distribution_def |
|
220 |
by (intro AE_I'[where N="X -` N \<inter> space M"]) auto |
|
221 |
qed |
|
222 |
||
223 |
lemma (in prob_space) distribution_lebesgue_thm1: |
|
35582 | 224 |
assumes "random_variable s X" |
225 |
assumes "A \<in> sets s" |
|
38656 | 226 |
shows "real (distribution X A) = expectation (indicator (X -` A \<inter> space M))" |
35582 | 227 |
unfolding distribution_def |
228 |
using assms unfolding measurable_def |
|
38656 | 229 |
using integral_indicator by auto |
35582 | 230 |
|
40859 | 231 |
lemma (in prob_space) distribution_lebesgue_thm2: |
232 |
assumes "random_variable S X" and "A \<in> sets S" |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
233 |
shows "distribution X A = integral\<^isup>P (S\<lparr>measure := distribution X\<rparr>) (indicator A)" |
35582 | 234 |
proof - |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
235 |
interpret S: prob_space "S\<lparr>measure := distribution X\<rparr>" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
236 |
using assms(1) by (rule distribution_prob_space) |
35582 | 237 |
show ?thesis |
38656 | 238 |
using S.positive_integral_indicator(1) |
35582 | 239 |
using assms unfolding distribution_def by auto |
240 |
qed |
|
241 |
||
40859 | 242 |
lemma (in prob_space) finite_expectation1: |
243 |
assumes f: "finite (X`space M)" and rv: "random_variable borel X" |
|
35582 | 244 |
shows "expectation X = (\<Sum> r \<in> X ` space M. r * prob (X -` {r} \<inter> space M))" |
40859 | 245 |
proof (rule integral_on_finite(2)[OF rv[THEN conjunct2] f]) |
38656 | 246 |
fix x have "X -` {x} \<inter> space M \<in> sets M" |
247 |
using rv unfolding measurable_def by auto |
|
248 |
thus "\<mu> (X -` {x} \<inter> space M) \<noteq> \<omega>" using finite_measure by simp |
|
249 |
qed |
|
35582 | 250 |
|
40859 | 251 |
lemma (in prob_space) finite_expectation: |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
252 |
assumes "finite (X`space M)" "random_variable borel X" |
38656 | 253 |
shows "expectation X = (\<Sum> r \<in> X ` (space M). r * real (distribution X {r}))" |
254 |
using assms unfolding distribution_def using finite_expectation1 by auto |
|
255 |
||
40859 | 256 |
lemma (in prob_space) prob_x_eq_1_imp_prob_y_eq_0: |
35582 | 257 |
assumes "{x} \<in> events" |
38656 | 258 |
assumes "prob {x} = 1" |
35582 | 259 |
assumes "{y} \<in> events" |
260 |
assumes "y \<noteq> x" |
|
261 |
shows "prob {y} = 0" |
|
262 |
using prob_one_inter[of "{y}" "{x}"] assms by auto |
|
263 |
||
40859 | 264 |
lemma (in prob_space) distribution_empty[simp]: "distribution X {} = 0" |
38656 | 265 |
unfolding distribution_def by simp |
266 |
||
40859 | 267 |
lemma (in prob_space) distribution_space[simp]: "distribution X (X ` space M) = 1" |
38656 | 268 |
proof - |
269 |
have "X -` X ` space M \<inter> space M = space M" by auto |
|
270 |
thus ?thesis unfolding distribution_def by (simp add: measure_space_1) |
|
271 |
qed |
|
272 |
||
40859 | 273 |
lemma (in prob_space) distribution_one: |
274 |
assumes "random_variable M' X" and "A \<in> sets M'" |
|
38656 | 275 |
shows "distribution X A \<le> 1" |
276 |
proof - |
|
277 |
have "distribution X A \<le> \<mu> (space M)" unfolding distribution_def |
|
278 |
using assms[unfolded measurable_def] by (auto intro!: measure_mono) |
|
279 |
thus ?thesis by (simp add: measure_space_1) |
|
280 |
qed |
|
281 |
||
40859 | 282 |
lemma (in prob_space) distribution_finite: |
283 |
assumes "random_variable M' X" and "A \<in> sets M'" |
|
38656 | 284 |
shows "distribution X A \<noteq> \<omega>" |
285 |
using distribution_one[OF assms] by auto |
|
286 |
||
40859 | 287 |
lemma (in prob_space) distribution_x_eq_1_imp_distribution_y_eq_0: |
35582 | 288 |
assumes X: "random_variable \<lparr>space = X ` (space M), sets = Pow (X ` (space M))\<rparr> X" |
38656 | 289 |
(is "random_variable ?S X") |
290 |
assumes "distribution X {x} = 1" |
|
35582 | 291 |
assumes "y \<noteq> x" |
292 |
shows "distribution X {y} = 0" |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
293 |
proof cases |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
294 |
{ fix x have "X -` {x} \<inter> space M \<in> sets M" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
295 |
proof cases |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
296 |
assume "x \<in> X`space M" with X show ?thesis |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
297 |
by (auto simp: measurable_def image_iff) |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
298 |
next |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
299 |
assume "x \<notin> X`space M" then have "X -` {x} \<inter> space M = {}" by auto |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
300 |
then show ?thesis by auto |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
301 |
qed } note single = this |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
302 |
have "X -` {x} \<inter> space M - X -` {y} \<inter> space M = X -` {x} \<inter> space M" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
303 |
"X -` {y} \<inter> space M \<inter> (X -` {x} \<inter> space M) = {}" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
304 |
using `y \<noteq> x` by auto |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
305 |
with measure_inter_full_set[OF single single, of x y] assms(2) |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
306 |
show ?thesis unfolding distribution_def measure_space_1 by auto |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
307 |
next |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
308 |
assume "{y} \<notin> sets ?S" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
309 |
then have "X -` {y} \<inter> space M = {}" by auto |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
310 |
thus "distribution X {y} = 0" unfolding distribution_def by auto |
35582 | 311 |
qed |
312 |
||
40859 | 313 |
lemma (in prob_space) joint_distribution_Times_le_fst: |
314 |
assumes X: "random_variable MX X" and Y: "random_variable MY Y" |
|
315 |
and A: "A \<in> sets MX" and B: "B \<in> sets MY" |
|
316 |
shows "joint_distribution X Y (A \<times> B) \<le> distribution X A" |
|
317 |
unfolding distribution_def |
|
318 |
proof (intro measure_mono) |
|
319 |
show "(\<lambda>x. (X x, Y x)) -` (A \<times> B) \<inter> space M \<subseteq> X -` A \<inter> space M" by force |
|
320 |
show "X -` A \<inter> space M \<in> events" |
|
321 |
using X A unfolding measurable_def by simp |
|
322 |
have *: "(\<lambda>x. (X x, Y x)) -` (A \<times> B) \<inter> space M = |
|
323 |
(X -` A \<inter> space M) \<inter> (Y -` B \<inter> space M)" by auto |
|
324 |
show "(\<lambda>x. (X x, Y x)) -` (A \<times> B) \<inter> space M \<in> events" |
|
325 |
unfolding * apply (rule Int) |
|
326 |
using assms unfolding measurable_def by auto |
|
327 |
qed |
|
328 |
||
329 |
lemma (in prob_space) joint_distribution_commute: |
|
330 |
"joint_distribution X Y x = joint_distribution Y X ((\<lambda>(x,y). (y,x))`x)" |
|
331 |
unfolding distribution_def by (auto intro!: arg_cong[where f=\<mu>]) |
|
332 |
||
333 |
lemma (in prob_space) joint_distribution_Times_le_snd: |
|
334 |
assumes X: "random_variable MX X" and Y: "random_variable MY Y" |
|
335 |
and A: "A \<in> sets MX" and B: "B \<in> sets MY" |
|
336 |
shows "joint_distribution X Y (A \<times> B) \<le> distribution Y B" |
|
337 |
using assms |
|
338 |
by (subst joint_distribution_commute) |
|
339 |
(simp add: swap_product joint_distribution_Times_le_fst) |
|
340 |
||
341 |
lemma (in prob_space) random_variable_pairI: |
|
342 |
assumes "random_variable MX X" |
|
343 |
assumes "random_variable MY Y" |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
344 |
shows "random_variable (MX \<Otimes>\<^isub>M MY) (\<lambda>x. (X x, Y x))" |
40859 | 345 |
proof |
346 |
interpret MX: sigma_algebra MX using assms by simp |
|
347 |
interpret MY: sigma_algebra MY using assms by simp |
|
348 |
interpret P: pair_sigma_algebra MX MY by default |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
349 |
show "sigma_algebra (MX \<Otimes>\<^isub>M MY)" by default |
40859 | 350 |
have sa: "sigma_algebra M" by default |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
351 |
show "(\<lambda>x. (X x, Y x)) \<in> measurable M (MX \<Otimes>\<^isub>M MY)" |
41095 | 352 |
unfolding P.measurable_pair_iff[OF sa] using assms by (simp add: comp_def) |
40859 | 353 |
qed |
354 |
||
355 |
lemma (in prob_space) distribution_order: |
|
356 |
assumes "random_variable MX X" "random_variable MY Y" |
|
357 |
assumes "{x} \<in> sets MX" "{y} \<in> sets MY" |
|
358 |
shows "r \<le> joint_distribution X Y {(x, y)} \<Longrightarrow> r \<le> distribution X {x}" |
|
359 |
and "r \<le> joint_distribution X Y {(x, y)} \<Longrightarrow> r \<le> distribution Y {y}" |
|
360 |
and "r < joint_distribution X Y {(x, y)} \<Longrightarrow> r < distribution X {x}" |
|
361 |
and "r < joint_distribution X Y {(x, y)} \<Longrightarrow> r < distribution Y {y}" |
|
362 |
and "distribution X {x} = 0 \<Longrightarrow> joint_distribution X Y {(x, y)} = 0" |
|
363 |
and "distribution Y {y} = 0 \<Longrightarrow> joint_distribution X Y {(x, y)} = 0" |
|
364 |
using joint_distribution_Times_le_snd[OF assms] |
|
365 |
using joint_distribution_Times_le_fst[OF assms] |
|
366 |
by auto |
|
367 |
||
368 |
lemma (in prob_space) joint_distribution_commute_singleton: |
|
369 |
"joint_distribution X Y {(x, y)} = joint_distribution Y X {(y, x)}" |
|
370 |
unfolding distribution_def by (auto intro!: arg_cong[where f=\<mu>]) |
|
371 |
||
372 |
lemma (in prob_space) joint_distribution_assoc_singleton: |
|
373 |
"joint_distribution X (\<lambda>x. (Y x, Z x)) {(x, y, z)} = |
|
374 |
joint_distribution (\<lambda>x. (X x, Y x)) Z {((x, y), z)}" |
|
375 |
unfolding distribution_def by (auto intro!: arg_cong[where f=\<mu>]) |
|
376 |
||
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
377 |
locale pair_prob_space = M1: prob_space M1 + M2: prob_space M2 for M1 M2 |
40859 | 378 |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
379 |
sublocale pair_prob_space \<subseteq> pair_sigma_finite M1 M2 by default |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
380 |
|
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
381 |
sublocale pair_prob_space \<subseteq> P: prob_space P |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
382 |
by default (simp add: pair_measure_times M1.measure_space_1 M2.measure_space_1 space_pair_measure) |
40859 | 383 |
|
384 |
lemma countably_additiveI[case_names countably]: |
|
385 |
assumes "\<And>A. \<lbrakk> range A \<subseteq> sets M ; disjoint_family A ; (\<Union>i. A i) \<in> sets M\<rbrakk> \<Longrightarrow> |
|
386 |
(\<Sum>\<^isub>\<infinity>n. \<mu> (A n)) = \<mu> (\<Union>i. A i)" |
|
387 |
shows "countably_additive M \<mu>" |
|
388 |
using assms unfolding countably_additive_def by auto |
|
389 |
||
390 |
lemma (in prob_space) joint_distribution_prob_space: |
|
391 |
assumes "random_variable MX X" "random_variable MY Y" |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
392 |
shows "prob_space ((MX \<Otimes>\<^isub>M MY) \<lparr> measure := joint_distribution X Y\<rparr>)" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
393 |
using random_variable_pairI[OF assms] by (rule distribution_prob_space) |
40859 | 394 |
|
395 |
section "Probability spaces on finite sets" |
|
35582 | 396 |
|
35977 | 397 |
locale finite_prob_space = prob_space + finite_measure_space |
398 |
||
40859 | 399 |
abbreviation (in prob_space) "finite_random_variable M' X \<equiv> finite_sigma_algebra M' \<and> X \<in> measurable M M'" |
400 |
||
401 |
lemma (in prob_space) finite_random_variableD: |
|
402 |
assumes "finite_random_variable M' X" shows "random_variable M' X" |
|
403 |
proof - |
|
404 |
interpret M': finite_sigma_algebra M' using assms by simp |
|
405 |
then show "random_variable M' X" using assms by simp default |
|
406 |
qed |
|
407 |
||
408 |
lemma (in prob_space) distribution_finite_prob_space: |
|
409 |
assumes "finite_random_variable MX X" |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
410 |
shows "finite_prob_space (MX\<lparr>measure := distribution X\<rparr>)" |
40859 | 411 |
proof - |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
412 |
interpret X: prob_space "MX\<lparr>measure := distribution X\<rparr>" |
40859 | 413 |
using assms[THEN finite_random_variableD] by (rule distribution_prob_space) |
414 |
interpret MX: finite_sigma_algebra MX |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
415 |
using assms by auto |
40859 | 416 |
show ?thesis |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
417 |
proof (default, simp_all) |
40859 | 418 |
fix x assume "x \<in> space MX" |
419 |
then have "X -` {x} \<inter> space M \<in> sets M" |
|
420 |
using assms unfolding measurable_def by simp |
|
421 |
then show "distribution X {x} \<noteq> \<omega>" |
|
422 |
unfolding distribution_def by simp |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
423 |
qed (rule MX.finite_space) |
40859 | 424 |
qed |
425 |
||
426 |
lemma (in prob_space) simple_function_imp_finite_random_variable[simp, intro]: |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
427 |
assumes "simple_function M X" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
428 |
shows "finite_random_variable \<lparr> space = X`space M, sets = Pow (X`space M), \<dots> = x \<rparr> X" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
429 |
(is "finite_random_variable ?X _") |
40859 | 430 |
proof (intro conjI) |
431 |
have [simp]: "finite (X ` space M)" using assms unfolding simple_function_def by simp |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
432 |
interpret X: sigma_algebra ?X by (rule sigma_algebra_Pow) |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
433 |
show "finite_sigma_algebra ?X" |
40859 | 434 |
by default auto |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
435 |
show "X \<in> measurable M ?X" |
40859 | 436 |
proof (unfold measurable_def, clarsimp) |
437 |
fix A assume A: "A \<subseteq> X`space M" |
|
438 |
then have "finite A" by (rule finite_subset) simp |
|
439 |
then have "X -` (\<Union>a\<in>A. {a}) \<inter> space M \<in> events" |
|
440 |
unfolding vimage_UN UN_extend_simps |
|
441 |
apply (rule finite_UN) |
|
442 |
using A assms unfolding simple_function_def by auto |
|
443 |
then show "X -` A \<inter> space M \<in> events" by simp |
|
444 |
qed |
|
445 |
qed |
|
446 |
||
447 |
lemma (in prob_space) simple_function_imp_random_variable[simp, intro]: |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
448 |
assumes "simple_function M X" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
449 |
shows "random_variable \<lparr> space = X`space M, sets = Pow (X`space M), \<dots> = ext \<rparr> X" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
450 |
using simple_function_imp_finite_random_variable[OF assms, of ext] |
40859 | 451 |
by (auto dest!: finite_random_variableD) |
452 |
||
453 |
lemma (in prob_space) sum_over_space_real_distribution: |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
454 |
"simple_function M X \<Longrightarrow> (\<Sum>x\<in>X`space M. real (distribution X {x})) = 1" |
40859 | 455 |
unfolding distribution_def prob_space[symmetric] |
456 |
by (subst real_finite_measure_finite_Union[symmetric]) |
|
457 |
(auto simp add: disjoint_family_on_def simple_function_def |
|
458 |
intro!: arg_cong[where f=prob]) |
|
459 |
||
460 |
lemma (in prob_space) finite_random_variable_pairI: |
|
461 |
assumes "finite_random_variable MX X" |
|
462 |
assumes "finite_random_variable MY Y" |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
463 |
shows "finite_random_variable (MX \<Otimes>\<^isub>M MY) (\<lambda>x. (X x, Y x))" |
40859 | 464 |
proof |
465 |
interpret MX: finite_sigma_algebra MX using assms by simp |
|
466 |
interpret MY: finite_sigma_algebra MY using assms by simp |
|
467 |
interpret P: pair_finite_sigma_algebra MX MY by default |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
468 |
show "finite_sigma_algebra (MX \<Otimes>\<^isub>M MY)" by default |
40859 | 469 |
have sa: "sigma_algebra M" by default |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
470 |
show "(\<lambda>x. (X x, Y x)) \<in> measurable M (MX \<Otimes>\<^isub>M MY)" |
41095 | 471 |
unfolding P.measurable_pair_iff[OF sa] using assms by (simp add: comp_def) |
40859 | 472 |
qed |
473 |
||
474 |
lemma (in prob_space) finite_random_variable_imp_sets: |
|
475 |
"finite_random_variable MX X \<Longrightarrow> x \<in> space MX \<Longrightarrow> {x} \<in> sets MX" |
|
476 |
unfolding finite_sigma_algebra_def finite_sigma_algebra_axioms_def by simp |
|
477 |
||
478 |
lemma (in prob_space) finite_random_variable_vimage: |
|
479 |
assumes X: "finite_random_variable MX X" shows "X -` A \<inter> space M \<in> events" |
|
480 |
proof - |
|
481 |
interpret X: finite_sigma_algebra MX using X by simp |
|
482 |
from X have vimage: "\<And>A. A \<subseteq> space MX \<Longrightarrow> X -` A \<inter> space M \<in> events" and |
|
483 |
"X \<in> space M \<rightarrow> space MX" |
|
484 |
by (auto simp: measurable_def) |
|
485 |
then have *: "X -` A \<inter> space M = X -` (A \<inter> space MX) \<inter> space M" |
|
486 |
by auto |
|
487 |
show "X -` A \<inter> space M \<in> events" |
|
488 |
unfolding * by (intro vimage) auto |
|
489 |
qed |
|
490 |
||
491 |
lemma (in prob_space) joint_distribution_finite_Times_le_fst: |
|
492 |
assumes X: "finite_random_variable MX X" and Y: "finite_random_variable MY Y" |
|
493 |
shows "joint_distribution X Y (A \<times> B) \<le> distribution X A" |
|
494 |
unfolding distribution_def |
|
495 |
proof (intro measure_mono) |
|
496 |
show "(\<lambda>x. (X x, Y x)) -` (A \<times> B) \<inter> space M \<subseteq> X -` A \<inter> space M" by force |
|
497 |
show "X -` A \<inter> space M \<in> events" |
|
498 |
using finite_random_variable_vimage[OF X] . |
|
499 |
have *: "(\<lambda>x. (X x, Y x)) -` (A \<times> B) \<inter> space M = |
|
500 |
(X -` A \<inter> space M) \<inter> (Y -` B \<inter> space M)" by auto |
|
501 |
show "(\<lambda>x. (X x, Y x)) -` (A \<times> B) \<inter> space M \<in> events" |
|
502 |
unfolding * apply (rule Int) |
|
503 |
using assms[THEN finite_random_variable_vimage] by auto |
|
504 |
qed |
|
505 |
||
506 |
lemma (in prob_space) joint_distribution_finite_Times_le_snd: |
|
507 |
assumes X: "finite_random_variable MX X" and Y: "finite_random_variable MY Y" |
|
508 |
shows "joint_distribution X Y (A \<times> B) \<le> distribution Y B" |
|
509 |
using assms |
|
510 |
by (subst joint_distribution_commute) |
|
511 |
(simp add: swap_product joint_distribution_finite_Times_le_fst) |
|
512 |
||
513 |
lemma (in prob_space) finite_distribution_order: |
|
514 |
assumes "finite_random_variable MX X" "finite_random_variable MY Y" |
|
515 |
shows "r \<le> joint_distribution X Y {(x, y)} \<Longrightarrow> r \<le> distribution X {x}" |
|
516 |
and "r \<le> joint_distribution X Y {(x, y)} \<Longrightarrow> r \<le> distribution Y {y}" |
|
517 |
and "r < joint_distribution X Y {(x, y)} \<Longrightarrow> r < distribution X {x}" |
|
518 |
and "r < joint_distribution X Y {(x, y)} \<Longrightarrow> r < distribution Y {y}" |
|
519 |
and "distribution X {x} = 0 \<Longrightarrow> joint_distribution X Y {(x, y)} = 0" |
|
520 |
and "distribution Y {y} = 0 \<Longrightarrow> joint_distribution X Y {(x, y)} = 0" |
|
521 |
using joint_distribution_finite_Times_le_snd[OF assms, of "{x}" "{y}"] |
|
522 |
using joint_distribution_finite_Times_le_fst[OF assms, of "{x}" "{y}"] |
|
523 |
by auto |
|
524 |
||
525 |
lemma (in prob_space) finite_distribution_finite: |
|
526 |
assumes "finite_random_variable M' X" |
|
527 |
shows "distribution X {x} \<noteq> \<omega>" |
|
528 |
proof - |
|
529 |
have "distribution X {x} \<le> \<mu> (space M)" |
|
530 |
unfolding distribution_def |
|
531 |
using finite_random_variable_vimage[OF assms] |
|
532 |
by (intro measure_mono) auto |
|
533 |
then show ?thesis |
|
534 |
by auto |
|
535 |
qed |
|
536 |
||
537 |
lemma (in prob_space) setsum_joint_distribution: |
|
538 |
assumes X: "finite_random_variable MX X" |
|
539 |
assumes Y: "random_variable MY Y" "B \<in> sets MY" |
|
540 |
shows "(\<Sum>a\<in>space MX. joint_distribution X Y ({a} \<times> B)) = distribution Y B" |
|
541 |
unfolding distribution_def |
|
542 |
proof (subst measure_finitely_additive'') |
|
543 |
interpret MX: finite_sigma_algebra MX using X by auto |
|
544 |
show "finite (space MX)" using MX.finite_space . |
|
545 |
let "?d i" = "(\<lambda>x. (X x, Y x)) -` ({i} \<times> B) \<inter> space M" |
|
546 |
{ fix i assume "i \<in> space MX" |
|
547 |
moreover have "?d i = (X -` {i} \<inter> space M) \<inter> (Y -` B \<inter> space M)" by auto |
|
548 |
ultimately show "?d i \<in> events" |
|
549 |
using measurable_sets[of X M MX] measurable_sets[of Y M MY B] X Y |
|
550 |
using MX.sets_eq_Pow by auto } |
|
551 |
show "disjoint_family_on ?d (space MX)" by (auto simp: disjoint_family_on_def) |
|
552 |
show "\<mu> (\<Union>i\<in>space MX. ?d i) = \<mu> (Y -` B \<inter> space M)" |
|
553 |
using X[unfolded measurable_def] |
|
554 |
by (auto intro!: arg_cong[where f=\<mu>]) |
|
555 |
qed |
|
556 |
||
557 |
lemma (in prob_space) setsum_joint_distribution_singleton: |
|
558 |
assumes X: "finite_random_variable MX X" |
|
559 |
assumes Y: "finite_random_variable MY Y" "b \<in> space MY" |
|
560 |
shows "(\<Sum>a\<in>space MX. joint_distribution X Y {(a, b)}) = distribution Y {b}" |
|
561 |
using setsum_joint_distribution[OF X |
|
562 |
finite_random_variableD[OF Y(1)] |
|
563 |
finite_random_variable_imp_sets[OF Y]] by simp |
|
564 |
||
565 |
lemma (in prob_space) setsum_real_joint_distribution: |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
566 |
fixes MX :: "('c, 'x) measure_space_scheme" and MY :: "('d, 'y) measure_space_scheme" |
40859 | 567 |
assumes X: "finite_random_variable MX X" |
568 |
assumes Y: "random_variable MY Y" "B \<in> sets MY" |
|
569 |
shows "(\<Sum>a\<in>space MX. real (joint_distribution X Y ({a} \<times> B))) = real (distribution Y B)" |
|
570 |
proof - |
|
571 |
interpret MX: finite_sigma_algebra MX using X by auto |
|
572 |
show ?thesis |
|
573 |
unfolding setsum_joint_distribution[OF assms, symmetric] |
|
574 |
using distribution_finite[OF random_variable_pairI[OF finite_random_variableD[OF X] Y(1)]] Y(2) |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
575 |
by (simp add: space_pair_measure real_of_pextreal_setsum) |
40859 | 576 |
qed |
577 |
||
578 |
lemma (in prob_space) setsum_real_joint_distribution_singleton: |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
579 |
fixes MX :: "('c, 'x) measure_space_scheme" and MY :: "('d, 'y) measure_space_scheme" |
40859 | 580 |
assumes X: "finite_random_variable MX X" |
581 |
assumes Y: "finite_random_variable MY Y" "b \<in> space MY" |
|
582 |
shows "(\<Sum>a\<in>space MX. real (joint_distribution X Y {(a,b)})) = real (distribution Y {b})" |
|
583 |
using setsum_real_joint_distribution[OF X |
|
584 |
finite_random_variableD[OF Y(1)] |
|
585 |
finite_random_variable_imp_sets[OF Y]] by simp |
|
586 |
||
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
587 |
locale pair_finite_prob_space = M1: finite_prob_space M1 + M2: finite_prob_space M2 for M1 M2 |
40859 | 588 |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
589 |
sublocale pair_finite_prob_space \<subseteq> pair_prob_space M1 M2 by default |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
590 |
sublocale pair_finite_prob_space \<subseteq> pair_finite_space M1 M2 by default |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
591 |
sublocale pair_finite_prob_space \<subseteq> finite_prob_space P by default |
40859 | 592 |
|
593 |
lemma (in prob_space) joint_distribution_finite_prob_space: |
|
594 |
assumes X: "finite_random_variable MX X" |
|
595 |
assumes Y: "finite_random_variable MY Y" |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
596 |
shows "finite_prob_space ((MX \<Otimes>\<^isub>M MY)\<lparr> measure := joint_distribution X Y\<rparr>)" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
597 |
by (intro distribution_finite_prob_space finite_random_variable_pairI X Y) |
40859 | 598 |
|
36624 | 599 |
lemma finite_prob_space_eq: |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
600 |
"finite_prob_space M \<longleftrightarrow> finite_measure_space M \<and> measure M (space M) = 1" |
36624 | 601 |
unfolding finite_prob_space_def finite_measure_space_def prob_space_def prob_space_axioms_def |
602 |
by auto |
|
603 |
||
604 |
lemma (in prob_space) not_empty: "space M \<noteq> {}" |
|
605 |
using prob_space empty_measure by auto |
|
606 |
||
38656 | 607 |
lemma (in finite_prob_space) sum_over_space_eq_1: "(\<Sum>x\<in>space M. \<mu> {x}) = 1" |
608 |
using measure_space_1 sum_over_space by simp |
|
36624 | 609 |
|
610 |
lemma (in finite_prob_space) positive_distribution: "0 \<le> distribution X x" |
|
38656 | 611 |
unfolding distribution_def by simp |
36624 | 612 |
|
613 |
lemma (in finite_prob_space) joint_distribution_restriction_fst: |
|
614 |
"joint_distribution X Y A \<le> distribution X (fst ` A)" |
|
615 |
unfolding distribution_def |
|
616 |
proof (safe intro!: measure_mono) |
|
617 |
fix x assume "x \<in> space M" and *: "(X x, Y x) \<in> A" |
|
618 |
show "x \<in> X -` fst ` A" |
|
619 |
by (auto intro!: image_eqI[OF _ *]) |
|
620 |
qed (simp_all add: sets_eq_Pow) |
|
621 |
||
622 |
lemma (in finite_prob_space) joint_distribution_restriction_snd: |
|
623 |
"joint_distribution X Y A \<le> distribution Y (snd ` A)" |
|
624 |
unfolding distribution_def |
|
625 |
proof (safe intro!: measure_mono) |
|
626 |
fix x assume "x \<in> space M" and *: "(X x, Y x) \<in> A" |
|
627 |
show "x \<in> Y -` snd ` A" |
|
628 |
by (auto intro!: image_eqI[OF _ *]) |
|
629 |
qed (simp_all add: sets_eq_Pow) |
|
630 |
||
631 |
lemma (in finite_prob_space) distribution_order: |
|
632 |
shows "0 \<le> distribution X x'" |
|
633 |
and "(distribution X x' \<noteq> 0) \<longleftrightarrow> (0 < distribution X x')" |
|
634 |
and "r \<le> joint_distribution X Y {(x, y)} \<Longrightarrow> r \<le> distribution X {x}" |
|
635 |
and "r \<le> joint_distribution X Y {(x, y)} \<Longrightarrow> r \<le> distribution Y {y}" |
|
636 |
and "r < joint_distribution X Y {(x, y)} \<Longrightarrow> r < distribution X {x}" |
|
637 |
and "r < joint_distribution X Y {(x, y)} \<Longrightarrow> r < distribution Y {y}" |
|
638 |
and "distribution X {x} = 0 \<Longrightarrow> joint_distribution X Y {(x, y)} = 0" |
|
639 |
and "distribution Y {y} = 0 \<Longrightarrow> joint_distribution X Y {(x, y)} = 0" |
|
640 |
using positive_distribution[of X x'] |
|
641 |
positive_distribution[of "\<lambda>x. (X x, Y x)" "{(x, y)}"] |
|
642 |
joint_distribution_restriction_fst[of X Y "{(x, y)}"] |
|
643 |
joint_distribution_restriction_snd[of X Y "{(x, y)}"] |
|
644 |
by auto |
|
645 |
||
39097 | 646 |
lemma (in finite_prob_space) distribution_mono: |
647 |
assumes "\<And>t. \<lbrakk> t \<in> space M ; X t \<in> x \<rbrakk> \<Longrightarrow> Y t \<in> y" |
|
648 |
shows "distribution X x \<le> distribution Y y" |
|
649 |
unfolding distribution_def |
|
650 |
using assms by (auto simp: sets_eq_Pow intro!: measure_mono) |
|
651 |
||
652 |
lemma (in finite_prob_space) distribution_mono_gt_0: |
|
653 |
assumes gt_0: "0 < distribution X x" |
|
654 |
assumes *: "\<And>t. \<lbrakk> t \<in> space M ; X t \<in> x \<rbrakk> \<Longrightarrow> Y t \<in> y" |
|
655 |
shows "0 < distribution Y y" |
|
656 |
by (rule less_le_trans[OF gt_0 distribution_mono]) (rule *) |
|
657 |
||
658 |
lemma (in finite_prob_space) sum_over_space_distrib: |
|
659 |
"(\<Sum>x\<in>X`space M. distribution X {x}) = 1" |
|
660 |
unfolding distribution_def measure_space_1[symmetric] using finite_space |
|
661 |
by (subst measure_finitely_additive'') |
|
662 |
(auto simp add: disjoint_family_on_def sets_eq_Pow intro!: arg_cong[where f=\<mu>]) |
|
663 |
||
664 |
lemma (in finite_prob_space) sum_over_space_real_distribution: |
|
665 |
"(\<Sum>x\<in>X`space M. real (distribution X {x})) = 1" |
|
666 |
unfolding distribution_def prob_space[symmetric] using finite_space |
|
667 |
by (subst real_finite_measure_finite_Union[symmetric]) |
|
668 |
(auto simp add: disjoint_family_on_def sets_eq_Pow intro!: arg_cong[where f=prob]) |
|
669 |
||
670 |
lemma (in finite_prob_space) finite_sum_over_space_eq_1: |
|
671 |
"(\<Sum>x\<in>space M. real (\<mu> {x})) = 1" |
|
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
672 |
using sum_over_space_eq_1 finite_measure by (simp add: real_of_pextreal_setsum sets_eq_Pow) |
39097 | 673 |
|
674 |
lemma (in finite_prob_space) distribution_finite: |
|
675 |
"distribution X A \<noteq> \<omega>" |
|
676 |
using finite_measure[of "X -` A \<inter> space M"] |
|
677 |
unfolding distribution_def sets_eq_Pow by auto |
|
678 |
||
679 |
lemma (in finite_prob_space) real_distribution_gt_0[simp]: |
|
680 |
"0 < real (distribution Y y) \<longleftrightarrow> 0 < distribution Y y" |
|
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
681 |
using assms by (auto intro!: real_pextreal_pos distribution_finite) |
39097 | 682 |
|
683 |
lemma (in finite_prob_space) real_distribution_mult_pos_pos: |
|
684 |
assumes "0 < distribution Y y" |
|
685 |
and "0 < distribution X x" |
|
686 |
shows "0 < real (distribution Y y * distribution X x)" |
|
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
687 |
unfolding real_of_pextreal_mult[symmetric] |
39097 | 688 |
using assms by (auto intro!: mult_pos_pos) |
689 |
||
690 |
lemma (in finite_prob_space) real_distribution_divide_pos_pos: |
|
691 |
assumes "0 < distribution Y y" |
|
692 |
and "0 < distribution X x" |
|
693 |
shows "0 < real (distribution Y y / distribution X x)" |
|
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
694 |
unfolding divide_pextreal_def real_of_pextreal_mult[symmetric] |
39097 | 695 |
using assms distribution_finite[of X x] by (cases "distribution X x") (auto intro!: mult_pos_pos) |
696 |
||
697 |
lemma (in finite_prob_space) real_distribution_mult_inverse_pos_pos: |
|
698 |
assumes "0 < distribution Y y" |
|
699 |
and "0 < distribution X x" |
|
700 |
shows "0 < real (distribution Y y * inverse (distribution X x))" |
|
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
701 |
unfolding divide_pextreal_def real_of_pextreal_mult[symmetric] |
39097 | 702 |
using assms distribution_finite[of X x] by (cases "distribution X x") (auto intro!: mult_pos_pos) |
703 |
||
704 |
lemma (in prob_space) distribution_remove_const: |
|
705 |
shows "joint_distribution X (\<lambda>x. ()) {(x, ())} = distribution X {x}" |
|
706 |
and "joint_distribution (\<lambda>x. ()) X {((), x)} = distribution X {x}" |
|
707 |
and "joint_distribution X (\<lambda>x. (Y x, ())) {(x, y, ())} = joint_distribution X Y {(x, y)}" |
|
708 |
and "joint_distribution X (\<lambda>x. ((), Y x)) {(x, (), y)} = joint_distribution X Y {(x, y)}" |
|
709 |
and "distribution (\<lambda>x. ()) {()} = 1" |
|
710 |
unfolding measure_space_1[symmetric] |
|
711 |
by (auto intro!: arg_cong[where f="\<mu>"] simp: distribution_def) |
|
35977 | 712 |
|
39097 | 713 |
lemma (in finite_prob_space) setsum_distribution_gen: |
714 |
assumes "Z -` {c} \<inter> space M = (\<Union>x \<in> X`space M. Y -` {f x}) \<inter> space M" |
|
715 |
and "inj_on f (X`space M)" |
|
716 |
shows "(\<Sum>x \<in> X`space M. distribution Y {f x}) = distribution Z {c}" |
|
717 |
unfolding distribution_def assms |
|
718 |
using finite_space assms |
|
719 |
by (subst measure_finitely_additive'') |
|
720 |
(auto simp add: disjoint_family_on_def sets_eq_Pow inj_on_def |
|
721 |
intro!: arg_cong[where f=prob]) |
|
722 |
||
723 |
lemma (in finite_prob_space) setsum_distribution: |
|
724 |
"(\<Sum>x \<in> X`space M. joint_distribution X Y {(x, y)}) = distribution Y {y}" |
|
725 |
"(\<Sum>y \<in> Y`space M. joint_distribution X Y {(x, y)}) = distribution X {x}" |
|
726 |
"(\<Sum>x \<in> X`space M. joint_distribution X (\<lambda>x. (Y x, Z x)) {(x, y, z)}) = joint_distribution Y Z {(y, z)}" |
|
727 |
"(\<Sum>y \<in> Y`space M. joint_distribution X (\<lambda>x. (Y x, Z x)) {(x, y, z)}) = joint_distribution X Z {(x, z)}" |
|
728 |
"(\<Sum>z \<in> Z`space M. joint_distribution X (\<lambda>x. (Y x, Z x)) {(x, y, z)}) = joint_distribution X Y {(x, y)}" |
|
729 |
by (auto intro!: inj_onI setsum_distribution_gen) |
|
730 |
||
731 |
lemma (in finite_prob_space) setsum_real_distribution_gen: |
|
732 |
assumes "Z -` {c} \<inter> space M = (\<Union>x \<in> X`space M. Y -` {f x}) \<inter> space M" |
|
733 |
and "inj_on f (X`space M)" |
|
734 |
shows "(\<Sum>x \<in> X`space M. real (distribution Y {f x})) = real (distribution Z {c})" |
|
735 |
unfolding distribution_def assms |
|
736 |
using finite_space assms |
|
737 |
by (subst real_finite_measure_finite_Union[symmetric]) |
|
738 |
(auto simp add: disjoint_family_on_def sets_eq_Pow inj_on_def |
|
739 |
intro!: arg_cong[where f=prob]) |
|
740 |
||
741 |
lemma (in finite_prob_space) setsum_real_distribution: |
|
742 |
"(\<Sum>x \<in> X`space M. real (joint_distribution X Y {(x, y)})) = real (distribution Y {y})" |
|
743 |
"(\<Sum>y \<in> Y`space M. real (joint_distribution X Y {(x, y)})) = real (distribution X {x})" |
|
744 |
"(\<Sum>x \<in> X`space M. real (joint_distribution X (\<lambda>x. (Y x, Z x)) {(x, y, z)})) = real (joint_distribution Y Z {(y, z)})" |
|
745 |
"(\<Sum>y \<in> Y`space M. real (joint_distribution X (\<lambda>x. (Y x, Z x)) {(x, y, z)})) = real (joint_distribution X Z {(x, z)})" |
|
746 |
"(\<Sum>z \<in> Z`space M. real (joint_distribution X (\<lambda>x. (Y x, Z x)) {(x, y, z)})) = real (joint_distribution X Y {(x, y)})" |
|
747 |
by (auto intro!: inj_onI setsum_real_distribution_gen) |
|
748 |
||
749 |
lemma (in finite_prob_space) real_distribution_order: |
|
750 |
shows "r \<le> real (joint_distribution X Y {(x, y)}) \<Longrightarrow> r \<le> real (distribution X {x})" |
|
751 |
and "r \<le> real (joint_distribution X Y {(x, y)}) \<Longrightarrow> r \<le> real (distribution Y {y})" |
|
752 |
and "r < real (joint_distribution X Y {(x, y)}) \<Longrightarrow> r < real (distribution X {x})" |
|
753 |
and "r < real (joint_distribution X Y {(x, y)}) \<Longrightarrow> r < real (distribution Y {y})" |
|
754 |
and "distribution X {x} = 0 \<Longrightarrow> real (joint_distribution X Y {(x, y)}) = 0" |
|
755 |
and "distribution Y {y} = 0 \<Longrightarrow> real (joint_distribution X Y {(x, y)}) = 0" |
|
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
756 |
using real_of_pextreal_mono[OF distribution_finite joint_distribution_restriction_fst, of X Y "{(x, y)}"] |
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
757 |
using real_of_pextreal_mono[OF distribution_finite joint_distribution_restriction_snd, of X Y "{(x, y)}"] |
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
758 |
using real_pextreal_nonneg[of "joint_distribution X Y {(x, y)}"] |
39097 | 759 |
by auto |
760 |
||
761 |
lemma (in prob_space) joint_distribution_remove[simp]: |
|
762 |
"joint_distribution X X {(x, x)} = distribution X {x}" |
|
763 |
unfolding distribution_def by (auto intro!: arg_cong[where f="\<mu>"]) |
|
764 |
||
765 |
lemma (in finite_prob_space) distribution_1: |
|
766 |
"distribution X A \<le> 1" |
|
767 |
unfolding distribution_def measure_space_1[symmetric] |
|
768 |
by (auto intro!: measure_mono simp: sets_eq_Pow) |
|
769 |
||
770 |
lemma (in finite_prob_space) real_distribution_1: |
|
771 |
"real (distribution X A) \<le> 1" |
|
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
772 |
unfolding real_pextreal_1[symmetric] |
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
773 |
by (rule real_of_pextreal_mono[OF _ distribution_1]) simp |
39097 | 774 |
|
775 |
lemma (in finite_prob_space) uniform_prob: |
|
776 |
assumes "x \<in> space M" |
|
777 |
assumes "\<And> x y. \<lbrakk>x \<in> space M ; y \<in> space M\<rbrakk> \<Longrightarrow> prob {x} = prob {y}" |
|
778 |
shows "prob {x} = 1 / real (card (space M))" |
|
779 |
proof - |
|
780 |
have prob_x: "\<And> y. y \<in> space M \<Longrightarrow> prob {y} = prob {x}" |
|
781 |
using assms(2)[OF _ `x \<in> space M`] by blast |
|
782 |
have "1 = prob (space M)" |
|
783 |
using prob_space by auto |
|
784 |
also have "\<dots> = (\<Sum> x \<in> space M. prob {x})" |
|
785 |
using real_finite_measure_finite_Union[of "space M" "\<lambda> x. {x}", simplified] |
|
786 |
sets_eq_Pow inj_singleton[unfolded inj_on_def, rule_format] |
|
787 |
finite_space unfolding disjoint_family_on_def prob_space[symmetric] |
|
788 |
by (auto simp add:setsum_restrict_set) |
|
789 |
also have "\<dots> = (\<Sum> y \<in> space M. prob {x})" |
|
790 |
using prob_x by auto |
|
791 |
also have "\<dots> = real_of_nat (card (space M)) * prob {x}" by simp |
|
792 |
finally have one: "1 = real (card (space M)) * prob {x}" |
|
793 |
using real_eq_of_nat by auto |
|
794 |
hence two: "real (card (space M)) \<noteq> 0" by fastsimp |
|
795 |
from one have three: "prob {x} \<noteq> 0" by fastsimp |
|
796 |
thus ?thesis using one two three divide_cancel_right |
|
797 |
by (auto simp:field_simps) |
|
39092 | 798 |
qed |
35977 | 799 |
|
39092 | 800 |
lemma (in prob_space) prob_space_subalgebra: |
41545 | 801 |
assumes "sigma_algebra N" "sets N \<subseteq> sets M" "space N = space M" |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
802 |
and "\<And>A. A \<in> sets N \<Longrightarrow> measure N A = \<mu> A" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
803 |
shows "prob_space N" |
39092 | 804 |
proof - |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
805 |
interpret N: measure_space N |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
806 |
by (rule measure_space_subalgebra[OF assms]) |
39092 | 807 |
show ?thesis |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
808 |
proof qed (insert assms(4)[OF N.top], simp add: assms measure_space_1) |
35977 | 809 |
qed |
810 |
||
39092 | 811 |
lemma (in prob_space) prob_space_of_restricted_space: |
812 |
assumes "\<mu> A \<noteq> 0" "\<mu> A \<noteq> \<omega>" "A \<in> sets M" |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
813 |
shows "prob_space (restricted_space A \<lparr>measure := \<lambda>S. \<mu> S / \<mu> A\<rparr>)" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
814 |
(is "prob_space ?P") |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
815 |
proof - |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
816 |
interpret A: measure_space "restricted_space A" |
39092 | 817 |
using `A \<in> sets M` by (rule restricted_measure_space) |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
818 |
interpret A': sigma_algebra ?P |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
819 |
by (rule A.sigma_algebra_cong) auto |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
820 |
show "prob_space ?P" |
39092 | 821 |
proof |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
822 |
show "measure ?P (space ?P) = 1" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
823 |
using `\<mu> A \<noteq> 0` `\<mu> A \<noteq> \<omega>` by (auto simp: pextreal_noteq_omega_Ex) |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
824 |
show "measure ?P {} = 0" by auto |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
825 |
have "\<And>S. \<mu> S / \<mu> A = inverse (\<mu> A) * \<mu> S" by (simp add: mult_commute) |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
826 |
then show "countably_additive ?P (measure ?P)" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
827 |
unfolding countably_additive_def psuminf_cmult_right |
39092 | 828 |
using A.measure_countably_additive by auto |
829 |
qed |
|
830 |
qed |
|
831 |
||
832 |
lemma finite_prob_spaceI: |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
833 |
assumes "finite (space M)" "sets M = Pow(space M)" "measure M (space M) = 1" "measure M {} = 0" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
834 |
and "\<And>A B. A\<subseteq>space M \<Longrightarrow> B\<subseteq>space M \<Longrightarrow> A \<inter> B = {} \<Longrightarrow> measure M (A \<union> B) = measure M A + measure M B" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
835 |
shows "finite_prob_space M" |
39092 | 836 |
unfolding finite_prob_space_eq |
837 |
proof |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
838 |
show "finite_measure_space M" using assms |
39092 | 839 |
by (auto intro!: finite_measure_spaceI) |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
840 |
show "measure M (space M) = 1" by fact |
39092 | 841 |
qed |
36624 | 842 |
|
843 |
lemma (in finite_prob_space) finite_measure_space: |
|
39097 | 844 |
fixes X :: "'a \<Rightarrow> 'x" |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
845 |
shows "finite_measure_space \<lparr>space = X ` space M, sets = Pow (X ` space M), measure = distribution X\<rparr>" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
846 |
(is "finite_measure_space ?S") |
39092 | 847 |
proof (rule finite_measure_spaceI, simp_all) |
36624 | 848 |
show "finite (X ` space M)" using finite_space by simp |
39097 | 849 |
next |
850 |
fix A B :: "'x set" assume "A \<inter> B = {}" |
|
851 |
then show "distribution X (A \<union> B) = distribution X A + distribution X B" |
|
852 |
unfolding distribution_def |
|
853 |
by (subst measure_additive) |
|
854 |
(auto intro!: arg_cong[where f=\<mu>] simp: sets_eq_Pow) |
|
36624 | 855 |
qed |
856 |
||
39097 | 857 |
lemma (in finite_prob_space) finite_prob_space_of_images: |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
858 |
"finite_prob_space \<lparr> space = X ` space M, sets = Pow (X ` space M), measure = distribution X \<rparr>" |
39097 | 859 |
by (simp add: finite_prob_space_eq finite_measure_space) |
860 |
||
861 |
lemma (in finite_prob_space) real_distribution_order': |
|
862 |
shows "real (distribution X {x}) = 0 \<Longrightarrow> real (joint_distribution X Y {(x, y)}) = 0" |
|
863 |
and "real (distribution Y {y}) = 0 \<Longrightarrow> real (joint_distribution X Y {(x, y)}) = 0" |
|
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
864 |
using real_of_pextreal_mono[OF distribution_finite joint_distribution_restriction_fst, of X Y "{(x, y)}"] |
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
865 |
using real_of_pextreal_mono[OF distribution_finite joint_distribution_restriction_snd, of X Y "{(x, y)}"] |
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
866 |
using real_pextreal_nonneg[of "joint_distribution X Y {(x, y)}"] |
39097 | 867 |
by auto |
868 |
||
39096 | 869 |
lemma (in finite_prob_space) finite_product_measure_space: |
39097 | 870 |
fixes X :: "'a \<Rightarrow> 'x" and Y :: "'a \<Rightarrow> 'y" |
39096 | 871 |
assumes "finite s1" "finite s2" |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
872 |
shows "finite_measure_space \<lparr> space = s1 \<times> s2, sets = Pow (s1 \<times> s2), measure = joint_distribution X Y\<rparr>" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
873 |
(is "finite_measure_space ?M") |
39097 | 874 |
proof (rule finite_measure_spaceI, simp_all) |
875 |
show "finite (s1 \<times> s2)" |
|
39096 | 876 |
using assms by auto |
39097 | 877 |
show "joint_distribution X Y (s1\<times>s2) \<noteq> \<omega>" |
878 |
using distribution_finite . |
|
879 |
next |
|
880 |
fix A B :: "('x*'y) set" assume "A \<inter> B = {}" |
|
881 |
then show "joint_distribution X Y (A \<union> B) = joint_distribution X Y A + joint_distribution X Y B" |
|
882 |
unfolding distribution_def |
|
883 |
by (subst measure_additive) |
|
884 |
(auto intro!: arg_cong[where f=\<mu>] simp: sets_eq_Pow) |
|
39096 | 885 |
qed |
886 |
||
39097 | 887 |
lemma (in finite_prob_space) finite_product_measure_space_of_images: |
39096 | 888 |
shows "finite_measure_space \<lparr> space = X ` space M \<times> Y ` space M, |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
889 |
sets = Pow (X ` space M \<times> Y ` space M), |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
890 |
measure = joint_distribution X Y \<rparr>" |
39096 | 891 |
using finite_space by (auto intro!: finite_product_measure_space) |
892 |
||
40859 | 893 |
lemma (in finite_prob_space) finite_product_prob_space_of_images: |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
894 |
"finite_prob_space \<lparr> space = X ` space M \<times> Y ` space M, sets = Pow (X ` space M \<times> Y ` space M), |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
895 |
measure = joint_distribution X Y \<rparr>" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
896 |
(is "finite_prob_space ?S") |
40859 | 897 |
proof (simp add: finite_prob_space_eq finite_product_measure_space_of_images) |
898 |
have "X -` X ` space M \<inter> Y -` Y ` space M \<inter> space M = space M" by auto |
|
899 |
thus "joint_distribution X Y (X ` space M \<times> Y ` space M) = 1" |
|
900 |
by (simp add: distribution_def prob_space vimage_Times comp_def measure_space_1) |
|
901 |
qed |
|
902 |
||
39085 | 903 |
section "Conditional Expectation and Probability" |
904 |
||
905 |
lemma (in prob_space) conditional_expectation_exists: |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
906 |
fixes X :: "'a \<Rightarrow> pextreal" and N :: "('a, 'b) measure_space_scheme" |
39083 | 907 |
assumes borel: "X \<in> borel_measurable M" |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
908 |
and N: "sigma_algebra N" "sets N \<subseteq> sets M" "space N = space M" "\<And>A. measure N A = \<mu> A" |
41545 | 909 |
shows "\<exists>Y\<in>borel_measurable N. \<forall>C\<in>sets N. |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
910 |
(\<integral>\<^isup>+x. Y x * indicator C x \<partial>M) = (\<integral>\<^isup>+x. X x * indicator C x \<partial>M)" |
39083 | 911 |
proof - |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
912 |
note N(4)[simp] |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
913 |
interpret P: prob_space N |
41545 | 914 |
using prob_space_subalgebra[OF N] . |
39083 | 915 |
|
916 |
let "?f A" = "\<lambda>x. X x * indicator A x" |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
917 |
let "?Q A" = "integral\<^isup>P M (?f A)" |
39083 | 918 |
|
919 |
from measure_space_density[OF borel] |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
920 |
have Q: "measure_space (N\<lparr> measure := ?Q \<rparr>)" |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
921 |
apply (rule measure_space.measure_space_subalgebra[of "M\<lparr> measure := ?Q \<rparr>"]) |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
922 |
using N by (auto intro!: P.sigma_algebra_cong) |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
923 |
then interpret Q: measure_space "N\<lparr> measure := ?Q \<rparr>" . |
39083 | 924 |
|
925 |
have "P.absolutely_continuous ?Q" |
|
926 |
unfolding P.absolutely_continuous_def |
|
41545 | 927 |
proof safe |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
928 |
fix A assume "A \<in> sets N" "P.\<mu> A = 0" |
39083 | 929 |
moreover then have f_borel: "?f A \<in> borel_measurable M" |
41545 | 930 |
using borel N by (auto intro: borel_measurable_indicator) |
39083 | 931 |
moreover have "{x\<in>space M. ?f A x \<noteq> 0} = (?f A -` {0<..} \<inter> space M) \<inter> A" |
932 |
by (auto simp: indicator_def) |
|
933 |
moreover have "\<mu> \<dots> \<le> \<mu> A" |
|
41545 | 934 |
using `A \<in> sets N` N f_borel |
39083 | 935 |
by (auto intro!: measure_mono Int[of _ A] measurable_sets) |
936 |
ultimately show "?Q A = 0" |
|
937 |
by (simp add: positive_integral_0_iff) |
|
938 |
qed |
|
939 |
from P.Radon_Nikodym[OF Q this] |
|
41545 | 940 |
obtain Y where Y: "Y \<in> borel_measurable N" |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
941 |
"\<And>A. A \<in> sets N \<Longrightarrow> ?Q A =(\<integral>\<^isup>+x. Y x * indicator A x \<partial>N)" |
39083 | 942 |
by blast |
41545 | 943 |
with N(2) show ?thesis |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
944 |
by (auto intro!: bexI[OF _ Y(1)] simp: positive_integral_subalgebra[OF _ N(2,3,4,1)]) |
39083 | 945 |
qed |
946 |
||
39085 | 947 |
definition (in prob_space) |
41545 | 948 |
"conditional_expectation N X = (SOME Y. Y\<in>borel_measurable N |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
949 |
\<and> (\<forall>C\<in>sets N. (\<integral>\<^isup>+x. Y x * indicator C x\<partial>M) = (\<integral>\<^isup>+x. X x * indicator C x\<partial>M)))" |
39085 | 950 |
|
951 |
abbreviation (in prob_space) |
|
39092 | 952 |
"conditional_prob N A \<equiv> conditional_expectation N (indicator A)" |
39085 | 953 |
|
954 |
lemma (in prob_space) |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
955 |
fixes X :: "'a \<Rightarrow> pextreal" and N :: "('a, 'b) measure_space_scheme" |
39085 | 956 |
assumes borel: "X \<in> borel_measurable M" |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
957 |
and N: "sigma_algebra N" "sets N \<subseteq> sets M" "space N = space M" "\<And>A. measure N A = \<mu> A" |
39085 | 958 |
shows borel_measurable_conditional_expectation: |
41545 | 959 |
"conditional_expectation N X \<in> borel_measurable N" |
960 |
and conditional_expectation: "\<And>C. C \<in> sets N \<Longrightarrow> |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
961 |
(\<integral>\<^isup>+x. conditional_expectation N X x * indicator C x \<partial>M) = |
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
962 |
(\<integral>\<^isup>+x. X x * indicator C x \<partial>M)" |
41545 | 963 |
(is "\<And>C. C \<in> sets N \<Longrightarrow> ?eq C") |
39085 | 964 |
proof - |
965 |
note CE = conditional_expectation_exists[OF assms, unfolded Bex_def] |
|
41545 | 966 |
then show "conditional_expectation N X \<in> borel_measurable N" |
39085 | 967 |
unfolding conditional_expectation_def by (rule someI2_ex) blast |
968 |
||
41545 | 969 |
from CE show "\<And>C. C \<in> sets N \<Longrightarrow> ?eq C" |
39085 | 970 |
unfolding conditional_expectation_def by (rule someI2_ex) blast |
971 |
qed |
|
972 |
||
39091 | 973 |
lemma (in sigma_algebra) factorize_measurable_function: |
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
974 |
fixes Z :: "'a \<Rightarrow> pextreal" and Y :: "'a \<Rightarrow> 'c" |
39091 | 975 |
assumes "sigma_algebra M'" and "Y \<in> measurable M M'" "Z \<in> borel_measurable M" |
976 |
shows "Z \<in> borel_measurable (sigma_algebra.vimage_algebra M' (space M) Y) |
|
977 |
\<longleftrightarrow> (\<exists>g\<in>borel_measurable M'. \<forall>x\<in>space M. Z x = g (Y x))" |
|
978 |
proof safe |
|
979 |
interpret M': sigma_algebra M' by fact |
|
980 |
have Y: "Y \<in> space M \<rightarrow> space M'" using assms unfolding measurable_def by auto |
|
981 |
from M'.sigma_algebra_vimage[OF this] |
|
982 |
interpret va: sigma_algebra "M'.vimage_algebra (space M) Y" . |
|
983 |
||
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
984 |
{ fix g :: "'c \<Rightarrow> pextreal" assume "g \<in> borel_measurable M'" |
39091 | 985 |
with M'.measurable_vimage_algebra[OF Y] |
986 |
have "g \<circ> Y \<in> borel_measurable (M'.vimage_algebra (space M) Y)" |
|
987 |
by (rule measurable_comp) |
|
988 |
moreover assume "\<forall>x\<in>space M. Z x = g (Y x)" |
|
989 |
then have "Z \<in> borel_measurable (M'.vimage_algebra (space M) Y) \<longleftrightarrow> |
|
990 |
g \<circ> Y \<in> borel_measurable (M'.vimage_algebra (space M) Y)" |
|
991 |
by (auto intro!: measurable_cong) |
|
992 |
ultimately show "Z \<in> borel_measurable (M'.vimage_algebra (space M) Y)" |
|
993 |
by simp } |
|
994 |
||
995 |
assume "Z \<in> borel_measurable (M'.vimage_algebra (space M) Y)" |
|
996 |
from va.borel_measurable_implies_simple_function_sequence[OF this] |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
997 |
obtain f where f: "\<And>i. simple_function (M'.vimage_algebra (space M) Y) (f i)" and "f \<up> Z" by blast |
39091 | 998 |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
999 |
have "\<forall>i. \<exists>g. simple_function M' g \<and> (\<forall>x\<in>space M. f i x = g (Y x))" |
39091 | 1000 |
proof |
1001 |
fix i |
|
1002 |
from f[of i] have "finite (f i`space M)" and B_ex: |
|
1003 |
"\<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" |
|
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
1004 |
unfolding simple_function_def by auto |
39091 | 1005 |
from B_ex[THEN bchoice] guess B .. note B = this |
1006 |
||
1007 |
let ?g = "\<lambda>x. \<Sum>z\<in>f i`space M. z * indicator (B z) x" |
|
1008 |
||
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
1009 |
show "\<exists>g. simple_function M' g \<and> (\<forall>x\<in>space M. f i x = g (Y x))" |
39091 | 1010 |
proof (intro exI[of _ ?g] conjI ballI) |
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset
|
1011 |
show "simple_function M' ?g" using B by auto |
39091 | 1012 |
|
1013 |
fix x assume "x \<in> space M" |
|
41023
9118eb4eb8dc
it is known as the extended reals, not the infinite reals
hoelzl
parents:
40859
diff
changeset
|
1014 |
then have "\<And>z. z \<in> f i`space M \<Longrightarrow> indicator (B z) (Y x) = (indicator (f i -` {z} \<inter> space M) x::pextreal)" |
39091 | 1015 |
unfolding indicator_def using B by auto |
1016 |
then show "f i x = ?g (Y x)" using `x \<in> space M` f[of i] |
|
1017 |
by (subst va.simple_function_indicator_representation) auto |
|
1018 |
qed |
|
1019 |
qed |
|
1020 |
from choice[OF this] guess g .. note g = this |
|
1021 |
||
1022 |
show "\<exists>g\<in>borel_measurable M'. \<forall>x\<in>space M. Z x = g (Y x)" |
|
1023 |
proof (intro ballI bexI) |
|
41097
a1abfa4e2b44
use SUPR_ and INFI_apply instead of SUPR_, INFI_fun_expand
hoelzl
parents:
41095
diff
changeset
|
1024 |
show "(\<lambda>x. SUP i. g i x) \<in> borel_measurable M'" |
39091 | 1025 |
using g by (auto intro: M'.borel_measurable_simple_function) |
1026 |
fix x assume "x \<in> space M" |
|
1027 |
have "Z x = (SUP i. f i) x" using `f \<up> Z` unfolding isoton_def by simp |
|
41097
a1abfa4e2b44
use SUPR_ and INFI_apply instead of SUPR_, INFI_fun_expand
hoelzl
parents:
41095
diff
changeset
|
1028 |
also have "\<dots> = (SUP i. g i (Y x))" unfolding SUPR_apply |
39091 | 1029 |
using g `x \<in> space M` by simp |
41097
a1abfa4e2b44
use SUPR_ and INFI_apply instead of SUPR_, INFI_fun_expand
hoelzl
parents:
41095
diff
changeset
|
1030 |
finally show "Z x = (SUP i. g i (Y x))" . |
39091 | 1031 |
qed |
1032 |
qed |
|
39090
a2d38b8b693e
Introduced sigma algebra generated by function preimages.
hoelzl
parents:
39089
diff
changeset
|
1033 |
|
35582 | 1034 |
end |