# HG changeset patch # User hoelzl # Date 1283440360 -7200 # Node ID 98de4085985867c63b78fbc90824349eac4203e3 # Parent 11314c196e119dda4c87e8478fd042ce9262e1ae move lemmas to correct theory files diff -r 11314c196e11 -r 98de40859858 src/HOL/Probability/Borel.thy --- a/src/HOL/Probability/Borel.thy Fri Aug 27 16:23:51 2010 +0200 +++ b/src/HOL/Probability/Borel.thy Thu Sep 02 17:12:40 2010 +0200 @@ -6,6 +6,10 @@ imports Sigma_Algebra Positive_Infinite_Real Multivariate_Analysis begin +lemma LIMSEQ_max: + "u ----> (x::real) \ (\i. max (u i) 0) ----> max x 0" + by (fastsimp intro!: LIMSEQ_I dest!: LIMSEQ_D) + section "Generic Borel spaces" definition "borel_space = sigma (UNIV::'a::topological_space set) open" @@ -105,6 +109,53 @@ qed (auto simp add: vimage_UN) qed +lemma (in sigma_algebra) borel_measurable_restricted: + fixes f :: "'a \ 'x\{topological_space, semiring_1}" assumes "A \ sets M" + shows "f \ borel_measurable (restricted_space A) \ + (\x. f x * indicator A x) \ borel_measurable M" + (is "f \ borel_measurable ?R \ ?f \ borel_measurable M") +proof - + interpret R: sigma_algebra ?R by (rule restricted_sigma_algebra[OF `A \ sets M`]) + have *: "f \ borel_measurable ?R \ ?f \ borel_measurable ?R" + by (auto intro!: measurable_cong) + show ?thesis unfolding * + unfolding in_borel_measurable_borel_space + proof (simp, safe) + fix S :: "'x set" assume "S \ sets borel_space" + "\S\sets borel_space. ?f -` S \ A \ op \ A ` sets M" + then have "?f -` S \ A \ op \ A ` sets M" by auto + then have f: "?f -` S \ A \ sets M" + using `A \ sets M` sets_into_space by fastsimp + show "?f -` S \ space M \ sets M" + proof cases + assume "0 \ S" + then have "?f -` S \ space M = ?f -` S \ A \ (space M - A)" + using `A \ sets M` sets_into_space by auto + then show ?thesis using f `A \ sets M` by (auto intro!: Un Diff) + next + assume "0 \ S" + then have "?f -` S \ space M = ?f -` S \ A" + using `A \ sets M` sets_into_space + by (auto simp: indicator_def split: split_if_asm) + then show ?thesis using f by auto + qed + next + fix S :: "'x set" assume "S \ sets borel_space" + "\S\sets borel_space. ?f -` S \ space M \ sets M" + then have f: "?f -` S \ space M \ sets M" by auto + then show "?f -` S \ A \ op \ A ` sets M" + using `A \ sets M` sets_into_space + apply (simp add: image_iff) + apply (rule bexI[OF _ f]) + by auto + qed +qed + +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 + section "Borel spaces on euclidean spaces" lemma lessThan_borel[simp, intro]: @@ -1294,4 +1345,46 @@ using assms by auto qed +lemma (in sigma_algebra) borel_measurable_psuminf: + assumes "\i. f i \ borel_measurable M" + shows "(\x. (\\<^isub>\ i. f i x)) \ borel_measurable M" + using assms unfolding psuminf_def + by (auto intro!: borel_measurable_SUP[unfolded SUPR_fun_expand]) + +section "LIMSEQ is borel measurable" + +lemma (in sigma_algebra) borel_measurable_LIMSEQ: + fixes u :: "nat \ 'a \ real" + assumes u': "\x. x \ space M \ (\i. u i x) ----> u' x" + and u: "\i. u i \ borel_measurable M" + shows "u' \ borel_measurable M" +proof - + let "?pu x i" = "max (u i x) 0" + let "?nu x i" = "max (- u i x) 0" + + { fix x assume x: "x \ space M" + have "(?pu x) ----> max (u' x) 0" + "(?nu x) ----> max (- u' x) 0" + using u'[OF x] by (auto intro!: LIMSEQ_max LIMSEQ_minus) + from LIMSEQ_imp_lim_INF[OF _ this(1)] LIMSEQ_imp_lim_INF[OF _ this(2)] + have "(SUP n. INF m. Real (u (n + m) x)) = Real (u' x)" + "(SUP n. INF m. Real (- u (n + m) x)) = Real (- u' x)" + by (simp_all add: Real_max'[symmetric]) } + note eq = this + + have *: "\x. real (Real (u' x)) - real (Real (- u' x)) = u' x" + by auto + + have "(SUP n. INF m. (\x. Real (u (n + m) x))) \ borel_measurable M" + "(SUP n. INF m. (\x. Real (- u (n + m) x))) \ borel_measurable M" + using u by (auto intro: borel_measurable_SUP borel_measurable_INF borel_measurable_Real) + with eq[THEN measurable_cong, of M "\x. x" borel_space] + have "(\x. Real (u' x)) \ borel_measurable M" + "(\x. Real (- u' x)) \ borel_measurable M" + unfolding SUPR_fun_expand INFI_fun_expand by auto + note this[THEN borel_measurable_real] + from borel_measurable_diff[OF this] + show ?thesis unfolding * . +qed + end diff -r 11314c196e11 -r 98de40859858 src/HOL/Probability/Information.thy --- a/src/HOL/Probability/Information.thy Fri Aug 27 16:23:51 2010 +0200 +++ b/src/HOL/Probability/Information.thy Thu Sep 02 17:12:40 2010 +0200 @@ -359,6 +359,48 @@ "(\x\A \ B. f x) = (\x\A. setsum (\y. f (x, y)) B)" unfolding setsum_cartesian_product by simp +lemma (in finite_information_space) mutual_information_generic_eq: + assumes MX: "finite_measure_space MX (distribution X)" + assumes MY: "finite_measure_space MY (distribution Y)" + shows "mutual_information b MX MY X Y = (\ (x,y) \ space MX \ space MY. + real (joint_distribution X Y {(x,y)}) * + log b (real (joint_distribution X Y {(x,y)}) / + (real (distribution X {x}) * real (distribution Y {y}))))" +proof - + let ?P = "prod_measure_space MX MY" + let ?\ = "prod_measure MX (distribution X) MY (distribution Y)" + let ?\ = "joint_distribution X Y" + interpret X: finite_measure_space MX "distribution X" by fact + moreover interpret Y: finite_measure_space MY "distribution Y" by fact + have fms: "finite_measure_space MX (distribution X)" + "finite_measure_space MY (distribution Y)" by fact+ + have fms_P: "finite_measure_space ?P ?\" + by (rule X.finite_measure_space_finite_prod_measure) fact + then interpret P: finite_measure_space ?P ?\ . + have fms_P': "finite_measure_space ?P ?\" + using finite_product_measure_space[of "space MX" "space MY"] + X.finite_space Y.finite_space sigma_prod_sets_finite[OF X.finite_space Y.finite_space] + X.sets_eq_Pow Y.sets_eq_Pow + by (simp add: prod_measure_space_def sigma_def) + then interpret P': finite_measure_space ?P ?\ . + { fix x assume "x \ space ?P" + hence in_MX: "{fst x} \ sets MX" "{snd x} \ sets MY" using X.sets_eq_Pow Y.sets_eq_Pow + by (auto simp: prod_measure_space_def) + assume "?\ {x} = 0" + with X.finite_prod_measure_times[OF fms(2), of "{fst x}" "{snd x}"] in_MX + have "distribution X {fst x} = 0 \ distribution Y {snd x} = 0" + by (simp add: prod_measure_space_def) + hence "joint_distribution X Y {x} = 0" + by (cases x) (auto simp: distribution_order) } + note measure_0 = this + show ?thesis + unfolding Let_def mutual_information_def + using measure_0 fms_P fms_P' MX MY P.absolutely_continuous_def + by (subst P.KL_divergence_eq_finite) + (auto simp add: prod_measure_space_def prod_measure_times_finite + finite_prob_space_eq setsum_cartesian_product' real_of_pinfreal_mult[symmetric]) +qed + lemma (in finite_information_space) assumes MX: "finite_prob_space MX (distribution X)" assumes MY: "finite_prob_space MY (distribution Y)" diff -r 11314c196e11 -r 98de40859858 src/HOL/Probability/Lebesgue_Integration.thy --- a/src/HOL/Probability/Lebesgue_Integration.thy Fri Aug 27 16:23:51 2010 +0200 +++ b/src/HOL/Probability/Lebesgue_Integration.thy Thu Sep 02 17:12:40 2010 +0200 @@ -209,19 +209,6 @@ by (auto intro!: **) qed -lemma setsum_indicator_disjoint_family: - fixes f :: "'d \ 'e::semiring_1" - assumes d: "disjoint_family_on A P" and "x \ A j" and "finite P" and "j \ P" - shows "(\i\P. f i * indicator (A i) x) = f j" -proof - - have "P \ {i. x \ A i} = {j}" - using d `x \ A j` `j \ P` unfolding disjoint_family_on_def - by auto - thus ?thesis - unfolding indicator_def - by (simp add: if_distrib setsum_cases[OF `finite P`]) -qed - lemma (in sigma_algebra) borel_measurable_implies_simple_function_sequence: fixes u :: "'a \ pinfreal" assumes u: "u \ borel_measurable M" @@ -426,6 +413,62 @@ with x show thesis by (auto intro!: that[of f]) qed +lemma (in sigma_algebra) simple_function_eq_borel_measurable: + fixes f :: "'a \ pinfreal" + shows "simple_function f \ + finite (f`space M) \ f \ borel_measurable M" + using simple_function_borel_measurable[of f] + borel_measurable_simple_function[of f] + by (fastsimp simp: simple_function_def) + +lemma (in measure_space) simple_function_restricted: + fixes f :: "'a \ pinfreal" assumes "A \ sets M" + shows "sigma_algebra.simple_function (restricted_space A) f \ simple_function (\x. f x * indicator A x)" + (is "sigma_algebra.simple_function ?R f \ simple_function ?f") +proof - + interpret R: sigma_algebra ?R by (rule restricted_sigma_algebra[OF `A \ sets M`]) + have "finite (f`A) \ finite (?f`space M)" + proof cases + assume "A = space M" + then have "f`A = ?f`space M" by (fastsimp simp: image_iff) + then show ?thesis by simp + next + assume "A \ space M" + then obtain x where x: "x \ space M" "x \ A" + using sets_into_space `A \ sets M` by auto + have *: "?f`space M = f`A \ {0}" + proof (auto simp add: image_iff) + show "\x\space M. f x = 0 \ indicator A x = 0" + using x by (auto intro!: bexI[of _ x]) + next + fix x assume "x \ A" + then show "\y\space M. f x = f y * indicator A y" + using `A \ sets M` sets_into_space by (auto intro!: bexI[of _ x]) + next + fix x + assume "indicator A x \ (0::pinfreal)" + then have "x \ A" by (auto simp: indicator_def split: split_if_asm) + moreover assume "x \ space M" "\y\A. ?f x \ f y" + ultimately show "f x = 0" by auto + qed + then show ?thesis by auto + qed + then show ?thesis + unfolding simple_function_eq_borel_measurable + R.simple_function_eq_borel_measurable + unfolding borel_measurable_restricted[OF `A \ sets M`] + by auto +qed + +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 + section "Simple integral" definition (in measure_space) @@ -668,6 +711,41 @@ qed qed +lemma (in measure_space) simple_integral_restricted: + assumes "A \ sets M" + assumes sf: "simple_function (\x. f x * indicator A x)" + shows "measure_space.simple_integral (restricted_space A) \ f = simple_integral (\x. f x * indicator A x)" + (is "_ = simple_integral ?f") + unfolding measure_space.simple_integral_def[OF restricted_measure_space[OF `A \ sets M`]] + unfolding simple_integral_def +proof (simp, safe intro!: setsum_mono_zero_cong_left) + from sf show "finite (?f ` space M)" + unfolding simple_function_def by auto +next + fix x assume "x \ A" + then show "f x \ ?f ` space M" + using sets_into_space `A \ sets M` by (auto intro!: image_eqI[of _ _ x]) +next + fix x assume "x \ space M" "?f x \ f`A" + then have "x \ A" by (auto simp: image_iff) + then show "?f x * \ (?f -` {?f x} \ space M) = 0" by simp +next + fix x assume "x \ A" + then have "f x \ 0 \ + f -` {f x} \ A = ?f -` {f x} \ space M" + using `A \ sets M` sets_into_space + by (auto simp: indicator_def split: split_if_asm) + then show "f x * \ (f -` {f x} \ A) = + f x * \ (?f -` {f x} \ space M)" + unfolding pinfreal_mult_cancel_left by auto +qed + +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 + section "Continuous posititve integration" definition (in measure_space) @@ -1077,6 +1155,43 @@ qed qed +lemma (in measure_space) positive_integral_translated_density: + assumes "f \ borel_measurable M" "g \ borel_measurable M" + shows "measure_space.positive_integral M (\A. positive_integral (\x. f x * indicator A x)) g = + positive_integral (\x. f x * g x)" (is "measure_space.positive_integral M ?T _ = _") +proof - + from measure_space_density[OF assms(1)] + interpret T: measure_space M ?T . + from borel_measurable_implies_simple_function_sequence[OF assms(2)] + obtain G where G: "\i. simple_function (G i)" "G \ g" by blast + note G_borel = borel_measurable_simple_function[OF this(1)] + from T.positive_integral_isoton[OF `G \ g` G_borel] + have *: "(\i. T.positive_integral (G i)) \ T.positive_integral g" . + { fix i + have [simp]: "finite (G i ` space M)" + using G(1) unfolding simple_function_def by auto + have "T.positive_integral (G i) = T.simple_integral (G i)" + using G T.positive_integral_eq_simple_integral by simp + also have "\ = positive_integral (\x. f x * (\y\G i`space M. y * indicator (G i -` {y} \ space M) x))" + apply (simp add: T.simple_integral_def) + apply (subst positive_integral_cmult[symmetric]) + using G_borel assms(1) apply (fastsimp intro: borel_measurable_indicator borel_measurable_vimage) + apply (subst positive_integral_setsum[symmetric]) + using G_borel assms(1) apply (fastsimp intro: borel_measurable_indicator borel_measurable_vimage) + by (simp add: setsum_right_distrib field_simps) + also have "\ = positive_integral (\x. f x * G i x)" + by (auto intro!: positive_integral_cong + simp: indicator_def if_distrib setsum_cases) + finally have "T.positive_integral (G i) = positive_integral (\x. f x * G i x)" . } + with * have eq_Tg: "(\i. positive_integral (\x. f x * G i x)) \ T.positive_integral g" by simp + from G(2) have "(\i x. f x * G i x) \ (\x. f x * g x)" + unfolding isoton_fun_expand by (auto intro!: isoton_cmult_right) + then have "(\i. positive_integral (\x. f x * G i x)) \ positive_integral (\x. f x * g x)" + using assms(1) G_borel by (auto intro!: positive_integral_isoton borel_measurable_pinfreal_times) + with eq_Tg show "T.positive_integral g = positive_integral (\x. f x * g x)" + unfolding isoton_def by simp +qed + lemma (in measure_space) positive_integral_null_set: assumes borel: "u \ borel_measurable M" and "N \ null_sets" shows "positive_integral (\x. u x * indicator N x) = 0" (is "?I = 0") @@ -1222,6 +1337,58 @@ finally show ?thesis by simp qed +lemma (in measure_space) positive_integral_restricted: + assumes "A \ sets M" + shows "measure_space.positive_integral (restricted_space A) \ f = positive_integral (\x. f x * indicator A x)" + (is "measure_space.positive_integral ?R \ f = positive_integral ?f") +proof - + have msR: "measure_space ?R \" by (rule restricted_measure_space[OF `A \ sets M`]) + then interpret R: measure_space ?R \ . + have saR: "sigma_algebra ?R" by fact + have *: "R.positive_integral f = R.positive_integral ?f" + by (auto intro!: R.positive_integral_cong) + show ?thesis + unfolding * R.positive_integral_def positive_integral_def + unfolding simple_function_restricted[OF `A \ sets M`] + apply (simp add: SUPR_def) + apply (rule arg_cong[where f=Sup]) + proof (auto simp: image_iff simple_integral_restricted[OF `A \ sets M`]) + fix g assume "simple_function (\x. g x * indicator A x)" + "g \ f" "\x\A. \ \ g x" + then show "\x. simple_function x \ x \ (\x. f x * indicator A x) \ (\y\space M. \ \ x y) \ + simple_integral (\x. g x * indicator A x) = simple_integral x" + apply (rule_tac exI[of _ "\x. g x * indicator A x"]) + by (auto simp: indicator_def le_fun_def) + next + fix g assume g: "simple_function g" "g \ (\x. f x * indicator A x)" + "\x\space M. \ \ g x" + then have *: "(\x. g x * indicator A x) = g" + "\x. g x * indicator A x = g x" + "\x. g x \ f x" + by (auto simp: le_fun_def expand_fun_eq indicator_def split: split_if_asm) + from g show "\x. simple_function (\xa. x xa * indicator A xa) \ x \ f \ (\xa\A. \ \ x xa) \ + simple_integral g = simple_integral (\xa. x xa * indicator A xa)" + using `A \ sets M`[THEN sets_into_space] + apply (rule_tac exI[of _ "\x. g x * indicator A x"]) + by (fastsimp simp: le_fun_def *) + qed +qed + +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 "Lebesgue Integral" definition (in measure_space) integrable where @@ -1629,44 +1796,6 @@ by (simp add: real_of_pinfreal_eq_0) qed -lemma LIMSEQ_max: - "u ----> (x::real) \ (\i. max (u i) 0) ----> max x 0" - by (fastsimp intro!: LIMSEQ_I dest!: LIMSEQ_D) - -lemma (in sigma_algebra) borel_measurable_LIMSEQ: - fixes u :: "nat \ 'a \ real" - assumes u': "\x. x \ space M \ (\i. u i x) ----> u' x" - and u: "\i. u i \ borel_measurable M" - shows "u' \ borel_measurable M" -proof - - let "?pu x i" = "max (u i x) 0" - let "?nu x i" = "max (- u i x) 0" - - { fix x assume x: "x \ space M" - have "(?pu x) ----> max (u' x) 0" - "(?nu x) ----> max (- u' x) 0" - using u'[OF x] by (auto intro!: LIMSEQ_max LIMSEQ_minus) - from LIMSEQ_imp_lim_INF[OF _ this(1)] LIMSEQ_imp_lim_INF[OF _ this(2)] - have "(SUP n. INF m. Real (u (n + m) x)) = Real (u' x)" - "(SUP n. INF m. Real (- u (n + m) x)) = Real (- u' x)" - by (simp_all add: Real_max'[symmetric]) } - note eq = this - - have *: "\x. real (Real (u' x)) - real (Real (- u' x)) = u' x" - by auto - - have "(SUP n. INF m. (\x. Real (u (n + m) x))) \ borel_measurable M" - "(SUP n. INF m. (\x. Real (- u (n + m) x))) \ borel_measurable M" - using u by (auto intro: borel_measurable_SUP borel_measurable_INF borel_measurable_Real) - with eq[THEN measurable_cong, of M "\x. x" borel_space] - have "(\x. Real (u' x)) \ borel_measurable M" - "(\x. Real (- u' x)) \ borel_measurable M" - unfolding SUPR_fun_expand INFI_fun_expand by auto - note this[THEN borel_measurable_real] - from borel_measurable_diff[OF this] - show ?thesis unfolding * . -qed - lemma (in measure_space) integral_dominated_convergence: assumes u: "\i. integrable (u i)" and bound: "\x j. x\space M \ \u j x\ \ w x" and w: "integrable w" "\x. x \ space M \ 0 \ w x" @@ -1926,41 +2055,11 @@ by (simp_all add: integral_cmul_indicator borel_measurable_vimage) qed -lemma sigma_algebra_cong: - fixes M :: "('a, 'b) algebra_scheme" and M' :: "('a, 'c) algebra_scheme" - assumes *: "sigma_algebra M" - and cong: "space M = space M'" "sets M = sets M'" - shows "sigma_algebra M'" -using * unfolding sigma_algebra_def algebra_def sigma_algebra_axioms_def unfolding cong . - -lemma finite_Pow_additivity_sufficient: - assumes "finite (space M)" and "sets M = Pow (space M)" - and "positive \" and "additive M \" - and "\x. x \ space M \ \ {x} \ \" - shows "finite_measure_space M \" -proof - - have "sigma_algebra M" - using assms by (auto intro!: sigma_algebra_cong[OF sigma_algebra_Pow]) - - have "measure_space M \" - by (rule sigma_algebra.finite_additivity_sufficient) (fact+) - thus ?thesis - unfolding finite_measure_space_def finite_measure_space_axioms_def - using assms by simp -qed - -lemma finite_measure_spaceI: - assumes "measure_space M \" and "finite (space M)" and "sets M = Pow (space M)" - and "\x. x \ space M \ \ {x} \ \" - shows "finite_measure_space M \" - unfolding finite_measure_space_def finite_measure_space_axioms_def - using assms by simp +lemma (in finite_measure_space) simple_function_finite[simp, intro]: "simple_function f" + unfolding simple_function_def sets_eq_Pow using finite_space by auto lemma (in finite_measure_space) borel_measurable_finite[intro, simp]: "f \ borel_measurable M" - unfolding measurable_def sets_eq_Pow by auto - -lemma (in finite_measure_space) simple_function_finite: "simple_function f" - unfolding simple_function_def sets_eq_Pow using finite_space by auto + by (auto intro: borel_measurable_simple_function) lemma (in finite_measure_space) positive_integral_finite_eq_setsum: "positive_integral f = (\x \ space M. f x * \ {x})" @@ -1979,10 +2078,8 @@ "positive_integral (\x. Real (f x)) = (\x \ space M. Real (f x) * \ {x})" "positive_integral (\x. Real (- f x)) = (\x \ space M. Real (- f x) * \ {x})" unfolding positive_integral_finite_eq_setsum by auto - show "integrable f" using finite_space finite_measure by (simp add: setsum_\ integrable_def sets_eq_Pow) - show ?I using finite_measure apply (simp add: integral_def sets_eq_Pow real_of_pinfreal_setsum[symmetric] real_of_pinfreal_mult[symmetric] setsum_subtractf[symmetric]) diff -r 11314c196e11 -r 98de40859858 src/HOL/Probability/Measure.thy --- a/src/HOL/Probability/Measure.thy Fri Aug 27 16:23:51 2010 +0200 +++ b/src/HOL/Probability/Measure.thy Thu Sep 02 17:12:40 2010 +0200 @@ -414,6 +414,19 @@ finally show ?thesis . qed +lemma (in measure_space) measure_finitely_subadditive: + assumes "finite I" "A ` I \ sets M" + shows "\ (\i\I. A i) \ (\i\I. \ (A i))" +using assms proof induct + case (insert i I) + then have "(\i\I. A i) \ sets M" by (auto intro: finite_UN) + then have "\ (\i\insert i I. A i) \ \ (A i) + \ (\i\I. A i)" + using insert by (simp add: measure_subadditive) + also have "\ \ (\i\insert i I. \ (A i))" + using insert by (auto intro!: add_left_mono) + finally show ?case . +qed simp + lemma (in measure_space) measurable_countably_subadditive: assumes "range f \ sets M" shows "\ (\i. f i) \ (\\<^isub>\ i. \ (f i))" @@ -432,9 +445,34 @@ finally show ?thesis . qed +lemma (in measure_space) measure_inter_full_set: + assumes "S \ sets M" "T \ sets M" and not_\: "\ (T - S) \ \" + assumes T: "\ T = \ (space M)" + shows "\ (S \ T) = \ S" +proof (rule antisym) + show " \ (S \ T) \ \ S" + using assms by (auto intro!: measure_mono) + + show "\ S \ \ (S \ T)" + proof (rule ccontr) + assume contr: "\ ?thesis" + have "\ (space M) = \ ((T - S) \ (S \ T))" + unfolding T[symmetric] by (auto intro!: arg_cong[where f="\"]) + also have "\ \ \ (T - S) + \ (S \ T)" + using assms by (auto intro!: measure_subadditive) + also have "\ < \ (T - S) + \ S" + by (rule pinfreal_less_add[OF not_\]) (insert contr, auto) + also have "\ = \ (T \ S)" + using assms by (subst measure_additive) auto + also have "\ \ \ (space M)" + using assms sets_into_space by (auto intro!: measure_mono) + finally show False .. + qed +qed + lemma (in measure_space) restricted_measure_space: assumes "S \ sets M" - shows "measure_space (M\ space := S, sets := (\A. S \ A) ` sets M \) \" + shows "measure_space (restricted_space S) \" (is "measure_space ?r \") unfolding measure_space_def measure_space_axioms_def proof safe @@ -477,6 +515,20 @@ qed qed +lemma (in measure_space) measure_space_subalgebra: + assumes "N \ sets M" "sigma_algebra (M\ sets := N \)" + shows "measure_space (M\ sets := N \) \" +proof - + interpret N: sigma_algebra "M\ sets := N \" by fact + show ?thesis + proof + show "countably_additive (M\sets := N\) \" + using `N \ sets M` + by (auto simp add: countably_additive_def + intro!: measure_countably_additive) + qed simp +qed + section "@{text \}-finite Measures" locale sigma_finite_measure = measure_space + @@ -484,7 +536,7 @@ lemma (in sigma_finite_measure) restricted_sigma_finite_measure: assumes "S \ sets M" - shows "sigma_finite_measure (M\ space := S, sets := (\A. S \ A) ` sets M \) \" + shows "sigma_finite_measure (restricted_space S) \" (is "sigma_finite_measure ?r _") unfolding sigma_finite_measure_def sigma_finite_measure_axioms_def proof safe @@ -512,6 +564,25 @@ qed qed +lemma (in sigma_finite_measure) disjoint_sigma_finite: + "\A::nat\'a set. range A \ sets M \ (\i. A i) = space M \ + (\i. \ (A i) \ \) \ disjoint_family A" +proof - + obtain A :: "nat \ 'a set" where + range: "range A \ sets M" and + space: "(\i. A i) = space M" and + measure: "\i. \ (A i) \ \" + using sigma_finite by auto + note range' = range_disjointed_sets[OF range] range + { fix i + have "\ (disjointed A i) \ \ (A i)" + using range' disjointed_subset[of A i] by (auto intro!: measure_mono) + then have "\ (disjointed A i) \ \" + using measure[of i] by auto } + with disjoint_family_disjointed UN_disjointed_eq[of A] space range' + show ?thesis by (auto intro!: exI[of _ "disjointed A"]) +qed + section "Real measure values" lemma (in measure_space) real_measure_Union: @@ -630,7 +701,7 @@ using finite_measure_of_space by (auto intro!: exI[of _ "\x. space M"]) qed -lemma (in finite_measure) finite_measure: +lemma (in finite_measure) finite_measure[simp, intro]: assumes "A \ sets M" shows "\ A \ \" proof - @@ -645,7 +716,7 @@ lemma (in finite_measure) restricted_finite_measure: assumes "S \ sets M" - shows "finite_measure (M\ space := S, sets := (\A. S \ A) ` sets M \) \" + shows "finite_measure (restricted_space S) \" (is "finite_measure ?r _") unfolding finite_measure_def finite_measure_axioms_def proof (safe del: notI) @@ -733,6 +804,13 @@ shows "\ (space M - s) = \ (space M) - \ s" using measure_compl[OF s, OF finite_measure, OF s] . +lemma (in finite_measure) finite_measure_inter_full_set: + assumes "S \ sets M" "T \ sets M" + assumes T: "\ T = \ (space M)" + shows "\ (S \ T) = \ S" + using measure_inter_full_set[OF assms(1,2) finite_measure assms(3)] assms + by auto + section {* Measure preserving *} definition "measure_preserving A \ B \ = @@ -843,10 +921,51 @@ and sets_eq_Pow: "sets M = Pow (space M)" and finite_single_measure: "\x. x \ space M \ \ {x} \ \" +lemma (in finite_measure_space) sets_image_space_eq_Pow: + "sets (image_space X) = Pow (space (image_space X))" +proof safe + fix x S assume "S \ sets (image_space X)" "x \ S" + then show "x \ space (image_space X)" + using sets_into_space by (auto intro!: imageI simp: image_space_def) +next + fix S assume "S \ space (image_space X)" + then obtain S' where "S = X`S'" "S'\sets M" + by (auto simp: subset_image_iff sets_eq_Pow image_space_def) + then show "S \ sets (image_space X)" + by (auto simp: image_space_def) +qed + lemma (in finite_measure_space) sum_over_space: "(\x\space M. \ {x}) = \ (space M)" using measure_finitely_additive''[of "space M" "\i. {i}"] by (simp add: sets_eq_Pow disjoint_family_on_def finite_space) +lemma finite_measure_spaceI: + assumes "finite (space M)" "sets M = Pow(space M)" and space: "\ (space M) \ \" + and add: "\A B. A\space M \ B\space M \ A \ B = {} \ \ (A \ B) = \ A + \ B" + and "\ {} = 0" + shows "finite_measure_space M \" + unfolding finite_measure_space_def finite_measure_space_axioms_def +proof (safe del: notI) + show "measure_space M \" + proof (rule sigma_algebra.finite_additivity_sufficient) + show "sigma_algebra M" + apply (rule sigma_algebra_cong) + apply (rule sigma_algebra_Pow[of "space M"]) + using assms by simp_all + show "finite (space M)" by fact + show "positive \" unfolding positive_def by fact + show "additive M \" unfolding additive_def using assms by simp + qed + show "finite (space M)" by fact + { fix A x assume "A \ sets M" "x \ A" then show "x \ space M" + using assms by auto } + { fix A assume "A \ space M" then show "A \ sets M" + using assms by auto } + { fix x assume *: "x \ space M" + with add[of "{x}" "space M - {x}"] space + show "\ {x} \ \" by (auto simp: insert_absorb[OF *] Diff_subset) } +qed + sublocale finite_measure_space < finite_measure proof show "\ (space M) \ \" @@ -854,6 +973,22 @@ using finite_space finite_single_measure by auto qed +lemma finite_measure_space_iff: + "finite_measure_space M \ \ + finite (space M) \ sets M = Pow(space M) \ \ (space M) \ \ \ \ {} = 0 \ + (\A\space M. \B\space M. A \ B = {} \ \ (A \ B) = \ A + \ B)" + (is "_ = ?rhs") +proof (intro iffI) + assume "finite_measure_space M \" + then interpret finite_measure_space M \ . + show ?rhs + using finite_space sets_eq_Pow measure_additive empty_measure finite_measure + by auto +next + assume ?rhs then show "finite_measure_space M \" + by (auto intro!: finite_measure_spaceI) +qed + lemma psuminf_cmult_indicator: assumes "disjoint_family A" "x \ A i" shows "(\\<^isub>\ n. f n * indicator (A n) x) = f i" diff -r 11314c196e11 -r 98de40859858 src/HOL/Probability/Positive_Infinite_Real.thy --- a/src/HOL/Probability/Positive_Infinite_Real.thy Fri Aug 27 16:23:51 2010 +0200 +++ b/src/HOL/Probability/Positive_Infinite_Real.thy Thu Sep 02 17:12:40 2010 +0200 @@ -411,6 +411,10 @@ lemma pinfreal_less_\: "x < \ \ x \ \" by (cases x) auto +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) + subsection {* @{text "x - y"} on @{typ pinfreal} *} instantiation pinfreal :: minus diff -r 11314c196e11 -r 98de40859858 src/HOL/Probability/Probability_Space.thy --- a/src/HOL/Probability/Probability_Space.thy Fri Aug 27 16:23:51 2010 +0200 +++ b/src/HOL/Probability/Probability_Space.thy Thu Sep 02 17:12:40 2010 +0200 @@ -2,38 +2,6 @@ imports Lebesgue_Integration Radon_Nikodym begin -lemma (in measure_space) measure_inter_full_set: - assumes "S \ sets M" "T \ sets M" and not_\: "\ (T - S) \ \" - assumes T: "\ T = \ (space M)" - shows "\ (S \ T) = \ S" -proof (rule antisym) - show " \ (S \ T) \ \ S" - using assms by (auto intro!: measure_mono) - - show "\ S \ \ (S \ T)" - proof (rule ccontr) - assume contr: "\ ?thesis" - have "\ (space M) = \ ((T - S) \ (S \ T))" - unfolding T[symmetric] by (auto intro!: arg_cong[where f="\"]) - also have "\ \ \ (T - S) + \ (S \ T)" - using assms by (auto intro!: measure_subadditive) - also have "\ < \ (T - S) + \ S" - by (rule pinfreal_less_add[OF not_\]) (insert contr, auto) - also have "\ = \ (T \ S)" - using assms by (subst measure_additive) auto - also have "\ \ \ (space M)" - using assms sets_into_space by (auto intro!: measure_mono) - finally show False .. - qed -qed - -lemma (in finite_measure) finite_measure_inter_full_set: - assumes "S \ sets M" "T \ sets M" - assumes T: "\ T = \ (space M)" - shows "\ (S \ T) = \ S" - using measure_inter_full_set[OF assms(1,2) finite_measure assms(3)] assms - by auto - locale prob_space = measure_space + assumes measure_space_1: "\ (space M) = 1" @@ -75,10 +43,6 @@ finally show ?thesis . qed -lemma measure_finite[simp, intro]: - assumes "A \ events" shows "\ A \ \" - using measure_le_1[OF assms] by auto - lemma prob_compl: assumes "A \ events" shows "prob (space M - A) = 1 - prob A" @@ -361,51 +325,64 @@ joint_distribution_restriction_snd[of X Y "{(x, y)}"] by auto -lemma (in finite_prob_space) finite_product_measure_space: - assumes "finite s1" "finite s2" - shows "finite_measure_space \ space = s1 \ s2, sets = Pow (s1 \ s2)\ (joint_distribution X Y)" - (is "finite_measure_space ?M ?D") -proof (rule finite_Pow_additivity_sufficient) - show "positive ?D" - unfolding positive_def using assms sets_eq_Pow - by (simp add: distribution_def) +lemma (in finite_prob_space) finite_prob_space_of_images: + "finite_prob_space \ space = X ` space M, sets = Pow (X ` space M)\ (distribution X)" + by (simp add: finite_prob_space_eq finite_measure_space) - show "additive ?M ?D" unfolding additive_def - proof safe - fix x y - have A: "((\x. (X x, Y x)) -` x) \ space M \ sets M" using assms sets_eq_Pow by auto - have B: "((\x. (X x, Y x)) -` y) \ space M \ sets M" using assms sets_eq_Pow by auto - assume "x \ y = {}" - hence "(\x. (X x, Y x)) -` x \ space M \ ((\x. (X x, Y x)) -` y \ space M) = {}" - by auto - from additive[unfolded additive_def, rule_format, OF A B] this - finite_measure[OF A] finite_measure[OF B] - show "?D (x \ y) = ?D x + ?D y" - apply (simp add: distribution_def) - apply (subst Int_Un_distrib2) - by (auto simp: real_of_pinfreal_add) - qed +lemma (in finite_prob_space) finite_product_prob_space_of_images: + "finite_prob_space \ space = X ` space M \ Y ` space M, sets = Pow (X ` space M \ Y ` space M)\ + (joint_distribution X Y)" + (is "finite_prob_space ?S _") +proof (simp add: finite_prob_space_eq finite_product_measure_space_of_images) + have "X -` X ` space M \ Y -` Y ` space M \ space M = space M" by auto + thus "joint_distribution X Y (X ` space M \ Y ` space M) = 1" + by (simp add: distribution_def prob_space vimage_Times comp_def measure_space_1) +qed - show "finite (space ?M)" - using assms by auto - - show "sets ?M = Pow (space ?M)" - by simp - - { fix x assume "x \ space ?M" thus "?D {x} \ \" - unfolding distribution_def by (auto intro!: finite_measure simp: sets_eq_Pow) } +lemma (in prob_space) prob_space_subalgebra: + assumes "N \ sets M" "sigma_algebra (M\ sets := N \)" + shows "prob_space (M\ sets := N \) \" +proof - + interpret N: measure_space "M\ sets := N \" \ + using measure_space_subalgebra[OF assms] . + show ?thesis + proof qed (simp add: measure_space_1) qed -lemma (in finite_prob_space) finite_product_measure_space_of_images: - shows "finite_measure_space \ space = X ` space M \ Y ` space M, - sets = Pow (X ` space M \ Y ` space M) \ - (joint_distribution X Y)" - using finite_space by (auto intro!: finite_product_measure_space) +lemma (in prob_space) prob_space_of_restricted_space: + assumes "\ A \ 0" "\ A \ \" "A \ sets M" + shows "prob_space (restricted_space A) (\S. \ S / \ A)" + unfolding prob_space_def prob_space_axioms_def +proof + show "\ (space (restricted_space A)) / \ A = 1" + using `\ A \ 0` `\ A \ \` by (auto simp: pinfreal_noteq_omega_Ex) + have *: "\S. \ S / \ A = inverse (\ A) * \ S" by (simp add: mult_commute) + interpret A: measure_space "restricted_space A" \ + using `A \ sets M` by (rule restricted_measure_space) + show "measure_space (restricted_space A) (\S. \ S / \ A)" + proof + show "\ {} / \ A = 0" by auto + show "countably_additive (restricted_space A) (\S. \ S / \ A)" + unfolding countably_additive_def psuminf_cmult_right * + using A.measure_countably_additive by auto + qed +qed + +lemma finite_prob_spaceI: + assumes "finite (space M)" "sets M = Pow(space M)" "\ (space M) = 1" "\ {} = 0" + and "\A B. A\space M \ B\space M \ A \ B = {} \ \ (A \ B) = \ A + \ B" + shows "finite_prob_space M \" + unfolding finite_prob_space_eq +proof + show "finite_measure_space M \" using assms + by (auto intro!: finite_measure_spaceI) + show "\ (space M) = 1" by fact +qed lemma (in finite_prob_space) finite_measure_space: shows "finite_measure_space \space = X ` space M, sets = Pow (X ` space M)\ (distribution X)" (is "finite_measure_space ?S _") -proof (rule finite_Pow_additivity_sufficient, simp_all) +proof (rule finite_measure_spaceI, simp_all) show "finite (X ` space M)" using finite_space by simp show "positive (distribution X)" @@ -431,69 +408,6 @@ unfolding distribution_def by (auto intro!: finite_measure simp: sets_eq_Pow) } qed -lemma (in finite_prob_space) finite_prob_space_of_images: - "finite_prob_space \ space = X ` space M, sets = Pow (X ` space M)\ (distribution X)" - by (simp add: finite_prob_space_eq finite_measure_space) - -lemma (in finite_prob_space) finite_product_prob_space_of_images: - "finite_prob_space \ space = X ` space M \ Y ` space M, sets = Pow (X ` space M \ Y ` space M)\ - (joint_distribution X Y)" - (is "finite_prob_space ?S _") -proof (simp add: finite_prob_space_eq finite_product_measure_space_of_images) - have "X -` X ` space M \ Y -` Y ` space M \ space M = space M" by auto - thus "joint_distribution X Y (X ` space M \ Y ` space M) = 1" - 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: @@ -541,7 +455,7 @@ \ (\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)" + "conditional_prob N A \ conditional_expectation N (indicator A)" lemma (in prob_space) fixes X :: "'a \ pinfreal" diff -r 11314c196e11 -r 98de40859858 src/HOL/Probability/Product_Measure.thy --- a/src/HOL/Probability/Product_Measure.thy Fri Aug 27 16:23:51 2010 +0200 +++ b/src/HOL/Probability/Product_Measure.thy Thu Sep 02 17:12:40 2010 +0200 @@ -403,4 +403,45 @@ unfolding finite_prod_measure_space[OF N, symmetric] using finite_measure_space_finite_prod_measure[OF N] . +lemma (in finite_prob_space) finite_product_measure_space: + assumes "finite s1" "finite s2" + shows "finite_measure_space \ space = s1 \ s2, sets = Pow (s1 \ s2)\ (joint_distribution X Y)" + (is "finite_measure_space ?M ?D") +proof (rule finite_Pow_additivity_sufficient) + show "positive ?D" + unfolding positive_def using assms sets_eq_Pow + by (simp add: distribution_def) + + show "additive ?M ?D" unfolding additive_def + proof safe + fix x y + have A: "((\x. (X x, Y x)) -` x) \ space M \ sets M" using assms sets_eq_Pow by auto + have B: "((\x. (X x, Y x)) -` y) \ space M \ sets M" using assms sets_eq_Pow by auto + assume "x \ y = {}" + hence "(\x. (X x, Y x)) -` x \ space M \ ((\x. (X x, Y x)) -` y \ space M) = {}" + by auto + from additive[unfolded additive_def, rule_format, OF A B] this + finite_measure[OF A] finite_measure[OF B] + show "?D (x \ y) = ?D x + ?D y" + apply (simp add: distribution_def) + apply (subst Int_Un_distrib2) + by (auto simp: real_of_pinfreal_add) + qed + + show "finite (space ?M)" + using assms by auto + + show "sets ?M = Pow (space ?M)" + by simp + + { fix x assume "x \ space ?M" thus "?D {x} \ \" + unfolding distribution_def by (auto intro!: finite_measure simp: sets_eq_Pow) } +qed + +lemma (in finite_measure_space) finite_product_measure_space_of_images: + shows "finite_measure_space \ space = X ` space M \ Y ` space M, + sets = Pow (X ` space M \ Y ` space M) \ + (joint_distribution X Y)" + using finite_space by (auto intro!: finite_product_measure_space) + end \ No newline at end of file diff -r 11314c196e11 -r 98de40859858 src/HOL/Probability/Radon_Nikodym.thy --- a/src/HOL/Probability/Radon_Nikodym.thy Fri Aug 27 16:23:51 2010 +0200 +++ b/src/HOL/Probability/Radon_Nikodym.thy Thu Sep 02 17:12:40 2010 +0200 @@ -2,201 +2,6 @@ imports Lebesgue_Integration begin -lemma (in measure_space) measure_finitely_subadditive: - assumes "finite I" "A ` I \ sets M" - shows "\ (\i\I. A i) \ (\i\I. \ (A i))" -using assms proof induct - case (insert i I) - then have "(\i\I. A i) \ sets M" by (auto intro: finite_UN) - then have "\ (\i\insert i I. A i) \ \ (A i) + \ (\i\I. A i)" - using insert by (simp add: measure_subadditive) - also have "\ \ (\i\insert i I. \ (A i))" - using insert by (auto intro!: add_left_mono) - finally show ?case . -qed simp - -lemma (in sigma_algebra) borel_measurable_restricted: - fixes f :: "'a \ pinfreal" assumes "A \ sets M" - shows "f \ borel_measurable (M\ space := A, sets := op \ A ` sets M \) \ - (\x. f x * indicator A x) \ borel_measurable M" - (is "f \ borel_measurable ?R \ ?f \ borel_measurable M") -proof - - interpret R: sigma_algebra ?R by (rule restricted_sigma_algebra[OF `A \ sets M`]) - have *: "f \ borel_measurable ?R \ ?f \ borel_measurable ?R" - by (auto intro!: measurable_cong) - show ?thesis unfolding * - unfolding in_borel_measurable_borel_space - proof (simp, safe) - fix S :: "pinfreal set" assume "S \ sets borel_space" - "\S\sets borel_space. ?f -` S \ A \ op \ A ` sets M" - then have "?f -` S \ A \ op \ A ` sets M" by auto - then have f: "?f -` S \ A \ sets M" - using `A \ sets M` sets_into_space by fastsimp - show "?f -` S \ space M \ sets M" - proof cases - assume "0 \ S" - then have "?f -` S \ space M = ?f -` S \ A \ (space M - A)" - using `A \ sets M` sets_into_space by auto - then show ?thesis using f `A \ sets M` by (auto intro!: Un Diff) - next - assume "0 \ S" - then have "?f -` S \ space M = ?f -` S \ A" - using `A \ sets M` sets_into_space - by (auto simp: indicator_def split: split_if_asm) - then show ?thesis using f by auto - qed - next - fix S :: "pinfreal set" assume "S \ sets borel_space" - "\S\sets borel_space. ?f -` S \ space M \ sets M" - then have f: "?f -` S \ space M \ sets M" by auto - then show "?f -` S \ A \ op \ A ` sets M" - using `A \ sets M` sets_into_space - apply (simp add: image_iff) - apply (rule bexI[OF _ f]) - by auto - qed -qed - -lemma (in sigma_algebra) simple_function_eq_borel_measurable: - fixes f :: "'a \ pinfreal" - shows "simple_function f \ - finite (f`space M) \ f \ borel_measurable M" - using simple_function_borel_measurable[of f] - borel_measurable_simple_function[of f] - by (fastsimp simp: simple_function_def) - -lemma (in measure_space) simple_function_restricted: - fixes f :: "'a \ pinfreal" assumes "A \ sets M" - shows "sigma_algebra.simple_function (M\ space := A, sets := op \ A ` sets M \) f \ simple_function (\x. f x * indicator A x)" - (is "sigma_algebra.simple_function ?R f \ simple_function ?f") -proof - - interpret R: sigma_algebra ?R by (rule restricted_sigma_algebra[OF `A \ sets M`]) - have "finite (f`A) \ finite (?f`space M)" - proof cases - assume "A = space M" - then have "f`A = ?f`space M" by (fastsimp simp: image_iff) - then show ?thesis by simp - next - assume "A \ space M" - then obtain x where x: "x \ space M" "x \ A" - using sets_into_space `A \ sets M` by auto - have *: "?f`space M = f`A \ {0}" - proof (auto simp add: image_iff) - show "\x\space M. f x = 0 \ indicator A x = 0" - using x by (auto intro!: bexI[of _ x]) - next - fix x assume "x \ A" - then show "\y\space M. f x = f y * indicator A y" - using `A \ sets M` sets_into_space by (auto intro!: bexI[of _ x]) - next - fix x - assume "indicator A x \ (0::pinfreal)" - then have "x \ A" by (auto simp: indicator_def split: split_if_asm) - moreover assume "x \ space M" "\y\A. ?f x \ f y" - ultimately show "f x = 0" by auto - qed - then show ?thesis by auto - qed - then show ?thesis - unfolding simple_function_eq_borel_measurable - R.simple_function_eq_borel_measurable - unfolding borel_measurable_restricted[OF `A \ sets M`] - by auto -qed - -lemma (in measure_space) simple_integral_restricted: - assumes "A \ sets M" - assumes sf: "simple_function (\x. f x * indicator A x)" - shows "measure_space.simple_integral (M\ space := A, sets := op \ A ` sets M \) \ f = simple_integral (\x. f x * indicator A x)" - (is "_ = simple_integral ?f") - unfolding measure_space.simple_integral_def[OF restricted_measure_space[OF `A \ sets M`]] - unfolding simple_integral_def -proof (simp, safe intro!: setsum_mono_zero_cong_left) - from sf show "finite (?f ` space M)" - unfolding simple_function_def by auto -next - fix x assume "x \ A" - then show "f x \ ?f ` space M" - using sets_into_space `A \ sets M` by (auto intro!: image_eqI[of _ _ x]) -next - fix x assume "x \ space M" "?f x \ f`A" - then have "x \ A" by (auto simp: image_iff) - then show "?f x * \ (?f -` {?f x} \ space M) = 0" by simp -next - fix x assume "x \ A" - then have "f x \ 0 \ - f -` {f x} \ A = ?f -` {f x} \ space M" - using `A \ sets M` sets_into_space - by (auto simp: indicator_def split: split_if_asm) - then show "f x * \ (f -` {f x} \ A) = - f x * \ (?f -` {f x} \ space M)" - unfolding pinfreal_mult_cancel_left by auto -qed - -lemma (in measure_space) positive_integral_restricted: - assumes "A \ sets M" - shows "measure_space.positive_integral (M\ space := A, sets := op \ A ` sets M \) \ f = positive_integral (\x. f x * indicator A x)" - (is "measure_space.positive_integral ?R \ f = positive_integral ?f") -proof - - have msR: "measure_space ?R \" by (rule restricted_measure_space[OF `A \ sets M`]) - then interpret R: measure_space ?R \ . - have saR: "sigma_algebra ?R" by fact - have *: "R.positive_integral f = R.positive_integral ?f" - by (auto intro!: R.positive_integral_cong) - show ?thesis - unfolding * R.positive_integral_def positive_integral_def - unfolding simple_function_restricted[OF `A \ sets M`] - apply (simp add: SUPR_def) - apply (rule arg_cong[where f=Sup]) - proof (auto simp: image_iff simple_integral_restricted[OF `A \ sets M`]) - fix g assume "simple_function (\x. g x * indicator A x)" - "g \ f" "\x\A. \ \ g x" - then show "\x. simple_function x \ x \ (\x. f x * indicator A x) \ (\y\space M. \ \ x y) \ - simple_integral (\x. g x * indicator A x) = simple_integral x" - apply (rule_tac exI[of _ "\x. g x * indicator A x"]) - by (auto simp: indicator_def le_fun_def) - next - fix g assume g: "simple_function g" "g \ (\x. f x * indicator A x)" - "\x\space M. \ \ g x" - then have *: "(\x. g x * indicator A x) = g" - "\x. g x * indicator A x = g x" - "\x. g x \ f x" - by (auto simp: le_fun_def expand_fun_eq indicator_def split: split_if_asm) - from g show "\x. simple_function (\xa. x xa * indicator A xa) \ x \ f \ (\xa\A. \ \ x xa) \ - simple_integral g = simple_integral (\xa. x xa * indicator A xa)" - using `A \ sets M`[THEN sets_into_space] - apply (rule_tac exI[of _ "\x. g x * indicator A x"]) - by (fastsimp simp: le_fun_def *) - qed -qed - -lemma (in sigma_algebra) borel_measurable_psuminf: - assumes "\i. f i \ borel_measurable M" - shows "(\x. (\\<^isub>\ i. f i x)) \ borel_measurable M" - using assms unfolding psuminf_def - by (auto intro!: borel_measurable_SUP[unfolded SUPR_fun_expand]) - -lemma (in sigma_finite_measure) disjoint_sigma_finite: - "\A::nat\'a set. range A \ sets M \ (\i. A i) = space M \ - (\i. \ (A i) \ \) \ disjoint_family A" -proof - - obtain A :: "nat \ 'a set" where - range: "range A \ sets M" and - space: "(\i. A i) = space M" and - measure: "\i. \ (A i) \ \" - using sigma_finite by auto - - note range' = range_disjointed_sets[OF range] range - - { fix i - have "\ (disjointed A i) \ \ (A i)" - using range' disjointed_subset[of A i] by (auto intro!: measure_mono) - then have "\ (disjointed A i) \ \" - using measure[of i] by auto } - with disjoint_family_disjointed UN_disjointed_eq[of A] space range' - show ?thesis by (auto intro!: exI[of _ "disjointed A"]) -qed - lemma (in sigma_finite_measure) Ex_finite_integrable_function: shows "\h\borel_measurable M. positive_integral h \ \ \ (\x\space M. 0 < h x \ h x < \)" proof - @@ -206,7 +11,6 @@ measure: "\i. \ (A i) \ \" and disjoint: "disjoint_family A" using disjoint_sigma_finite by auto - let "?B i" = "2^Suc i * \ (A i)" have "\i. \x. 0 < x \ x < inverse (?B i)" proof @@ -225,20 +29,22 @@ qed from choice[OF this] obtain n where n: "\i. 0 < n i" "\i. n i < inverse (2^Suc i * \ (A i))" by auto - let "?h x" = "\\<^isub>\ i. n i * indicator (A i) x" show ?thesis proof (safe intro!: bexI[of _ ?h] del: notI) - have "positive_integral ?h = (\\<^isub>\ i. n i * \ (A i))" - apply (subst positive_integral_psuminf) - using range apply (fastsimp intro!: borel_measurable_pinfreal_times borel_measurable_const borel_measurable_indicator) - apply (subst positive_integral_cmult_indicator) - using range by auto + have "\i. A i \ sets M" + using range by fastsimp+ + then have "positive_integral ?h = (\\<^isub>\ i. n i * \ (A i))" + by (simp add: positive_integral_psuminf positive_integral_cmult_indicator) also have "\ \ (\\<^isub>\ i. Real ((1 / 2)^Suc i))" proof (rule psuminf_le) fix N show "n N * \ (A N) \ Real ((1 / 2) ^ Suc N)" using measure[of N] n[of N] - by (cases "n N") (auto simp: pinfreal_noteq_omega_Ex field_simps zero_le_mult_iff mult_le_0_iff mult_less_0_iff power_less_zero_eq power_le_zero_eq inverse_eq_divide less_divide_eq power_divide split: split_if_asm) + by (cases "n N") + (auto simp: pinfreal_noteq_omega_Ex field_simps zero_le_mult_iff + mult_le_0_iff mult_less_0_iff power_less_zero_eq + power_le_zero_eq inverse_eq_divide less_divide_eq + power_divide split: split_if_asm) qed also have "\ = Real 1" by (rule suminf_imp_psuminf, rule power_half_series, auto) @@ -251,7 +57,7 @@ then show "0 < ?h x" and "?h x < \" using n[of i] by auto next show "?h \ borel_measurable M" using range - by (auto intro!: borel_measurable_psuminf borel_measurable_pinfreal_times borel_measurable_indicator) + by (auto intro!: borel_measurable_psuminf borel_measurable_pinfreal_times) qed qed @@ -370,7 +176,7 @@ interpret M': finite_measure M s by fact - let "?r S" = "M\ space := S, sets := (\C. S \ C)`sets M\" + let "?r S" = "restricted_space S" { fix S n assume S: "S \ sets M" @@ -838,7 +644,7 @@ = (f x * indicator (Q i) x) * indicator A x" unfolding indicator_def by auto - have fm: "finite_measure (M\space := Q i, sets := op \ (Q i) ` sets M\) \" + have fm: "finite_measure (restricted_space (Q i)) \" (is "finite_measure ?R \") by (rule restricted_finite_measure[OF Q_sets[of i]]) then interpret R: finite_measure ?R . have fmv: "finite_measure ?R \" @@ -935,47 +741,6 @@ qed qed -lemma (in measure_space) positive_integral_translated_density: - assumes "f \ borel_measurable M" "g \ borel_measurable M" - shows "measure_space.positive_integral M (\A. positive_integral (\x. f x * indicator A x)) g = - positive_integral (\x. f x * g x)" (is "measure_space.positive_integral M ?T _ = _") -proof - - from measure_space_density[OF assms(1)] - interpret T: measure_space M ?T . - - from borel_measurable_implies_simple_function_sequence[OF assms(2)] - obtain G where G: "\i. simple_function (G i)" "G \ g" by blast - note G_borel = borel_measurable_simple_function[OF this(1)] - - from T.positive_integral_isoton[OF `G \ g` G_borel] - have *: "(\i. T.positive_integral (G i)) \ T.positive_integral g" . - - { fix i - have [simp]: "finite (G i ` space M)" - using G(1) unfolding simple_function_def by auto - have "T.positive_integral (G i) = T.simple_integral (G i)" - using G T.positive_integral_eq_simple_integral by simp - also have "\ = positive_integral (\x. f x * (\y\G i`space M. y * indicator (G i -` {y} \ space M) x))" - apply (simp add: T.simple_integral_def) - apply (subst positive_integral_cmult[symmetric]) - using G_borel assms(1) apply (fastsimp intro: borel_measurable_indicator borel_measurable_vimage) - apply (subst positive_integral_setsum[symmetric]) - using G_borel assms(1) apply (fastsimp intro: borel_measurable_indicator borel_measurable_vimage) - by (simp add: setsum_right_distrib field_simps) - also have "\ = positive_integral (\x. f x * G i x)" - by (auto intro!: positive_integral_cong - simp: indicator_def if_distrib setsum_cases) - finally have "T.positive_integral (G i) = positive_integral (\x. f x * G i x)" . } - with * have eq_Tg: "(\i. positive_integral (\x. f x * G i x)) \ T.positive_integral g" by simp - - from G(2) have "(\i x. f x * G i x) \ (\x. f x * g x)" - unfolding isoton_fun_expand by (auto intro!: isoton_cmult_right) - then have "(\i. positive_integral (\x. f x * G i x)) \ positive_integral (\x. f x * g x)" - using assms(1) G_borel by (auto intro!: positive_integral_isoton borel_measurable_pinfreal_times) - with eq_Tg show "T.positive_integral g = positive_integral (\x. f x * g x)" - unfolding isoton_def by simp -qed - lemma (in sigma_finite_measure) Radon_Nikodym: assumes "measure_space M \" assumes "absolutely_continuous \" diff -r 11314c196e11 -r 98de40859858 src/HOL/Probability/Sigma_Algebra.thy --- a/src/HOL/Probability/Sigma_Algebra.thy Fri Aug 27 16:23:51 2010 +0200 +++ b/src/HOL/Probability/Sigma_Algebra.thy Thu Sep 02 17:12:40 2010 +0200 @@ -6,7 +6,7 @@ header {* Sigma Algebras *} -theory Sigma_Algebra imports Main Countable FuncSet begin +theory Sigma_Algebra imports Main Countable FuncSet Indicator_Function begin text {* Sigma algebras are an elementary concept in measure theory. To measure --- that is to integrate --- functions, we first have @@ -95,10 +95,13 @@ lemma (in algebra) Int_space_eq2 [simp]: "x \ sets M \ x \ space M = x" by (metis Int_absorb2 sets_into_space) +section {* Restricted algebras *} + +abbreviation (in algebra) + "restricted_space A \ \ space = A, sets = (\S. (A \ S)) ` sets M \" + lemma (in algebra) restricted_algebra: - assumes "S \ sets M" - shows "algebra (M\ space := S, sets := (\A. S \ A) ` sets M \)" - (is "algebra ?r") + assumes "A \ sets M" shows "algebra (restricted_space A)" using assms by unfold_locales auto subsection {* Sigma Algebras *} @@ -107,6 +110,13 @@ assumes countable_nat_UN [intro]: "!!A. range A \ sets M \ (\i::nat. A i) \ sets M" +lemma sigma_algebra_cong: + fixes M :: "('a, 'b) algebra_scheme" and M' :: "('a, 'c) algebra_scheme" + assumes *: "sigma_algebra M" + and cong: "space M = space M'" "sets M = sets M'" + shows "sigma_algebra M'" +using * unfolding sigma_algebra_def algebra_def sigma_algebra_axioms_def unfolding cong . + lemma countable_UN_eq: fixes A :: "'i::countable \ 'a set" shows "(range A \ sets M \ (\i. A i) \ sets M) \ @@ -320,15 +330,14 @@ lemma (in sigma_algebra) restricted_sigma_algebra: assumes "S \ sets M" - shows "sigma_algebra (M\ space := S, sets := (\A. S \ A) ` sets M \)" - (is "sigma_algebra ?r") + shows "sigma_algebra (restricted_space S)" unfolding sigma_algebra_def sigma_algebra_axioms_def proof safe - show "algebra ?r" using restricted_algebra[OF assms] . + show "algebra (restricted_space S)" using restricted_algebra[OF assms] . next - fix A :: "nat \ 'a set" assume "range A \ sets ?r" + fix A :: "nat \ 'a set" assume "range A \ sets (restricted_space S)" from restriction_in_sets[OF assms this[simplified]] - show "(\i. A i) \ sets ?r" by simp + show "(\i. A i) \ sets (restricted_space S)" by simp qed section {* Measurable functions *} @@ -560,6 +569,19 @@ (metis insert_absorb insert_subset le_SucE le_antisym not_leE) qed +lemma setsum_indicator_disjoint_family: + fixes f :: "'d \ 'e::semiring_1" + assumes d: "disjoint_family_on A P" and "x \ A j" and "finite P" and "j \ P" + shows "(\i\P. f i * indicator (A i) x) = f j" +proof - + have "P \ {i. x \ A i} = {j}" + using d `x \ A j` `j \ P` unfolding disjoint_family_on_def + by auto + thus ?thesis + unfolding indicator_def + by (simp add: if_distrib setsum_cases[OF `finite P`]) +qed + definition disjointed :: "(nat \ 'a set) \ nat \ 'a set " where "disjointed A n = A n - (\i\{0.. measurable (vimage_algebra S f) M" unfolding measurable_def using assms by force +section {* Conditional space *} + +definition (in algebra) + "image_space X = \ space = X`space M, sets = (\S. X`S) ` sets M \" + +definition (in algebra) + "conditional_space X A = algebra.image_space (restricted_space A) X" + +lemma (in algebra) space_conditional_space: + assumes "A \ sets M" shows "space (conditional_space X A) = X`A" +proof - + interpret r: algebra "restricted_space A" using assms by (rule restricted_algebra) + show ?thesis unfolding conditional_space_def r.image_space_def + by simp +qed + subsection {* A Two-Element Series *} definition binaryset :: "'a set \ 'a set \ nat \ 'a set "