src/HOL/Library/Topology_Euclidean_Space.thy
changeset 31529 689f5dae1f41
parent 31528 c701f4085ca4
child 31530 e31d63c66f55
equal deleted inserted replaced
31528:c701f4085ca4 31529:689f5dae1f41
  1239 text{* Basic arithmetical combining theorems for limits. *}
  1239 text{* Basic arithmetical combining theorems for limits. *}
  1240 
  1240 
  1241 lemma Lim_linear: fixes f :: "('a \<Rightarrow> real^'n::finite)" and h :: "(real^'n \<Rightarrow> real^'m::finite)"
  1241 lemma Lim_linear: fixes f :: "('a \<Rightarrow> real^'n::finite)" and h :: "(real^'n \<Rightarrow> real^'m::finite)"
  1242   assumes "(f ---> l) net" "linear h"
  1242   assumes "(f ---> l) net" "linear h"
  1243   shows "((\<lambda>x. h (f x)) ---> h l) net"
  1243   shows "((\<lambda>x. h (f x)) ---> h l) net"
  1244 proof -
  1244 using `linear h` `(f ---> l) net`
  1245   obtain b where b: "b>0" "\<forall>x. norm (h x) \<le> b * norm x"
  1245 unfolding linear_conv_bounded_linear
  1246     using assms(2) using linear_bounded_pos[of h] by auto
  1246 by (rule bounded_linear.tendsto)
  1247   { fix e::real assume "e >0"
       
  1248     hence "e/b > 0" using `b>0` by (metis divide_pos_pos)
       
  1249     with `(f ---> l) net` have "eventually (\<lambda>x. dist (f x) l < e/b) net"
       
  1250       by (rule tendstoD)
       
  1251     then have "eventually (\<lambda>x. dist (h (f x)) (h l) < e) net"
       
  1252       apply (rule eventually_rev_mono [rule_format])
       
  1253       apply (simp add: dist_norm linear_sub [OF `linear h`, symmetric])
       
  1254       apply (rule le_less_trans [OF b(2) [rule_format]])
       
  1255       apply (simp add: pos_less_divide_eq `0 < b` mult_commute)
       
  1256       done
       
  1257   }
       
  1258   thus ?thesis unfolding tendsto_iff by simp
       
  1259 qed
       
  1260 
  1247 
  1261 lemma Lim_const: "((\<lambda>x. a) ---> a) net"
  1248 lemma Lim_const: "((\<lambda>x. a) ---> a) net"
  1262   by (rule tendsto_const)
  1249   by (rule tendsto_const)
  1263 
  1250 
  1264 lemma Lim_cmul:
  1251 lemma Lim_cmul:
  1430 lemma tendsto_Lim:
  1417 lemma tendsto_Lim:
  1431   fixes f :: "'a \<Rightarrow> 'b::metric_space"
  1418   fixes f :: "'a \<Rightarrow> 'b::metric_space"
  1432   shows "~(trivial_limit net) \<Longrightarrow> (f ---> l) net ==> Lim net f = l"
  1419   shows "~(trivial_limit net) \<Longrightarrow> (f ---> l) net ==> Lim net f = l"
  1433   unfolding Lim_def using Lim_unique[of net f] by auto
  1420   unfolding Lim_def using Lim_unique[of net f] by auto
  1434 
  1421 
  1435 text{* Limit under bilinear function (surprisingly tedious, but important) *}
  1422 text{* Limit under bilinear function *}
  1436 
       
  1437 lemma norm_bound_lemma:
       
  1438   "0 < e \<Longrightarrow> \<exists>d>0. \<forall>(x'::real^'b::finite) y'::real^'a::finite. norm(x' - (x::real^'b)) < d \<and> norm(y' - y) < d \<longrightarrow> norm(x') * norm(y' - y) + norm(x' - x) * norm(y) < e"
       
  1439 proof-
       
  1440   assume e: "0 < e"
       
  1441   have th1: "(2 * norm x + 2 * norm y + 2) > 0" using norm_ge_zero[of x] norm_ge_zero[of y] by norm
       
  1442   hence th0: "0 < e / (2 * norm x + 2 * norm y + 2)"  using `e>0` using divide_pos_pos by auto
       
  1443   moreover
       
  1444   { fix x' y'
       
  1445     assume h: "norm (x' - x) < 1" "norm (x' - x) < e / (2 * norm x + 2 * norm y + 2)"
       
  1446       "norm (y' - y) < 1" "norm (y' - y) < e / (2 * norm x + 2 * norm y + 2)"
       
  1447     have th: "\<And>a b (c::real). a \<ge> 0 \<Longrightarrow> c \<ge> 0 \<Longrightarrow> a + (b + c) < e ==> b < e " by arith
       
  1448     from h have thx: "norm (x' - x) * norm y < e / 2"
       
  1449       using th0 th1 apply (simp add: field_simps)
       
  1450       apply (rule th) defer defer apply assumption
       
  1451       by (simp_all add: norm_ge_zero zero_le_mult_iff)
       
  1452 
       
  1453     have "norm x' - norm x < 1" apply(rule le_less_trans)
       
  1454       using h(1) using norm_triangle_ineq2[of x' x] by auto
       
  1455     hence *:"norm x' < 1 + norm x"  by auto
       
  1456 
       
  1457     have thy: "norm (y' - y) * norm x' < e / (2 * norm x + 2 * norm y + 2) * (1 + norm x)"
       
  1458       using mult_strict_mono'[OF h(4) * norm_ge_zero norm_ge_zero] by auto
       
  1459     also have "\<dots> \<le> e/2" apply simp unfolding divide_le_eq
       
  1460       using th1 th0 `e>0` by auto
       
  1461 
       
  1462     finally have "norm x' * norm (y' - y) + norm (x' - x) * norm y < e"
       
  1463       using thx and e by (simp add: field_simps)  }
       
  1464   ultimately show ?thesis apply(rule_tac x="min 1 (e / 2 / (norm x + norm y + 1))" in exI) by auto
       
  1465 qed
       
  1466 
  1423 
  1467 lemma Lim_bilinear:
  1424 lemma Lim_bilinear:
  1468   fixes net :: "'a net" and h:: "real ^'m::finite \<Rightarrow> real ^'n::finite \<Rightarrow> real ^'p::finite"
  1425   fixes net :: "'a net" and h:: "real ^'m::finite \<Rightarrow> real ^'n::finite \<Rightarrow> real ^'p::finite"
  1469   assumes "(f ---> l) net" and "(g ---> m) net" and "bilinear h"
  1426   assumes "(f ---> l) net" and "(g ---> m) net" and "bilinear h"
  1470   shows "((\<lambda>x. h (f x) (g x)) ---> (h l m)) net"
  1427   shows "((\<lambda>x. h (f x) (g x)) ---> (h l m)) net"
  1471 proof -
  1428 using `bilinear h` `(f ---> l) net` `(g ---> m) net`
  1472   obtain B where "B>0" and B:"\<forall>x y. norm (h x y) \<le> B * norm x * norm y" using bilinear_bounded_pos[OF assms(3)] by auto
  1429 unfolding bilinear_conv_bounded_bilinear
  1473   { fix e::real assume "e>0"
  1430 by (rule bounded_bilinear.tendsto)
  1474     obtain d where "d>0" and d:"\<forall>x' y'. norm (x' - l) < d \<and> norm (y' - m) < d \<longrightarrow> norm x' * norm (y' - m) + norm (x' - l) * norm m < e / B" using `B>0` `e>0`
       
  1475       using norm_bound_lemma[of "e / B" l m] using divide_pos_pos by auto
       
  1476 
       
  1477     have *:"\<And>x y. h (f x) (g x) - h l m = h (f x) (g x - m) + h (f x - l) m"
       
  1478       unfolding bilinear_rsub[OF assms(3)]
       
  1479       unfolding bilinear_lsub[OF assms(3)] by auto
       
  1480 
       
  1481     have "eventually (\<lambda>x. dist (f x) l < d) net"
       
  1482       using assms(1) `d>0` by (rule tendstoD)
       
  1483     moreover
       
  1484     have "eventually (\<lambda>x. dist (g x) m < d) net"
       
  1485       using assms(2) `d>0` by (rule tendstoD)
       
  1486     ultimately
       
  1487     have "eventually (\<lambda>x. dist (f x) l < d \<and> dist (g x) m < d) net"
       
  1488       by (rule eventually_conjI)
       
  1489     moreover
       
  1490     { fix x assume "dist (f x) l < d \<and> dist (g x) m < d"
       
  1491       hence **:"norm (f x) * norm (g x - m) + norm (f x - l) * norm m < e / B"
       
  1492 	using d[THEN spec[where x="f x"], THEN spec[where x="g x"]] unfolding dist_norm  by auto
       
  1493       have "norm (h (f x) (g x - m)) + norm (h (f x - l) m) \<le> B * norm (f x) * norm (g x - m) + B * norm (f x - l) * norm m"
       
  1494 	using B[THEN spec[where x="f x"], THEN spec[where x="g x - m"]]
       
  1495 	using B[THEN spec[where x="f x - l"], THEN spec[where x="m"]] by auto
       
  1496       also have "\<dots> < e" using ** and `B>0` by(auto simp add: field_simps)
       
  1497       finally have "dist (h (f x) (g x)) (h l m) < e" unfolding dist_norm and * using norm_triangle_lt by auto
       
  1498     }
       
  1499     ultimately have "eventually (\<lambda>x. dist (h (f x) (g x)) (h l m) < e) net"
       
  1500       by (auto elim: eventually_rev_mono)
       
  1501   }
       
  1502   thus "((\<lambda>x. h (f x) (g x)) ---> h l m) net"
       
  1503     unfolding tendsto_iff by simp
       
  1504 qed
       
  1505 
  1431 
  1506 text{* These are special for limits out of the same vector space. *}
  1432 text{* These are special for limits out of the same vector space. *}
  1507 
  1433 
  1508 lemma Lim_within_id: "(id ---> a) (at a within s)"
  1434 lemma Lim_within_id: "(id ---> a) (at a within s)"
  1509   unfolding tendsto_def Limits.eventually_within eventually_at_topological
  1435   unfolding tendsto_def Limits.eventually_within eventually_at_topological