| author | wenzelm | 
| Sat, 13 Aug 2022 14:45:36 +0200 | |
| changeset 75841 | 7c00d5266bf8 | 
| parent 70723 | 4e39d87c9737 | 
| child 80914 | d97fdabd9e2b | 
| permissions | -rw-r--r-- | 
| 62479 | 1 | (* Title: HOL/Nonstandard_Analysis/HLim.thy | 
| 41589 | 2 | Author: Jacques D. Fleuriot, University of Cambridge | 
| 3 | Author: Lawrence C Paulson | |
| 27468 | 4 | *) | 
| 5 | ||
| 64435 | 6 | section \<open>Limits and Continuity (Nonstandard)\<close> | 
| 27468 | 7 | |
| 8 | theory HLim | |
| 63579 | 9 | imports Star | 
| 10 | abbrevs "--->" = "\<midarrow>\<rightarrow>\<^sub>N\<^sub>S" | |
| 27468 | 11 | begin | 
| 12 | ||
| 64435 | 13 | text \<open>Nonstandard Definitions.\<close> | 
| 27468 | 14 | |
| 64435 | 15 | definition NSLIM :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool"
 | 
| 16 |     ("((_)/ \<midarrow>(_)/\<rightarrow>\<^sub>N\<^sub>S (_))" [60, 0, 60] 60)
 | |
| 17 | where "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L \<longleftrightarrow> (\<forall>x. x \<noteq> star_of a \<and> x \<approx> star_of a \<longrightarrow> ( *f* f) x \<approx> star_of L)" | |
| 27468 | 18 | |
| 64435 | 19 | definition isNSCont :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a \<Rightarrow> bool"
 | 
| 20 | where \<comment> \<open>NS definition dispenses with limit notions\<close> | |
| 21 | "isNSCont f a \<longleftrightarrow> (\<forall>y. y \<approx> star_of a \<longrightarrow> ( *f* f) y \<approx> star_of (f a))" | |
| 27468 | 22 | |
| 64435 | 23 | definition isNSUCont :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> bool"
 | 
| 24 | where "isNSUCont f \<longleftrightarrow> (\<forall>x y. x \<approx> y \<longrightarrow> ( *f* f) x \<approx> ( *f* f) y)" | |
| 27468 | 25 | |
| 26 | ||
| 61975 | 27 | subsection \<open>Limits of Functions\<close> | 
| 27468 | 28 | |
| 64435 | 29 | lemma NSLIM_I: "(\<And>x. x \<noteq> star_of a \<Longrightarrow> x \<approx> star_of a \<Longrightarrow> starfun f x \<approx> star_of L) \<Longrightarrow> f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L" | 
| 30 | by (simp add: NSLIM_def) | |
| 31 | ||
| 32 | lemma NSLIM_D: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L \<Longrightarrow> x \<noteq> star_of a \<Longrightarrow> x \<approx> star_of a \<Longrightarrow> starfun f x \<approx> star_of L" | |
| 33 | by (simp add: NSLIM_def) | |
| 27468 | 34 | |
| 64435 | 35 | text \<open>Proving properties of limits using nonstandard definition. | 
| 36 | The properties hold for standard limits as well!\<close> | |
| 27468 | 37 | |
| 64435 | 38 | lemma NSLIM_mult: "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> g \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S m \<Longrightarrow> (\<lambda>x. f x * g x) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S (l * m)" | 
| 39 | for l m :: "'a::real_normed_algebra" | |
| 40 | by (auto simp add: NSLIM_def intro!: approx_mult_HFinite) | |
| 27468 | 41 | |
| 64435 | 42 | lemma starfun_scaleR [simp]: "starfun (\<lambda>x. f x *\<^sub>R g x) = (\<lambda>x. scaleHR (starfun f x) (starfun g x))" | 
| 43 | by transfer (rule refl) | |
| 27468 | 44 | |
| 64435 | 45 | lemma NSLIM_scaleR: "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> g \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S m \<Longrightarrow> (\<lambda>x. f x *\<^sub>R g x) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S (l *\<^sub>R m)" | 
| 46 | by (auto simp add: NSLIM_def intro!: approx_scaleR_HFinite) | |
| 27468 | 47 | |
| 64435 | 48 | lemma NSLIM_add: "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> g \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S m \<Longrightarrow> (\<lambda>x. f x + g x) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S (l + m)" | 
| 49 | by (auto simp add: NSLIM_def intro!: approx_add) | |
| 27468 | 50 | |
| 64435 | 51 | lemma NSLIM_const [simp]: "(\<lambda>x. k) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S k" | 
| 52 | by (simp add: NSLIM_def) | |
| 27468 | 53 | |
| 64435 | 54 | lemma NSLIM_minus: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L \<Longrightarrow> (\<lambda>x. - f x) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S -L" | 
| 55 | by (simp add: NSLIM_def) | |
| 27468 | 56 | |
| 64435 | 57 | lemma NSLIM_diff: "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> g \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S m \<Longrightarrow> (\<lambda>x. f x - g x) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S (l - m)" | 
| 54230 
b1d955791529
more simplification rules on unary and binary minus
 haftmann parents: 
51525diff
changeset | 58 | by (simp only: NSLIM_add NSLIM_minus diff_conv_add_uminus) | 
| 27468 | 59 | |
| 64435 | 60 | lemma NSLIM_add_minus: "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> g \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S m \<Longrightarrow> (\<lambda>x. f x + - g x) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S (l + -m)" | 
| 61 | by (simp only: NSLIM_add NSLIM_minus) | |
| 27468 | 62 | |
| 64435 | 63 | lemma NSLIM_inverse: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L \<Longrightarrow> L \<noteq> 0 \<Longrightarrow> (\<lambda>x. inverse (f x)) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S (inverse L)" | 
| 64 | for L :: "'a::real_normed_div_algebra" | |
| 70228 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 65 | unfolding NSLIM_def by (metis (no_types) star_of_approx_inverse star_of_simps(6) starfun_inverse) | 
| 27468 | 66 | |
| 67 | lemma NSLIM_zero: | |
| 64435 | 68 | assumes f: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S l" | 
| 69 | shows "(\<lambda>x. f(x) - l) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S 0" | |
| 27468 | 70 | proof - | 
| 61971 | 71 | have "(\<lambda>x. f x - l) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S l - l" | 
| 27468 | 72 | by (rule NSLIM_diff [OF f NSLIM_const]) | 
| 64435 | 73 | then show ?thesis by simp | 
| 27468 | 74 | qed | 
| 75 | ||
| 70228 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 76 | lemma NSLIM_zero_cancel: | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 77 | assumes "(\<lambda>x. f x - l) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S 0" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 78 | shows "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 79 | proof - | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 80 | have "(\<lambda>x. f x - l + l) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S 0 + l" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 81 | by (fast intro: assms NSLIM_const NSLIM_add) | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 82 | then show ?thesis | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 83 | by simp | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 84 | qed | 
| 27468 | 85 | |
| 70228 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 86 | lemma NSLIM_const_eq: | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 87 | fixes a :: "'a::real_normed_algebra_1" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 88 | assumes "(\<lambda>x. k) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S l" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 89 | shows "k = l" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 90 | proof - | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 91 | have "\<not> (\<lambda>x. k) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S l" if "k \<noteq> l" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 92 | proof - | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 93 | have "star_of a + of_hypreal \<epsilon> \<approx> star_of a" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 94 | by (simp add: approx_def) | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 95 | then show ?thesis | 
| 70723 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70228diff
changeset | 96 | using epsilon_not_zero that by (force simp add: NSLIM_def) | 
| 70228 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 97 | qed | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 98 | with assms show ?thesis by metis | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 99 | qed | 
| 27468 | 100 | |
| 70228 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 101 | lemma NSLIM_unique: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S M \<Longrightarrow> l = M" | 
| 64435 | 102 | for a :: "'a::real_normed_algebra_1" | 
| 103 | by (drule (1) NSLIM_diff) (auto dest!: NSLIM_const_eq) | |
| 27468 | 104 | |
| 64435 | 105 | lemma NSLIM_mult_zero: "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S 0 \<Longrightarrow> g \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S 0 \<Longrightarrow> (\<lambda>x. f x * g x) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S 0" | 
| 106 | for f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_algebra" | |
| 107 | by (drule NSLIM_mult) auto | |
| 27468 | 108 | |
| 64435 | 109 | lemma NSLIM_self: "(\<lambda>x. x) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S a" | 
| 110 | by (simp add: NSLIM_def) | |
| 27468 | 111 | |
| 112 | ||
| 69597 | 113 | subsubsection \<open>Equivalence of \<^term>\<open>filterlim\<close> and \<^term>\<open>NSLIM\<close>\<close> | 
| 27468 | 114 | |
| 115 | lemma LIM_NSLIM: | |
| 64435 | 116 | assumes f: "f \<midarrow>a\<rightarrow> L" | 
| 117 | shows "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L" | |
| 27468 | 118 | proof (rule NSLIM_I) | 
| 119 | fix x | |
| 120 | assume neq: "x \<noteq> star_of a" | |
| 121 | assume approx: "x \<approx> star_of a" | |
| 122 | have "starfun f x - star_of L \<in> Infinitesimal" | |
| 123 | proof (rule InfinitesimalI2) | |
| 64435 | 124 | fix r :: real | 
| 125 | assume r: "0 < r" | |
| 126 | from LIM_D [OF f r] obtain s | |
| 127 | where s: "0 < s" and less_r: "\<And>x. x \<noteq> a \<Longrightarrow> norm (x - a) < s \<Longrightarrow> norm (f x - L) < r" | |
| 27468 | 128 | by fast | 
| 129 | from less_r have less_r': | |
| 64435 | 130 | "\<And>x. x \<noteq> star_of a \<Longrightarrow> hnorm (x - star_of a) < star_of s \<Longrightarrow> | 
| 131 | hnorm (starfun f x - star_of L) < star_of r" | |
| 27468 | 132 | by transfer | 
| 133 | from approx have "x - star_of a \<in> Infinitesimal" | |
| 64435 | 134 | by (simp only: approx_def) | 
| 135 | then have "hnorm (x - star_of a) < star_of s" | |
| 27468 | 136 | using s by (rule InfinitesimalD2) | 
| 137 | with neq show "hnorm (starfun f x - star_of L) < star_of r" | |
| 138 | by (rule less_r') | |
| 139 | qed | |
| 64435 | 140 | then show "starfun f x \<approx> star_of L" | 
| 27468 | 141 | by (unfold approx_def) | 
| 142 | qed | |
| 143 | ||
| 144 | lemma NSLIM_LIM: | |
| 64435 | 145 | assumes f: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L" | 
| 146 | shows "f \<midarrow>a\<rightarrow> L" | |
| 27468 | 147 | proof (rule LIM_I) | 
| 64435 | 148 | fix r :: real | 
| 149 | assume r: "0 < r" | |
| 150 | have "\<exists>s>0. \<forall>x. x \<noteq> star_of a \<and> hnorm (x - star_of a) < s \<longrightarrow> | |
| 151 | hnorm (starfun f x - star_of L) < star_of r" | |
| 27468 | 152 | proof (rule exI, safe) | 
| 64435 | 153 | show "0 < \<epsilon>" | 
| 70723 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70228diff
changeset | 154 | by (rule epsilon_gt_zero) | 
| 27468 | 155 | next | 
| 64435 | 156 | fix x | 
| 157 | assume neq: "x \<noteq> star_of a" | |
| 61981 | 158 | assume "hnorm (x - star_of a) < \<epsilon>" | 
| 64435 | 159 | with Infinitesimal_epsilon have "x - star_of a \<in> Infinitesimal" | 
| 27468 | 160 | by (rule hnorm_less_Infinitesimal) | 
| 64435 | 161 | then have "x \<approx> star_of a" | 
| 27468 | 162 | by (unfold approx_def) | 
| 163 | with f neq have "starfun f x \<approx> star_of L" | |
| 164 | by (rule NSLIM_D) | |
| 64435 | 165 | then have "starfun f x - star_of L \<in> Infinitesimal" | 
| 27468 | 166 | by (unfold approx_def) | 
| 64435 | 167 | then show "hnorm (starfun f x - star_of L) < star_of r" | 
| 27468 | 168 | using r by (rule InfinitesimalD2) | 
| 169 | qed | |
| 64435 | 170 | then show "\<exists>s>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < s \<longrightarrow> norm (f x - L) < r" | 
| 27468 | 171 | by transfer | 
| 172 | qed | |
| 173 | ||
| 64435 | 174 | theorem LIM_NSLIM_iff: "f \<midarrow>x\<rightarrow> L \<longleftrightarrow> f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S L" | 
| 175 | by (blast intro: LIM_NSLIM NSLIM_LIM) | |
| 27468 | 176 | |
| 177 | ||
| 61975 | 178 | subsection \<open>Continuity\<close> | 
| 27468 | 179 | |
| 64435 | 180 | lemma isNSContD: "isNSCont f a \<Longrightarrow> y \<approx> star_of a \<Longrightarrow> ( *f* f) y \<approx> star_of (f a)" | 
| 181 | by (simp add: isNSCont_def) | |
| 182 | ||
| 183 | lemma isNSCont_NSLIM: "isNSCont f a \<Longrightarrow> f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S (f a)" | |
| 184 | by (simp add: isNSCont_def NSLIM_def) | |
| 27468 | 185 | |
| 64435 | 186 | lemma NSLIM_isNSCont: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S (f a) \<Longrightarrow> isNSCont f a" | 
| 70228 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 187 | by (force simp add: isNSCont_def NSLIM_def) | 
| 27468 | 188 | |
| 64435 | 189 | text \<open>NS continuity can be defined using NS Limit in | 
| 190 | similar fashion to standard definition of continuity.\<close> | |
| 191 | lemma isNSCont_NSLIM_iff: "isNSCont f a \<longleftrightarrow> f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S (f a)" | |
| 192 | by (blast intro: isNSCont_NSLIM NSLIM_isNSCont) | |
| 27468 | 193 | |
| 64435 | 194 | text \<open>Hence, NS continuity can be given in terms of standard limit.\<close> | 
| 195 | lemma isNSCont_LIM_iff: "(isNSCont f a) = (f \<midarrow>a\<rightarrow> (f a))" | |
| 196 | by (simp add: LIM_NSLIM_iff isNSCont_NSLIM_iff) | |
| 27468 | 197 | |
| 64435 | 198 | text \<open>Moreover, it's trivial now that NS continuity | 
| 199 | is equivalent to standard continuity.\<close> | |
| 200 | lemma isNSCont_isCont_iff: "isNSCont f a \<longleftrightarrow> isCont f a" | |
| 201 | by (simp add: isCont_def) (rule isNSCont_LIM_iff) | |
| 27468 | 202 | |
| 64435 | 203 | text \<open>Standard continuity \<open>\<Longrightarrow>\<close> NS continuity.\<close> | 
| 204 | lemma isCont_isNSCont: "isCont f a \<Longrightarrow> isNSCont f a" | |
| 205 | by (erule isNSCont_isCont_iff [THEN iffD2]) | |
| 27468 | 206 | |
| 64604 | 207 | text \<open>NS continuity \<open>\<Longrightarrow>\<close> Standard continuity.\<close> | 
| 208 | lemma isNSCont_isCont: "isNSCont f a \<Longrightarrow> isCont f a" | |
| 64435 | 209 | by (erule isNSCont_isCont_iff [THEN iffD1]) | 
| 27468 | 210 | |
| 64435 | 211 | |
| 212 | text \<open>Alternative definition of continuity.\<close> | |
| 27468 | 213 | |
| 64435 | 214 | text \<open>Prove equivalence between NS limits -- | 
| 215 | seems easier than using standard definition.\<close> | |
| 70228 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 216 | lemma NSLIM_at0_iff: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L \<longleftrightarrow> (\<lambda>h. f (a + h)) \<midarrow>0\<rightarrow>\<^sub>N\<^sub>S L" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 217 | proof | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 218 | assume "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 219 | then show "(\<lambda>h. f (a + h)) \<midarrow>0\<rightarrow>\<^sub>N\<^sub>S L" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 220 | by (simp add: NSLIM_def) (metis (no_types) add_cancel_left_right approx_add_left_iff starfun_lambda_cancel) | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 221 | next | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 222 | assume *: "(\<lambda>h. f (a + h)) \<midarrow>0\<rightarrow>\<^sub>N\<^sub>S L" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 223 | show "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 224 | proof (clarsimp simp: NSLIM_def) | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 225 | fix x | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 226 | assume "x \<noteq> star_of a" "x \<approx> star_of a" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 227 | then have "(*f* (\<lambda>h. f (a + h))) (- star_of a + x) \<approx> star_of L" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 228 | by (metis (no_types, lifting) "*" NSLIM_D add.right_neutral add_minus_cancel approx_minus_iff2 star_zero_def) | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 229 | then show "(*f* f) x \<approx> star_of L" | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 230 | by (simp add: starfun_lambda_cancel) | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 231 | qed | 
| 
2d5b122aa0ff
De-applying and combining lemmas to make structured proofs
 paulson <lp15@cam.ac.uk> parents: 
69597diff
changeset | 232 | qed | 
| 27468 | 233 | |
| 64435 | 234 | lemma isNSCont_minus: "isNSCont f a \<Longrightarrow> isNSCont (\<lambda>x. - f x) a" | 
| 235 | by (simp add: isNSCont_def) | |
| 27468 | 236 | |
| 64435 | 237 | lemma isNSCont_inverse: "isNSCont f x \<Longrightarrow> f x \<noteq> 0 \<Longrightarrow> isNSCont (\<lambda>x. inverse (f x)) x" | 
| 238 | for f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_div_algebra" | |
| 68611 | 239 | using NSLIM_inverse NSLIM_isNSCont isNSCont_NSLIM by blast | 
| 27468 | 240 | |
| 64435 | 241 | lemma isNSCont_const [simp]: "isNSCont (\<lambda>x. k) a" | 
| 242 | by (simp add: isNSCont_def) | |
| 27468 | 243 | |
| 64435 | 244 | lemma isNSCont_abs [simp]: "isNSCont abs a" | 
| 245 | for a :: real | |
| 246 | by (auto simp: isNSCont_def intro: approx_hrabs simp: starfun_rabs_hrabs) | |
| 27468 | 247 | |
| 248 | ||
| 61975 | 249 | subsection \<open>Uniform Continuity\<close> | 
| 27468 | 250 | |
| 64435 | 251 | lemma isNSUContD: "isNSUCont f \<Longrightarrow> x \<approx> y \<Longrightarrow> ( *f* f) x \<approx> ( *f* f) y" | 
| 252 | by (simp add: isNSUCont_def) | |
| 27468 | 253 | |
| 254 | lemma isUCont_isNSUCont: | |
| 255 | fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector" | |
| 64435 | 256 | assumes f: "isUCont f" | 
| 257 | shows "isNSUCont f" | |
| 258 | unfolding isNSUCont_def | |
| 259 | proof safe | |
| 27468 | 260 | fix x y :: "'a star" | 
| 261 | assume approx: "x \<approx> y" | |
| 262 | have "starfun f x - starfun f y \<in> Infinitesimal" | |
| 263 | proof (rule InfinitesimalI2) | |
| 64435 | 264 | fix r :: real | 
| 265 | assume r: "0 < r" | |
| 266 | with f obtain s where s: "0 < s" | |
| 267 | and less_r: "\<And>x y. norm (x - y) < s \<Longrightarrow> norm (f x - f y) < r" | |
| 31338 
d41a8ba25b67
generalize constants from Lim.thy to class metric_space
 huffman parents: 
28562diff
changeset | 268 | by (auto simp add: isUCont_def dist_norm) | 
| 27468 | 269 | from less_r have less_r': | 
| 64435 | 270 | "\<And>x y. hnorm (x - y) < star_of s \<Longrightarrow> hnorm (starfun f x - starfun f y) < star_of r" | 
| 27468 | 271 | by transfer | 
| 272 | from approx have "x - y \<in> Infinitesimal" | |
| 273 | by (unfold approx_def) | |
| 64435 | 274 | then have "hnorm (x - y) < star_of s" | 
| 27468 | 275 | using s by (rule InfinitesimalD2) | 
| 64435 | 276 | then show "hnorm (starfun f x - starfun f y) < star_of r" | 
| 27468 | 277 | by (rule less_r') | 
| 278 | qed | |
| 64435 | 279 | then show "starfun f x \<approx> starfun f y" | 
| 27468 | 280 | by (unfold approx_def) | 
| 281 | qed | |
| 282 | ||
| 283 | lemma isNSUCont_isUCont: | |
| 284 | fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector" | |
| 64435 | 285 | assumes f: "isNSUCont f" | 
| 286 | shows "isUCont f" | |
| 287 | unfolding isUCont_def dist_norm | |
| 288 | proof safe | |
| 289 | fix r :: real | |
| 290 | assume r: "0 < r" | |
| 291 | have "\<exists>s>0. \<forall>x y. hnorm (x - y) < s \<longrightarrow> hnorm (starfun f x - starfun f y) < star_of r" | |
| 27468 | 292 | proof (rule exI, safe) | 
| 64435 | 293 | show "0 < \<epsilon>" | 
| 70723 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70228diff
changeset | 294 | by (rule epsilon_gt_zero) | 
| 27468 | 295 | next | 
| 296 | fix x y :: "'a star" | |
| 61981 | 297 | assume "hnorm (x - y) < \<epsilon>" | 
| 64435 | 298 | with Infinitesimal_epsilon have "x - y \<in> Infinitesimal" | 
| 27468 | 299 | by (rule hnorm_less_Infinitesimal) | 
| 64435 | 300 | then have "x \<approx> y" | 
| 27468 | 301 | by (unfold approx_def) | 
| 302 | with f have "starfun f x \<approx> starfun f y" | |
| 303 | by (simp add: isNSUCont_def) | |
| 64435 | 304 | then have "starfun f x - starfun f y \<in> Infinitesimal" | 
| 27468 | 305 | by (unfold approx_def) | 
| 64435 | 306 | then show "hnorm (starfun f x - starfun f y) < star_of r" | 
| 27468 | 307 | using r by (rule InfinitesimalD2) | 
| 308 | qed | |
| 64435 | 309 | then show "\<exists>s>0. \<forall>x y. norm (x - y) < s \<longrightarrow> norm (f x - f y) < r" | 
| 27468 | 310 | by transfer | 
| 311 | qed | |
| 312 | ||
| 313 | end |