author | ballarin |
Wed, 04 Nov 2015 08:13:49 +0100 | |
changeset 61565 | 352c73a689da |
parent 61424 | c3658c18b7bc |
child 61605 | 1bf7b186542e |
permissions | -rw-r--r-- |
42148 | 1 |
(* Title: HOL/Probability/Probability_Measure.thy |
42067 | 2 |
Author: Johannes Hölzl, TU München |
3 |
Author: Armin Heller, TU München |
|
4 |
*) |
|
5 |
||
58876 | 6 |
section {*Probability measure*} |
42067 | 7 |
|
42148 | 8 |
theory Probability_Measure |
47694 | 9 |
imports Lebesgue_Measure Radon_Nikodym |
35582 | 10 |
begin |
11 |
||
45777
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
12 |
locale prob_space = finite_measure + |
47694 | 13 |
assumes emeasure_space_1: "emeasure M (space M) = 1" |
38656 | 14 |
|
45777
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
15 |
lemma prob_spaceI[Pure.intro!]: |
47694 | 16 |
assumes *: "emeasure M (space M) = 1" |
45777
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
17 |
shows "prob_space M" |
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
18 |
proof - |
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
19 |
interpret finite_measure M |
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
20 |
proof |
47694 | 21 |
show "emeasure M (space M) \<noteq> \<infinity>" using * by simp |
45777
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
22 |
qed |
61169 | 23 |
show "prob_space M" by standard fact |
38656 | 24 |
qed |
25 |
||
59425 | 26 |
lemma prob_space_imp_sigma_finite: "prob_space M \<Longrightarrow> sigma_finite_measure M" |
27 |
unfolding prob_space_def finite_measure_def by simp |
|
28 |
||
40859 | 29 |
abbreviation (in prob_space) "events \<equiv> sets M" |
47694 | 30 |
abbreviation (in prob_space) "prob \<equiv> measure M" |
31 |
abbreviation (in prob_space) "random_variable M' X \<equiv> X \<in> measurable M M'" |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
32 |
abbreviation (in prob_space) "expectation \<equiv> integral\<^sup>L M" |
57235
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
33 |
abbreviation (in prob_space) "variance X \<equiv> integral\<^sup>L M (\<lambda>x. (X x - expectation X)\<^sup>2)" |
35582 | 34 |
|
57447
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents:
57418
diff
changeset
|
35 |
lemma (in prob_space) finite_measure [simp]: "finite_measure M" |
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents:
57418
diff
changeset
|
36 |
by unfold_locales |
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents:
57418
diff
changeset
|
37 |
|
47694 | 38 |
lemma (in prob_space) prob_space_distr: |
39 |
assumes f: "f \<in> measurable M M'" shows "prob_space (distr M M' f)" |
|
40 |
proof (rule prob_spaceI) |
|
41 |
have "f -` space M' \<inter> space M = space M" using f by (auto dest: measurable_space) |
|
42 |
with f show "emeasure (distr M M' f) (space (distr M M' f)) = 1" |
|
43 |
by (auto simp: emeasure_distr emeasure_space_1) |
|
43339 | 44 |
qed |
45 |
||
61359
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
46 |
lemma prob_space_distrD: |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
47 |
assumes f: "f \<in> measurable M N" and M: "prob_space (distr M N f)" shows "prob_space M" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
48 |
proof |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
49 |
interpret M!: prob_space "distr M N f" by fact |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
50 |
have "f -` space N \<inter> space M = space M" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
51 |
using f[THEN measurable_space] by auto |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
52 |
then show "emeasure M (space M) = 1" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
53 |
using M.emeasure_space_1 by (simp add: emeasure_distr[OF f]) |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
54 |
qed |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
55 |
|
40859 | 56 |
lemma (in prob_space) prob_space: "prob (space M) = 1" |
47694 | 57 |
using emeasure_space_1 unfolding measure_def by (simp add: one_ereal_def) |
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset
|
58 |
|
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset
|
59 |
lemma (in prob_space) prob_le_1[simp, intro]: "prob A \<le> 1" |
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset
|
60 |
using bounded_measure[of A] by (simp add: prob_space) |
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset
|
61 |
|
47694 | 62 |
lemma (in prob_space) not_empty: "space M \<noteq> {}" |
63 |
using prob_space by auto |
|
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset
|
64 |
|
47694 | 65 |
lemma (in prob_space) measure_le_1: "emeasure M X \<le> 1" |
66 |
using emeasure_space[of M X] by (simp add: emeasure_space_1) |
|
42950
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42902
diff
changeset
|
67 |
|
43339 | 68 |
lemma (in prob_space) AE_I_eq_1: |
47694 | 69 |
assumes "emeasure M {x\<in>space M. P x} = 1" "{x\<in>space M. P x} \<in> sets M" |
70 |
shows "AE x in M. P x" |
|
43339 | 71 |
proof (rule AE_I) |
47694 | 72 |
show "emeasure M (space M - {x \<in> space M. P x}) = 0" |
73 |
using assms emeasure_space_1 by (simp add: emeasure_compl) |
|
43339 | 74 |
qed (insert assms, auto) |
75 |
||
59000 | 76 |
lemma prob_space_restrict_space: |
77 |
"S \<in> sets M \<Longrightarrow> emeasure M S = 1 \<Longrightarrow> prob_space (restrict_space M S)" |
|
78 |
by (intro prob_spaceI) |
|
79 |
(simp add: emeasure_restrict_space space_restrict_space) |
|
80 |
||
40859 | 81 |
lemma (in prob_space) prob_compl: |
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset
|
82 |
assumes A: "A \<in> events" |
38656 | 83 |
shows "prob (space M - A) = 1 - prob A" |
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset
|
84 |
using finite_measure_compl[OF A] by (simp add: prob_space) |
35582 | 85 |
|
47694 | 86 |
lemma (in prob_space) AE_in_set_eq_1: |
87 |
assumes "A \<in> events" shows "(AE x in M. x \<in> A) \<longleftrightarrow> prob A = 1" |
|
88 |
proof |
|
89 |
assume ae: "AE x in M. x \<in> A" |
|
90 |
have "{x \<in> space M. x \<in> A} = A" "{x \<in> space M. x \<notin> A} = space M - A" |
|
50244
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents:
50104
diff
changeset
|
91 |
using `A \<in> events`[THEN sets.sets_into_space] by auto |
47694 | 92 |
with AE_E2[OF ae] `A \<in> events` have "1 - emeasure M A = 0" |
93 |
by (simp add: emeasure_compl emeasure_space_1) |
|
94 |
then show "prob A = 1" |
|
95 |
using `A \<in> events` by (simp add: emeasure_eq_measure one_ereal_def) |
|
96 |
next |
|
97 |
assume prob: "prob A = 1" |
|
98 |
show "AE x in M. x \<in> A" |
|
99 |
proof (rule AE_I) |
|
100 |
show "{x \<in> space M. x \<notin> A} \<subseteq> space M - A" by auto |
|
101 |
show "emeasure M (space M - A) = 0" |
|
102 |
using `A \<in> events` prob |
|
103 |
by (simp add: prob_compl emeasure_space_1 emeasure_eq_measure one_ereal_def) |
|
104 |
show "space M - A \<in> events" |
|
105 |
using `A \<in> events` by auto |
|
106 |
qed |
|
107 |
qed |
|
108 |
||
109 |
lemma (in prob_space) AE_False: "(AE x in M. False) \<longleftrightarrow> False" |
|
110 |
proof |
|
111 |
assume "AE x in M. False" |
|
112 |
then have "AE x in M. x \<in> {}" by simp |
|
113 |
then show False |
|
114 |
by (subst (asm) AE_in_set_eq_1) auto |
|
115 |
qed simp |
|
116 |
||
117 |
lemma (in prob_space) AE_prob_1: |
|
118 |
assumes "prob A = 1" shows "AE x in M. x \<in> A" |
|
119 |
proof - |
|
120 |
from `prob A = 1` have "A \<in> events" |
|
121 |
by (metis measure_notin_sets zero_neq_one) |
|
122 |
with AE_in_set_eq_1 assms show ?thesis by simp |
|
123 |
qed |
|
124 |
||
50098 | 125 |
lemma (in prob_space) AE_const[simp]: "(AE x in M. P) \<longleftrightarrow> P" |
126 |
by (cases P) (auto simp: AE_False) |
|
127 |
||
59000 | 128 |
lemma (in prob_space) ae_filter_bot: "ae_filter M \<noteq> bot" |
129 |
by (simp add: trivial_limit_def) |
|
130 |
||
50098 | 131 |
lemma (in prob_space) AE_contr: |
132 |
assumes ae: "AE \<omega> in M. P \<omega>" "AE \<omega> in M. \<not> P \<omega>" |
|
133 |
shows False |
|
134 |
proof - |
|
135 |
from ae have "AE \<omega> in M. False" by eventually_elim auto |
|
136 |
then show False by auto |
|
137 |
qed |
|
138 |
||
59000 | 139 |
lemma (in prob_space) emeasure_eq_1_AE: |
140 |
"S \<in> sets M \<Longrightarrow> AE x in M. x \<in> S \<Longrightarrow> emeasure M S = 1" |
|
141 |
by (subst emeasure_eq_AE[where B="space M"]) (auto simp: emeasure_space_1) |
|
142 |
||
57025 | 143 |
lemma (in prob_space) integral_ge_const: |
144 |
fixes c :: real |
|
145 |
shows "integrable M f \<Longrightarrow> (AE x in M. c \<le> f x) \<Longrightarrow> c \<le> (\<integral>x. f x \<partial>M)" |
|
146 |
using integral_mono_AE[of M "\<lambda>x. c" f] prob_space by simp |
|
147 |
||
148 |
lemma (in prob_space) integral_le_const: |
|
149 |
fixes c :: real |
|
150 |
shows "integrable M f \<Longrightarrow> (AE x in M. f x \<le> c) \<Longrightarrow> (\<integral>x. f x \<partial>M) \<le> c" |
|
151 |
using integral_mono_AE[of M f "\<lambda>x. c"] prob_space by simp |
|
152 |
||
153 |
lemma (in prob_space) nn_integral_ge_const: |
|
154 |
"(AE x in M. c \<le> f x) \<Longrightarrow> c \<le> (\<integral>\<^sup>+x. f x \<partial>M)" |
|
155 |
using nn_integral_mono_AE[of "\<lambda>x. c" f M] emeasure_space_1 |
|
156 |
by (simp add: nn_integral_const_If split: split_if_asm) |
|
157 |
||
43339 | 158 |
lemma (in prob_space) expectation_less: |
56993
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56166
diff
changeset
|
159 |
fixes X :: "_ \<Rightarrow> real" |
43339 | 160 |
assumes [simp]: "integrable M X" |
49786 | 161 |
assumes gt: "AE x in M. X x < b" |
43339 | 162 |
shows "expectation X < b" |
163 |
proof - |
|
164 |
have "expectation X < expectation (\<lambda>x. b)" |
|
47694 | 165 |
using gt emeasure_space_1 |
43340
60e181c4eae4
lemma: independence is equal to mutual information = 0
hoelzl
parents:
43339
diff
changeset
|
166 |
by (intro integral_less_AE_space) auto |
43339 | 167 |
then show ?thesis using prob_space by simp |
168 |
qed |
|
169 |
||
170 |
lemma (in prob_space) expectation_greater: |
|
56993
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56166
diff
changeset
|
171 |
fixes X :: "_ \<Rightarrow> real" |
43339 | 172 |
assumes [simp]: "integrable M X" |
49786 | 173 |
assumes gt: "AE x in M. a < X x" |
43339 | 174 |
shows "a < expectation X" |
175 |
proof - |
|
176 |
have "expectation (\<lambda>x. a) < expectation X" |
|
47694 | 177 |
using gt emeasure_space_1 |
43340
60e181c4eae4
lemma: independence is equal to mutual information = 0
hoelzl
parents:
43339
diff
changeset
|
178 |
by (intro integral_less_AE_space) auto |
43339 | 179 |
then show ?thesis using prob_space by simp |
180 |
qed |
|
181 |
||
182 |
lemma (in prob_space) jensens_inequality: |
|
56993
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56166
diff
changeset
|
183 |
fixes q :: "real \<Rightarrow> real" |
49786 | 184 |
assumes X: "integrable M X" "AE x in M. X x \<in> I" |
43339 | 185 |
assumes I: "I = {a <..< b} \<or> I = {a <..} \<or> I = {..< b} \<or> I = UNIV" |
186 |
assumes q: "integrable M (\<lambda>x. q (X x))" "convex_on I q" |
|
187 |
shows "q (expectation X) \<le> expectation (\<lambda>x. q (X x))" |
|
188 |
proof - |
|
46731 | 189 |
let ?F = "\<lambda>x. Inf ((\<lambda>t. (q x - q t) / (x - t)) ` ({x<..} \<inter> I))" |
49786 | 190 |
from X(2) AE_False have "I \<noteq> {}" by auto |
43339 | 191 |
|
192 |
from I have "open I" by auto |
|
193 |
||
194 |
note I |
|
195 |
moreover |
|
196 |
{ assume "I \<subseteq> {a <..}" |
|
197 |
with X have "a < expectation X" |
|
198 |
by (intro expectation_greater) auto } |
|
199 |
moreover |
|
200 |
{ assume "I \<subseteq> {..< b}" |
|
201 |
with X have "expectation X < b" |
|
202 |
by (intro expectation_less) auto } |
|
203 |
ultimately have "expectation X \<in> I" |
|
204 |
by (elim disjE) (auto simp: subset_eq) |
|
205 |
moreover |
|
206 |
{ fix y assume y: "y \<in> I" |
|
207 |
with q(2) `open I` have "Sup ((\<lambda>x. q x + ?F x * (y - x)) ` I) = q y" |
|
56166 | 208 |
by (auto intro!: cSup_eq_maximum convex_le_Inf_differential image_eqI [OF _ y] simp: interior_open simp del: Sup_image_eq Inf_image_eq) } |
43339 | 209 |
ultimately have "q (expectation X) = Sup ((\<lambda>x. q x + ?F x * (expectation X - x)) ` I)" |
210 |
by simp |
|
211 |
also have "\<dots> \<le> expectation (\<lambda>w. q (X w))" |
|
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50419
diff
changeset
|
212 |
proof (rule cSup_least) |
43339 | 213 |
show "(\<lambda>x. q x + ?F x * (expectation X - x)) ` I \<noteq> {}" |
214 |
using `I \<noteq> {}` by auto |
|
215 |
next |
|
216 |
fix k assume "k \<in> (\<lambda>x. q x + ?F x * (expectation X - x)) ` I" |
|
217 |
then guess x .. note x = this |
|
218 |
have "q x + ?F x * (expectation X - x) = expectation (\<lambda>w. q x + ?F x * (X w - x))" |
|
47694 | 219 |
using prob_space by (simp add: X) |
43339 | 220 |
also have "\<dots> \<le> expectation (\<lambda>w. q (X w))" |
221 |
using `x \<in> I` `open I` X(2) |
|
56993
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56166
diff
changeset
|
222 |
apply (intro integral_mono_AE integrable_add integrable_mult_right integrable_diff |
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56166
diff
changeset
|
223 |
integrable_const X q) |
49786 | 224 |
apply (elim eventually_elim1) |
225 |
apply (intro convex_le_Inf_differential) |
|
226 |
apply (auto simp: interior_open q) |
|
227 |
done |
|
43339 | 228 |
finally show "k \<le> expectation (\<lambda>w. q (X w))" using x by auto |
229 |
qed |
|
230 |
finally show "q (expectation X) \<le> expectation (\<lambda>x. q (X x))" . |
|
231 |
qed |
|
232 |
||
50001
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
233 |
subsection {* Introduce binder for probability *} |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
234 |
|
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
235 |
syntax |
59356
e6f5b1bbcb01
allow line breaks in probability syntax
Andreas Lochbihler
parents:
59353
diff
changeset
|
236 |
"_prob" :: "pttrn \<Rightarrow> logic \<Rightarrow> logic \<Rightarrow> logic" ("('\<P>'((/_ in _./ _)'))") |
50001
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
237 |
|
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
238 |
translations |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
239 |
"\<P>(x in M. P)" => "CONST measure M {x \<in> CONST space M. P}" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
240 |
|
58764
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
241 |
print_translation {* |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
242 |
let |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
243 |
fun to_pattern (Const (@{const_syntax Pair}, _) $ l $ r) = |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
244 |
Syntax.const @{const_syntax Pair} :: to_pattern l @ to_pattern r |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
245 |
| to_pattern (t as (Const (@{syntax_const "_bound"}, _)) $ _) = [t] |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
246 |
|
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
247 |
fun mk_pattern ((t, n) :: xs) = mk_patterns n xs |>> curry list_comb t |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
248 |
and mk_patterns 0 xs = ([], xs) |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
249 |
| mk_patterns n xs = |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
250 |
let |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
251 |
val (t, xs') = mk_pattern xs |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
252 |
val (ts, xs'') = mk_patterns (n - 1) xs' |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
253 |
in |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
254 |
(t :: ts, xs'') |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
255 |
end |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
256 |
|
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
257 |
fun unnest_tuples |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
258 |
(Const (@{syntax_const "_pattern"}, _) $ |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
259 |
t1 $ |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
260 |
(t as (Const (@{syntax_const "_pattern"}, _) $ _ $ _))) |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
261 |
= let |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
262 |
val (_ $ t2 $ t3) = unnest_tuples t |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
263 |
in |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
264 |
Syntax.const @{syntax_const "_pattern"} $ |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
265 |
unnest_tuples t1 $ |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
266 |
(Syntax.const @{syntax_const "_patterns"} $ t2 $ t3) |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
267 |
end |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
268 |
| unnest_tuples pat = pat |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
269 |
|
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
270 |
fun tr' [sig_alg, Const (@{const_syntax Collect}, _) $ t] = |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
271 |
let |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
272 |
val bound_dummyT = Const (@{syntax_const "_bound"}, dummyT) |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
273 |
|
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
274 |
fun go pattern elem |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
275 |
(Const (@{const_syntax "conj"}, _) $ |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
276 |
(Const (@{const_syntax Set.member}, _) $ elem' $ (Const (@{const_syntax space}, _) $ sig_alg')) $ |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
277 |
u) |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
278 |
= let |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
279 |
val _ = if sig_alg aconv sig_alg' andalso to_pattern elem' = rev elem then () else raise Match; |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
280 |
val (pat, rest) = mk_pattern (rev pattern); |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
281 |
val _ = case rest of [] => () | _ => raise Match |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
282 |
in |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
283 |
Syntax.const @{syntax_const "_prob"} $ unnest_tuples pat $ sig_alg $ u |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
284 |
end |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
285 |
| go pattern elem (Abs abs) = |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
286 |
let |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
287 |
val (x as (_ $ tx), t) = Syntax_Trans.atomic_abs_tr' abs |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
288 |
in |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
289 |
go ((x, 0) :: pattern) (bound_dummyT $ tx :: elem) t |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
290 |
end |
61424
c3658c18b7bc
prod_case as canonical name for product type eliminator
haftmann
parents:
61359
diff
changeset
|
291 |
| go pattern elem (Const (@{const_syntax case_prod}, _) $ t) = |
58764
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
292 |
go |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
293 |
((Syntax.const @{syntax_const "_pattern"}, 2) :: pattern) |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
294 |
(Syntax.const @{const_syntax Pair} :: elem) |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
295 |
t |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
296 |
in |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
297 |
go [] [] t |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
298 |
end |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
299 |
in |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
300 |
[(@{const_syntax Sigma_Algebra.measure}, K tr')] |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
301 |
end |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
302 |
*} |
ca2f59aef665
add print translation for probability notation \<P>
Andreas Lochbihler
parents:
57447
diff
changeset
|
303 |
|
50001
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
304 |
definition |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
305 |
"cond_prob M P Q = \<P>(\<omega> in M. P \<omega> \<and> Q \<omega>) / \<P>(\<omega> in M. Q \<omega>)" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
306 |
|
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
307 |
syntax |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
308 |
"_conditional_prob" :: "pttrn \<Rightarrow> logic \<Rightarrow> logic \<Rightarrow> logic \<Rightarrow> logic" ("('\<P>'(_ in _. _ \<bar>/ _'))") |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
309 |
|
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
310 |
translations |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
311 |
"\<P>(x in M. P \<bar> Q)" => "CONST cond_prob M (\<lambda>x. P) (\<lambda>x. Q)" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
312 |
|
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
313 |
lemma (in prob_space) AE_E_prob: |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
314 |
assumes ae: "AE x in M. P x" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
315 |
obtains S where "S \<subseteq> {x \<in> space M. P x}" "S \<in> events" "prob S = 1" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
316 |
proof - |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
317 |
from ae[THEN AE_E] guess N . |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
318 |
then show thesis |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
319 |
by (intro that[of "space M - N"]) |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
320 |
(auto simp: prob_compl prob_space emeasure_eq_measure) |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
321 |
qed |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
322 |
|
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
323 |
lemma (in prob_space) prob_neg: "{x\<in>space M. P x} \<in> events \<Longrightarrow> \<P>(x in M. \<not> P x) = 1 - \<P>(x in M. P x)" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
324 |
by (auto intro!: arg_cong[where f=prob] simp add: prob_compl[symmetric]) |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
325 |
|
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
326 |
lemma (in prob_space) prob_eq_AE: |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
327 |
"(AE x in M. P x \<longleftrightarrow> Q x) \<Longrightarrow> {x\<in>space M. P x} \<in> events \<Longrightarrow> {x\<in>space M. Q x} \<in> events \<Longrightarrow> \<P>(x in M. P x) = \<P>(x in M. Q x)" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
328 |
by (rule finite_measure_eq_AE) auto |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
329 |
|
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
330 |
lemma (in prob_space) prob_eq_0_AE: |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
331 |
assumes not: "AE x in M. \<not> P x" shows "\<P>(x in M. P x) = 0" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
332 |
proof cases |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
333 |
assume "{x\<in>space M. P x} \<in> events" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
334 |
with not have "\<P>(x in M. P x) = \<P>(x in M. False)" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
335 |
by (intro prob_eq_AE) auto |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
336 |
then show ?thesis by simp |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
337 |
qed (simp add: measure_notin_sets) |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
338 |
|
50098 | 339 |
lemma (in prob_space) prob_Collect_eq_0: |
340 |
"{x \<in> space M. P x} \<in> sets M \<Longrightarrow> \<P>(x in M. P x) = 0 \<longleftrightarrow> (AE x in M. \<not> P x)" |
|
341 |
using AE_iff_measurable[OF _ refl, of M "\<lambda>x. \<not> P x"] by (simp add: emeasure_eq_measure) |
|
342 |
||
343 |
lemma (in prob_space) prob_Collect_eq_1: |
|
344 |
"{x \<in> space M. P x} \<in> sets M \<Longrightarrow> \<P>(x in M. P x) = 1 \<longleftrightarrow> (AE x in M. P x)" |
|
345 |
using AE_in_set_eq_1[of "{x\<in>space M. P x}"] by simp |
|
346 |
||
347 |
lemma (in prob_space) prob_eq_0: |
|
348 |
"A \<in> sets M \<Longrightarrow> prob A = 0 \<longleftrightarrow> (AE x in M. x \<notin> A)" |
|
349 |
using AE_iff_measurable[OF _ refl, of M "\<lambda>x. x \<notin> A"] |
|
350 |
by (auto simp add: emeasure_eq_measure Int_def[symmetric]) |
|
351 |
||
352 |
lemma (in prob_space) prob_eq_1: |
|
353 |
"A \<in> sets M \<Longrightarrow> prob A = 1 \<longleftrightarrow> (AE x in M. x \<in> A)" |
|
354 |
using AE_in_set_eq_1[of A] by simp |
|
355 |
||
50001
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
356 |
lemma (in prob_space) prob_sums: |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
357 |
assumes P: "\<And>n. {x\<in>space M. P n x} \<in> events" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
358 |
assumes Q: "{x\<in>space M. Q x} \<in> events" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
359 |
assumes ae: "AE x in M. (\<forall>n. P n x \<longrightarrow> Q x) \<and> (Q x \<longrightarrow> (\<exists>!n. P n x))" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
360 |
shows "(\<lambda>n. \<P>(x in M. P n x)) sums \<P>(x in M. Q x)" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
361 |
proof - |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
362 |
from ae[THEN AE_E_prob] guess S . note S = this |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
363 |
then have disj: "disjoint_family (\<lambda>n. {x\<in>space M. P n x} \<inter> S)" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
364 |
by (auto simp: disjoint_family_on_def) |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
365 |
from S have ae_S: |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
366 |
"AE x in M. x \<in> {x\<in>space M. Q x} \<longleftrightarrow> x \<in> (\<Union>n. {x\<in>space M. P n x} \<inter> S)" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
367 |
"\<And>n. AE x in M. x \<in> {x\<in>space M. P n x} \<longleftrightarrow> x \<in> {x\<in>space M. P n x} \<inter> S" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
368 |
using ae by (auto dest!: AE_prob_1) |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
369 |
from ae_S have *: |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
370 |
"\<P>(x in M. Q x) = prob (\<Union>n. {x\<in>space M. P n x} \<inter> S)" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
371 |
using P Q S by (intro finite_measure_eq_AE) auto |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
372 |
from ae_S have **: |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
373 |
"\<And>n. \<P>(x in M. P n x) = prob ({x\<in>space M. P n x} \<inter> S)" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
374 |
using P Q S by (intro finite_measure_eq_AE) auto |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
375 |
show ?thesis |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
376 |
unfolding * ** using S P disj |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
377 |
by (intro finite_measure_UNION) auto |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
378 |
qed |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
379 |
|
59000 | 380 |
lemma (in prob_space) prob_setsum: |
381 |
assumes [simp, intro]: "finite I" |
|
382 |
assumes P: "\<And>n. n \<in> I \<Longrightarrow> {x\<in>space M. P n x} \<in> events" |
|
383 |
assumes Q: "{x\<in>space M. Q x} \<in> events" |
|
384 |
assumes ae: "AE x in M. (\<forall>n\<in>I. P n x \<longrightarrow> Q x) \<and> (Q x \<longrightarrow> (\<exists>!n\<in>I. P n x))" |
|
385 |
shows "\<P>(x in M. Q x) = (\<Sum>n\<in>I. \<P>(x in M. P n x))" |
|
386 |
proof - |
|
387 |
from ae[THEN AE_E_prob] guess S . note S = this |
|
388 |
then have disj: "disjoint_family_on (\<lambda>n. {x\<in>space M. P n x} \<inter> S) I" |
|
389 |
by (auto simp: disjoint_family_on_def) |
|
390 |
from S have ae_S: |
|
391 |
"AE x in M. x \<in> {x\<in>space M. Q x} \<longleftrightarrow> x \<in> (\<Union>n\<in>I. {x\<in>space M. P n x} \<inter> S)" |
|
392 |
"\<And>n. n \<in> I \<Longrightarrow> AE x in M. x \<in> {x\<in>space M. P n x} \<longleftrightarrow> x \<in> {x\<in>space M. P n x} \<inter> S" |
|
393 |
using ae by (auto dest!: AE_prob_1) |
|
394 |
from ae_S have *: |
|
395 |
"\<P>(x in M. Q x) = prob (\<Union>n\<in>I. {x\<in>space M. P n x} \<inter> S)" |
|
396 |
using P Q S by (intro finite_measure_eq_AE) (auto intro!: sets.Int) |
|
397 |
from ae_S have **: |
|
398 |
"\<And>n. n \<in> I \<Longrightarrow> \<P>(x in M. P n x) = prob ({x\<in>space M. P n x} \<inter> S)" |
|
399 |
using P Q S by (intro finite_measure_eq_AE) auto |
|
400 |
show ?thesis |
|
401 |
using S P disj |
|
402 |
by (auto simp add: * ** simp del: UN_simps intro!: finite_measure_finite_Union) |
|
403 |
qed |
|
404 |
||
54418 | 405 |
lemma (in prob_space) prob_EX_countable: |
406 |
assumes sets: "\<And>i. i \<in> I \<Longrightarrow> {x\<in>space M. P i x} \<in> sets M" and I: "countable I" |
|
407 |
assumes disj: "AE x in M. \<forall>i\<in>I. \<forall>j\<in>I. P i x \<longrightarrow> P j x \<longrightarrow> i = j" |
|
408 |
shows "\<P>(x in M. \<exists>i\<in>I. P i x) = (\<integral>\<^sup>+i. \<P>(x in M. P i x) \<partial>count_space I)" |
|
409 |
proof - |
|
410 |
let ?N= "\<lambda>x. \<exists>!i\<in>I. P i x" |
|
411 |
have "ereal (\<P>(x in M. \<exists>i\<in>I. P i x)) = \<P>(x in M. (\<exists>i\<in>I. P i x \<and> ?N x))" |
|
412 |
unfolding ereal.inject |
|
413 |
proof (rule prob_eq_AE) |
|
414 |
show "AE x in M. (\<exists>i\<in>I. P i x) = (\<exists>i\<in>I. P i x \<and> ?N x)" |
|
415 |
using disj by eventually_elim blast |
|
416 |
qed (auto intro!: sets.sets_Collect_countable_Ex' sets.sets_Collect_conj sets.sets_Collect_countable_Ex1' I sets)+ |
|
417 |
also have "\<P>(x in M. (\<exists>i\<in>I. P i x \<and> ?N x)) = emeasure M (\<Union>i\<in>I. {x\<in>space M. P i x \<and> ?N x})" |
|
418 |
unfolding emeasure_eq_measure by (auto intro!: arg_cong[where f=prob]) |
|
419 |
also have "\<dots> = (\<integral>\<^sup>+i. emeasure M {x\<in>space M. P i x \<and> ?N x} \<partial>count_space I)" |
|
420 |
by (rule emeasure_UN_countable) |
|
421 |
(auto intro!: sets.sets_Collect_countable_Ex' sets.sets_Collect_conj sets.sets_Collect_countable_Ex1' I sets |
|
422 |
simp: disjoint_family_on_def) |
|
423 |
also have "\<dots> = (\<integral>\<^sup>+i. \<P>(x in M. P i x) \<partial>count_space I)" |
|
424 |
unfolding emeasure_eq_measure using disj |
|
56996 | 425 |
by (intro nn_integral_cong ereal.inject[THEN iffD2] prob_eq_AE) |
54418 | 426 |
(auto intro!: sets.sets_Collect_countable_Ex' sets.sets_Collect_conj sets.sets_Collect_countable_Ex1' I sets)+ |
427 |
finally show ?thesis . |
|
428 |
qed |
|
429 |
||
50001
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
430 |
lemma (in prob_space) cond_prob_eq_AE: |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
431 |
assumes P: "AE x in M. Q x \<longrightarrow> P x \<longleftrightarrow> P' x" "{x\<in>space M. P x} \<in> events" "{x\<in>space M. P' x} \<in> events" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
432 |
assumes Q: "AE x in M. Q x \<longleftrightarrow> Q' x" "{x\<in>space M. Q x} \<in> events" "{x\<in>space M. Q' x} \<in> events" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
433 |
shows "cond_prob M P Q = cond_prob M P' Q'" |
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
434 |
using P Q |
50244
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents:
50104
diff
changeset
|
435 |
by (auto simp: cond_prob_def intro!: arg_cong2[where f="op /"] prob_eq_AE sets.sets_Collect_conj) |
50001
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
436 |
|
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents:
49795
diff
changeset
|
437 |
|
40859 | 438 |
lemma (in prob_space) joint_distribution_Times_le_fst: |
47694 | 439 |
"random_variable MX X \<Longrightarrow> random_variable MY Y \<Longrightarrow> A \<in> sets MX \<Longrightarrow> B \<in> sets MY |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
440 |
\<Longrightarrow> emeasure (distr M (MX \<Otimes>\<^sub>M MY) (\<lambda>x. (X x, Y x))) (A \<times> B) \<le> emeasure (distr M MX X) A" |
47694 | 441 |
by (auto simp: emeasure_distr measurable_pair_iff comp_def intro!: emeasure_mono measurable_sets) |
40859 | 442 |
|
443 |
lemma (in prob_space) joint_distribution_Times_le_snd: |
|
47694 | 444 |
"random_variable MX X \<Longrightarrow> random_variable MY Y \<Longrightarrow> A \<in> sets MX \<Longrightarrow> B \<in> sets MY |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
445 |
\<Longrightarrow> emeasure (distr M (MX \<Otimes>\<^sub>M MY) (\<lambda>x. (X x, Y x))) (A \<times> B) \<le> emeasure (distr M MY Y) B" |
47694 | 446 |
by (auto simp: emeasure_distr measurable_pair_iff comp_def intro!: emeasure_mono measurable_sets) |
40859 | 447 |
|
57235
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
448 |
lemma (in prob_space) variance_eq: |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
449 |
fixes X :: "'a \<Rightarrow> real" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
450 |
assumes [simp]: "integrable M X" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
451 |
assumes [simp]: "integrable M (\<lambda>x. (X x)\<^sup>2)" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
452 |
shows "variance X = expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
453 |
by (simp add: field_simps prob_space power2_diff power2_eq_square[symmetric]) |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
454 |
|
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
455 |
lemma (in prob_space) variance_positive: "0 \<le> variance (X::'a \<Rightarrow> real)" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
456 |
by (intro integral_nonneg_AE) (auto intro!: integral_nonneg_AE) |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
457 |
|
57447
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents:
57418
diff
changeset
|
458 |
lemma (in prob_space) variance_mean_zero: |
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents:
57418
diff
changeset
|
459 |
"expectation X = 0 \<Longrightarrow> variance X = expectation (\<lambda>x. (X x)^2)" |
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents:
57418
diff
changeset
|
460 |
by simp |
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents:
57418
diff
changeset
|
461 |
|
45777
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
462 |
locale pair_prob_space = pair_sigma_finite M1 M2 + M1: prob_space M1 + M2: prob_space M2 for M1 M2 |
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 |
|
61565
352c73a689da
Qualifiers in locale expressions default to mandatory regardless of the command.
ballarin
parents:
61424
diff
changeset
|
464 |
sublocale pair_prob_space \<subseteq> P?: prob_space "M1 \<Otimes>\<^sub>M M2" |
45777
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
465 |
proof |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
466 |
show "emeasure (M1 \<Otimes>\<^sub>M M2) (space (M1 \<Otimes>\<^sub>M M2)) = 1" |
49776 | 467 |
by (simp add: M2.emeasure_pair_measure_Times M1.emeasure_space_1 M2.emeasure_space_1 space_pair_measure) |
45777
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
468 |
qed |
40859 | 469 |
|
47694 | 470 |
locale product_prob_space = product_sigma_finite M for M :: "'i \<Rightarrow> 'a measure" + |
45777
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
471 |
fixes I :: "'i set" |
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
472 |
assumes prob_space: "\<And>i. prob_space (M i)" |
42988 | 473 |
|
61565
352c73a689da
Qualifiers in locale expressions default to mandatory regardless of the command.
ballarin
parents:
61424
diff
changeset
|
474 |
sublocale product_prob_space \<subseteq> M?: prob_space "M i" for i |
42988 | 475 |
by (rule prob_space) |
476 |
||
45777
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
477 |
locale finite_product_prob_space = finite_product_sigma_finite M I + product_prob_space M I for M I |
42988 | 478 |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
479 |
sublocale finite_product_prob_space \<subseteq> prob_space "\<Pi>\<^sub>M i\<in>I. M i" |
45777
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
480 |
proof |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
481 |
show "emeasure (\<Pi>\<^sub>M i\<in>I. M i) (space (\<Pi>\<^sub>M i\<in>I. M i)) = 1" |
57418 | 482 |
by (simp add: measure_times M.emeasure_space_1 setprod.neutral_const space_PiM) |
45777
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
483 |
qed |
42988 | 484 |
|
485 |
lemma (in finite_product_prob_space) prob_times: |
|
486 |
assumes X: "\<And>i. i \<in> I \<Longrightarrow> X i \<in> sets (M i)" |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
487 |
shows "prob (\<Pi>\<^sub>E i\<in>I. X i) = (\<Prod>i\<in>I. M.prob i (X i))" |
42988 | 488 |
proof - |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
489 |
have "ereal (measure (\<Pi>\<^sub>M i\<in>I. M i) (\<Pi>\<^sub>E i\<in>I. X i)) = emeasure (\<Pi>\<^sub>M i\<in>I. M i) (\<Pi>\<^sub>E i\<in>I. X i)" |
47694 | 490 |
using X by (simp add: emeasure_eq_measure) |
491 |
also have "\<dots> = (\<Prod>i\<in>I. emeasure (M i) (X i))" |
|
42988 | 492 |
using measure_times X by simp |
47694 | 493 |
also have "\<dots> = ereal (\<Prod>i\<in>I. measure (M i) (X i))" |
494 |
using X by (simp add: M.emeasure_eq_measure setprod_ereal) |
|
42859
d9dfc733f25c
add product of probability spaces with finite cardinality
hoelzl
parents:
42858
diff
changeset
|
495 |
finally show ?thesis by simp |
d9dfc733f25c
add product of probability spaces with finite cardinality
hoelzl
parents:
42858
diff
changeset
|
496 |
qed |
d9dfc733f25c
add product of probability spaces with finite cardinality
hoelzl
parents:
42858
diff
changeset
|
497 |
|
56994 | 498 |
subsection {* Distributions *} |
42892 | 499 |
|
47694 | 500 |
definition "distributed M N X f \<longleftrightarrow> distr M N X = density N f \<and> |
501 |
f \<in> borel_measurable N \<and> (AE x in N. 0 \<le> f x) \<and> X \<in> measurable M N" |
|
36624 | 502 |
|
47694 | 503 |
lemma |
50003 | 504 |
assumes "distributed M N X f" |
505 |
shows distributed_distr_eq_density: "distr M N X = density N f" |
|
506 |
and distributed_measurable: "X \<in> measurable M N" |
|
507 |
and distributed_borel_measurable: "f \<in> borel_measurable N" |
|
508 |
and distributed_AE: "(AE x in N. 0 \<le> f x)" |
|
509 |
using assms by (simp_all add: distributed_def) |
|
510 |
||
511 |
lemma |
|
512 |
assumes D: "distributed M N X f" |
|
513 |
shows distributed_measurable'[measurable_dest]: |
|
514 |
"g \<in> measurable L M \<Longrightarrow> (\<lambda>x. X (g x)) \<in> measurable L N" |
|
515 |
and distributed_borel_measurable'[measurable_dest]: |
|
516 |
"h \<in> measurable L N \<Longrightarrow> (\<lambda>x. f (h x)) \<in> borel_measurable L" |
|
517 |
using distributed_measurable[OF D] distributed_borel_measurable[OF D] |
|
518 |
by simp_all |
|
39097 | 519 |
|
47694 | 520 |
lemma |
521 |
shows distributed_real_measurable: "distributed M N X (\<lambda>x. ereal (f x)) \<Longrightarrow> f \<in> borel_measurable N" |
|
522 |
and distributed_real_AE: "distributed M N X (\<lambda>x. ereal (f x)) \<Longrightarrow> (AE x in N. 0 \<le> f x)" |
|
523 |
by (simp_all add: distributed_def borel_measurable_ereal_iff) |
|
35977 | 524 |
|
59353
f0707dc3d9aa
measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents:
59000
diff
changeset
|
525 |
lemma distributed_real_measurable': |
f0707dc3d9aa
measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents:
59000
diff
changeset
|
526 |
"distributed M N X (\<lambda>x. ereal (f x)) \<Longrightarrow> h \<in> measurable L N \<Longrightarrow> (\<lambda>x. f (h x)) \<in> borel_measurable L" |
f0707dc3d9aa
measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents:
59000
diff
changeset
|
527 |
by simp |
50003 | 528 |
|
59353
f0707dc3d9aa
measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents:
59000
diff
changeset
|
529 |
lemma joint_distributed_measurable1: |
f0707dc3d9aa
measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents:
59000
diff
changeset
|
530 |
"distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) f \<Longrightarrow> h1 \<in> measurable N M \<Longrightarrow> (\<lambda>x. X (h1 x)) \<in> measurable N S" |
f0707dc3d9aa
measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents:
59000
diff
changeset
|
531 |
by simp |
f0707dc3d9aa
measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents:
59000
diff
changeset
|
532 |
|
f0707dc3d9aa
measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents:
59000
diff
changeset
|
533 |
lemma joint_distributed_measurable2: |
f0707dc3d9aa
measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents:
59000
diff
changeset
|
534 |
"distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) f \<Longrightarrow> h2 \<in> measurable N M \<Longrightarrow> (\<lambda>x. Y (h2 x)) \<in> measurable N T" |
f0707dc3d9aa
measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents:
59000
diff
changeset
|
535 |
by simp |
50003 | 536 |
|
47694 | 537 |
lemma distributed_count_space: |
538 |
assumes X: "distributed M (count_space A) X P" and a: "a \<in> A" and A: "finite A" |
|
539 |
shows "P a = emeasure M (X -` {a} \<inter> space M)" |
|
39097 | 540 |
proof - |
47694 | 541 |
have "emeasure M (X -` {a} \<inter> space M) = emeasure (distr M (count_space A) X) {a}" |
50003 | 542 |
using X a A by (simp add: emeasure_distr) |
47694 | 543 |
also have "\<dots> = emeasure (density (count_space A) P) {a}" |
544 |
using X by (simp add: distributed_distr_eq_density) |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
545 |
also have "\<dots> = (\<integral>\<^sup>+x. P a * indicator {a} x \<partial>count_space A)" |
56996 | 546 |
using X a by (auto simp add: emeasure_density distributed_def indicator_def intro!: nn_integral_cong) |
47694 | 547 |
also have "\<dots> = P a" |
56996 | 548 |
using X a by (subst nn_integral_cmult_indicator) (auto simp: distributed_def one_ereal_def[symmetric] AE_count_space) |
47694 | 549 |
finally show ?thesis .. |
39092 | 550 |
qed |
35977 | 551 |
|
47694 | 552 |
lemma distributed_cong_density: |
553 |
"(AE x in N. f x = g x) \<Longrightarrow> g \<in> borel_measurable N \<Longrightarrow> f \<in> borel_measurable N \<Longrightarrow> |
|
554 |
distributed M N X f \<longleftrightarrow> distributed M N X g" |
|
555 |
by (auto simp: distributed_def intro!: density_cong) |
|
556 |
||
557 |
lemma subdensity: |
|
558 |
assumes T: "T \<in> measurable P Q" |
|
559 |
assumes f: "distributed M P X f" |
|
560 |
assumes g: "distributed M Q Y g" |
|
561 |
assumes Y: "Y = T \<circ> X" |
|
562 |
shows "AE x in P. g (T x) = 0 \<longrightarrow> f x = 0" |
|
563 |
proof - |
|
564 |
have "{x\<in>space Q. g x = 0} \<in> null_sets (distr M Q (T \<circ> X))" |
|
565 |
using g Y by (auto simp: null_sets_density_iff distributed_def) |
|
566 |
also have "distr M Q (T \<circ> X) = distr (distr M P X) Q T" |
|
567 |
using T f[THEN distributed_measurable] by (rule distr_distr[symmetric]) |
|
568 |
finally have "T -` {x\<in>space Q. g x = 0} \<inter> space P \<in> null_sets (distr M P X)" |
|
569 |
using T by (subst (asm) null_sets_distr_iff) auto |
|
570 |
also have "T -` {x\<in>space Q. g x = 0} \<inter> space P = {x\<in>space P. g (T x) = 0}" |
|
571 |
using T by (auto dest: measurable_space) |
|
572 |
finally show ?thesis |
|
573 |
using f g by (auto simp add: null_sets_density_iff distributed_def) |
|
35977 | 574 |
qed |
575 |
||
47694 | 576 |
lemma subdensity_real: |
577 |
fixes g :: "'a \<Rightarrow> real" and f :: "'b \<Rightarrow> real" |
|
578 |
assumes T: "T \<in> measurable P Q" |
|
579 |
assumes f: "distributed M P X f" |
|
580 |
assumes g: "distributed M Q Y g" |
|
581 |
assumes Y: "Y = T \<circ> X" |
|
582 |
shows "AE x in P. g (T x) = 0 \<longrightarrow> f x = 0" |
|
583 |
using subdensity[OF T, of M X "\<lambda>x. ereal (f x)" Y "\<lambda>x. ereal (g x)"] assms by auto |
|
584 |
||
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
585 |
lemma distributed_emeasure: |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
586 |
"distributed M N X f \<Longrightarrow> A \<in> sets N \<Longrightarrow> emeasure M (X -` A \<inter> space M) = (\<integral>\<^sup>+x. f x * indicator A x \<partial>N)" |
50003 | 587 |
by (auto simp: distributed_AE |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
588 |
distributed_distr_eq_density[symmetric] emeasure_density[symmetric] emeasure_distr) |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
589 |
|
56996 | 590 |
lemma distributed_nn_integral: |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
591 |
"distributed M N X f \<Longrightarrow> g \<in> borel_measurable N \<Longrightarrow> (\<integral>\<^sup>+x. f x * g x \<partial>N) = (\<integral>\<^sup>+x. g (X x) \<partial>M)" |
50003 | 592 |
by (auto simp: distributed_AE |
56996 | 593 |
distributed_distr_eq_density[symmetric] nn_integral_density[symmetric] nn_integral_distr) |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
594 |
|
47694 | 595 |
lemma distributed_integral: |
596 |
"distributed M N X f \<Longrightarrow> g \<in> borel_measurable N \<Longrightarrow> (\<integral>x. f x * g x \<partial>N) = (\<integral>x. g (X x) \<partial>M)" |
|
50003 | 597 |
by (auto simp: distributed_real_AE |
56993
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56166
diff
changeset
|
598 |
distributed_distr_eq_density[symmetric] integral_real_density[symmetric] integral_distr) |
47694 | 599 |
|
600 |
lemma distributed_transform_integral: |
|
601 |
assumes Px: "distributed M N X Px" |
|
602 |
assumes "distributed M P Y Py" |
|
603 |
assumes Y: "Y = T \<circ> X" and T: "T \<in> measurable N P" and f: "f \<in> borel_measurable P" |
|
604 |
shows "(\<integral>x. Py x * f x \<partial>P) = (\<integral>x. Px x * f (T x) \<partial>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
|
605 |
proof - |
47694 | 606 |
have "(\<integral>x. Py x * f x \<partial>P) = (\<integral>x. f (Y x) \<partial>M)" |
607 |
by (rule distributed_integral) fact+ |
|
608 |
also have "\<dots> = (\<integral>x. f (T (X x)) \<partial>M)" |
|
609 |
using Y by simp |
|
610 |
also have "\<dots> = (\<integral>x. Px x * f (T x) \<partial>N)" |
|
611 |
using measurable_comp[OF T f] Px by (intro distributed_integral[symmetric]) (auto simp: comp_def) |
|
45777
c36637603821
remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents:
45712
diff
changeset
|
612 |
finally show ?thesis . |
39092 | 613 |
qed |
36624 | 614 |
|
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
615 |
lemma (in prob_space) distributed_unique: |
47694 | 616 |
assumes Px: "distributed M S X Px" |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
617 |
assumes Py: "distributed M S X Py" |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
618 |
shows "AE x in S. Px x = Py x" |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
619 |
proof - |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
620 |
interpret X: prob_space "distr M S X" |
50003 | 621 |
using Px by (intro prob_space_distr) simp |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
622 |
have "sigma_finite_measure (distr M S X)" .. |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
623 |
with sigma_finite_density_unique[of Px S Py ] Px Py |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
624 |
show ?thesis |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
625 |
by (auto simp: distributed_def) |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
626 |
qed |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
627 |
|
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
628 |
lemma (in prob_space) distributed_jointI: |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
629 |
assumes "sigma_finite_measure S" "sigma_finite_measure T" |
50003 | 630 |
assumes X[measurable]: "X \<in> measurable M S" and Y[measurable]: "Y \<in> measurable M T" |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
631 |
assumes [measurable]: "f \<in> borel_measurable (S \<Otimes>\<^sub>M T)" and f: "AE x in S \<Otimes>\<^sub>M T. 0 \<le> f x" |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
632 |
assumes eq: "\<And>A B. A \<in> sets S \<Longrightarrow> B \<in> sets T \<Longrightarrow> |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
633 |
emeasure M {x \<in> space M. X x \<in> A \<and> Y x \<in> B} = (\<integral>\<^sup>+x. (\<integral>\<^sup>+y. f (x, y) * indicator B y \<partial>T) * indicator A x \<partial>S)" |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
634 |
shows "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) f" |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
635 |
unfolding distributed_def |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
636 |
proof safe |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
637 |
interpret S: sigma_finite_measure S by fact |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
638 |
interpret T: sigma_finite_measure T by fact |
61169 | 639 |
interpret ST: pair_sigma_finite S T .. |
47694 | 640 |
|
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
641 |
from ST.sigma_finite_up_in_pair_measure_generator guess F :: "nat \<Rightarrow> ('b \<times> 'c) set" .. note F = this |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
642 |
let ?E = "{a \<times> b |a b. a \<in> sets S \<and> b \<in> sets T}" |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
643 |
let ?P = "S \<Otimes>\<^sub>M T" |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
644 |
show "distr M ?P (\<lambda>x. (X x, Y x)) = density ?P f" (is "?L = ?R") |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
645 |
proof (rule measure_eqI_generator_eq[OF Int_stable_pair_measure_generator[of S T]]) |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
646 |
show "?E \<subseteq> Pow (space ?P)" |
50244
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents:
50104
diff
changeset
|
647 |
using sets.space_closed[of S] sets.space_closed[of T] by (auto simp: space_pair_measure) |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
648 |
show "sets ?L = sigma_sets (space ?P) ?E" |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
649 |
by (simp add: sets_pair_measure space_pair_measure) |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
650 |
then show "sets ?R = sigma_sets (space ?P) ?E" |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
651 |
by simp |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
652 |
next |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
653 |
interpret L: prob_space ?L |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
654 |
by (rule prob_space_distr) (auto intro!: measurable_Pair) |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
655 |
show "range F \<subseteq> ?E" "(\<Union>i. F i) = space ?P" "\<And>i. emeasure ?L (F i) \<noteq> \<infinity>" |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
656 |
using F by (auto simp: space_pair_measure) |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
657 |
next |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
658 |
fix E assume "E \<in> ?E" |
50003 | 659 |
then obtain A B where E[simp]: "E = A \<times> B" |
660 |
and A[measurable]: "A \<in> sets S" and B[measurable]: "B \<in> sets T" by auto |
|
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
661 |
have "emeasure ?L E = emeasure M {x \<in> space M. X x \<in> A \<and> Y x \<in> B}" |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
662 |
by (auto intro!: arg_cong[where f="emeasure M"] simp add: emeasure_distr measurable_Pair) |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
663 |
also have "\<dots> = (\<integral>\<^sup>+x. (\<integral>\<^sup>+y. (f (x, y) * indicator B y) * indicator A x \<partial>T) \<partial>S)" |
56996 | 664 |
using f by (auto simp add: eq nn_integral_multc intro!: nn_integral_cong) |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
665 |
also have "\<dots> = emeasure ?R E" |
56996 | 666 |
by (auto simp add: emeasure_density T.nn_integral_fst[symmetric] |
667 |
intro!: nn_integral_cong split: split_indicator) |
|
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
668 |
finally show "emeasure ?L E = emeasure ?R E" . |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
669 |
qed |
50003 | 670 |
qed (auto simp: f) |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
671 |
|
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
672 |
lemma (in prob_space) distributed_swap: |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
673 |
assumes "sigma_finite_measure S" "sigma_finite_measure T" |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
674 |
assumes Pxy: "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy" |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
675 |
shows "distributed M (T \<Otimes>\<^sub>M S) (\<lambda>x. (Y x, X x)) (\<lambda>(x, y). Pxy (y, x))" |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
676 |
proof - |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
677 |
interpret S: sigma_finite_measure S by fact |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
678 |
interpret T: sigma_finite_measure T by fact |
61169 | 679 |
interpret ST: pair_sigma_finite S T .. |
680 |
interpret TS: pair_sigma_finite T S .. |
|
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
681 |
|
50003 | 682 |
note Pxy[measurable] |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
683 |
show ?thesis |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
684 |
apply (subst TS.distr_pair_swap) |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
685 |
unfolding distributed_def |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
686 |
proof safe |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
687 |
let ?D = "distr (S \<Otimes>\<^sub>M T) (T \<Otimes>\<^sub>M S) (\<lambda>(x, y). (y, x))" |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
688 |
show 1: "(\<lambda>(x, y). Pxy (y, x)) \<in> borel_measurable ?D" |
50003 | 689 |
by auto |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
690 |
with Pxy |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
691 |
show "AE x in distr (S \<Otimes>\<^sub>M T) (T \<Otimes>\<^sub>M S) (\<lambda>(x, y). (y, x)). 0 \<le> (case x of (x, y) \<Rightarrow> Pxy (y, x))" |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
692 |
by (subst AE_distr_iff) |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
693 |
(auto dest!: distributed_AE |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
694 |
simp: measurable_split_conv split_beta |
51683
baefa3b461c2
generalize Borel-set properties from real/ereal/ordered_euclidean_spaces to order_topology and real_normed_vector
hoelzl
parents:
51475
diff
changeset
|
695 |
intro!: measurable_Pair) |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
696 |
show 2: "random_variable (distr (S \<Otimes>\<^sub>M T) (T \<Otimes>\<^sub>M S) (\<lambda>(x, y). (y, x))) (\<lambda>x. (Y x, X x))" |
50003 | 697 |
using Pxy by auto |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
698 |
{ fix A assume A: "A \<in> sets (T \<Otimes>\<^sub>M S)" |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
699 |
let ?B = "(\<lambda>(x, y). (y, x)) -` A \<inter> space (S \<Otimes>\<^sub>M T)" |
50244
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents:
50104
diff
changeset
|
700 |
from sets.sets_into_space[OF A] |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
701 |
have "emeasure M ((\<lambda>x. (Y x, X x)) -` A \<inter> space M) = |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
702 |
emeasure M ((\<lambda>x. (X x, Y x)) -` ?B \<inter> space M)" |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
703 |
by (auto intro!: arg_cong2[where f=emeasure] simp: space_pair_measure) |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
704 |
also have "\<dots> = (\<integral>\<^sup>+ x. Pxy x * indicator ?B x \<partial>(S \<Otimes>\<^sub>M T))" |
50003 | 705 |
using Pxy A by (intro distributed_emeasure) auto |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
706 |
finally have "emeasure M ((\<lambda>x. (Y x, X x)) -` A \<inter> space M) = |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
707 |
(\<integral>\<^sup>+ x. Pxy x * indicator A (snd x, fst x) \<partial>(S \<Otimes>\<^sub>M T))" |
56996 | 708 |
by (auto intro!: nn_integral_cong split: split_indicator) } |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
709 |
note * = this |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
710 |
show "distr M ?D (\<lambda>x. (Y x, X x)) = density ?D (\<lambda>(x, y). Pxy (y, x))" |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
711 |
apply (intro measure_eqI) |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
712 |
apply (simp_all add: emeasure_distr[OF 2] emeasure_density[OF 1]) |
56996 | 713 |
apply (subst nn_integral_distr) |
50003 | 714 |
apply (auto intro!: * simp: comp_def split_beta) |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
715 |
done |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
716 |
qed |
36624 | 717 |
qed |
718 |
||
47694 | 719 |
lemma (in prob_space) distr_marginal1: |
720 |
assumes "sigma_finite_measure S" "sigma_finite_measure T" |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
721 |
assumes Pxy: "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy" |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
722 |
defines "Px \<equiv> \<lambda>x. (\<integral>\<^sup>+z. Pxy (x, z) \<partial>T)" |
47694 | 723 |
shows "distributed M S X Px" |
724 |
unfolding distributed_def |
|
725 |
proof safe |
|
726 |
interpret S: sigma_finite_measure S by fact |
|
727 |
interpret T: sigma_finite_measure T by fact |
|
61169 | 728 |
interpret ST: pair_sigma_finite S T .. |
47694 | 729 |
|
50003 | 730 |
note Pxy[measurable] |
731 |
show X: "X \<in> measurable M S" by simp |
|
47694 | 732 |
|
50003 | 733 |
show borel: "Px \<in> borel_measurable S" |
56996 | 734 |
by (auto intro!: T.nn_integral_fst simp: Px_def) |
39097 | 735 |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
736 |
interpret Pxy: prob_space "distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))" |
50003 | 737 |
by (intro prob_space_distr) simp |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
738 |
have "(\<integral>\<^sup>+ x. max 0 (- Pxy x) \<partial>(S \<Otimes>\<^sub>M T)) = (\<integral>\<^sup>+ x. 0 \<partial>(S \<Otimes>\<^sub>M T))" |
47694 | 739 |
using Pxy |
56996 | 740 |
by (intro nn_integral_cong_AE) (auto simp: max_def dest: distributed_AE) |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
741 |
|
47694 | 742 |
show "distr M S X = density S Px" |
743 |
proof (rule measure_eqI) |
|
744 |
fix A assume A: "A \<in> sets (distr M S X)" |
|
50003 | 745 |
with X measurable_space[of Y M T] |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
746 |
have "emeasure (distr M S X) A = emeasure (distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))) (A \<times> space T)" |
50003 | 747 |
by (auto simp add: emeasure_distr intro!: arg_cong[where f="emeasure M"]) |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
748 |
also have "\<dots> = emeasure (density (S \<Otimes>\<^sub>M T) Pxy) (A \<times> space T)" |
47694 | 749 |
using Pxy by (simp add: distributed_def) |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
750 |
also have "\<dots> = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. Pxy (x, y) * indicator (A \<times> space T) (x, y) \<partial>T \<partial>S" |
47694 | 751 |
using A borel Pxy |
56996 | 752 |
by (simp add: emeasure_density T.nn_integral_fst[symmetric]) |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
753 |
also have "\<dots> = \<integral>\<^sup>+ x. Px x * indicator A x \<partial>S" |
56996 | 754 |
apply (rule nn_integral_cong_AE) |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
755 |
using Pxy[THEN distributed_AE, THEN ST.AE_pair] AE_space |
47694 | 756 |
proof eventually_elim |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
757 |
fix x assume "x \<in> space S" "AE y in T. 0 \<le> Pxy (x, y)" |
47694 | 758 |
moreover have eq: "\<And>y. y \<in> space T \<Longrightarrow> indicator (A \<times> space T) (x, y) = indicator A x" |
759 |
by (auto simp: indicator_def) |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
760 |
ultimately have "(\<integral>\<^sup>+ y. Pxy (x, y) * indicator (A \<times> space T) (x, y) \<partial>T) = (\<integral>\<^sup>+ y. Pxy (x, y) \<partial>T) * indicator A x" |
56996 | 761 |
by (simp add: eq nn_integral_multc cong: nn_integral_cong) |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
762 |
also have "(\<integral>\<^sup>+ y. Pxy (x, y) \<partial>T) = Px x" |
56996 | 763 |
by (simp add: Px_def ereal_real nn_integral_nonneg) |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
764 |
finally show "(\<integral>\<^sup>+ y. Pxy (x, y) * indicator (A \<times> space T) (x, y) \<partial>T) = Px x * indicator A x" . |
47694 | 765 |
qed |
766 |
finally show "emeasure (distr M S X) A = emeasure (density S Px) A" |
|
767 |
using A borel Pxy by (simp add: emeasure_density) |
|
768 |
qed simp |
|
769 |
||
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
770 |
show "AE x in S. 0 \<le> Px x" |
56996 | 771 |
by (simp add: Px_def nn_integral_nonneg real_of_ereal_pos) |
40859 | 772 |
qed |
773 |
||
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
774 |
lemma (in prob_space) distr_marginal2: |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
775 |
assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T" |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
776 |
assumes Pxy: "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy" |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
777 |
shows "distributed M T Y (\<lambda>y. (\<integral>\<^sup>+x. Pxy (x, y) \<partial>S))" |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
778 |
using distr_marginal1[OF T S distributed_swap[OF S T]] Pxy by simp |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
779 |
|
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
780 |
lemma (in prob_space) distributed_marginal_eq_joint1: |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
781 |
assumes T: "sigma_finite_measure T" |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
782 |
assumes S: "sigma_finite_measure S" |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
783 |
assumes Px: "distributed M S X Px" |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
784 |
assumes Pxy: "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy" |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
785 |
shows "AE x in S. Px x = (\<integral>\<^sup>+y. Pxy (x, y) \<partial>T)" |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
786 |
using Px distr_marginal1[OF S T Pxy] by (rule distributed_unique) |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
787 |
|
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
788 |
lemma (in prob_space) distributed_marginal_eq_joint2: |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
789 |
assumes T: "sigma_finite_measure T" |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
790 |
assumes S: "sigma_finite_measure S" |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
791 |
assumes Py: "distributed M T Y Py" |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
792 |
assumes Pxy: "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy" |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
793 |
shows "AE y in T. Py y = (\<integral>\<^sup>+x. Pxy (x, y) \<partial>S)" |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
794 |
using Py distr_marginal2[OF S T Pxy] by (rule distributed_unique) |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
795 |
|
49795 | 796 |
lemma (in prob_space) distributed_joint_indep': |
797 |
assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T" |
|
50003 | 798 |
assumes X[measurable]: "distributed M S X Px" and Y[measurable]: "distributed M T Y Py" |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
799 |
assumes indep: "distr M S X \<Otimes>\<^sub>M distr M T Y = distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))" |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
800 |
shows "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) (\<lambda>(x, y). Px x * Py y)" |
49795 | 801 |
unfolding distributed_def |
802 |
proof safe |
|
803 |
interpret S: sigma_finite_measure S by fact |
|
804 |
interpret T: sigma_finite_measure T by fact |
|
61169 | 805 |
interpret ST: pair_sigma_finite S T .. |
49795 | 806 |
|
807 |
interpret X: prob_space "density S Px" |
|
808 |
unfolding distributed_distr_eq_density[OF X, symmetric] |
|
50003 | 809 |
by (rule prob_space_distr) simp |
49795 | 810 |
have sf_X: "sigma_finite_measure (density S Px)" .. |
811 |
||
812 |
interpret Y: prob_space "density T Py" |
|
813 |
unfolding distributed_distr_eq_density[OF Y, symmetric] |
|
50003 | 814 |
by (rule prob_space_distr) simp |
49795 | 815 |
have sf_Y: "sigma_finite_measure (density T Py)" .. |
816 |
||
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
817 |
show "distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) = density (S \<Otimes>\<^sub>M T) (\<lambda>(x, y). Px x * Py y)" |
49795 | 818 |
unfolding indep[symmetric] distributed_distr_eq_density[OF X] distributed_distr_eq_density[OF Y] |
819 |
using distributed_borel_measurable[OF X] distributed_AE[OF X] |
|
820 |
using distributed_borel_measurable[OF Y] distributed_AE[OF Y] |
|
50003 | 821 |
by (rule pair_measure_density[OF _ _ _ _ T sf_Y]) |
49795 | 822 |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
823 |
show "random_variable (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))" by auto |
49795 | 824 |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
825 |
show Pxy: "(\<lambda>(x, y). Px x * Py y) \<in> borel_measurable (S \<Otimes>\<^sub>M T)" by auto |
49795 | 826 |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
827 |
show "AE x in S \<Otimes>\<^sub>M T. 0 \<le> (case x of (x, y) \<Rightarrow> Px x * Py y)" |
51683
baefa3b461c2
generalize Borel-set properties from real/ereal/ordered_euclidean_spaces to order_topology and real_normed_vector
hoelzl
parents:
51475
diff
changeset
|
828 |
apply (intro ST.AE_pair_measure borel_measurable_le Pxy borel_measurable_const) |
49795 | 829 |
using distributed_AE[OF X] |
830 |
apply eventually_elim |
|
831 |
using distributed_AE[OF Y] |
|
832 |
apply eventually_elim |
|
833 |
apply auto |
|
834 |
done |
|
835 |
qed |
|
836 |
||
57235
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
837 |
lemma distributed_integrable: |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
838 |
"distributed M N X f \<Longrightarrow> g \<in> borel_measurable N \<Longrightarrow> |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
839 |
integrable N (\<lambda>x. f x * g x) \<longleftrightarrow> integrable M (\<lambda>x. g (X x))" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
840 |
by (auto simp: distributed_real_AE |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
841 |
distributed_distr_eq_density[symmetric] integrable_real_density[symmetric] integrable_distr_eq) |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
842 |
|
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
843 |
lemma distributed_transform_integrable: |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
844 |
assumes Px: "distributed M N X Px" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
845 |
assumes "distributed M P Y Py" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
846 |
assumes Y: "Y = (\<lambda>x. T (X x))" and T: "T \<in> measurable N P" and f: "f \<in> borel_measurable P" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
847 |
shows "integrable P (\<lambda>x. Py x * f x) \<longleftrightarrow> integrable N (\<lambda>x. Px x * f (T x))" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
848 |
proof - |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
849 |
have "integrable P (\<lambda>x. Py x * f x) \<longleftrightarrow> integrable M (\<lambda>x. f (Y x))" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
850 |
by (rule distributed_integrable) fact+ |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
851 |
also have "\<dots> \<longleftrightarrow> integrable M (\<lambda>x. f (T (X x)))" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
852 |
using Y by simp |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
853 |
also have "\<dots> \<longleftrightarrow> integrable N (\<lambda>x. Px x * f (T x))" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
854 |
using measurable_comp[OF T f] Px by (intro distributed_integrable[symmetric]) (auto simp: comp_def) |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
855 |
finally show ?thesis . |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
856 |
qed |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
857 |
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57235
diff
changeset
|
858 |
lemma distributed_integrable_var: |
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57235
diff
changeset
|
859 |
fixes X :: "'a \<Rightarrow> real" |
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57235
diff
changeset
|
860 |
shows "distributed M lborel X (\<lambda>x. ereal (f x)) \<Longrightarrow> integrable lborel (\<lambda>x. f x * x) \<Longrightarrow> integrable M X" |
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57235
diff
changeset
|
861 |
using distributed_integrable[of M lborel X f "\<lambda>x. x"] by simp |
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57235
diff
changeset
|
862 |
|
57235
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
863 |
lemma (in prob_space) distributed_variance: |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
864 |
fixes f::"real \<Rightarrow> real" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
865 |
assumes D: "distributed M lborel X f" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
866 |
shows "variance X = (\<integral>x. x\<^sup>2 * f (x + expectation X) \<partial>lborel)" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
867 |
proof (subst distributed_integral[OF D, symmetric]) |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
868 |
show "(\<integral> x. f x * (x - expectation X)\<^sup>2 \<partial>lborel) = (\<integral> x. x\<^sup>2 * f (x + expectation X) \<partial>lborel)" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
869 |
by (subst lborel_integral_real_affine[where c=1 and t="expectation X"]) (auto simp: ac_simps) |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
870 |
qed simp |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
871 |
|
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
872 |
lemma (in prob_space) variance_affine: |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
873 |
fixes f::"real \<Rightarrow> real" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
874 |
assumes [arith]: "b \<noteq> 0" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
875 |
assumes D[intro]: "distributed M lborel X f" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
876 |
assumes [simp]: "prob_space (density lborel f)" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
877 |
assumes I[simp]: "integrable M X" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
878 |
assumes I2[simp]: "integrable M (\<lambda>x. (X x)\<^sup>2)" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
879 |
shows "variance (\<lambda>x. a + b * X x) = b\<^sup>2 * variance X" |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
880 |
by (subst variance_eq) |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
881 |
(auto simp: power2_sum power_mult_distrib prob_space variance_eq right_diff_distrib) |
b0b9a10e4bf4
properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents:
57025
diff
changeset
|
882 |
|
47694 | 883 |
definition |
884 |
"simple_distributed M X f \<longleftrightarrow> distributed M (count_space (X`space M)) X (\<lambda>x. ereal (f x)) \<and> |
|
885 |
finite (X`space M)" |
|
42902 | 886 |
|
47694 | 887 |
lemma simple_distributed: |
888 |
"simple_distributed M X Px \<Longrightarrow> distributed M (count_space (X`space M)) X Px" |
|
889 |
unfolding simple_distributed_def by auto |
|
42902 | 890 |
|
47694 | 891 |
lemma simple_distributed_finite[dest]: "simple_distributed M X P \<Longrightarrow> finite (X`space M)" |
892 |
by (simp add: simple_distributed_def) |
|
42902 | 893 |
|
47694 | 894 |
lemma (in prob_space) distributed_simple_function_superset: |
895 |
assumes X: "simple_function M X" "\<And>x. x \<in> X ` space M \<Longrightarrow> P x = measure M (X -` {x} \<inter> space M)" |
|
896 |
assumes A: "X`space M \<subseteq> A" "finite A" |
|
897 |
defines "S \<equiv> count_space A" and "P' \<equiv> (\<lambda>x. if x \<in> X`space M then P x else 0)" |
|
898 |
shows "distributed M S X P'" |
|
899 |
unfolding distributed_def |
|
900 |
proof safe |
|
901 |
show "(\<lambda>x. ereal (P' x)) \<in> borel_measurable S" unfolding S_def by simp |
|
902 |
show "AE x in S. 0 \<le> ereal (P' x)" |
|
903 |
using X by (auto simp: S_def P'_def simple_distributed_def intro!: measure_nonneg) |
|
904 |
show "distr M S X = density S P'" |
|
905 |
proof (rule measure_eqI_finite) |
|
906 |
show "sets (distr M S X) = Pow A" "sets (density S P') = Pow A" |
|
907 |
using A unfolding S_def by auto |
|
908 |
show "finite A" by fact |
|
909 |
fix a assume a: "a \<in> A" |
|
910 |
then have "a \<notin> X`space M \<Longrightarrow> X -` {a} \<inter> space M = {}" by auto |
|
911 |
with A a X have "emeasure (distr M S X) {a} = P' a" |
|
912 |
by (subst emeasure_distr) |
|
50002
ce0d316b5b44
add measurability prover; add support for Borel sets
hoelzl
parents:
50001
diff
changeset
|
913 |
(auto simp add: S_def P'_def simple_functionD emeasure_eq_measure measurable_count_space_eq2 |
47694 | 914 |
intro!: arg_cong[where f=prob]) |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
915 |
also have "\<dots> = (\<integral>\<^sup>+x. ereal (P' a) * indicator {a} x \<partial>S)" |
47694 | 916 |
using A X a |
56996 | 917 |
by (subst nn_integral_cmult_indicator) |
47694 | 918 |
(auto simp: S_def P'_def simple_distributed_def simple_functionD measure_nonneg) |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
919 |
also have "\<dots> = (\<integral>\<^sup>+x. ereal (P' x) * indicator {a} x \<partial>S)" |
56996 | 920 |
by (auto simp: indicator_def intro!: nn_integral_cong) |
47694 | 921 |
also have "\<dots> = emeasure (density S P') {a}" |
922 |
using a A by (intro emeasure_density[symmetric]) (auto simp: S_def) |
|
923 |
finally show "emeasure (distr M S X) {a} = emeasure (density S P') {a}" . |
|
924 |
qed |
|
925 |
show "random_variable S X" |
|
926 |
using X(1) A by (auto simp: measurable_def simple_functionD S_def) |
|
927 |
qed |
|
42902 | 928 |
|
47694 | 929 |
lemma (in prob_space) simple_distributedI: |
930 |
assumes X: "simple_function M X" "\<And>x. x \<in> X ` space M \<Longrightarrow> P x = measure M (X -` {x} \<inter> space M)" |
|
931 |
shows "simple_distributed M X P" |
|
932 |
unfolding simple_distributed_def |
|
933 |
proof |
|
934 |
have "distributed M (count_space (X ` space M)) X (\<lambda>x. ereal (if x \<in> X`space M then P x else 0))" |
|
935 |
(is "?A") |
|
936 |
using simple_functionD[OF X(1)] by (intro distributed_simple_function_superset[OF X]) auto |
|
937 |
also have "?A \<longleftrightarrow> distributed M (count_space (X ` space M)) X (\<lambda>x. ereal (P x))" |
|
938 |
by (rule distributed_cong_density) auto |
|
939 |
finally show "\<dots>" . |
|
940 |
qed (rule simple_functionD[OF X(1)]) |
|
941 |
||
942 |
lemma simple_distributed_joint_finite: |
|
943 |
assumes X: "simple_distributed M (\<lambda>x. (X x, Y x)) Px" |
|
944 |
shows "finite (X ` space M)" "finite (Y ` space M)" |
|
42902 | 945 |
proof - |
47694 | 946 |
have "finite ((\<lambda>x. (X x, Y x)) ` space M)" |
947 |
using X by (auto simp: simple_distributed_def simple_functionD) |
|
948 |
then have "finite (fst ` (\<lambda>x. (X x, Y x)) ` space M)" "finite (snd ` (\<lambda>x. (X x, Y x)) ` space M)" |
|
949 |
by auto |
|
950 |
then show fin: "finite (X ` space M)" "finite (Y ` space M)" |
|
951 |
by (auto simp: image_image) |
|
952 |
qed |
|
953 |
||
954 |
lemma simple_distributed_joint2_finite: |
|
955 |
assumes X: "simple_distributed M (\<lambda>x. (X x, Y x, Z x)) Px" |
|
956 |
shows "finite (X ` space M)" "finite (Y ` space M)" "finite (Z ` space M)" |
|
957 |
proof - |
|
958 |
have "finite ((\<lambda>x. (X x, Y x, Z x)) ` space M)" |
|
959 |
using X by (auto simp: simple_distributed_def simple_functionD) |
|
960 |
then have "finite (fst ` (\<lambda>x. (X x, Y x, Z x)) ` space M)" |
|
961 |
"finite ((fst \<circ> snd) ` (\<lambda>x. (X x, Y x, Z x)) ` space M)" |
|
962 |
"finite ((snd \<circ> snd) ` (\<lambda>x. (X x, Y x, Z x)) ` space M)" |
|
963 |
by auto |
|
964 |
then show fin: "finite (X ` space M)" "finite (Y ` space M)" "finite (Z ` space M)" |
|
965 |
by (auto simp: image_image) |
|
42902 | 966 |
qed |
967 |
||
47694 | 968 |
lemma simple_distributed_simple_function: |
969 |
"simple_distributed M X Px \<Longrightarrow> simple_function M X" |
|
970 |
unfolding simple_distributed_def distributed_def |
|
50002
ce0d316b5b44
add measurability prover; add support for Borel sets
hoelzl
parents:
50001
diff
changeset
|
971 |
by (auto simp: simple_function_def measurable_count_space_eq2) |
47694 | 972 |
|
973 |
lemma simple_distributed_measure: |
|
974 |
"simple_distributed M X P \<Longrightarrow> a \<in> X`space M \<Longrightarrow> P a = measure M (X -` {a} \<inter> space M)" |
|
975 |
using distributed_count_space[of M "X`space M" X P a, symmetric] |
|
976 |
by (auto simp: simple_distributed_def measure_def) |
|
977 |
||
978 |
lemma simple_distributed_nonneg: "simple_distributed M X f \<Longrightarrow> x \<in> space M \<Longrightarrow> 0 \<le> f (X x)" |
|
979 |
by (auto simp: simple_distributed_measure measure_nonneg) |
|
42860 | 980 |
|
47694 | 981 |
lemma (in prob_space) simple_distributed_joint: |
982 |
assumes X: "simple_distributed M (\<lambda>x. (X x, Y x)) Px" |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
983 |
defines "S \<equiv> count_space (X`space M) \<Otimes>\<^sub>M count_space (Y`space M)" |
47694 | 984 |
defines "P \<equiv> (\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x))`space M then Px x else 0)" |
985 |
shows "distributed M S (\<lambda>x. (X x, Y x)) P" |
|
986 |
proof - |
|
987 |
from simple_distributed_joint_finite[OF X, simp] |
|
988 |
have S_eq: "S = count_space (X`space M \<times> Y`space M)" |
|
989 |
by (simp add: S_def pair_measure_count_space) |
|
990 |
show ?thesis |
|
991 |
unfolding S_eq P_def |
|
992 |
proof (rule distributed_simple_function_superset) |
|
993 |
show "simple_function M (\<lambda>x. (X x, Y x))" |
|
994 |
using X by (rule simple_distributed_simple_function) |
|
995 |
fix x assume "x \<in> (\<lambda>x. (X x, Y x)) ` space M" |
|
996 |
from simple_distributed_measure[OF X this] |
|
997 |
show "Px x = prob ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M)" . |
|
998 |
qed auto |
|
999 |
qed |
|
42860 | 1000 |
|
47694 | 1001 |
lemma (in prob_space) simple_distributed_joint2: |
1002 |
assumes X: "simple_distributed M (\<lambda>x. (X x, Y x, Z x)) Px" |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
1003 |
defines "S \<equiv> count_space (X`space M) \<Otimes>\<^sub>M count_space (Y`space M) \<Otimes>\<^sub>M count_space (Z`space M)" |
47694 | 1004 |
defines "P \<equiv> (\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x, Z x))`space M then Px x else 0)" |
1005 |
shows "distributed M S (\<lambda>x. (X x, Y x, Z x)) P" |
|
1006 |
proof - |
|
1007 |
from simple_distributed_joint2_finite[OF X, simp] |
|
1008 |
have S_eq: "S = count_space (X`space M \<times> Y`space M \<times> Z`space M)" |
|
1009 |
by (simp add: S_def pair_measure_count_space) |
|
1010 |
show ?thesis |
|
1011 |
unfolding S_eq P_def |
|
1012 |
proof (rule distributed_simple_function_superset) |
|
1013 |
show "simple_function M (\<lambda>x. (X x, Y x, Z x))" |
|
1014 |
using X by (rule simple_distributed_simple_function) |
|
1015 |
fix x assume "x \<in> (\<lambda>x. (X x, Y x, Z x)) ` space M" |
|
1016 |
from simple_distributed_measure[OF X this] |
|
1017 |
show "Px x = prob ((\<lambda>x. (X x, Y x, Z x)) -` {x} \<inter> space M)" . |
|
1018 |
qed auto |
|
1019 |
qed |
|
1020 |
||
1021 |
lemma (in prob_space) simple_distributed_setsum_space: |
|
1022 |
assumes X: "simple_distributed M X f" |
|
1023 |
shows "setsum f (X`space M) = 1" |
|
1024 |
proof - |
|
1025 |
from X have "setsum f (X`space M) = prob (\<Union>i\<in>X`space M. X -` {i} \<inter> space M)" |
|
1026 |
by (subst finite_measure_finite_Union) |
|
1027 |
(auto simp add: disjoint_family_on_def simple_distributed_measure simple_distributed_simple_function simple_functionD |
|
57418 | 1028 |
intro!: setsum.cong arg_cong[where f="prob"]) |
47694 | 1029 |
also have "\<dots> = prob (space M)" |
1030 |
by (auto intro!: arg_cong[where f=prob]) |
|
1031 |
finally show ?thesis |
|
1032 |
using emeasure_space_1 by (simp add: emeasure_eq_measure one_ereal_def) |
|
1033 |
qed |
|
42860 | 1034 |
|
47694 | 1035 |
lemma (in prob_space) distributed_marginal_eq_joint_simple: |
1036 |
assumes Px: "simple_function M X" |
|
1037 |
assumes Py: "simple_distributed M Y Py" |
|
1038 |
assumes Pxy: "simple_distributed M (\<lambda>x. (X x, Y x)) Pxy" |
|
1039 |
assumes y: "y \<in> Y`space M" |
|
1040 |
shows "Py y = (\<Sum>x\<in>X`space M. if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0)" |
|
1041 |
proof - |
|
1042 |
note Px = simple_distributedI[OF Px refl] |
|
1043 |
have *: "\<And>f A. setsum (\<lambda>x. max 0 (ereal (f x))) A = ereal (setsum (\<lambda>x. max 0 (f x)) A)" |
|
1044 |
by (simp add: setsum_ereal[symmetric] zero_ereal_def) |
|
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
1045 |
from distributed_marginal_eq_joint2[OF |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
1046 |
sigma_finite_measure_count_space_finite |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
1047 |
sigma_finite_measure_count_space_finite |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
1048 |
simple_distributed[OF Py] simple_distributed_joint[OF Pxy], |
47694 | 1049 |
OF Py[THEN simple_distributed_finite] Px[THEN simple_distributed_finite]] |
49788
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
1050 |
y |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
1051 |
Px[THEN simple_distributed_finite] |
3c10763f5cb4
show and use distributed_swap and distributed_jointI
hoelzl
parents:
49786
diff
changeset
|
1052 |
Py[THEN simple_distributed_finite] |
47694 | 1053 |
Pxy[THEN simple_distributed, THEN distributed_real_AE] |
1054 |
show ?thesis |
|
1055 |
unfolding AE_count_space |
|
57418 | 1056 |
apply (auto simp add: nn_integral_count_space_finite * intro!: setsum.cong split: split_max) |
47694 | 1057 |
done |
1058 |
qed |
|
42860 | 1059 |
|
50419 | 1060 |
lemma distributedI_real: |
1061 |
fixes f :: "'a \<Rightarrow> real" |
|
1062 |
assumes gen: "sets M1 = sigma_sets (space M1) E" and "Int_stable E" |
|
1063 |
and A: "range A \<subseteq> E" "(\<Union>i::nat. A i) = space M1" "\<And>i. emeasure (distr M M1 X) (A i) \<noteq> \<infinity>" |
|
1064 |
and X: "X \<in> measurable M M1" |
|
1065 |
and f: "f \<in> borel_measurable M1" "AE x in M1. 0 \<le> f x" |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
1066 |
and eq: "\<And>A. A \<in> E \<Longrightarrow> emeasure M (X -` A \<inter> space M) = (\<integral>\<^sup>+ x. f x * indicator A x \<partial>M1)" |
50419 | 1067 |
shows "distributed M M1 X f" |
1068 |
unfolding distributed_def |
|
1069 |
proof (intro conjI) |
|
1070 |
show "distr M M1 X = density M1 f" |
|
1071 |
proof (rule measure_eqI_generator_eq[where A=A]) |
|
1072 |
{ fix A assume A: "A \<in> E" |
|
1073 |
then have "A \<in> sigma_sets (space M1) E" by auto |
|
1074 |
then have "A \<in> sets M1" |
|
1075 |
using gen by simp |
|
1076 |
with f A eq[of A] X show "emeasure (distr M M1 X) A = emeasure (density M1 f) A" |
|
1077 |
by (simp add: emeasure_distr emeasure_density borel_measurable_ereal |
|
1078 |
times_ereal.simps[symmetric] ereal_indicator |
|
1079 |
del: times_ereal.simps) } |
|
1080 |
note eq_E = this |
|
1081 |
show "Int_stable E" by fact |
|
1082 |
{ fix e assume "e \<in> E" |
|
1083 |
then have "e \<in> sigma_sets (space M1) E" by auto |
|
1084 |
then have "e \<in> sets M1" unfolding gen . |
|
1085 |
then have "e \<subseteq> space M1" by (rule sets.sets_into_space) } |
|
1086 |
then show "E \<subseteq> Pow (space M1)" by auto |
|
1087 |
show "sets (distr M M1 X) = sigma_sets (space M1) E" |
|
1088 |
"sets (density M1 (\<lambda>x. ereal (f x))) = sigma_sets (space M1) E" |
|
1089 |
unfolding gen[symmetric] by auto |
|
1090 |
qed fact+ |
|
1091 |
qed (insert X f, auto) |
|
1092 |
||
1093 |
lemma distributedI_borel_atMost: |
|
1094 |
fixes f :: "real \<Rightarrow> real" |
|
1095 |
assumes [measurable]: "X \<in> borel_measurable M" |
|
1096 |
and [measurable]: "f \<in> borel_measurable borel" and f[simp]: "AE x in lborel. 0 \<le> f x" |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
1097 |
and g_eq: "\<And>a. (\<integral>\<^sup>+x. f x * indicator {..a} x \<partial>lborel) = ereal (g a)" |
50419 | 1098 |
and M_eq: "\<And>a. emeasure M {x\<in>space M. X x \<le> a} = ereal (g a)" |
1099 |
shows "distributed M lborel X f" |
|
1100 |
proof (rule distributedI_real) |
|
57447
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents:
57418
diff
changeset
|
1101 |
show "sets (lborel::real measure) = sigma_sets (space lborel) (range atMost)" |
50419 | 1102 |
by (simp add: borel_eq_atMost) |
1103 |
show "Int_stable (range atMost :: real set set)" |
|
1104 |
by (auto simp: Int_stable_def) |
|
1105 |
have vimage_eq: "\<And>a. (X -` {..a} \<inter> space M) = {x\<in>space M. X x \<le> a}" by auto |
|
1106 |
def A \<equiv> "\<lambda>i::nat. {.. real i}" |
|
1107 |
then show "range A \<subseteq> range atMost" "(\<Union>i. A i) = space lborel" |
|
1108 |
"\<And>i. emeasure (distr M lborel X) (A i) \<noteq> \<infinity>" |
|
1109 |
by (auto simp: real_arch_simple emeasure_distr vimage_eq M_eq) |
|
1110 |
||
1111 |
fix A :: "real set" assume "A \<in> range atMost" |
|
1112 |
then obtain a where A: "A = {..a}" by auto |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51683
diff
changeset
|
1113 |
show "emeasure M (X -` A \<inter> space M) = (\<integral>\<^sup>+x. f x * indicator A x \<partial>lborel)" |
50419 | 1114 |
unfolding vimage_eq A M_eq g_eq .. |
1115 |
qed auto |
|
1116 |
||
1117 |
lemma (in prob_space) uniform_distributed_params: |
|
1118 |
assumes X: "distributed M MX X (\<lambda>x. indicator A x / measure MX A)" |
|
1119 |
shows "A \<in> sets MX" "measure MX A \<noteq> 0" |
|
1120 |
proof - |
|
1121 |
interpret X: prob_space "distr M MX X" |
|
1122 |
using distributed_measurable[OF X] by (rule prob_space_distr) |
|
1123 |
||
1124 |
show "measure MX A \<noteq> 0" |
|
1125 |
proof |
|
1126 |
assume "measure MX A = 0" |
|
1127 |
with X.emeasure_space_1 X.prob_space distributed_distr_eq_density[OF X] |
|
1128 |
show False |
|
1129 |
by (simp add: emeasure_density zero_ereal_def[symmetric]) |
|
1130 |
qed |
|
1131 |
with measure_notin_sets[of A MX] show "A \<in> sets MX" |
|
1132 |
by blast |
|
1133 |
qed |
|
1134 |
||
47694 | 1135 |
lemma prob_space_uniform_measure: |
1136 |
assumes A: "emeasure M A \<noteq> 0" "emeasure M A \<noteq> \<infinity>" |
|
1137 |
shows "prob_space (uniform_measure M A)" |
|
1138 |
proof |
|
1139 |
show "emeasure (uniform_measure M A) (space (uniform_measure M A)) = 1" |
|
1140 |
using emeasure_uniform_measure[OF emeasure_neq_0_sets[OF A(1)], of "space M"] |
|
50244
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents:
50104
diff
changeset
|
1141 |
using sets.sets_into_space[OF emeasure_neq_0_sets[OF A(1)]] A |
47694 | 1142 |
by (simp add: Int_absorb2 emeasure_nonneg) |
1143 |
qed |
|
1144 |
||
1145 |
lemma prob_space_uniform_count_measure: "finite A \<Longrightarrow> A \<noteq> {} \<Longrightarrow> prob_space (uniform_count_measure A)" |
|
61169 | 1146 |
by standard (auto simp: emeasure_uniform_count_measure space_uniform_count_measure one_ereal_def) |
42860 | 1147 |
|
59000 | 1148 |
lemma (in prob_space) measure_uniform_measure_eq_cond_prob: |
1149 |
assumes [measurable]: "Measurable.pred M P" "Measurable.pred M Q" |
|
1150 |
shows "\<P>(x in uniform_measure M {x\<in>space M. Q x}. P x) = \<P>(x in M. P x \<bar> Q x)" |
|
1151 |
proof cases |
|
1152 |
assume Q: "measure M {x\<in>space M. Q x} = 0" |
|
1153 |
then have "AE x in M. \<not> Q x" |
|
1154 |
by (simp add: prob_eq_0) |
|
1155 |
then have "AE x in M. indicator {x\<in>space M. Q x} x / ereal 0 = 0" |
|
1156 |
by (auto split: split_indicator) |
|
1157 |
from density_cong[OF _ _ this] show ?thesis |
|
1158 |
by (simp add: uniform_measure_def emeasure_eq_measure cond_prob_def Q measure_density_const) |
|
1159 |
qed (auto simp add: emeasure_eq_measure cond_prob_def intro!: arg_cong[where f=prob]) |
|
1160 |
||
1161 |
lemma prob_space_point_measure: |
|
1162 |
"finite S \<Longrightarrow> (\<And>s. s \<in> S \<Longrightarrow> 0 \<le> p s) \<Longrightarrow> (\<Sum>s\<in>S. p s) = 1 \<Longrightarrow> prob_space (point_measure S p)" |
|
1163 |
by (rule prob_spaceI) (simp add: space_point_measure emeasure_point_measure_finite) |
|
1164 |
||
61359
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1165 |
lemma (in prob_space) distr_pair_fst: "distr (N \<Otimes>\<^sub>M M) N fst = N" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1166 |
proof (intro measure_eqI) |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1167 |
fix A assume A: "A \<in> sets (distr (N \<Otimes>\<^sub>M M) N fst)" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1168 |
from A have "emeasure (distr (N \<Otimes>\<^sub>M M) N fst) A = emeasure (N \<Otimes>\<^sub>M M) (A \<times> space M)" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1169 |
by (auto simp add: emeasure_distr space_pair_measure dest: sets.sets_into_space intro!: arg_cong2[where f=emeasure]) |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1170 |
with A show "emeasure (distr (N \<Otimes>\<^sub>M M) N fst) A = emeasure N A" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1171 |
by (simp add: emeasure_pair_measure_Times emeasure_space_1) |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1172 |
qed simp |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1173 |
|
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1174 |
lemma (in product_prob_space) distr_reorder: |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1175 |
assumes "inj_on t J" "t \<in> J \<rightarrow> K" "finite K" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1176 |
shows "distr (PiM K M) (Pi\<^sub>M J (\<lambda>x. M (t x))) (\<lambda>\<omega>. \<lambda>n\<in>J. \<omega> (t n)) = PiM J (\<lambda>x. M (t x))" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1177 |
proof (rule product_sigma_finite.PiM_eqI) |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1178 |
show "product_sigma_finite (\<lambda>x. M (t x))" .. |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1179 |
have "t`J \<subseteq> K" using assms by auto |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1180 |
then show [simp]: "finite J" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1181 |
by (rule finite_imageD[OF finite_subset]) fact+ |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1182 |
fix A assume A: "\<And>i. i \<in> J \<Longrightarrow> A i \<in> sets (M (t i))" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1183 |
moreover have "((\<lambda>\<omega>. \<lambda>n\<in>J. \<omega> (t n)) -` Pi\<^sub>E J A \<inter> space (Pi\<^sub>M K M)) = |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1184 |
(\<Pi>\<^sub>E i\<in>K. if i \<in> t`J then A (the_inv_into J t i) else space (M i))" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1185 |
using A A[THEN sets.sets_into_space] \<open>t \<in> J \<rightarrow> K\<close> \<open>inj_on t J\<close> |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1186 |
by (subst prod_emb_Pi[symmetric]) (auto simp: space_PiM PiE_iff the_inv_into_f_f prod_emb_def) |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1187 |
ultimately show "distr (Pi\<^sub>M K M) (Pi\<^sub>M J (\<lambda>x. M (t x))) (\<lambda>\<omega>. \<lambda>n\<in>J. \<omega> (t n)) (Pi\<^sub>E J A) = (\<Prod>i\<in>J. M (t i) (A i))" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1188 |
using assms |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1189 |
apply (subst emeasure_distr) |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1190 |
apply (auto intro!: sets_PiM_I_finite simp: Pi_iff) |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1191 |
apply (subst emeasure_PiM) |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1192 |
apply (auto simp: the_inv_into_f_f \<open>inj_on t J\<close> setprod.reindex[OF \<open>inj_on t J\<close>] |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1193 |
if_distrib[where f="emeasure (M _)"] setprod.If_cases emeasure_space_1 Int_absorb1 \<open>t`J \<subseteq> K\<close>) |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1194 |
done |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1195 |
qed simp |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1196 |
|
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1197 |
lemma (in product_prob_space) distr_restrict: |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1198 |
"J \<subseteq> K \<Longrightarrow> finite K \<Longrightarrow> (\<Pi>\<^sub>M i\<in>J. M i) = distr (\<Pi>\<^sub>M i\<in>K. M i) (\<Pi>\<^sub>M i\<in>J. M i) (\<lambda>f. restrict f J)" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1199 |
using distr_reorder[of "\<lambda>x. x" J K] by (simp add: Pi_iff subset_eq) |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1200 |
|
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1201 |
lemma (in product_prob_space) emeasure_prod_emb[simp]: |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1202 |
assumes L: "J \<subseteq> L" "finite L" and X: "X \<in> sets (Pi\<^sub>M J M)" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1203 |
shows "emeasure (Pi\<^sub>M L M) (prod_emb L M J X) = emeasure (Pi\<^sub>M J M) X" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1204 |
by (subst distr_restrict[OF L]) |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1205 |
(simp add: prod_emb_def space_PiM emeasure_distr measurable_restrict_subset L X) |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1206 |
|
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1207 |
lemma emeasure_distr_restrict: |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1208 |
assumes "I \<subseteq> K" and Q[measurable_cong]: "sets Q = sets (PiM K M)" and A[measurable]: "A \<in> sets (PiM I M)" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1209 |
shows "emeasure (distr Q (PiM I M) (\<lambda>\<omega>. restrict \<omega> I)) A = emeasure Q (prod_emb K M I A)" |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1210 |
using \<open>I\<subseteq>K\<close> sets_eq_imp_space_eq[OF Q] |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1211 |
by (subst emeasure_distr) |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1212 |
(auto simp: measurable_cong_sets[OF Q] prod_emb_def space_PiM[symmetric] intro!: measurable_restrict) |
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents:
61169
diff
changeset
|
1213 |
|
35582 | 1214 |
end |