# HG changeset patch # User paulson # Date 1435668976 -3600 # Node ID e5fa1d5d3952e862f4068aa2bd7b69d410b143a2 # Parent 9627a75eb32ad4042a488beec90fb8542ce18f8a Useful lemmas. The theorem concerning swapping the variables in a double integral. diff -r 9627a75eb32a -r e5fa1d5d3952 src/HOL/Conditionally_Complete_Lattices.thy --- a/src/HOL/Conditionally_Complete_Lattices.thy Mon Jun 29 13:49:21 2015 +0200 +++ b/src/HOL/Conditionally_Complete_Lattices.thy Tue Jun 30 13:56:16 2015 +0100 @@ -302,10 +302,10 @@ lemma cSUP_upper2: "bdd_above (f ` A) \ x \ A \ u \ f x \ u \ SUPREMUM A f" by (auto intro: cSUP_upper assms order_trans) -lemma cSUP_const: "A \ {} \ (SUP x:A. c) = c" +lemma cSUP_const [simp]: "A \ {} \ (SUP x:A. c) = c" by (intro antisym cSUP_least) (auto intro: cSUP_upper) -lemma cINF_const: "A \ {} \ (INF x:A. c) = c" +lemma cINF_const [simp]: "A \ {} \ (INF x:A. c) = c" by (intro antisym cINF_greatest) (auto intro: cINF_lower) lemma le_cINF_iff: "A \ {} \ bdd_below (f ` A) \ u \ INFIMUM A f \ (\x\A. u \ f x)" @@ -634,4 +634,16 @@ by (elim exE disjE) auto qed +lemma cSUP_eq_cINF_D: + fixes f :: "_ \ 'b::conditionally_complete_lattice" + assumes eq: "(SUP x:A. f x) = (INF x:A. f x)" + and bdd: "bdd_above (f ` A)" "bdd_below (f ` A)" + and a: "a \ A" + shows "f a = (INF x:A. f x)" +apply (rule antisym) +using a bdd +apply (auto simp: cINF_lower) +apply (metis eq cSUP_upper) +done + end diff -r 9627a75eb32a -r e5fa1d5d3952 src/HOL/Library/Product_Vector.thy --- a/src/HOL/Library/Product_Vector.thy Mon Jun 29 13:49:21 2015 +0200 +++ b/src/HOL/Library/Product_Vector.thy Tue Jun 30 13:56:16 2015 +0100 @@ -213,6 +213,9 @@ lemma continuous_on_Pair[continuous_intros]: "continuous_on s f \ continuous_on s g \ continuous_on s (\x. (f x, g x))" unfolding continuous_on_def by (auto intro: tendsto_Pair) +lemma continuous_on_swap[continuous_intros]: "continuous_on A prod.swap" + by (simp add: prod.swap_def continuous_on_fst continuous_on_snd continuous_on_Pair continuous_on_id) + lemma isCont_fst [simp]: "isCont f a \ isCont (\x. fst (f x)) a" by (fact continuous_fst) @@ -254,6 +257,9 @@ by (fast dest: hausdorff elim: open_vimage_fst open_vimage_snd) qed +lemma isCont_swap[continuous_intros]: "isCont prod.swap a" + using continuous_on_eq_continuous_within continuous_on_swap by blast + subsection \Product is a metric space\ instantiation prod :: (metric_space, metric_space) metric_space @@ -439,15 +445,6 @@ using snd_add snd_scaleR by (rule bounded_linear_intro [where K=1], simp add: norm_prod_def) -text \TODO: move to NthRoot\ -lemma sqrt_add_le_add_sqrt: - assumes x: "0 \ x" and y: "0 \ y" - shows "sqrt (x + y) \ sqrt x + sqrt y" -apply (rule power2_le_imp_le) -apply (simp add: power2_sum x y) -apply (simp add: x y) -done - lemma bounded_linear_Pair: assumes f: "bounded_linear f" assumes g: "bounded_linear g" @@ -541,5 +538,11 @@ lemma inner_Pair_0: "inner x (0, b) = inner (snd x) b" "inner x (a, 0) = inner (fst x) a" by (cases x, simp)+ +lemma + fixes x :: "'a::real_normed_vector" + shows norm_Pair1 [simp]: "norm (0,x) = norm x" + and norm_Pair2 [simp]: "norm (x,0) = norm x" +by (auto simp: norm_Pair) + end diff -r 9627a75eb32a -r e5fa1d5d3952 src/HOL/Multivariate_Analysis/Integration.thy --- a/src/HOL/Multivariate_Analysis/Integration.thy Mon Jun 29 13:49:21 2015 +0200 +++ b/src/HOL/Multivariate_Analysis/Integration.thy Tue Jun 30 13:56:16 2015 +0100 @@ -394,7 +394,7 @@ then have "x \ s \ interior (\f)" unfolding lem1[where U="\f", symmetric] using centre_in_ball e by auto - then show ?thesis + then show ?thesis using insert.hyps(3) insert.prems(1) by blast qed qed @@ -445,7 +445,7 @@ using assms unfolding box_ne_empty by auto -lemma interval_upperbound_Times: +lemma interval_upperbound_Times: assumes "A \ {}" and "B \ {}" shows "interval_upperbound (A \ B) = (interval_upperbound A, interval_upperbound B)" proof- @@ -459,7 +459,7 @@ by (subst setsum_Basis_prod_eq) (auto simp add: setsum_prod) qed -lemma interval_lowerbound_Times: +lemma interval_lowerbound_Times: assumes "A \ {}" and "B \ {}" shows "interval_lowerbound (A \ B) = (interval_lowerbound A, interval_lowerbound B)" proof- @@ -505,7 +505,7 @@ then show ?thesis by (simp add: cbox_sing) qed -lemma content_unit[intro]: "content(cbox 0 (One::'a::euclidean_space)) = 1" +lemma content_unit[iff]: "content(cbox 0 (One::'a::euclidean_space)) = 1" proof - have *: "\i\Basis. (0::'a)\i \ (One::'a)\i" by auto @@ -532,6 +532,11 @@ 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" @@ -607,7 +612,7 @@ 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)" + 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) @@ -616,6 +621,50 @@ 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) + +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: split_if_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) + subsection \The notion of a gauge --- simply an open set containing the point.\ @@ -1104,7 +1153,7 @@ apply (rule division_disjoint_union[OF d assms(1)]) apply (rule inter_interior_unions_intervals) apply (rule p open_interior ballI)+ - apply simp_all + apply simp_all done qed then show ?thesis @@ -1162,7 +1211,7 @@ apply auto done finally have [simp]: "interior (cbox a b) \ interior (\(p - {cbox u v})) = {}" by simp - have cbe: "cbox a b \ cbox c d = cbox a b \ \(p - {cbox u v})" + have cbe: "cbox a b \ cbox c d = cbox a b \ \(p - {cbox u v})" using p(8) unfolding uv[symmetric] by auto show ?thesis apply (rule that[of "p - {cbox u v}"]) @@ -1221,7 +1270,7 @@ next assume as: "p \ {}" "interior (cbox a b) \ {}" "cbox a b \ {}" have "\k\p. \q. (insert (cbox a b) q) division_of (cbox a b \ k)" - proof + proof case goal1 from assm(4)[OF this] obtain c d where "k = cbox c d" by blast then show ?case @@ -1230,7 +1279,7 @@ from bchoice[OF this] obtain q where "\x\p. insert (cbox a b) (q x) division_of (cbox a b) \ x" .. note q = division_ofD[OF this[rule_format]] let ?D = "\{insert (cbox a b) (q k) | k. k \ p}" - show thesis + show thesis proof (rule that[OF division_ofI]) have *: "{insert (cbox a b) (q k) |k. k \ p} = (\k. insert (cbox a b) (q k)) ` p" by auto @@ -1858,7 +1907,7 @@ have "?A \ ?B" proof case goal1 - then obtain c d + then obtain c d where x: "x = cbox c d" "\i. i \ Basis \ c \ i = a \ i \ d \ i = (a \ i + b \ i) / 2 \ @@ -1934,7 +1983,7 @@ "x \ cbox c d" "\i. i \ Basis \ c \ i = a \ i \ d \ i = (a \ i + b \ i) / 2 \ - c \ i = (a \ i + b \ i) / 2 \ d \ i = b \ i" + c \ i = (a \ i + b \ i) / 2 \ d \ i = b \ i" by blast show "x\cbox a b" unfolding mem_box @@ -2160,7 +2209,7 @@ done obtain e where e: "e > 0" "ball x e \ g x" using gaugeD[OF assms, of x] unfolding open_contains_ball by auto - from x(2)[OF e(1)] + from x(2)[OF e(1)] obtain c d where c_d: "x \ cbox c d" "cbox c d \ ball x e" "cbox c d \ cbox a b" @@ -2346,7 +2395,7 @@ obtain B where B: "0 < B" "\x. norm (h x) \ norm x * B" by blast have "e / B > 0" using goal1(2) B by simp - then obtain g + then obtain g where g: "gauge g" "\p. p tagged_division_of (cbox a b) \ g fine p \ norm ((\(x, k)\p. content k *\<^sub>R f x) - y) < e / B" @@ -2404,7 +2453,7 @@ qed qed -lemma has_integral_scaleR_left: +lemma has_integral_scaleR_left: "(f has_integral y) s \ ((\x. f x *\<^sub>R c) has_integral (y *\<^sub>R c)) s" using has_integral_linear[OF _ bounded_linear_scaleR_left] by (simp add: comp_def) @@ -2413,6 +2462,11 @@ shows "(f has_integral y) s \ ((\x. f x * c) has_integral (y * c)) s" using has_integral_linear[OF _ bounded_linear_mult_left] by (simp add: comp_def) +corollary integral_mult_left: + fixes c:: "'a::real_normed_algebra" + shows "f integrable_on s \ integral s (\x. f x * c) = integral s f * c" + by (blast intro: has_integral_mult_left) + lemma has_integral_cmul: "(f has_integral k) s \ ((\x. c *\<^sub>R f x) has_integral (c *\<^sub>R k)) s" unfolding o_def[symmetric] by (metis has_integral_linear bounded_linear_scaleR_right) @@ -2478,7 +2532,7 @@ unfolding * by (auto simp add: algebra_simps) also have "\ < e/2 + e/2" apply (rule le_less_trans[OF norm_triangle_ineq]) - using as d1 d2 fine + using as d1 d2 fine apply (blast intro: add_strict_mono) done finally show "norm ((\(x, k)\p. content k *\<^sub>R (f x + g x)) - (k + l)) < e" @@ -2628,7 +2682,7 @@ done lemma has_integral_eq: - assumes "\x\s. f x = g x" + assumes "\x. x \ s \ f x = g x" and "(f has_integral k) s" shows "(g has_integral k) s" using has_integral_sub[OF assms(2), of "\x. f x - g x" 0] @@ -2636,16 +2690,23 @@ using assms(1) by auto -lemma integrable_eq: "\x\s. f x = g x \ f integrable_on s \ g integrable_on s" +lemma integrable_eq: "(\x. x \ s \ f x = g x) \ f integrable_on s \ g integrable_on s" unfolding integrable_on_def - using has_integral_eq[of s f g] + using has_integral_eq[of s f g] has_integral_eq by blast + +lemma has_integral_cong: + assumes "\x. x \ s \ f x = g x" + shows "(f has_integral i) s = (g has_integral i) s" + using has_integral_eq[of s f g] has_integral_eq[of s g f] assms by auto -lemma has_integral_eq_eq: "\x\s. f x = g x \ (f has_integral k) s \ (g has_integral k) s" - using has_integral_eq[of s f g] has_integral_eq[of s g f] - by auto - -lemma has_integral_null[dest]: +lemma integral_cong: + assumes "\x. x \ s \ f x = g x" + shows "integral s f = integral s g" + unfolding integral_def + by (metis assms has_integral_cong) + +lemma has_integral_null [intro]: assumes "content(cbox a b) = 0" shows "(f has_integral 0) (cbox a b)" proof - @@ -2667,7 +2728,7 @@ by (auto simp: has_integral) qed -lemma has_integral_null_real[dest]: +lemma has_integral_null_real [intro]: assumes "content {a .. b::real} = 0" shows "(f has_integral 0) {a .. b}" by (metis assms box_real(2) has_integral_null) @@ -2675,14 +2736,11 @@ lemma has_integral_null_eq[simp]: "content (cbox a b) = 0 \ (f has_integral i) (cbox a b) \ i = 0" by (auto simp add: has_integral_null dest!: integral_unique) -lemma integral_null[dest]: "content (cbox a b) = 0 \ integral (cbox a b) f = 0" +lemma integral_null [simp]: "content (cbox a b) = 0 \ integral (cbox a b) f = 0" by (metis has_integral_null integral_unique) -lemma integrable_on_null[dest]: "content (cbox a b) = 0 \ f integrable_on (cbox a b)" - unfolding integrable_on_def - apply (drule has_integral_null) - apply auto - done +lemma integrable_on_null [intro]: "content (cbox a b) = 0 \ f integrable_on (cbox a b)" + by (simp add: has_integral_integrable) lemma has_integral_empty[intro]: "(f has_integral 0) {}" by (simp add: has_integral_is_0) @@ -2798,7 +2856,7 @@ proof (rule_tac x=y in exI, clarify) fix e :: real assume "e>0" - then have *:"e/2 > 0" by auto + then have *:"e/2 > 0" by auto then guess N1 unfolding real_arch_inv[of "e/2"] .. note N1=this then have N1': "N1 = N1 - 1 + 1" by auto @@ -2818,7 +2876,7 @@ apply (rule norm_triangle_half_r) apply (rule less_trans[OF _ *]) apply (subst N1', rule d(2)[of "p (N1+N2)"]) - using N1' as(1) as(2) dp + using N1' as(1) as(2) dp apply (simp add: `\x. p x tagged_division_of cbox a b \ (\xa. \{d i xa |i. i \ {0..x}}) fine p x`) using N2 le_add2 by blast } @@ -2992,9 +3050,9 @@ assume "k \ ?p1" then guess l unfolding mem_Collect_eq by (elim exE conjE) note l=this guess u v using p(4)[OF l(2)] by (elim exE) note uv=this - show "k \ ?I1" + show "k \ ?I1" using l p(2) uv by force - show "k \ {}" + show "k \ {}" by (simp add: l) show "\a b. k = cbox a b" apply (simp add: l uv p(2-3)[OF l(2)]) @@ -3013,9 +3071,9 @@ assume "k \ ?p2" then guess l unfolding mem_Collect_eq by (elim exE conjE) note l=this guess u v using p(4)[OF l(2)] by (elim exE) note uv=this - show "k \ ?I2" + show "k \ ?I2" using l p(2) uv by force - show "k \ {}" + show "k \ {}" by (simp add: l) show "\a b. k = cbox a b" apply (simp add: l uv p(2-3)[OF l(2)]) @@ -3041,17 +3099,17 @@ case goal1 then have e: "e/2 > 0" by auto - obtain d1 + obtain d1 where d1: "gauge d1" - and d1norm: + and d1norm: "\p. \p tagged_division_of cbox a b \ {x. x \ k \ c}; d1 fine p\ \ norm ((\(x, k) \ p. content k *\<^sub>R f x) - i) < e / 2" apply (rule has_integralD[OF fi[unfolded interval_split[OF k]] e]) apply (simp add: interval_split[symmetric] k) done - obtain d2 + obtain d2 where d2: "gauge d2" - and d2norm: + and d2norm: "\p. \p tagged_division_of cbox a b \ {x. c \ x \ k}; d2 fine p\ \ norm ((\(x, k) \ p. content k *\<^sub>R f x) - j) < e / 2" apply (rule has_integralD[OF fj[unfolded interval_split[OF k]] e]) @@ -3077,12 +3135,12 @@ using p(2)[unfolded fine_def, rule_format,OF as] by auto with kk obtain y where y: "y \ ball x \x \ k - c\" "y\k \ c" by blast - then have "\x \ k - y \ k\ < \x \ k - c\" + then have "\x \ k - y \ k\ < \x \ k - c\" using Basis_le_norm[OF k, of "x - y"] by (auto simp add: dist_norm inner_diff_left intro: le_less_trans) with y show False using ** by (auto simp add: field_simps) - qed + qed qed have xk_ge_c: "\x kk. (x, kk) \ p \ kk \ {x. x\k \ c} \ {} \ x\k \ c" proof - @@ -3095,7 +3153,7 @@ using p(2)[unfolded fine_def,rule_format,OF as,unfolded split_conv] by auto with kk obtain y where y: "y \ ball x \x \ k - c\" "y\k \ c" by blast - then have "\x \ k - y \ k\ < \x \ k - c\" + then have "\x \ k - y \ k\ < \x \ k - c\" using Basis_le_norm[OF k, of "x - y"] by (auto simp add: dist_norm inner_diff_left intro: le_less_trans) with y show False @@ -3104,7 +3162,7 @@ qed have lem1: "\f P Q. (\x k. (x, k) \ {(x, f k) | x k. P x k} \ Q x k) \ - (\x k. P x k \ Q x (f k))" + (\x k. P x k \ Q x (f k))" by auto have fin_finite: "\f s P f. finite s \ finite {(x,f k) | x k. (x,k) \ s \ P x k}" proof - @@ -3342,7 +3400,7 @@ also have "\ < e" by (rule k d(2) p12 fine_union p1 p2)+ finally have "norm ((\(x, k)\p1. content k *\<^sub>R f x) + (\(x, k)\p2. content k *\<^sub>R f x) - i) < e" . - } + } then show ?thesis by (auto intro: that[of d] d elim: ) qed @@ -3602,7 +3660,7 @@ fix a b :: 'a assume "content (cbox a b) = 0" then show "(if f integrable_on cbox a b then Some (integral (cbox a b) f) else None) = Some 0" - using has_integral_null_eq + using has_integral_null_eq by (auto simp: integrable_on_null) qed @@ -3723,7 +3781,7 @@ guess u v using division_ofD(4)[OF assms(1,5)] by (elim exE) note l=this have uv: "\i\Basis. u\i \ v\i" "\i\Basis. a\i \ u\i \ v\i \ b\i" using division_ofD(2,2,3)[OF assms(1,5)] unfolding l box_ne_empty - using subset_box(1) + using subset_box(1) apply auto apply blast+ done @@ -3836,7 +3894,7 @@ qed lemma iterate_op: - "\monoidal opp; finite s\ + "\monoidal opp; finite s\ \ iterate opp s (\x. opp (f x) (g x)) = opp (iterate opp s f) (iterate opp s g)" by (erule finite_induct) (auto simp: monoidal_ac(4) monoidal_ac(5)) @@ -3857,13 +3915,13 @@ def su \ "support opp f s" have fsu: "finite su" using True by (simp add: su_def) - moreover + moreover { assume "finite su" "su \ s" then have "iterate opp su f = iterate opp su g" by (induct su) (auto simp: assms) } ultimately have "iterate opp (support opp f s) f = iterate opp (support opp g s) g" - by (simp add: "*" su_def support_subset) + by (simp add: "*" su_def support_subset) then show ?thesis by simp qed @@ -3884,17 +3942,17 @@ def C \ "card (division_points (cbox a b) d)" then show ?thesis using assms - proof (induct C arbitrary: a b d rule: full_nat_induct) + proof (induct C arbitrary: a b d rule: full_nat_induct) case (1 a b d) show ?case proof (cases "content (cbox a b) = 0") case True show "iterate opp d f = f (cbox a b)" unfolding operativeD(1)[OF assms(2) True] - proof (rule iterate_eq_neutral[OF `monoidal opp`]) + proof (rule iterate_eq_neutral[OF `monoidal opp`]) fix x assume x: "x \ d" - then show "f x = neutral opp" + then show "f x = neutral opp" by (metis division_ofD(4) 1(4) division_of_content_0[OF True] operativeD(1)[OF assms(2)] x) qed next @@ -3927,7 +3985,7 @@ then have d': "\i\d. \u v. i = cbox u v \ (\j\Basis. u\j = a\j \ v\j = a\j \ u\j = b\j \ v\j = b\j \ u\j = a\j \ v\j = b\j)" unfolding forall_in_division[OF 1(4)] - by blast + by blast have "(1/2) *\<^sub>R (a+b) \ cbox a b" unfolding mem_box using ab by(auto intro!: less_imp_le simp: inner_simps) note this[unfolded division_ofD(6)[OF `d division_of cbox a b`,symmetric] Union_iff] @@ -4004,7 +4062,7 @@ unfolding leq interval_split[OF kc(4)] apply (rule operativeD(1) 1)+ unfolding interval_split[symmetric,OF kc(4)] - using division_split_left_inj 1 as kc leq by blast + using division_split_left_inj 1 as kc leq by blast } note fxk_le = this { fix l y assume as: "l \ d" "y \ d" "l \ {x. c \ x \ k} = y \ {x. c \ x \ k}" "l \ y" @@ -4061,14 +4119,14 @@ proof - have *: "(\(x,l). f l) = f \ snd" unfolding o_def by rule auto note tagged = tagged_division_ofD[OF assms(3)] - { fix a b a' - assume as: "(a, b) \ d" "(a', b) \ d" "(a, b) \ (a', b)" + { fix a b a' + assume as: "(a, b) \ d" "(a', b) \ d" "(a, b) \ (a', b)" have "f b = neutral opp" - using tagged(4)[OF as(1)] + using tagged(4)[OF as(1)] apply clarify apply (rule operativeD(1)[OF assms(2)]) by (metis content_eq_0_interior inf.idem tagged_division_ofD(5)[OF assms(3) as(1-3)]) - } + } then have "iterate opp d (\(x,l). f l) = iterate opp (snd ` d) f" unfolding * by (force intro!: assms iterate_image_nonzero[symmetric, OF _ tagged_division_of_finite]) @@ -4184,7 +4242,7 @@ apply (rule mult_left_mono[OF _ abs_ge_zero, of _ e]) apply (metis norm) unfolding setsum_left_distrib[symmetric] - using con setsum_le + using con setsum_le apply (auto simp: mult.commute intro: mult_left_mono [OF _ e]) done finally show ?thesis . @@ -4219,13 +4277,21 @@ using d(2)[OF conjI[OF p]] *[OF rsum_bound[OF p(1) assms(3)]] by auto qed -lemma has_integral_bound_real: +corollary has_integral_bound_real: fixes f :: "real \ 'b::real_normed_vector" assumes "0 \ B" and "(f has_integral i) {a .. b}" and "\x\{a .. b}. norm (f x) \ B" shows "norm i \ B * content {a .. b}" - by (metis assms(1) assms(2) assms(3) box_real(2) has_integral_bound) + by (metis assms box_real(2) has_integral_bound) + +corollary integrable_bound: + fixes f :: "'a::euclidean_space \ 'b::real_normed_vector" + assumes "0 \ B" + and "f integrable_on (cbox a b)" + and "\x. x\cbox a b \ norm (f x) \ B" + shows "norm (integral (cbox a b) f) \ B * content (cbox a b)" +by (metis integrable_integral has_integral_bound assms) subsection \Similar theorems about relationship among components.\ @@ -4244,7 +4310,7 @@ show "(content b *\<^sub>R f a) \ i \ (content b *\<^sub>R g a) \ i" unfolding b inner_simps real_scaleR_def apply (rule mult_left_mono) - using assms(2) tagged + using assms(2) tagged by (auto simp add: content_pos_le) qed @@ -4263,9 +4329,9 @@ by auto guess d1 using goal1(1)[unfolded has_integral,rule_format,OF *] by (elim exE conjE) note d1=this[rule_format] guess d2 using goal1(2)[unfolded has_integral,rule_format,OF *] by (elim exE conjE) note d2=this[rule_format] - obtain p where p: "p tagged_division_of cbox a b" "d1 fine p" "d2 fine p" - using fine_division_exists[OF gauge_inter[OF d1(1) d2(1)], of a b] unfolding fine_inter - by metis + obtain p where p: "p tagged_division_of cbox a b" "d1 fine p" "d2 fine p" + using fine_division_exists[OF gauge_inter[OF d1(1) d2(1)], of a b] unfolding fine_inter + by metis note le_less_trans[OF Basis_le_norm[OF k]] then have "\((\(x, k)\p. content k *\<^sub>R f x) - i) \ k\ < (i \ k - j \ k) / 3" "\((\(x, k)\p. content k *\<^sub>R g x) - j) \ k\ < (i \ k - j \ k) / 3" @@ -4423,7 +4489,7 @@ have *: "\P. \e>(0::real). P e \ \n::nat. P (inverse (real n + 1))" by auto from choice[OF *[OF assms]] guess g .. note g=conjunctD2[OF this[rule_format],rule_format] - from choice[OF allI[OF g(2)[unfolded integrable_on_def], of "\x. x"]] + from choice[OF allI[OF g(2)[unfolded integrable_on_def], of "\x. x"]] obtain i where i: "\x. (g x has_integral i x) (cbox a b)" by auto have "Cauchy i" @@ -4444,7 +4510,7 @@ note * = i[unfolded has_integral,rule_format,OF this] from *[of m] guess gm by (elim conjE exE) note gm=this[rule_format] from *[of n] guess gn by (elim conjE exE) note gn=this[rule_format] - from fine_division_exists[OF gauge_inter[OF gm(1) gn(1)], of a b] + from fine_division_exists[OF gauge_inter[OF gm(1) gn(1)], of a b] obtain p where p: "p tagged_division_of cbox a b" "(\x. gm x \ gn x) fine p" by auto { fix s1 s2 i1 and i2::'b @@ -4485,7 +4551,7 @@ by (auto intro!: triangle3) qed qed - then obtain s where s: "i ----> s" + then obtain s where s: "i ----> s" using convergent_eq_cauchy[symmetric] by blast show ?thesis unfolding integrable_on_def has_integral @@ -4512,7 +4578,7 @@ unfolding norm_minus_commute by (auto simp add: algebra_simps) finally have "norm (sf - s) < e" . - } note lem = this + } note lem = this { fix p assume p: "p tagged_division_of (cbox a b) \ g' fine p" then have norm_less: "norm ((\(x, k)\p. content k *\<^sub>R g (N1 + N2) x) - i (N1 + N2)) < e / 3" @@ -4554,7 +4620,7 @@ and "\x\s. \y\s. f x = f y \ x \ y \ g (f x) = 0" shows "setsum g {f x |x. x \ s \ f x \ a} = setsum (g o f) s" apply (subst setsum_iterate) - using assms monoidal_monoid + using assms monoidal_monoid unfolding setsum_iterate[OF assms(1)] apply (auto intro!: iterate_nonzero_image_lemma) done @@ -4648,14 +4714,14 @@ using assms by simp next case False - then have + 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) + 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 + using assms False apply (subst *) apply (subst setprod.insert) apply (simp_all add: interval_doublesplit[OF k] box_eq_empty not_less less_e) @@ -4997,7 +5063,6 @@ let ?f = "(\x. if x \ t then f x else 0)" show ?thesis apply (rule_tac f="?f" in has_integral_eq) - apply rule unfolding if_P apply (rule refl) apply (subst has_integral_alt) @@ -5095,7 +5160,7 @@ apply (erule_tac x=x in ballE) apply (erule exE) apply (rule_tac x="(xa,x)" in bexI) - apply auto + apply auto done qed have "norm ((\(x, k)\p. content k *\<^sub>R f x) - 0) \ setsum (\i. (real i + 1) * @@ -8197,10 +8262,7 @@ proof - assume ?l then have "?g integrable_on cbox c d" - apply - - apply (rule integrable_subinterval[OF _ assms]) - apply auto - done + using assms has_integral_integrable integrable_subinterval by blast then have *: "f integrable_on cbox c d" apply - apply (rule integrable_eq) @@ -10503,7 +10565,7 @@ lemma bounded_variation_absolutely_integrable_interval: fixes f :: "'n::euclidean_space \ 'm::euclidean_space" - assumes "f integrable_on cbox a b" + assumes f: "f integrable_on cbox a b" and *: "\d. d division_of (cbox a b) \ setsum (\k. norm(integral k f)) d \ B" shows "f absolutely_integrable_on cbox a b" proof - @@ -10515,9 +10577,7 @@ note D = D_1 D_2 let ?S = "SUP x:?D. ?f x" show ?thesis - apply rule - apply (rule assms) - apply rule + apply (rule absolutely_integrable_onI [OF f has_integral_integrable]) apply (subst has_integral[of _ ?S]) proof safe case goal1 @@ -10533,17 +10593,11 @@ apply (rule separate_point_closed) apply (rule closed_Union) apply (rule finite_subset[OF _ d'(1)]) - apply safe - apply (drule d'(4)) + using d'(4) apply auto done then show ?case - apply safe - apply (rule_tac x=da in exI) - apply safe - apply (erule_tac x=xa in ballE) - apply auto - done + by force qed from choice[OF this] guess k .. note k=conjunctD2[OF this[rule_format],rule_format] @@ -10556,9 +10610,8 @@ apply safe proof - show "gauge ?g" - using g(1) + using g(1) k(1) unfolding gauge_def - using k(1) by auto fix p assume "p tagged_division_of (cbox a b)" and "?g fine p" @@ -10641,13 +10694,6 @@ then show "y \ \{k. \x. (x, k) \ p'}" unfolding p'_def Union_iff apply (rule_tac x="i \ l" in bexI) - defer - unfolding mem_Collect_eq - apply (rule_tac x=x in exI)+ - apply (rule_tac x="i\l" in exI) - apply safe - apply (rule_tac x=i in exI) - apply (rule_tac x=l in exI) using i xl apply auto done @@ -10663,10 +10709,8 @@ done then have **: "\(\(x,k)\p'. norm (content k *\<^sub>R f x)) - (\(x,k)\p'. norm (integral k f))\ < e / 2" unfolding split_def - apply (rule helplemma) using p'' - apply auto - done + by (force intro!: helplemma) have p'alt: "p' = {(x,(i \ l)) | x i l. (x,l) \ p \ i \ d \ i \ l \ {}}" proof safe @@ -10676,6 +10720,7 @@ by auto then have "(x, i \ l) \ p'" unfolding p'_def + using goal2 apply safe apply (rule_tac x=x in exI) apply (rule_tac x="i \ l" in exI) @@ -11289,13 +11334,7 @@ and "\a. a \ t \ (f a) absolutely_integrable_on s" shows "(\x. setsum (\a. f a x) t) absolutely_integrable_on s" using assms(1,2) - apply induct - defer - apply (subst setsum.insert) - apply assumption+ - apply rule - apply auto - done + by induct auto lemma bounded_linear_setsum: fixes f :: "'i \ 'a::real_normed_vector \ 'b::real_normed_vector" @@ -11460,7 +11499,7 @@ shows "f absolutely_integrable_on s" unfolding absolutely_integrable_abs_eq apply rule - apply (rule assms) + apply (rule assms)thm integrable_eq apply (rule integrable_eq[of _ f]) using assms apply (auto simp: euclidean_eq_iff[where 'a='m]) @@ -11524,18 +11563,6 @@ qed qed -lemma absolutely_integrable_integrable_bound_real: - fixes f :: "'n::euclidean_space \ real" - assumes "\x\s. norm (f x) \ g x" - and "f integrable_on s" - and "g integrable_on s" - shows "f absolutely_integrable_on s" - apply (rule absolutely_integrable_integrable_bound[where g=g]) - using assms - unfolding o_def - apply auto - done - lemma absolutely_integrable_absolutely_integrable_bound: fixes f :: "'n::euclidean_space \ 'm::euclidean_space" and g :: "'n::euclidean_space \ 'p::euclidean_space" @@ -11670,7 +11697,7 @@ apply (rule cInf_abs_ge) prefer 5 apply rule - apply (rule_tac g = h in absolutely_integrable_integrable_bound_real) + apply (rule_tac g = h in absolutely_integrable_integrable_bound) using assms unfolding real_norm_def apply auto @@ -11682,7 +11709,7 @@ apply (rule absolutely_integrable_onD) apply (rule absolutely_integrable_inf_real) prefer 3 - using absolutely_integrable_integrable_bound_real[OF assms(3,1,2)] + using absolutely_integrable_integrable_bound[OF assms(3,1,2)] apply auto done fix x @@ -11739,7 +11766,7 @@ apply (rule cSup_abs_le) prefer 5 apply rule - apply (rule_tac g=h in absolutely_integrable_integrable_bound_real) + apply (rule_tac g=h in absolutely_integrable_integrable_bound) using assms unfolding real_norm_def apply auto @@ -11751,7 +11778,7 @@ apply (rule absolutely_integrable_onD) apply (rule absolutely_integrable_sup_real) prefer 3 - using absolutely_integrable_integrable_bound_real[OF assms(3,1,2)] + using absolutely_integrable_integrable_bound[OF assms(3,1,2)] apply auto done fix x @@ -11926,4 +11953,351 @@ by simp qed +subsection{*Compute a double integral using iterated integrals and switching the order of integration*} + +lemma setcomp_dot1: "{z. P (z \ (i,0))} = {(x,y). P(x \ i)}" + by auto + +lemma setcomp_dot2: "{z. P (z \ (0,i))} = {(x,y). P(y \ i)}" + by auto + +lemma Sigma_Int_Paircomp1: "(Sigma A B) \ {(x, y). P x} = Sigma (A \ {x. P x}) B" + by blast + +lemma Sigma_Int_Paircomp2: "(Sigma A B) \ {(x, y). P y} = Sigma A (\z. B z \ {y. P y})" + by blast + +lemma continuous_on_imp_integrable_on_Pair1: + fixes f :: "_ \ 'b::banach" + assumes con: "continuous_on (cbox (a,c) (b,d)) f" and x: "x \ cbox a b" + shows "(\y. f (x, y)) integrable_on (cbox c d)" +proof - + have "f o (\y. (x, y)) integrable_on (cbox c d)" + apply (rule integrable_continuous) + apply (rule continuous_on_compose [OF _ continuous_on_subset [OF con]]) + using x + apply (auto intro: continuous_on_Pair continuous_on_const continuous_on_id continuous_on_subset con) + done + then show ?thesis + by (simp add: o_def) +qed + +lemma integral_integrable_2dim: + fixes f :: "('a::euclidean_space * 'b::euclidean_space) \ 'c::banach" + assumes "continuous_on (cbox (a,c) (b,d)) f" + shows "(\x. integral (cbox c d) (\y. f (x,y))) integrable_on cbox a b" +proof (cases "content(cbox c d) = 0") +case True + then show ?thesis + by (simp add: True integrable_const) +next + case False + have uc: "uniformly_continuous_on (cbox (a,c) (b,d)) f" + by (simp add: assms compact_cbox compact_uniformly_continuous) + { fix x::'a and e::real + assume x: "x \ cbox a b" and e: "0 < e" + then have e2_gt: "0 < e / 2 / content (cbox c d)" and e2_less: "e / 2 / content (cbox c d) * content (cbox c d) < e" + by (auto simp: False content_lt_nz e) + then obtain dd + where dd: "\x x'. \x\cbox (a, c) (b, d); x'\cbox (a, c) (b, d); norm (x' - x) < dd\ + \ norm (f x' - f x) \ e / (2 * content (cbox c d))" "dd>0" + using uc [unfolded uniformly_continuous_on_def, THEN spec, of "e / (2 * content (cbox c d))"] + by (auto simp: dist_norm intro: less_imp_le) + have "\delta>0. \x'\cbox a b. norm (x' - x) < delta \ norm (integral (cbox c d) (\u. f (x', u) - f (x, u))) < e" + apply (rule_tac x=dd in exI) + using dd e2_gt assms x + apply clarify + apply (rule le_less_trans [OF _ e2_less]) + apply (rule integrable_bound) + apply (auto intro: integrable_sub continuous_on_imp_integrable_on_Pair1) + done + } note * = this + show ?thesis + apply (rule integrable_continuous) + apply (simp add: * continuous_on_iff dist_norm integral_sub [symmetric] continuous_on_imp_integrable_on_Pair1 [OF assms]) + done +qed + +lemma norm_diff2: "\y = y1 + y2; x = x1 + x2; e = e1 + e2; norm(y1 - x1) \ e1; norm(y2 - x2) \ e2\ + \ norm(y - x) \ e" +using norm_triangle_mono [of "y1 - x1" "e1" "y2 - x2" "e2"] + by (simp add: add_diff_add) + +lemma integral_split: + fixes f :: "'a::euclidean_space \ 'b::{real_normed_vector,complete_space}" + assumes f: "f integrable_on (cbox a b)" + and k: "k \ Basis" + shows "integral (cbox a b) f = + integral (cbox a b \ {x. x\k \ c}) f + + integral (cbox a b \ {x. x\k \ c}) f" + apply (rule integral_unique [OF has_integral_split [where c=c]]) + using k f + apply (auto simp: has_integral_integral [symmetric]) + done + +lemma integral_swap_operative: + fixes f :: "('a::euclidean_space * 'b::euclidean_space) \ 'c::banach" + assumes f: "continuous_on s f" and e: "0 < e" + shows "operative(op \) + (\k. \a b c d. + cbox (a,c) (b,d) \ k \ cbox (a,c) (b,d) \ s + \ norm(integral (cbox (a,c) (b,d)) f - + integral (cbox a b) (\x. integral (cbox c d) (\y. f((x,y))))) + \ e * content (cbox (a,c) (b,d)))" +proof (auto simp: operative_def) + fix a::'a and c::'b and b::'a and d::'b and u::'a and v::'a and w::'b and z::'b + assume c0: "content (cbox (a, c) (b, d)) = 0" + and cb1: "cbox (u, w) (v, z) \ cbox (a, c) (b, d)" + and cb2: "cbox (u, w) (v, z) \ s" + have c0': "content (cbox (u, w) (v, z)) = 0" + by (fact content_0_subset [OF c0 cb1]) + show "norm (integral (cbox (u,w) (v,z)) f - integral (cbox u v) (\x. integral (cbox w z) (\y. f (x, y)))) + \ e * content (cbox (u,w) (v,z))" + using content_cbox_pair_eq0_D [OF c0'] + by (force simp add: c0') +next + fix a::'a and c::'b and b::'a and d::'b + and M::real and i::'a and j::'b + and u::'a and v::'a and w::'b and z::'b + assume ij: "(i,j) \ Basis" + and n1: "\a' b' c' d'. + cbox (a',c') (b',d') \ cbox (a,c) (b,d) \ + cbox (a',c') (b',d') \ {x. x \ (i,j) \ M} \ cbox (a',c') (b',d') \ s \ + norm (integral (cbox (a',c') (b',d')) f - integral (cbox a' b') (\x. integral (cbox c' d') (\y. f (x,y)))) + \ e * content (cbox (a',c') (b',d'))" + and n2: "\a' b' c' d'. + cbox (a',c') (b',d') \ cbox (a,c) (b,d) \ + cbox (a',c') (b',d') \ {x. M \ x \ (i,j)} \ cbox (a',c') (b',d') \ s \ + norm (integral (cbox (a',c') (b',d')) f - integral (cbox a' b') (\x. integral (cbox c' d') (\y. f (x,y)))) + \ e * content (cbox (a',c') (b',d'))" + and subs: "cbox (u,w) (v,z) \ cbox (a,c) (b,d)" "cbox (u,w) (v,z) \ s" + have fcont: "continuous_on (cbox (u, w) (v, z)) f" + using assms(1) continuous_on_subset subs(2) by blast + then have fint: "f integrable_on cbox (u, w) (v, z)" + by (metis integrable_continuous) + consider "i \ Basis" "j=0" | "j \ Basis" "i=0" using ij + by (auto simp: Euclidean_Space.Basis_prod_def) + then show "norm (integral (cbox (u,w) (v,z)) f - integral (cbox u v) (\x. integral (cbox w z) (\y. f (x,y)))) + \ e * content (cbox (u,w) (v,z))" (is ?normle) + proof cases + case 1 + then have e: "e * content (cbox (u, w) (v, z)) = + e * (content (cbox u v \ {x. x \ i \ M}) * content (cbox w z)) + + e * (content (cbox u v \ {x. M \ x \ i}) * content (cbox w z))" + by (simp add: content_split [where c=M] content_Pair algebra_simps) + have *: "integral (cbox u v) (\x. integral (cbox w z) (\y. f (x, y))) = + integral (cbox u v \ {x. x \ i \ M}) (\x. integral (cbox w z) (\y. f (x, y))) + + integral (cbox u v \ {x. M \ x \ i}) (\x. integral (cbox w z) (\y. f (x, y)))" + using 1 f subs integral_integrable_2dim continuous_on_subset + by (blast intro: integral_split) + show ?normle + apply (rule norm_diff2 [OF integral_split [where c=M, OF fint ij] * e]) + using 1 subs + apply (simp_all add: cbox_Pair_eq setcomp_dot1 [of "\u. M\u"] setcomp_dot1 [of "\u. u\M"] Sigma_Int_Paircomp1) + apply (simp_all add: interval_split ij) + apply (simp_all add: cbox_Pair_eq [symmetric] content_Pair [symmetric]) + apply (force simp add: interval_split [symmetric] intro!: n1 [rule_format]) + apply (force simp add: interval_split [symmetric] intro!: n2 [rule_format]) + done + next + case 2 + then have e: "e * content (cbox (u, w) (v, z)) = + e * (content (cbox u v) * content (cbox w z \ {x. x \ j \ M})) + + e * (content (cbox u v) * content (cbox w z \ {x. M \ x \ j}))" + by (simp add: content_split [where c=M] content_Pair algebra_simps) + have "(\x. integral (cbox w z \ {x. x \ j \ M}) (\y. f (x, y))) integrable_on cbox u v" + "(\x. integral (cbox w z \ {x. M \ x \ j}) (\y. f (x, y))) integrable_on cbox u v" + using 2 subs + apply (simp_all add: interval_split) + apply (rule_tac [!] integral_integrable_2dim [OF continuous_on_subset [OF f]]) + apply (auto simp: cbox_Pair_eq interval_split [symmetric]) + done + with 2 have *: "integral (cbox u v) (\x. integral (cbox w z) (\y. f (x, y))) = + integral (cbox u v) (\x. integral (cbox w z \ {x. x \ j \ M}) (\y. f (x, y))) + + integral (cbox u v) (\x. integral (cbox w z \ {x. M \ x \ j}) (\y. f (x, y)))" + by (simp add: integral_add [symmetric] integral_split [symmetric] + continuous_on_imp_integrable_on_Pair1 [OF fcont] cong: integral_cong) + show ?normle + apply (rule norm_diff2 [OF integral_split [where c=M, OF fint ij] * e]) + using 2 subs + apply (simp_all add: cbox_Pair_eq setcomp_dot2 [of "\u. M\u"] setcomp_dot2 [of "\u. u\M"] Sigma_Int_Paircomp2) + apply (simp_all add: interval_split ij) + apply (simp_all add: cbox_Pair_eq [symmetric] content_Pair [symmetric]) + apply (force simp add: interval_split [symmetric] intro!: n1 [rule_format]) + apply (force simp add: interval_split [symmetric] intro!: n2 [rule_format]) + done + qed +qed + +lemma dense_eq0_I: + fixes x::"'a::{dense_linorder,ordered_ab_group_add_abs}" + shows "(\e. 0 < e \ \x\ \ e) ==> x = 0" +by (metis dense not_less zero_less_abs_iff) + +lemma integral_Pair_const: + "integral (cbox (a,c) (b,d)) (\x. k) = + integral (cbox a b) (\x. integral (cbox c d) (\y. k))" + by (simp add: content_Pair) + +lemma norm_minus2: "norm (x1-x2, y1-y2) = norm (x2-x1, y2-y1)" + by (simp add: norm_minus_eqI) + +lemma integral_prod_continuous: + fixes f :: "('a::euclidean_space * 'b::euclidean_space) \ 'c::banach" + assumes "continuous_on (cbox (a,c) (b,d)) f" (is "continuous_on ?CBOX f") + shows "integral (cbox (a,c) (b,d)) f = integral (cbox a b) (\x. integral (cbox c d) (\y. f(x,y)))" +proof (cases "content ?CBOX = 0") + case True + then show ?thesis + by (auto simp: content_Pair) +next + case False + then have cbp: "content ?CBOX > 0" + using content_lt_nz by blast + have "norm (integral ?CBOX f - integral (cbox a b) (\x. integral (cbox c d) (\y. f (x,y)))) = 0" + proof (rule dense_eq0_I, simp) + fix e::real assume "0 < e" + with cbp have e': "0 < e / content ?CBOX" + by simp + have f_int_acbd: "f integrable_on cbox (a,c) (b,d)" + by (rule integrable_continuous [OF assms]) + { fix p + assume p: "p division_of cbox (a,c) (b,d)" + note opd1 = operative_division_and [OF integral_swap_operative [OF assms e'], THEN iffD1, + THEN spec, THEN spec, THEN spec, THEN spec, of p "(a,c)" "(b,d)" a c b d] + have "(\t u v w z. + \t \ p; cbox (u,w) (v,z) \ t; cbox (u,w) (v,z) \ cbox (a,c) (b,d)\ \ + norm (integral (cbox (u,w) (v,z)) f - integral (cbox u v) (\x. integral (cbox w z) (\y. f (x,y)))) + \ e * content (cbox (u,w) (v,z)) / content?CBOX) + \ + norm (integral ?CBOX f - integral (cbox a b) (\x. integral (cbox c d) (\y. f (x,y)))) \ e" + using opd1 [OF p] False by simp + } note op_acbd = this + { fix k::real and p and u::'a and v w and z::'b and t1 t2 l + assume k: "0 < k" + and nf: "\x y u v. + \x \ cbox a b; y \ cbox c d; u \ cbox a b; v\cbox c d; norm (u-x, v-y) < k\ + \ norm (f(u,v) - f(x,y)) < e / (2 * (content ?CBOX))" + and p_acbd: "p tagged_division_of cbox (a,c) (b,d)" + and fine: "(\x. ball x k) fine p" "((t1,t2), l) \ p" + and uwvz_sub: "cbox (u,w) (v,z) \ l" "cbox (u,w) (v,z) \ cbox (a,c) (b,d)" + have t: "t1 \ cbox a b" "t2 \ cbox c d" + by (meson fine p_acbd cbox_Pair_iff tag_in_interval)+ + have ls: "l \ ball (t1,t2) k" + using fine by (simp add: fine_def Ball_def) + { fix x1 x2 + assume xuvwz: "x1 \ cbox u v" "x2 \ cbox w z" + then have x: "x1 \ cbox a b" "x2 \ cbox c d" + using uwvz_sub by auto + have "norm (x1 - t1, x2 - t2) < k" + using xuvwz ls uwvz_sub unfolding ball_def + by (force simp add: cbox_Pair_eq dist_norm norm_minus2) + then have "norm (f (x1,x2) - f (t1,t2)) \ e / content ?CBOX / 2" + using nf [OF t x] by simp + } note nf' = this + have f_int_uwvz: "f integrable_on cbox (u,w) (v,z)" + using f_int_acbd uwvz_sub integrable_on_subcbox by blast + have f_int_uv: "\x. x \ cbox u v \ (\y. f (x,y)) integrable_on cbox w z" + using assms continuous_on_subset uwvz_sub + by (blast intro: continuous_on_imp_integrable_on_Pair1) + have 1: "norm (integral (cbox (u,w) (v,z)) f - integral (cbox (u,w) (v,z)) (\x. f (t1,t2))) + \ e * content (cbox (u,w) (v,z)) / content ?CBOX / 2" + apply (simp only: integral_sub [symmetric] f_int_uwvz integrable_const) + apply (rule order_trans [OF integrable_bound [of "e / content ?CBOX / 2"]]) + using cbp e' nf' + apply (auto simp: integrable_sub f_int_uwvz integrable_const) + done + have int_integrable: "(\x. integral (cbox w z) (\y. f (x, y))) integrable_on cbox u v" + using assms integral_integrable_2dim continuous_on_subset uwvz_sub(2) by blast + have normint_wz: + "\x. x \ cbox u v \ + norm (integral (cbox w z) (\y. f (x, y)) - integral (cbox w z) (\y. f (t1, t2))) + \ e * content (cbox w z) / content (cbox (a, c) (b, d)) / 2" + apply (simp only: integral_sub [symmetric] f_int_uv integrable_const) + apply (rule order_trans [OF integrable_bound [of "e / content ?CBOX / 2"]]) + using cbp e' nf' + apply (auto simp: integrable_sub f_int_uv integrable_const) + done + have "norm (integral (cbox u v) + (\x. integral (cbox w z) (\y. f (x,y)) - integral (cbox w z) (\y. f (t1,t2)))) + \ e * content (cbox w z) / content ?CBOX / 2 * content (cbox u v)" + apply (rule integrable_bound [OF _ _ normint_wz]) + using cbp e' + apply (auto simp: divide_simps content_pos_le integrable_sub int_integrable integrable_const) + done + also have "... \ e * content (cbox (u,w) (v,z)) / content ?CBOX / 2" + by (simp add: content_Pair divide_simps) + finally have 2: "norm (integral (cbox u v) (\x. integral (cbox w z) (\y. f (x,y))) - + integral (cbox u v) (\x. integral (cbox w z) (\y. f (t1,t2)))) + \ e * content (cbox (u,w) (v,z)) / content ?CBOX / 2" + by (simp only: integral_sub [symmetric] int_integrable integrable_const) + have norm_xx: "\x' = y'; norm(x - x') \ e/2; norm(y - y') \ e/2\ \ norm(x - y) \ e" for x::'c and y x' y' e + using norm_triangle_mono [of "x-y'" "e/2" "y'-y" "e/2"] real_sum_of_halves + by (simp add: norm_minus_commute) + have "norm (integral (cbox (u,w) (v,z)) f - integral (cbox u v) (\x. integral (cbox w z) (\y. f (x,y)))) + \ e * content (cbox (u,w) (v,z)) / content ?CBOX" + by (rule norm_xx [OF integral_Pair_const 1 2]) + } note * = this + show "norm (integral ?CBOX f - integral (cbox a b) (\x. integral (cbox c d) (\y. f (x,y)))) \ e" + using compact_uniformly_continuous [OF assms compact_cbox] + apply (simp add: uniformly_continuous_on_def dist_norm) + apply (drule_tac x="e / 2 / content?CBOX" in spec) + using cbp `0 < e` + apply (auto simp: zero_less_mult_iff) + apply (rename_tac k) + apply (rule_tac e1=k in fine_division_exists [OF gauge_ball, where a = "(a,c)" and b = "(b,d)"]) + apply assumption + apply (rule op_acbd) + apply (erule division_of_tagged_division) + using * + apply auto + done + qed + then show ?thesis + by simp +qed + +lemma swap_continuous: + assumes "continuous_on (cbox (a,c) (b,d)) (\(x,y). f x y)" + shows "continuous_on (cbox (c,a) (d,b)) (\(x, y). f y x)" +proof - + have "(\(x, y). f y x) = (\(x, y). f x y) o prod.swap" + by auto + then show ?thesis + apply (rule ssubst) + apply (rule continuous_on_compose) + apply (simp add: split_def) + apply (rule continuous_intros | simp add: assms)+ + done +qed + +lemma integral_swap_2dim: + fixes f :: "['a::euclidean_space, 'b::euclidean_space] \ 'c::banach" + assumes "continuous_on (cbox (a,c) (b,d)) (\(x,y). f x y)" + shows "integral (cbox (a, c) (b, d)) (\(x, y). f x y) = integral (cbox (c, a) (d, b)) (\(x, y). f y x)" +proof - + have "((\(x, y). f x y) has_integral integral (cbox (c, a) (d, b)) (\(x, y). f y x)) (prod.swap ` (cbox (c, a) (d, b)))" + apply (rule has_integral_twiddle [of 1 prod.swap prod.swap "\(x,y). f y x" "integral (cbox (c, a) (d, b)) (\(x, y). f y x)", simplified]) + apply (auto simp: isCont_swap content_Pair has_integral_integral [symmetric] integrable_continuous swap_continuous assms) + done + then show ?thesis + by force +qed + +theorem integral_swap_continuous: + fixes f :: "['a::euclidean_space, 'b::euclidean_space] \ 'c::banach" + assumes "continuous_on (cbox (a,c) (b,d)) (\(x,y). f x y)" + shows "integral (cbox a b) (\x. integral (cbox c d) (f x)) = + integral (cbox c d) (\y. integral (cbox a b) (\x. f x y))" +proof - + have "integral (cbox a b) (\x. integral (cbox c d) (f x)) = integral (cbox (a, c) (b, d)) (\(x, y). f x y)" + using integral_prod_continuous [OF assms] by auto + also have "... = integral (cbox (c, a) (d, b)) (\(x, y). f y x)" + by (rule integral_swap_2dim [OF assms]) + also have "... = integral (cbox c d) (\y. integral (cbox a b) (\x. f x y))" + using integral_prod_continuous [OF swap_continuous] assms + by auto + finally show ?thesis . +qed + end diff -r 9627a75eb32a -r e5fa1d5d3952 src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Mon Jun 29 13:49:21 2015 +0200 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Tue Jun 30 13:56:16 2015 +0100 @@ -840,6 +840,18 @@ "x \ cbox a b \ (\i\Basis. a \ i \ x \ i \ x \ i \ b \ i)" by (auto simp: box_eucl_less eucl_less_def cbox_def) +lemma cbox_Pair_eq: "cbox (a, c) (b, d) = cbox a b \ cbox c d" + by (force simp: cbox_def Basis_prod_def) + +lemma cbox_Pair_iff [iff]: "(x, y) \ cbox (a, c) (b, d) \ x \ cbox a b \ y \ cbox c d" + by (force simp: cbox_Pair_eq) + +lemma cbox_Pair_eq_0: "cbox (a, c) (b, d) = {} \ cbox a b = {} \ cbox c d = {}" + by (force simp: cbox_Pair_eq) + +lemma swap_cbox_Pair [simp]: "prod.swap ` cbox (c, a) (d, b) = cbox (a,c) (b,d)" + by auto + lemma mem_box_real[simp]: "(x::real) \ box a b \ a < x \ x < b" "(x::real) \ cbox a b \ a \ x \ x \ b" @@ -2794,6 +2806,11 @@ by (auto intro!: exI[of _ "b + norm a"]) qed +lemma bounded_uminus [simp]: + fixes X :: "'a::euclidean_space set" + shows "bounded (uminus ` X) \ bounded X" +by (auto simp: bounded_def dist_norm; rule_tac x="-x" in exI; force simp add: add.commute norm_minus_commute) + text\Some theorems on sups and infs using the notion "bounded".\ @@ -2808,7 +2825,15 @@ by (auto simp: bounded_def bdd_below_def dist_real_def) (metis abs_le_D1 add.commute diff_le_eq) -(* TODO: remove the following lemmas about Inf and Sup, is now in conditionally complete lattice *) +lemma bounded_inner_imp_bdd_above: + assumes "bounded s" + shows "bdd_above ((\x. x \ a) ` s)" +by (simp add: assms bounded_imp_bdd_above bounded_linear_image bounded_linear_inner_left) + +lemma bounded_inner_imp_bdd_below: + assumes "bounded s" + shows "bdd_below ((\x. x \ a) ` s)" +by (simp add: assms bounded_imp_bdd_below bounded_linear_image bounded_linear_inner_left) lemma bounded_has_Sup: fixes S :: "real set" diff -r 9627a75eb32a -r e5fa1d5d3952 src/HOL/NthRoot.thy --- a/src/HOL/NthRoot.thy Mon Jun 29 13:49:21 2015 +0200 +++ b/src/HOL/NthRoot.thy Tue Jun 30 13:56:16 2015 +0100 @@ -448,6 +448,11 @@ lemmas real_sqrt_le_1_iff [simp] = real_sqrt_le_iff [where y=1, unfolded real_sqrt_one] lemmas real_sqrt_eq_1_iff [simp] = real_sqrt_eq_iff [where y=1, unfolded real_sqrt_one] +lemma sqrt_add_le_add_sqrt: + assumes "0 \ x" "0 \ y" + shows "sqrt (x + y) \ sqrt x + sqrt y" +by (rule power2_le_imp_le) (simp_all add: power2_sum assms) + lemma isCont_real_sqrt: "isCont sqrt x" unfolding sqrt_def by (rule isCont_real_root) diff -r 9627a75eb32a -r e5fa1d5d3952 src/HOL/Probability/Lebesgue_Measure.thy --- a/src/HOL/Probability/Lebesgue_Measure.thy Mon Jun 29 13:49:21 2015 +0200 +++ b/src/HOL/Probability/Lebesgue_Measure.thy Tue Jun 30 13:56:16 2015 +0100 @@ -19,7 +19,7 @@ lemma emeasure_interval_measure_Ioc: assumes "a \ b" assumes mono_F: "\x y. x \ y \ F x \ F y" - assumes right_cont_F : "\a. continuous (at_right a) F" + assumes right_cont_F : "\a. continuous (at_right a) F" shows "emeasure (interval_measure F) {a <.. b} = F b - F a" proof (rule extend_measure_caratheodory_pair[OF interval_measure_def `a \ b`]) show "semiring_of_sets UNIV {{a<..b} |a b :: real. a \ b}" @@ -40,10 +40,10 @@ thus ?thesis .. qed qed (auto simp: Ioc_inj, metis linear) - + next fix l r :: "nat \ real" and a b :: real - assume l_r[simp]: "\n. l n \ r n" and "a \ b" and disj: "disjoint_family (\n. {l n<..r n})" + assume l_r[simp]: "\n. l n \ r n" and "a \ b" and disj: "disjoint_family (\n. {l n<..r n})" assume lr_eq_ab: "(\i. {l i<..r i}) = {a<..b}" have [intro, simp]: "\a b. a \ b \ 0 \ F b - F a" @@ -171,7 +171,7 @@ { fix epsilon :: real assume egt0: "epsilon > 0" have "\i. \d. d > 0 & F (r i + d) < F (r i) + epsilon / 2^(i+2)" - proof + proof fix i note right_cont_F [of "r i"] thus "\d. d > 0 \ F (r i + d) < F (r i) + epsilon / 2^(i+2)" @@ -182,7 +182,7 @@ apply (erule impE) using egt0 by (auto simp add: field_simps) qed - then obtain delta where + then obtain delta where deltai_gt0: "\i. delta i > 0" and deltai_prop: "\i. F (r i + delta i) < F (r i) + epsilon / 2^(i+2)" by metis @@ -192,12 +192,12 @@ using mono_F apply force apply (drule_tac x = "epsilon / 2" in spec) using egt0 unfolding mult.commute [of 2] by force - then obtain a' where a'lea [arith]: "a' > a" and + then obtain a' where a'lea [arith]: "a' > a" and a_prop: "F a' - F a < epsilon / 2" by auto def S' \ "{i. l i < r i}" - obtain S :: "nat set" where - "S \ S'" and finS: "finite S" and + obtain S :: "nat set" where + "S \ S'" and finS: "finite S" and Sprop: "{a'..b} \ (\i \ S. {l i<.. (\i \ S'. {l i<..i. i \ S \ l i < r i" by auto - from finS have "\n. \i \ S. i \ n" + from finS have "\n. \i \ S. i \ n" by (subst finite_nat_set_iff_bounded_le [symmetric]) then obtain n where Sbound [rule_format]: "\i \ S. i \ n" .. have "F b - F a' \ (\i\S. F (r i + delta i) - F (l i))" @@ -233,14 +233,14 @@ apply (rule less_imp_le) apply (rule deltai_prop) by auto - also have "... = (SUM i : S. F(r i) - F(l i)) + + also have "... = (SUM i : S. F(r i) - F(l i)) + (epsilon / 4) * (SUM i : S. (1 / 2)^i)" (is "_ = ?t + _") by (subst setsum.distrib) (simp add: field_simps setsum_right_distrib) also have "... \ ?t + (epsilon / 4) * (\ i < Suc n. (1 / 2)^i)" apply (rule add_left_mono) apply (rule mult_left_mono) apply (rule setsum_mono2) - using egt0 apply auto + using egt0 apply auto by (frule Sbound, auto) also have "... \ ?t + (epsilon / 2)" apply (rule add_left_mono) @@ -285,7 +285,7 @@ lemma measure_interval_measure_Ioc: assumes "a \ b" assumes mono_F: "\x y. x \ y \ F x \ F y" - assumes right_cont_F : "\a. continuous (at_right a) F" + assumes right_cont_F : "\a. continuous (at_right a) F" shows "measure (interval_measure F) {a <.. b} = F b - F a" unfolding measure_def apply (subst emeasure_interval_measure_Ioc) @@ -312,7 +312,7 @@ lemma emeasure_interval_measure_Icc: assumes "a \ b" assumes mono_F: "\x y. x \ y \ F x \ F y" - assumes cont_F : "continuous_on UNIV F" + assumes cont_F : "continuous_on UNIV F" shows "emeasure (interval_measure F) {a .. b} = F b - F a" proof (rule tendsto_unique) { fix a b :: real assume "a \ b" then have "emeasure (interval_measure F) {a <.. b} = F b - F a" @@ -349,10 +349,10 @@ by (intro lim_ereal[THEN iffD2] tendsto_intros ) (auto simp: continuous_on_def intro: tendsto_within_subset) qed (rule trivial_limit_at_left_real) - + lemma sigma_finite_interval_measure: assumes mono_F: "\x y. x \ y \ F x \ F y" - assumes right_cont_F : "\a. continuous (at_right a) F" + assumes right_cont_F : "\a. continuous (at_right a) F" shows "sigma_finite_measure (interval_measure F)" apply unfold_locales apply (intro exI[of _ "(\(a, b). {a <.. b}) ` (\ \ \)"]) @@ -364,7 +364,7 @@ definition lborel :: "('a :: euclidean_space) measure" where "lborel = distr (\\<^sub>M b\Basis. interval_measure (\x. x)) borel (\f. \b\Basis. f b *\<^sub>R b)" -lemma +lemma shows sets_lborel[simp, measurable_cong]: "sets lborel = sets borel" and space_lborel[simp]: "space lborel = space borel" and measurable_lborel1[simp]: "measurable M lborel = measurable M borel" @@ -395,7 +395,7 @@ by (simp add: lborel_def nn_integral_distr product_nn_integral_setprod product_nn_integral_singleton) -lemma emeasure_lborel_Icc[simp]: +lemma emeasure_lborel_Icc[simp]: fixes l u :: real assumes [simp]: "l \ u" shows "emeasure lborel {l .. u} = u - l" @@ -486,7 +486,7 @@ and measure_lborel_Ioo[simp]: "measure lborel {l <..< u} = u - l" by (simp_all add: measure_def) -lemma +lemma assumes [simp]: "\b. b \ Basis \ l \ b \ u \ b" shows measure_lborel_box[simp]: "measure lborel (box l u) = (\b\Basis. (u - l) \ b)" and measure_lborel_cbox[simp]: "measure lborel (cbox l u) = (\b\Basis. (u - l) \ b)" @@ -507,7 +507,7 @@ let ?Ba = "Basis :: 'a set" have "real n \ (2::real) ^ card ?Ba * real n" by (simp add: mult_le_cancel_right1) - also + also have "... \ (2::real) ^ card ?Ba * real (Suc n) ^ card ?Ba" apply (rule mult_left_mono) apply (metis DIM_positive One_nat_def less_eq_Suc_le less_imp_le real_of_nat_le_iff real_of_nat_power self_le_power zero_less_Suc) @@ -518,9 +518,9 @@ show ?thesis unfolding UN_box_eq_UNIV[symmetric] apply (subst SUP_emeasure_incseq[symmetric]) - apply (auto simp: incseq_def subset_box inner_add_left setprod_constant + apply (auto simp: incseq_def subset_box inner_add_left setprod_constant intro!: SUP_PInfty) - done + done qed lemma emeasure_lborel_singleton[simp]: "emeasure lborel {x} = 0" @@ -551,7 +551,7 @@ assume asm: "lborel = count_space A" have "space lborel = UNIV" by simp hence [simp]: "A = UNIV" by (subst (asm) asm) (simp only: space_count_space) - have "emeasure lborel {undefined::'a} = 1" + have "emeasure lborel {undefined::'a} = 1" by (subst asm, subst emeasure_count_space_finite) auto moreover have "emeasure lborel {undefined} \ 1" by simp ultimately show False by contradiction @@ -607,7 +607,7 @@ 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 :: ereal)" by (auto split: split_indicator) moreover - { have "(- c) ^ card ?B * (\x\?B. l \ x - u \ x) = + { have "(- c) ^ card ?B * (\x\?B. l \ x - u \ x) = (-1 * c) ^ card ?B * (\x\?B. -1 * (u \ x - l \ x))" by simp also have "\ = (-1 * -1)^card ?B * c ^ card ?B * (\x\?B. u \ x - l \ x)" @@ -626,7 +626,7 @@ "c \ 0 \ lborel = density (distr lborel borel (\x. t + c * x)) (\_. \c\)" using lborel_affine[of c t] by simp -lemma AE_borel_affine: +lemma AE_borel_affine: fixes P :: "real \ bool" shows "c \ 0 \ Measurable.pred borel P \ AE x in lborel. P x \ AE x in lborel. P (t + c * x)" by (subst lborel_real_affine[where t="- t / c" and c="1 / c"]) @@ -666,7 +666,7 @@ by (simp add: lborel_integrable_real_affine_iff not_integrable_integral_eq) qed -lemma divideR_right: +lemma divideR_right: fixes x y :: "'a::real_normed_vector" shows "r \ 0 \ y = x /\<^sub>R r \ r *\<^sub>R y = x" using scaleR_cancel_left[of r y "x /\<^sub>R r"] by simp @@ -680,10 +680,10 @@ by (simp_all add: lborel_integral_real_affine[symmetric] divideR_right cong: conj_cong) lemma lborel_distr_uminus: "distr lborel borel uminus = (lborel :: real measure)" - by (subst lborel_real_affine[of "-1" 0]) + by (subst lborel_real_affine[of "-1" 0]) (auto simp: density_1 one_ereal_def[symmetric]) -lemma lborel_distr_mult: +lemma lborel_distr_mult: assumes "(c::real) \ 0" shows "distr lborel borel (op * c) = density lborel (\_. inverse \c\)" proof- @@ -693,7 +693,7 @@ finally show ?thesis . qed -lemma lborel_distr_mult': +lemma lborel_distr_mult': assumes "(c::real) \ 0" shows "lborel = density (distr lborel borel (op * c)) (\_. abs c)" proof- @@ -789,7 +789,7 @@ 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_eq_eq[THEN iffD1, rotated 1]) auto + 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)" @@ -887,7 +887,7 @@ case (seq U) note seq(1)[measurable] and f[measurable] - { fix i x + { fix i x have "U i x \ f x" using seq(5) apply (rule LIMSEQ_le_const) @@ -895,7 +895,7 @@ apply (auto intro!: exI[of _ i] simp: incseq_def le_fun_def) done } note U_le_f = this - + { fix i have "(\\<^sup>+x. ereal (U i x) \lborel) \ (\\<^sup>+x. ereal (f x) \lborel)" using U_le_f by (intro nn_integral_mono) simp @@ -951,7 +951,7 @@ by (intro has_integral_integrable[where i=r] nn_integral_has_integral[where r=r] f) qed -lemma nn_integral_has_integral_lborel: +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" @@ -996,7 +996,7 @@ have "emeasure lborel {x \ space lborel. ereal (real (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. ereal (real (F i x) * indicator (?B i) x) \ 0} < \" + then show "emeasure lborel {x \ space lborel. ereal (real (F i x) * indicator (?B i) x) \ 0} < \" by auto qed (auto split: split_indicator intro!: real_of_ereal_pos F simple_function_compose1[where g="real"] simple_function_ereal) @@ -1004,8 +1004,8 @@ have int_F: "(\x. real (F i x) * indicator (?B i) x) integrable_on UNIV" using F(5) finite_F by (intro nn_integral_integrable_on) (auto split: split_indicator intro: real_of_ereal_pos) - - have "(\\<^sup>+ x. F i x * indicator (?B i) x \lborel) = + + have "(\\<^sup>+ x. F i x * indicator (?B i) x \lborel) = (\\<^sup>+ x. ereal (real (F i x) * indicator (?B i) x) \lborel)" using F(3,5) by (intro nn_integral_cong) (auto simp: image_iff ereal_real eq_commute split: split_indicator) @@ -1100,7 +1100,7 @@ lemma integrable_on_lborel: "integrable lborel f \ f integrable_on UNIV" using has_integral_integral_lborel by (auto intro: has_integral_integrable) - + lemma integral_lborel: "integrable lborel f \ integral UNIV f = (\x. f x \lborel)" using has_integral_integral_lborel by auto @@ -1161,7 +1161,7 @@ text {* -For the positive integral we replace continuity with Borel-measurability. +For the positive integral we replace continuity with Borel-measurability. *} @@ -1177,7 +1177,7 @@ 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 has_integral F b - F a) {a..b}" by (intro fundamental_theorem_of_calculus) (auto simp: has_field_derivative_iff_has_vector_derivative[symmetric] @@ -1209,7 +1209,7 @@ 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 + 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] @@ -1242,7 +1242,7 @@ 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 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. ereal (f x) * indicator {a ..} x \lborel) = T - F a" @@ -1280,7 +1280,7 @@ with f nonneg show "F (a + real m) \ F (a + real n)" by (intro DERIV_nonneg_imp_nondecreasing[where f=F]) (simp, metis add_increasing2 order_refl order_trans real_of_nat_ge_zero) - qed + qed 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]) @@ -1320,10 +1320,10 @@ 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" + = 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) + 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) = @@ -1343,7 +1343,7 @@ 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" + = 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: @@ -1379,7 +1379,7 @@ (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 + 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)" diff -r 9627a75eb32a -r e5fa1d5d3952 src/HOL/Probability/Set_Integral.thy --- a/src/HOL/Probability/Set_Integral.thy Mon Jun 29 13:49:21 2015 +0200 +++ b/src/HOL/Probability/Set_Integral.thy Tue Jun 30 13:56:16 2015 +0100 @@ -10,7 +10,7 @@ imports Bochner_Integration Lebesgue_Measure begin -(* +(* Notation *) @@ -67,8 +67,8 @@ translations "LBINT x:A. f" == "CONST set_lebesgue_integral CONST lborel A (\x. f)" -(* - Basic properties +(* + Basic properties *) (* @@ -93,13 +93,13 @@ lemma set_integrable_cong_AE: "f \ borel_measurable M \ g \ borel_measurable M \ - AE x \ A in M. f x = g x \ A \ sets M \ + AE x \ A in M. f x = g x \ A \ sets M \ set_integrable M A f = set_integrable M A g" by (rule integrable_cong_AE) auto -lemma set_integrable_subset: +lemma set_integrable_subset: fixes M A B and f :: "_ \ _ :: {banach, second_countable_topology}" - assumes "set_integrable M A f" "B \ sets M" "B \ A" + assumes "set_integrable M A f" "B \ sets M" "B \ A" shows "set_integrable M B f" proof - have "set_integrable M B (\x. indicator A x *\<^sub>R f x)" @@ -114,17 +114,17 @@ 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) -lemma set_integral_mult_right [simp]: +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) -lemma set_integral_mult_left [simp]: +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) -lemma set_integral_divide_zero [simp]: +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) @@ -198,7 +198,7 @@ shows "(LINT x:A|M. f x) \ (LINT x:A|M. g x)" using assms by (auto intro: integral_mono split: split_indicator) -lemma set_integral_mono_AE: +lemma set_integral_mono_AE: fixes f g :: "_ \ real" assumes "set_integrable M A f" "set_integrable M A g" "AE x \ A in M. f x \ g x" @@ -210,12 +210,12 @@ lemma set_integrable_abs_iff: fixes f :: "_ \ real" - shows "set_borel_measurable M A f \ set_integrable M A (\x. \f x\) = set_integrable M A f" + shows "set_borel_measurable M A f \ set_integrable M A (\x. \f x\) = set_integrable M A f" by (subst (2) integrable_abs_iff[symmetric]) (simp_all add: abs_mult ac_simps) lemma set_integrable_abs_iff': fixes f :: "_ \ real" - shows "f \ borel_measurable M \ A \ sets M \ + shows "f \ borel_measurable M \ A \ sets M \ set_integrable M A (\x. \f x\) = set_integrable M A f" by (intro set_integrable_abs_iff) auto @@ -303,7 +303,7 @@ then have f': "set_borel_measurable M (A \ B) f" by (rule borel_measurable_integrable) have "LINT x:A\B|M. f x = LINT x:(A - A \ B) \ (B - A \ B)|M. f x" - proof (rule set_integral_cong_set) + proof (rule set_integral_cong_set) show "AE x in M. (x \ A - A \ B \ (B - A \ B)) = (x \ A \ B)" using ae by auto show "set_borel_measurable M (A - A \ B \ (B - A \ B)) f" @@ -389,7 +389,7 @@ fix n show "0 \ LINT x|M. norm (indicator (A n) x *\<^sub>R f x)" using norm_f by (auto intro!: integral_nonneg_AE) - + have "(\iR f x)) = (\ix. norm (f x)))" by (simp add: abs_mult) @@ -423,7 +423,7 @@ then show "\i. set_borel_measurable M (A i) f" "set_borel_measurable M (\i. A i) f" "set_integrable M (\i. A i) (\x. norm (f x))" using intgbl integrable_norm[OF intgbl] by auto - + { fix x i assume "x \ A i" with A have "(\xa. indicator (A xa) x::real) ----> 1 \ (\xa. 1::real) ----> 1" by (intro filterlim_cong refl) @@ -431,7 +431,7 @@ then show "AE x in M. (\i. indicator (A i) x *\<^sub>R f x) ----> indicator (\i. A i) x *\<^sub>R f x" by (intro AE_I2 tendsto_intros) (auto split: split_indicator) qed (auto split: split_indicator) - + (* Can the int0 hypothesis be dropped? *) lemma set_integral_cont_down: fixes f :: "_ \ 'a :: {banach, second_countable_topology}" @@ -549,7 +549,7 @@ have "(f has_integral F b - F a) {a .. b}" by (intro fundamental_theorem_of_calculus ballI assms) auto then have "(?f has_integral F b - F a) {a .. b}" - by (subst has_integral_eq_eq[where g=f]) auto + by (subst has_integral_cong[where g=f]) auto then have "(?f has_integral F b - F a) UNIV" by (intro has_integral_on_superset[where t=UNIV and s="{a..b}"]) auto ultimately show "integral\<^sup>L lborel ?f = F b - F a" diff -r 9627a75eb32a -r e5fa1d5d3952 src/HOL/Rings.thy --- a/src/HOL/Rings.thy Mon Jun 29 13:49:21 2015 +0200 +++ b/src/HOL/Rings.thy Tue Jun 30 13:56:16 2015 +0100 @@ -1362,7 +1362,30 @@ lemma add_diff_inverse: "~ a b + (a - b) = a" by simp - + +lemma add_le_imp_le_diff: + shows "i + k \ n \ i \ n - k" + apply (subst add_le_cancel_right [where c=k, symmetric]) + apply (frule le_add_diff_inverse2) + apply (simp only: add.assoc [symmetric]) + using add_implies_diff by fastforce + +lemma add_le_add_imp_diff_le: + assumes a1: "i + k \ n" + and a2: "n \ j + k" + shows "\i + k \ n; n \ j + k\ \ n - k \ j" +proof - + have "n - (i + k) + (i + k) = n" + using a1 by simp + moreover have "n - k = n - k - i + i" + using a1 by (simp add: add_le_imp_le_diff) + ultimately show ?thesis + using a2 + apply (simp add: add.assoc [symmetric]) + apply (rule add_le_imp_le_diff [of _ k "j+k", simplified add_diff_cancel_right']) + by (simp add: add.commute diff_diff_add) +qed + lemma pos_add_strict: shows "0 < a \ b < c \ b < a + c" using add_strict_mono [of 0 a b c] by simp diff -r 9627a75eb32a -r e5fa1d5d3952 src/HOL/Set_Interval.thy --- a/src/HOL/Set_Interval.thy Mon Jun 29 13:49:21 2015 +0200 +++ b/src/HOL/Set_Interval.thy Tue Jun 30 13:56:16 2015 +0100 @@ -810,15 +810,25 @@ subsubsection {* Image *} lemma image_add_atLeastAtMost: - "(%n::nat. n+k) ` {i..j} = {i+k..j+k}" (is "?A = ?B") + fixes k ::"'a::linordered_semidom" + shows "(\n. n+k) ` {i..j} = {i+k..j+k}" (is "?A = ?B") proof show "?A \ ?B" by auto next show "?B \ ?A" proof fix n assume a: "n : ?B" - hence "n - k : {i..j}" by auto - moreover have "n = (n - k) + k" using a by auto + hence "n - k : {i..j}" + by (auto simp: add_le_imp_le_diff add_le_add_imp_diff_le) + moreover have "n = (n - k) + k" using a + proof - + have "k + i \ n" + by (metis a add.commute atLeastAtMost_iff) + hence "k + (n - k) = n" + by (metis (no_types) ab_semigroup_add_class.add_ac(1) add_diff_cancel_left' le_add_diff_inverse) + thus ?thesis + by (simp add: add.commute) + qed ultimately show "n : ?A" by blast qed qed