13 |
14 |
14 text{*Standard and Nonstandard Definitions*} |
15 text{*Standard and Nonstandard Definitions*} |
15 |
16 |
16 constdefs |
17 constdefs |
17 LIM :: "[real=>real,real,real] => bool" |
18 LIM :: "[real=>real,real,real] => bool" |
18 ("((_)/ -- (_)/ --> (_))" [60, 0, 60] 60) |
19 ("((_)/ -- (_)/ --> (_))" [60, 0, 60] 60) |
19 "f -- a --> L == |
20 "f -- a --> L == |
20 \<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & \<bar>x + -a\<bar> < s |
21 \<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & \<bar>x + -a\<bar> < s |
21 --> \<bar>f x + -L\<bar> < r" |
22 --> \<bar>f x + -L\<bar> < r" |
22 |
23 |
23 NSLIM :: "[real=>real,real,real] => bool" |
24 NSLIM :: "[real=>real,real,real] => bool" |
24 ("((_)/ -- (_)/ --NS> (_))" [60, 0, 60] 60) |
25 ("((_)/ -- (_)/ --NS> (_))" [60, 0, 60] 60) |
25 "f -- a --NS> L == (\<forall>x. (x \<noteq> hypreal_of_real a & |
26 "f -- a --NS> L == (\<forall>x. (x \<noteq> hypreal_of_real a & |
26 x @= hypreal_of_real a --> |
27 x @= hypreal_of_real a --> |
27 ( *f* f) x @= hypreal_of_real L))" |
28 ( *f* f) x @= hypreal_of_real L))" |
28 |
29 |
29 isCont :: "[real=>real,real] => bool" |
30 isCont :: "[real=>real,real] => bool" |
30 "isCont f a == (f -- a --> (f a))" |
31 "isCont f a == (f -- a --> (f a))" |
31 |
32 |
32 isNSCont :: "[real=>real,real] => bool" |
33 isNSCont :: "[real=>real,real] => bool" |
33 --{*NS definition dispenses with limit notions*} |
34 --{*NS definition dispenses with limit notions*} |
34 "isNSCont f a == (\<forall>y. y @= hypreal_of_real a --> |
35 "isNSCont f a == (\<forall>y. y @= hypreal_of_real a --> |
35 ( *f* f) y @= hypreal_of_real (f a))" |
36 ( *f* f) y @= hypreal_of_real (f a))" |
36 |
37 |
37 deriv:: "[real=>real,real,real] => bool" |
38 deriv:: "[real=>real,real,real] => bool" |
38 --{*Differentiation: D is derivative of function f at x*} |
39 --{*Differentiation: D is derivative of function f at x*} |
39 ("(DERIV (_)/ (_)/ :> (_))" [1000, 1000, 60] 60) |
40 ("(DERIV (_)/ (_)/ :> (_))" [1000, 1000, 60] 60) |
40 "DERIV f x :> D == ((%h. (f(x + h) + -f x)/h) -- 0 --> D)" |
41 "DERIV f x :> D == ((%h. (f(x + h) + -f x)/h) -- 0 --> D)" |
41 |
42 |
42 nsderiv :: "[real=>real,real,real] => bool" |
43 nsderiv :: "[real=>real,real,real] => bool" |
43 ("(NSDERIV (_)/ (_)/ :> (_))" [1000, 1000, 60] 60) |
44 ("(NSDERIV (_)/ (_)/ :> (_))" [1000, 1000, 60] 60) |
44 "NSDERIV f x :> D == (\<forall>h \<in> Infinitesimal - {0}. |
45 "NSDERIV f x :> D == (\<forall>h \<in> Infinitesimal - {0}. |
45 (( *f* f)(hypreal_of_real x + h) + |
46 (( *f* f)(hypreal_of_real x + h) + |
46 - hypreal_of_real (f x))/h @= hypreal_of_real D)" |
47 - hypreal_of_real (f x))/h @= hypreal_of_real D)" |
47 |
48 |
48 differentiable :: "[real=>real,real] => bool" (infixl "differentiable" 60) |
49 differentiable :: "[real=>real,real] => bool" (infixl "differentiable" 60) |
49 "f differentiable x == (\<exists>D. DERIV f x :> D)" |
50 "f differentiable x == (\<exists>D. DERIV f x :> D)" |
50 |
51 |
51 NSdifferentiable :: "[real=>real,real] => bool" |
52 NSdifferentiable :: "[real=>real,real] => bool" |
52 (infixl "NSdifferentiable" 60) |
53 (infixl "NSdifferentiable" 60) |
53 "f NSdifferentiable x == (\<exists>D. NSDERIV f x :> D)" |
54 "f NSdifferentiable x == (\<exists>D. NSDERIV f x :> D)" |
54 |
55 |
55 increment :: "[real=>real,real,hypreal] => hypreal" |
56 increment :: "[real=>real,real,hypreal] => hypreal" |
56 "increment f x h == (@inc. f NSdifferentiable x & |
57 "increment f x h == (@inc. f NSdifferentiable x & |
57 inc = ( *f* f)(hypreal_of_real x + h) + -hypreal_of_real (f x))" |
58 inc = ( *f* f)(hypreal_of_real x + h) + -hypreal_of_real (f x))" |
58 |
59 |
59 isUCont :: "(real=>real) => bool" |
60 isUCont :: "(real=>real) => bool" |
60 "isUCont f == \<forall>r > 0. \<exists>s > 0. \<forall>x y. \<bar>x + -y\<bar> < s --> \<bar>f x + -f y\<bar> < r" |
61 "isUCont f == \<forall>r > 0. \<exists>s > 0. \<forall>x y. \<bar>x + -y\<bar> < s --> \<bar>f x + -f y\<bar> < r" |
61 |
62 |
62 isNSUCont :: "(real=>real) => bool" |
63 isNSUCont :: "(real=>real) => bool" |
2057 show "\<bar>g (f x + z) - g (f x)\<bar> < r" by force |
2058 show "\<bar>g (f x + z) - g (f x)\<bar> < r" by force |
2058 qed |
2059 qed |
2059 qed |
2060 qed |
2060 qed |
2061 qed |
2061 qed |
2062 qed |
|
2063 |
|
2064 |
|
2065 lemma differentiable_const: "(\<lambda>z. a) differentiable x" |
|
2066 apply (unfold differentiable_def) |
|
2067 apply (rule_tac x=0 in exI) |
|
2068 apply simp |
|
2069 done |
|
2070 |
|
2071 lemma differentiable_sum: |
|
2072 assumes "f differentiable x" |
|
2073 and "g differentiable x" |
|
2074 shows "(\<lambda>x. f x + g x) differentiable x" |
|
2075 proof - |
|
2076 from prems have "\<exists>D. DERIV f x :> D" by (unfold differentiable_def) |
|
2077 then obtain df where "DERIV f x :> df" .. |
|
2078 moreover from prems have "\<exists>D. DERIV g x :> D" by (unfold differentiable_def) |
|
2079 then obtain dg where "DERIV g x :> dg" .. |
|
2080 ultimately have "DERIV (\<lambda>x. f x + g x) x :> df + dg" by (rule DERIV_add) |
|
2081 hence "\<exists>D. DERIV (\<lambda>x. f x + g x) x :> D" by auto |
|
2082 thus ?thesis by (fold differentiable_def) |
|
2083 qed |
|
2084 |
|
2085 lemma differentiable_diff: |
|
2086 assumes "f differentiable x" |
|
2087 and "g differentiable x" |
|
2088 shows "(\<lambda>x. f x - g x) differentiable x" |
|
2089 proof - |
|
2090 from prems have "f differentiable x" by simp |
|
2091 moreover |
|
2092 from prems have "\<exists>D. DERIV g x :> D" by (unfold differentiable_def) |
|
2093 then obtain dg where "DERIV g x :> dg" .. |
|
2094 then have "DERIV (\<lambda>x. - g x) x :> -dg" by (rule DERIV_minus) |
|
2095 hence "\<exists>D. DERIV (\<lambda>x. - g x) x :> D" by auto |
|
2096 hence "(\<lambda>x. - g x) differentiable x" by (fold differentiable_def) |
|
2097 ultimately |
|
2098 show ?thesis |
|
2099 by (auto simp: real_diff_def dest: differentiable_sum) |
|
2100 qed |
|
2101 |
|
2102 lemma differentiable_mult: |
|
2103 assumes "f differentiable x" |
|
2104 and "g differentiable x" |
|
2105 shows "(\<lambda>x. f x * g x) differentiable x" |
|
2106 proof - |
|
2107 from prems have "\<exists>D. DERIV f x :> D" by (unfold differentiable_def) |
|
2108 then obtain df where "DERIV f x :> df" .. |
|
2109 moreover from prems have "\<exists>D. DERIV g x :> D" by (unfold differentiable_def) |
|
2110 then obtain dg where "DERIV g x :> dg" .. |
|
2111 ultimately have "DERIV (\<lambda>x. f x * g x) x :> df * g x + dg * f x" by (simp add: DERIV_mult) |
|
2112 hence "\<exists>D. DERIV (\<lambda>x. f x * g x) x :> D" by auto |
|
2113 thus ?thesis by (fold differentiable_def) |
|
2114 qed |
|
2115 |
|
2116 |
|
2117 theorem GMVT: |
|
2118 assumes alb: "a < b" |
|
2119 and fc: "\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x" |
|
2120 and fd: "\<forall>x. a < x \<and> x < b \<longrightarrow> f differentiable x" |
|
2121 and gc: "\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont g x" |
|
2122 and gd: "\<forall>x. a < x \<and> x < b \<longrightarrow> g differentiable x" |
|
2123 shows "\<exists>g'c f'c c. DERIV g c :> g'c \<and> DERIV f c :> f'c \<and> a < c \<and> c < b \<and> ((f b - f a) * g'c) = ((g b - g a) * f'c)" |
|
2124 proof - |
|
2125 let ?h = "\<lambda>x. (f b - f a)*(g x) - (g b - g a)*(f x)" |
|
2126 from prems have "a < b" by simp |
|
2127 moreover have "\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont ?h x" |
|
2128 proof - |
|
2129 have "\<forall>x. a <= x \<and> x <= b \<longrightarrow> isCont (\<lambda>x. f b - f a) x" by simp |
|
2130 with gc have "\<forall>x. a <= x \<and> x <= b \<longrightarrow> isCont (\<lambda>x. (f b - f a) * g x) x" |
|
2131 by (auto intro: isCont_mult) |
|
2132 moreover |
|
2133 have "\<forall>x. a <= x \<and> x <= b \<longrightarrow> isCont (\<lambda>x. g b - g a) x" by simp |
|
2134 with fc have "\<forall>x. a <= x \<and> x <= b \<longrightarrow> isCont (\<lambda>x. (g b - g a) * f x) x" |
|
2135 by (auto intro: isCont_mult) |
|
2136 ultimately show ?thesis |
|
2137 by (fastsimp intro: isCont_diff) |
|
2138 qed |
|
2139 moreover |
|
2140 have "\<forall>x. a < x \<and> x < b \<longrightarrow> ?h differentiable x" |
|
2141 proof - |
|
2142 have "\<forall>x. a < x \<and> x < b \<longrightarrow> (\<lambda>x. f b - f a) differentiable x" by (simp add: differentiable_const) |
|
2143 with gd have "\<forall>x. a < x \<and> x < b \<longrightarrow> (\<lambda>x. (f b - f a) * g x) differentiable x" by (simp add: differentiable_mult) |
|
2144 moreover |
|
2145 have "\<forall>x. a < x \<and> x < b \<longrightarrow> (\<lambda>x. g b - g a) differentiable x" by (simp add: differentiable_const) |
|
2146 with fd have "\<forall>x. a < x \<and> x < b \<longrightarrow> (\<lambda>x. (g b - g a) * f x) differentiable x" by (simp add: differentiable_mult) |
|
2147 ultimately show ?thesis by (simp add: differentiable_diff) |
|
2148 qed |
|
2149 ultimately have "\<exists>l z. a < z \<and> z < b \<and> DERIV ?h z :> l \<and> ?h b - ?h a = (b - a) * l" by (rule MVT) |
|
2150 then obtain l where ldef: "\<exists>z. a < z \<and> z < b \<and> DERIV ?h z :> l \<and> ?h b - ?h a = (b - a) * l" .. |
|
2151 then obtain c where cdef: "a < c \<and> c < b \<and> DERIV ?h c :> l \<and> ?h b - ?h a = (b - a) * l" .. |
|
2152 |
|
2153 from cdef have cint: "a < c \<and> c < b" by auto |
|
2154 with gd have "g differentiable c" by simp |
|
2155 hence "\<exists>D. DERIV g c :> D" by (rule differentiableD) |
|
2156 then obtain g'c where g'cdef: "DERIV g c :> g'c" .. |
|
2157 |
|
2158 from cdef have "a < c \<and> c < b" by auto |
|
2159 with fd have "f differentiable c" by simp |
|
2160 hence "\<exists>D. DERIV f c :> D" by (rule differentiableD) |
|
2161 then obtain f'c where f'cdef: "DERIV f c :> f'c" .. |
|
2162 |
|
2163 from cdef have "DERIV ?h c :> l" by auto |
|
2164 moreover |
|
2165 { |
|
2166 from g'cdef have "DERIV (\<lambda>x. (f b - f a) * g x) c :> g'c * (f b - f a)" |
|
2167 apply (insert DERIV_const [where k="f b - f a"]) |
|
2168 apply (drule meta_spec [of _ c]) |
|
2169 apply (drule DERIV_mult [where f="(\<lambda>x. f b - f a)" and g=g]) |
|
2170 by simp_all |
|
2171 moreover from f'cdef have "DERIV (\<lambda>x. (g b - g a) * f x) c :> f'c * (g b - g a)" |
|
2172 apply (insert DERIV_const [where k="g b - g a"]) |
|
2173 apply (drule meta_spec [of _ c]) |
|
2174 apply (drule DERIV_mult [where f="(\<lambda>x. g b - g a)" and g=f]) |
|
2175 by simp_all |
|
2176 ultimately have "DERIV ?h c :> g'c * (f b - f a) - f'c * (g b - g a)" |
|
2177 by (simp add: DERIV_diff) |
|
2178 } |
|
2179 ultimately have leq: "l = g'c * (f b - f a) - f'c * (g b - g a)" by (rule DERIV_unique) |
|
2180 |
|
2181 { |
|
2182 from cdef have "?h b - ?h a = (b - a) * l" by auto |
|
2183 also with leq have "\<dots> = (b - a) * (g'c * (f b - f a) - f'c * (g b - g a))" by simp |
|
2184 finally have "?h b - ?h a = (b - a) * (g'c * (f b - f a) - f'c * (g b - g a))" by simp |
|
2185 } |
|
2186 moreover |
|
2187 { |
|
2188 have "?h b - ?h a = |
|
2189 ((f b)*(g b) - (f a)*(g b) - (g b)*(f b) + (g a)*(f b)) - |
|
2190 ((f b)*(g a) - (f a)*(g a) - (g b)*(f a) + (g a)*(f a))" |
|
2191 by (simp add: mult_ac add_ac real_diff_mult_distrib) |
|
2192 hence "?h b - ?h a = 0" by auto |
|
2193 } |
|
2194 ultimately have "(b - a) * (g'c * (f b - f a) - f'c * (g b - g a)) = 0" by auto |
|
2195 with alb have "g'c * (f b - f a) - f'c * (g b - g a) = 0" by simp |
|
2196 hence "g'c * (f b - f a) = f'c * (g b - g a)" by simp |
|
2197 hence "(f b - f a) * g'c = (g b - g a) * f'c" by (simp add: mult_ac) |
|
2198 |
|
2199 with g'cdef f'cdef cint show ?thesis by auto |
|
2200 qed |
|
2201 |
|
2202 |
|
2203 lemma LIMSEQ_SEQ_conv1: |
|
2204 assumes "X -- a --> L" |
|
2205 shows "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" |
|
2206 proof - |
|
2207 { |
|
2208 from prems have Xdef: "\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & \<bar>x + -a\<bar> < s --> \<bar>X x + -L\<bar> < r" by (unfold LIM_def) |
|
2209 |
|
2210 fix S |
|
2211 assume as: "(\<forall>n. S n \<noteq> a) \<and> S ----> a" |
|
2212 then have "S ----> a" by auto |
|
2213 then have Sdef: "(\<forall>r. 0 < r --> (\<exists>no. \<forall>n. no \<le> n --> \<bar>S n + -a\<bar> < r))" by (unfold LIMSEQ_def) |
|
2214 { |
|
2215 fix r |
|
2216 from Xdef have Xdef2: "0 < r --> (\<exists>s > 0. \<forall>x. x \<noteq> a \<and> \<bar>x + -a\<bar> < s --> \<bar>X x + -L\<bar> < r)" by simp |
|
2217 { |
|
2218 assume rgz: "0 < r" |
|
2219 |
|
2220 from Xdef2 rgz have "\<exists>s > 0. \<forall>x. x \<noteq> a \<and> \<bar>x + -a\<bar> < s --> \<bar>X x + -L\<bar> < r" by simp |
|
2221 then obtain s where sdef: "s > 0 \<and> (\<forall>x. x\<noteq>a \<and> \<bar>x + -a\<bar> < s \<longrightarrow> \<bar>X x + -L\<bar> < r)" by auto |
|
2222 then have aux: "\<forall>x. x\<noteq>a \<and> \<bar>x + -a\<bar> < s \<longrightarrow> \<bar>X x + -L\<bar> < r" by auto |
|
2223 { |
|
2224 fix n |
|
2225 from aux have "S n \<noteq> a \<and> \<bar>S n + -a\<bar> < s \<longrightarrow> \<bar>X (S n) + -L\<bar> < r" by simp |
|
2226 with as have imp2: "\<bar>S n + -a\<bar> < s --> \<bar>X (S n) + -L\<bar> < r" by auto |
|
2227 } |
|
2228 hence "\<forall>n. \<bar>S n + -a\<bar> < s --> \<bar>X (S n) + -L\<bar> < r" .. |
|
2229 moreover |
|
2230 from Sdef sdef have imp1: "\<exists>no. \<forall>n. no \<le> n --> \<bar>S n + -a\<bar> < s" by auto |
|
2231 then obtain no where "\<forall>n. no \<le> n --> \<bar>S n + -a\<bar> < s" by auto |
|
2232 ultimately have "\<forall>n. no \<le> n \<longrightarrow> \<bar>X (S n) + -L\<bar> < r" by simp |
|
2233 hence "\<exists>no. \<forall>n. no \<le> n \<longrightarrow> \<bar>X (S n) + -L\<bar> < r" by auto |
|
2234 } |
|
2235 } |
|
2236 hence "(\<forall>r. 0 < r --> (\<exists>no. \<forall>n. no \<le> n --> \<bar>X (S n) + -L\<bar> < r))" by simp |
|
2237 hence "(\<lambda>n. X (S n)) ----> L" by (fold LIMSEQ_def) |
|
2238 } |
|
2239 thus ?thesis by simp |
|
2240 qed |
|
2241 |
|
2242 lemma LIMSEQ_SEQ_conv2: |
|
2243 assumes "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" |
|
2244 shows "X -- a --> L" |
|
2245 proof (rule ccontr) |
|
2246 assume "\<not> (X -- a --> L)" |
|
2247 hence "\<not> (\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & \<bar>x + -a\<bar> < s --> \<bar>X x + -L\<bar> < r)" by (unfold LIM_def) |
|
2248 hence "\<exists>r > 0. \<forall>s > 0. \<exists>x. \<not>(x \<noteq> a \<and> \<bar>x + -a\<bar> < s --> \<bar>X x + -L\<bar> < r)" by simp |
|
2249 hence "\<exists>r > 0. \<forall>s > 0. \<exists>x. (x \<noteq> a \<and> \<bar>x + -a\<bar> < s \<and> \<bar>X x + -L\<bar> \<ge> r)" by (simp add: linorder_not_less) |
|
2250 then obtain r where rdef: "r > 0 \<and> (\<forall>s > 0. \<exists>x. (x \<noteq> a \<and> \<bar>x + -a\<bar> < s \<and> \<bar>X x + -L\<bar> \<ge> r))" by auto |
|
2251 |
|
2252 let ?F = "\<lambda>n::nat. SOME x. x\<noteq>a \<and> \<bar>x + -a\<bar> < inverse (real (Suc n)) \<and> \<bar>X x + -L\<bar> \<ge> r" |
|
2253 have "?F ----> a" |
|
2254 proof - |
|
2255 { |
|
2256 fix e::real |
|
2257 assume "0 < e" |
|
2258 (* choose no such that inverse (real (Suc n)) < e *) |
|
2259 have "\<exists>no. inverse (real (Suc no)) < e" by (rule reals_Archimedean) |
|
2260 then obtain m where nodef: "inverse (real (Suc m)) < e" by auto |
|
2261 { |
|
2262 fix n |
|
2263 assume mlen: "m \<le> n" |
|
2264 then have |
|
2265 "inverse (real (Suc n)) \<le> inverse (real (Suc m))" |
|
2266 by auto |
|
2267 moreover have |
|
2268 "\<bar>?F n + -a\<bar> < inverse (real (Suc n))" |
|
2269 proof - |
|
2270 from rdef have |
|
2271 "\<exists>x. x\<noteq>a \<and> \<bar>x + -a\<bar> < inverse (real (Suc n)) \<and> \<bar>X x + -L\<bar> \<ge> r" |
|
2272 by simp |
|
2273 hence |
|
2274 "(?F n)\<noteq>a \<and> \<bar>(?F n) + -a\<bar> < inverse (real (Suc n)) \<and> \<bar>X (?F n) + -L\<bar> \<ge> r" |
|
2275 by (simp add: some_eq_ex [symmetric]) |
|
2276 thus ?thesis by simp |
|
2277 qed |
|
2278 moreover from nodef have |
|
2279 "inverse (real (Suc m)) < e" . |
|
2280 ultimately have "\<bar>?F n + -a\<bar> < e" by arith |
|
2281 } |
|
2282 then have "\<exists>no. \<forall>n. no \<le> n --> \<bar>?F n + -a\<bar> < e" by auto |
|
2283 } |
|
2284 thus ?thesis by (unfold LIMSEQ_def, simp) |
|
2285 qed |
|
2286 |
|
2287 moreover have "\<forall>n. ?F n \<noteq> a" |
|
2288 proof - |
|
2289 { |
|
2290 fix n |
|
2291 from rdef have |
|
2292 "\<exists>x. x\<noteq>a \<and> \<bar>x + -a\<bar> < inverse (real (Suc n)) \<and> \<bar>X x + -L\<bar> \<ge> r" |
|
2293 by simp |
|
2294 hence "?F n \<noteq> a" by (simp add: some_eq_ex [symmetric]) |
|
2295 } |
|
2296 thus ?thesis .. |
|
2297 qed |
|
2298 moreover from prems have "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" by simp |
|
2299 ultimately have "(\<lambda>n. X (?F n)) ----> L" by simp |
|
2300 |
|
2301 moreover have "\<not> ((\<lambda>n. X (?F n)) ----> L)" |
|
2302 proof - |
|
2303 { |
|
2304 fix no::nat |
|
2305 obtain n where "n = no + 1" by simp |
|
2306 then have nolen: "no \<le> n" by simp |
|
2307 (* We prove this by showing that for any m there is an n\<ge>m such that |X (?F n) - L| \<ge> r *) |
|
2308 from rdef have "\<forall>s > 0. \<exists>x. (x \<noteq> a \<and> \<bar>x + -a\<bar> < s \<and> \<bar>X x + -L\<bar> \<ge> r)" .. |
|
2309 |
|
2310 then have "\<exists>x. x\<noteq>a \<and> \<bar>x + -a\<bar> < inverse (real (Suc n)) \<and> \<bar>X x + -L\<bar> \<ge> r" by simp |
|
2311 |
|
2312 hence "\<bar>X (?F n) + -L\<bar> \<ge> r" by (simp add: some_eq_ex [symmetric]) |
|
2313 with nolen have "\<exists>n. no \<le> n \<and> \<bar>X (?F n) + -L\<bar> \<ge> r" by auto |
|
2314 } |
|
2315 then have "(\<forall>no. \<exists>n. no \<le> n \<and> \<bar>X (?F n) + -L\<bar> \<ge> r)" by simp |
|
2316 with rdef have "\<exists>e>0. (\<forall>no. \<exists>n. no \<le> n \<and> \<bar>X (?F n) + -L\<bar> \<ge> e)" by auto |
|
2317 thus ?thesis by (unfold LIMSEQ_def, auto simp add: linorder_not_less) |
|
2318 qed |
|
2319 ultimately show False by simp |
|
2320 qed |
|
2321 |
|
2322 |
|
2323 lemma LIMSEQ_SEQ_conv: |
|
2324 "(\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L) = (X -- a --> L)" |
|
2325 proof |
|
2326 assume "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" |
|
2327 show "X -- a --> L" by (rule LIMSEQ_SEQ_conv2) |
|
2328 next |
|
2329 assume "(X -- a --> L)" |
|
2330 show "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" by (rule LIMSEQ_SEQ_conv1) |
|
2331 qed |
|
2332 |
|
2333 lemma real_sqz: |
|
2334 fixes a::real |
|
2335 assumes "a < c" |
|
2336 shows "\<exists>b. a < b \<and> b < c" |
|
2337 proof |
|
2338 let ?b = "(a + c) / 2" |
|
2339 have "a < ?b" by simp |
|
2340 moreover |
|
2341 have "?b < c" by simp |
|
2342 ultimately |
|
2343 show "a < ?b \<and> ?b < c" by simp |
|
2344 qed |
|
2345 |
|
2346 lemma LIM_offset: |
|
2347 assumes "(\<lambda>x. f x) -- a --> L" |
|
2348 shows "(\<lambda>x. f (x+c)) -- (a-c) --> L" |
|
2349 proof - |
|
2350 have "f -- a --> L" . |
|
2351 hence |
|
2352 fd: "\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & \<bar>x + -a\<bar> < s --> \<bar>f x + -L\<bar> < r" |
|
2353 by (unfold LIM_def) |
|
2354 { |
|
2355 fix r::real |
|
2356 assume rgz: "0 < r" |
|
2357 with fd have "\<exists>s > 0. \<forall>x. x\<noteq>a \<and> \<bar>x + -a\<bar> < s --> \<bar>f x + -L\<bar> < r" by simp |
|
2358 then obtain s where sgz: "s > 0" and ax: "\<forall>x. x\<noteq>a \<and> \<bar>x + -a\<bar> < s \<longrightarrow> \<bar>f x + -L\<bar> < r" by auto |
|
2359 from ax have ax2: "\<forall>x. (x+c)\<noteq>a \<and> \<bar>(x+c) + -a\<bar> < s \<longrightarrow> \<bar>f (x+c) + -L\<bar> < r" by auto |
|
2360 { |
|
2361 fix x::real |
|
2362 from ax2 have nt: "(x+c)\<noteq>a \<and> \<bar>(x+c) + -a\<bar> < s \<longrightarrow> \<bar>f (x+c) + -L\<bar> < r" .. |
|
2363 moreover have "((x+c)\<noteq>a) = (x\<noteq>(a-c))" by auto |
|
2364 moreover have "((x+c) + -a) = (x + -(a-c))" by simp |
|
2365 ultimately have "x\<noteq>(a-c) \<and> \<bar>x + -(a-c)\<bar> < s \<longrightarrow> \<bar>f (x+c) + -L\<bar> < r" by simp |
|
2366 } |
|
2367 then have "\<forall>x. x\<noteq>(a-c) \<and> \<bar>x + -(a-c)\<bar> < s \<longrightarrow> \<bar>f (x+c) + -L\<bar> < r" .. |
|
2368 with sgz have "\<exists>s > 0. \<forall>x. x\<noteq>(a-c) \<and> \<bar>x + -(a-c)\<bar> < s \<longrightarrow> \<bar>f (x+c) + -L\<bar> < r" by auto |
|
2369 } |
|
2370 then have |
|
2371 "\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> (a-c) & \<bar>x + -(a-c)\<bar> < s --> \<bar>f (x+c) + -L\<bar> < r" by simp |
|
2372 thus ?thesis by (fold LIM_def) |
|
2373 qed |
|
2374 |
|
2375 |
2062 |
2376 |
2063 ML |
2377 ML |
2064 {* |
2378 {* |
2065 val LIM_def = thm"LIM_def"; |
2379 val LIM_def = thm"LIM_def"; |
2066 val NSLIM_def = thm"NSLIM_def"; |
2380 val NSLIM_def = thm"NSLIM_def"; |