diff -r 1a6103f6ab0b -r dec831b200eb src/HOL/Analysis/Infinite_Sum.thy --- a/src/HOL/Analysis/Infinite_Sum.thy Sat Feb 25 17:35:48 2023 +0000 +++ b/src/HOL/Analysis/Infinite_Sum.thy Sun Feb 26 21:17:39 2023 +0000 @@ -787,17 +787,14 @@ by (subst (asm) sum.union_disjoint) (use that in \auto simp: F0A_def\) qed + have "eventually (\x. E' (x, sum f F0B)) (filtermap (sum f) (finite_subsets_at_top B))" + and "eventually (\x. E' (sum f F0B, x)) (filtermap (sum f) (finite_subsets_at_top B))" + unfolding eventually_filtermap eventually_finite_subsets_at_top + by (rule exI[of _ F0B]; use * in \force simp: F0B_def\)+ + then show \eventually E (?filter_fB \\<^sub>F ?filter_fB)\ unfolding eventually_prod_filter - proof (safe intro!: exI) - show "eventually (\x. E' (x, sum f F0B)) (filtermap (sum f) (finite_subsets_at_top B))" - and "eventually (\x. E' (sum f F0B, x)) (filtermap (sum f) (finite_subsets_at_top B))" - unfolding eventually_filtermap eventually_finite_subsets_at_top - by (rule exI[of _ F0B]; use * in \force simp: F0B_def\)+ - next - show "E (x, y)" if "E' (x, sum f F0B)" and "E' (sum f F0B, y)" for x y - using E'E'E that by blast - qed + using E'E'E by blast qed then obtain x where \?filter_fB \ nhds x\ @@ -816,8 +813,7 @@ assumes \f summable_on A\ assumes \B \ A\ shows \f summable_on B\ - by (rule summable_on_subset_aux[OF _ _ assms]) - (auto simp: complete_def convergent_def dest!: Cauchy_convergent) + by (meson Cauchy_convergent UNIV_I assms complete_def convergent_def isUCont_plus summable_on_subset_aux) lemma has_sum_empty[simp]: \(f has_sum 0) {}\ by (meson ex_in_conv has_sum_0) @@ -866,7 +862,7 @@ assumes conv: \\a. a \ A \ f summable_on (B a)\ assumes disj: \\a a'. a\A \ a'\A \ a\a' \ B a \ B a' = {}\ shows \sum (\a. infsum f (B a)) A = infsum f (\a\A. B a)\ - by (metis (no_types, lifting) assms has_sum_infsum infsumI sum_has_sum[of A f B \\a. infsum f (B a)\]) + by (metis (no_types, lifting) assms has_sum_infsum infsumI sum_has_sum) text \The lemmas \infsum_comm_additive_general\ and \infsum_comm_additive\ (and variants) below both state that the infinite sum commutes with a continuous additive function. \infsum_comm_additive_general\ is stated more for more general type classes @@ -959,16 +955,10 @@ by (metis \F \ A\ \finite F\ eventually_finite_subsets_at_top) next fix a assume *: \(SUP F\{F. finite F \ F\A}. sum f F) < a\ - have \sum f F < a\ if \F\A\ and \finite F\ for F - proof - - have "sum f F \ (SUP F\{F. finite F \ F\A}. sum f F)" + have "sum f F \ (SUP F\{F. finite F \ F\A}. sum f F)" if \F\A\ and \finite F\ for F by (rule cSUP_upper) (use that assms(2) in \auto simp: conj_commute\) - also have "\ < a" - by fact - finally show ?thesis . - qed then show \\\<^sub>F x in finite_subsets_at_top A. sum f x < a\ - by (rule eventually_finite_subsets_at_top_weakI) + by (metis (no_types, lifting) "*" eventually_finite_subsets_at_top_weakI order_le_less_trans) qed then show ?thesis using has_sum_def by blast @@ -1024,14 +1014,7 @@ assumes "(f has_sum S) A" "(f has_sum S') B" "A \ B" assumes "\x. x \ B - A \ f x \ 0" shows "S \ S'" -proof - - have "(f has_sum (S' - S)) (B - A)" - by (rule has_sum_Diff) fact+ - hence "S' - S \ 0" - by (rule has_sum_nonneg) (use assms(4) in auto) - thus ?thesis - by (metis add_0 add_mono_thms_linordered_semiring(3) diff_add_cancel) -qed + by (metis add_0 add_right_mono assms diff_add_cancel has_sum_Diff has_sum_nonneg) lemma infsum_mono2: fixes f :: "'a \ 'b::{topological_ab_group_add, ordered_comm_monoid_add,linorder_topology}" @@ -1045,12 +1028,7 @@ assumes "(f has_sum S) A" "finite B" "B \ A" assumes "\x. x \ A - B \ f x \ 0" shows "sum f B \ S" -proof (rule has_sum_mono2) - show "(f has_sum S) A" - by fact - show "(f has_sum (sum f B)) B" - by (rule has_sum_finite) fact+ -qed (use assms in auto) + by (meson assms has_sum_finite has_sum_mono2) lemma finite_sum_le_infsum: fixes f :: "'a \ 'b::{topological_ab_group_add, ordered_comm_monoid_add,linorder_topology}" @@ -1085,39 +1063,24 @@ lemma infsum_reindex: assumes \inj_on h A\ shows \infsum g (h ` A) = infsum (g \ h) A\ - by (metis (no_types, opaque_lifting) assms finite_subsets_at_top_neq_bot infsum_def - summable_on_reindex has_sum_def has_sum_infsum has_sum_reindex tendsto_Lim) + by (metis assms has_sum_infsum has_sum_reindex infsumI infsum_def) lemma summable_on_reindex_bij_betw: assumes "bij_betw g A B" shows "(\x. f (g x)) summable_on A \ f summable_on B" -proof - - have "inj_on g A" - using assms bij_betw_imp_inj_on by blast - then have \(\x. f (g x)) summable_on A \ f summable_on g ` A\ - by (metis (mono_tags, lifting) comp_apply summable_on_cong summable_on_reindex) - also have \\ \ f summable_on B\ - using assms bij_betw_imp_surj_on by blast - finally show ?thesis . -qed + by (smt (verit) assms bij_betw_def o_apply summable_on_cong summable_on_reindex) lemma infsum_reindex_bij_betw: assumes "bij_betw g A B" shows "infsum (\x. f (g x)) A = infsum f B" -proof - - have \infsum (\x. f (g x)) A = infsum f (g ` A)\ - by (metis (mono_tags, lifting) assms bij_betw_imp_inj_on infsum_cong infsum_reindex o_def) - also have \\ = infsum f B\ - using assms bij_betw_imp_surj_on by blast - finally show ?thesis . -qed + by (metis (mono_tags, lifting) assms bij_betw_def infsum_cong infsum_reindex o_def) lemma sum_uniformity: assumes plus_cont: \uniformly_continuous_on UNIV (\(x::'b::{uniform_space,comm_monoid_add},y). x+y)\ - assumes \eventually E uniformity\ + assumes EE: \eventually E uniformity\ obtains D where \eventually D uniformity\ and \\M::'a set. \f f' :: 'a \ 'b. card M \ n \ (\m\M. D (f m, f' m)) \ E (sum f M, sum f' M)\ -proof (atomize_elim, insert \eventually E uniformity\, induction n arbitrary: E rule:nat_induct) +proof (atomize_elim, insert EE, induction n arbitrary: E rule:nat_induct) case 0 then show ?case by (metis card_eq_0_iff equals0D le_zero_eq sum.infinite sum.not_neutral_contains_not_neutral uniformity_refl) @@ -1169,8 +1132,7 @@ then show \E (sum f M, sum f' M)\ by (metis False \M = insert x N\ \x \ N\ card.infinite finite_insert sum.insert) qed - with \eventually D uniformity\ - show ?case + with \eventually D uniformity\ show ?case by auto qed @@ -1257,26 +1219,23 @@ using Ha_B \M \ A\ by auto ultimately show ?thesis unfolding FMB_def eventually_finite_subsets_at_top - by (intro exI[of _ "Sigma M Ha"]) - (use Ha_fin that(2,3) in \fastforce intro!: finite_SigmaI\) + by (metis (no_types, lifting) Ha_fin finite_SigmaI subsetD that(2) that(3)) qed moreover have \eventually (\H. D (\(a,b)\H. f (a,b), a)) FMB\ unfolding FMB_def eventually_finite_subsets_at_top proof (rule exI[of _ G], safe) fix Y assume Y: "finite Y" "G \ Y" "Y \ Sigma M B" - have "Y \ Sigma A B" - using Y \M \ A\ by blast thus "D (\(a,b)\Y. f (a, b), a)" - using G_sum[of Y] Y by auto + using G_sum[of Y] Y using that(3) by fastforce qed (use \finite G\ \G \ Sigma A B\ that in auto) ultimately have \\\<^sub>F x in FMB. E (sum b M, a)\ by eventually_elim (use DDE' in auto) then show \E (sum b M, a)\ - by (rule eventually_const[THEN iffD1, rotated]) (force simp: FMB_def) + using FMB_def by force qed then show \\\<^sub>F x in FA. E (sum b x, a)\ using \finite (fst ` G)\ and \fst ` G \ A\ - by (auto intro!: exI[of _ \fst ` G\] simp add: FA_def eventually_finite_subsets_at_top) + by (metis (mono_tags, lifting) FA_def eventually_finite_subsets_at_top) qed then show ?thesis by (simp add: FA_def has_sum_def) @@ -1295,8 +1254,8 @@ from summableB have b: \\x. x\A \ (f x has_sum infsum (f x) (B x)) (B x)\ by (auto intro!: has_sum_infsum) show ?thesis - using plus_cont a b - by (auto intro: has_sum_Sigma[where f=\\(x,y). f x y\, simplified] simp: summable_on_def) + using plus_cont a b + by (smt (verit) has_sum_Sigma[where f=\\(x,y). f x y\] has_sum_cong old.prod.case summable_on_def) qed lemma infsum_Sigma: @@ -1354,8 +1313,7 @@ and f :: \'a \ 'b \ 'c::banach\ assumes [simp]: "f summable_on (Sigma A B)" shows \infsum (\x. infsum (\y. f (x,y)) (B x)) A = infsum f (Sigma A B)\ - using assms - by (subst infsum_Sigma'_banach) auto + using assms by (simp add: infsum_Sigma'_banach) lemma infsum_swap: fixes A :: "'a set" and B :: "'b set" @@ -1440,31 +1398,14 @@ fixes f :: "'a \ 'b :: {topological_semigroup_mult, semiring_0}" assumes \(f has_sum a) A\ shows "((\x. f x * c) has_sum (a * c)) A" -proof - - from assms have \(sum f \ a) (finite_subsets_at_top A)\ - using has_sum_def by blast - then have \((\F. sum f F * c) \ a * c) (finite_subsets_at_top A)\ - by (simp add: tendsto_mult_right) - then have \(sum (\x. f x * c) \ a * c) (finite_subsets_at_top A)\ - by (metis (mono_tags) tendsto_cong eventually_finite_subsets_at_top_weakI sum_distrib_right) - then show ?thesis - using infsumI has_sum_def by blast -qed + using assms tendsto_mult_right + by (force simp add: has_sum_def sum_distrib_right) lemma infsum_cmult_left: fixes f :: "'a \ 'b :: {t2_space, topological_semigroup_mult, semiring_0}" assumes \c \ 0 \ f summable_on A\ shows "infsum (\x. f x * c) A = infsum f A * c" -proof (cases \c=0\) - case True - then show ?thesis by auto -next - case False - then have \(f has_sum (infsum f A)) A\ - by (simp add: assms) - then show ?thesis - by (auto intro!: infsumI has_sum_cmult_left) -qed + using assms has_sum_cmult_left infsumI summable_iff_has_sum_infsum by fastforce lemma summable_on_cmult_left: fixes f :: "'a \ 'b :: {t2_space, topological_semigroup_mult, semiring_0}" @@ -1476,16 +1417,8 @@ fixes f :: "'a \ 'b :: {topological_semigroup_mult, semiring_0}" assumes \(f has_sum a) A\ shows "((\x. c * f x) has_sum (c * a)) A" -proof - - from assms have \(sum f \ a) (finite_subsets_at_top A)\ - using has_sum_def by blast - then have \((\F. c * sum f F) \ c * a) (finite_subsets_at_top A)\ - by (simp add: tendsto_mult_left) - then have \(sum (\x. c * f x) \ c * a) (finite_subsets_at_top A)\ - by (metis (mono_tags, lifting) tendsto_cong eventually_finite_subsets_at_top_weakI sum_distrib_left) - then show ?thesis - using infsumI has_sum_def by blast -qed + using assms tendsto_mult_left + by (force simp add: has_sum_def sum_distrib_left) lemma infsum_cmult_right: fixes f :: "'a \ 'b :: {t2_space, topological_semigroup_mult, semiring_0}" @@ -1512,24 +1445,14 @@ then have \(\x. f x * c * inverse c) summable_on A\ by (rule summable_on_cmult_left) then show \f summable_on A\ - by (metis (no_types, lifting) assms summable_on_cong mult.assoc mult.right_neutral right_inverse) + by (smt (verit, del_insts) assms divide_inverse nonzero_divide_eq_eq summable_on_cong) qed lemma summable_on_cmult_right': fixes f :: "'a \ 'b :: {t2_space, topological_semigroup_mult, division_ring}" assumes \c \ 0\ shows "(\x. c * f x) summable_on A \ f summable_on A" -proof - assume \f summable_on A\ - then show \(\x. c * f x) summable_on A\ - by (rule summable_on_cmult_right) -next - assume \(\x. c * f x) summable_on A\ - then have \(\x. inverse c * (c * f x)) summable_on A\ - by (rule summable_on_cmult_right) - then show \f summable_on A\ - by (metis (no_types, lifting) assms summable_on_cong left_inverse mult.assoc mult.left_neutral) -qed + by (metis (no_types, lifting) assms left_inverse mult.assoc mult_1 summable_on_cmult_right summable_on_cong) lemma infsum_cmult_left': fixes f :: "'a \ 'b :: {t2_space, topological_semigroup_mult, division_ring}" @@ -2203,15 +2126,10 @@ and fnn: "\x. x\A \ f x \ 0" shows "infsum f A = (SUP F\{F. finite F \ F \ A}. (sum f F))" proof - - have "ereal (infsum f A) = (SUP F\{F. finite F \ F \ A}. (ereal (sum f F)))" + have *: "ereal (infsum f A) = (SUP F\{F. finite F \ F \ A}. (ereal (sum f F)))" using assms by (rule infsum_nonneg_is_SUPREMUM_ereal) also have "\ = ereal (SUP F\{F. finite F \ F \ A}. (sum f F))" - proof (subst ereal_SUP) - show "\SUP a\{F. finite F \ F \ A}. ereal (sum f a)\ \ \" - using calculation by fastforce - show "(SUP F\{F. finite F \ F \ A}. ereal (sum f F)) = (SUP a\{F. finite F \ F \ A}. ereal (sum f a))" - by simp - qed + by (metis (no_types, lifting) * MInfty_neq_ereal(2) PInfty_neq_ereal(2) SUP_cong abs_eq_infinity_cases ereal_SUP) finally show ?thesis by simp qed @@ -2530,7 +2448,7 @@ assumes "eventually (\x. x \ X) F" "g X \ F'" shows "lift_filter g F \ F'" unfolding lift_filter_def - by (rule INF_lower2[of X _ g F', OF _ assms(2)]) (use assms(1) in auto) + by (metis INF_lower2 assms mem_Collect_eq) definition lift_filter' :: "('a set \ 'b set) \ 'a filter \ 'b filter" where "lift_filter' f F = lift_filter (principal \ f) F" @@ -2649,13 +2567,10 @@ using P eventually_compose_filterlim eventually_uniformity_imp_nhds G by blast ultimately have "eventually (\n. (\x\B n. P x) \ P (L, g n)) sequentially" by eventually_elim auto - then obtain n where n: "\x\B n. P x" "P (L, g n)" + then obtain n where "\x\B n. P x" "P (L, g n)" unfolding eventually_at_top_linorder by blast - - have "eventually (\y. y \ G n) F" "\z\G n \ G n. P z" "g n \ G n" "P (L, g n)" - using n gG by blast+ - thus "\X. (\\<^sub>F y in F. y \ X) \ (\z\X \ X. P z) \ (\y. P (L, y) \ y \ X)" - by blast + then show "\X. (\\<^sub>F y in F. y \ X) \ (\z\X \ X. P z) \ (\y. P (L, y) \ y \ X)" + using gG by blast+ qed thus "convergent_filter F" by (auto simp: convergent_filter_iff) @@ -2713,12 +2628,11 @@ proof safe fix P :: "'a \ 'a \ bool" assume P: "eventually P uniformity" - from U[OF this] obtain N where N: "\x\U N. P x" + from U[OF this] obtain N where "\x\U N. P x" by blast - - show "eventually P (filtermap (map_prod f f) (sequentially \\<^sub>F sequentially))" + then show "eventually P (filtermap (map_prod f f) (sequentially \\<^sub>F sequentially))" unfolding eventually_filtermap eventually_prod_sequentially - by (rule exI[of _ N]) (use controlled N in \auto simp: map_prod_def\) + by (metis controlled map_prod_simp) qed qed @@ -2778,10 +2692,10 @@ thus ?case by (intro bexI[of _ "min \1 \2"]) auto qed auto - from \\ > 0\ obtain n where n: "1 / real (Suc n) < \" + from \\ > 0\ obtain n where "1 / real (Suc n) < \" using nat_approx_posE by blast - have "eventually P (principal {(x, y). dist x y < 1 / real (Suc n)})" - using \(2) n by (auto simp: eventually_principal) + then have "eventually P (principal {(x, y). dist x y < 1 / real (Suc n)})" + using \(2) by (auto simp: eventually_principal) thus "eventually P ?G" by (intro eventually_INF1) auto qed @@ -2813,7 +2727,7 @@ show "((\Y. \x\Y. g x) \ T) (finite_subsets_at_top X)" using assms(2) unfolding has_sum_def . show "\\<^sub>F x in finite_subsets_at_top X. norm (sum f x) \ (\x\x. g x)" - by (rule eventually_finite_subsets_at_top_weakI) (auto intro!: sum_norm_le assms) + by (simp add: assms(3) eventually_finite_subsets_at_top_weakI subsetD sum_norm_le) qed auto (* @@ -2835,9 +2749,8 @@ proof - have "((\x. f (g x)) has_sum S) A \ (f has_sum S) (g ` A)" by (subst has_sum_reindex) (use assms in \auto dest: bij_betw_imp_inj_on simp: o_def\) - also have "g ` A = B" - using assms bij_betw_imp_surj_on by blast - finally show ?thesis . + then show ?thesis + using assms bij_betw_imp_surj_on by blast qed lemma has_sum_reindex_bij_witness: @@ -2848,16 +2761,7 @@ assumes "\a. a \ S \ h (j a) = g a" assumes "s = s'" shows "(g has_sum s) S = (h has_sum s') T" -proof - - have bij:"bij_betw j S T" - using assms by (intro bij_betwI[of _ _ _ i]) auto - have "(h has_sum s') T \ ((\a. h (j a)) has_sum s) S" - using has_sum_reindex_bij_betw[OF bij, of h] assms by simp - also have "\ \ (g has_sum s) S" - by (intro has_sum_cong) (use assms in auto) - finally show ?thesis .. -qed - + by (smt (verit, del_insts) assms bij_betwI' has_sum_cong has_sum_reindex_bij_betw) lemma has_sum_homomorphism: @@ -2868,10 +2772,9 @@ by (induction X rule: infinite_finite_induct) (simp_all add: assms) hence sum_h: "sum (h \ f) = h \ sum f" by (intro ext) auto - have "((h \ f) has_sum h S) A" - unfolding has_sum_def sum_h unfolding o_def - by (rule continuous_on_tendsto_compose[OF assms(4)]) - (use assms in \auto simp: has_sum_def\) + then have "((h \ f) has_sum h S) A" + using assms + by (metis UNIV_I continuous_on_def has_sum_comm_additive_general o_apply) thus ?thesis by (simp add: o_def) qed @@ -2892,18 +2795,10 @@ fixes h :: "'a :: {t2_space, topological_comm_monoid_add} \ 'b :: {t2_space, topological_comm_monoid_add}" assumes "(\x. h (f x)) summable_on A \ f summable_on A" - assumes "h 0 = 0" "\a b. h (a + b) = h a + h b" "continuous_on UNIV h" + assumes "h 0 = 0" assumes "\S. (f has_sum S) A \ ((\x. h (f x)) has_sum (h S)) A" shows "infsum (\x. h (f x)) A = h (infsum f A)" -proof (cases "f summable_on A") - case False - thus ?thesis by (simp add: infsum_def assms) -next - case True - then obtain S where "(f has_sum S) A" by (auto simp: summable_on_def) - moreover from this have "((\x. h (f x)) has_sum (h S)) A" by (rule assms) - ultimately show ?thesis by (simp add: infsumI) -qed + by (metis assms has_sum_infsum infsumI infsum_not_exists) lemma has_sum_bounded_linear: assumes "bounded_linear h" and "(f has_sum S) A" @@ -2917,16 +2812,12 @@ lemma summable_on_bounded_linear: assumes "bounded_linear h" and "f summable_on A" shows "(\x. h (f x)) summable_on A" -proof - - interpret bounded_linear h by fact - from assms(2) show ?thesis - by (rule summable_on_homomorphism) (auto simp: add intro!: continuous_on) -qed + by (metis assms has_sum_bounded_linear summable_on_def) lemma summable_on_bounded_linear_iff: assumes "bounded_linear h" and "bounded_linear h'" and "\x. h' (h x) = x" shows "(\x. h (f x)) summable_on A \ f summable_on A" - by (auto dest: assms(1,2)[THEN summable_on_bounded_linear] simp: assms(3)) + by (metis (full_types) assms summable_on_bounded_linear summable_on_cong) lemma infsum_bounded_linear_strong: fixes h :: "'a :: real_normed_vector \ 'b :: real_normed_vector" @@ -2946,7 +2837,7 @@ assumes "bounded_linear (mult c)" assumes [simp]: "\x. mult 0 x = 0" shows "infsum (\x. mult c (f x)) A = mult c (infsum f A)" - using assms(1,2) by (cases "c = 0") (auto intro: infsum_bounded_linear_strong) + by (metis assms infsum_0 infsum_bounded_linear_strong) lemma has_sum_of_nat: "(f has_sum S) A \ ((\x. of_nat (f x)) has_sum of_nat S) A" by (erule has_sum_homomorphism) (auto intro!: continuous_intros) @@ -2967,9 +2858,8 @@ assume *: "finite {x\A. f x \ 0}" hence "f summable_on {x\A. f x \ 0}" by (rule summable_on_finite) - also have "?this \ f summable_on A" - by (intro summable_on_cong_neutral) auto - finally show "f summable_on A" . + then show "f summable_on A" + by (smt (verit) DiffE mem_Collect_eq summable_on_cong_neutral) next assume "f summable_on A" then obtain S where "(f has_sum S) A" @@ -2985,13 +2875,9 @@ proof (rule ccontr) assume [simp]: "x \ X" have "sum f (insert x X) = S" - using X(1,2) x by (intro X) auto - also have "sum f (insert x X) = f x + sum f X" - using X(1) by (subst sum.insert) auto - also have "sum f X = S" - by (intro X order.refl) - finally have "f x = 0" - by simp + using X x by (intro X) auto + then have "f x = 0" + using X by auto with x show False by auto qed @@ -3025,28 +2911,20 @@ by blast have "\\<^sub>F X in finite_subsets_at_top A. sum f X < C" using S C by (rule order_tendstoD(2)) - hence "\\<^sub>F X in finite_subsets_at_top A. sum f X \ C" - by (rule eventually_mono) auto - thus ?thesis by blast + thus ?thesis + by (meson eventually_mono nless_le) next - case False - hence "\\<^sub>F X in finite_subsets_at_top A. sum f X \ S" - by (auto simp: not_less) - thus ?thesis by blast + case False thus ?thesis + by (meson not_eventuallyD not_le_imp_less) qed qed lemma has_sum_mono': fixes S S' :: "'a :: {linorder_topology, ordered_comm_monoid_add, topological_comm_monoid_add}" - assumes "(f has_sum S) A" "(f has_sum S') B" "A \ B" "\x. x \ B - A \ f x \ 0" + assumes f: "(f has_sum S) A" "(f has_sum S') B" + and AB: "A \ B" "\x. x \ B - A \ f x \ 0" shows "S \ S'" -proof (rule has_sum_mono) - show "(f has_sum S') B" by fact - have "(f has_sum S) A \ ((\x. if x \ A then f x else 0) has_sum S) B" - by (rule has_sum_cong_neutral) (use assms in auto) - thus "((\x. if x \ A then f x else 0) has_sum S) B" - using assms(1) by blast -qed (insert assms, auto) + using AB has_sum_mono_neutral[OF f] by fastforce context @@ -3069,8 +2947,9 @@ have bound': "sum f X \ C" if "X \ A" "finite X" for X proof - have "sum f X \ sum f (X \ X0)" - using that X0(1,2) assms(1) by (intro sum_mono2) auto - also have "\ \ C" using X0(1,2) that by (intro X0) auto + using that X0 assms(1) by (intro sum_mono2) auto + also have "\ \ C" + by (simp add: X0 that) finally show ?thesis . qed hence bdd: "bdd_above (sum f ` {X. X \ A \ finite X})" @@ -3115,8 +2994,7 @@ shows "g summable_on A" proof - obtain C where C: "\\<^sub>F X in finite_subsets_at_top A. sum f X \ C" - using summable_on_imp_bounded_partial_sums [of f] - using assms(1) by presburger + using assms(1) summable_on_imp_bounded_partial_sums by blast show ?thesis proof (rule nonneg_bounded_partial_sums_imp_summable_on) show "\\<^sub>F X in finite_subsets_at_top A. sum g X \ C" @@ -3142,7 +3020,7 @@ shows "f summable_on (A \ B)" proof - have "f summable_on (A \ (B - A))" - by (intro summable_on_Un_disjoint[OF assms(1) summable_on_subset[OF assms(2)]]) auto + by (meson Diff_disjoint Diff_subset assms summable_on_Un_disjoint summable_on_subset) also have "A \ (B - A) = A \ B" by blast finally show ?thesis . @@ -3154,7 +3032,7 @@ using summable_on_union[of f A "{x}"] by (auto intro: summable_on_subset) lemma has_sum_finiteI: "finite A \ S = sum f A \ (f has_sum S) A" - using has_sum_finite by blast + by simp lemma has_sum_insert: fixes f :: "'a \ 'b :: topological_comm_monoid_add" @@ -3269,14 +3147,7 @@ assumes g: "(g has_sum S) A" assumes summable: "f summable_on Sigma A B" shows "(f has_sum S) (Sigma A B)" -proof - - from summable obtain S' where S': "(f has_sum S') (Sigma A B)" - using summable_on_def by blast - have "(g has_sum S') A" - by (rule has_sum_SigmaD[OF S' f]) - with g S' show ?thesis - using has_sum_unique by blast -qed + by (metis f g has_sum_SigmaD has_sum_infsum has_sum_unique local.summable) lemma summable_on_SigmaD1: fixes f :: "_ \ _ \ 'a :: {complete_uniform_space, uniform_topological_group_add, ab_group_add, topological_comm_monoid_add}" @@ -3307,12 +3178,7 @@ lemma summable_on_swap: "f summable_on (A \ B) \ (\(x,y). f (y,x)) summable_on (B \ A)" -proof - - have "bij_betw (\(x,y). (y,x)) (B \ A) (A \ B)" - by (rule bij_betwI[of _ _ _ "\(x,y). (y,x)"]) auto - from summable_on_reindex_bij_betw[OF this, where f = f] show ?thesis - by (simp add: case_prod_unfold) -qed + by (metis has_sum_swap summable_on_def) lemma has_sum_cmult_right_iff: fixes c :: "'a :: {topological_semigroup_mult, field}" @@ -3331,13 +3197,7 @@ lemma finite_nonzero_values_imp_summable_on: assumes "finite {x\X. f x \ 0}" shows "f summable_on X" -proof - - have "f summable_on {x\X. f x \ 0}" - by (intro summable_on_finite assms) - also have "?this \ f summable_on X" - by (intro summable_on_cong_neutral) auto - finally show ?thesis . -qed + by (smt (verit, del_insts) Diff_iff assms mem_Collect_eq summable_on_cong_neutral summable_on_finite) lemma summable_on_of_int_iff: "(\x::'a. of_int (f x) :: 'b :: real_normed_algebra_1) summable_on A \ f summable_on A" @@ -3351,7 +3211,7 @@ by (auto simp: summable_on_def) hence "(sum (\x. of_int (f x) :: 'b) \ S) (finite_subsets_at_top A)" unfolding has_sum_def . - moreover have "1 / 2 > (0 :: real)" + moreover have "1/2 > (0 :: real)" by auto ultimately have "eventually (\X. dist (sum (\x. of_int (f x) :: 'b) X) S < 1/2) (finite_subsets_at_top A)" @@ -3360,31 +3220,20 @@ "\Y. finite Y \ X \ Y \ Y \ A \ dist (sum (\x. of_int (f x)) Y) S < 1/2" unfolding eventually_finite_subsets_at_top by metis - have X': "sum f Y = sum f X" if "finite Y" "X \ Y" "Y \ A" for Y + have "sum f Y = sum f X" if "finite Y" "X \ Y" "Y \ A" for Y proof - - have "dist (sum (\x. of_int (f x)) X) S < 1 / 2" + have "dist (sum (\x. of_int (f x)) X) S < 1/2" by (intro X) auto - moreover have "dist (sum (\x. of_int (f x)) Y) S < 1 / 2" + moreover have "dist (sum (\x. of_int (f x)) Y) S < 1/2" by (intro X that) ultimately have "dist (sum (\x. of_int (f x)) X) (sum (\x. of_int (f x) :: 'b) Y) < - 1 / 2 + 1 / 2" + 1/2 + 1/2" using dist_triangle_less_add by blast thus ?thesis by (simp add: dist_norm flip: of_int_sum of_int_diff) qed - - have "{x\A. f x \ 0} \ X" - proof (rule ccontr) - assume "\{x\A. f x \ 0} \ X" - then obtain x where x: "x \ A" "f x \ 0" "x \ X" - by blast - have "sum f (insert x X) = sum f X" - using x X by (intro X') auto - also have "sum f (insert x X) = f x + sum f X" - using x X by auto - finally show False - using x by auto - qed + then have "{x\A. f x \ 0} \ X" + by (smt (verit) X finite_insert insert_iff mem_Collect_eq subset_eq sum.insert) with \finite X\ have "finite {x\A. f x \ 0}" using finite_subset by blast thus "f summable_on A" @@ -3403,8 +3252,6 @@ by simp also have "?this \ (\x. int (f x)) summable_on A" by (rule summable_on_of_int_iff) - also have "\ \ finite {x\A. f x \ 0}" - by (simp add: summable_on_discrete_iff) also have "\ \ f summable_on A" by (simp add: summable_on_discrete_iff) finally show "f summable_on A" . @@ -3412,13 +3259,11 @@ lemma infsum_of_nat: "infsum (\x::'a. of_nat (f x) :: 'b :: {real_normed_algebra_1}) A = of_nat (infsum f A)" - by (rule infsum_homomorphism_strong) - (auto simp: summable_on_of_nat has_sum_of_nat summable_on_of_nat_iff) + by (metis has_sum_infsum has_sum_of_nat infsumI infsum_def of_nat_0 summable_on_of_nat_iff) lemma infsum_of_int: "infsum (\x::'a. of_int (f x) :: 'b :: {real_normed_algebra_1}) A = of_int (infsum f A)" - by (rule infsum_homomorphism_strong) - (auto simp: summable_on_of_nat has_sum_of_int summable_on_of_int_iff) + by (metis has_sum_infsum has_sum_of_int infsumI infsum_not_exists of_int_0 summable_on_of_int_iff) lemma summable_on_SigmaI: @@ -3440,7 +3285,7 @@ "finite X'" "X' \ A" "\Y. finite Y \ X' \ Y \ Y \ A \ sum g Y \ C" unfolding eventually_finite_subsets_at_top by metis have "sum g X \ sum g (X \ X')" - using X X'(1,2) by (intro sum_mono2 g_nonneg) auto + using X X' by (intro sum_mono2 g_nonneg) auto also have "\ \ C" using X X'(1,2) by (intro X'(3)) auto finally show ?thesis . @@ -3481,8 +3326,7 @@ hence "\\<^sub>F X in finite_subsets_at_top (Sigma A B). sum f X \ C" unfolding eventually_finite_subsets_at_top by auto thus ?thesis - by (intro nonneg_bounded_partial_sums_imp_summable_on[where C = C]) - (use f_nonneg in auto) + by (metis SigmaE f_nonneg nonneg_bounded_partial_sums_imp_summable_on) qed lemma summable_on_UnionI: @@ -3508,14 +3352,8 @@ assumes sum1: "f summable_on (Sigma A B)" assumes sum2: "\x. x \ A \ (\y. f (x, y)) summable_on (B x)" shows "(\x. infsum (\y. f (x, y)) (B x)) summable_on A" -proof - - from sum1 have 1: "(f has_sum infsum f (Sigma A B)) (Sigma A B)" - using has_sum_infsum by blast - have 2: "((\y. f (x, y)) has_sum infsum (\y. f (x, y)) (B x)) (B x)" - if "x \ A" for x using sum2[OF that] by simp - from has_sum_SigmaD[OF 1 2] show ?thesis - using has_sum_imp_summable by blast -qed + using assms unfolding summable_on_def + by (smt (verit, del_insts) assms has_sum_SigmaD has_sum_cong has_sum_infsum) lemma summable_on_UnionD: fixes f :: "'a \ 'c :: {topological_comm_monoid_add,t3_space}" @@ -3568,24 +3406,9 @@ shows "(\x. norm (f x)) summable_on A" proof (rule Infinite_Sum.abs_summable_on_comparison_test) have "g summable_on A \ (\x. norm (g x)) summable_on A" - proof (rule summable_on_cong) - fix x assume "x \ A" - have "0 \ norm (f x)" - by simp - also have "\ \ g x" - by (rule assms) fact - finally show "g x = norm (g x)" - by simp - qed + by (metis summable_on_iff_abs_summable_on_real) with assms show "(\x. norm (g x)) summable_on A" by blast -next - fix x assume "x \ A" - have "norm (f x) \ g x" - by (intro assms) fact - also have "\ \ norm (g x)" - by simp - finally show "norm (f x) \ norm (g x)" . -qed +qed (use assms in fastforce) lemma has_sum_geometric_from_1: fixes z :: "'a :: {real_normed_field, banach}"