# HG changeset patch # User desharna # Date 1743773403 -7200 # Node ID 9d457dfb56c5175a5e31722eb4ed91bc650603e3 # Parent b3b8c278af235918aa2d329f5a889bda3ee44542# Parent 918c50e0447e9eafbe1fdf7f1832808d3a5ad100 merged diff -r b3b8c278af23 -r 9d457dfb56c5 src/HOL/Analysis/Uniform_Limit.thy --- a/src/HOL/Analysis/Uniform_Limit.thy Wed Apr 02 11:26:40 2025 +0200 +++ b/src/HOL/Analysis/Uniform_Limit.thy Fri Apr 04 15:30:03 2025 +0200 @@ -112,15 +112,14 @@ by eventually_elim force qed - subsection \Exchange limits\ - -proposition swap_uniform_limit: - assumes f: "\\<^sub>F n in F. (f n \ g n) (at x within S)" +proposition swap_uniform_limit': + assumes f: "\\<^sub>F n in F. (f n \ g n) G" assumes g: "(g \ l) F" assumes uc: "uniform_limit S f h F" + assumes ev: "\\<^sub>F x in G. x \ S" assumes "\trivial_limit F" - shows "(h \ l) (at x within S)" + shows "(h \ l) G" proof (rule tendstoI) fix e :: real define e' where "e' = e/3" @@ -131,21 +130,19 @@ by (simp add: dist_commute) moreover from f - have "\\<^sub>F n in F. \\<^sub>F x in at x within S. dist (g n) (f n x) < e'" + have "\\<^sub>F n in F. \\<^sub>F x in G. dist (g n) (f n x) < e'" by eventually_elim (auto dest!: tendstoD[OF _ \0 < e'\] simp: dist_commute) moreover from tendstoD[OF g \0 < e'\] have "\\<^sub>F x in F. dist l (g x) < e'" by (simp add: dist_commute) ultimately - have "\\<^sub>F _ in F. \\<^sub>F x in at x within S. dist (h x) l < e" + have "\\<^sub>F _ in F. \\<^sub>F x in G. dist (h x) l < e" proof eventually_elim case (elim n) note fh = elim(1) note gl = elim(3) - have "\\<^sub>F x in at x within S. x \ S" - by (auto simp: eventually_at_filter) - with elim(2) show ?case + using elim(2) ev proof eventually_elim case (elim x) from fh[rule_format, OF \x \ S\] elim(1) @@ -155,10 +152,17 @@ show ?case by (simp add: e'_def) qed qed - thus "\\<^sub>F x in at x within S. dist (h x) l < e" + thus "\\<^sub>F x in G. dist (h x) l < e" using eventually_happens by (metis \\trivial_limit F\) qed +corollary swap_uniform_limit: + assumes "\\<^sub>F n in F. (f n \ g n) (at x within S)" + assumes "(g \ l) F" "uniform_limit S f h F" "\trivial_limit F" + shows "(h \ l) (at x within S)" + using swap_uniform_limit' eventually_at_topological assms + by blast + subsection \Uniform limit theorem\ @@ -998,27 +1002,98 @@ fixes a :: "nat \ 'a::{real_normed_div_algebra,banach}" assumes "r < conv_radius a" shows "uniform_limit (cball \ r) (\n x. \i) ^ i) (\x. suminf (\i. a i * (x - \) ^ i)) sequentially" -using powser_uniformly_convergent [OF assms] -by (simp add: Uniform_Limit.uniformly_convergent_uniform_limit_iff Series.suminf_eq_lim) + using powser_uniformly_convergent [OF assms] + by (simp add: Uniform_Limit.uniformly_convergent_uniform_limit_iff Series.suminf_eq_lim) lemma powser_continuous_suminf: fixes a :: "nat \ 'a::{real_normed_div_algebra,banach}" assumes "r < conv_radius a" shows "continuous_on (cball \ r) (\x. suminf (\i. a i * (x - \) ^ i))" -apply (rule uniform_limit_theorem [OF _ powser_uniform_limit]) -apply (rule eventuallyI continuous_intros assms)+ -apply auto -done + apply (rule uniform_limit_theorem [OF _ powser_uniform_limit]) + apply (rule eventuallyI continuous_intros assms)+ + apply auto + done lemma powser_continuous_sums: fixes a :: "nat \ 'a::{real_normed_div_algebra,banach}" assumes r: "r < conv_radius a" - and sm: "\x. x \ cball \ r \ (\n. a n * (x - \) ^ n) sums (f x)" + and sm: "\x. x \ cball \ r \ (\n. a n * (x - \) ^ n) sums (f x)" shows "continuous_on (cball \ r) f" -apply (rule continuous_on_cong [THEN iffD1, OF refl _ powser_continuous_suminf [OF r]]) -using sm sums_unique by fastforce + apply (rule continuous_on_cong [THEN iffD1, OF refl _ powser_continuous_suminf [OF r]]) + using sm sums_unique by fastforce lemmas uniform_limit_subset_union = uniform_limit_on_subset[OF uniform_limit_on_Union] +subsection \Tannery's Theorem\ + +text \ + Tannery's Theorem proves that, under certain boundedness conditions: + \[ \lim_{x\to\bar x} \sum_{k=0}^\infty f(k,n) = \sum_{k=0}^\infty \lim_{x\to\bar x} f(k,n) \] +\ +lemma tannerys_theorem: + fixes a :: "nat \ _ \ 'a :: {real_normed_algebra, banach}" + assumes limit: "\k. ((\n. a k n) \ b k) F" + assumes bound: "eventually (\(k,n). norm (a k n) \ M k) (at_top \\<^sub>F F)" + assumes "summable M" + assumes [simp]: "F \ bot" + shows "eventually (\n. summable (\k. norm (a k n))) F \ + summable (\n. norm (b n)) \ + ((\n. suminf (\k. a k n)) \ suminf b) F" +proof (intro conjI allI) + show "eventually (\n. summable (\k. norm (a k n))) F" + proof - + have "eventually (\n. eventually (\k. norm (a k n) \ M k) at_top) F" + using eventually_eventually_prod_filter2[OF bound] by simp + thus ?thesis + proof eventually_elim + case (elim n) + show "summable (\k. norm (a k n))" + proof (rule summable_comparison_test_ev) + show "eventually (\k. norm (norm (a k n)) \ M k) at_top" + using elim by auto + qed fact + qed + qed + + have bound': "eventually (\k. norm (b k) \ M k) at_top" + proof - + have "eventually (\k. eventually (\n. norm (a k n) \ M k) F) at_top" + using eventually_eventually_prod_filter1[OF bound] by simp + thus ?thesis + proof eventually_elim + case (elim k) + show "norm (b k) \ M k" + proof (rule tendsto_upperbound) + show "((\n. norm (a k n)) \ norm (b k)) F" + by (intro tendsto_intros limit) + qed (use elim in auto) + qed + qed + show "summable (\n. norm (b n))" + by (rule summable_comparison_test_ev[OF _ \summable M\]) (use bound' in auto) + + from bound obtain Pf Pg where + *: "eventually Pf at_top" "eventually Pg F" "\k n. Pf k \ Pg n \ norm (a k n) \ M k" + unfolding eventually_prod_filter by auto + + show "((\n. \k. a k n) \ (\k. b k)) F" + proof (rule swap_uniform_limit') + show "(\K. (\k (\k. b k)" + using \summable (\n. norm (b n))\ + by (intro summable_LIMSEQ) (auto dest: summable_norm_cancel) + show "\\<^sub>F K in sequentially. ((\n. \k (\k\<^sub>F x in F. x \ {n. Pg n}" + using *(2) by simp + show "uniform_limit {n. Pg n} (\K n. \kn. \k. a k n) sequentially" + proof (rule Weierstrass_m_test_ev) + show "\\<^sub>F k in at_top. \n\{n. Pg n}. norm (a k n) \ M k" + using *(1) by eventually_elim (use *(3) in auto) + show "summable M" + by fact + qed + qed auto +qed + end diff -r b3b8c278af23 -r 9d457dfb56c5 src/HOL/Computational_Algebra/Formal_Laurent_Series.thy --- a/src/HOL/Computational_Algebra/Formal_Laurent_Series.thy Wed Apr 02 11:26:40 2025 +0200 +++ b/src/HOL/Computational_Algebra/Formal_Laurent_Series.thy Fri Apr 04 15:30:03 2025 +0200 @@ -912,6 +912,9 @@ instance fls :: (comm_monoid_add) comm_monoid_add by (standard, transfer, auto simp: add.commute) +lemma fls_nth_sum: "fls_nth (\x\A. f x) n = (\x\A. fls_nth (f x) n)" + by (induction A rule: infinite_finite_induct) auto + subsubsection \Subtraction and negatives\ @@ -2923,6 +2926,20 @@ by simp_all qed +lemma one_plus_fls_X_powi_eq: + "(1 + fls_X) powi n = fps_to_fls (fps_binomial (of_int n :: 'a :: field_char_0))" +proof (cases "n \ 0") + case True + thus ?thesis + using fps_binomial_of_nat[of "nat n", where ?'a = 'a] + by (simp add: power_int_def fps_to_fls_power) +next + case False + thus ?thesis + using fps_binomial_minus_of_nat[of "nat (-n)", where ?'a = 'a] + by (simp add: power_int_def fps_to_fls_power fps_inverse_power flip: fls_inverse_fps_to_fls) +qed + instance fls :: (field) field by (standard, simp_all add: field_simps) diff -r b3b8c278af23 -r 9d457dfb56c5 src/HOL/Deriv.thy --- a/src/HOL/Deriv.thy Wed Apr 02 11:26:40 2025 +0200 +++ b/src/HOL/Deriv.thy Fri Apr 04 15:30:03 2025 +0200 @@ -1130,18 +1130,19 @@ using DERIV_power [OF DERIV_ident] by simp lemma DERIV_power_int [derivative_intros]: - assumes [derivative_intros]: "(f has_field_derivative d) (at x within s)" and [simp]: "f x \ 0" + assumes [derivative_intros]: "(f has_field_derivative d) (at x within s)" + and "n \ 0 \ f x \ 0" shows "((\x. power_int (f x) n) has_field_derivative (of_int n * power_int (f x) (n - 1) * d)) (at x within s)" proof (cases n rule: int_cases4) case (nonneg n) thus ?thesis - by (cases "n = 0") - (auto intro!: derivative_eq_intros simp: field_simps power_int_diff - simp flip: power_Suc power_Suc2 power_add) + by (cases "n = 0"; cases "f x = 0") + (auto intro!: derivative_eq_intros simp: field_simps power_int_diff + power_diff power_int_0_left_if) next case (neg n) - thus ?thesis + thus ?thesis using assms(2) by (auto intro!: derivative_eq_intros simp: field_simps power_int_diff power_int_minus simp flip: power_Suc power_Suc2 power_add) qed diff -r b3b8c278af23 -r 9d457dfb56c5 src/HOL/Filter.thy --- a/src/HOL/Filter.thy Wed Apr 02 11:26:40 2025 +0200 +++ b/src/HOL/Filter.thy Fri Apr 04 15:30:03 2025 +0200 @@ -1132,6 +1132,38 @@ by (intro exI[of _ P] exI[of _ "\x. True"]) auto qed +lemma eventually_eventually_prod_filter1: + assumes "eventually P (F \\<^sub>F G)" + shows "eventually (\x. eventually (\y. P (x, y)) G) F" +proof - + from assms obtain Pf Pg where + *: "eventually Pf F" "eventually Pg G" "\x y. Pf x \ Pg y \ P (x, y)" + unfolding eventually_prod_filter by auto + show ?thesis + using *(1) + proof eventually_elim + case x: (elim x) + show ?case + using *(2) by eventually_elim (use x *(3) in auto) + qed +qed + +lemma eventually_eventually_prod_filter2: + assumes "eventually P (F \\<^sub>F G)" + shows "eventually (\y. eventually (\x. P (x, y)) F) G" +proof - + from assms obtain Pf Pg where + *: "eventually Pf F" "eventually Pg G" "\x y. Pf x \ Pg y \ P (x, y)" + unfolding eventually_prod_filter by auto + show ?thesis + using *(2) + proof eventually_elim + case y: (elim y) + show ?case + using *(1) by eventually_elim (use y *(3) in auto) + qed +qed + lemma INF_filter_bot_base: fixes F :: "'a \ 'b filter" assumes *: "\i j. i \ I \ j \ I \ \k\I. F k \ F i \ F j" diff -r b3b8c278af23 -r 9d457dfb56c5 src/HOL/Fun.thy --- a/src/HOL/Fun.thy Wed Apr 02 11:26:40 2025 +0200 +++ b/src/HOL/Fun.thy Fri Apr 04 15:30:03 2025 +0200 @@ -368,6 +368,15 @@ lemma bij_betw_singletonI [intro]: "f x = y \ bij_betw f {x} {y}" by auto +lemma bij_betw_imp_empty_iff: "bij_betw f A B \ A = {} \ B = {}" + unfolding bij_betw_def by blast + +lemma bij_betw_imp_Ex_iff: "bij_betw f {x. P x} {x. Q x} \ (\x. P x) \ (\x. Q x)" + unfolding bij_betw_def by blast + +lemma bij_betw_imp_Bex_iff: "bij_betw f {x\A. P x} {x\B. Q x} \ (\x\A. P x) \ (\x\B. Q x)" + unfolding bij_betw_def by blast + lemma bij_betw_apply: "\bij_betw f A B; a \ A\ \ f a \ B" unfolding bij_betw_def by auto diff -r b3b8c278af23 -r 9d457dfb56c5 src/HOL/Groups_Big.thy --- a/src/HOL/Groups_Big.thy Wed Apr 02 11:26:40 2025 +0200 +++ b/src/HOL/Groups_Big.thy Fri Apr 04 15:30:03 2025 +0200 @@ -1580,6 +1580,16 @@ qed qed +lemma prod_uminus: "(\x\A. -f x :: 'a :: comm_ring_1) = (-1) ^ card A * (\x\A. f x)" + by (induction A rule: infinite_finite_induct) (auto simp: algebra_simps) + +lemma prod_diff: + fixes f :: "'a \ 'b :: field" + assumes "finite A" "B \ A" "\x. x \ B \ f x \ 0" + shows "prod f (A - B) = prod f A / prod f B" + by (metis assms finite_subset nonzero_eq_divide_eq prod.subset_diff + prod_zero_iff) + lemma sum_zero_power [simp]: "(\i\A. c i * 0^i) = (if finite A \ 0 \ A then c 0 else 0)" for c :: "nat \ 'a::division_ring" by (induct A rule: infinite_finite_induct) auto @@ -1712,10 +1722,22 @@ for y :: "'a::comm_monoid_mult" by (induct A rule: infinite_finite_induct) simp_all +lemma prod_diff_swap: + fixes f :: "'a \ 'b :: comm_ring_1" + shows "prod (\x. f x - g x) A = (-1) ^ card A * prod (\x. g x - f x) A" + using prod.distrib[of "\_. -1" "\x. f x - g x" A] + by simp + lemma prod_power_distrib: "prod f A ^ n = prod (\x. (f x) ^ n) A" for f :: "'a \ 'b::comm_semiring_1" by (induct A rule: infinite_finite_induct) (auto simp add: power_mult_distrib) +lemma power_inject_exp': + assumes "a \ 1" "a > (0 :: 'a :: linordered_semidom)" + shows "a ^ m = a ^ n \ m = n" + by (metis assms not_less_iff_gr_or_eq order_le_less power_decreasing_iff + power_inject_exp) + lemma power_sum: "c ^ (\a\A. f a) = (\a\A. c ^ f a)" by (induct A rule: infinite_finite_induct) (simp_all add: power_add) diff -r b3b8c278af23 -r 9d457dfb56c5 src/HOL/Library/Infinite_Typeclass.thy --- a/src/HOL/Library/Infinite_Typeclass.thy Wed Apr 02 11:26:40 2025 +0200 +++ b/src/HOL/Library/Infinite_Typeclass.thy Fri Apr 04 15:30:03 2025 +0200 @@ -27,6 +27,9 @@ by auto qed +lemma arb_inj_on_finite_infinite: "finite(A :: 'b set) \ \f :: 'b \ 'a. inj_on f A" +by (meson arb_finite_subset card_le_inj infinite_imp_nonempty) + lemma arb_countable_map: "finite Y \ \f :: (nat \ 'a). inj f \ range f \ UNIV - Y" using infinite_UNIV by (auto simp: infinite_countable_subset)