equal
deleted
inserted
replaced
3 Author: Robert Himmelmann, TU München |
3 Author: Robert Himmelmann, TU München |
4 Author: Armin Heller, TU München |
4 Author: Armin Heller, TU München |
5 Author: Bogdan Grechuk, University of Edinburgh |
5 Author: Bogdan Grechuk, University of Edinburgh |
6 *) |
6 *) |
7 |
7 |
8 section {* Limits on the Extended real number line *} |
8 section \<open>Limits on the Extended real number line\<close> |
9 |
9 |
10 theory Extended_Real_Limits |
10 theory Extended_Real_Limits |
11 imports Topology_Euclidean_Space "~~/src/HOL/Library/Extended_Real" "~~/src/HOL/Library/Indicator_Function" |
11 imports Topology_Euclidean_Space "~~/src/HOL/Library/Extended_Real" "~~/src/HOL/Library/Indicator_Function" |
12 begin |
12 begin |
13 |
13 |
48 by (auto simp add: monoseq_def) |
48 by (auto simp add: monoseq_def) |
49 then obtain l where "(X \<circ> r) ----> l" |
49 then obtain l where "(X \<circ> r) ----> l" |
50 using lim_increasing_cl[of "X \<circ> r"] lim_decreasing_cl[of "X \<circ> r"] |
50 using lim_increasing_cl[of "X \<circ> r"] lim_decreasing_cl[of "X \<circ> r"] |
51 by auto |
51 by auto |
52 then show ?thesis |
52 then show ?thesis |
53 using `subseq r` by auto |
53 using \<open>subseq r\<close> by auto |
54 qed |
54 qed |
55 |
55 |
56 lemma compact_UNIV: |
56 lemma compact_UNIV: |
57 "compact (UNIV :: 'a::{complete_linorder,linorder_topology,second_countable_topology} set)" |
57 "compact (UNIV :: 'a::{complete_linorder,linorder_topology,second_countable_topology} set)" |
58 using compact_complete_linorder |
58 using compact_complete_linorder |
153 |
153 |
154 lemma ereal_open_uminus: |
154 lemma ereal_open_uminus: |
155 fixes S :: "ereal set" |
155 fixes S :: "ereal set" |
156 assumes "open S" |
156 assumes "open S" |
157 shows "open (uminus ` S)" |
157 shows "open (uminus ` S)" |
158 using `open S`[unfolded open_generated_order] |
158 using \<open>open S\<close>[unfolded open_generated_order] |
159 proof induct |
159 proof induct |
160 have "range uminus = (UNIV :: ereal set)" |
160 have "range uminus = (UNIV :: ereal set)" |
161 by (auto simp: image_iff ereal_uminus_eq_reorder) |
161 by (auto simp: image_iff ereal_uminus_eq_reorder) |
162 then show "open (range uminus :: ereal set)" |
162 then show "open (range uminus :: ereal set)" |
163 by simp |
163 by simp |
193 } |
193 } |
194 moreover |
194 moreover |
195 { |
195 { |
196 assume "Inf S = \<infinity>" |
196 assume "Inf S = \<infinity>" |
197 then have "S = {\<infinity>}" |
197 then have "S = {\<infinity>}" |
198 by (metis Inf_eq_PInfty `S \<noteq> {}`) |
198 by (metis Inf_eq_PInfty \<open>S \<noteq> {}\<close>) |
199 then have False |
199 then have False |
200 by (metis assms(1) not_open_singleton) |
200 by (metis assms(1) not_open_singleton) |
201 } |
201 } |
202 moreover |
202 moreover |
203 { |
203 { |
250 and t: "\<bar>t\<bar> \<noteq> \<infinity>" |
250 and t: "\<bar>t\<bar> \<noteq> \<infinity>" |
251 shows "open ((\<lambda>x. m * x + t) ` S)" |
251 shows "open ((\<lambda>x. m * x + t) ` S)" |
252 proof - |
252 proof - |
253 have "open ((\<lambda>x. inverse m * (x + -t)) -` S)" |
253 have "open ((\<lambda>x. inverse m * (x + -t)) -` S)" |
254 using m t |
254 using m t |
255 apply (intro open_vimage `open S`) |
255 apply (intro open_vimage \<open>open S\<close>) |
256 apply (intro continuous_at_imp_continuous_on ballI tendsto_cmult_ereal continuous_at[THEN iffD2] |
256 apply (intro continuous_at_imp_continuous_on ballI tendsto_cmult_ereal continuous_at[THEN iffD2] |
257 tendsto_ident_at tendsto_add_left_ereal) |
257 tendsto_ident_at tendsto_add_left_ereal) |
258 apply auto |
258 apply auto |
259 done |
259 done |
260 also have "(\<lambda>x. inverse m * (x + -t)) -` S = (\<lambda>x. (x - t) / m) -` S" |
260 also have "(\<lambda>x. inverse m * (x + -t)) -` S = (\<lambda>x. (x - t) / m) -` S" |
275 and t: "\<bar>t\<bar> \<noteq> \<infinity>" |
275 and t: "\<bar>t\<bar> \<noteq> \<infinity>" |
276 shows "open ((\<lambda>x. m * x + t) ` S)" |
276 shows "open ((\<lambda>x. m * x + t) ` S)" |
277 proof cases |
277 proof cases |
278 assume "0 < m" |
278 assume "0 < m" |
279 then show ?thesis |
279 then show ?thesis |
280 using ereal_open_affinity_pos[OF `open S` _ _ t, of m] m |
280 using ereal_open_affinity_pos[OF \<open>open S\<close> _ _ t, of m] m |
281 by auto |
281 by auto |
282 next |
282 next |
283 assume "\<not> 0 < m" then |
283 assume "\<not> 0 < m" then |
284 have "0 < -m" |
284 have "0 < -m" |
285 using `m \<noteq> 0` |
285 using \<open>m \<noteq> 0\<close> |
286 by (cases m) auto |
286 by (cases m) auto |
287 then have m: "-m \<noteq> \<infinity>" "0 < -m" |
287 then have m: "-m \<noteq> \<infinity>" "0 < -m" |
288 using `\<bar>m\<bar> \<noteq> \<infinity>` |
288 using \<open>\<bar>m\<bar> \<noteq> \<infinity>\<close> |
289 by (auto simp: ereal_uminus_eq_reorder) |
289 by (auto simp: ereal_uminus_eq_reorder) |
290 from ereal_open_affinity_pos[OF ereal_open_uminus[OF `open S`] m t] show ?thesis |
290 from ereal_open_affinity_pos[OF ereal_open_uminus[OF \<open>open S\<close>] m t] show ?thesis |
291 unfolding image_image by simp |
291 unfolding image_image by simp |
292 qed |
292 qed |
293 |
293 |
294 lemma ereal_open_atLeast: |
294 lemma ereal_open_atLeast: |
295 fixes x :: ereal |
295 fixes x :: ereal |
437 lemma SUP_eq_LIMSEQ: |
437 lemma SUP_eq_LIMSEQ: |
438 assumes "mono f" |
438 assumes "mono f" |
439 shows "(SUP n. ereal (f n)) = ereal x \<longleftrightarrow> f ----> x" |
439 shows "(SUP n. ereal (f n)) = ereal x \<longleftrightarrow> f ----> x" |
440 proof |
440 proof |
441 have inc: "incseq (\<lambda>i. ereal (f i))" |
441 have inc: "incseq (\<lambda>i. ereal (f i))" |
442 using `mono f` unfolding mono_def incseq_def by auto |
442 using \<open>mono f\<close> unfolding mono_def incseq_def by auto |
443 { |
443 { |
444 assume "f ----> x" |
444 assume "f ----> x" |
445 then have "(\<lambda>i. ereal (f i)) ----> ereal x" |
445 then have "(\<lambda>i. ereal (f i)) ----> ereal x" |
446 by auto |
446 by auto |
447 from SUP_Lim_ereal[OF inc this] show "(SUP n. ereal (f n)) = ereal x" . |
447 from SUP_Lim_ereal[OF inc this] show "(SUP n. ereal (f n)) = ereal x" . |
466 apply (subst INF_ereal_minus_right) |
466 apply (subst INF_ereal_minus_right) |
467 apply auto |
467 apply auto |
468 apply (subst SUP_ereal_minus_right) |
468 apply (subst SUP_ereal_minus_right) |
469 apply auto |
469 apply auto |
470 done |
470 done |
471 qed (insert `c \<noteq> -\<infinity>`, simp) |
471 qed (insert \<open>c \<noteq> -\<infinity>\<close>, simp) |
472 |
472 |
473 |
473 |
474 subsubsection {* Continuity *} |
474 subsubsection \<open>Continuity\<close> |
475 |
475 |
476 lemma continuous_at_of_ereal: |
476 lemma continuous_at_of_ereal: |
477 fixes x0 :: ereal |
477 fixes x0 :: ereal |
478 assumes "\<bar>x0\<bar> \<noteq> \<infinity>" |
478 assumes "\<bar>x0\<bar> \<noteq> \<infinity>" |
479 shows "continuous (at x0) real" |
479 shows "continuous (at x0) real" |
605 { assume ex: "\<exists>B. \<forall>x\<in>S. B \<le> x" |
605 { assume ex: "\<exists>B. \<forall>x\<in>S. B \<le> x" |
606 then have *: "\<forall>x\<in>S. Inf S \<le> x" |
606 then have *: "\<forall>x\<in>S. Inf S \<le> x" |
607 using cInf_lower[of _ S] ex by (metis bdd_below_def) |
607 using cInf_lower[of _ S] ex by (metis bdd_below_def) |
608 then have "Inf S \<in> S" |
608 then have "Inf S \<in> S" |
609 apply (subst closed_contains_Inf) |
609 apply (subst closed_contains_Inf) |
610 using ex `S \<noteq> {}` `closed S` |
610 using ex \<open>S \<noteq> {}\<close> \<open>closed S\<close> |
611 apply auto |
611 apply auto |
612 done |
612 done |
613 then have "\<forall>x. Inf S \<le> x \<longleftrightarrow> x \<in> S" |
613 then have "\<forall>x. Inf S \<le> x \<longleftrightarrow> x \<in> S" |
614 using mono[rule_format, of "Inf S"] * |
614 using mono[rule_format, of "Inf S"] * |
615 by auto |
615 by auto |
674 ultimately show ?thesis |
674 ultimately show ?thesis |
675 using mono_closed_real[of S] assms by auto |
675 using mono_closed_real[of S] assms by auto |
676 qed |
676 qed |
677 |
677 |
678 |
678 |
679 subsection {* Sums *} |
679 subsection \<open>Sums\<close> |
680 |
680 |
681 lemma sums_ereal_positive: |
681 lemma sums_ereal_positive: |
682 fixes f :: "nat \<Rightarrow> ereal" |
682 fixes f :: "nat \<Rightarrow> ereal" |
683 assumes "\<And>i. 0 \<le> f i" |
683 assumes "\<And>i. 0 \<le> f i" |
684 shows "f sums (SUP n. \<Sum>i<n. f i)" |
684 shows "f sums (SUP n. \<Sum>i<n. f i)" |
765 using assms(2,1)[of N] by auto |
765 using assms(2,1)[of N] by auto |
766 } |
766 } |
767 have "setsum f {..<n} \<le> setsum g {..<n}" |
767 have "setsum f {..<n} \<le> setsum g {..<n}" |
768 using assms by (auto intro: setsum_mono) |
768 using assms by (auto intro: setsum_mono) |
769 also have "\<dots> \<le> suminf g" |
769 also have "\<dots> \<le> suminf g" |
770 using `\<And>N. 0 \<le> g N` |
770 using \<open>\<And>N. 0 \<le> g N\<close> |
771 by (rule suminf_upper) |
771 by (rule suminf_upper) |
772 finally show "setsum f {..<n} \<le> suminf g" . |
772 finally show "setsum f {..<n} \<le> suminf g" . |
773 qed (rule assms(2)) |
773 qed (rule assms(2)) |
774 |
774 |
775 lemma suminf_half_series_ereal: "(\<Sum>n. (1/2 :: ereal) ^ Suc n) = 1" |
775 lemma suminf_half_series_ereal: "(\<Sum>n. (1/2 :: ereal) ^ Suc n) = 1" |
865 fix i |
865 fix i |
866 have "0 \<le> f i" |
866 have "0 \<le> f i" |
867 using ord[of i] by auto |
867 using ord[of i] by auto |
868 } |
868 } |
869 moreover |
869 moreover |
870 from suminf_PInfty_fun[OF `\<And>i. 0 \<le> f i` fin(1)] obtain f' where [simp]: "f = (\<lambda>x. ereal (f' x))" .. |
870 from suminf_PInfty_fun[OF \<open>\<And>i. 0 \<le> f i\<close> fin(1)] obtain f' where [simp]: "f = (\<lambda>x. ereal (f' x))" .. |
871 from suminf_PInfty_fun[OF `\<And>i. 0 \<le> g i` fin(2)] obtain g' where [simp]: "g = (\<lambda>x. ereal (g' x))" .. |
871 from suminf_PInfty_fun[OF \<open>\<And>i. 0 \<le> g i\<close> fin(2)] obtain g' where [simp]: "g = (\<lambda>x. ereal (g' x))" .. |
872 { |
872 { |
873 fix i |
873 fix i |
874 have "0 \<le> f i - g i" |
874 have "0 \<le> f i - g i" |
875 using ord[of i] by (auto simp: ereal_le_minus_iff) |
875 using ord[of i] by (auto simp: ereal_le_minus_iff) |
876 } |
876 } |
878 have "suminf (\<lambda>i. f i - g i) \<le> suminf f" |
878 have "suminf (\<lambda>i. f i - g i) \<le> suminf f" |
879 using assms by (auto intro!: suminf_le_pos simp: field_simps) |
879 using assms by (auto intro!: suminf_le_pos simp: field_simps) |
880 then have "suminf (\<lambda>i. f i - g i) \<noteq> \<infinity>" |
880 then have "suminf (\<lambda>i. f i - g i) \<noteq> \<infinity>" |
881 using fin by auto |
881 using fin by auto |
882 ultimately show ?thesis |
882 ultimately show ?thesis |
883 using assms `\<And>i. 0 \<le> f i` |
883 using assms \<open>\<And>i. 0 \<le> f i\<close> |
884 apply simp |
884 apply simp |
885 apply (subst (1 2 3) suminf_ereal) |
885 apply (subst (1 2 3) suminf_ereal) |
886 apply (auto intro!: suminf_diff[symmetric] summable_ereal) |
886 apply (auto intro!: suminf_diff[symmetric] summable_ereal) |
887 done |
887 done |
888 qed |
888 qed |
974 by (subst suminf_finite[where N="{i}"]) auto |
974 by (subst suminf_finite[where N="{i}"]) auto |
975 also have "\<dots> \<le> (\<Sum>i. f i)" |
975 also have "\<dots> \<le> (\<Sum>i. f i)" |
976 using nneg |
976 using nneg |
977 by (auto intro!: suminf_le_pos) |
977 by (auto intro!: suminf_le_pos) |
978 finally have False |
978 finally have False |
979 using `(\<Sum>i. f i) = 0` by auto |
979 using \<open>(\<Sum>i. f i) = 0\<close> by auto |
980 } |
980 } |
981 then show "\<forall>i. f i = 0" |
981 then show "\<forall>i. f i = 0" |
982 by auto |
982 by auto |
983 qed simp |
983 qed simp |
984 |
984 |
990 fix P d |
990 fix P d |
991 assume "0 < d" and "\<forall>y. y \<in> S \<longrightarrow> y \<noteq> x \<and> dist y x < d \<longrightarrow> P y" |
991 assume "0 < d" and "\<forall>y. y \<in> S \<longrightarrow> y \<noteq> x \<and> dist y x < d \<longrightarrow> P y" |
992 then have "S \<inter> ball x d - {x} \<subseteq> {x. P x}" |
992 then have "S \<inter> ball x d - {x} \<subseteq> {x. P x}" |
993 by (auto simp: zero_less_dist_iff dist_commute) |
993 by (auto simp: zero_less_dist_iff dist_commute) |
994 then show "\<exists>r>0. INFIMUM (Collect P) f \<le> INFIMUM (S \<inter> ball x r - {x}) f" |
994 then show "\<exists>r>0. INFIMUM (Collect P) f \<le> INFIMUM (S \<inter> ball x r - {x}) f" |
995 by (intro exI[of _ d] INF_mono conjI `0 < d`) auto |
995 by (intro exI[of _ d] INF_mono conjI \<open>0 < d\<close>) auto |
996 next |
996 next |
997 fix d :: real |
997 fix d :: real |
998 assume "0 < d" |
998 assume "0 < d" |
999 then show "\<exists>P. (\<exists>d>0. \<forall>xa. xa \<in> S \<longrightarrow> xa \<noteq> x \<and> dist xa x < d \<longrightarrow> P xa) \<and> |
999 then show "\<exists>P. (\<exists>d>0. \<forall>xa. xa \<in> S \<longrightarrow> xa \<noteq> x \<and> dist xa x < d \<longrightarrow> P xa) \<and> |
1000 INFIMUM (S \<inter> ball x d - {x}) f \<le> INFIMUM (Collect P) f" |
1000 INFIMUM (S \<inter> ball x d - {x}) f \<le> INFIMUM (Collect P) f" |
1010 fix P d |
1010 fix P d |
1011 assume "0 < d" and "\<forall>y. y \<in> S \<longrightarrow> y \<noteq> x \<and> dist y x < d \<longrightarrow> P y" |
1011 assume "0 < d" and "\<forall>y. y \<in> S \<longrightarrow> y \<noteq> x \<and> dist y x < d \<longrightarrow> P y" |
1012 then have "S \<inter> ball x d - {x} \<subseteq> {x. P x}" |
1012 then have "S \<inter> ball x d - {x} \<subseteq> {x. P x}" |
1013 by (auto simp: zero_less_dist_iff dist_commute) |
1013 by (auto simp: zero_less_dist_iff dist_commute) |
1014 then show "\<exists>r>0. SUPREMUM (S \<inter> ball x r - {x}) f \<le> SUPREMUM (Collect P) f" |
1014 then show "\<exists>r>0. SUPREMUM (S \<inter> ball x r - {x}) f \<le> SUPREMUM (Collect P) f" |
1015 by (intro exI[of _ d] SUP_mono conjI `0 < d`) auto |
1015 by (intro exI[of _ d] SUP_mono conjI \<open>0 < d\<close>) auto |
1016 next |
1016 next |
1017 fix d :: real |
1017 fix d :: real |
1018 assume "0 < d" |
1018 assume "0 < d" |
1019 then show "\<exists>P. (\<exists>d>0. \<forall>xa. xa \<in> S \<longrightarrow> xa \<noteq> x \<and> dist xa x < d \<longrightarrow> P xa) \<and> |
1019 then show "\<exists>P. (\<exists>d>0. \<forall>xa. xa \<in> S \<longrightarrow> xa \<noteq> x \<and> dist xa x < d \<longrightarrow> P xa) \<and> |
1020 SUPREMUM (Collect P) f \<le> SUPREMUM (S \<inter> ball x d - {x}) f" |
1020 SUPREMUM (Collect P) f \<le> SUPREMUM (S \<inter> ball x d - {x}) f" |
1087 hence "(\<lambda>x. ereal (f x)) sums ereal x" by (simp add: sums_ereal) |
1087 hence "(\<lambda>x. ereal (f x)) sums ereal x" by (simp add: sums_ereal) |
1088 from sums_unique[OF this] have "(\<Sum>x. ereal (f x)) = ereal x" .. |
1088 from sums_unique[OF this] have "(\<Sum>x. ereal (f x)) = ereal x" .. |
1089 thus "(\<Sum>x. ereal (f x)) \<noteq> -\<infinity>" by simp_all |
1089 thus "(\<Sum>x. ereal (f x)) \<noteq> -\<infinity>" by simp_all |
1090 qed |
1090 qed |
1091 |
1091 |
1092 subsection {* monoset *} |
1092 subsection \<open>monoset\<close> |
1093 |
1093 |
1094 definition (in order) mono_set: |
1094 definition (in order) mono_set: |
1095 "mono_set S \<longleftrightarrow> (\<forall>x y. x \<le> y \<longrightarrow> x \<in> S \<longrightarrow> y \<in> S)" |
1095 "mono_set S \<longleftrightarrow> (\<forall>x y. x \<le> y \<longrightarrow> x \<in> S \<longrightarrow> y \<in> S)" |
1096 |
1096 |
1097 lemma (in order) mono_greaterThan [intro, simp]: "mono_set {B<..}" unfolding mono_set by auto |
1097 lemma (in order) mono_greaterThan [intro, simp]: "mono_set {B<..}" unfolding mono_set by auto |
1109 by (auto simp: mono_set) |
1109 by (auto simp: mono_set) |
1110 show ?c |
1110 show ?c |
1111 proof cases |
1111 proof cases |
1112 assume "a \<in> S" |
1112 assume "a \<in> S" |
1113 show ?c |
1113 show ?c |
1114 using mono[OF _ `a \<in> S`] |
1114 using mono[OF _ \<open>a \<in> S\<close>] |
1115 by (auto intro: Inf_lower simp: a_def) |
1115 by (auto intro: Inf_lower simp: a_def) |
1116 next |
1116 next |
1117 assume "a \<notin> S" |
1117 assume "a \<notin> S" |
1118 have "S = {a <..}" |
1118 have "S = {a <..}" |
1119 proof safe |
1119 proof safe |
1120 fix x assume "x \<in> S" |
1120 fix x assume "x \<in> S" |
1121 then have "a \<le> x" |
1121 then have "a \<le> x" |
1122 unfolding a_def by (rule Inf_lower) |
1122 unfolding a_def by (rule Inf_lower) |
1123 then show "a < x" |
1123 then show "a < x" |
1124 using `x \<in> S` `a \<notin> S` by (cases "a = x") auto |
1124 using \<open>x \<in> S\<close> \<open>a \<notin> S\<close> by (cases "a = x") auto |
1125 next |
1125 next |
1126 fix x assume "a < x" |
1126 fix x assume "a < x" |
1127 then obtain y where "y < x" "y \<in> S" |
1127 then obtain y where "y < x" "y \<in> S" |
1128 unfolding a_def Inf_less_iff .. |
1128 unfolding a_def Inf_less_iff .. |
1129 with mono[of y x] show "x \<in> S" |
1129 with mono[of y x] show "x \<in> S" |
1249 using om ereal_open_mono_set by auto |
1249 using om ereal_open_mono_set by auto |
1250 then have "B < x0" |
1250 then have "B < x0" |
1251 using om by auto |
1251 using om by auto |
1252 then have "\<exists>N. \<forall>n\<ge>N. x n \<in> S" |
1252 then have "\<exists>N. \<forall>n\<ge>N. x n \<in> S" |
1253 unfolding B |
1253 unfolding B |
1254 using `x0 \<le> liminf x` liminf_bounded_iff |
1254 using \<open>x0 \<le> liminf x\<close> liminf_bounded_iff |
1255 by auto |
1255 by auto |
1256 } |
1256 } |
1257 ultimately have "\<exists>N. \<forall>n\<ge>N. x n \<in> S" |
1257 ultimately have "\<exists>N. \<forall>n\<ge>N. x n \<in> S" |
1258 by auto |
1258 by auto |
1259 } |
1259 } |