# HG changeset patch # User hellerar # Date 1283434575 -7200 # Node ID f92b7e2877c2db6f8d54577c34b3975db630774d # Parent 67da17aced5aa3a94c8c09cc0dc1b50ec27c0ba7# Parent 11314c196e119dda4c87e8478fd042ce9262e1ae merged diff -r 67da17aced5a -r f92b7e2877c2 src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Thu Sep 02 15:31:38 2010 +0200 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Thu Sep 02 15:36:15 2010 +0200 @@ -5027,7 +5027,7 @@ (\a\s. \b\s. \x. (\i x$$i \ x$$i \ b$$i) \ (b$$i \ x$$i \ x$$i \ a$$i))) \ x \ s)" lemma is_interval_interval: "is_interval {a .. b::'a::ordered_euclidean_space}" (is ?th1) - "is_interval {a<..x y z::real. x < y \ y < z \ x < z" by auto show ?th1 ?th2 unfolding is_interval_def mem_interval Ball_def atLeastAtMost_iff by(meson order_trans le_less_trans less_le_trans *)+ qed @@ -5051,6 +5051,9 @@ lemma continuous_at_inner: "continuous (at x) (inner a)" unfolding continuous_at by (intro tendsto_intros) +lemma continuous_at_euclidean_component[intro!, simp]: "continuous (at x) (\x. x $$ i)" + unfolding euclidean_component_def by (rule continuous_at_inner) + lemma continuous_on_inner: fixes s :: "'a::real_inner set" shows "continuous_on s (inner a)" @@ -5159,6 +5162,9 @@ by (simp add: closed_def open_halfspace_component_lt) qed +lemma open_vimage_euclidean_component: "open S \ open ((\x. x $$ i) -` S)" + by (auto intro!: continuous_open_vimage) + text{* This gives a simple derivation of limit component bounds. *} lemma Lim_component_le: fixes f :: "'a \ 'b::euclidean_space" diff -r 67da17aced5a -r f92b7e2877c2 src/HOL/Probability/Borel.thy --- a/src/HOL/Probability/Borel.thy Thu Sep 02 15:31:38 2010 +0200 +++ b/src/HOL/Probability/Borel.thy Thu Sep 02 15:36:15 2010 +0200 @@ -81,7 +81,7 @@ "(\x. c) \ borel_measurable M" by (auto intro!: measurable_const) -lemma (in sigma_algebra) borel_measurable_indicator: +lemma (in sigma_algebra) borel_measurable_indicator[simp, intro!]: assumes A: "A \ sets M" shows "indicator A \ borel_measurable M" unfolding indicator_def_raw using A @@ -658,6 +658,30 @@ "(f::'a \ real) \ borel_measurable M = (\a. {w \ space M. a < f w} \ sets M)" using borel_measurable_iff_halfspace_greater[where 'c=real] by simp +lemma borel_measureable_euclidean_component: + "(\x::'a::euclidean_space. x $$ i) \ borel_measurable borel_space" + unfolding borel_space_def[where 'a=real] +proof (rule borel_space.measurable_sigma) + fix S::"real set" assume "S \ open" then have "open S" unfolding mem_def . + from open_vimage_euclidean_component[OF this] + show "(\x. x $$ i) -` S \ space borel_space \ sets borel_space" + by (auto intro: borel_space_open) +qed auto + +lemma (in sigma_algebra) borel_measureable_euclidean_space: + fixes f :: "'a \ 'c::ordered_euclidean_space" + shows "f \ borel_measurable M \ (\ix. f x $$ i) \ borel_measurable M)" +proof safe + fix i assume "f \ borel_measurable M" + then show "(\x. f x $$ i) \ borel_measurable M" + using measurable_comp[of f _ _ "\x. x $$ i", unfolded comp_def] + by (auto intro: borel_measureable_euclidean_component) +next + assume f: "\ix. f x $$ i) \ borel_measurable M" + then show "f \ borel_measurable M" + unfolding borel_measurable_iff_halfspace_le by auto +qed + subsection "Borel measurable operators" lemma (in sigma_algebra) affine_borel_measurable_vector: diff -r 67da17aced5a -r f92b7e2877c2 src/HOL/Probability/Measure.thy --- a/src/HOL/Probability/Measure.thy Thu Sep 02 15:31:38 2010 +0200 +++ b/src/HOL/Probability/Measure.thy Thu Sep 02 15:36:15 2010 +0200 @@ -451,6 +451,32 @@ qed qed +lemma (in measure_space) measure_space_vimage: + assumes "f \ measurable M M'" + and "sigma_algebra M'" + shows "measure_space M' (\A. \ (f -` A \ space M))" (is "measure_space M' ?T") +proof - + interpret M': sigma_algebra M' by fact + + show ?thesis + proof + show "?T {} = 0" by simp + + show "countably_additive M' ?T" + proof (unfold countably_additive_def, safe) + fix A :: "nat \ 'c set" assume "range A \ sets M'" "disjoint_family A" + hence *: "\i. f -` (A i) \ space M \ sets M" + using `f \ measurable M M'` by (auto simp: measurable_def) + moreover have "(\i. f -` A i \ space M) \ sets M" + using * by blast + moreover have **: "disjoint_family (\i. f -` A i \ space M)" + using `disjoint_family A` by (auto simp: disjoint_family_on_def) + ultimately show "(\\<^isub>\ i. ?T (A i)) = ?T (\i. A i)" + using measure_countably_additive[OF _ **] by (auto simp: comp_def vimage_UN) + qed + qed +qed + section "@{text \}-finite Measures" locale sigma_finite_measure = measure_space + diff -r 67da17aced5a -r f92b7e2877c2 src/HOL/Probability/Probability_Space.thy --- a/src/HOL/Probability/Probability_Space.thy Thu Sep 02 15:31:38 2010 +0200 +++ b/src/HOL/Probability/Probability_Space.thy Thu Sep 02 15:36:15 2010 +0200 @@ -1,5 +1,5 @@ theory Probability_Space -imports Lebesgue_Integration +imports Lebesgue_Integration Radon_Nikodym begin lemma (in measure_space) measure_inter_full_set: @@ -197,35 +197,17 @@ qed lemma distribution_prob_space: - fixes S :: "('c, 'd) algebra_scheme" - assumes "sigma_algebra S" "random_variable S X" + assumes S: "sigma_algebra S" "random_variable S X" shows "prob_space S (distribution X)" proof - - interpret S: sigma_algebra S by fact + interpret S: measure_space S "distribution X" + using measure_space_vimage[OF S(2,1)] unfolding distribution_def . show ?thesis proof - show "distribution X {} = 0" unfolding distribution_def by simp have "X -` space S \ space M = space M" using `random_variable S X` by (auto simp: measurable_def) - then show "distribution X (space S) = 1" using measure_space_1 by (simp add: distribution_def) - - show "countably_additive S (distribution X)" - proof (unfold countably_additive_def, safe) - fix A :: "nat \ 'c set" assume "range A \ sets S" "disjoint_family A" - hence *: "\i. X -` A i \ space M \ sets M" - using `random_variable S X` by (auto simp: measurable_def) - moreover hence "\i. \ (X -` A i \ space M) \ \" - using finite_measure by auto - moreover have "(\i. X -` A i \ space M) \ sets M" - using * by blast - moreover hence "\ (\i. X -` A i \ space M) \ \" - using finite_measure by auto - moreover have **: "disjoint_family (\i. X -` A i \ space M)" - using `disjoint_family A` by (auto simp: disjoint_family_on_def) - ultimately show "(\\<^isub>\ i. distribution X (A i)) = distribution X (\i. A i)" - using measure_countably_additive[OF _ **] - by (auto simp: distribution_def Real_real comp_def vimage_UN) - qed + then show "distribution X (space S) = 1" + using measure_space_1 by (simp add: distribution_def) qed qed @@ -463,4 +445,182 @@ by (simp add: distribution_def prob_space vimage_Times comp_def measure_space_1) qed +lemma (in prob_space) prob_space_subalgebra: + assumes "N \ sets M" "sigma_algebra (M\ sets := N \)" + shows "prob_space (M\ sets := N \) \" sorry + +lemma (in measure_space) measure_space_subalgebra: + assumes "N \ sets M" "sigma_algebra (M\ sets := N \)" + shows "measure_space (M\ sets := N \) \" sorry + +lemma pinfreal_0_less_mult_iff[simp]: + fixes x y :: pinfreal shows "0 < x * y \ 0 < x \ 0 < y" + by (cases x, cases y) (auto simp: zero_less_mult_iff) + +lemma (in sigma_algebra) simple_function_subalgebra: + assumes "sigma_algebra.simple_function (M\sets:=N\) f" + and N_subalgebra: "N \ sets M" "sigma_algebra (M\sets:=N\)" + shows "simple_function f" + using assms + unfolding simple_function_def + unfolding sigma_algebra.simple_function_def[OF N_subalgebra(2)] + by auto + +lemma (in measure_space) simple_integral_subalgebra[simp]: + assumes "measure_space (M\sets := N\) \" + shows "measure_space.simple_integral (M\sets := N\) \ = simple_integral" + unfolding simple_integral_def_raw + unfolding measure_space.simple_integral_def_raw[OF assms] by simp + +lemma (in sigma_algebra) borel_measurable_subalgebra: + assumes "N \ sets M" "f \ borel_measurable (M\sets:=N\)" + shows "f \ borel_measurable M" + using assms unfolding measurable_def by auto + +lemma (in measure_space) positive_integral_subalgebra[simp]: + assumes borel: "f \ borel_measurable (M\sets := N\)" + and N_subalgebra: "N \ sets M" "sigma_algebra (M\sets := N\)" + shows "measure_space.positive_integral (M\sets := N\) \ f = positive_integral f" +proof - + note msN = measure_space_subalgebra[OF N_subalgebra] + then interpret N: measure_space "M\sets:=N\" \ . + + from N.borel_measurable_implies_simple_function_sequence[OF borel] + obtain fs where Nsf: "\i. N.simple_function (fs i)" and "fs \ f" by blast + then have sf: "\i. simple_function (fs i)" + using simple_function_subalgebra[OF _ N_subalgebra] by blast + + from positive_integral_isoton_simple[OF `fs \ f` sf] N.positive_integral_isoton_simple[OF `fs \ f` Nsf] + show ?thesis unfolding simple_integral_subalgebra[OF msN] isoton_def by simp +qed + +section "Conditional Expectation and Probability" + +lemma (in prob_space) conditional_expectation_exists: + fixes X :: "'a \ pinfreal" + assumes borel: "X \ borel_measurable M" + and N_subalgebra: "N \ sets M" "sigma_algebra (M\ sets := N \)" + shows "\Y\borel_measurable (M\ sets := N \). \C\N. + positive_integral (\x. Y x * indicator C x) = positive_integral (\x. X x * indicator C x)" +proof - + interpret P: prob_space "M\ sets := N \" \ + using prob_space_subalgebra[OF N_subalgebra] . + + let "?f A" = "\x. X x * indicator A x" + let "?Q A" = "positive_integral (?f A)" + + from measure_space_density[OF borel] + have Q: "measure_space (M\ sets := N \) ?Q" + by (rule measure_space.measure_space_subalgebra[OF _ N_subalgebra]) + then interpret Q: measure_space "M\ sets := N \" ?Q . + + have "P.absolutely_continuous ?Q" + unfolding P.absolutely_continuous_def + proof (safe, simp) + fix A assume "A \ N" "\ A = 0" + moreover then have f_borel: "?f A \ borel_measurable M" + using borel N_subalgebra by (auto intro: borel_measurable_indicator) + moreover have "{x\space M. ?f A x \ 0} = (?f A -` {0<..} \ space M) \ A" + by (auto simp: indicator_def) + moreover have "\ \ \ \ A" + using `A \ N` N_subalgebra f_borel + by (auto intro!: measure_mono Int[of _ A] measurable_sets) + ultimately show "?Q A = 0" + by (simp add: positive_integral_0_iff) + qed + from P.Radon_Nikodym[OF Q this] + obtain Y where Y: "Y \ borel_measurable (M\sets := N\)" + "\A. A \ sets (M\sets:=N\) \ ?Q A = P.positive_integral (\x. Y x * indicator A x)" + by blast + with N_subalgebra show ?thesis + by (auto intro!: bexI[OF _ Y(1)]) +qed + +definition (in prob_space) + "conditional_expectation N X = (SOME Y. Y\borel_measurable (M\sets:=N\) + \ (\C\N. positive_integral (\x. Y x * indicator C x) = positive_integral (\x. X x * indicator C x)))" + +abbreviation (in prob_space) + "conditional_probabiltiy N A \ conditional_expectation N (indicator A)" + +lemma (in prob_space) + fixes X :: "'a \ pinfreal" + assumes borel: "X \ borel_measurable M" + and N_subalgebra: "N \ sets M" "sigma_algebra (M\ sets := N \)" + shows borel_measurable_conditional_expectation: + "conditional_expectation N X \ borel_measurable (M\ sets := N \)" + and conditional_expectation: "\C. C \ N \ + positive_integral (\x. conditional_expectation N X x * indicator C x) = + positive_integral (\x. X x * indicator C x)" + (is "\C. C \ N \ ?eq C") +proof - + note CE = conditional_expectation_exists[OF assms, unfolded Bex_def] + then show "conditional_expectation N X \ borel_measurable (M\ sets := N \)" + unfolding conditional_expectation_def by (rule someI2_ex) blast + + from CE show "\C. C\N \ ?eq C" + unfolding conditional_expectation_def by (rule someI2_ex) blast +qed + +lemma (in sigma_algebra) factorize_measurable_function: + fixes Z :: "'a \ pinfreal" and Y :: "'a \ 'c" + assumes "sigma_algebra M'" and "Y \ measurable M M'" "Z \ borel_measurable M" + shows "Z \ borel_measurable (sigma_algebra.vimage_algebra M' (space M) Y) + \ (\g\borel_measurable M'. \x\space M. Z x = g (Y x))" +proof safe + interpret M': sigma_algebra M' by fact + have Y: "Y \ space M \ space M'" using assms unfolding measurable_def by auto + from M'.sigma_algebra_vimage[OF this] + interpret va: sigma_algebra "M'.vimage_algebra (space M) Y" . + + { fix g :: "'c \ pinfreal" assume "g \ borel_measurable M'" + with M'.measurable_vimage_algebra[OF Y] + have "g \ Y \ borel_measurable (M'.vimage_algebra (space M) Y)" + by (rule measurable_comp) + moreover assume "\x\space M. Z x = g (Y x)" + then have "Z \ borel_measurable (M'.vimage_algebra (space M) Y) \ + g \ Y \ borel_measurable (M'.vimage_algebra (space M) Y)" + by (auto intro!: measurable_cong) + ultimately show "Z \ borel_measurable (M'.vimage_algebra (space M) Y)" + by simp } + + assume "Z \ borel_measurable (M'.vimage_algebra (space M) Y)" + from va.borel_measurable_implies_simple_function_sequence[OF this] + obtain f where f: "\i. va.simple_function (f i)" and "f \ Z" by blast + + have "\i. \g. M'.simple_function g \ (\x\space M. f i x = g (Y x))" + proof + fix i + from f[of i] have "finite (f i`space M)" and B_ex: + "\z\(f i)`space M. \B. B \ sets M' \ (f i) -` {z} \ space M = Y -` B \ space M" + unfolding va.simple_function_def by auto + from B_ex[THEN bchoice] guess B .. note B = this + + let ?g = "\x. \z\f i`space M. z * indicator (B z) x" + + show "\g. M'.simple_function g \ (\x\space M. f i x = g (Y x))" + proof (intro exI[of _ ?g] conjI ballI) + show "M'.simple_function ?g" using B by auto + + fix x assume "x \ space M" + then have "\z. z \ f i`space M \ indicator (B z) (Y x) = (indicator (f i -` {z} \ space M) x::pinfreal)" + unfolding indicator_def using B by auto + then show "f i x = ?g (Y x)" using `x \ space M` f[of i] + by (subst va.simple_function_indicator_representation) auto + qed + qed + from choice[OF this] guess g .. note g = this + + show "\g\borel_measurable M'. \x\space M. Z x = g (Y x)" + proof (intro ballI bexI) + show "(SUP i. g i) \ borel_measurable M'" + using g by (auto intro: M'.borel_measurable_simple_function) + fix x assume "x \ space M" + have "Z x = (SUP i. f i) x" using `f \ Z` unfolding isoton_def by simp + also have "\ = (SUP i. g i) (Y x)" unfolding SUPR_fun_expand + using g `x \ space M` by simp + finally show "Z x = (SUP i. g i) (Y x)" . + qed +qed + end diff -r 67da17aced5a -r f92b7e2877c2 src/HOL/Probability/Product_Measure.thy --- a/src/HOL/Probability/Product_Measure.thy Thu Sep 02 15:31:38 2010 +0200 +++ b/src/HOL/Probability/Product_Measure.thy Thu Sep 02 15:36:15 2010 +0200 @@ -2,12 +2,11 @@ imports Lebesgue_Integration begin -definition dynkin -where "dynkin M = - ((\ A \ sets M. A \ space M) \ - space M \ sets M \ (\ b \ sets M. \ a \ sets M. a \ b \ b - a \ sets M) \ - (\ a. (\ i j :: nat. i \ j \ a i \ a j = {}) \ - (\ i :: nat. a i \ sets M) \ UNION UNIV a \ sets M))" +definition "dynkin M \ + space M \ sets M \ + (\ A \ sets M. A \ space M) \ + (\ a \ sets M. \ b \ sets M. b - a \ sets M) \ + (\A. disjoint_family A \ range A \ sets M \ (\i::nat. A i) \ sets M)" lemma dynkinI: assumes "\ A. A \ sets M \ A \ space M" @@ -15,7 +14,7 @@ assumes "\ a. (\ i j :: nat. i \ j \ a i \ a j = {}) \ (\ i :: nat. a i \ sets M) \ UNION UNIV a \ sets M" shows "dynkin M" -using assms unfolding dynkin_def by auto +using assms unfolding dynkin_def sorry lemma dynkin_subset: assumes "dynkin M" @@ -42,16 +41,16 @@ assumes "\ i j :: nat. i \ j \ a i \ a j = {}" assumes "\ i :: nat. a i \ sets M" shows "UNION UNIV a \ sets M" -using assms unfolding dynkin_def by auto +using assms unfolding dynkin_def sorry -definition Int_stable -where "Int_stable M = (\ a \ sets M. (\ b \ sets M. a \ b \ sets M))" +definition "Int_stable M \ (\ a \ sets M. \ b \ sets M. a \ b \ sets M)" lemma dynkin_trivial: shows "dynkin \ space = A, sets = Pow A \" by (rule dynkinI) auto lemma dynkin_lemma: + fixes D :: "'a algebra" assumes stab: "Int_stable E" and spac: "space E = space D" and subsED: "sets E \ sets D" @@ -72,23 +71,9 @@ proof (rule dynkinI, safe) fix A x assume asm: "A \ sets \E" "x \ A" { fix d :: "('a, 'b) algebra_scheme" assume "A \ sets d" "dynkin d \ space d = space E" - hence "A \ space d" - using dynkin_subset by auto } - show "x \ space \E" using asm - unfolding \E_def sets_\E_def using not_empty - proof auto - fix x A fix d :: "'a algebra" - assume asm: "\x. (\d :: 'a algebra. x = sets d \ - dynkin d \ - space d = space E \ - sets E \ sets d) \ - A \ x" "x \ A" - and asm': "space d = space E" "dynkin d" "sets E \ sets d" - have "A \ sets d" - apply (rule impE[OF spec[OF asm(1), of "sets d"]]) - using exI[of _ d] asm' by auto - thus "x \ space E" using asm' dynkin_subset[OF asm'(2), of A] asm(2) by auto - qed + hence "A \ space d" using dynkin_subset by auto } + show "x \ space \E" using asm unfolding \E_def sets_\E_def using not_empty + by simp (metis dynkin_subset in_mono mem_def) next show "space \E \ sets \E" unfolding \E_def sets_\E_def @@ -103,28 +88,14 @@ unfolding \E_def sets_\E_def apply (auto intro!:dynkin_UN[OF _ asm(1)]) by blast qed + def Dy == "\ d. {A | A. A \ sets_\E \ A \ d \ sets_\E}" { fix d assume dasm: "d \ sets_\E" have "dynkin \ space = space E, sets = Dy d \" - proof (rule dynkinI, auto) + proof (rule dynkinI, safe, simp_all) fix A x assume "A \ Dy d" "x \ A" thus "x \ space E" unfolding Dy_def sets_\E_def using not_empty - proof auto fix x A fix da :: "'a algebra" - assume asm: "x \ A" - "\x. (\d :: 'a algebra. x = sets d \ - dynkin d \ space d = space E \ - sets E \ sets d) \ A \ x" - "\x. (\d. x = sets d \ - dynkin d \ space d = space E \ - sets E \ sets d) \ A \ d \ x" - "space da = space E" "dynkin da" - "sets E \ sets da" - have "A \ sets da" - apply (rule impE[OF spec[OF asm(2)], of "sets da"]) - apply (rule exI[of _ da]) - using exI[of _ da] asm(4,5,6) by auto - thus "x \ space E" using dynkin_subset[OF asm(5)] asm by auto - qed + by simp (metis dynkin_subset in_mono mem_def) next show "space E \ Dy d" unfolding Dy_def \E_def sets_\E_def @@ -192,20 +163,7 @@ have "\ space = space E, sets = Dy e \ \ {d | d. dynkin d \ space d = space E \ sets E \ sets d}" using Dy_nkin[OF deasm[unfolded \E_def, simplified]] E_\E E_Dy by auto hence "sets_\E \ Dy e" - unfolding sets_\E_def - proof auto fix x - assume asm: "\xa. (\d :: 'a algebra. xa = sets d \ - dynkin d \ - space d = space E \ - sets E \ sets d) \ - x \ xa" - "dynkin \space = space E, sets = Dy e\" - "sets E \ Dy e" - show "x \ Dy e" - apply (rule impE[OF spec[OF asm(1), of "Dy e"]]) - apply (rule exI[of _ "\space = space E, sets = Dy e\"]) - using asm by auto - qed + unfolding sets_\E_def by auto (metis E_Dy simps(1) simps(2) spac) hence "sets \E = Dy e" using subset unfolding \E_def by auto hence "d \ e \ sets \E" using dasm easm deasm unfolding Dy_def \E_def by auto @@ -214,18 +172,8 @@ by (auto simp add:Int_commute) } hence "sets E \ Dy d" by auto hence "sets \E \ Dy d" using Dy_nkin[OF dasm[unfolded \E_def, simplified]] - unfolding \E_def sets_\E_def - proof auto - fix x - assume asm: "sets E \ Dy d" - "dynkin \space = space E, sets = Dy d\" - "\xa. (\d :: 'a algebra. xa = sets d \ dynkin d \ - space d = space E \ sets E \ sets d) \ x \ xa" - show "x \ Dy d" - apply (rule impE[OF spec[OF asm(3), of "Dy d"]]) - apply (rule exI[of _ "\space = space E, sets = Dy d\"]) - using asm by auto - qed + unfolding \E_def sets_\E_def + by auto (metis `sets E <= Dy d` simps(1) simps(2) spac) hence *: "sets \E = Dy d" unfolding Dy_def \E_def by auto fix a assume aasm: "a \ sets \E" @@ -394,19 +342,72 @@ have "\ (A i \ B) = \ (A i \ B)" apply (rule measure_eq[of \ ?M \ "\ space = space E \ A i, sets = op \ (A i) ` sets E\" "A i \ B", simplified]) using assms nu_i mu_i - apply (auto simp add:image_def) (* TODO *) + apply (auto simp add:image_def) (* TODO *) sorry + show ?thesis sorry qed -lemma -(* definition prod_sets where "prod_sets A B = {z. \x \ A. \y \ B. z = x \ y}" definition - "prod_measure M \ N \ = (\A. measure_space.positive_integral M \ (\s0. \ ((\s1. (s0, s1)) -` A)))" + "prod_measure_space M1 M2 = sigma (space M1 \ space M2) (prod_sets (sets M1) (sets M2))" + +lemma + fixes M1 :: "'a algebra" and M2 :: "'b algebra" + assumes "algebra M1" "algebra M2" + shows measureable_fst[intro!, simp]: + "fst \ measurable (prod_measure_space M1 M2) M1" (is ?fst) + and measureable_snd[intro!, simp]: + "snd \ measurable (prod_measure_space M1 M2) M2" (is ?snd) +proof - + interpret M1: algebra M1 by fact + interpret M2: algebra M2 by fact + + { fix X assume "X \ sets M1" + then have "\X1\sets M1. \X2\sets M2. fst -` X \ space M1 \ space M2 = X1 \ X2" + apply - apply (rule bexI[of _ X]) apply (rule bexI[of _ "space M2"]) + using M1.sets_into_space by force+ } + moreover + { fix X assume "X \ sets M2" + then have "\X1\sets M1. \X2\sets M2. snd -` X \ space M1 \ space M2 = X1 \ X2" + apply - apply (rule bexI[of _ "space M1"]) apply (rule bexI[of _ X]) + using M2.sets_into_space by force+ } + ultimately show ?fst ?snd + by (force intro!: sigma_sets.Basic + simp: measurable_def prod_measure_space_def prod_sets_def sets_sigma)+ +qed + +lemma (in sigma_algebra) measureable_prod: + fixes M1 :: "'a algebra" and M2 :: "'b algebra" + assumes "algebra M1" "algebra M2" + shows "f \ measurable M (prod_measure_space M1 M2) \ + (fst \ f) \ measurable M M1 \ (snd \ f) \ measurable M M2" +using assms proof (safe intro!: measurable_comp[where b="prod_measure_space M1 M2"]) + interpret M1: algebra M1 by fact + interpret M2: algebra M2 by fact + assume f: "(fst \ f) \ measurable M M1" and s: "(snd \ f) \ measurable M M2" + + show "f \ measurable M (prod_measure_space M1 M2)" unfolding prod_measure_space_def + proof (rule measurable_sigma) + show "prod_sets (sets M1) (sets M2) \ Pow (space M1 \ space M2)" + unfolding prod_sets_def using M1.sets_into_space M2.sets_into_space by auto + show "f \ space M \ space M1 \ space M2" + using f s by (auto simp: mem_Times_iff measurable_def comp_def) + fix A assume "A \ prod_sets (sets M1) (sets M2)" + then obtain B C where "B \ sets M1" "C \ sets M2" "A = B \ C" + unfolding prod_sets_def by auto + moreover have "(fst \ f) -` B \ space M \ sets M" + using f `B \ sets M1` unfolding measurable_def by auto + moreover have "(snd \ f) -` C \ space M \ sets M" + using s `C \ sets M2` unfolding measurable_def by auto + moreover have "f -` A \ space M = ((fst \ f) -` B \ space M) \ ((snd \ f) -` C \ space M)" + unfolding `A = B \ C` by (auto simp: vimage_Times) + ultimately show "f -` A \ space M \ sets M" by auto + qed +qed definition - "prod_measure_space M1 M2 = sigma (space M1 \ space M2) (prod_sets (sets M1) (sets M2))" + "prod_measure M \ N \ = (\A. measure_space.positive_integral M \ (\s0. \ ((\s1. (s0, s1)) -` A)))" lemma prod_setsI: "x \ A \ y \ B \ (x \ y) \ prod_sets A B" by (auto simp add: prod_sets_def) @@ -550,5 +551,4 @@ unfolding finite_prod_measure_space[OF N, symmetric] using finite_measure_space_finite_prod_measure[OF N] . -*) -end \ No newline at end of file +end diff -r 67da17aced5a -r f92b7e2877c2 src/HOL/Probability/Sigma_Algebra.thy --- a/src/HOL/Probability/Sigma_Algebra.thy Thu Sep 02 15:31:38 2010 +0200 +++ b/src/HOL/Probability/Sigma_Algebra.thy Thu Sep 02 15:36:15 2010 +0200 @@ -626,6 +626,51 @@ thus "(\i::nat. A i) \ sets M" by (simp add: UN_disjointed_eq) qed +subsection {* Sigma algebra generated by function preimages *} + +definition (in sigma_algebra) + "vimage_algebra S f = \ space = S, sets = (\A. f -` A \ S) ` sets M \" + +lemma (in sigma_algebra) in_vimage_algebra[simp]: + "A \ sets (vimage_algebra S f) \ (\B\sets M. A = f -` B \ S)" + by (simp add: vimage_algebra_def image_iff) + +lemma (in sigma_algebra) space_vimage_algebra[simp]: + "space (vimage_algebra S f) = S" + by (simp add: vimage_algebra_def) + +lemma (in sigma_algebra) sigma_algebra_vimage: + fixes S :: "'c set" assumes "f \ S \ space M" + shows "sigma_algebra (vimage_algebra S f)" +proof + fix A assume "A \ sets (vimage_algebra S f)" + then guess B unfolding in_vimage_algebra .. + then show "space (vimage_algebra S f) - A \ sets (vimage_algebra S f)" + using sets_into_space assms + by (auto intro!: bexI[of _ "space M - B"]) +next + fix A assume "A \ sets (vimage_algebra S f)" + then guess A' unfolding in_vimage_algebra .. note A' = this + fix B assume "B \ sets (vimage_algebra S f)" + then guess B' unfolding in_vimage_algebra .. note B' = this + then show "A \ B \ sets (vimage_algebra S f)" + using sets_into_space assms A' B' + by (auto intro!: bexI[of _ "A' \ B'"]) +next + fix A::"nat \ 'c set" assume "range A \ sets (vimage_algebra S f)" + then have "\i. \B. A i = f -` B \ S \ B \ sets M" + by (simp add: subset_eq) blast + from this[THEN choice] obtain B + where B: "\i. A i = f -` B i \ S" "range B \ sets M" by auto + show "(\i. A i) \ sets (vimage_algebra S f)" + using B by (auto intro!: bexI[of _ "\i. B i"]) +qed auto + +lemma (in sigma_algebra) measurable_vimage_algebra: + fixes S :: "'c set" assumes "f \ S \ space M" + shows "f \ measurable (vimage_algebra S f) M" + unfolding measurable_def using assms by force + subsection {* A Two-Element Series *} definition binaryset :: "'a set \ 'a set \ nat \ 'a set "