# HG changeset patch # User hoelzl # Date 1474027011 -7200 # Node ID 685fb01256af401d6fea2fd4a73e06812d9df36f # Parent a6cd18af8bf941cae81c622a9f3e8e2f5fe6b1dc move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Analysis/Bochner_Integration.thy --- a/src/HOL/Analysis/Bochner_Integration.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Analysis/Bochner_Integration.thy Fri Sep 16 13:56:51 2016 +0200 @@ -187,7 +187,7 @@ using U by (auto intro: borel_measurable_simple_function intro!: borel_measurable_enn2real borel_measurable_times - simp: U'_def zero_le_mult_iff enn2real_nonneg) + simp: U'_def zero_le_mult_iff) show "incseq U'" using U(2,3) by (auto simp: incseq_def le_fun_def image_iff eq_commute U'_def indicator_def enn2real_mono) @@ -212,7 +212,7 @@ ultimately have U': "(\z. \y\U' i`space M. y * indicator {x\space M. U' i x = y} z) = U' i" by (simp add: U'_def fun_eq_iff) have "\x. x \ U' i ` space M \ 0 \ x" - by (auto simp: U'_def enn2real_nonneg) + by (auto simp: U'_def) with fin have "P (\z. \y\U' i`space M. y * indicator {x\space M. U' i x = y} z)" proof induct case empty from set[of "{}"] show ?case @@ -866,7 +866,7 @@ simple_bochner_integrable M (\x. indicator \ x *\<^sub>R f x)" by (simp add: simple_bochner_integrable.simps space_restrict_space simple_function_restrict_space[OF \] emeasure_restrict_space[OF \] Collect_restrict - indicator_eq_0_iff conj_ac) + indicator_eq_0_iff conj_left_commute) lemma simple_bochner_integral_restrict_space: fixes f :: "_ \ 'b::real_normed_vector" @@ -1624,7 +1624,7 @@ with seq show "\N. \n\N. 0 \ integral\<^sup>L M (U n)" by auto qed - qed (auto simp: measure_nonneg integrable_mult_left_iff) + qed (auto simp: integrable_mult_left_iff) also have "\ = integral\<^sup>L M f" using nonneg by (auto intro!: integral_cong_AE) finally show ?thesis . @@ -2466,10 +2466,10 @@ shows "ennreal (\x. enn2real (f x) \M) = (\\<^sup>+x. f x \M)" proof (subst nn_integral_eq_integral[symmetric]) show "integrable M (\x. enn2real (f x))" - using ae by (intro integrable_const_bound[where B=B]) (auto simp: enn2real_leI enn2real_nonneg) + using ae by (intro integrable_const_bound[where B=B]) (auto simp: enn2real_leI) show "(\\<^sup>+ x. ennreal (enn2real (f x)) \M) = integral\<^sup>N M f" using ae by (intro nn_integral_cong_AE) (auto simp: le_less_trans[OF _ ennreal_less_top]) -qed (auto simp: enn2real_nonneg) +qed auto lemma (in finite_measure) integral_less_AE: fixes X Y :: "'a \ real" diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Analysis/Cartesian_Euclidean_Space.thy --- a/src/HOL/Analysis/Cartesian_Euclidean_Space.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Analysis/Cartesian_Euclidean_Space.thy Fri Sep 16 13:56:51 2016 +0200 @@ -1,7 +1,7 @@ section \Instantiates the finite Cartesian product of Euclidean spaces as a Euclidean space.\ theory Cartesian_Euclidean_Space -imports Finite_Cartesian_Product Henstock_Kurzweil_Integration +imports Finite_Cartesian_Product Derivative (* Henstock_Kurzweil_Integration *) begin lemma subspace_special_hyperplane: "subspace {x. x $ k = 0}" @@ -927,7 +927,6 @@ unfolding dot_matrix_product transpose_columnvector[symmetric] dot_rowvector_columnvector matrix_transpose_mul matrix_mul_assoc .. - lemma infnorm_cart:"infnorm (x::real^'n) = Sup {\x$i\ |i. i\UNIV}" by (simp add: infnorm_def inner_axis Basis_vec_def) (metis (lifting) inner_axis real_inner_1_right) @@ -1409,12 +1408,6 @@ apply (rule bounded_linearI[where K=1]) using component_le_norm_cart[of _ k] unfolding real_norm_def by auto -lemma integral_component_eq_cart[simp]: - fixes f :: "'n::euclidean_space \ real^'m" - assumes "f integrable_on s" - shows "integral s (\x. f x $ k) = integral s f $ k" - using integral_linear[OF assms(1) bounded_linear_component_cart,unfolded o_def] . - lemma interval_split_cart: "{a..b::real^'n} \ {x. x$k \ c} = {a .. (\ i. if i = k then min (b$k) c else b$i)}" "cbox a b \ {x. x$k \ c} = {(\ i. if i = k then max (a$k) c else a$i) .. b}" diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Analysis/Complex_Analysis_Basics.thy --- a/src/HOL/Analysis/Complex_Analysis_Basics.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Analysis/Complex_Analysis_Basics.thy Fri Sep 16 13:56:51 2016 +0200 @@ -5,7 +5,7 @@ section \Complex Analysis Basics\ theory Complex_Analysis_Basics -imports Cartesian_Euclidean_Space "~~/src/HOL/Library/Nonpos_Ints" +imports Henstock_Kurzweil_Integration "~~/src/HOL/Library/Nonpos_Ints" begin diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Analysis/Derivative.thy --- a/src/HOL/Analysis/Derivative.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Analysis/Derivative.thy Fri Sep 16 13:56:51 2016 +0200 @@ -9,6 +9,9 @@ imports Brouwer_Fixpoint Operator_Norm Uniform_Limit Bounded_Linear_Function begin +lemma bounded_linear_component [intro]: "bounded_linear (\x::'a::euclidean_space. x \ k)" + by (rule bounded_linear_inner_left) + lemma onorm_inner_left: assumes "bounded_linear r" shows "onorm (\x. r x \ f) \ onorm r * norm f" @@ -2906,5 +2909,4 @@ by eventually_elim (auto simp: dist_norm field_simps) qed (auto intro!: bounded_linear_intros simp: split_beta') - end diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Analysis/Embed_Measure.thy --- a/src/HOL/Analysis/Embed_Measure.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Analysis/Embed_Measure.thy Fri Sep 16 13:56:51 2016 +0200 @@ -47,7 +47,7 @@ lemma sets_embed_eq_vimage_algebra: assumes "inj_on f (space M)" shows "sets (embed_measure M f) = sets (vimage_algebra (f`space M) (the_inv_into (space M) f) M)" - by (auto simp: sets_embed_measure'[OF assms] Pi_iff the_inv_into_f_f assms sets_vimage_algebra2 simple_image + by (auto simp: sets_embed_measure'[OF assms] Pi_iff the_inv_into_f_f assms sets_vimage_algebra2 Setcompr_eq_image dest: sets.sets_into_space intro!: image_cong the_inv_into_vimage[symmetric]) diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Fri Sep 16 13:56:51 2016 +0200 @@ -0,0 +1,606 @@ +theory Equivalence_Lebesgue_Henstock_Integration + imports Lebesgue_Measure Henstock_Kurzweil_Integration +begin + +subsection \Equivalence Lebesgue integral on @{const lborel} and HK-integral\ + +lemma has_integral_measure_lborel: + fixes A :: "'a::euclidean_space set" + assumes A[measurable]: "A \ sets borel" and finite: "emeasure lborel A < \" + shows "((\x. 1) has_integral measure lborel A) A" +proof - + { fix l u :: 'a + have "((\x. 1) has_integral measure lborel (box l u)) (box l u)" + proof cases + assume "\b\Basis. l \ b \ u \ b" + then show ?thesis + apply simp + apply (subst has_integral_restrict[symmetric, OF box_subset_cbox]) + apply (subst has_integral_spike_interior_eq[where g="\_. 1"]) + using has_integral_const[of "1::real" l u] + apply (simp_all add: inner_diff_left[symmetric] content_cbox_cases) + done + next + assume "\ (\b\Basis. l \ b \ u \ b)" + then have "box l u = {}" + unfolding box_eq_empty by (auto simp: not_le intro: less_imp_le) + then show ?thesis + by simp + qed } + note has_integral_box = this + + { fix a b :: 'a let ?M = "\A. measure lborel (A \ box a b)" + have "Int_stable (range (\(a, b). box a b))" + by (auto simp: Int_stable_def box_Int_box) + moreover have "(range (\(a, b). box a b)) \ Pow UNIV" + by auto + moreover have "A \ sigma_sets UNIV (range (\(a, b). box a b))" + using A unfolding borel_eq_box by simp + ultimately have "((\x. 1) has_integral ?M A) (A \ box a b)" + proof (induction rule: sigma_sets_induct_disjoint) + case (basic A) then show ?case + by (auto simp: box_Int_box has_integral_box) + next + case empty then show ?case + by simp + next + case (compl A) + then have [measurable]: "A \ sets borel" + by (simp add: borel_eq_box) + + have "((\x. 1) has_integral ?M (box a b)) (box a b)" + by (simp add: has_integral_box) + moreover have "((\x. if x \ A \ box a b then 1 else 0) has_integral ?M A) (box a b)" + by (subst has_integral_restrict) (auto intro: compl) + ultimately have "((\x. 1 - (if x \ A \ box a b then 1 else 0)) has_integral ?M (box a b) - ?M A) (box a b)" + by (rule has_integral_sub) + then have "((\x. (if x \ (UNIV - A) \ box a b then 1 else 0)) has_integral ?M (box a b) - ?M A) (box a b)" + by (rule has_integral_cong[THEN iffD1, rotated 1]) auto + then have "((\x. 1) has_integral ?M (box a b) - ?M A) ((UNIV - A) \ box a b)" + by (subst (asm) has_integral_restrict) auto + also have "?M (box a b) - ?M A = ?M (UNIV - A)" + by (subst measure_Diff[symmetric]) (auto simp: emeasure_lborel_box_eq Diff_Int_distrib2) + finally show ?case . + next + case (union F) + then have [measurable]: "\i. F i \ sets borel" + by (simp add: borel_eq_box subset_eq) + have "((\x. if x \ UNION UNIV F \ box a b then 1 else 0) has_integral ?M (\i. F i)) (box a b)" + proof (rule has_integral_monotone_convergence_increasing) + let ?f = "\k x. \i F i \ box a b then 1 else 0 :: real" + show "\k. (?f k has_integral (\ik x. ?f k x \ ?f (Suc k) x" + by (intro setsum_mono2) auto + from union(1) have *: "\x i j. x \ F i \ x \ F j \ j = i" + by (auto simp add: disjoint_family_on_def) + show "\x. (\k. ?f k x) \ (if x \ UNION UNIV F \ box a b then 1 else 0)" + apply (auto simp: * setsum.If_cases Iio_Int_singleton) + apply (rule_tac k="Suc xa" in LIMSEQ_offset) + apply simp + done + have *: "emeasure lborel ((\x. F x) \ box a b) \ emeasure lborel (box a b)" + by (intro emeasure_mono) auto + + with union(1) show "(\k. \i ?M (\i. F i)" + unfolding sums_def[symmetric] UN_extend_simps + by (intro measure_UNION) (auto simp: disjoint_family_on_def emeasure_lborel_box_eq top_unique) + qed + then show ?case + by (subst (asm) has_integral_restrict) auto + qed } + note * = this + + show ?thesis + proof (rule has_integral_monotone_convergence_increasing) + let ?B = "\n::nat. box (- real n *\<^sub>R One) (real n *\<^sub>R One) :: 'a set" + let ?f = "\n::nat. \x. if x \ A \ ?B n then 1 else 0 :: real" + let ?M = "\n. measure lborel (A \ ?B n)" + + show "\n::nat. (?f n has_integral ?M n) A" + using * by (subst has_integral_restrict) simp_all + show "\k x. ?f k x \ ?f (Suc k) x" + by (auto simp: box_def) + { fix x assume "x \ A" + moreover have "(\k. indicator (A \ ?B k) x :: real) \ indicator (\k::nat. A \ ?B k) x" + by (intro LIMSEQ_indicator_incseq) (auto simp: incseq_def box_def) + ultimately show "(\k. if x \ A \ ?B k then 1 else 0::real) \ 1" + by (simp add: indicator_def UN_box_eq_UNIV) } + + have "(\n. emeasure lborel (A \ ?B n)) \ emeasure lborel (\n::nat. A \ ?B n)" + by (intro Lim_emeasure_incseq) (auto simp: incseq_def box_def) + also have "(\n. emeasure lborel (A \ ?B n)) = (\n. measure lborel (A \ ?B n))" + proof (intro ext emeasure_eq_ennreal_measure) + fix n have "emeasure lborel (A \ ?B n) \ emeasure lborel (?B n)" + by (intro emeasure_mono) auto + then show "emeasure lborel (A \ ?B n) \ top" + by (auto simp: top_unique) + qed + finally show "(\n. measure lborel (A \ ?B n)) \ measure lborel A" + using emeasure_eq_ennreal_measure[of lborel A] finite + by (simp add: UN_box_eq_UNIV less_top) + qed +qed + +lemma nn_integral_has_integral: + fixes f::"'a::euclidean_space \ real" + assumes f: "f \ borel_measurable borel" "\x. 0 \ f x" "(\\<^sup>+x. f x \lborel) = ennreal r" "0 \ r" + shows "(f has_integral r) UNIV" +using f proof (induct f arbitrary: r rule: borel_measurable_induct_real) + case (set A) + then have "((\x. 1) has_integral measure lborel A) A" + by (intro has_integral_measure_lborel) (auto simp: ennreal_indicator) + with set show ?case + by (simp add: ennreal_indicator measure_def) (simp add: indicator_def) +next + case (mult g c) + then have "ennreal c * (\\<^sup>+ x. g x \lborel) = ennreal r" + by (subst nn_integral_cmult[symmetric]) (auto simp: ennreal_mult) + with \0 \ r\ \0 \ c\ + obtain r' where "(c = 0 \ r = 0) \ (0 \ r' \ (\\<^sup>+ x. ennreal (g x) \lborel) = ennreal r' \ r = c * r')" + by (cases "\\<^sup>+ x. ennreal (g x) \lborel" rule: ennreal_cases) + (auto split: if_split_asm simp: ennreal_mult_top ennreal_mult[symmetric]) + with mult show ?case + by (auto intro!: has_integral_cmult_real) +next + case (add g h) + then have "(\\<^sup>+ x. h x + g x \lborel) = (\\<^sup>+ x. h x \lborel) + (\\<^sup>+ x. g x \lborel)" + by (simp add: nn_integral_add) + with add obtain a b where "0 \ a" "0 \ b" "(\\<^sup>+ x. h x \lborel) = ennreal a" "(\\<^sup>+ x. g x \lborel) = ennreal b" "r = a + b" + by (cases "\\<^sup>+ x. h x \lborel" "\\<^sup>+ x. g x \lborel" rule: ennreal2_cases) + (auto simp: add_top nn_integral_add top_add ennreal_plus[symmetric] simp del: ennreal_plus) + with add show ?case + by (auto intro!: has_integral_add) +next + case (seq U) + note seq(1)[measurable] and f[measurable] + + { fix i x + have "U i x \ f x" + using seq(5) + apply (rule LIMSEQ_le_const) + using seq(4) + apply (auto intro!: exI[of _ i] simp: incseq_def le_fun_def) + done } + note U_le_f = this + + { fix i + have "(\\<^sup>+x. U i x \lborel) \ (\\<^sup>+x. f x \lborel)" + using seq(2) f(2) U_le_f by (intro nn_integral_mono) simp + then obtain p where "(\\<^sup>+x. U i x \lborel) = ennreal p" "p \ r" "0 \ p" + using seq(6) \0\r\ by (cases "\\<^sup>+x. U i x \lborel" rule: ennreal_cases) (auto simp: top_unique) + moreover note seq + ultimately have "\p. (\\<^sup>+x. U i x \lborel) = ennreal p \ 0 \ p \ p \ r \ (U i has_integral p) UNIV" + by auto } + then obtain p where p: "\i. (\\<^sup>+x. ennreal (U i x) \lborel) = ennreal (p i)" + and bnd: "\i. p i \ r" "\i. 0 \ p i" + and U_int: "\i.(U i has_integral (p i)) UNIV" by metis + + have int_eq: "\i. integral UNIV (U i) = p i" using U_int by (rule integral_unique) + + have *: "f integrable_on UNIV \ (\k. integral UNIV (U k)) \ integral UNIV f" + proof (rule monotone_convergence_increasing) + show "\k. U k integrable_on UNIV" using U_int by auto + show "\k. \x\UNIV. U k x \ U (Suc k) x" using \incseq U\ by (auto simp: incseq_def le_fun_def) + then show "bounded {integral UNIV (U k) |k. True}" + using bnd int_eq by (auto simp: bounded_real intro!: exI[of _ r]) + show "\x\UNIV. (\k. U k x) \ f x" + using seq by auto + qed + moreover have "(\i. (\\<^sup>+x. U i x \lborel)) \ (\\<^sup>+x. f x \lborel)" + using seq f(2) U_le_f by (intro nn_integral_dominated_convergence[where w=f]) auto + ultimately have "integral UNIV f = r" + by (auto simp add: bnd int_eq p seq intro: LIMSEQ_unique) + with * show ?case + by (simp add: has_integral_integral) +qed + +lemma nn_integral_lborel_eq_integral: + fixes f::"'a::euclidean_space \ real" + assumes f: "f \ borel_measurable borel" "\x. 0 \ f x" "(\\<^sup>+x. f x \lborel) < \" + shows "(\\<^sup>+x. f x \lborel) = integral UNIV f" +proof - + from f(3) obtain r where r: "(\\<^sup>+x. f x \lborel) = ennreal r" "0 \ r" + by (cases "\\<^sup>+x. f x \lborel" rule: ennreal_cases) auto + then show ?thesis + using nn_integral_has_integral[OF f(1,2) r] by (simp add: integral_unique) +qed + +lemma nn_integral_integrable_on: + fixes f::"'a::euclidean_space \ real" + assumes f: "f \ borel_measurable borel" "\x. 0 \ f x" "(\\<^sup>+x. f x \lborel) < \" + shows "f integrable_on UNIV" +proof - + from f(3) obtain r where r: "(\\<^sup>+x. f x \lborel) = ennreal r" "0 \ r" + by (cases "\\<^sup>+x. f x \lborel" rule: ennreal_cases) auto + then show ?thesis + by (intro has_integral_integrable[where i=r] nn_integral_has_integral[where r=r] f) +qed + +lemma nn_integral_has_integral_lborel: + fixes f :: "'a::euclidean_space \ real" + assumes f_borel: "f \ borel_measurable borel" and nonneg: "\x. 0 \ f x" + assumes I: "(f has_integral I) UNIV" + shows "integral\<^sup>N lborel f = I" +proof - + from f_borel have "(\x. ennreal (f x)) \ borel_measurable lborel" by auto + from borel_measurable_implies_simple_function_sequence'[OF this] guess F . note F = this + let ?B = "\i::nat. box (- (real i *\<^sub>R One)) (real i *\<^sub>R One) :: 'a set" + + note F(1)[THEN borel_measurable_simple_function, measurable] + + have "0 \ I" + using I by (rule has_integral_nonneg) (simp add: nonneg) + + have F_le_f: "enn2real (F i x) \ f x" for i x + using F(3,4)[where x=x] nonneg SUP_upper[of i UNIV "\i. F i x"] + by (cases "F i x" rule: ennreal_cases) auto + let ?F = "\i x. F i x * indicator (?B i) x" + have "(\\<^sup>+ x. ennreal (f x) \lborel) = (SUP i. integral\<^sup>N lborel (\x. ?F i x))" + proof (subst nn_integral_monotone_convergence_SUP[symmetric]) + { fix x + obtain j where j: "x \ ?B j" + using UN_box_eq_UNIV by auto + + have "ennreal (f x) = (SUP i. F i x)" + using F(4)[of x] nonneg[of x] by (simp add: max_def) + also have "\ = (SUP i. ?F i x)" + proof (rule SUP_eq) + fix i show "\j\UNIV. F i x \ ?F j x" + using j F(2) + by (intro bexI[of _ "max i j"]) + (auto split: split_max split_indicator simp: incseq_def le_fun_def box_def) + qed (auto intro!: F split: split_indicator) + finally have "ennreal (f x) = (SUP i. ?F i x)" . } + then show "(\\<^sup>+ x. ennreal (f x) \lborel) = (\\<^sup>+ x. (SUP i. ?F i x) \lborel)" + by simp + qed (insert F, auto simp: incseq_def le_fun_def box_def split: split_indicator) + also have "\ \ ennreal I" + proof (rule SUP_least) + fix i :: nat + have finite_F: "(\\<^sup>+ x. ennreal (enn2real (F i x) * indicator (?B i) x) \lborel) < \" + proof (rule nn_integral_bound_simple_function) + have "emeasure lborel {x \ space lborel. ennreal (enn2real (F i x) * indicator (?B i) x) \ 0} \ + emeasure lborel (?B i)" + by (intro emeasure_mono) (auto split: split_indicator) + then show "emeasure lborel {x \ space lborel. ennreal (enn2real (F i x) * indicator (?B i) x) \ 0} < \" + by (auto simp: less_top[symmetric] top_unique) + qed (auto split: split_indicator + intro!: F simple_function_compose1[where g="enn2real"] simple_function_ennreal) + + have int_F: "(\x. enn2real (F i x) * indicator (?B i) x) integrable_on UNIV" + using F(4) finite_F + by (intro nn_integral_integrable_on) (auto split: split_indicator simp: enn2real_nonneg) + + have "(\\<^sup>+ x. F i x * indicator (?B i) x \lborel) = + (\\<^sup>+ x. ennreal (enn2real (F i x) * indicator (?B i) x) \lborel)" + using F(3,4) + by (intro nn_integral_cong) (auto simp: image_iff eq_commute split: split_indicator) + also have "\ = ennreal (integral UNIV (\x. enn2real (F i x) * indicator (?B i) x))" + using F + by (intro nn_integral_lborel_eq_integral[OF _ _ finite_F]) + (auto split: split_indicator intro: enn2real_nonneg) + also have "\ \ ennreal I" + by (auto intro!: has_integral_le[OF integrable_integral[OF int_F] I] nonneg F_le_f + simp: \0 \ I\ split: split_indicator ) + finally show "(\\<^sup>+ x. F i x * indicator (?B i) x \lborel) \ ennreal I" . + qed + finally have "(\\<^sup>+ x. ennreal (f x) \lborel) < \" + by (auto simp: less_top[symmetric] top_unique) + from nn_integral_lborel_eq_integral[OF assms(1,2) this] I show ?thesis + by (simp add: integral_unique) +qed + +lemma has_integral_iff_emeasure_lborel: + fixes A :: "'a::euclidean_space set" + assumes A[measurable]: "A \ sets borel" and [simp]: "0 \ r" + shows "((\x. 1) has_integral r) A \ emeasure lborel A = ennreal r" +proof (cases "emeasure lborel A = \") + case emeasure_A: True + have "\ (\x. 1::real) integrable_on A" + proof + assume int: "(\x. 1::real) integrable_on A" + then have "(indicator A::'a \ real) integrable_on UNIV" + unfolding indicator_def[abs_def] integrable_restrict_univ . + then obtain r where "((indicator A::'a\real) has_integral r) UNIV" + by auto + from nn_integral_has_integral_lborel[OF _ _ this] emeasure_A show False + by (simp add: ennreal_indicator) + qed + with emeasure_A show ?thesis + by auto +next + case False + then have "((\x. 1) has_integral measure lborel A) A" + by (simp add: has_integral_measure_lborel less_top) + with False show ?thesis + by (auto simp: emeasure_eq_ennreal_measure has_integral_unique) +qed + +lemma has_integral_integral_real: + fixes f::"'a::euclidean_space \ real" + assumes f: "integrable lborel f" + shows "(f has_integral (integral\<^sup>L lborel f)) UNIV" +using f proof induct + case (base A c) then show ?case + by (auto intro!: has_integral_mult_left simp: ) + (simp add: emeasure_eq_ennreal_measure indicator_def has_integral_measure_lborel) +next + case (add f g) then show ?case + by (auto intro!: has_integral_add) +next + case (lim f s) + show ?case + proof (rule has_integral_dominated_convergence) + show "\i. (s i has_integral integral\<^sup>L lborel (s i)) UNIV" by fact + show "(\x. norm (2 * f x)) integrable_on UNIV" + using \integrable lborel f\ + by (intro nn_integral_integrable_on) + (auto simp: integrable_iff_bounded abs_mult nn_integral_cmult ennreal_mult ennreal_mult_less_top) + show "\k. \x\UNIV. norm (s k x) \ norm (2 * f x)" + using lim by (auto simp add: abs_mult) + show "\x\UNIV. (\k. s k x) \ f x" + using lim by auto + show "(\k. integral\<^sup>L lborel (s k)) \ integral\<^sup>L lborel f" + using lim lim(1)[THEN borel_measurable_integrable] + by (intro integral_dominated_convergence[where w="\x. 2 * norm (f x)"]) auto + qed +qed + +context + fixes f::"'a::euclidean_space \ 'b::euclidean_space" +begin + +lemma has_integral_integral_lborel: + assumes f: "integrable lborel f" + shows "(f has_integral (integral\<^sup>L lborel f)) UNIV" +proof - + have "((\x. \b\Basis. (f x \ b) *\<^sub>R b) has_integral (\b\Basis. integral\<^sup>L lborel (\x. f x \ b) *\<^sub>R b)) UNIV" + using f by (intro has_integral_setsum finite_Basis ballI has_integral_scaleR_left has_integral_integral_real) auto + also have eq_f: "(\x. \b\Basis. (f x \ b) *\<^sub>R b) = f" + by (simp add: fun_eq_iff euclidean_representation) + also have "(\b\Basis. integral\<^sup>L lborel (\x. f x \ b) *\<^sub>R b) = integral\<^sup>L lborel f" + using f by (subst (2) eq_f[symmetric]) simp + finally show ?thesis . +qed + +lemma integrable_on_lborel: "integrable lborel f \ f integrable_on UNIV" + using has_integral_integral_lborel by auto + +lemma integral_lborel: "integrable lborel f \ integral UNIV f = (\x. f x \lborel)" + using has_integral_integral_lborel by auto + +end + +subsection \Fundamental Theorem of Calculus for the Lebesgue integral\ + +text \ + +For the positive integral we replace continuity with Borel-measurability. + +\ + +lemma + fixes f :: "real \ real" + assumes [measurable]: "f \ borel_measurable borel" + assumes f: "\x. x \ {a..b} \ DERIV F x :> f x" "\x. x \ {a..b} \ 0 \ f x" and "a \ b" + shows nn_integral_FTC_Icc: "(\\<^sup>+x. ennreal (f x) * indicator {a .. b} x \lborel) = F b - F a" (is ?nn) + and has_bochner_integral_FTC_Icc_nonneg: + "has_bochner_integral lborel (\x. f x * indicator {a .. b} x) (F b - F a)" (is ?has) + and integral_FTC_Icc_nonneg: "(\x. f x * indicator {a .. b} x \lborel) = F b - F a" (is ?eq) + and integrable_FTC_Icc_nonneg: "integrable lborel (\x. f x * indicator {a .. b} x)" (is ?int) +proof - + have *: "(\x. f x * indicator {a..b} x) \ borel_measurable borel" "\x. 0 \ f x * indicator {a..b} x" + using f(2) by (auto split: split_indicator) + + have F_mono: "a \ x \ x \ y \ y \ b\ F x \ F y" for x y + using f by (intro DERIV_nonneg_imp_nondecreasing[of x y F]) (auto intro: order_trans) + + have "(f has_integral F b - F a) {a..b}" + by (intro fundamental_theorem_of_calculus) + (auto simp: has_field_derivative_iff_has_vector_derivative[symmetric] + intro: has_field_derivative_subset[OF f(1)] \a \ b\) + then have i: "((\x. f x * indicator {a .. b} x) has_integral F b - F a) UNIV" + unfolding indicator_def if_distrib[where f="\x. a * x" for a] + by (simp cong del: if_weak_cong del: atLeastAtMost_iff) + then have nn: "(\\<^sup>+x. f x * indicator {a .. b} x \lborel) = F b - F a" + by (rule nn_integral_has_integral_lborel[OF *]) + then show ?has + by (rule has_bochner_integral_nn_integral[rotated 3]) (simp_all add: * F_mono \a \ b\) + then show ?eq ?int + unfolding has_bochner_integral_iff by auto + show ?nn + by (subst nn[symmetric]) + (auto intro!: nn_integral_cong simp add: ennreal_mult f split: split_indicator) +qed + +lemma + fixes f :: "real \ 'a :: euclidean_space" + assumes "a \ b" + assumes "\x. a \ x \ x \ b \ (F has_vector_derivative f x) (at x within {a .. b})" + assumes cont: "continuous_on {a .. b} f" + shows has_bochner_integral_FTC_Icc: + "has_bochner_integral lborel (\x. indicator {a .. b} x *\<^sub>R f x) (F b - F a)" (is ?has) + and integral_FTC_Icc: "(\x. indicator {a .. b} x *\<^sub>R f x \lborel) = F b - F a" (is ?eq) +proof - + let ?f = "\x. indicator {a .. b} x *\<^sub>R f x" + have int: "integrable lborel ?f" + using borel_integrable_compact[OF _ cont] by auto + have "(f has_integral F b - F a) {a..b}" + using assms(1,2) by (intro fundamental_theorem_of_calculus) auto + moreover + have "(f has_integral integral\<^sup>L lborel ?f) {a..b}" + using has_integral_integral_lborel[OF int] + unfolding indicator_def if_distrib[where f="\x. x *\<^sub>R a" for a] + by (simp cong del: if_weak_cong del: atLeastAtMost_iff) + ultimately show ?eq + by (auto dest: has_integral_unique) + then show ?has + using int by (auto simp: has_bochner_integral_iff) +qed + +lemma + fixes f :: "real \ real" + assumes "a \ b" + assumes deriv: "\x. a \ x \ x \ b \ DERIV F x :> f x" + assumes cont: "\x. a \ x \ x \ b \ isCont f x" + shows has_bochner_integral_FTC_Icc_real: + "has_bochner_integral lborel (\x. f x * indicator {a .. b} x) (F b - F a)" (is ?has) + and integral_FTC_Icc_real: "(\x. f x * indicator {a .. b} x \lborel) = F b - F a" (is ?eq) +proof - + have 1: "\x. a \ x \ x \ b \ (F has_vector_derivative f x) (at x within {a .. b})" + unfolding has_field_derivative_iff_has_vector_derivative[symmetric] + using deriv by (auto intro: DERIV_subset) + have 2: "continuous_on {a .. b} f" + using cont by (intro continuous_at_imp_continuous_on) auto + show ?has ?eq + using has_bochner_integral_FTC_Icc[OF \a \ b\ 1 2] integral_FTC_Icc[OF \a \ b\ 1 2] + by (auto simp: mult.commute) +qed + +lemma nn_integral_FTC_atLeast: + fixes f :: "real \ real" + assumes f_borel: "f \ borel_measurable borel" + assumes f: "\x. a \ x \ DERIV F x :> f x" + assumes nonneg: "\x. a \ x \ 0 \ f x" + assumes lim: "(F \ T) at_top" + shows "(\\<^sup>+x. ennreal (f x) * indicator {a ..} x \lborel) = T - F a" +proof - + let ?f = "\(i::nat) (x::real). ennreal (f x) * indicator {a..a + real i} x" + let ?fR = "\x. ennreal (f x) * indicator {a ..} x" + + have F_mono: "a \ x \ x \ y \ F x \ F y" for x y + using f nonneg by (intro DERIV_nonneg_imp_nondecreasing[of x y F]) (auto intro: order_trans) + then have F_le_T: "a \ x \ F x \ T" for x + by (intro tendsto_le_const[OF _ lim]) + (auto simp: trivial_limit_at_top_linorder eventually_at_top_linorder) + + have "(SUP i::nat. ?f i x) = ?fR x" for x + proof (rule LIMSEQ_unique[OF LIMSEQ_SUP]) + from reals_Archimedean2[of "x - a"] guess n .. + then have "eventually (\n. ?f n x = ?fR x) sequentially" + by (auto intro!: eventually_sequentiallyI[where c=n] split: split_indicator) + then show "(\n. ?f n x) \ ?fR x" + by (rule Lim_eventually) + qed (auto simp: nonneg incseq_def le_fun_def split: split_indicator) + then have "integral\<^sup>N lborel ?fR = (\\<^sup>+ x. (SUP i::nat. ?f i x) \lborel)" + by simp + also have "\ = (SUP i::nat. (\\<^sup>+ x. ?f i x \lborel))" + proof (rule nn_integral_monotone_convergence_SUP) + show "incseq ?f" + using nonneg by (auto simp: incseq_def le_fun_def split: split_indicator) + show "\i. (?f i) \ borel_measurable lborel" + using f_borel by auto + qed + also have "\ = (SUP i::nat. ennreal (F (a + real i) - F a))" + by (subst nn_integral_FTC_Icc[OF f_borel f nonneg]) auto + also have "\ = T - F a" + proof (rule LIMSEQ_unique[OF LIMSEQ_SUP]) + have "(\x. F (a + real x)) \ T" + apply (rule filterlim_compose[OF lim filterlim_tendsto_add_at_top]) + apply (rule LIMSEQ_const_iff[THEN iffD2, OF refl]) + apply (rule filterlim_real_sequentially) + done + then show "(\n. ennreal (F (a + real n) - F a)) \ ennreal (T - F a)" + by (simp add: F_mono F_le_T tendsto_diff) + qed (auto simp: incseq_def intro!: ennreal_le_iff[THEN iffD2] F_mono) + finally show ?thesis . +qed + +lemma integral_power: + "a \ b \ (\x. x^k * indicator {a..b} x \lborel) = (b^Suc k - a^Suc k) / Suc k" +proof (subst integral_FTC_Icc_real) + fix x show "DERIV (\x. x^Suc k / Suc k) x :> x^k" + by (intro derivative_eq_intros) auto +qed (auto simp: field_simps simp del: of_nat_Suc) + +subsection \Integration by parts\ + +lemma integral_by_parts_integrable: + fixes f g F G::"real \ real" + assumes "a \ b" + assumes cont_f[intro]: "!!x. a \x \ x\b \ isCont f x" + assumes cont_g[intro]: "!!x. a \x \ x\b \ isCont g x" + assumes [intro]: "!!x. DERIV F x :> f x" + assumes [intro]: "!!x. DERIV G x :> g x" + shows "integrable lborel (\x.((F x) * (g x) + (f x) * (G x)) * indicator {a .. b} x)" + by (auto intro!: borel_integrable_atLeastAtMost continuous_intros) (auto intro!: DERIV_isCont) + +lemma integral_by_parts: + fixes f g F G::"real \ real" + assumes [arith]: "a \ b" + assumes cont_f[intro]: "!!x. a \x \ x\b \ isCont f x" + assumes cont_g[intro]: "!!x. a \x \ x\b \ isCont g x" + assumes [intro]: "!!x. DERIV F x :> f x" + assumes [intro]: "!!x. DERIV G x :> g x" + shows "(\x. (F x * g x) * indicator {a .. b} x \lborel) + = F b * G b - F a * G a - \x. (f x * G x) * indicator {a .. b} x \lborel" +proof- + have 0: "(\x. (F x * g x + f x * G x) * indicator {a .. b} x \lborel) = F b * G b - F a * G a" + by (rule integral_FTC_Icc_real, auto intro!: derivative_eq_intros continuous_intros) + (auto intro!: DERIV_isCont) + + have "(\x. (F x * g x + f x * G x) * indicator {a .. b} x \lborel) = + (\x. (F x * g x) * indicator {a .. b} x \lborel) + \x. (f x * G x) * indicator {a .. b} x \lborel" + apply (subst Bochner_Integration.integral_add[symmetric]) + apply (auto intro!: borel_integrable_atLeastAtMost continuous_intros) + by (auto intro!: DERIV_isCont Bochner_Integration.integral_cong split: split_indicator) + + thus ?thesis using 0 by auto +qed + +lemma integral_by_parts': + fixes f g F G::"real \ real" + assumes "a \ b" + assumes "!!x. a \x \ x\b \ isCont f x" + assumes "!!x. a \x \ x\b \ isCont g x" + assumes "!!x. DERIV F x :> f x" + assumes "!!x. DERIV G x :> g x" + shows "(\x. indicator {a .. b} x *\<^sub>R (F x * g x) \lborel) + = F b * G b - F a * G a - \x. indicator {a .. b} x *\<^sub>R (f x * G x) \lborel" + using integral_by_parts[OF assms] by (simp add: ac_simps) + +lemma has_bochner_integral_even_function: + fixes f :: "real \ 'a :: {banach, second_countable_topology}" + assumes f: "has_bochner_integral lborel (\x. indicator {0..} x *\<^sub>R f x) x" + assumes even: "\x. f (- x) = f x" + shows "has_bochner_integral lborel f (2 *\<^sub>R x)" +proof - + have indicator: "\x::real. indicator {..0} (- x) = indicator {0..} x" + by (auto split: split_indicator) + have "has_bochner_integral lborel (\x. indicator {.. 0} x *\<^sub>R f x) x" + by (subst lborel_has_bochner_integral_real_affine_iff[where c="-1" and t=0]) + (auto simp: indicator even f) + with f have "has_bochner_integral lborel (\x. indicator {0..} x *\<^sub>R f x + indicator {.. 0} x *\<^sub>R f x) (x + x)" + by (rule has_bochner_integral_add) + then have "has_bochner_integral lborel f (x + x)" + by (rule has_bochner_integral_discrete_difference[where X="{0}", THEN iffD1, rotated 4]) + (auto split: split_indicator) + then show ?thesis + by (simp add: scaleR_2) +qed + +lemma has_bochner_integral_odd_function: + fixes f :: "real \ 'a :: {banach, second_countable_topology}" + assumes f: "has_bochner_integral lborel (\x. indicator {0..} x *\<^sub>R f x) x" + assumes odd: "\x. f (- x) = - f x" + shows "has_bochner_integral lborel f 0" +proof - + have indicator: "\x::real. indicator {..0} (- x) = indicator {0..} x" + by (auto split: split_indicator) + have "has_bochner_integral lborel (\x. - indicator {.. 0} x *\<^sub>R f x) x" + by (subst lborel_has_bochner_integral_real_affine_iff[where c="-1" and t=0]) + (auto simp: indicator odd f) + from has_bochner_integral_minus[OF this] + have "has_bochner_integral lborel (\x. indicator {.. 0} x *\<^sub>R f x) (- x)" + by simp + with f have "has_bochner_integral lborel (\x. indicator {0..} x *\<^sub>R f x + indicator {.. 0} x *\<^sub>R f x) (x + - x)" + by (rule has_bochner_integral_add) + then have "has_bochner_integral lborel f (x + - x)" + by (rule has_bochner_integral_discrete_difference[where X="{0}", THEN iffD1, rotated 4]) + (auto split: split_indicator) + then show ?thesis + by simp +qed + +end diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Analysis/Henstock_Kurzweil_Integration.thy --- a/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Fri Sep 16 13:56:51 2016 +0200 @@ -6,9 +6,7 @@ theory Henstock_Kurzweil_Integration imports - Derivative - Uniform_Limit - "~~/src/HOL/Library/Indicator_Function" + Lebesgue_Measure begin lemmas scaleR_simps = scaleR_zero_left scaleR_minus_left scaleR_left_diff_distrib @@ -22,122 +20,19 @@ lemma conjunctD3: assumes "a \ b \ c" shows a b c using assms by auto lemma conjunctD4: assumes "a \ b \ c \ d" shows a b c d using assms by auto +lemma cond_cases: "(P \ Q x) \ (\ P \ Q y) \ Q (if P then x else y)" + by auto + declare norm_triangle_ineq4[intro] -lemma simple_image: "{f x |x . x \ s} = f ` s" - by blast - -lemma linear_simps: - assumes "bounded_linear f" - shows - "f (a + b) = f a + f b" - "f (a - b) = f a - f b" - "f 0 = 0" - "f (- a) = - f a" - "f (s *\<^sub>R v) = s *\<^sub>R (f v)" -proof - - interpret f: bounded_linear f by fact - show "f (a + b) = f a + f b" by (rule f.add) - show "f (a - b) = f a - f b" by (rule f.diff) - show "f 0 = 0" by (rule f.zero) - show "f (- a) = - f a" by (rule f.minus) - show "f (s *\<^sub>R v) = s *\<^sub>R (f v)" by (rule f.scaleR) -qed - -lemma bounded_linearI: - assumes "\x y. f (x + y) = f x + f y" - and "\r x. f (r *\<^sub>R x) = r *\<^sub>R f x" - and "\x. norm (f x) \ norm x * K" - shows "bounded_linear f" - using assms by (rule bounded_linear_intro) (* FIXME: duplicate *) - -lemma bounded_linear_component [intro]: "bounded_linear (\x::'a::euclidean_space. x \ k)" - by (rule bounded_linear_inner_left) - -lemma transitive_stepwise_lt_eq: - assumes "(\x y z::nat. R x y \ R y z \ R x z)" - shows "((\m. \n>m. R m n) \ (\n. R n (Suc n)))" - (is "?l = ?r") -proof safe - assume ?r - fix n m :: nat - assume "m < n" - then show "R m n" - proof (induct n arbitrary: m) - case 0 - then show ?case by auto - next - case (Suc n) - show ?case - proof (cases "m < n") - case True - show ?thesis - apply (rule assms[OF Suc(1)[OF True]]) - using \?r\ - apply auto - done - next - case False - then have "m = n" - using Suc(2) by auto - then show ?thesis - using \?r\ by auto - qed - qed -qed auto - -lemma transitive_stepwise_gt: - assumes "\x y z. R x y \ R y z \ R x z" "\n. R n (Suc n)" - shows "\n>m. R m n" -proof - - have "\m. \n>m. R m n" - apply (subst transitive_stepwise_lt_eq) - apply (blast intro: assms)+ - done - then show ?thesis by auto -qed - -lemma transitive_stepwise_le_eq: - assumes "\x. R x x" "\x y z. R x y \ R y z \ R x z" - shows "(\m. \n\m. R m n) \ (\n. R n (Suc n))" - (is "?l = ?r") -proof safe - assume ?r - fix m n :: nat - assume "m \ n" - then show "R m n" - proof (induct n arbitrary: m) - case 0 - with assms show ?case by auto - next - case (Suc n) - show ?case - proof (cases "m \ n") - case True - with Suc.hyps \\n. R n (Suc n)\ assms show ?thesis - by blast - next - case False - then have "m = Suc n" - using Suc(2) by auto - then show ?thesis - using assms(1) by auto - qed - qed -qed auto - lemma transitive_stepwise_le: - assumes "\x. R x x" "\x y z. R x y \ R y z \ R x z" - and "\n. R n (Suc n)" + assumes "\x. R x x" "\x y z. R x y \ R y z \ R x z" and "\n. R n (Suc n)" shows "\n\m. R m n" -proof - - have "\m. \n\m. R m n" - apply (subst transitive_stepwise_le_eq) - apply (blast intro: assms)+ - done - then show ?thesis by auto -qed - +proof (intro allI impI) + show "m \ n \ R m n" for n + by (induction rule: dec_induct) + (use assms in blast)+ +qed subsection \Some useful lemmas about intervals.\ @@ -208,13 +103,28 @@ "finite f \ open s \ \t\f. \a b. t = cbox a b \ \t\f. s \ (interior t) = {} \ s \ interior (\f) = {}" using interior_Union_subset_cbox[of f "UNIV - s"] by auto +lemma interval_split: + fixes a :: "'a::euclidean_space" + assumes "k \ Basis" + shows + "cbox a b \ {x. x\k \ c} = cbox a (\i\Basis. (if i = k then min (b\k) c else b\i) *\<^sub>R i)" + "cbox a b \ {x. x\k \ c} = cbox (\i\Basis. (if i = k then max (a\k) c else a\i) *\<^sub>R i) b" + apply (rule_tac[!] set_eqI) + unfolding Int_iff mem_box mem_Collect_eq + using assms + apply auto + done + +lemma interval_not_empty: "\i\Basis. a\i \ b\i \ cbox a b \ {}" + by (simp add: box_ne_empty) + subsection \Bounds on intervals where they exist.\ definition interval_upperbound :: "('a::euclidean_space) set \ 'a" where "interval_upperbound s = (\i\Basis. (SUP x:s. x\i) *\<^sub>R i)" definition interval_lowerbound :: "('a::euclidean_space) set \ 'a" - where "interval_lowerbound s = (\i\Basis. (INF x:s. x\i) *\<^sub>R i)" + where "interval_lowerbound s = (\i\Basis. (INF x:s. x\i) *\<^sub>R i)" lemma interval_upperbound[simp]: "\i\Basis. a\i \ b\i \ @@ -242,7 +152,6 @@ and "interval_lowerbound (cbox a b) = a" using assms unfolding box_ne_empty by auto - lemma interval_upperbound_Times: assumes "A \ {}" and "B \ {}" shows "interval_upperbound (A \ B) = (interval_upperbound A, interval_upperbound B)" @@ -273,219 +182,83 @@ subsection \Content (length, area, volume...) of an interval.\ -definition "content (s::('a::euclidean_space) set) = - (if s = {} then 0 else (\i\Basis. (interval_upperbound s)\i - (interval_lowerbound s)\i))" - -lemma interval_not_empty: "\i\Basis. a\i \ b\i \ cbox a b \ {}" - unfolding box_eq_empty unfolding not_ex not_less by auto - -lemma content_cbox: - fixes a :: "'a::euclidean_space" - assumes "\i\Basis. a\i \ b\i" - shows "content (cbox a b) = (\i\Basis. b\i - a\i)" - using interval_not_empty[OF assms] - unfolding content_def - by auto - -lemma content_cbox': - fixes a :: "'a::euclidean_space" - assumes "cbox a b \ {}" - shows "content (cbox a b) = (\i\Basis. b\i - a\i)" - using assms box_ne_empty(1) content_cbox by blast +abbreviation content :: "'a::euclidean_space set \ real" + where "content s \ measure lborel s" + +lemma content_cbox_cases: + "content (cbox a b) = (if \i\Basis. a\i \ b\i then setprod (\i. b\i - a\i) Basis else 0)" + by (simp add: measure_lborel_cbox_eq inner_diff) + +lemma content_cbox: "\i\Basis. a\i \ b\i \ content (cbox a b) = (\i\Basis. b\i - a\i)" + unfolding content_cbox_cases by simp + +lemma content_cbox': "cbox a b \ {} \ content (cbox a b) = (\i\Basis. b\i - a\i)" + by (simp add: box_ne_empty inner_diff) lemma content_real: "a \ b \ content {a..b} = b - a" - by (auto simp: interval_upperbound_def interval_lowerbound_def content_def) + by simp lemma abs_eq_content: "\y - x\ = (if x\y then content {x .. y} else content {y..x})" by (auto simp: content_real) -lemma content_singleton[simp]: "content {a} = 0" -proof - - have "content (cbox a a) = 0" - by (subst content_cbox) (auto simp: ex_in_conv) - then show ?thesis by (simp add: cbox_sing) -qed - -lemma content_unit[iff]: "content(cbox 0 (One::'a::euclidean_space)) = 1" - proof - - have *: "\i\Basis. (0::'a)\i \ (One::'a)\i" - by auto - have "0 \ cbox 0 (One::'a)" - unfolding mem_box by auto - then show ?thesis - unfolding content_def interval_bounds[OF *] using setprod.neutral_const by auto - qed - -lemma content_pos_le[intro]: - fixes a::"'a::euclidean_space" - shows "0 \ content (cbox a b)" -proof (cases "cbox a b = {}") - case False - then have *: "\i\Basis. a \ i \ b \ i" - unfolding box_ne_empty . - have "0 \ (\i\Basis. interval_upperbound (cbox a b) \ i - interval_lowerbound (cbox a b) \ i)" - apply (rule setprod_nonneg) - unfolding interval_bounds[OF *] - using * - apply auto - done - also have "\ = content (cbox a b)" using False by (simp add: content_def) - finally show ?thesis . -qed (simp add: content_def) - -corollary content_nonneg [simp]: - fixes a::"'a::euclidean_space" - shows "~ content (cbox a b) < 0" -using not_le by blast - -lemma content_pos_lt: - fixes a :: "'a::euclidean_space" - assumes "\i\Basis. a\i < b\i" - shows "0 < content (cbox a b)" - using assms - by (auto simp: content_def box_eq_empty intro!: setprod_pos) - -lemma content_eq_0: - "content (cbox a b) = 0 \ (\i\Basis. b\i \ a\i)" - by (auto simp: content_def box_eq_empty intro!: setprod_pos bexI) - -lemma cond_cases: "(P \ Q x) \ (\ P \ Q y) \ Q (if P then x else y)" - by auto - -lemma content_cbox_cases: - "content (cbox a (b::'a::euclidean_space)) = - (if \i\Basis. a\i \ b\i then setprod (\i. b\i - a\i) Basis else 0)" - by (auto simp: not_le content_eq_0 intro: less_imp_le content_cbox) +lemma content_singleton: "content {a} = 0" + by simp + +lemma content_unit[iff]: "content (cbox 0 (One::'a::euclidean_space)) = 1" + by simp + +lemma content_pos_le[intro]: "0 \ content (cbox a b)" + by simp + +corollary content_nonneg [simp]: "~ content (cbox a b) < 0" + using not_le by blast + +lemma content_pos_lt: "\i\Basis. a\i < b\i \ 0 < content (cbox a b)" + by (auto simp: less_imp_le inner_diff box_eq_empty intro!: setprod_pos) + +lemma content_eq_0: "content (cbox a b) = 0 \ (\i\Basis. b\i \ a\i)" + by (auto simp: content_cbox_cases not_le intro: less_imp_le antisym eq_refl) lemma content_eq_0_interior: "content (cbox a b) = 0 \ interior(cbox a b) = {}" - unfolding content_eq_0 interior_cbox box_eq_empty - by auto - -lemma content_pos_lt_eq: - "0 < content (cbox a (b::'a::euclidean_space)) \ (\i\Basis. a\i < b\i)" -proof (rule iffI) - assume "0 < content (cbox a b)" - then have "content (cbox a b) \ 0" by auto - then show "\i\Basis. a\i < b\i" - unfolding content_eq_0 not_ex not_le by fastforce -next - assume "\i\Basis. a \ i < b \ i" - then show "0 < content (cbox a b)" - by (metis content_pos_lt) -qed + unfolding content_eq_0 interior_cbox box_eq_empty by auto + +lemma content_pos_lt_eq: "0 < content (cbox a (b::'a::euclidean_space)) \ (\i\Basis. a\i < b\i)" + by (auto simp add: content_cbox_cases less_le setprod_nonneg) lemma content_empty [simp]: "content {} = 0" - unfolding content_def by auto + by simp lemma content_real_if [simp]: "content {a..b} = (if a \ b then b - a else 0)" by (simp add: content_real) -lemma content_subset: - assumes "cbox a b \ cbox c d" - shows "content (cbox a b) \ content (cbox c d)" -proof (cases "cbox a b = {}") - case True - then show ?thesis - using content_pos_le[of c d] by auto -next - case False - then have ab_ne: "\i\Basis. a \ i \ b \ i" - unfolding box_ne_empty by auto - then have ab_ab: "a\cbox a b" "b\cbox a b" - unfolding mem_box by auto - have "cbox c d \ {}" using assms False by auto - then have cd_ne: "\i\Basis. c \ i \ d \ i" - using assms unfolding box_ne_empty by auto - have "\i. i \ Basis \ 0 \ b \ i - a \ i" - using ab_ne by auto - moreover - have "\i. i \ Basis \ b \ i - a \ i \ d \ i - c \ i" - using assms[unfolded subset_eq mem_box,rule_format,OF ab_ab(2)] - assms[unfolded subset_eq mem_box,rule_format,OF ab_ab(1)] - by (metis diff_mono) - ultimately show ?thesis - unfolding content_def interval_bounds[OF ab_ne] interval_bounds[OF cd_ne] - by (simp add: setprod_mono if_not_P[OF False] if_not_P[OF \cbox c d \ {}\]) -qed +lemma content_subset: "cbox a b \ cbox c d \ content (cbox a b) \ content (cbox c d)" + unfolding measure_def + by (intro enn2real_mono emeasure_mono) (auto simp: emeasure_lborel_cbox_eq) lemma content_lt_nz: "0 < content (cbox a b) \ content (cbox a b) \ 0" unfolding content_pos_lt_eq content_eq_0 unfolding not_ex not_le by fastforce -lemma content_times[simp]: "content (A \ B) = content A * content B" -proof (cases "A \ B = {}") - let ?ub1 = "interval_upperbound" and ?lb1 = "interval_lowerbound" - let ?ub2 = "interval_upperbound" and ?lb2 = "interval_lowerbound" - assume nonempty: "A \ B \ {}" - hence "content (A \ B) = (\i\Basis. (?ub1 A, ?ub2 B) \ i - (?lb1 A, ?lb2 B) \ i)" - unfolding content_def by (simp add: interval_upperbound_Times interval_lowerbound_Times) - also have "... = content A * content B" unfolding content_def using nonempty - apply (subst Basis_prod_def, subst setprod.union_disjoint, force, force, force, simp) - apply (subst (1 2) setprod.reindex, auto intro: inj_onI) - done - finally show ?thesis . -qed (auto simp: content_def) - lemma content_Pair: "content (cbox (a,c) (b,d)) = content (cbox a b) * content (cbox c d)" - by (simp add: cbox_Pair_eq) + unfolding measure_lborel_cbox_eq Basis_prod_def + apply (subst setprod.union_disjoint) + apply (auto simp: bex_Un ball_Un) + apply (subst (1 2) setprod.reindex_nontrivial) + apply auto + done lemma content_cbox_pair_eq0_D: "content (cbox (a,c) (b,d)) = 0 \ content (cbox a b) = 0 \ content (cbox c d) = 0" by (simp add: content_Pair) -lemma content_eq_0_gen: - fixes s :: "'a::euclidean_space set" - assumes "bounded s" - shows "content s = 0 \ (\i\Basis. \v. \x \ s. x \ i = v)" (is "_ = ?rhs") -proof safe - assume "content s = 0" then show ?rhs - apply (clarsimp simp: ex_in_conv content_def split: if_split_asm) - apply (rule_tac x=a in bexI) - apply (rule_tac x="interval_lowerbound s \ a" in exI) - apply (clarsimp simp: interval_upperbound_def interval_lowerbound_def) - apply (drule cSUP_eq_cINF_D) - apply (auto simp: bounded_inner_imp_bdd_above [OF assms] bounded_inner_imp_bdd_below [OF assms]) - done -next - fix i a - assume "i \ Basis" "\x\s. x \ i = a" - then show "content s = 0" - apply (clarsimp simp: content_def) - apply (rule_tac x=i in bexI) - apply (auto simp: interval_upperbound_def interval_lowerbound_def) - done -qed - -lemma content_0_subset_gen: - fixes a :: "'a::euclidean_space" - assumes "content t = 0" "s \ t" "bounded t" shows "content s = 0" -proof - - have "bounded s" - using assms by (metis bounded_subset) - then show ?thesis - using assms - by (auto simp: content_eq_0_gen) -qed - -lemma content_0_subset: "\content(cbox a b) = 0; s \ cbox a b\ \ content s = 0" - by (simp add: content_0_subset_gen bounded_cbox) - - -lemma interval_split: - fixes a :: "'a::euclidean_space" - assumes "k \ Basis" - shows - "cbox a b \ {x. x\k \ c} = cbox a (\i\Basis. (if i = k then min (b\k) c else b\i) *\<^sub>R i)" - "cbox a b \ {x. x\k \ c} = cbox (\i\Basis. (if i = k then max (a\k) c else a\i) *\<^sub>R i) b" - apply (rule_tac[!] set_eqI) - unfolding Int_iff mem_box mem_Collect_eq - using assms - apply auto - done +lemma content_0_subset: "content(cbox a b) = 0 \ s \ cbox a b \ content s = 0" + using emeasure_mono[of s "cbox a b" lborel] + by (auto simp: measure_def enn2real_eq_0_iff emeasure_lborel_cbox_eq) lemma content_split: fixes a :: "'a::euclidean_space" assumes "k \ Basis" shows "content (cbox a b) = content(cbox a b \ {x. x\k \ c}) + content(cbox a b \ {x. x\k \ c})" + -- \Prove using measure theory\ proof cases note simps = interval_split[OF assms] content_cbox_cases have *: "Basis = insert k (Basis - {k})" "\x. finite (Basis-{x})" "\x. x\Basis-{x}" @@ -2040,11 +1813,6 @@ "d tagged_division_of (cbox a b) \ setsum (\(x,l). content l) d = content (cbox a b)" unfolding setsum.operative_tagged_division[OF operative_content, symmetric] by blast -lemma - shows real_inner_1_left: "inner 1 x = x" - and real_inner_1_right: "inner x 1 = x" - by simp_all - lemma content_real_eq_0: "content {a .. b::real} = 0 \ a \ b" by (metis atLeastatMost_empty_iff2 content_empty content_real diff_self eq_iff le_cases le_iff_diff_le_0) @@ -3988,8 +3756,7 @@ have "norm (setsum (\l. content l *\<^sub>R c) p) \ (\i\p. norm (content i *\<^sub>R c))" using norm_setsum by blast also have "... \ e * (\i\p. \content i\)" - apply (simp add: setsum_right_distrib[symmetric] mult.commute) - using assms(2) mult_right_mono by blast + by (simp add: setsum_right_distrib[symmetric] mult.commute assms(2) mult_right_mono setsum_nonneg) also have "... \ e * content (cbox a b)" apply (rule mult_left_mono [OF _ e]) apply (simp add: sumeq) @@ -4458,65 +4225,70 @@ assumes "0 < e" and k: "k \ Basis" obtains d where "0 < d" and "content (cbox a b \ {x. \x\k - c\ \ d}) < e" -proof (cases "content (cbox a b) = 0") - case True - then have ce: "content (cbox a b) < e" - by (metis \0 < e\) +proof cases + assume *: "a \ k \ c \ c \ b \ k \ (\j\Basis. a \ j \ b \ j)" + define a' where "a' d = (\j\Basis. (if j = k then max (a\j) (c - d) else a\j) *\<^sub>R j)" for d + define b' where "b' d = (\j\Basis. (if j = k then min (b\j) (c + d) else b\j) *\<^sub>R j)" for d + + have "((\d. \j\Basis. (b' d - a' d) \ j) \ (\j\Basis. (b' 0 - a' 0) \ j)) (at_right 0)" + by (auto simp: b'_def a'_def intro!: tendsto_min tendsto_max tendsto_eq_intros) + also have "(\j\Basis. (b' 0 - a' 0) \ j) = 0" + using k * + by (intro setprod_zero bexI[OF _ k]) + (auto simp: b'_def a'_def inner_diff inner_setsum_left inner_not_same_Basis intro!: setsum.cong) + also have "((\d. \j\Basis. (b' d - a' d) \ j) \ 0) (at_right 0) = + ((\d. content (cbox a b \ {x. \x\k - c\ \ d})) \ 0) (at_right 0)" + proof (intro tendsto_cong eventually_at_rightI) + fix d :: real assume d: "d \ {0<..<1}" + have "cbox a b \ {x. \x\k - c\ \ d} = cbox (a' d) (b' d)" for d + using * d k by (auto simp add: cbox_def set_eq_iff Int_def ball_conj_distrib abs_diff_le_iff a'_def b'_def) + moreover have "j \ Basis \ a' d \ j \ b' d \ j" for j + using * d k by (auto simp: a'_def b'_def) + ultimately show "(\j\Basis. (b' d - a' d) \ j) = content (cbox a b \ {x. \x\k - c\ \ d})" + by simp + qed simp + finally have "((\d. content (cbox a b \ {x. \x \ k - c\ \ d})) \ 0) (at_right 0)" . + from order_tendstoD(2)[OF this \0] + obtain d' where "0 < d'" and d': "\y. y > 0 \ y < d' \ content (cbox a b \ {x. \x \ k - c\ \ y}) < e" + by (subst (asm) eventually_at_right[of _ 1]) auto show ?thesis - apply (rule that[of 1]) - apply simp - unfolding interval_doublesplit[OF k] - apply (rule le_less_trans[OF content_subset ce]) - apply (auto simp: interval_doublesplit[symmetric] k) - done + by (rule that[of "d'/2"], insert \0 d'[of "d'/2"], auto) next - case False - define d where "d = e / 3 / setprod (\i. b\i - a\i) (Basis - {k})" - note False[unfolded content_eq_0 not_ex not_le, rule_format] - then have "\x. x \ Basis \ b\x > a\x" - by (auto simp add:not_le) - then have prod0: "0 < setprod (\i. b\i - a\i) (Basis - {k})" - by (force simp add: setprod_pos field_simps) - then have "d > 0" - using assms - by (auto simp add: d_def field_simps) - then show ?thesis - proof (rule that[of d]) - have *: "Basis = insert k (Basis - {k})" - using k by auto - have less_e: "(min (b \ k) (c + d) - max (a \ k) (c - d)) * (\i\Basis - {k}. b \ i - a \ i) < e" - proof - - have "(min (b \ k) (c + d) - max (a \ k) (c - d)) \ 2 * d" + assume *: "\ (a \ k \ c \ c \ b \ k \ (\j\Basis. a \ j \ b \ j))" + then have "(\j\Basis. b \ j < a \ j) \ (c < a \ k \ b \ k < c)" + by (auto simp: not_le) + show thesis + proof cases + assume "\j\Basis. b \ j < a \ j" + then have [simp]: "cbox a b = {}" + using box_ne_empty(1)[of a b] by auto + show ?thesis + by (rule that[of 1]) (simp_all add: \0) + next + assume "\ (\j\Basis. b \ j < a \ j)" + with * have "c < a \ k \ b \ k < c" + by auto + then show thesis + proof + assume c: "c < a \ k" + moreover have "x \ cbox a b \ c \ x \ k" for x + using k c by (auto simp: cbox_def) + ultimately have "cbox a b \ {x. \x \ k - c\ \ (a \ k - c) / 2} = {}" + using k by (auto simp: cbox_def) + with \0 c that[of "(a \ k - c) / 2"] show ?thesis by auto - also have "\ < e / (\i\Basis - {k}. b \ i - a \ i)" - unfolding d_def - using assms prod0 - by (auto simp add: field_simps) - finally show "(min (b \ k) (c + d) - max (a \ k) (c - d)) * (\i\Basis - {k}. b \ i - a \ i) < e" - unfolding pos_less_divide_eq[OF prod0] . - qed - show "content (cbox a b \ {x. \x \ k - c\ \ d}) < e" - proof (cases "cbox a b \ {x. \x \ k - c\ \ d} = {}") - case True - then show ?thesis - using assms by simp next - case False - then have - "(\i\Basis - {k}. interval_upperbound (cbox a b \ {x. \x \ k - c\ \ d}) \ i - - interval_lowerbound (cbox a b \ {x. \x \ k - c\ \ d}) \ i) - = (\i\Basis - {k}. b\i - a\i)" - by (simp add: box_eq_empty interval_doublesplit[OF k]) - then show "content (cbox a b \ {x. \x \ k - c\ \ d}) < e" - unfolding content_def - using assms False - apply (subst *) - apply (subst setprod.insert) - apply (simp_all add: interval_doublesplit[OF k] box_eq_empty not_less less_e) - done - qed - qed -qed + assume c: "b \ k < c" + moreover have "x \ cbox a b \ x \ k \ c" for x + using k c by (auto simp: cbox_def) + ultimately have "cbox a b \ {x. \x \ k - c\ \ (c - b \ k) / 2} = {}" + using k by (auto simp: cbox_def) + with \0 c that[of "(c - b \ k) / 2"] show ?thesis + by auto + qed + qed +qed + lemma negligible_standard_hyperplane[intro]: fixes k :: "'a::euclidean_space" @@ -5695,6 +5467,7 @@ by auto from fundamental_theorem_of_calculus[rule_format, OF \a \ b\ deriv] have "(i has_integral ?sum b - ?sum a) {a .. b}" + using atLeastatMost_empty'[simp del] by (simp add: i_def g_def Dg_def) also have one: "(- 1) ^ p' * (- 1) ^ p' = (1::real)" @@ -6036,7 +5809,7 @@ done show ?thesis using False - apply (simp add: abs_eq_content del: content_real_if) + apply (simp add: abs_eq_content del: content_real_if measure_lborel_Icc) apply (rule has_integral_bound_real[where f="(\u. f u - f x)"]) using yx False d x y \e>0\ apply (auto simp add: Idiff fux_int) done @@ -6054,7 +5827,7 @@ done have "norm (integral {a..x} f - integral {a..y} f - (x - y) *\<^sub>R f x) \ e * \y - x\" using True - apply (simp add: abs_eq_content del: content_real_if) + apply (simp add: abs_eq_content del: content_real_if measure_lborel_Icc) apply (rule has_integral_bound_real[where f="(\u. f u - f x)"]) using yx True d x y \e>0\ apply (auto simp add: Idiff fux_int) done @@ -6274,6 +6047,62 @@ subsection \Special case of a basic affine transformation.\ +lemma AE_lborel_inner_neq: + assumes k: "k \ Basis" + shows "AE x in lborel. x \ k \ c" +proof - + interpret finite_product_sigma_finite "\_. lborel" Basis + proof qed simp + + have "emeasure lborel {x\space lborel. x \ k = c} = emeasure (\\<^sub>M j::'a\Basis. lborel) (\\<^sub>E j\Basis. if j = k then {c} else UNIV)" + using k + by (auto simp add: lborel_eq[where 'a='a] emeasure_distr intro!: arg_cong2[where f=emeasure]) + (auto simp: space_PiM PiE_iff extensional_def split: if_split_asm) + also have "\ = (\j\Basis. emeasure lborel (if j = k then {c} else UNIV))" + by (intro measure_times) auto + also have "\ = 0" + by (intro setprod_zero bexI[OF _ k]) auto + finally show ?thesis + by (subst AE_iff_measurable[OF _ refl]) auto +qed + +lemma content_image_stretch_interval: + fixes m :: "'a::euclidean_space \ real" + defines "s f x \ (\k::'a\Basis. (f k * (x\k)) *\<^sub>R k)" + shows "content (s m ` cbox a b) = \\k\Basis. m k\ * content (cbox a b)" +proof cases + have s[measurable]: "s f \ borel \\<^sub>M borel" for f + by (auto simp: s_def[abs_def]) + assume m: "\k\Basis. m k \ 0" + then have s_comp_s: "s (\k. 1 / m k) \ s m = id" "s m \ s (\k. 1 / m k) = id" + by (auto simp: s_def[abs_def] fun_eq_iff euclidean_representation) + then have "inv (s (\k. 1 / m k)) = s m" "bij (s (\k. 1 / m k))" + by (auto intro: inv_unique_comp o_bij) + then have eq: "s m ` cbox a b = s (\k. 1 / m k) -` cbox a b" + using bij_vimage_eq_inv_image[OF \bij (s (\k. 1 / m k))\, of "cbox a b"] by auto + show ?thesis + using m unfolding eq measure_def + by (subst lborel_affine_euclidean[where c=m and t=0]) + (simp_all add: emeasure_density measurable_sets_borel[OF s] abs_setprod nn_integral_cmult + s_def[symmetric] emeasure_distr vimage_comp s_comp_s enn2real_mult setprod_nonneg) +next + assume "\ (\k\Basis. m k \ 0)" + then obtain k where k: "k \ Basis" "m k = 0" by auto + then have [simp]: "(\k\Basis. m k) = 0" + by (intro setprod_zero) auto + have "emeasure lborel {x\space lborel. x \ s m ` cbox a b} = 0" + proof (rule emeasure_eq_0_AE) + show "AE x in lborel. x \ s m ` cbox a b" + using AE_lborel_inner_neq[OF \k\Basis\] + proof eventually_elim + show "x \ k \ 0 \ x \ s m ` cbox a b " for x + using k by (auto simp: s_def[abs_def] cbox_def) + qed + qed + then show ?thesis + by (simp add: measure_def) +qed + lemma interval_image_affinity_interval: "\u v. (\x. m *\<^sub>R (x::'a::euclidean_space) + c) ` cbox a b = cbox u v" unfolding image_affinity_cbox @@ -6344,43 +6173,6 @@ subsection \Special case of stretching coordinate axes separately.\ -lemma content_image_stretch_interval: - "content ((\x::'a::euclidean_space. (\k\Basis. (m k * (x\k))*\<^sub>R k)::'a) ` cbox a b) = - \setprod m Basis\ * content (cbox a b)" -proof (cases "cbox a b = {}") - case True - then show ?thesis - unfolding content_def image_is_empty image_stretch_interval if_P[OF True] by auto -next - case False - then have "(\x. (\k\Basis. (m k * (x\k))*\<^sub>R k)) ` cbox a b \ {}" - by auto - then show ?thesis - using False - unfolding content_def image_stretch_interval - apply - - unfolding interval_bounds' if_not_P - unfolding abs_setprod setprod.distrib[symmetric] - apply (rule setprod.cong) - apply (rule refl) - unfolding lessThan_iff - apply (simp only: inner_setsum_left_Basis) - proof - - fix i :: 'a - assume i: "i \ Basis" - have "(m i < 0 \ m i > 0) \ m i = 0" - by auto - then show "max (m i * (a \ i)) (m i * (b \ i)) - min (m i * (a \ i)) (m i * (b \ i)) = - \m i\ * (b \ i - a \ i)" - apply - - apply (erule disjE)+ - unfolding min_def max_def - using False[unfolded box_ne_empty,rule_format,of i] i - apply (auto simp add:field_simps not_le mult_le_cancel_left_neg mult_le_cancel_left_pos) - done - qed -qed - lemma has_integral_stretch: fixes f :: "'a::euclidean_space \ 'b::real_normed_vector" assumes "(f has_integral i) (cbox a b)" @@ -9324,7 +9116,7 @@ proof (rule, goal_cases) case prems: (1 x) have "e / (4 * content (cbox a b)) > 0" - using \e>0\ False content_pos_le[of a b] by auto + using \e>0\ False content_pos_le[of a b] by (simp add: less_le) from assms(3)[rule_format, OF prems, THEN LIMSEQ_D, OF this] guess n .. note n=this then show ?case @@ -10314,7 +10106,7 @@ done also have "\ = (\k\{k \ l |l. l \ snd ` p}. norm (integral k f))" apply (rule setsum.mono_neutral_left) - apply (subst simple_image) + apply (subst Setcompr_eq_image) apply (rule finite_imageI)+ apply fact unfolding d'_def uv @@ -10330,7 +10122,7 @@ using l by auto qed also have "\ = (\l\snd ` p. norm (integral (k \ l) f))" - unfolding simple_image + unfolding Setcompr_eq_image apply (rule setsum.reindex_nontrivial [unfolded o_def]) apply (rule finite_imageI) apply (rule p') @@ -10518,7 +10310,7 @@ apply auto done also have "\ = setsum content {k \ cbox u v| k. k \ d}" - unfolding simple_image + unfolding Setcompr_eq_image apply (rule setsum.reindex_nontrivial [unfolded o_def, symmetric]) apply (rule d') proof goal_cases @@ -10539,7 +10331,7 @@ qed also have "\ = setsum content {cbox u v \ k |k. k \ d \ cbox u v \ k \ {}}" apply (rule setsum.mono_neutral_right) - unfolding simple_image + unfolding Setcompr_eq_image apply (rule finite_imageI) apply (rule d') apply blast @@ -11394,7 +11186,7 @@ also have "\ < e' * norm (x - x0)" using \e' > 0\ content_pos_le[of a b] by (intro mult_strict_right_mono[OF _ \0 < norm (x - x0)\]) - (auto simp: divide_simps e_def) + (auto simp: divide_simps e_def simp del: measure_nonneg) finally have "norm (?F x - ?F x0 - ?dF (x - x0)) < e' * norm (x - x0)" . then show ?case by (auto simp: divide_simps) @@ -11509,7 +11301,7 @@ with \e > 0\ have "e' > 0" by simp then have "\\<^sub>F n in F. \x\cbox a b. norm (f n x - g x) < e' / content (cbox a b)" using u content_nonzero content_pos_le[of a b] - by (auto simp: uniform_limit_iff dist_norm) + by (auto simp: uniform_limit_iff dist_norm simp del: measure_nonneg) then show "\\<^sub>F n in F. dist (I n) J < e" proof eventually_elim case (elim n) @@ -11568,7 +11360,7 @@ fix k :: nat show "norm (integral s (\x. Inf {f j x |j. j \ {m..m + k}})) \ integral s h" apply (rule integral_norm_bound_integral) - unfolding simple_image + unfolding Setcompr_eq_image apply (rule absolutely_integrable_onD) apply (rule absolutely_integrable_inf_real) prefer 5 @@ -11585,7 +11377,7 @@ qed fix k :: nat show "(\x. Inf {f j x |j. j \ {m..m + k}}) integrable_on s" - unfolding simple_image + unfolding Setcompr_eq_image apply (rule absolutely_integrable_onD) apply (rule absolutely_integrable_inf_real) prefer 3 @@ -11638,7 +11430,7 @@ proof safe fix k :: nat show "norm (integral s (\x. Sup {f j x |j. j \ {m..m + k}})) \ integral s h" - apply (rule integral_norm_bound_integral) unfolding simple_image + apply (rule integral_norm_bound_integral) unfolding Setcompr_eq_image apply (rule absolutely_integrable_onD) apply(rule absolutely_integrable_sup_real) prefer 5 unfolding real_norm_def @@ -11656,7 +11448,7 @@ qed fix k :: nat show "(\x. Sup {f j x |j. j \ {m..m + k}}) integrable_on s" - unfolding simple_image + unfolding Setcompr_eq_image apply (rule absolutely_integrable_onD) apply (rule absolutely_integrable_sup_real) prefer 3 @@ -12541,11 +12333,11 @@ define f :: "nat \ real \ real" where "f = (\n x. if x \ {a..n} then x powr e else 0)" define F where "F = (\x. x powr (e + 1) / (e + 1))" - have has_integral_f: "(f n has_integral (F n - F a)) {a..}" + have has_integral_f: "(f n has_integral (F n - F a)) {a..}" if n: "n \ a" for n :: nat proof - from n assms have "((\x. x powr e) has_integral (F n - F a)) {a..n}" - by (intro fundamental_theorem_of_calculus) (auto intro!: derivative_eq_intros + by (intro fundamental_theorem_of_calculus) (auto intro!: derivative_eq_intros simp: has_field_derivative_iff_has_vector_derivative [symmetric] F_def) hence "(f n has_integral (F n - F a)) {a..n}" by (rule has_integral_eq [rotated]) (simp add: f_def) @@ -12559,12 +12351,12 @@ next case False have "(f n has_integral 0) {a}" by (rule has_integral_refl) - hence "(f n has_integral 0) {a..}" + hence "(f n has_integral 0) {a..}" by (rule has_integral_on_superset [rotated 2]) (insert False, simp_all add: f_def) with False show ?thesis by (simp add: integral_unique) qed - - have *: "(\x. x powr e) integrable_on {a..} \ + + have *: "(\x. x powr e) integrable_on {a..} \ (\n. integral {a..} (f n)) \ integral {a..} (\x. x powr e)" proof (intro monotone_convergence_increasing allI ballI) fix n :: nat @@ -12582,7 +12374,7 @@ from filterlim_real_sequentially have "eventually (\n. real n \ x) at_top" by (simp add: filterlim_at_top) - with x have "eventually (\n. f n x = x powr e) at_top" + with x have "eventually (\n. f n x = x powr e) at_top" by (auto elim!: eventually_mono simp: f_def) thus "(\n. f n x) \ x powr e" by (simp add: Lim_eventually) next @@ -12603,11 +12395,11 @@ hence "eventually (\n. F n - F a = integral {a..} (f n)) at_top" by eventually_elim (simp add: integral_f) moreover have "(\n. F n - F a) \ 0 / (e + 1) - F a" unfolding F_def - by (insert assms, (rule tendsto_intros filterlim_compose[OF tendsto_neg_powr] + by (insert assms, (rule tendsto_intros filterlim_compose[OF tendsto_neg_powr] filterlim_ident filterlim_real_sequentially | simp)+) hence "(\n. F n - F a) \ -F a" by simp ultimately have "(\n. integral {a..} (f n)) \ -F a" by (rule Lim_transform_eventually) - from conjunct2[OF *] and this + from conjunct2[OF *] and this have "integral {a..} (\x. x powr e) = -F a" by (rule LIMSEQ_unique) with conjunct1[OF *] show ?thesis by (simp add: has_integral_integral F_def) @@ -12620,7 +12412,7 @@ proof - from assms have "real_of_int (-int n) < -1" by simp note has_integral_powr_to_inf[OF this \a > 0\] - also have "- (a powr (real_of_int (- int n) + 1)) / (real_of_int (- int n) + 1) = + also have "- (a powr (real_of_int (- int n) + 1)) / (real_of_int (- int n) + 1) = 1 / (real (n - 1) * a powr (real (n - 1)))" using assms by (simp add: divide_simps powr_add [symmetric] of_nat_diff) also from assms have "a powr (real (n - 1)) = a ^ (n - 1)" @@ -12630,4 +12422,33 @@ (insert assms, simp_all add: powr_minus powr_realpow divide_simps) qed +subsubsection \Adaption to ordered Euclidean spaces and the Cartesian Euclidean space\ + +lemma integral_component_eq_cart[simp]: + fixes f :: "'n::euclidean_space \ real^'m" + assumes "f integrable_on s" + shows "integral s (\x. f x $ k) = integral s f $ k" + using integral_linear[OF assms(1) bounded_linear_component_cart,unfolded o_def] . + +lemma content_closed_interval: + fixes a :: "'a::ordered_euclidean_space" + assumes "a \ b" + shows "content {a .. b} = (\i\Basis. b\i - a\i)" + using content_cbox[of a b] assms + by (simp add: cbox_interval eucl_le[where 'a='a]) + +lemma integrable_const_ivl[intro]: + fixes a::"'a::ordered_euclidean_space" + shows "(\x. c) integrable_on {a .. b}" + unfolding cbox_interval[symmetric] + by (rule integrable_const) + +lemma integrable_on_subinterval: + fixes f :: "'n::ordered_euclidean_space \ 'a::banach" + assumes "f integrable_on s" + and "{a .. b} \ s" + shows "f integrable_on {a .. b}" + using integrable_on_subcbox[of f s a b] assms + by (simp add: cbox_interval) + end diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Analysis/Interval_Integral.thy --- a/src/HOL/Analysis/Interval_Integral.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Analysis/Interval_Integral.thy Fri Sep 16 13:56:51 2016 +0200 @@ -311,7 +311,7 @@ ereal_uminus_le_reorder ereal_uminus_less_reorder not_less uminus_ereal.simps[symmetric] simp del: uminus_ereal.simps - intro!: integral_cong + intro!: Bochner_Integration.integral_cong split: split_indicator) qed diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Analysis/Lebesgue_Measure.thy --- a/src/HOL/Analysis/Lebesgue_Measure.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Analysis/Lebesgue_Measure.thy Fri Sep 16 13:56:51 2016 +0200 @@ -469,6 +469,10 @@ "emeasure lborel (box l u) = (if \b\Basis. l \ b \ u \ b then \b\Basis. (u - l) \ b else 0)" using box_eq_empty(1)[THEN iffD2, of u l] by (auto simp: not_le dest!: less_imp_le) force +lemma emeasure_lborel_singleton[simp]: "emeasure lborel {x} = 0" + using emeasure_lborel_cbox[of x x] nonempty_Basis + by (auto simp del: emeasure_lborel_cbox nonempty_Basis simp add: cbox_sing setprod_constant) + lemma fixes l u :: real assumes [simp]: "l \ u" @@ -484,6 +488,17 @@ and measure_lborel_cbox[simp]: "measure lborel (cbox l u) = (\b\Basis. (u - l) \ b)" by (simp_all add: measure_def inner_diff_left setprod_nonneg) +lemma measure_lborel_cbox_eq: + "measure lborel (cbox l u) = (if \b\Basis. l \ b \ u \ b then \b\Basis. (u - l) \ b else 0)" + using box_eq_empty(2)[THEN iffD2, of u l] by (auto simp: not_le) + +lemma measure_lborel_box_eq: + "measure lborel (box l u) = (if \b\Basis. l \ b \ u \ b then \b\Basis. (u - l) \ b else 0)" + using box_eq_empty(1)[THEN iffD2, of u l] by (auto simp: not_le dest!: less_imp_le) force + +lemma measure_lborel_singleton[simp]: "measure lborel {x} = 0" + by (simp add: measure_def) + lemma sigma_finite_lborel: "sigma_finite_measure lborel" proof show "\A::'a set set. countable A \ A \ sets lborel \ \A = space lborel \ (\a\A. emeasure lborel a \ \)" @@ -516,10 +531,6 @@ done qed -lemma emeasure_lborel_singleton[simp]: "emeasure lborel {x} = 0" - using emeasure_lborel_cbox[of x x] nonempty_Basis - by (auto simp del: emeasure_lborel_cbox nonempty_Basis simp add: cbox_sing setprod_constant) - lemma emeasure_lborel_countable: fixes A :: "'a::euclidean_space set" assumes "countable A" @@ -572,46 +583,38 @@ { fix i show "emeasure lborel (?A i) \ \" by auto } { fix X assume "X \ ?E" then show "emeasure lborel X = emeasure M X" - apply (auto simp: emeasure_eq emeasure_lborel_box_eq ) + apply (auto simp: emeasure_eq emeasure_lborel_box_eq) apply (subst box_eq_empty(1)[THEN iffD2]) apply (auto intro: less_imp_le simp: not_le) done } qed -lemma lborel_affine: - fixes t :: "'a::euclidean_space" assumes "c \ 0" - shows "lborel = density (distr lborel borel (\x. t + c *\<^sub>R x)) (\_. \c\^DIM('a))" (is "_ = ?D") +lemma lborel_affine_euclidean: + fixes c :: "'a::euclidean_space \ real" and t + defines "T x \ t + (\j\Basis. (c j * (x \ j)) *\<^sub>R j)" + assumes c: "\j. j \ Basis \ c j \ 0" + shows "lborel = density (distr lborel borel T) (\_. (\j\Basis. \c j\))" (is "_ = ?D") proof (rule lborel_eqI) let ?B = "Basis :: 'a set" fix l u assume le: "\b. b \ ?B \ l \ b \ u \ b" - show "emeasure ?D (box l u) = (\b\?B. (u - l) \ b)" - proof cases - assume "0 < c" - then have "(\x. t + c *\<^sub>R x) -` box l u = box ((l - t) /\<^sub>R c) ((u - t) /\<^sub>R c)" - by (auto simp: field_simps box_def inner_simps) - with \0 < c\ show ?thesis - using le - by (auto simp: field_simps inner_simps setprod_dividef setprod_constant setprod_nonneg - ennreal_mult[symmetric] emeasure_density nn_integral_distr emeasure_distr - nn_integral_cmult emeasure_lborel_box_eq borel_measurable_indicator') - next - assume "\ 0 < c" with \c \ 0\ have "c < 0" by auto - then have "box ((u - t) /\<^sub>R c) ((l - t) /\<^sub>R c) = (\x. t + c *\<^sub>R x) -` box l u" - by (auto simp: field_simps box_def inner_simps) - then have *: "\x. indicator (box l u) (t + c *\<^sub>R x) = (indicator (box ((u - t) /\<^sub>R c) ((l - t) /\<^sub>R c)) x :: ennreal)" - by (auto split: split_indicator) - have **: "(\x\Basis. (l \ x - u \ x) / c) = (\x\Basis. u \ x - l \ x) / (-c) ^ card (Basis::'a set)" - using \c < 0\ - by (auto simp add: field_simps setprod_dividef[symmetric] setprod_constant[symmetric] - intro!: setprod.cong) - show ?thesis - using \c < 0\ le - by (auto simp: * ** field_simps emeasure_density nn_integral_distr nn_integral_cmult - emeasure_lborel_box_eq inner_simps setprod_nonneg ennreal_mult[symmetric] - borel_measurable_indicator') - qed + have [measurable]: "T \ borel \\<^sub>M borel" + by (simp add: T_def[abs_def]) + have eq: "T -` box l u = box + (\j\Basis. (((if 0 < c j then l - t else u - t) \ j) / c j) *\<^sub>R j) + (\j\Basis. (((if 0 < c j then u - t else l - t) \ j) / c j) *\<^sub>R j)" + using c by (auto simp: box_def T_def field_simps inner_simps divide_less_eq) + with le c show "emeasure ?D (box l u) = (\b\?B. (u - l) \ b)" + by (auto simp: emeasure_density emeasure_distr nn_integral_multc emeasure_lborel_box_eq inner_simps + field_simps divide_simps ennreal_mult'[symmetric] setprod_nonneg setprod.distrib[symmetric] + intro!: setprod.cong) qed simp +lemma lborel_affine: + fixes t :: "'a::euclidean_space" + shows "c \ 0 \ lborel = density (distr lborel borel (\x. t + c *\<^sub>R x)) (\_. \c\^DIM('a))" + using lborel_affine_euclidean[where c="\_::'a. c" and t=t] + unfolding scaleR_scaleR[symmetric] scaleR_setsum_right[symmetric] euclidean_representation setprod_constant by simp + lemma lborel_real_affine: "c \ 0 \ lborel = density (distr lborel borel (\x. t + c * x)) (\_. ennreal (abs c))" using lborel_affine[of c t] by simp @@ -726,378 +729,6 @@ lemma lborelD_Collect[measurable (raw)]: "{x\space borel. P x} \ sets borel \ {x\space lborel. P x} \ sets lborel" by simp lemma lborelD[measurable (raw)]: "A \ sets borel \ A \ sets lborel" by simp -subsection \Equivalence Lebesgue integral on @{const lborel} and HK-integral\ - -lemma has_integral_measure_lborel: - fixes A :: "'a::euclidean_space set" - assumes A[measurable]: "A \ sets borel" and finite: "emeasure lborel A < \" - shows "((\x. 1) has_integral measure lborel A) A" -proof - - { fix l u :: 'a - have "((\x. 1) has_integral measure lborel (box l u)) (box l u)" - proof cases - assume "\b\Basis. l \ b \ u \ b" - then show ?thesis - apply simp - apply (subst has_integral_restrict[symmetric, OF box_subset_cbox]) - apply (subst has_integral_spike_interior_eq[where g="\_. 1"]) - using has_integral_const[of "1::real" l u] - apply (simp_all add: inner_diff_left[symmetric] content_cbox_cases) - done - next - assume "\ (\b\Basis. l \ b \ u \ b)" - then have "box l u = {}" - unfolding box_eq_empty by (auto simp: not_le intro: less_imp_le) - then show ?thesis - by simp - qed } - note has_integral_box = this - - { fix a b :: 'a let ?M = "\A. measure lborel (A \ box a b)" - have "Int_stable (range (\(a, b). box a b))" - by (auto simp: Int_stable_def box_Int_box) - moreover have "(range (\(a, b). box a b)) \ Pow UNIV" - by auto - moreover have "A \ sigma_sets UNIV (range (\(a, b). box a b))" - using A unfolding borel_eq_box by simp - ultimately have "((\x. 1) has_integral ?M A) (A \ box a b)" - proof (induction rule: sigma_sets_induct_disjoint) - case (basic A) then show ?case - by (auto simp: box_Int_box has_integral_box) - next - case empty then show ?case - by simp - next - case (compl A) - then have [measurable]: "A \ sets borel" - by (simp add: borel_eq_box) - - have "((\x. 1) has_integral ?M (box a b)) (box a b)" - by (simp add: has_integral_box) - moreover have "((\x. if x \ A \ box a b then 1 else 0) has_integral ?M A) (box a b)" - by (subst has_integral_restrict) (auto intro: compl) - ultimately have "((\x. 1 - (if x \ A \ box a b then 1 else 0)) has_integral ?M (box a b) - ?M A) (box a b)" - by (rule has_integral_sub) - then have "((\x. (if x \ (UNIV - A) \ box a b then 1 else 0)) has_integral ?M (box a b) - ?M A) (box a b)" - by (rule has_integral_cong[THEN iffD1, rotated 1]) auto - then have "((\x. 1) has_integral ?M (box a b) - ?M A) ((UNIV - A) \ box a b)" - by (subst (asm) has_integral_restrict) auto - also have "?M (box a b) - ?M A = ?M (UNIV - A)" - by (subst measure_Diff[symmetric]) (auto simp: emeasure_lborel_box_eq Diff_Int_distrib2) - finally show ?case . - next - case (union F) - then have [measurable]: "\i. F i \ sets borel" - by (simp add: borel_eq_box subset_eq) - have "((\x. if x \ UNION UNIV F \ box a b then 1 else 0) has_integral ?M (\i. F i)) (box a b)" - proof (rule has_integral_monotone_convergence_increasing) - let ?f = "\k x. \i F i \ box a b then 1 else 0 :: real" - show "\k. (?f k has_integral (\ik x. ?f k x \ ?f (Suc k) x" - by (intro setsum_mono2) auto - from union(1) have *: "\x i j. x \ F i \ x \ F j \ j = i" - by (auto simp add: disjoint_family_on_def) - show "\x. (\k. ?f k x) \ (if x \ UNION UNIV F \ box a b then 1 else 0)" - apply (auto simp: * setsum.If_cases Iio_Int_singleton) - apply (rule_tac k="Suc xa" in LIMSEQ_offset) - apply simp - done - have *: "emeasure lborel ((\x. F x) \ box a b) \ emeasure lborel (box a b)" - by (intro emeasure_mono) auto - - with union(1) show "(\k. \i ?M (\i. F i)" - unfolding sums_def[symmetric] UN_extend_simps - by (intro measure_UNION) (auto simp: disjoint_family_on_def emeasure_lborel_box_eq top_unique) - qed - then show ?case - by (subst (asm) has_integral_restrict) auto - qed } - note * = this - - show ?thesis - proof (rule has_integral_monotone_convergence_increasing) - let ?B = "\n::nat. box (- real n *\<^sub>R One) (real n *\<^sub>R One) :: 'a set" - let ?f = "\n::nat. \x. if x \ A \ ?B n then 1 else 0 :: real" - let ?M = "\n. measure lborel (A \ ?B n)" - - show "\n::nat. (?f n has_integral ?M n) A" - using * by (subst has_integral_restrict) simp_all - show "\k x. ?f k x \ ?f (Suc k) x" - by (auto simp: box_def) - { fix x assume "x \ A" - moreover have "(\k. indicator (A \ ?B k) x :: real) \ indicator (\k::nat. A \ ?B k) x" - by (intro LIMSEQ_indicator_incseq) (auto simp: incseq_def box_def) - ultimately show "(\k. if x \ A \ ?B k then 1 else 0::real) \ 1" - by (simp add: indicator_def UN_box_eq_UNIV) } - - have "(\n. emeasure lborel (A \ ?B n)) \ emeasure lborel (\n::nat. A \ ?B n)" - by (intro Lim_emeasure_incseq) (auto simp: incseq_def box_def) - also have "(\n. emeasure lborel (A \ ?B n)) = (\n. measure lborel (A \ ?B n))" - proof (intro ext emeasure_eq_ennreal_measure) - fix n have "emeasure lborel (A \ ?B n) \ emeasure lborel (?B n)" - by (intro emeasure_mono) auto - then show "emeasure lborel (A \ ?B n) \ top" - by (auto simp: top_unique) - qed - finally show "(\n. measure lborel (A \ ?B n)) \ measure lborel A" - using emeasure_eq_ennreal_measure[of lborel A] finite - by (simp add: UN_box_eq_UNIV less_top) - qed -qed - -lemma nn_integral_has_integral: - fixes f::"'a::euclidean_space \ real" - assumes f: "f \ borel_measurable borel" "\x. 0 \ f x" "(\\<^sup>+x. f x \lborel) = ennreal r" "0 \ r" - shows "(f has_integral r) UNIV" -using f proof (induct f arbitrary: r rule: borel_measurable_induct_real) - case (set A) - then have "((\x. 1) has_integral measure lborel A) A" - by (intro has_integral_measure_lborel) (auto simp: ennreal_indicator) - with set show ?case - by (simp add: ennreal_indicator measure_def) (simp add: indicator_def) -next - case (mult g c) - then have "ennreal c * (\\<^sup>+ x. g x \lborel) = ennreal r" - by (subst nn_integral_cmult[symmetric]) (auto simp: ennreal_mult) - with \0 \ r\ \0 \ c\ - obtain r' where "(c = 0 \ r = 0) \ (0 \ r' \ (\\<^sup>+ x. ennreal (g x) \lborel) = ennreal r' \ r = c * r')" - by (cases "\\<^sup>+ x. ennreal (g x) \lborel" rule: ennreal_cases) - (auto split: if_split_asm simp: ennreal_mult_top ennreal_mult[symmetric]) - with mult show ?case - by (auto intro!: has_integral_cmult_real) -next - case (add g h) - then have "(\\<^sup>+ x. h x + g x \lborel) = (\\<^sup>+ x. h x \lborel) + (\\<^sup>+ x. g x \lborel)" - by (simp add: nn_integral_add) - with add obtain a b where "0 \ a" "0 \ b" "(\\<^sup>+ x. h x \lborel) = ennreal a" "(\\<^sup>+ x. g x \lborel) = ennreal b" "r = a + b" - by (cases "\\<^sup>+ x. h x \lborel" "\\<^sup>+ x. g x \lborel" rule: ennreal2_cases) - (auto simp: add_top nn_integral_add top_add ennreal_plus[symmetric] simp del: ennreal_plus) - with add show ?case - by (auto intro!: has_integral_add) -next - case (seq U) - note seq(1)[measurable] and f[measurable] - - { fix i x - have "U i x \ f x" - using seq(5) - apply (rule LIMSEQ_le_const) - using seq(4) - apply (auto intro!: exI[of _ i] simp: incseq_def le_fun_def) - done } - note U_le_f = this - - { fix i - have "(\\<^sup>+x. U i x \lborel) \ (\\<^sup>+x. f x \lborel)" - using seq(2) f(2) U_le_f by (intro nn_integral_mono) simp - then obtain p where "(\\<^sup>+x. U i x \lborel) = ennreal p" "p \ r" "0 \ p" - using seq(6) \0\r\ by (cases "\\<^sup>+x. U i x \lborel" rule: ennreal_cases) (auto simp: top_unique) - moreover note seq - ultimately have "\p. (\\<^sup>+x. U i x \lborel) = ennreal p \ 0 \ p \ p \ r \ (U i has_integral p) UNIV" - by auto } - then obtain p where p: "\i. (\\<^sup>+x. ennreal (U i x) \lborel) = ennreal (p i)" - and bnd: "\i. p i \ r" "\i. 0 \ p i" - and U_int: "\i.(U i has_integral (p i)) UNIV" by metis - - have int_eq: "\i. integral UNIV (U i) = p i" using U_int by (rule integral_unique) - - have *: "f integrable_on UNIV \ (\k. integral UNIV (U k)) \ integral UNIV f" - proof (rule monotone_convergence_increasing) - show "\k. U k integrable_on UNIV" using U_int by auto - show "\k. \x\UNIV. U k x \ U (Suc k) x" using \incseq U\ by (auto simp: incseq_def le_fun_def) - then show "bounded {integral UNIV (U k) |k. True}" - using bnd int_eq by (auto simp: bounded_real intro!: exI[of _ r]) - show "\x\UNIV. (\k. U k x) \ f x" - using seq by auto - qed - moreover have "(\i. (\\<^sup>+x. U i x \lborel)) \ (\\<^sup>+x. f x \lborel)" - using seq f(2) U_le_f by (intro nn_integral_dominated_convergence[where w=f]) auto - ultimately have "integral UNIV f = r" - by (auto simp add: bnd int_eq p seq intro: LIMSEQ_unique) - with * show ?case - by (simp add: has_integral_integral) -qed - -lemma nn_integral_lborel_eq_integral: - fixes f::"'a::euclidean_space \ real" - assumes f: "f \ borel_measurable borel" "\x. 0 \ f x" "(\\<^sup>+x. f x \lborel) < \" - shows "(\\<^sup>+x. f x \lborel) = integral UNIV f" -proof - - from f(3) obtain r where r: "(\\<^sup>+x. f x \lborel) = ennreal r" "0 \ r" - by (cases "\\<^sup>+x. f x \lborel" rule: ennreal_cases) auto - then show ?thesis - using nn_integral_has_integral[OF f(1,2) r] by (simp add: integral_unique) -qed - -lemma nn_integral_integrable_on: - fixes f::"'a::euclidean_space \ real" - assumes f: "f \ borel_measurable borel" "\x. 0 \ f x" "(\\<^sup>+x. f x \lborel) < \" - shows "f integrable_on UNIV" -proof - - from f(3) obtain r where r: "(\\<^sup>+x. f x \lborel) = ennreal r" "0 \ r" - by (cases "\\<^sup>+x. f x \lborel" rule: ennreal_cases) auto - then show ?thesis - by (intro has_integral_integrable[where i=r] nn_integral_has_integral[where r=r] f) -qed - -lemma nn_integral_has_integral_lborel: - fixes f :: "'a::euclidean_space \ real" - assumes f_borel: "f \ borel_measurable borel" and nonneg: "\x. 0 \ f x" - assumes I: "(f has_integral I) UNIV" - shows "integral\<^sup>N lborel f = I" -proof - - from f_borel have "(\x. ennreal (f x)) \ borel_measurable lborel" by auto - from borel_measurable_implies_simple_function_sequence'[OF this] guess F . note F = this - let ?B = "\i::nat. box (- (real i *\<^sub>R One)) (real i *\<^sub>R One) :: 'a set" - - note F(1)[THEN borel_measurable_simple_function, measurable] - - have "0 \ I" - using I by (rule has_integral_nonneg) (simp add: nonneg) - - have F_le_f: "enn2real (F i x) \ f x" for i x - using F(3,4)[where x=x] nonneg SUP_upper[of i UNIV "\i. F i x"] - by (cases "F i x" rule: ennreal_cases) auto - let ?F = "\i x. F i x * indicator (?B i) x" - have "(\\<^sup>+ x. ennreal (f x) \lborel) = (SUP i. integral\<^sup>N lborel (\x. ?F i x))" - proof (subst nn_integral_monotone_convergence_SUP[symmetric]) - { fix x - obtain j where j: "x \ ?B j" - using UN_box_eq_UNIV by auto - - have "ennreal (f x) = (SUP i. F i x)" - using F(4)[of x] nonneg[of x] by (simp add: max_def) - also have "\ = (SUP i. ?F i x)" - proof (rule SUP_eq) - fix i show "\j\UNIV. F i x \ ?F j x" - using j F(2) - by (intro bexI[of _ "max i j"]) - (auto split: split_max split_indicator simp: incseq_def le_fun_def box_def) - qed (auto intro!: F split: split_indicator) - finally have "ennreal (f x) = (SUP i. ?F i x)" . } - then show "(\\<^sup>+ x. ennreal (f x) \lborel) = (\\<^sup>+ x. (SUP i. ?F i x) \lborel)" - by simp - qed (insert F, auto simp: incseq_def le_fun_def box_def split: split_indicator) - also have "\ \ ennreal I" - proof (rule SUP_least) - fix i :: nat - have finite_F: "(\\<^sup>+ x. ennreal (enn2real (F i x) * indicator (?B i) x) \lborel) < \" - proof (rule nn_integral_bound_simple_function) - have "emeasure lborel {x \ space lborel. ennreal (enn2real (F i x) * indicator (?B i) x) \ 0} \ - emeasure lborel (?B i)" - by (intro emeasure_mono) (auto split: split_indicator) - then show "emeasure lborel {x \ space lborel. ennreal (enn2real (F i x) * indicator (?B i) x) \ 0} < \" - by (auto simp: less_top[symmetric] top_unique) - qed (auto split: split_indicator - intro!: F simple_function_compose1[where g="enn2real"] simple_function_ennreal) - - have int_F: "(\x. enn2real (F i x) * indicator (?B i) x) integrable_on UNIV" - using F(4) finite_F - by (intro nn_integral_integrable_on) (auto split: split_indicator simp: enn2real_nonneg) - - have "(\\<^sup>+ x. F i x * indicator (?B i) x \lborel) = - (\\<^sup>+ x. ennreal (enn2real (F i x) * indicator (?B i) x) \lborel)" - using F(3,4) - by (intro nn_integral_cong) (auto simp: image_iff eq_commute split: split_indicator) - also have "\ = ennreal (integral UNIV (\x. enn2real (F i x) * indicator (?B i) x))" - using F - by (intro nn_integral_lborel_eq_integral[OF _ _ finite_F]) - (auto split: split_indicator intro: enn2real_nonneg) - also have "\ \ ennreal I" - by (auto intro!: has_integral_le[OF integrable_integral[OF int_F] I] nonneg F_le_f - simp: \0 \ I\ split: split_indicator ) - finally show "(\\<^sup>+ x. F i x * indicator (?B i) x \lborel) \ ennreal I" . - qed - finally have "(\\<^sup>+ x. ennreal (f x) \lborel) < \" - by (auto simp: less_top[symmetric] top_unique) - from nn_integral_lborel_eq_integral[OF assms(1,2) this] I show ?thesis - by (simp add: integral_unique) -qed - -lemma has_integral_iff_emeasure_lborel: - fixes A :: "'a::euclidean_space set" - assumes A[measurable]: "A \ sets borel" and [simp]: "0 \ r" - shows "((\x. 1) has_integral r) A \ emeasure lborel A = ennreal r" -proof (cases "emeasure lborel A = \") - case emeasure_A: True - have "\ (\x. 1::real) integrable_on A" - proof - assume int: "(\x. 1::real) integrable_on A" - then have "(indicator A::'a \ real) integrable_on UNIV" - unfolding indicator_def[abs_def] integrable_restrict_univ . - then obtain r where "((indicator A::'a\real) has_integral r) UNIV" - by auto - from nn_integral_has_integral_lborel[OF _ _ this] emeasure_A show False - by (simp add: ennreal_indicator) - qed - with emeasure_A show ?thesis - by auto -next - case False - then have "((\x. 1) has_integral measure lborel A) A" - by (simp add: has_integral_measure_lborel less_top) - with False show ?thesis - by (auto simp: emeasure_eq_ennreal_measure has_integral_unique) -qed - -lemma has_integral_integral_real: - fixes f::"'a::euclidean_space \ real" - assumes f: "integrable lborel f" - shows "(f has_integral (integral\<^sup>L lborel f)) UNIV" -using f proof induct - case (base A c) then show ?case - by (auto intro!: has_integral_mult_left simp: ) - (simp add: emeasure_eq_ennreal_measure indicator_def has_integral_measure_lborel) -next - case (add f g) then show ?case - by (auto intro!: has_integral_add) -next - case (lim f s) - show ?case - proof (rule has_integral_dominated_convergence) - show "\i. (s i has_integral integral\<^sup>L lborel (s i)) UNIV" by fact - show "(\x. norm (2 * f x)) integrable_on UNIV" - using \integrable lborel f\ - by (intro nn_integral_integrable_on) - (auto simp: integrable_iff_bounded abs_mult nn_integral_cmult ennreal_mult ennreal_mult_less_top) - show "\k. \x\UNIV. norm (s k x) \ norm (2 * f x)" - using lim by (auto simp add: abs_mult) - show "\x\UNIV. (\k. s k x) \ f x" - using lim by auto - show "(\k. integral\<^sup>L lborel (s k)) \ integral\<^sup>L lborel f" - using lim lim(1)[THEN borel_measurable_integrable] - by (intro integral_dominated_convergence[where w="\x. 2 * norm (f x)"]) auto - qed -qed - -context - fixes f::"'a::euclidean_space \ 'b::euclidean_space" -begin - -lemma has_integral_integral_lborel: - assumes f: "integrable lborel f" - shows "(f has_integral (integral\<^sup>L lborel f)) UNIV" -proof - - have "((\x. \b\Basis. (f x \ b) *\<^sub>R b) has_integral (\b\Basis. integral\<^sup>L lborel (\x. f x \ b) *\<^sub>R b)) UNIV" - using f by (intro has_integral_setsum finite_Basis ballI has_integral_scaleR_left has_integral_integral_real) auto - also have eq_f: "(\x. \b\Basis. (f x \ b) *\<^sub>R b) = f" - by (simp add: fun_eq_iff euclidean_representation) - also have "(\b\Basis. integral\<^sup>L lborel (\x. f x \ b) *\<^sub>R b) = integral\<^sup>L lborel f" - using f by (subst (2) eq_f[symmetric]) simp - finally show ?thesis . -qed - -lemma integrable_on_lborel: "integrable lborel f \ f integrable_on UNIV" - using has_integral_integral_lborel by auto - -lemma integral_lborel: "integrable lborel f \ integral UNIV f = (\x. f x \lborel)" - using has_integral_integral_lborel by auto - -end - -subsection \Fundamental Theorem of Calculus for the Lebesgue integral\ - lemma emeasure_bounded_finite: assumes "bounded A" shows "emeasure lborel A < \" proof - @@ -1149,233 +780,4 @@ by (auto simp: mult.commute) qed -text \ - -For the positive integral we replace continuity with Borel-measurability. - -\ - -lemma - fixes f :: "real \ real" - assumes [measurable]: "f \ borel_measurable borel" - assumes f: "\x. x \ {a..b} \ DERIV F x :> f x" "\x. x \ {a..b} \ 0 \ f x" and "a \ b" - shows nn_integral_FTC_Icc: "(\\<^sup>+x. ennreal (f x) * indicator {a .. b} x \lborel) = F b - F a" (is ?nn) - and has_bochner_integral_FTC_Icc_nonneg: - "has_bochner_integral lborel (\x. f x * indicator {a .. b} x) (F b - F a)" (is ?has) - and integral_FTC_Icc_nonneg: "(\x. f x * indicator {a .. b} x \lborel) = F b - F a" (is ?eq) - and integrable_FTC_Icc_nonneg: "integrable lborel (\x. f x * indicator {a .. b} x)" (is ?int) -proof - - have *: "(\x. f x * indicator {a..b} x) \ borel_measurable borel" "\x. 0 \ f x * indicator {a..b} x" - using f(2) by (auto split: split_indicator) - - have F_mono: "a \ x \ x \ y \ y \ b\ F x \ F y" for x y - using f by (intro DERIV_nonneg_imp_nondecreasing[of x y F]) (auto intro: order_trans) - - have "(f has_integral F b - F a) {a..b}" - by (intro fundamental_theorem_of_calculus) - (auto simp: has_field_derivative_iff_has_vector_derivative[symmetric] - intro: has_field_derivative_subset[OF f(1)] \a \ b\) - then have i: "((\x. f x * indicator {a .. b} x) has_integral F b - F a) UNIV" - unfolding indicator_def if_distrib[where f="\x. a * x" for a] - by (simp cong del: if_weak_cong del: atLeastAtMost_iff) - then have nn: "(\\<^sup>+x. f x * indicator {a .. b} x \lborel) = F b - F a" - by (rule nn_integral_has_integral_lborel[OF *]) - then show ?has - by (rule has_bochner_integral_nn_integral[rotated 3]) (simp_all add: * F_mono \a \ b\) - then show ?eq ?int - unfolding has_bochner_integral_iff by auto - show ?nn - by (subst nn[symmetric]) - (auto intro!: nn_integral_cong simp add: ennreal_mult f split: split_indicator) -qed - -lemma - fixes f :: "real \ 'a :: euclidean_space" - assumes "a \ b" - assumes "\x. a \ x \ x \ b \ (F has_vector_derivative f x) (at x within {a .. b})" - assumes cont: "continuous_on {a .. b} f" - shows has_bochner_integral_FTC_Icc: - "has_bochner_integral lborel (\x. indicator {a .. b} x *\<^sub>R f x) (F b - F a)" (is ?has) - and integral_FTC_Icc: "(\x. indicator {a .. b} x *\<^sub>R f x \lborel) = F b - F a" (is ?eq) -proof - - let ?f = "\x. indicator {a .. b} x *\<^sub>R f x" - have int: "integrable lborel ?f" - using borel_integrable_compact[OF _ cont] by auto - have "(f has_integral F b - F a) {a..b}" - using assms(1,2) by (intro fundamental_theorem_of_calculus) auto - moreover - have "(f has_integral integral\<^sup>L lborel ?f) {a..b}" - using has_integral_integral_lborel[OF int] - unfolding indicator_def if_distrib[where f="\x. x *\<^sub>R a" for a] - by (simp cong del: if_weak_cong del: atLeastAtMost_iff) - ultimately show ?eq - by (auto dest: has_integral_unique) - then show ?has - using int by (auto simp: has_bochner_integral_iff) -qed - -lemma - fixes f :: "real \ real" - assumes "a \ b" - assumes deriv: "\x. a \ x \ x \ b \ DERIV F x :> f x" - assumes cont: "\x. a \ x \ x \ b \ isCont f x" - shows has_bochner_integral_FTC_Icc_real: - "has_bochner_integral lborel (\x. f x * indicator {a .. b} x) (F b - F a)" (is ?has) - and integral_FTC_Icc_real: "(\x. f x * indicator {a .. b} x \lborel) = F b - F a" (is ?eq) -proof - - have 1: "\x. a \ x \ x \ b \ (F has_vector_derivative f x) (at x within {a .. b})" - unfolding has_field_derivative_iff_has_vector_derivative[symmetric] - using deriv by (auto intro: DERIV_subset) - have 2: "continuous_on {a .. b} f" - using cont by (intro continuous_at_imp_continuous_on) auto - show ?has ?eq - using has_bochner_integral_FTC_Icc[OF \a \ b\ 1 2] integral_FTC_Icc[OF \a \ b\ 1 2] - by (auto simp: mult.commute) -qed - -lemma nn_integral_FTC_atLeast: - fixes f :: "real \ real" - assumes f_borel: "f \ borel_measurable borel" - assumes f: "\x. a \ x \ DERIV F x :> f x" - assumes nonneg: "\x. a \ x \ 0 \ f x" - assumes lim: "(F \ T) at_top" - shows "(\\<^sup>+x. ennreal (f x) * indicator {a ..} x \lborel) = T - F a" -proof - - let ?f = "\(i::nat) (x::real). ennreal (f x) * indicator {a..a + real i} x" - let ?fR = "\x. ennreal (f x) * indicator {a ..} x" - - have F_mono: "a \ x \ x \ y \ F x \ F y" for x y - using f nonneg by (intro DERIV_nonneg_imp_nondecreasing[of x y F]) (auto intro: order_trans) - then have F_le_T: "a \ x \ F x \ T" for x - by (intro tendsto_le_const[OF _ lim]) - (auto simp: trivial_limit_at_top_linorder eventually_at_top_linorder) - - have "(SUP i::nat. ?f i x) = ?fR x" for x - proof (rule LIMSEQ_unique[OF LIMSEQ_SUP]) - from reals_Archimedean2[of "x - a"] guess n .. - then have "eventually (\n. ?f n x = ?fR x) sequentially" - by (auto intro!: eventually_sequentiallyI[where c=n] split: split_indicator) - then show "(\n. ?f n x) \ ?fR x" - by (rule Lim_eventually) - qed (auto simp: nonneg incseq_def le_fun_def split: split_indicator) - then have "integral\<^sup>N lborel ?fR = (\\<^sup>+ x. (SUP i::nat. ?f i x) \lborel)" - by simp - also have "\ = (SUP i::nat. (\\<^sup>+ x. ?f i x \lborel))" - proof (rule nn_integral_monotone_convergence_SUP) - show "incseq ?f" - using nonneg by (auto simp: incseq_def le_fun_def split: split_indicator) - show "\i. (?f i) \ borel_measurable lborel" - using f_borel by auto - qed - also have "\ = (SUP i::nat. ennreal (F (a + real i) - F a))" - by (subst nn_integral_FTC_Icc[OF f_borel f nonneg]) auto - also have "\ = T - F a" - proof (rule LIMSEQ_unique[OF LIMSEQ_SUP]) - have "(\x. F (a + real x)) \ T" - apply (rule filterlim_compose[OF lim filterlim_tendsto_add_at_top]) - apply (rule LIMSEQ_const_iff[THEN iffD2, OF refl]) - apply (rule filterlim_real_sequentially) - done - then show "(\n. ennreal (F (a + real n) - F a)) \ ennreal (T - F a)" - by (simp add: F_mono F_le_T tendsto_diff) - qed (auto simp: incseq_def intro!: ennreal_le_iff[THEN iffD2] F_mono) - finally show ?thesis . -qed - -lemma integral_power: - "a \ b \ (\x. x^k * indicator {a..b} x \lborel) = (b^Suc k - a^Suc k) / Suc k" -proof (subst integral_FTC_Icc_real) - fix x show "DERIV (\x. x^Suc k / Suc k) x :> x^k" - by (intro derivative_eq_intros) auto -qed (auto simp: field_simps simp del: of_nat_Suc) - -subsection \Integration by parts\ - -lemma integral_by_parts_integrable: - fixes f g F G::"real \ real" - assumes "a \ b" - assumes cont_f[intro]: "!!x. a \x \ x\b \ isCont f x" - assumes cont_g[intro]: "!!x. a \x \ x\b \ isCont g x" - assumes [intro]: "!!x. DERIV F x :> f x" - assumes [intro]: "!!x. DERIV G x :> g x" - shows "integrable lborel (\x.((F x) * (g x) + (f x) * (G x)) * indicator {a .. b} x)" - by (auto intro!: borel_integrable_atLeastAtMost continuous_intros) (auto intro!: DERIV_isCont) - -lemma integral_by_parts: - fixes f g F G::"real \ real" - assumes [arith]: "a \ b" - assumes cont_f[intro]: "!!x. a \x \ x\b \ isCont f x" - assumes cont_g[intro]: "!!x. a \x \ x\b \ isCont g x" - assumes [intro]: "!!x. DERIV F x :> f x" - assumes [intro]: "!!x. DERIV G x :> g x" - shows "(\x. (F x * g x) * indicator {a .. b} x \lborel) - = F b * G b - F a * G a - \x. (f x * G x) * indicator {a .. b} x \lborel" -proof- - have 0: "(\x. (F x * g x + f x * G x) * indicator {a .. b} x \lborel) = F b * G b - F a * G a" - by (rule integral_FTC_Icc_real, auto intro!: derivative_eq_intros continuous_intros) - (auto intro!: DERIV_isCont) - - have "(\x. (F x * g x + f x * G x) * indicator {a .. b} x \lborel) = - (\x. (F x * g x) * indicator {a .. b} x \lborel) + \x. (f x * G x) * indicator {a .. b} x \lborel" - apply (subst integral_add[symmetric]) - apply (auto intro!: borel_integrable_atLeastAtMost continuous_intros) - by (auto intro!: DERIV_isCont integral_cong split:split_indicator) - - thus ?thesis using 0 by auto -qed - -lemma integral_by_parts': - fixes f g F G::"real \ real" - assumes "a \ b" - assumes "!!x. a \x \ x\b \ isCont f x" - assumes "!!x. a \x \ x\b \ isCont g x" - assumes "!!x. DERIV F x :> f x" - assumes "!!x. DERIV G x :> g x" - shows "(\x. indicator {a .. b} x *\<^sub>R (F x * g x) \lborel) - = F b * G b - F a * G a - \x. indicator {a .. b} x *\<^sub>R (f x * G x) \lborel" - using integral_by_parts[OF assms] by (simp add: ac_simps) - -lemma has_bochner_integral_even_function: - fixes f :: "real \ 'a :: {banach, second_countable_topology}" - assumes f: "has_bochner_integral lborel (\x. indicator {0..} x *\<^sub>R f x) x" - assumes even: "\x. f (- x) = f x" - shows "has_bochner_integral lborel f (2 *\<^sub>R x)" -proof - - have indicator: "\x::real. indicator {..0} (- x) = indicator {0..} x" - by (auto split: split_indicator) - have "has_bochner_integral lborel (\x. indicator {.. 0} x *\<^sub>R f x) x" - by (subst lborel_has_bochner_integral_real_affine_iff[where c="-1" and t=0]) - (auto simp: indicator even f) - with f have "has_bochner_integral lborel (\x. indicator {0..} x *\<^sub>R f x + indicator {.. 0} x *\<^sub>R f x) (x + x)" - by (rule has_bochner_integral_add) - then have "has_bochner_integral lborel f (x + x)" - by (rule has_bochner_integral_discrete_difference[where X="{0}", THEN iffD1, rotated 4]) - (auto split: split_indicator) - then show ?thesis - by (simp add: scaleR_2) -qed - -lemma has_bochner_integral_odd_function: - fixes f :: "real \ 'a :: {banach, second_countable_topology}" - assumes f: "has_bochner_integral lborel (\x. indicator {0..} x *\<^sub>R f x) x" - assumes odd: "\x. f (- x) = - f x" - shows "has_bochner_integral lborel f 0" -proof - - have indicator: "\x::real. indicator {..0} (- x) = indicator {0..} x" - by (auto split: split_indicator) - have "has_bochner_integral lborel (\x. - indicator {.. 0} x *\<^sub>R f x) x" - by (subst lborel_has_bochner_integral_real_affine_iff[where c="-1" and t=0]) - (auto simp: indicator odd f) - from has_bochner_integral_minus[OF this] - have "has_bochner_integral lborel (\x. indicator {.. 0} x *\<^sub>R f x) (- x)" - by simp - with f have "has_bochner_integral lborel (\x. indicator {0..} x *\<^sub>R f x + indicator {.. 0} x *\<^sub>R f x) (x + - x)" - by (rule has_bochner_integral_add) - then have "has_bochner_integral lborel f (x + - x)" - by (rule has_bochner_integral_discrete_difference[where X="{0}", THEN iffD1, rotated 4]) - (auto split: split_indicator) - then show ?thesis - by simp -qed - end diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Analysis/Linear_Algebra.thy --- a/src/HOL/Analysis/Linear_Algebra.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Analysis/Linear_Algebra.thy Fri Sep 16 13:56:51 2016 +0200 @@ -10,6 +10,30 @@ "~~/src/HOL/Library/Infinite_Set" begin +lemma linear_simps: + assumes "bounded_linear f" + shows + "f (a + b) = f a + f b" + "f (a - b) = f a - f b" + "f 0 = 0" + "f (- a) = - f a" + "f (s *\<^sub>R v) = s *\<^sub>R (f v)" +proof - + interpret f: bounded_linear f by fact + show "f (a + b) = f a + f b" by (rule f.add) + show "f (a - b) = f a - f b" by (rule f.diff) + show "f 0 = 0" by (rule f.zero) + show "f (- a) = - f a" by (rule f.minus) + show "f (s *\<^sub>R v) = s *\<^sub>R (f v)" by (rule f.scaleR) +qed + +lemma bounded_linearI: + assumes "\x y. f (x + y) = f x + f y" + and "\r x. f (r *\<^sub>R x) = r *\<^sub>R f x" + and "\x. norm (f x) \ norm x * K" + shows "bounded_linear f" + using assms by (rule bounded_linear_intro) (* FIXME: duplicate *) + subsection \A generic notion of "hull" (convex, affine, conic hull and closure).\ definition hull :: "('a set \ bool) \ 'a set \ 'a set" (infixl "hull" 75) diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Analysis/Ordered_Euclidean_Space.thy --- a/src/HOL/Analysis/Ordered_Euclidean_Space.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Analysis/Ordered_Euclidean_Space.thy Fri Sep 16 13:56:51 2016 +0200 @@ -243,27 +243,6 @@ lemma One_nonneg: "0 \ (\Basis::'a::ordered_euclidean_space)" by (auto intro: setsum_nonneg) -lemma content_closed_interval: - fixes a :: "'a::ordered_euclidean_space" - assumes "a \ b" - shows "content {a .. b} = (\i\Basis. b\i - a\i)" - using content_cbox[of a b] assms - by (simp add: cbox_interval eucl_le[where 'a='a]) - -lemma integrable_const_ivl[intro]: - fixes a::"'a::ordered_euclidean_space" - shows "(\x. c) integrable_on {a .. b}" - unfolding cbox_interval[symmetric] - by (rule integrable_const) - -lemma integrable_on_subinterval: - fixes f :: "'n::ordered_euclidean_space \ 'a::banach" - assumes "f integrable_on s" - and "{a .. b} \ s" - shows "f integrable_on {a .. b}" - using integrable_on_subcbox[of f s a b] assms - by (simp add: cbox_interval) - lemma fixes a b::"'a::ordered_euclidean_space" shows bdd_above_cbox[intro, simp]: "bdd_above (cbox a b)" diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Analysis/Set_Integral.thy --- a/src/HOL/Analysis/Set_Integral.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Analysis/Set_Integral.thy Fri Sep 16 13:56:51 2016 +0200 @@ -7,7 +7,7 @@ *) theory Set_Integral - imports Bochner_Integration Lebesgue_Measure + imports Equivalence_Lebesgue_Henstock_Integration begin (* @@ -85,7 +85,7 @@ lemma set_lebesgue_integral_cong: assumes "A \ sets M" and "\x. x \ A \ f x = g x" shows "(LINT x:A|M. f x) = (LINT x:A|M. g x)" - using assms by (auto intro!: integral_cong split: split_indicator simp add: sets.sets_into_space) + using assms by (auto intro!: Bochner_Integration.integral_cong split: split_indicator simp add: sets.sets_into_space) lemma set_lebesgue_integral_cong_AE: assumes [measurable]: "A \ sets M" "f \ borel_measurable M" "g \ borel_measurable M" @@ -118,22 +118,22 @@ (* TODO: borel_integrable_atLeastAtMost should be named something like set_integrable_Icc_isCont *) lemma set_integral_scaleR_right [simp]: "LINT t:A|M. a *\<^sub>R f t = a *\<^sub>R (LINT t:A|M. f t)" - by (subst integral_scaleR_right[symmetric]) (auto intro!: integral_cong) + by (subst integral_scaleR_right[symmetric]) (auto intro!: Bochner_Integration.integral_cong) lemma set_integral_mult_right [simp]: fixes a :: "'a::{real_normed_field, second_countable_topology}" shows "LINT t:A|M. a * f t = a * (LINT t:A|M. f t)" - by (subst integral_mult_right_zero[symmetric]) (auto intro!: integral_cong) + by (subst integral_mult_right_zero[symmetric]) auto lemma set_integral_mult_left [simp]: fixes a :: "'a::{real_normed_field, second_countable_topology}" shows "LINT t:A|M. f t * a = (LINT t:A|M. f t) * a" - by (subst integral_mult_left_zero[symmetric]) (auto intro!: integral_cong) + by (subst integral_mult_left_zero[symmetric]) auto lemma set_integral_divide_zero [simp]: fixes a :: "'a::{real_normed_field, field, second_countable_topology}" shows "LINT t:A|M. f t / a = (LINT t:A|M. f t) / a" - by (subst integral_divide_zero[symmetric], intro integral_cong) + by (subst integral_divide_zero[symmetric], intro Bochner_Integration.integral_cong) (auto split: split_indicator) lemma set_integrable_scaleR_right [simp, intro]: @@ -184,7 +184,7 @@ fixes S and f :: "real \ 'a :: {banach, second_countable_topology}" shows "(LBINT x : S. f x) = (LBINT x : {x. - x \ S}. f (- x))" by (subst lborel_integral_real_affine[where c="-1" and t=0]) - (auto intro!: integral_cong split: split_indicator) + (auto intro!: Bochner_Integration.integral_cong split: split_indicator) (* question: why do we have this for negation, but multiplication by a constant requires an integrability assumption? *) @@ -194,7 +194,7 @@ lemma set_integral_complex_of_real: "LINT x:A|M. complex_of_real (f x) = of_real (LINT x:A|M. f x)" by (subst integral_complex_of_real[symmetric]) - (auto intro!: integral_cong split: split_indicator) + (auto intro!: Bochner_Integration.integral_cong split: split_indicator) lemma set_integral_mono: fixes f g :: "_ \ real" @@ -254,7 +254,7 @@ proof - have "set_integrable M (A - B) f" using f_A by (rule set_integrable_subset) auto - from integrable_add[OF this f_B] show ?thesis + from Bochner_Integration.integrable_add[OF this f_B] show ?thesis by (rule integrable_cong[THEN iffD1, rotated 2]) (auto split: split_indicator) qed @@ -410,7 +410,7 @@ by simp qed show "set_lebesgue_integral M (UNION UNIV A) f = LINT x|M. (\i. indicator (A i) x *\<^sub>R f x)" - apply (rule integral_cong[OF refl]) + apply (rule Bochner_Integration.integral_cong[OF refl]) apply (subst suminf_scaleR_left[OF sums_summable[OF indicator_sums, OF disj], symmetric]) using sums_unique[OF indicator_sums[OF disj]] apply auto diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Library/Inner_Product.thy --- a/src/HOL/Library/Inner_Product.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Library/Inner_Product.thy Fri Sep 16 13:56:51 2016 +0200 @@ -260,6 +260,11 @@ end +lemma + shows real_inner_1_left[simp]: "inner 1 x = x" + and real_inner_1_right[simp]: "inner x 1 = x" + by simp_all + instantiation complex :: real_inner begin diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Probability/Characteristic_Functions.thy --- a/src/HOL/Probability/Characteristic_Functions.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Probability/Characteristic_Functions.thy Fri Sep 16 13:56:51 2016 +0200 @@ -316,13 +316,13 @@ then have "norm (char M t - ?t1) = norm (char M t - (CLINT x | M. (\k \ n. c k x)))" by (simp add: integ_c) also have "\ = norm ((CLINT x | M. iexp (t * x) - (\k \ n. c k x)))" - unfolding char_def by (subst integral_diff[OF integ_iexp]) (auto intro!: integ_c) + unfolding char_def by (subst Bochner_Integration.integral_diff[OF integ_iexp]) (auto intro!: integ_c) also have "\ \ expectation (\x. cmod (iexp (t * x) - (\k \ n. c k x)))" - by (intro integral_norm_bound integrable_diff integ_iexp integrable_setsum integ_c) simp + by (intro integral_norm_bound Bochner_Integration.integrable_diff integ_iexp Bochner_Integration.integrable_setsum integ_c) simp also have "\ \ expectation (\x. 2 * \t\ ^ n / fact n * \x\ ^ n)" proof (rule integral_mono) show "integrable M (\x. cmod (iexp (t * x) - (\k\n. c k x)))" - by (intro integrable_norm integrable_diff integ_iexp integrable_setsum integ_c) simp + by (intro integrable_norm Bochner_Integration.integrable_diff integ_iexp Bochner_Integration.integrable_setsum integ_c) simp show "integrable M (\x. 2 * \t\ ^ n / fact n * \x\ ^ n)" unfolding power_abs[symmetric] by (intro integrable_mult_right integrable_abs integrable_moments) simp @@ -360,16 +360,16 @@ then have "norm (char M t - ?t1) = norm (char M t - (CLINT x | M. (\k \ n. c k x)))" by (simp add: integ_c) also have "\ = norm ((CLINT x | M. iexp (t * x) - (\k \ n. c k x)))" - unfolding char_def by (subst integral_diff[OF integ_iexp]) (auto intro!: integ_c) + unfolding char_def by (subst Bochner_Integration.integral_diff[OF integ_iexp]) (auto intro!: integ_c) also have "\ \ expectation (\x. cmod (iexp (t * x) - (\k \ n. c k x)))" - by (intro integral_norm_bound integrable_diff integ_iexp integrable_setsum integ_c) simp + by (intro integral_norm_bound Bochner_Integration.integrable_diff integ_iexp Bochner_Integration.integrable_setsum integ_c) simp also have "\ \ expectation (\x. min (2 * \t * x\^n / fact n) (\t * x\^(Suc n) / fact (Suc n)))" (is "_ \ expectation ?f") proof (rule integral_mono) show "integrable M (\x. cmod (iexp (t * x) - (\k\n. c k x)))" - by (intro integrable_norm integrable_diff integ_iexp integrable_setsum integ_c) simp + by (intro integrable_norm Bochner_Integration.integrable_diff integ_iexp Bochner_Integration.integrable_setsum integ_c) simp show "integrable M ?f" - by (rule integrable_bound[where f="\x. 2 * \t * x\ ^ n / fact n"]) + by (rule Bochner_Integration.integrable_bound[where f="\x. 2 * \t * x\ ^ n / fact n"]) (auto simp: integrable_moments power_abs[symmetric] power_mult_distrib) show "cmod (iexp (t * x) - (\k\n. c k x)) \ ?f x" for x using iexp_approx1[of "t * x" n] iexp_approx2[of "t * x" n] @@ -377,9 +377,9 @@ qed also have "\ = (\t\^n / fact (Suc n)) * expectation (\x. min (2 * \x\^n * Suc n) (\t\ * \x\^Suc n))" unfolding * - proof (rule integral_mult_right) + proof (rule Bochner_Integration.integral_mult_right) show "integrable M (\x. min (2 * \x\ ^ n * real (Suc n)) (\t\ * \x\ ^ Suc n))" - by (rule integrable_bound[where f="\x. 2 * \x\ ^ n * real (Suc n)"]) + by (rule Bochner_Integration.integrable_bound[where f="\x. 2 * \x\ ^ n * real (Suc n)"]) (auto simp: integrable_moments power_abs[symmetric] power_mult_distrib) qed finally show ?thesis diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Probability/Distributions.thy --- a/src/HOL/Probability/Distributions.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Probability/Distributions.thy Fri Sep 16 13:56:51 2016 +0200 @@ -608,7 +608,7 @@ using D by (rule entropy_distr) simp also have "(\ x. exponential_density l x * log b (exponential_density l x) \lborel) = (\ x. (ln l * exponential_density l x - l * (exponential_density l x * x)) / ln b \lborel)" - by (intro integral_cong) (auto simp: log_def ln_mult exponential_density_def field_simps) + by (intro Bochner_Integration.integral_cong) (auto simp: log_def ln_mult exponential_density_def field_simps) also have "\ = (ln l - 1) / ln b" by simp finally show ?thesis @@ -750,7 +750,7 @@ uniform_distributed_bounds[of X a b] uniform_distributed_measure[of X a b] distributed_measurable[of M lborel X] - by (auto intro!: uniform_distrI_borel_atLeastAtMost) + by (auto intro!: uniform_distrI_borel_atLeastAtMost simp del: content_real_if) lemma (in prob_space) uniform_distributed_expectation: fixes a b :: real @@ -762,13 +762,13 @@ have "(\ x. indicator {a .. b} x / measure lborel {a .. b} * x \lborel) = (\ x. (x / measure lborel {a .. b}) * indicator {a .. b} x \lborel)" - by (intro integral_cong) auto + by (intro Bochner_Integration.integral_cong) auto also have "(\ x. (x / measure lborel {a .. b}) * indicator {a .. b} x \lborel) = (a + b) / 2" proof (subst integral_FTC_Icc_real) fix x show "DERIV (\x. x\<^sup>2 / (2 * measure lborel {a..b})) x :> x / measure lborel {a..b}" using uniform_distributed_params[OF D] - by (auto intro!: derivative_eq_intros) + by (auto intro!: derivative_eq_intros simp del: content_real_if) show "isCont (\x. x / Sigma_Algebra.measure lborel {a..b}) x" using uniform_distributed_params[OF D] by (auto intro!: isCont_divide) @@ -791,12 +791,12 @@ have [arith]: "a < b" using uniform_distributed_bounds[OF D] . let ?\ = "expectation X" let ?D = "\x. indicator {a..b} (x + ?\) / measure lborel {a..b}" have "(\x. x\<^sup>2 * (?D x) \lborel) = (\x. x\<^sup>2 * (indicator {a - ?\ .. b - ?\} x) / measure lborel {a .. b} \lborel)" - by (intro integral_cong) (auto split: split_indicator) + by (intro Bochner_Integration.integral_cong) (auto split: split_indicator) also have "\ = (b - a)\<^sup>2 / 12" by (simp add: integral_power uniform_distributed_expectation[OF D]) (simp add: eval_nat_numeral field_simps ) finally show "(\x. x\<^sup>2 * ?D x \lborel) = (b - a)\<^sup>2 / 12" . -qed (auto intro: D simp: measure_nonneg) +qed (auto intro: D simp del: content_real_if) subsection \Normal distribution\ @@ -949,7 +949,7 @@ proof (intro filterlim_cong refl eventually_at_top_linorder[THEN iffD2] exI[of _ 0] allI impI) fix b :: real assume b: "0 \ b" have "Suc k * (\x. indicator {0..b} x *\<^sub>R ?M k x \lborel) = (\x. indicator {0..b} x *\<^sub>R (exp (- x\<^sup>2) * ((Suc k) * x ^ k)) \lborel)" - unfolding integral_mult_right_zero[symmetric] by (intro integral_cong) auto + unfolding integral_mult_right_zero[symmetric] by (intro Bochner_Integration.integral_cong) auto also have "\ = exp (- b\<^sup>2) * b ^ (Suc k) - exp (- 0\<^sup>2) * 0 ^ (Suc k) - (\x. indicator {0..b} x *\<^sub>R (- 2 * x * exp (- x\<^sup>2) * x ^ (Suc k)) \lborel)" by (rule integral_by_parts') @@ -957,7 +957,7 @@ simp: diff_Suc of_nat_Suc field_simps split: nat.split) also have "(\x. indicator {0..b} x *\<^sub>R (- 2 * x * exp (- x\<^sup>2) * x ^ (Suc k)) \lborel) = (\x. indicator {0..b} x *\<^sub>R (- 2 * (exp (- x\<^sup>2) * x ^ (k + 2))) \lborel)" - by (intro integral_cong) auto + by (intro Bochner_Integration.integral_cong) auto finally have "Suc k * (\x. indicator {0..b} x *\<^sub>R ?M k x \lborel) = exp (- b\<^sup>2) * b ^ (Suc k) + 2 * (\x. indicator {0..b} x *\<^sub>R ?M (k + 2) x \lborel)" by (simp del: real_scaleR_def integral_mult_right add: integral_mult_right[symmetric]) @@ -1361,10 +1361,10 @@ have "entropy b lborel X = - (\ x. normal_density \ \ x * log b (normal_density \ \ x) \lborel)" using D by (rule entropy_distr) simp also have "\ = - (\ x. normal_density \ \ x * (- ln (2 * pi * \\<^sup>2) - (x - \)\<^sup>2 / \\<^sup>2) / (2 * ln b) \lborel)" - by (intro arg_cong[where f="uminus"] integral_cong) + by (intro arg_cong[where f="uminus"] Bochner_Integration.integral_cong) (auto simp: normal_density_def field_simps ln_mult log_def ln_div ln_sqrt) also have "\ = - (\x. - (normal_density \ \ x * (ln (2 * pi * \\<^sup>2)) + (normal_density \ \ x * (x - \)\<^sup>2) / \\<^sup>2) / (2 * ln b) \lborel)" - by (intro arg_cong[where f="uminus"] integral_cong) (auto simp: divide_simps field_simps) + by (intro arg_cong[where f="uminus"] Bochner_Integration.integral_cong) (auto simp: divide_simps field_simps) also have "\ = (\x. normal_density \ \ x * (ln (2 * pi * \\<^sup>2)) + (normal_density \ \ x * (x - \)\<^sup>2) / \\<^sup>2 \lborel) / (2 * ln b)" by (simp del: minus_add_distrib) also have "\ = (ln (2 * pi * \\<^sup>2) + 1) / (2 * ln b)" diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Probability/Giry_Monad.thy --- a/src/HOL/Probability/Giry_Monad.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Probability/Giry_Monad.thy Fri Sep 16 13:56:51 2016 +0200 @@ -862,15 +862,15 @@ show ?integrable using M * by(simp add: real_integrable_def measurable_def nn_integral_empty) have "(\ M'. integral\<^sup>L M' f \M) = (\ M'. 0 \M)" - proof(rule integral_cong) + proof(rule Bochner_Integration.integral_cong) fix M' assume "M' \ space M" with sets_eq_imp_space_eq[OF M] have "space M' = space N" by(auto simp add: space_subprob_algebra dest: sets_eq_imp_space_eq) - with * show "(\ x. f x \M') = 0" by(simp add: integral_empty) + with * show "(\ x. f x \M') = 0" by(simp add: Bochner_Integration.integral_empty) qed simp then show ?integral - using M * by(simp add: integral_empty) + using M * by(simp add: Bochner_Integration.integral_empty) next assume *: "space N \ {}" @@ -1213,7 +1213,7 @@ also have "\ = \ x. integral\<^sup>L (N x) f \M" by(rule integral_distr)(simp_all add: integral_measurable_subprob_algebra[OF _]) finally show ?integral by(simp add: bind_nonempty''[where N=K]) -qed(simp_all add: bind_def integrable_count_space lebesgue_integral_count_space_finite integral_empty) +qed(simp_all add: bind_def integrable_count_space lebesgue_integral_count_space_finite Bochner_Integration.integral_empty) lemma (in prob_space) prob_space_bind: assumes ae: "AE x in M. prob_space (N x)" diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Probability/Information.thy --- a/src/HOL/Probability/Information.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Probability/Information.thy Fri Sep 16 13:56:51 2016 +0200 @@ -840,7 +840,7 @@ 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!: integral_cong) + by (subst integral_density) (auto simp del: integral_indicator intro!: Bochner_Integration.integral_cong) 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<..}" @@ -901,11 +901,11 @@ have eq: "(\ x. indicator A x / measure MX A * log b (indicator A x / measure MX A) \MX) = (\ x. (- log b (measure MX A) / measure MX A) * indicator A x \MX)" using uniform_distributed_params[OF X] - by (intro integral_cong) (auto split: split_indicator simp: log_divide_eq zero_less_measure_iff) + by (intro Bochner_Integration.integral_cong) (auto split: split_indicator simp: log_divide_eq zero_less_measure_iff) show "- (\ x. indicator A x / measure MX A * log b (indicator A x / measure MX A) \MX) = log b (measure MX A)" unfolding eq using uniform_distributed_params[OF X] - by (subst integral_mult_right) (auto simp: measure_def less_top[symmetric] intro!: integrable_real_indicator) + by (subst Bochner_Integration.integral_mult_right) (auto simp: measure_def less_top[symmetric] intro!: integrable_real_indicator) qed simp lemma (in information_space) entropy_simple_distributed: @@ -1038,8 +1038,8 @@ apply (subst mi_eq) apply (subst mutual_information_distr[OF S TP Px Px_nn Pyz _ Pxyz]) apply (auto simp: space_pair_measure) - apply (subst integral_diff[symmetric]) - apply (auto intro!: integral_cong_AE simp: split_beta' simp del: integral_diff) + apply (subst Bochner_Integration.integral_diff[symmetric]) + apply (auto intro!: integral_cong_AE simp: split_beta' simp del: Bochner_Integration.integral_diff) done let ?P = "density (S \\<^sub>M T \\<^sub>M P) Pxyz" @@ -1112,7 +1112,7 @@ done have I3: "integrable (S \\<^sub>M T \\<^sub>M P) (\(x, y, z). Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Pxz (x, z) * (Pyz (y,z) / Pz z))))" - apply (rule integrable_cong_AE[THEN iffD1, OF _ _ _ integrable_diff[OF I1 I2]]) + apply (rule integrable_cong_AE[THEN iffD1, OF _ _ _ Bochner_Integration.integrable_diff[OF I1 I2]]) using ae apply (auto simp: split_beta') done @@ -1297,8 +1297,8 @@ apply simp apply simp apply (simp add: space_pair_measure) - apply (subst integral_diff[symmetric]) - apply (auto intro!: integral_cong_AE simp: split_beta' simp del: integral_diff) + apply (subst Bochner_Integration.integral_diff[symmetric]) + apply (auto intro!: integral_cong_AE simp: split_beta' simp del: Bochner_Integration.integral_diff) done let ?P = "density (S \\<^sub>M T \\<^sub>M P) Pxyz" @@ -1373,7 +1373,7 @@ (auto simp: split_beta' AE_density space_pair_measure intro!: AE_I2 ennreal_neg) have I3: "integrable (S \\<^sub>M T \\<^sub>M P) (\(x, y, z). Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Pxz (x, z) * (Pyz (y,z) / Pz z))))" - apply (rule integrable_cong_AE[THEN iffD1, OF _ _ _ integrable_diff[OF I1 I2]]) + apply (rule integrable_cong_AE[THEN iffD1, OF _ _ _ Bochner_Integration.integrable_diff[OF I1 I2]]) using ae apply (auto simp: split_beta') done @@ -1593,7 +1593,7 @@ also have "\ = - (\(x,y). Pxy (x,y) * log b (Py y) \(S \\<^sub>M T))" using b_gt_1 by (subst distributed_transform_integral[OF Pxy _ Py, where T=snd]) - (auto intro!: integral_cong simp: space_pair_measure) + (auto intro!: Bochner_Integration.integral_cong simp: space_pair_measure) finally have e_eq: "entropy b T Y = - (\(x,y). Pxy (x,y) * log b (Py y) \(S \\<^sub>M T))" . have **: "\x. x \ space (S \\<^sub>M T) \ 0 \ Pxy x" @@ -1618,7 +1618,7 @@ apply auto done also have "\ = - (\x. Pxy x * log b (Pxy x) \(S \\<^sub>M T)) - - (\x. Pxy x * log b (Py (snd x)) \(S \\<^sub>M T))" - by (simp add: integral_diff[OF I1 I2]) + by (simp add: Bochner_Integration.integral_diff[OF I1 I2]) finally show ?thesis using conditional_entropy_generic_eq[OF S T Py Py_nn Pxy Pxy_nn, simplified] entropy_distr[OF Pxy **, simplified] e_eq @@ -1785,9 +1785,9 @@ have "entropy b S X + entropy b T Y - entropy b (S \\<^sub>M T) (\x. (X x, Y x)) = integral\<^sup>L (S \\<^sub>M T) ?f" unfolding X Y XY - apply (subst integral_diff) - apply (intro integrable_diff Ixy Ix Iy)+ - apply (subst integral_diff) + apply (subst Bochner_Integration.integral_diff) + apply (intro Bochner_Integration.integrable_diff Ixy Ix Iy)+ + apply (subst Bochner_Integration.integral_diff) apply (intro Ixy Ix Iy)+ apply (simp add: field_simps) done diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Probability/Levy.thy --- a/src/HOL/Probability/Levy.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Probability/Levy.thy Fri Sep 16 13:56:51 2016 +0200 @@ -136,9 +136,9 @@ have "(CLBINT t=-T..T. ?F t * \ t) = (CLBINT t. (CLINT x | M. ?F t * iexp (t * x) * indicator {-T<..T \ 0\ unfolding \_def char_def interval_lebesgue_integral_def - by (auto split: split_indicator intro!: integral_cong) + by (auto split: split_indicator intro!: Bochner_Integration.integral_cong) also have "\ = (CLBINT t. (CLINT x | M. ?f' (t, x)))" - by (auto intro!: integral_cong simp: field_simps exp_diff exp_minus split: split_indicator) + by (auto intro!: Bochner_Integration.integral_cong simp: field_simps exp_diff exp_minus split: split_indicator) also have "\ = (CLINT x | M. (CLBINT t. ?f' (t, x)))" proof (intro P.Fubini_integral [symmetric] integrableI_bounded_set [where B="b - a"]) show "emeasure (lborel \\<^sub>M M) ({- T<.. space M) < \" @@ -151,7 +151,7 @@ qed (auto split: split_indicator split_indicator_asm) also have "\ = (CLINT x | M. (complex_of_real (2 * (sgn (x - a) * Si (T * abs (x - a)) - sgn (x - b) * Si (T * abs (x - b))))))" - using main_eq by (intro integral_cong, auto) + using main_eq by (intro Bochner_Integration.integral_cong, auto) also have "\ = complex_of_real (LINT x | M. (2 * (sgn (x - a) * Si (T * abs (x - a)) - sgn (x - b) * Si (T * abs (x - b)))))" by (rule integral_complex_of_real) @@ -336,11 +336,11 @@ (CLBINT t:{-u..u}. (CLINT x | M n. 1 - iexp (t * x)))" unfolding char_def by (rule set_lebesgue_integral_cong, auto simp del: of_real_mult) also have "\ = (CLBINT t. (CLINT x | M n. indicator {-u..u} t *\<^sub>R (1 - iexp (t * x))))" - by (rule integral_cong) (auto split: split_indicator) + by (rule Bochner_Integration.integral_cong) (auto split: split_indicator) also have "\ = (CLINT x | M n. (CLBINT t:{-u..u}. 1 - iexp (t * x)))" using Mn3 by (subst P.Fubini_integral) (auto simp: indicator_times split_beta') also have "\ = (CLINT x | M n. (if x = 0 then 0 else 2 * (u - sin (u * x) / x)))" - using \u > 0\ by (intro integral_cong, auto simp add: * simp del: of_real_mult) + using \u > 0\ by (intro Bochner_Integration.integral_cong, auto simp add: * simp del: of_real_mult) also have "\ = (LINT x | M n. (if x = 0 then 0 else 2 * (u - sin (u * x) / x)))" by (rule integral_complex_of_real) finally have "Re (CLBINT t:{-u..u}. 1 - char (M n) t) = diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Probability/Probability_Mass_Function.thy --- a/src/HOL/Probability/Probability_Mass_Function.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Probability/Probability_Mass_Function.thy Fri Sep 16 13:56:51 2016 +0200 @@ -167,7 +167,7 @@ lemma pmf_nonneg[simp]: "0 \ pmf p x" by transfer simp - + lemma pmf_not_neg [simp]: "\pmf p x < 0" by (simp add: not_less pmf_nonneg) @@ -546,7 +546,7 @@ lemma measure_return_pmf [simp]: "measure_pmf.prob (return_pmf x) A = indicator A x" proof - - have "ennreal (measure_pmf.prob (return_pmf x) A) = + have "ennreal (measure_pmf.prob (return_pmf x) A) = emeasure (measure_pmf (return_pmf x)) A" by (simp add: measure_pmf.emeasure_eq_measure) also have "\ = ennreal (indicator A x)" by (simp add: ennreal_indicator) @@ -778,10 +778,10 @@ have "1 = measure (measure_pmf M) UNIV" by simp also have "\ = measure (measure_pmf N) {x} + measure (measure_pmf N) (UNIV - {x})" by (subst measure_pmf.finite_measure_Union [symmetric]) simp_all - also from gt have "measure (measure_pmf N) {x} < measure (measure_pmf M) {x}" + also from gt have "measure (measure_pmf N) {x} < measure (measure_pmf M) {x}" by (simp add: measure_pmf_single) also have "measure (measure_pmf N) (UNIV - {x}) \ measure (measure_pmf M) (UNIV - {x})" - by (subst (1 2) integral_pmf [symmetric]) + by (subst (1 2) integral_pmf [symmetric]) (intro integral_mono integrable_pmf, simp_all add: ge) also have "measure (measure_pmf M) {x} + \ = 1" by (subst measure_pmf.finite_measure_Union [symmetric]) simp_all @@ -803,7 +803,7 @@ by unfold_locales have "(\ x. \ y. pmf (C x y) i \B \A) = (\ x. (\ y. pmf (C x y) i \restrict_space B B) \A)" - by (rule integral_cong) (auto intro!: integral_pmf_restrict) + by (rule Bochner_Integration.integral_cong) (auto intro!: integral_pmf_restrict) also have "\ = (\ x. (\ y. pmf (C x y) i \restrict_space B B) \restrict_space A A)" by (intro integral_pmf_restrict B.borel_measurable_lebesgue_integral measurable_pair_restrict_pmf2 countable_set_pmf borel_measurable_count_space) @@ -815,7 +815,7 @@ by (intro integral_pmf_restrict[symmetric] A.borel_measurable_lebesgue_integral measurable_pair_restrict_pmf2 countable_set_pmf borel_measurable_count_space) also have "\ = (\ y. \ x. pmf (C x y) i \A \B)" - by (rule integral_cong) (auto intro!: integral_pmf_restrict[symmetric]) + by (rule Bochner_Integration.integral_cong) (auto intro!: integral_pmf_restrict[symmetric]) finally show "(\ x. \ y. pmf (C x y) i \B \A) = (\ y. \ x. pmf (C x y) i \A \B)" . qed @@ -1629,7 +1629,7 @@ lemma map_pmf_of_set: assumes "finite A" "A \ {}" - shows "map_pmf f (pmf_of_set A) = pmf_of_multiset (image_mset f (mset_set A))" + shows "map_pmf f (pmf_of_set A) = pmf_of_multiset (image_mset f (mset_set A))" (is "?lhs = ?rhs") proof (intro pmf_eqI) fix x @@ -1641,13 +1641,13 @@ lemma pmf_bind_pmf_of_set: assumes "A \ {}" "finite A" - shows "pmf (bind_pmf (pmf_of_set A) f) x = + shows "pmf (bind_pmf (pmf_of_set A) f) x = (\xa\A. pmf (f xa) x) / real_of_nat (card A)" (is "?lhs = ?rhs") proof - from assms have "card A > 0" by auto with assms have "ennreal ?lhs = ennreal ?rhs" - by (subst ennreal_pmf_bind) - (simp_all add: nn_integral_pmf_of_set max_def pmf_nonneg divide_ennreal [symmetric] + by (subst ennreal_pmf_bind) + (simp_all add: nn_integral_pmf_of_set max_def pmf_nonneg divide_ennreal [symmetric] setsum_nonneg ennreal_of_nat_eq_real_of_nat) thus ?thesis by (subst (asm) ennreal_inj) (auto intro!: setsum_nonneg divide_nonneg_nonneg) qed @@ -1675,10 +1675,10 @@ qed text \ - Choosing an element uniformly at random from the union of a disjoint family - of finite non-empty sets with the same size is the same as first choosing a set - from the family uniformly at random and then choosing an element from the chosen set - uniformly at random. + Choosing an element uniformly at random from the union of a disjoint family + of finite non-empty sets with the same size is the same as first choosing a set + from the family uniformly at random and then choosing an element from the chosen set + uniformly at random. \ lemma pmf_of_set_UN: assumes "finite (UNION A f)" "A \ {}" "\x. x \ A \ f x \ {}" @@ -1694,8 +1694,8 @@ by (subst pmf_of_set) auto also from assms have "card (\x\A. f x) = card A * n" by (subst card_UN_disjoint) (auto simp: disjoint_family_on_def) - also from assms - have "indicator (\x\A. f x) x / real \ = + also from assms + have "indicator (\x\A. f x) x / real \ = indicator (\x\A. f x) x / (n * real (card A))" by (simp add: setsum_divide_distrib [symmetric] mult_ac) also from assms have "indicator (\x\A. f x) x = (\y\A. indicator (f y) x)" @@ -1794,17 +1794,17 @@ lemma replicate_pmf_1: "replicate_pmf 1 p = map_pmf (\x. [x]) p" by (simp add: map_pmf_def bind_return_pmf) - -lemma set_replicate_pmf: + +lemma set_replicate_pmf: "set_pmf (replicate_pmf n p) = {xs\lists (set_pmf p). length xs = n}" by (induction n) (auto simp: length_Suc_conv) lemma replicate_pmf_distrib: - "replicate_pmf (m + n) p = + "replicate_pmf (m + n) p = do {xs \ replicate_pmf m p; ys \ replicate_pmf n p; return_pmf (xs @ ys)}" by (induction m) (simp_all add: bind_return_pmf bind_return_pmf' bind_assoc_pmf) -lemma power_diff': +lemma power_diff': assumes "b \ a" shows "x ^ (a - b) = (if x = 0 \ a = b then 1 else x ^ a / (x::'a::field) ^ b)" proof (cases "x = 0") @@ -1812,12 +1812,12 @@ with assms show ?thesis by (cases "a - b") simp_all qed (insert assms, simp_all add: power_diff) - + lemma binomial_pmf_Suc: assumes "p \ {0..1}" - shows "binomial_pmf (Suc n) p = - do {b \ bernoulli_pmf p; - k \ binomial_pmf n p; + shows "binomial_pmf (Suc n) p = + do {b \ bernoulli_pmf p; + k \ binomial_pmf n p; return_pmf ((if b then 1 else 0) + k)}" (is "_ = ?rhs") proof (intro pmf_eqI) fix k @@ -1835,14 +1835,14 @@ lemma binomial_pmf_altdef: assumes "p \ {0..1}" shows "binomial_pmf n p = map_pmf (length \ filter id) (replicate_pmf n (bernoulli_pmf p))" - by (induction n) - (insert assms, auto simp: binomial_pmf_Suc map_pmf_def bind_return_pmf bind_assoc_pmf + by (induction n) + (insert assms, auto simp: binomial_pmf_Suc map_pmf_def bind_return_pmf bind_assoc_pmf bind_return_pmf' binomial_pmf_0 intro!: bind_pmf_cong) subsection \PMFs from assiciation lists\ -definition pmf_of_list ::" ('a \ real) list \ 'a pmf" where +definition pmf_of_list ::" ('a \ real) list \ 'a pmf" where "pmf_of_list xs = embed_pmf (\x. sum_list (map snd (filter (\z. fst z = x) xs)))" definition pmf_of_list_wf where @@ -1870,12 +1870,12 @@ from Cons.prems have "snd x \ 0" by simp moreover have "b \ 0" if "(a,b) \ set xs" for a b using Cons.prems[of b] that by force - ultimately have "(\\<^sup>+ y. ennreal (\(x', p)\x # xs. indicator {x'} y * p) \count_space UNIV) = - (\\<^sup>+ y. ennreal (indicator {fst x} y * snd x) + + ultimately have "(\\<^sup>+ y. ennreal (\(x', p)\x # xs. indicator {x'} y * p) \count_space UNIV) = + (\\<^sup>+ y. ennreal (indicator {fst x} y * snd x) + ennreal (\(x', p)\xs. indicator {x'} y * p) \count_space UNIV)" - by (intro nn_integral_cong, subst ennreal_plus [symmetric]) + by (intro nn_integral_cong, subst ennreal_plus [symmetric]) (auto simp: case_prod_unfold indicator_def intro!: sum_list_nonneg) - also have "\ = (\\<^sup>+ y. ennreal (indicator {fst x} y * snd x) \count_space UNIV) + + also have "\ = (\\<^sup>+ y. ennreal (indicator {fst x} y * snd x) \count_space UNIV) + (\\<^sup>+ y. ennreal (\(x', p)\xs. indicator {x'} y * p) \count_space UNIV)" by (intro nn_integral_add) (force intro!: sum_list_nonneg AE_I2 intro: Cons simp: indicator_def)+ @@ -1934,20 +1934,20 @@ proof - have "emeasure (pmf_of_list xs) A = nn_integral (measure_pmf (pmf_of_list xs)) (indicator A)" by simp - also from assms + also from assms have "\ = (\x\set_pmf (pmf_of_list xs) \ A. ennreal (sum_list (map snd [z\xs . fst z = x])))" by (subst nn_integral_measure_pmf_finite) (simp_all add: finite_set_pmf_of_list pmf_pmf_of_list) - also from assms + also from assms have "\ = ennreal (\x\set_pmf (pmf_of_list xs) \ A. sum_list (map snd [z\xs . fst z = x]))" by (subst setsum_ennreal) (auto simp: pmf_of_list_wf_def intro!: sum_list_nonneg) - also have "\ = ennreal (\x\set_pmf (pmf_of_list xs) \ A. + also have "\ = ennreal (\x\set_pmf (pmf_of_list xs) \ A. indicator A x * pmf (pmf_of_list xs) x)" (is "_ = ennreal ?S") using assms by (intro ennreal_cong setsum.cong) (auto simp: pmf_pmf_of_list) also have "?S = (\x\set_pmf (pmf_of_list xs). indicator A x * pmf (pmf_of_list xs) x)" using assms by (intro setsum.mono_neutral_left set_pmf_of_list finite_set_pmf_of_list) auto also have "\ = (\x\set (map fst xs). indicator A x * pmf (pmf_of_list xs) x)" using assms by (intro setsum.mono_neutral_left set_pmf_of_list) (auto simp: set_pmf_eq) - also have "\ = (\x\set (map fst xs). indicator A x * + also have "\ = (\x\set (map fst xs). indicator A x * sum_list (map snd (filter (\z. fst z = x) xs)))" using assms by (simp add: pmf_pmf_of_list) also have "\ = (\x\set (map fst xs). sum_list (map snd (filter (\z. fst z = x \ x \ A) xs)))" @@ -1955,17 +1955,17 @@ also have "\ = (\x\set (map fst xs). (\xa = 0.. x \ A then snd (xs ! xa) else 0))" by (intro setsum.cong refl, subst sum_list_map_filter', subst sum_list_setsum_nth) simp - also have "\ = (\xa = 0..x\set (map fst xs). + also have "\ = (\xa = 0..x\set (map fst xs). if fst (xs ! xa) = x \ x \ A then snd (xs ! xa) else 0))" by (rule setsum.commute) - also have "\ = (\xa = 0.. A then + also have "\ = (\xa = 0.. A then (\x\set (map fst xs). if x = fst (xs ! xa) then snd (xs ! xa) else 0) else 0)" by (auto intro!: setsum.cong setsum.neutral) also have "\ = (\xa = 0.. A then snd (xs ! xa) else 0)" by (intro setsum.cong refl) (simp_all add: setsum.delta) also have "\ = sum_list (map snd (filter (\x. fst x \ A) xs))" by (subst sum_list_map_filter', subst sum_list_setsum_nth) simp_all - finally show ?thesis . + finally show ?thesis . qed lemma measure_pmf_of_list: @@ -1989,7 +1989,7 @@ "sum_list (filter (\x. x \ 0) xs) = sum_list xs" by (induction xs) simp_all (* END MOVE *) - + lemma set_pmf_of_list_eq: assumes "pmf_of_list_wf xs" "\x. x \ snd ` set xs \ x > 0" shows "set_pmf (pmf_of_list xs) = fst ` set xs" @@ -2000,13 +2000,13 @@ from B have "sum_list (map snd [z\xs. fst z = x]) = 0" by (simp add: pmf_pmf_of_list[OF assms(1)] set_pmf_eq) moreover from y have "y \ snd ` {xa \ set xs. fst xa = x}" by force - ultimately have "y = 0" using assms(1) + ultimately have "y = 0" using assms(1) by (subst (asm) sum_list_nonneg_eq_zero_iff) (auto simp: pmf_of_list_wf_def) with assms(2) y have False by force } thus "fst ` set xs \ set_pmf (pmf_of_list xs)" by blast qed (insert set_pmf_of_list[OF assms(1)], simp_all) - + lemma pmf_of_list_remove_zeros: assumes "pmf_of_list_wf xs" defines "xs' \ filter (\z. snd z \ 0) xs" diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Probability/Probability_Measure.thy --- a/src/HOL/Probability/Probability_Measure.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Probability/Probability_Measure.thy Fri Sep 16 13:56:51 2016 +0200 @@ -225,7 +225,7 @@ using prob_space by (simp add: X) also have "\ \ expectation (\w. q (X w))" using \x \ I\ \open I\ X(2) - apply (intro integral_mono_AE integrable_add integrable_mult_right integrable_diff + apply (intro integral_mono_AE Bochner_Integration.integrable_add Bochner_Integration.integrable_mult_right Bochner_Integration.integrable_diff integrable_const X q) apply (elim eventually_mono) apply (intro convex_le_Inf_differential) diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Probability/SPMF.thy --- a/src/HOL/Probability/SPMF.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Probability/SPMF.thy Fri Sep 16 13:56:51 2016 +0200 @@ -554,11 +554,11 @@ have "?lhs = \ x. ?f x \measure_pmf p" by(simp add: bind_spmf_def pmf_bind) also have "\ = \ x. ?f None * indicator {None} x + ?f x * indicator (range Some) x \measure_pmf p" - by(rule integral_cong)(auto simp add: indicator_def) + by(rule Bochner_Integration.integral_cong)(auto simp add: indicator_def) also have "\ = (\ x. ?f None * indicator {None} x \measure_pmf p) + (\ x. ?f x * indicator (range Some) x \measure_pmf p)" - by(rule integral_add)(auto 4 3 intro: integrable_real_mult_indicator measure_pmf.integrable_const_bound[where B=1] simp add: AE_measure_pmf_iff pmf_le_1) + by(rule Bochner_Integration.integral_add)(auto 4 3 intro: integrable_real_mult_indicator measure_pmf.integrable_const_bound[where B=1] simp add: AE_measure_pmf_iff pmf_le_1) also have "\ = pmf p None + \ x. indicator (range Some) x * pmf (f (the x)) None \measure_pmf p" - by(auto simp add: measure_measure_pmf_finite indicator_eq_0_iff intro!: integral_cong) + by(auto simp add: measure_measure_pmf_finite indicator_eq_0_iff intro!: Bochner_Integration.integral_cong) also have "\ = ?rhs" unfolding measure_spmf_def by(subst integral_distr)(auto simp add: integral_restrict_space) finally show ?thesis . @@ -566,7 +566,7 @@ lemma spmf_bind: "spmf (p \ f) y = \ x. spmf (f x) y \measure_spmf p" unfolding measure_spmf_def -by(subst integral_distr)(auto simp add: bind_spmf_def pmf_bind integral_restrict_space indicator_eq_0_iff intro!: integral_cong split: option.split) +by(subst integral_distr)(auto simp add: bind_spmf_def pmf_bind integral_restrict_space indicator_eq_0_iff intro!: Bochner_Integration.integral_cong split: option.split) lemma ennreal_spmf_bind: "ennreal (spmf (p \ f) x) = \\<^sup>+ y. spmf (f y) x \measure_spmf p" by(auto simp add: bind_spmf_def ennreal_pmf_bind nn_integral_measure_spmf_conv_measure_pmf nn_integral_restrict_space intro: nn_integral_cong split: split_indicator option.split) @@ -2688,7 +2688,7 @@ lemma pmf_try_spmf_None [simp]: "pmf (TRY p ELSE q) None = pmf p None * pmf q None" (is "?lhs = ?rhs") proof - have "?lhs = \ x. pmf q None * indicator {None} x \measure_pmf p" - unfolding try_spmf_def pmf_bind by(rule integral_cong)(simp_all split: option.split) + unfolding try_spmf_def pmf_bind by(rule Bochner_Integration.integral_cong)(simp_all split: option.split) also have "\ = ?rhs" by(simp add: measure_pmf_single) finally show ?thesis . qed diff -r a6cd18af8bf9 -r 685fb01256af src/HOL/Probability/Sinc_Integral.thy --- a/src/HOL/Probability/Sinc_Integral.thy Thu Sep 15 22:41:05 2016 +0200 +++ b/src/HOL/Probability/Sinc_Integral.thy Fri Sep 16 13:56:51 2016 +0200 @@ -263,7 +263,7 @@ from lborel_integrable_real_affine[OF this, of t 0] show ?thesis unfolding interval_lebesgue_integral_0_infty - by (rule integrable_bound) (auto simp: field_simps * split: split_indicator) + by (rule Bochner_Integration.integrable_bound) (auto simp: field_simps * split: split_indicator) qed lemma Si_at_top: "(Si \ pi / 2) at_top" @@ -291,7 +291,7 @@ fix x :: real assume x: "x \ 0" "x \ t" have "LBINT y. \indicator ({0<..} \ {0<..R (sin x * exp (- (y * x)))\ = LBINT y. \sin x\ * exp (- (y * x)) * indicator {0<..} y * indicator {0<.. = \sin x\ * indicator {0<... exp (- (y * x)))" by (cases "x > 0") (auto simp: field_simps interval_lebesgue_integral_0_infty split: split_indicator) @@ -315,7 +315,7 @@ also have "... = LBINT u=0..\. (LBINT x=0..t. exp (-(u * x)) * sin x)" using \0\t\ by (auto simp: interval_lebesgue_integral_def zero_ereal_def ac_simps - split: split_indicator intro!: integral_cong) + split: split_indicator intro!: Bochner_Integration.integral_cong) also have "\ = LBINT u=0..\. 1 / (1 + u\<^sup>2) - 1 / (1 + u\<^sup>2) * (exp (- (u * t)) * (u * sin t + cos t))" by (auto simp: divide_simps LBINT_I0c_exp_mscale_sin intro!: interval_integral_cong) also have "... = pi / 2 - (LBINT u=0..\. exp (- (u * t)) * (u * sin t + cos t) / (1 + u^2))"