# HG changeset patch # User paulson # Date 1523797020 -3600 # Node ID 7643b005b29abc26fac98dbfc741804fdf18e95f # Parent 349c639e593cd24d1d3b3c17c8808a1fc18708b4 various new results on measures, integrals, etc., and some simplified proofs diff -r 349c639e593c -r 7643b005b29a src/HOL/Analysis/Ball_Volume.thy --- a/src/HOL/Analysis/Ball_Volume.thy Sat Apr 14 20:19:52 2018 +0100 +++ b/src/HOL/Analysis/Ball_Volume.thy Sun Apr 15 13:57:00 2018 +0100 @@ -1,10 +1,10 @@ (* File: HOL/Analysis/Gamma_Function.thy Author: Manuel Eberl, TU München +*) - The volume (Lebesgue measure) of an n-dimensional ball. -*) -section \The volume of an $n$-ball\ +section \The volume (Lebesgue measure) of an $n$-dimensional ball\ + theory Ball_Volume imports Gamma_Function Lebesgue_Integral_Substitution begin @@ -301,4 +301,30 @@ corollary sphere_volume: "r \ 0 \ content (ball c r :: (real ^ 3) set) = 4 / 3 * r ^ 3 * pi" by (simp add: content_ball unit_ball_vol_3) +text \ + Useful equivalent forms +\ +corollary content_ball_eq_0_iff [simp]: "content (ball c r) = 0 \ r \ 0" +proof - + have "r > 0 \ content (ball c r) > 0" + by (simp add: content_ball unit_ball_vol_def) + then show ?thesis + by (fastforce simp: ball_empty) +qed + +corollary content_ball_gt_0_iff [simp]: "0 < content (ball z r) \ 0 < r" + by (auto simp: zero_less_measure_iff) + +corollary content_cball_eq_0_iff [simp]: "content (cball c r) = 0 \ r \ 0" +proof (cases "r = 0") + case False + moreover have "r > 0 \ content (cball c r) > 0" + by (simp add: content_cball unit_ball_vol_def) + ultimately show ?thesis + by fastforce +qed auto + +corollary content_cball_gt_0_iff [simp]: "0 < content (cball z r) \ 0 < r" + by (auto simp: zero_less_measure_iff) + end diff -r 349c639e593c -r 7643b005b29a src/HOL/Analysis/Cartesian_Euclidean_Space.thy --- a/src/HOL/Analysis/Cartesian_Euclidean_Space.thy Sat Apr 14 20:19:52 2018 +0100 +++ b/src/HOL/Analysis/Cartesian_Euclidean_Space.thy Sun Apr 15 13:57:00 2018 +0100 @@ -4,6 +4,16 @@ imports Finite_Cartesian_Product Derivative begin +lemma norm_le_componentwise: + "(\b. b \ Basis \ abs(x \ b) \ abs(y \ b)) \ norm x \ norm y" + by (auto simp: norm_le euclidean_inner [of x x] euclidean_inner [of y y] abs_le_square_iff power2_eq_square intro!: sum_mono) + +lemma norm_le_componentwise_cart: + fixes x :: "real^'n" + shows "(\i. abs(x$i) \ abs(y$i)) \ norm x \ norm y" + unfolding cart_eq_inner_axis + by (rule norm_le_componentwise) (metis axis_index) + lemma subspace_special_hyperplane: "subspace {x. x $ k = 0}" by (simp add: subspace_def) @@ -759,7 +769,7 @@ have "norm (\ j. A $ j $ i) \ norm (A *v axis i 1)" by (simp add: matrix_mult_dot cart_eq_inner_axis) also have "\ \ onorm (( *v) A)" - using onorm [OF bl, of "axis i 1"] by (auto simp: axis_in_Basis) + using onorm [OF bl, of "axis i 1"] by auto finally have "norm (\ j. A $ j $ i) \ onorm (( *v) A)" . then show ?thesis unfolding column_def . diff -r 349c639e593c -r 7643b005b29a src/HOL/Analysis/Complete_Measure.thy --- a/src/HOL/Analysis/Complete_Measure.thy Sat Apr 14 20:19:52 2018 +0100 +++ b/src/HOL/Analysis/Complete_Measure.thy Sun Apr 15 13:57:00 2018 +0100 @@ -114,6 +114,11 @@ qed auto qed +lemma sets_restrict_space_subset: + assumes S: "S \ sets (completion M)" + shows "sets (restrict_space (completion M) S) \ sets (completion M)" + by (metis assms sets.Int_space_eq2 sets_restrict_space_iff subsetI) + lemma assumes "S \ sets (completion M)" shows main_part_sets[intro, simp]: "main_part M S \ sets M" @@ -989,6 +994,23 @@ finally show ?thesis . qed +lemma (in complete_measure) fmeasurable_measure_inner_outer_le: + "(S \ fmeasurable M \ m = measure M S) \ + (\e>0. \T\fmeasurable M. T \ S \ m - e \ measure M T) \ + (\e>0. \U\fmeasurable M. S \ U \ measure M U \ m + e)" (is ?T1) + and null_sets_outer_le: + "S \ null_sets M \ (\e>0. \T\fmeasurable M. S \ T \ measure M T \ e)" (is ?T2) +proof - + have "e > 0 \ m - e/2 \ t \ m - e < t" + "e > 0 \ t \ m + e/2 \ t < m + e" + "e > 0 \ e/2 > 0" + for e t + by auto + then show ?T1 ?T2 + unfolding fmeasurable_measure_inner_outer null_sets_outer + by (meson dense le_less_trans less_imp_le)+ +qed + lemma (in cld_measure) notin_sets_outer_measure_of_cover: assumes E: "E \ space M" "E \ sets M" shows "\B\sets M. 0 < emeasure M B \ emeasure M B < \ \ diff -r 349c639e593c -r 7643b005b29a src/HOL/Analysis/Convex_Euclidean_Space.thy --- a/src/HOL/Analysis/Convex_Euclidean_Space.thy Sat Apr 14 20:19:52 2018 +0100 +++ b/src/HOL/Analysis/Convex_Euclidean_Space.thy Sun Apr 15 13:57:00 2018 +0100 @@ -6992,7 +6992,7 @@ done qed -subsubsection%unimportant\Representation of any interval as a finite convex hull\ +subsection%unimportant\Representation of any interval as a finite convex hull\ lemma image_stretch_interval: "(\x. \k\Basis. (m k * (x\k)) *\<^sub>R k) ` cbox a (b::'a::euclidean_space) = diff -r 349c639e593c -r 7643b005b29a src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy --- a/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Sat Apr 14 20:19:52 2018 +0100 +++ b/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Sun Apr 15 13:57:00 2018 +0100 @@ -945,7 +945,18 @@ by (auto simp: integrable_on_def nn_integral_completion) qed qed - + +lemma integrable_on_lebesgue_on: + fixes f :: "'a::euclidean_space \ 'b::euclidean_space" + assumes f: "integrable (lebesgue_on S) f" and S: "S \ sets lebesgue" + shows "f integrable_on S" +proof - + have "integrable lebesgue (\x. indicator S x *\<^sub>R f x)" + using S f inf_top.comm_neutral integrable_restrict_space by blast + then show ?thesis + using absolutely_integrable_on_def set_integrable_def by blast +qed + lemma absolutely_integrable_on_null [intro]: fixes f :: "'a::euclidean_space \ 'b::euclidean_space" shows "content (cbox a b) = 0 \ f absolutely_integrable_on (cbox a b)" @@ -1051,6 +1062,39 @@ lemma lmeasure_integral: "S \ lmeasurable \ measure lebesgue S = integral S (\x. 1::real)" by (fastforce simp add: lmeasure_integral_UNIV indicator_def[abs_def] lmeasurable_iff_integrable_on) +lemma integrable_on_const: "S \ lmeasurable \ (\x. c) integrable_on S" + unfolding lmeasurable_iff_integrable + by (metis (mono_tags, lifting) integrable_eq integrable_on_scaleR_left lmeasurable_iff_integrable lmeasurable_iff_integrable_on scaleR_one) + +lemma integral_indicator: + assumes "(S \ T) \ lmeasurable" + shows "integral T (indicator S) = measure lebesgue (S \ T)" +proof - + have "integral UNIV (indicator (S \ T)) = integral UNIV (\a. if a \ S \ T then 1::real else 0)" + by (meson indicator_def) + moreover + have "(indicator (S \ T) has_integral measure lebesgue (S \ T)) UNIV" + using assms by (simp add: lmeasurable_iff_has_integral) + ultimately have "integral UNIV (\x. if x \ S \ T then 1 else 0) = measure lebesgue (S \ T)" + by (metis (no_types) integral_unique) + then show ?thesis + using integral_restrict_Int [of UNIV "S \ T" "\x. 1::real"] + apply (simp add: integral_restrict_Int [symmetric]) + by (meson indicator_def) +qed + +lemma measurable_integrable: + fixes S :: "'a::euclidean_space set" + shows "S \ lmeasurable \ (indicat_real S) integrable_on UNIV" + by (auto simp: lmeasurable_iff_integrable absolutely_integrable_on_iff_nonneg [symmetric] set_integrable_def) + +lemma integrable_on_indicator: + fixes S :: "'a::euclidean_space set" + shows "indicat_real S integrable_on T \ (S \ T) \ lmeasurable" + unfolding measurable_integrable + unfolding integrable_restrict_UNIV [of T, symmetric] + by (fastforce simp add: indicator_def elim: integrable_eq) + lemma assumes \: "\ division_of S" shows lmeasurable_division: "S \ lmeasurable" (is ?l) @@ -1072,7 +1116,6 @@ by (auto intro!: measure_Union_AE[symmetric] simp: completion.AE_iff_null_sets Int_def[symmetric] pairwise_def null_sets_def) qed -text \This should be an abbreviation for negligible.\ lemma negligible_iff_null_sets: "negligible S \ S \ null_sets lebesgue" proof assume "negligible S" @@ -2208,6 +2251,12 @@ using f by (auto intro: has_integral_implies_lebesgue_measurable simp: integrable_on_def) qed (use le in \force intro!: always_eventually split: split_indicator\) +lemma absolutely_integrable_continuous: + fixes f :: "'a::euclidean_space \ 'b::euclidean_space" + shows "continuous_on (cbox a b) f \ f absolutely_integrable_on cbox a b" + using absolutely_integrable_integrable_bound + by (simp add: absolutely_integrable_on_def continuous_on_norm integrable_continuous) + subsection \Componentwise\ proposition absolutely_integrable_componentwise_iff: diff -r 349c639e593c -r 7643b005b29a src/HOL/Analysis/Fashoda_Theorem.thy --- a/src/HOL/Analysis/Fashoda_Theorem.thy Sat Apr 14 20:19:52 2018 +0100 +++ b/src/HOL/Analysis/Fashoda_Theorem.thy Sun Apr 15 13:57:00 2018 +0100 @@ -269,15 +269,10 @@ by auto moreover from x1 have "g (x $ 2) \ cbox (-1) 1" - apply - - apply (rule assms(2)[unfolded subset_eq,rule_format]) - apply auto - done + using assms(2) by blast ultimately show False unfolding lem3[OF nz] vector_component_simps * mem_box_cart - apply (erule_tac x=1 in allE) - apply auto - done + using not_le by auto next assume as: "x$1 = -1" then have *: "f (x $ 1) $ 1 = - 1" @@ -288,15 +283,10 @@ by auto moreover from x1 have "g (x $ 2) \ cbox (-1) 1" - apply - - apply (rule assms(2)[unfolded subset_eq,rule_format]) - apply auto - done + using assms(2) by blast ultimately show False unfolding lem3[OF nz] vector_component_simps * mem_box_cart - apply (erule_tac x=1 in allE) - apply auto - done + using not_le by auto next assume as: "x$2 = 1" then have *: "g (x $ 2) $ 2 = 1" @@ -527,7 +517,7 @@ and "(interval_bij (a, b) (- 1, 1) \ g) 0 $ 2 = -1" and "(interval_bij (a, b) (- 1, 1) \ g) 1 $ 2 = 1" using assms as - by (simp_all add: axis_in_Basis cart_eq_inner_axis pathstart_def pathfinish_def interval_bij_def) + by (simp_all add: cart_eq_inner_axis pathstart_def pathfinish_def interval_bij_def) (simp_all add: inner_axis) qed from z(1) obtain zf where zf: diff -r 349c639e593c -r 7643b005b29a src/HOL/Analysis/Finite_Cartesian_Product.thy --- a/src/HOL/Analysis/Finite_Cartesian_Product.thy Sat Apr 14 20:19:52 2018 +0100 +++ b/src/HOL/Analysis/Finite_Cartesian_Product.thy Sun Apr 15 13:57:00 2018 +0100 @@ -607,20 +607,8 @@ apply (rule sum.neutral, simp add: axis_def) done -lemma sum_single: - assumes "finite A" and "k \ A" and "f k = y" - assumes "\i. i \ A \ i \ k \ f i = 0" - shows "(\i\A. f i) = y" - apply (subst sum.remove [OF assms(1,2)]) - apply (simp add: sum.neutral assms(3,4)) - done - lemma inner_axis: "inner x (axis i y) = inner (x $ i) y" - unfolding inner_vec_def - apply (rule_tac k=i in sum_single) - apply simp_all - apply (simp add: axis_def) - done + by (simp add: inner_vec_def axis_def sum.remove [where x=i]) lemma inner_axis': "inner(axis i y) x = inner y (x $ i)" by (simp add: inner_axis inner_commute) @@ -649,22 +637,51 @@ by (simp add: inner_axis euclidean_all_zero_iff vec_eq_iff) qed -lemma DIM_cart[simp]: "DIM('a^'b) = CARD('b) * DIM('a)" - apply (simp add: Basis_vec_def) - apply (subst card_UN_disjoint) - apply simp - apply simp - apply (auto simp: axis_eq_axis) [1] - apply (subst card_UN_disjoint) - apply (auto simp: axis_eq_axis) - done +lemma DIM_cart [simp]: "DIM('a^'b) = CARD('b) * DIM('a)" +proof - + have "card (\i::'b. \u::'a\Basis. {axis i u}) = (\i::'b\UNIV. card (\u::'a\Basis. {axis i u}))" + by (rule card_UN_disjoint) (auto simp: axis_eq_axis) + also have "... = CARD('b) * DIM('a)" + by (subst card_UN_disjoint) (auto simp: axis_eq_axis) + finally show ?thesis + by (simp add: Basis_vec_def) +qed end lemma cart_eq_inner_axis: "a $ i = inner a (axis i 1)" by (simp add: inner_axis) -lemma axis_in_Basis: "a \ Basis \ axis i a \ Basis" - by (auto simp add: Basis_vec_def axis_eq_axis) +lemma axis_eq_0_iff [simp]: + shows "axis m x = 0 \ x = 0" + by (simp add: axis_def vec_eq_iff) + +lemma axis_in_Basis_iff [simp]: "axis i a \ Basis \ a \ Basis" + by (auto simp: Basis_vec_def axis_eq_axis) + +text\Mapping each basis element to the corresponding finite index\ +definition axis_index :: "('a::comm_ring_1)^'n \ 'n" where "axis_index v \ SOME i. v = axis i 1" + +lemma axis_inverse: + fixes v :: "real^'n" + assumes "v \ Basis" + shows "\i. v = axis i 1" +proof - + have "v \ (\n. \r\Basis. {axis n r})" + using assms Basis_vec_def by blast + then show ?thesis + by (force simp add: vec_eq_iff) +qed + +lemma axis_index: + fixes v :: "real^'n" + assumes "v \ Basis" + shows "v = axis (axis_index v) 1" + by (metis (mono_tags) assms axis_inverse axis_index_def someI_ex) + +lemma axis_index_axis [simp]: + fixes UU :: "real^'n" + shows "(axis_index (axis u 1 :: real^'n)) = (u::'n)" + by (simp add: axis_eq_axis axis_index_def) end diff -r 349c639e593c -r 7643b005b29a src/HOL/Analysis/Henstock_Kurzweil_Integration.thy --- a/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Sat Apr 14 20:19:52 2018 +0100 +++ b/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Sun Apr 15 13:57:00 2018 +0100 @@ -3501,6 +3501,44 @@ using assms unfolding integrable_on_def by (force dest: has_integral_stretch) +lemma vec_lambda_eq_sum: + shows "(\ k. f k (x $ k)) = (\k\Basis. (f (axis_index k) (x \ k)) *\<^sub>R k)" + apply (simp add: Basis_vec_def cart_eq_inner_axis UNION_singleton_eq_range sum.reindex axis_eq_axis inj_on_def) + apply (simp add: vec_eq_iff axis_def if_distrib cong: if_cong) + done + +lemma has_integral_stretch_cart: + fixes m :: "'n::finite \ real" + assumes f: "(f has_integral i) (cbox a b)" and m: "\k. m k \ 0" + shows "((\x. f(\ k. m k * x$k)) has_integral i /\<^sub>R \prod m UNIV\) + ((\x. \ k. x$k / m k) ` (cbox a b))" +proof - + have *: "\k:: real^'n \ Basis. m (axis_index k) \ 0" + using axis_index by (simp add: m) + have eqp: "(\k:: real^'n \ Basis. m (axis_index k)) = prod m UNIV" + by (simp add: Basis_vec_def UNION_singleton_eq_range prod.reindex axis_eq_axis inj_on_def) + show ?thesis + using has_integral_stretch [OF f *] vec_lambda_eq_sum [where f="\i x. m i * x"] vec_lambda_eq_sum [where f="\i x. x / m i"] + by (simp add: field_simps eqp) +qed + +lemma image_stretch_interval_cart: + fixes m :: "'n::finite \ real" + shows "(\x. \ k. m k * x$k) ` cbox a b = + (if cbox a b = {} then {} + else cbox (\ k. min (m k * a$k) (m k * b$k)) (\ k. max (m k * a$k) (m k * b$k)))" +proof - + have *: "(\k\Basis. min (m (axis_index k) * (a \ k)) (m (axis_index k) * (b \ k)) *\<^sub>R k) + = (\ k. min (m k * a $ k) (m k * b $ k))" + "(\k\Basis. max (m (axis_index k) * (a \ k)) (m (axis_index k) * (b \ k)) *\<^sub>R k) + = (\ k. max (m k * a $ k) (m k * b $ k))" + apply (simp_all add: Basis_vec_def cart_eq_inner_axis UNION_singleton_eq_range sum.reindex axis_eq_axis inj_on_def) + apply (simp_all add: vec_eq_iff axis_def if_distrib cong: if_cong) + done + show ?thesis + by (simp add: vec_lambda_eq_sum [where f="\i x. m i * x"] image_stretch_interval eq_cbox *) +qed + subsection \even more special cases\ diff -r 349c639e593c -r 7643b005b29a src/HOL/Analysis/Lebesgue_Measure.thy --- a/src/HOL/Analysis/Lebesgue_Measure.thy Sat Apr 14 20:19:52 2018 +0100 +++ b/src/HOL/Analysis/Lebesgue_Measure.thy Sun Apr 15 13:57:00 2018 +0100 @@ -393,6 +393,23 @@ lemma Compl_in_sets_lebesgue: "-A \ sets lebesgue \ A \ sets lebesgue" by (metis Compl_eq_Diff_UNIV double_compl space_borel space_completion space_lborel Sigma_Algebra.sets.compl_sets) +lemma measurable_lebesgue_cong: + assumes "\x. x \ S \ f x = g x" + shows "f \ measurable (lebesgue_on S) M \ g \ measurable (lebesgue_on S) M" + by (metis (mono_tags, lifting) IntD1 assms measurable_cong_strong space_restrict_space) + +text\Measurability of continuous functions\ +lemma continuous_imp_measurable_on_sets_lebesgue: + assumes f: "continuous_on S f" and S: "S \ sets lebesgue" + shows "f \ borel_measurable (lebesgue_on S)" +proof - + have "sets (restrict_space borel S) \ sets (lebesgue_on S)" + by (simp add: mono_restrict_space subsetI) + then show ?thesis + by (simp add: borel_measurable_continuous_on_restrict [OF f] borel_measurable_subalgebra + space_restrict_space) +qed + context begin @@ -446,7 +463,7 @@ lemma AE_lborel_singleton: "AE x in lborel::'a::euclidean_space measure. x \ c" using SOME_Basis AE_discrete_difference [of "{c}" lborel] emeasure_lborel_cbox [of c c] - by (auto simp add: cbox_sing prod_constant power_0_left) + by (auto simp add: power_0_left) lemma emeasure_lborel_Ioo[simp]: assumes [simp]: "l \ u" @@ -542,7 +559,7 @@ end -lemma emeasure_lborel_UNIV: "emeasure lborel (UNIV::'a::euclidean_space set) = \" +lemma emeasure_lborel_UNIV [simp]: "emeasure lborel (UNIV::'a::euclidean_space set) = \" proof - { fix n::nat let ?Ba = "Basis :: 'a set" @@ -949,6 +966,9 @@ where "lmeasurable \ fmeasurable lebesgue" +lemma not_measurable_UNIV [simp]: "UNIV \ lmeasurable" + by (simp add: fmeasurable_def) + lemma lmeasurable_iff_integrable: "S \ lmeasurable \ integrable lebesgue (indicator S :: 'a::euclidean_space \ real)" by (auto simp: fmeasurable_def integrable_iff_bounded borel_measurable_indicator_iff ennreal_indicator) diff -r 349c639e593c -r 7643b005b29a src/HOL/Analysis/Linear_Algebra.thy --- a/src/HOL/Analysis/Linear_Algebra.thy Sat Apr 14 20:19:52 2018 +0100 +++ b/src/HOL/Analysis/Linear_Algebra.thy Sun Apr 15 13:57:00 2018 +0100 @@ -1962,15 +1962,43 @@ lemma linear_bounded_pos: fixes f :: "'a::euclidean_space \ 'b::real_normed_vector" assumes lf: "linear f" - shows "\B > 0. \x. norm (f x) \ B * norm x" + obtains B where "B > 0" "\x. norm (f x) \ B * norm x" proof - have "\B > 0. \x. norm (f x) \ norm x * B" using lf unfolding linear_conv_bounded_linear by (rule bounded_linear.pos_bounded) - then show ?thesis - by (simp only: mult.commute) + with that show ?thesis + by (auto simp: mult.commute) qed +lemma linear_invertible_bounded_below_pos: + fixes f :: "'a::real_normed_vector \ 'b::euclidean_space" + assumes "linear f" "linear g" "g \ f = id" + obtains B where "B > 0" "\x. B * norm x \ norm(f x)" +proof - + obtain B where "B > 0" and B: "\x. norm (g x) \ B * norm x" + using linear_bounded_pos [OF \linear g\] by blast + show thesis + proof + show "0 < 1/B" + by (simp add: \B > 0\) + show "1/B * norm x \ norm (f x)" for x + proof - + have "1/B * norm x = 1/B * norm (g (f x))" + using assms by (simp add: pointfree_idE) + also have "\ \ norm (f x)" + using B [of "f x"] by (simp add: \B > 0\ mult.commute pos_divide_le_eq) + finally show ?thesis . + qed + qed +qed + +lemma linear_inj_bounded_below_pos: + fixes f :: "'a::real_normed_vector \ 'b::euclidean_space" + assumes "linear f" "inj f" + obtains B where "B > 0" "\x. B * norm x \ norm(f x)" + using linear_injective_left_inverse [OF assms] linear_invertible_bounded_below_pos assms by blast + lemma bounded_linearI': fixes f ::"'a::euclidean_space \ 'b::real_normed_vector" assumes "\x y. f (x + y) = f x + f y" diff -r 349c639e593c -r 7643b005b29a src/HOL/Analysis/Measure_Space.thy --- a/src/HOL/Analysis/Measure_Space.thy Sat Apr 14 20:19:52 2018 +0100 +++ b/src/HOL/Analysis/Measure_Space.thy Sun Apr 15 13:57:00 2018 +0100 @@ -1534,6 +1534,9 @@ lemma measure_nonneg[simp]: "0 \ measure M A" unfolding measure_def by auto +lemma measure_nonneg' [simp]: "\ measure M A < 0" + using measure_nonneg not_le by blast + lemma zero_less_measure_iff: "0 < measure M A \ measure M A \ 0" using measure_nonneg[of M A] by (auto simp add: le_less) @@ -1686,7 +1689,7 @@ moreover have "ennreal (measure M (A i)) = emeasure M (A i)" for i using assms emeasure_mono[of "A _" "\i. A i" M] by (intro emeasure_eq_ennreal_measure[symmetric]) (auto simp: less_top UN_upper intro: le_less_trans) - ultimately show "(\x. ennreal (Sigma_Algebra.measure M (A x))) \ ennreal (Sigma_Algebra.measure M (\i. A i))" + ultimately show "(\x. ennreal (measure M (A x))) \ ennreal (measure M (\i. A i))" using A by (auto intro!: Lim_emeasure_incseq) qed auto @@ -1699,7 +1702,7 @@ by (auto intro!: emeasure_eq_ennreal_measure[symmetric] simp: INT_lower less_top intro: le_less_trans) moreover have "ennreal (measure M (A i)) = emeasure M (A i)" for i using A fin[of i] by (intro emeasure_eq_ennreal_measure[symmetric]) auto - ultimately show "(\x. ennreal (Sigma_Algebra.measure M (A x))) \ ennreal (Sigma_Algebra.measure M (\i. A i))" + ultimately show "(\x. ennreal (measure M (A x))) \ ennreal (measure M (\i. A i))" using fin A by (auto intro!: Lim_emeasure_decseq) qed auto @@ -1772,6 +1775,32 @@ using assms by (intro sets.countable_INT') auto qed +lemma measurable_measure_Diff: + assumes "A \ fmeasurable M" "B \ sets M" "B \ A" + shows "measure M (A - B) = measure M A - measure M B" + by (simp add: assms fmeasurableD fmeasurableD2 measure_Diff) + +lemma measurable_Un_null_set: + assumes "B \ null_sets M" + shows "(A \ B \ fmeasurable M \ A \ sets M) \ A \ fmeasurable M" + using assms by (fastforce simp add: fmeasurable.Un fmeasurableI_null_sets intro: fmeasurableI2) + +lemma measurable_Diff_null_set: + assumes "B \ null_sets M" + shows "(A - B) \ fmeasurable M \ A \ sets M \ A \ fmeasurable M" + using assms + by (metis Un_Diff_cancel2 fmeasurable.Diff fmeasurableD fmeasurableI_null_sets measurable_Un_null_set) + +lemma fmeasurable_Diff_D: + assumes m: "T - S \ fmeasurable M" "S \ fmeasurable M" and sub: "S \ T" + shows "T \ fmeasurable M" +proof - + have "T = S \ (T - S)" + using assms by blast + then show ?thesis + by (metis m fmeasurable.Un) +qed + lemma measure_Un2: "A \ fmeasurable M \ B \ fmeasurable M \ measure M (A \ B) = measure M A + measure M (B - A)" using measure_Union[of M A "B - A"] by (auto simp: fmeasurableD2 fmeasurable.Diff) @@ -1801,12 +1830,13 @@ measure M (\i\I. F i) = (\i\I. measure M (F i))" unfolding AE_pairwise[OF countable_finite, OF I] using I - apply (induction I rule: finite_induct) - apply simp - apply (simp add: pairwise_insert) - apply (subst measure_Un_AE) - apply auto - done +proof (induction I rule: finite_induct) + case (insert x I) + have "measure M (F x \ UNION I F) = measure M (F x) + measure M (UNION I F)" + by (rule measure_Un_AE) (use insert in \auto simp: pairwise_insert\) + with insert show ?case + by (simp add: pairwise_insert ) +qed simp lemma measure_UNION': "finite I \ (\i. i \ I \ F i \ fmeasurable M) \ pairwise (\i j. disjnt (F i) (F j)) I \ @@ -1888,6 +1918,18 @@ then show ?fm ?m by auto qed +lemma measure_diff_le_measure_setdiff: + assumes "S \ fmeasurable M" "T \ fmeasurable M" + shows "measure M S - measure M T \ measure M (S - T)" +proof - + have "measure M S \ measure M ((S - T) \ T)" + by (simp add: assms fmeasurable.Un fmeasurableD measure_mono_fmeasurable) + also have "\ \ measure M (S - T) + measure M T" + using assms by (blast intro: measure_Un_le) + finally show ?thesis + by (simp add: algebra_simps) +qed + lemma suminf_exist_split2: fixes f :: "nat \ 'a::real_normed_vector" assumes "summable f" diff -r 349c639e593c -r 7643b005b29a src/HOL/Analysis/Sigma_Algebra.thy --- a/src/HOL/Analysis/Sigma_Algebra.thy Sat Apr 14 20:19:52 2018 +0100 +++ b/src/HOL/Analysis/Sigma_Algebra.thy Sun Apr 15 13:57:00 2018 +0100 @@ -2096,7 +2096,7 @@ lemma space_restrict_space: "space (restrict_space M \) = \ \ space M" using sets.sets_into_space unfolding restrict_space_def by (subst space_measure_of) auto -lemma space_restrict_space2: "\ \ sets M \ space (restrict_space M \) = \" +lemma space_restrict_space2 [simp]: "\ \ sets M \ space (restrict_space M \) = \" by (simp add: space_restrict_space sets.sets_into_space) lemma sets_restrict_space: "sets (restrict_space M \) = ((\) \) ` sets M" diff -r 349c639e593c -r 7643b005b29a src/HOL/Probability/Information.thy --- a/src/HOL/Probability/Information.thy Sat Apr 14 20:19:52 2018 +0100 +++ b/src/HOL/Probability/Information.thy Sun Apr 15 13:57:00 2018 +0100 @@ -834,9 +834,14 @@ - log b (\ x. indicator {x \ space MX. Px x \ 0} x \MX)" using Px Px_nn fin by (auto simp: measure_def) also have "- log b (\ x. indicator {x \ space MX. Px x \ 0} x \MX) = - log b (\ x. 1 / Px x \distr M MX X)" - unfolding distributed_distr_eq_density[OF X] using Px Px_nn - apply (intro arg_cong[where f="log b"] arg_cong[where f=uminus]) - by (subst integral_density) (auto simp del: integral_indicator intro!: Bochner_Integration.integral_cong) + proof - + have "integral\<^sup>L MX (indicator {x \ space MX. Px x \ 0}) = LINT x|MX. Px x *\<^sub>R (1 / Px x)" + by (rule Bochner_Integration.integral_cong) auto + also have "... = LINT x|density MX (\x. ennreal (Px x)). 1 / Px x" + by (rule integral_density [symmetric]) (use Px Px_nn in auto) + finally show ?thesis + unfolding distributed_distr_eq_density[OF X] by simp + qed also have "\ \ (\ x. - log b (1 / Px x) \distr M MX X)" proof (rule X.jensens_inequality[of "\x. 1 / Px x" "{0<..}" 0 1 "\x. - log b x"]) show "AE x in distr M MX X. 1 / Px x \ {0<..}"