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