src/HOL/Limits.thy
 author huffman Sat May 01 11:46:47 2010 -0700 (2010-05-01) changeset 36630 aa1f8acdcc1c parent 36629 de62713aec6e child 36654 7c8eb32724ce permissions -rw-r--r--
complete_lattice instance for net type
 huffman@31349 ` 1` ```(* Title : Limits.thy ``` huffman@31349 ` 2` ``` Author : Brian Huffman ``` huffman@31349 ` 3` ```*) ``` huffman@31349 ` 4` huffman@31349 ` 5` ```header {* Filters and Limits *} ``` huffman@31349 ` 6` huffman@31349 ` 7` ```theory Limits ``` huffman@31349 ` 8` ```imports RealVector RComplete ``` huffman@31349 ` 9` ```begin ``` huffman@31349 ` 10` huffman@31392 ` 11` ```subsection {* Nets *} ``` huffman@31392 ` 12` huffman@31392 ` 13` ```text {* ``` huffman@36630 ` 14` ``` A net is now defined simply as a filter on a set. ``` huffman@36358 ` 15` ``` The definition also allows non-proper filters. ``` huffman@31392 ` 16` ```*} ``` huffman@31392 ` 17` huffman@36358 ` 18` ```locale is_filter = ``` huffman@36358 ` 19` ``` fixes net :: "('a \ bool) \ bool" ``` huffman@36358 ` 20` ``` assumes True: "net (\x. True)" ``` huffman@36358 ` 21` ``` assumes conj: "net (\x. P x) \ net (\x. Q x) \ net (\x. P x \ Q x)" ``` huffman@36358 ` 22` ``` assumes mono: "\x. P x \ Q x \ net (\x. P x) \ net (\x. Q x)" ``` huffman@36358 ` 23` huffman@31392 ` 24` ```typedef (open) 'a net = ``` huffman@36358 ` 25` ``` "{net :: ('a \ bool) \ bool. is_filter net}" ``` huffman@31392 ` 26` ```proof ``` huffman@36358 ` 27` ``` show "(\x. True) \ ?net" by (auto intro: is_filter.intro) ``` huffman@31392 ` 28` ```qed ``` huffman@31349 ` 29` huffman@36358 ` 30` ```lemma is_filter_Rep_net: "is_filter (Rep_net net)" ``` huffman@31392 ` 31` ```using Rep_net [of net] by simp ``` huffman@31392 ` 32` huffman@31392 ` 33` ```lemma Abs_net_inverse': ``` huffman@36358 ` 34` ``` assumes "is_filter net" shows "Rep_net (Abs_net net) = net" ``` huffman@31392 ` 35` ```using assms by (simp add: Abs_net_inverse) ``` huffman@31392 ` 36` huffman@31392 ` 37` huffman@31392 ` 38` ```subsection {* Eventually *} ``` huffman@31349 ` 39` huffman@31349 ` 40` ```definition ``` huffman@31392 ` 41` ``` eventually :: "('a \ bool) \ 'a net \ bool" where ``` huffman@36358 ` 42` ``` [code del]: "eventually P net \ Rep_net net P" ``` huffman@36358 ` 43` huffman@36358 ` 44` ```lemma eventually_Abs_net: ``` huffman@36358 ` 45` ``` assumes "is_filter net" shows "eventually P (Abs_net net) = net P" ``` huffman@36358 ` 46` ```unfolding eventually_def using assms by (simp add: Abs_net_inverse) ``` huffman@31349 ` 47` huffman@36360 ` 48` ```lemma expand_net_eq: ``` huffman@36360 ` 49` ``` shows "net = net' \ (\P. eventually P net = eventually P net')" ``` huffman@36360 ` 50` ```unfolding Rep_net_inject [symmetric] expand_fun_eq eventually_def .. ``` huffman@36360 ` 51` huffman@31392 ` 52` ```lemma eventually_True [simp]: "eventually (\x. True) net" ``` huffman@36358 ` 53` ```unfolding eventually_def ``` huffman@36358 ` 54` ```by (rule is_filter.True [OF is_filter_Rep_net]) ``` huffman@31349 ` 55` huffman@36630 ` 56` ```lemma always_eventually: "\x. P x \ eventually P net" ``` huffman@36630 ` 57` ```proof - ``` huffman@36630 ` 58` ``` assume "\x. P x" hence "P = (\x. True)" by (simp add: ext) ``` huffman@36630 ` 59` ``` thus "eventually P net" by simp ``` huffman@36630 ` 60` ```qed ``` huffman@36630 ` 61` huffman@31349 ` 62` ```lemma eventually_mono: ``` huffman@31392 ` 63` ``` "(\x. P x \ Q x) \ eventually P net \ eventually Q net" ``` huffman@36358 ` 64` ```unfolding eventually_def ``` huffman@36358 ` 65` ```by (rule is_filter.mono [OF is_filter_Rep_net]) ``` huffman@31349 ` 66` huffman@31349 ` 67` ```lemma eventually_conj: ``` huffman@31392 ` 68` ``` assumes P: "eventually (\x. P x) net" ``` huffman@31392 ` 69` ``` assumes Q: "eventually (\x. Q x) net" ``` huffman@31392 ` 70` ``` shows "eventually (\x. P x \ Q x) net" ``` huffman@36358 ` 71` ```using assms unfolding eventually_def ``` huffman@36358 ` 72` ```by (rule is_filter.conj [OF is_filter_Rep_net]) ``` huffman@31349 ` 73` huffman@31349 ` 74` ```lemma eventually_mp: ``` huffman@31392 ` 75` ``` assumes "eventually (\x. P x \ Q x) net" ``` huffman@31392 ` 76` ``` assumes "eventually (\x. P x) net" ``` huffman@31392 ` 77` ``` shows "eventually (\x. Q x) net" ``` huffman@31349 ` 78` ```proof (rule eventually_mono) ``` huffman@31349 ` 79` ``` show "\x. (P x \ Q x) \ P x \ Q x" by simp ``` huffman@31392 ` 80` ``` show "eventually (\x. (P x \ Q x) \ P x) net" ``` huffman@31349 ` 81` ``` using assms by (rule eventually_conj) ``` huffman@31349 ` 82` ```qed ``` huffman@31349 ` 83` huffman@31349 ` 84` ```lemma eventually_rev_mp: ``` huffman@31392 ` 85` ``` assumes "eventually (\x. P x) net" ``` huffman@31392 ` 86` ``` assumes "eventually (\x. P x \ Q x) net" ``` huffman@31392 ` 87` ``` shows "eventually (\x. Q x) net" ``` huffman@31349 ` 88` ```using assms(2) assms(1) by (rule eventually_mp) ``` huffman@31349 ` 89` huffman@31349 ` 90` ```lemma eventually_conj_iff: ``` huffman@31349 ` 91` ``` "eventually (\x. P x \ Q x) net \ eventually P net \ eventually Q net" ``` huffman@31349 ` 92` ```by (auto intro: eventually_conj elim: eventually_rev_mp) ``` huffman@31349 ` 93` huffman@31349 ` 94` ```lemma eventually_elim1: ``` huffman@31392 ` 95` ``` assumes "eventually (\i. P i) net" ``` huffman@31349 ` 96` ``` assumes "\i. P i \ Q i" ``` huffman@31392 ` 97` ``` shows "eventually (\i. Q i) net" ``` huffman@31349 ` 98` ```using assms by (auto elim!: eventually_rev_mp) ``` huffman@31349 ` 99` huffman@31349 ` 100` ```lemma eventually_elim2: ``` huffman@31392 ` 101` ``` assumes "eventually (\i. P i) net" ``` huffman@31392 ` 102` ``` assumes "eventually (\i. Q i) net" ``` huffman@31349 ` 103` ``` assumes "\i. P i \ Q i \ R i" ``` huffman@31392 ` 104` ``` shows "eventually (\i. R i) net" ``` huffman@31349 ` 105` ```using assms by (auto elim!: eventually_rev_mp) ``` huffman@31349 ` 106` huffman@31349 ` 107` huffman@36360 ` 108` ```subsection {* Finer-than relation *} ``` huffman@36360 ` 109` huffman@36629 ` 110` ```text {* @{term "net \ net'"} means that @{term net} is finer than ``` huffman@36629 ` 111` ```@{term net'}. *} ``` huffman@36360 ` 112` huffman@36630 ` 113` ```instantiation net :: (type) complete_lattice ``` huffman@36360 ` 114` ```begin ``` huffman@36360 ` 115` huffman@36360 ` 116` ```definition ``` huffman@36360 ` 117` ``` le_net_def [code del]: ``` huffman@36629 ` 118` ``` "net \ net' \ (\P. eventually P net' \ eventually P net)" ``` huffman@36360 ` 119` huffman@36360 ` 120` ```definition ``` huffman@36360 ` 121` ``` less_net_def [code del]: ``` huffman@36360 ` 122` ``` "(net :: 'a net) < net' \ net \ net' \ \ net' \ net" ``` huffman@36360 ` 123` huffman@36360 ` 124` ```definition ``` huffman@36630 ` 125` ``` top_net_def [code del]: ``` huffman@36630 ` 126` ``` "top = Abs_net (\P. \x. P x)" ``` huffman@36630 ` 127` huffman@36630 ` 128` ```definition ``` huffman@36629 ` 129` ``` bot_net_def [code del]: ``` huffman@36629 ` 130` ``` "bot = Abs_net (\P. True)" ``` huffman@36360 ` 131` huffman@36630 ` 132` ```definition ``` huffman@36630 ` 133` ``` sup_net_def [code del]: ``` huffman@36630 ` 134` ``` "sup net net' = Abs_net (\P. eventually P net \ eventually P net')" ``` huffman@36630 ` 135` huffman@36630 ` 136` ```definition ``` huffman@36630 ` 137` ``` inf_net_def [code del]: ``` huffman@36630 ` 138` ``` "inf a b = Abs_net ``` huffman@36630 ` 139` ``` (\P. \Q R. eventually Q a \ eventually R b \ (\x. Q x \ R x \ P x))" ``` huffman@36630 ` 140` huffman@36630 ` 141` ```definition ``` huffman@36630 ` 142` ``` Sup_net_def [code del]: ``` huffman@36630 ` 143` ``` "Sup A = Abs_net (\P. \net\A. eventually P net)" ``` huffman@36630 ` 144` huffman@36630 ` 145` ```definition ``` huffman@36630 ` 146` ``` Inf_net_def [code del]: ``` huffman@36630 ` 147` ``` "Inf A = Sup {x::'a net. \y\A. x \ y}" ``` huffman@36630 ` 148` huffman@36630 ` 149` ```lemma eventually_top [simp]: "eventually P top \ (\x. P x)" ``` huffman@36630 ` 150` ```unfolding top_net_def ``` huffman@36630 ` 151` ```by (rule eventually_Abs_net, rule is_filter.intro, auto) ``` huffman@36630 ` 152` huffman@36629 ` 153` ```lemma eventually_bot [simp]: "eventually P bot" ``` huffman@36629 ` 154` ```unfolding bot_net_def ``` huffman@36360 ` 155` ```by (subst eventually_Abs_net, rule is_filter.intro, auto) ``` huffman@36360 ` 156` huffman@36630 ` 157` ```lemma eventually_sup: ``` huffman@36630 ` 158` ``` "eventually P (sup net net') \ eventually P net \ eventually P net'" ``` huffman@36630 ` 159` ```unfolding sup_net_def ``` huffman@36630 ` 160` ```by (rule eventually_Abs_net, rule is_filter.intro) ``` huffman@36630 ` 161` ``` (auto elim!: eventually_rev_mp) ``` huffman@36630 ` 162` huffman@36630 ` 163` ```lemma eventually_inf: ``` huffman@36630 ` 164` ``` "eventually P (inf a b) \ ``` huffman@36630 ` 165` ``` (\Q R. eventually Q a \ eventually R b \ (\x. Q x \ R x \ P x))" ``` huffman@36630 ` 166` ```unfolding inf_net_def ``` huffman@36630 ` 167` ```apply (rule eventually_Abs_net, rule is_filter.intro) ``` huffman@36630 ` 168` ```apply (fast intro: eventually_True) ``` huffman@36630 ` 169` ```apply clarify ``` huffman@36630 ` 170` ```apply (intro exI conjI) ``` huffman@36630 ` 171` ```apply (erule (1) eventually_conj) ``` huffman@36630 ` 172` ```apply (erule (1) eventually_conj) ``` huffman@36630 ` 173` ```apply simp ``` huffman@36630 ` 174` ```apply auto ``` huffman@36630 ` 175` ```done ``` huffman@36630 ` 176` huffman@36630 ` 177` ```lemma eventually_Sup: ``` huffman@36630 ` 178` ``` "eventually P (Sup A) \ (\net\A. eventually P net)" ``` huffman@36630 ` 179` ```unfolding Sup_net_def ``` huffman@36630 ` 180` ```apply (rule eventually_Abs_net, rule is_filter.intro) ``` huffman@36630 ` 181` ```apply (auto intro: eventually_conj elim!: eventually_rev_mp) ``` huffman@36630 ` 182` ```done ``` huffman@36630 ` 183` huffman@36360 ` 184` ```instance proof ``` huffman@36360 ` 185` ``` fix x y :: "'a net" show "x < y \ x \ y \ \ y \ x" ``` huffman@36360 ` 186` ``` by (rule less_net_def) ``` huffman@36360 ` 187` ```next ``` huffman@36360 ` 188` ``` fix x :: "'a net" show "x \ x" ``` huffman@36360 ` 189` ``` unfolding le_net_def by simp ``` huffman@36360 ` 190` ```next ``` huffman@36360 ` 191` ``` fix x y z :: "'a net" assume "x \ y" and "y \ z" thus "x \ z" ``` huffman@36360 ` 192` ``` unfolding le_net_def by simp ``` huffman@36360 ` 193` ```next ``` huffman@36360 ` 194` ``` fix x y :: "'a net" assume "x \ y" and "y \ x" thus "x = y" ``` huffman@36360 ` 195` ``` unfolding le_net_def expand_net_eq by fast ``` huffman@36360 ` 196` ```next ``` huffman@36630 ` 197` ``` fix x :: "'a net" show "x \ top" ``` huffman@36630 ` 198` ``` unfolding le_net_def eventually_top by (simp add: always_eventually) ``` huffman@36630 ` 199` ```next ``` huffman@36629 ` 200` ``` fix x :: "'a net" show "bot \ x" ``` huffman@36360 ` 201` ``` unfolding le_net_def by simp ``` huffman@36630 ` 202` ```next ``` huffman@36630 ` 203` ``` fix x y :: "'a net" show "x \ sup x y" and "y \ sup x y" ``` huffman@36630 ` 204` ``` unfolding le_net_def eventually_sup by simp_all ``` huffman@36630 ` 205` ```next ``` huffman@36630 ` 206` ``` fix x y z :: "'a net" assume "x \ z" and "y \ z" thus "sup x y \ z" ``` huffman@36630 ` 207` ``` unfolding le_net_def eventually_sup by simp ``` huffman@36630 ` 208` ```next ``` huffman@36630 ` 209` ``` fix x y :: "'a net" show "inf x y \ x" and "inf x y \ y" ``` huffman@36630 ` 210` ``` unfolding le_net_def eventually_inf by (auto intro: eventually_True) ``` huffman@36630 ` 211` ```next ``` huffman@36630 ` 212` ``` fix x y z :: "'a net" assume "x \ y" and "x \ z" thus "x \ inf y z" ``` huffman@36630 ` 213` ``` unfolding le_net_def eventually_inf ``` huffman@36630 ` 214` ``` by (auto elim!: eventually_mono intro: eventually_conj) ``` huffman@36630 ` 215` ```next ``` huffman@36630 ` 216` ``` fix x :: "'a net" and A assume "x \ A" thus "x \ Sup A" ``` huffman@36630 ` 217` ``` unfolding le_net_def eventually_Sup by simp ``` huffman@36630 ` 218` ```next ``` huffman@36630 ` 219` ``` fix A and y :: "'a net" assume "\x. x \ A \ x \ y" thus "Sup A \ y" ``` huffman@36630 ` 220` ``` unfolding le_net_def eventually_Sup by simp ``` huffman@36630 ` 221` ```next ``` huffman@36630 ` 222` ``` fix z :: "'a net" and A assume "z \ A" thus "Inf A \ z" ``` huffman@36630 ` 223` ``` unfolding le_net_def Inf_net_def eventually_Sup Ball_def by simp ``` huffman@36630 ` 224` ```next ``` huffman@36630 ` 225` ``` fix A and x :: "'a net" assume "\y. y \ A \ x \ y" thus "x \ Inf A" ``` huffman@36630 ` 226` ``` unfolding le_net_def Inf_net_def eventually_Sup Ball_def by simp ``` huffman@36360 ` 227` ```qed ``` huffman@36360 ` 228` huffman@36360 ` 229` ```end ``` huffman@36360 ` 230` huffman@36360 ` 231` ```lemma net_leD: ``` huffman@36629 ` 232` ``` "net \ net' \ eventually P net' \ eventually P net" ``` huffman@36360 ` 233` ```unfolding le_net_def by simp ``` huffman@36360 ` 234` huffman@36360 ` 235` ```lemma net_leI: ``` huffman@36629 ` 236` ``` "(\P. eventually P net' \ eventually P net) \ net \ net'" ``` huffman@36360 ` 237` ```unfolding le_net_def by simp ``` huffman@36360 ` 238` huffman@36360 ` 239` ```lemma eventually_False: ``` huffman@36629 ` 240` ``` "eventually (\x. False) net \ net = bot" ``` huffman@36360 ` 241` ```unfolding expand_net_eq by (auto elim: eventually_rev_mp) ``` huffman@36360 ` 242` huffman@36360 ` 243` huffman@31392 ` 244` ```subsection {* Standard Nets *} ``` huffman@31392 ` 245` huffman@31392 ` 246` ```definition ``` huffman@36358 ` 247` ``` sequentially :: "nat net" ``` huffman@36358 ` 248` ```where [code del]: ``` huffman@36358 ` 249` ``` "sequentially = Abs_net (\P. \k. \n\k. P n)" ``` huffman@31392 ` 250` huffman@31392 ` 251` ```definition ``` huffman@36358 ` 252` ``` within :: "'a net \ 'a set \ 'a net" (infixr "within" 70) ``` huffman@36358 ` 253` ```where [code del]: ``` huffman@36358 ` 254` ``` "net within S = Abs_net (\P. eventually (\x. x \ S \ P x) net)" ``` huffman@31392 ` 255` huffman@36358 ` 256` ```definition ``` huffman@36358 ` 257` ``` at :: "'a::topological_space \ 'a net" ``` huffman@36358 ` 258` ```where [code del]: ``` huffman@36358 ` 259` ``` "at a = Abs_net (\P. \S. open S \ a \ S \ (\x\S. x \ a \ P x))" ``` huffman@31447 ` 260` huffman@31392 ` 261` ```lemma eventually_sequentially: ``` huffman@31392 ` 262` ``` "eventually P sequentially \ (\N. \n\N. P n)" ``` huffman@36358 ` 263` ```unfolding sequentially_def ``` huffman@36358 ` 264` ```proof (rule eventually_Abs_net, rule is_filter.intro) ``` huffman@36358 ` 265` ``` fix P Q :: "nat \ bool" ``` huffman@36358 ` 266` ``` assume "\i. \n\i. P n" and "\j. \n\j. Q n" ``` huffman@36358 ` 267` ``` then obtain i j where "\n\i. P n" and "\n\j. Q n" by auto ``` huffman@36358 ` 268` ``` then have "\n\max i j. P n \ Q n" by simp ``` huffman@36358 ` 269` ``` then show "\k. \n\k. P n \ Q n" .. ``` huffman@36358 ` 270` ```qed auto ``` huffman@31392 ` 271` huffman@31392 ` 272` ```lemma eventually_within: ``` huffman@31392 ` 273` ``` "eventually P (net within S) = eventually (\x. x \ S \ P x) net" ``` huffman@36358 ` 274` ```unfolding within_def ``` huffman@36358 ` 275` ```by (rule eventually_Abs_net, rule is_filter.intro) ``` huffman@36358 ` 276` ``` (auto elim!: eventually_rev_mp) ``` huffman@31392 ` 277` huffman@36360 ` 278` ```lemma within_UNIV: "net within UNIV = net" ``` huffman@36360 ` 279` ``` unfolding expand_net_eq eventually_within by simp ``` huffman@36360 ` 280` huffman@31447 ` 281` ```lemma eventually_at_topological: ``` huffman@31492 ` 282` ``` "eventually P (at a) \ (\S. open S \ a \ S \ (\x\S. x \ a \ P x))" ``` huffman@36358 ` 283` ```unfolding at_def ``` huffman@36358 ` 284` ```proof (rule eventually_Abs_net, rule is_filter.intro) ``` huffman@36358 ` 285` ``` have "open UNIV \ a \ UNIV \ (\x\UNIV. x \ a \ True)" by simp ``` huffman@36358 ` 286` ``` thus "\S. open S \ a \ S \ (\x\S. x \ a \ True)" by - rule ``` huffman@36358 ` 287` ```next ``` huffman@36358 ` 288` ``` fix P Q ``` huffman@36358 ` 289` ``` assume "\S. open S \ a \ S \ (\x\S. x \ a \ P x)" ``` huffman@36358 ` 290` ``` and "\T. open T \ a \ T \ (\x\T. x \ a \ Q x)" ``` huffman@36358 ` 291` ``` then obtain S T where ``` huffman@36358 ` 292` ``` "open S \ a \ S \ (\x\S. x \ a \ P x)" ``` huffman@36358 ` 293` ``` "open T \ a \ T \ (\x\T. x \ a \ Q x)" by auto ``` huffman@36358 ` 294` ``` hence "open (S \ T) \ a \ S \ T \ (\x\(S \ T). x \ a \ P x \ Q x)" ``` huffman@36358 ` 295` ``` by (simp add: open_Int) ``` huffman@36358 ` 296` ``` thus "\S. open S \ a \ S \ (\x\S. x \ a \ P x \ Q x)" by - rule ``` huffman@36358 ` 297` ```qed auto ``` huffman@31447 ` 298` huffman@31447 ` 299` ```lemma eventually_at: ``` huffman@31447 ` 300` ``` fixes a :: "'a::metric_space" ``` huffman@31447 ` 301` ``` shows "eventually P (at a) \ (\d>0. \x. x \ a \ dist x a < d \ P x)" ``` huffman@31492 ` 302` ```unfolding eventually_at_topological open_dist ``` huffman@31447 ` 303` ```apply safe ``` huffman@31447 ` 304` ```apply fast ``` huffman@31492 ` 305` ```apply (rule_tac x="{x. dist x a < d}" in exI, simp) ``` huffman@31447 ` 306` ```apply clarsimp ``` huffman@31447 ` 307` ```apply (rule_tac x="d - dist x a" in exI, clarsimp) ``` huffman@31447 ` 308` ```apply (simp only: less_diff_eq) ``` huffman@31447 ` 309` ```apply (erule le_less_trans [OF dist_triangle]) ``` huffman@31447 ` 310` ```done ``` huffman@31447 ` 311` huffman@31392 ` 312` huffman@31355 ` 313` ```subsection {* Boundedness *} ``` huffman@31355 ` 314` huffman@31355 ` 315` ```definition ``` huffman@31392 ` 316` ``` Bfun :: "('a \ 'b::real_normed_vector) \ 'a net \ bool" where ``` huffman@31487 ` 317` ``` [code del]: "Bfun f net = (\K>0. eventually (\x. norm (f x) \ K) net)" ``` huffman@31355 ` 318` huffman@31487 ` 319` ```lemma BfunI: ``` huffman@31487 ` 320` ``` assumes K: "eventually (\x. norm (f x) \ K) net" shows "Bfun f net" ``` huffman@31355 ` 321` ```unfolding Bfun_def ``` huffman@31355 ` 322` ```proof (intro exI conjI allI) ``` huffman@31355 ` 323` ``` show "0 < max K 1" by simp ``` huffman@31355 ` 324` ```next ``` huffman@31487 ` 325` ``` show "eventually (\x. norm (f x) \ max K 1) net" ``` huffman@31355 ` 326` ``` using K by (rule eventually_elim1, simp) ``` huffman@31355 ` 327` ```qed ``` huffman@31355 ` 328` huffman@31355 ` 329` ```lemma BfunE: ``` huffman@31487 ` 330` ``` assumes "Bfun f net" ``` huffman@31487 ` 331` ``` obtains B where "0 < B" and "eventually (\x. norm (f x) \ B) net" ``` huffman@31355 ` 332` ```using assms unfolding Bfun_def by fast ``` huffman@31355 ` 333` huffman@31355 ` 334` huffman@31349 ` 335` ```subsection {* Convergence to Zero *} ``` huffman@31349 ` 336` huffman@31349 ` 337` ```definition ``` huffman@31392 ` 338` ``` Zfun :: "('a \ 'b::real_normed_vector) \ 'a net \ bool" where ``` huffman@31487 ` 339` ``` [code del]: "Zfun f net = (\r>0. eventually (\x. norm (f x) < r) net)" ``` huffman@31349 ` 340` huffman@31349 ` 341` ```lemma ZfunI: ``` huffman@31487 ` 342` ``` "(\r. 0 < r \ eventually (\x. norm (f x) < r) net) \ Zfun f net" ``` huffman@31349 ` 343` ```unfolding Zfun_def by simp ``` huffman@31349 ` 344` huffman@31349 ` 345` ```lemma ZfunD: ``` huffman@31487 ` 346` ``` "\Zfun f net; 0 < r\ \ eventually (\x. norm (f x) < r) net" ``` huffman@31349 ` 347` ```unfolding Zfun_def by simp ``` huffman@31349 ` 348` huffman@31355 ` 349` ```lemma Zfun_ssubst: ``` huffman@31487 ` 350` ``` "eventually (\x. f x = g x) net \ Zfun g net \ Zfun f net" ``` huffman@31355 ` 351` ```unfolding Zfun_def by (auto elim!: eventually_rev_mp) ``` huffman@31355 ` 352` huffman@31487 ` 353` ```lemma Zfun_zero: "Zfun (\x. 0) net" ``` huffman@31349 ` 354` ```unfolding Zfun_def by simp ``` huffman@31349 ` 355` huffman@31487 ` 356` ```lemma Zfun_norm_iff: "Zfun (\x. norm (f x)) net = Zfun (\x. f x) net" ``` huffman@31349 ` 357` ```unfolding Zfun_def by simp ``` huffman@31349 ` 358` huffman@31349 ` 359` ```lemma Zfun_imp_Zfun: ``` huffman@31487 ` 360` ``` assumes f: "Zfun f net" ``` huffman@31487 ` 361` ``` assumes g: "eventually (\x. norm (g x) \ norm (f x) * K) net" ``` huffman@31487 ` 362` ``` shows "Zfun (\x. g x) net" ``` huffman@31349 ` 363` ```proof (cases) ``` huffman@31349 ` 364` ``` assume K: "0 < K" ``` huffman@31349 ` 365` ``` show ?thesis ``` huffman@31349 ` 366` ``` proof (rule ZfunI) ``` huffman@31349 ` 367` ``` fix r::real assume "0 < r" ``` huffman@31349 ` 368` ``` hence "0 < r / K" ``` huffman@31349 ` 369` ``` using K by (rule divide_pos_pos) ``` huffman@31487 ` 370` ``` then have "eventually (\x. norm (f x) < r / K) net" ``` huffman@31487 ` 371` ``` using ZfunD [OF f] by fast ``` huffman@31487 ` 372` ``` with g show "eventually (\x. norm (g x) < r) net" ``` huffman@31355 ` 373` ``` proof (rule eventually_elim2) ``` huffman@31487 ` 374` ``` fix x ``` huffman@31487 ` 375` ``` assume *: "norm (g x) \ norm (f x) * K" ``` huffman@31487 ` 376` ``` assume "norm (f x) < r / K" ``` huffman@31487 ` 377` ``` hence "norm (f x) * K < r" ``` huffman@31349 ` 378` ``` by (simp add: pos_less_divide_eq K) ``` huffman@31487 ` 379` ``` thus "norm (g x) < r" ``` huffman@31355 ` 380` ``` by (simp add: order_le_less_trans [OF *]) ``` huffman@31349 ` 381` ``` qed ``` huffman@31349 ` 382` ``` qed ``` huffman@31349 ` 383` ```next ``` huffman@31349 ` 384` ``` assume "\ 0 < K" ``` huffman@31349 ` 385` ``` hence K: "K \ 0" by (simp only: not_less) ``` huffman@31355 ` 386` ``` show ?thesis ``` huffman@31355 ` 387` ``` proof (rule ZfunI) ``` huffman@31355 ` 388` ``` fix r :: real ``` huffman@31355 ` 389` ``` assume "0 < r" ``` huffman@31487 ` 390` ``` from g show "eventually (\x. norm (g x) < r) net" ``` huffman@31355 ` 391` ``` proof (rule eventually_elim1) ``` huffman@31487 ` 392` ``` fix x ``` huffman@31487 ` 393` ``` assume "norm (g x) \ norm (f x) * K" ``` huffman@31487 ` 394` ``` also have "\ \ norm (f x) * 0" ``` huffman@31355 ` 395` ``` using K norm_ge_zero by (rule mult_left_mono) ``` huffman@31487 ` 396` ``` finally show "norm (g x) < r" ``` huffman@31355 ` 397` ``` using `0 < r` by simp ``` huffman@31355 ` 398` ``` qed ``` huffman@31355 ` 399` ``` qed ``` huffman@31349 ` 400` ```qed ``` huffman@31349 ` 401` huffman@31487 ` 402` ```lemma Zfun_le: "\Zfun g net; \x. norm (f x) \ norm (g x)\ \ Zfun f net" ``` huffman@31349 ` 403` ```by (erule_tac K="1" in Zfun_imp_Zfun, simp) ``` huffman@31349 ` 404` huffman@31349 ` 405` ```lemma Zfun_add: ``` huffman@31487 ` 406` ``` assumes f: "Zfun f net" and g: "Zfun g net" ``` huffman@31487 ` 407` ``` shows "Zfun (\x. f x + g x) net" ``` huffman@31349 ` 408` ```proof (rule ZfunI) ``` huffman@31349 ` 409` ``` fix r::real assume "0 < r" ``` huffman@31349 ` 410` ``` hence r: "0 < r / 2" by simp ``` huffman@31487 ` 411` ``` have "eventually (\x. norm (f x) < r/2) net" ``` huffman@31487 ` 412` ``` using f r by (rule ZfunD) ``` huffman@31349 ` 413` ``` moreover ``` huffman@31487 ` 414` ``` have "eventually (\x. norm (g x) < r/2) net" ``` huffman@31487 ` 415` ``` using g r by (rule ZfunD) ``` huffman@31349 ` 416` ``` ultimately ``` huffman@31487 ` 417` ``` show "eventually (\x. norm (f x + g x) < r) net" ``` huffman@31349 ` 418` ``` proof (rule eventually_elim2) ``` huffman@31487 ` 419` ``` fix x ``` huffman@31487 ` 420` ``` assume *: "norm (f x) < r/2" "norm (g x) < r/2" ``` huffman@31487 ` 421` ``` have "norm (f x + g x) \ norm (f x) + norm (g x)" ``` huffman@31349 ` 422` ``` by (rule norm_triangle_ineq) ``` huffman@31349 ` 423` ``` also have "\ < r/2 + r/2" ``` huffman@31349 ` 424` ``` using * by (rule add_strict_mono) ``` huffman@31487 ` 425` ``` finally show "norm (f x + g x) < r" ``` huffman@31349 ` 426` ``` by simp ``` huffman@31349 ` 427` ``` qed ``` huffman@31349 ` 428` ```qed ``` huffman@31349 ` 429` huffman@31487 ` 430` ```lemma Zfun_minus: "Zfun f net \ Zfun (\x. - f x) net" ``` huffman@31349 ` 431` ```unfolding Zfun_def by simp ``` huffman@31349 ` 432` huffman@31487 ` 433` ```lemma Zfun_diff: "\Zfun f net; Zfun g net\ \ Zfun (\x. f x - g x) net" ``` huffman@31349 ` 434` ```by (simp only: diff_minus Zfun_add Zfun_minus) ``` huffman@31349 ` 435` huffman@31349 ` 436` ```lemma (in bounded_linear) Zfun: ``` huffman@31487 ` 437` ``` assumes g: "Zfun g net" ``` huffman@31487 ` 438` ``` shows "Zfun (\x. f (g x)) net" ``` huffman@31349 ` 439` ```proof - ``` huffman@31349 ` 440` ``` obtain K where "\x. norm (f x) \ norm x * K" ``` huffman@31349 ` 441` ``` using bounded by fast ``` huffman@31487 ` 442` ``` then have "eventually (\x. norm (f (g x)) \ norm (g x) * K) net" ``` huffman@31355 ` 443` ``` by simp ``` huffman@31487 ` 444` ``` with g show ?thesis ``` huffman@31349 ` 445` ``` by (rule Zfun_imp_Zfun) ``` huffman@31349 ` 446` ```qed ``` huffman@31349 ` 447` huffman@31349 ` 448` ```lemma (in bounded_bilinear) Zfun: ``` huffman@31487 ` 449` ``` assumes f: "Zfun f net" ``` huffman@31487 ` 450` ``` assumes g: "Zfun g net" ``` huffman@31487 ` 451` ``` shows "Zfun (\x. f x ** g x) net" ``` huffman@31349 ` 452` ```proof (rule ZfunI) ``` huffman@31349 ` 453` ``` fix r::real assume r: "0 < r" ``` huffman@31349 ` 454` ``` obtain K where K: "0 < K" ``` huffman@31349 ` 455` ``` and norm_le: "\x y. norm (x ** y) \ norm x * norm y * K" ``` huffman@31349 ` 456` ``` using pos_bounded by fast ``` huffman@31349 ` 457` ``` from K have K': "0 < inverse K" ``` huffman@31349 ` 458` ``` by (rule positive_imp_inverse_positive) ``` huffman@31487 ` 459` ``` have "eventually (\x. norm (f x) < r) net" ``` huffman@31487 ` 460` ``` using f r by (rule ZfunD) ``` huffman@31349 ` 461` ``` moreover ``` huffman@31487 ` 462` ``` have "eventually (\x. norm (g x) < inverse K) net" ``` huffman@31487 ` 463` ``` using g K' by (rule ZfunD) ``` huffman@31349 ` 464` ``` ultimately ``` huffman@31487 ` 465` ``` show "eventually (\x. norm (f x ** g x) < r) net" ``` huffman@31349 ` 466` ``` proof (rule eventually_elim2) ``` huffman@31487 ` 467` ``` fix x ``` huffman@31487 ` 468` ``` assume *: "norm (f x) < r" "norm (g x) < inverse K" ``` huffman@31487 ` 469` ``` have "norm (f x ** g x) \ norm (f x) * norm (g x) * K" ``` huffman@31349 ` 470` ``` by (rule norm_le) ``` huffman@31487 ` 471` ``` also have "norm (f x) * norm (g x) * K < r * inverse K * K" ``` huffman@31349 ` 472` ``` by (intro mult_strict_right_mono mult_strict_mono' norm_ge_zero * K) ``` huffman@31349 ` 473` ``` also from K have "r * inverse K * K = r" ``` huffman@31349 ` 474` ``` by simp ``` huffman@31487 ` 475` ``` finally show "norm (f x ** g x) < r" . ``` huffman@31349 ` 476` ``` qed ``` huffman@31349 ` 477` ```qed ``` huffman@31349 ` 478` huffman@31349 ` 479` ```lemma (in bounded_bilinear) Zfun_left: ``` huffman@31487 ` 480` ``` "Zfun f net \ Zfun (\x. f x ** a) net" ``` huffman@31349 ` 481` ```by (rule bounded_linear_left [THEN bounded_linear.Zfun]) ``` huffman@31349 ` 482` huffman@31349 ` 483` ```lemma (in bounded_bilinear) Zfun_right: ``` huffman@31487 ` 484` ``` "Zfun f net \ Zfun (\x. a ** f x) net" ``` huffman@31349 ` 485` ```by (rule bounded_linear_right [THEN bounded_linear.Zfun]) ``` huffman@31349 ` 486` huffman@31349 ` 487` ```lemmas Zfun_mult = mult.Zfun ``` huffman@31349 ` 488` ```lemmas Zfun_mult_right = mult.Zfun_right ``` huffman@31349 ` 489` ```lemmas Zfun_mult_left = mult.Zfun_left ``` huffman@31349 ` 490` huffman@31349 ` 491` wenzelm@31902 ` 492` ```subsection {* Limits *} ``` huffman@31349 ` 493` huffman@31349 ` 494` ```definition ``` huffman@31488 ` 495` ``` tendsto :: "('a \ 'b::topological_space) \ 'b \ 'a net \ bool" ``` huffman@31488 ` 496` ``` (infixr "--->" 55) ``` huffman@31488 ` 497` ```where [code del]: ``` huffman@31492 ` 498` ``` "(f ---> l) net \ (\S. open S \ l \ S \ eventually (\x. f x \ S) net)" ``` huffman@31349 ` 499` wenzelm@31902 ` 500` ```ML {* ``` wenzelm@31902 ` 501` ```structure Tendsto_Intros = Named_Thms ``` wenzelm@31902 ` 502` ```( ``` wenzelm@31902 ` 503` ``` val name = "tendsto_intros" ``` wenzelm@31902 ` 504` ``` val description = "introduction rules for tendsto" ``` wenzelm@31902 ` 505` ```) ``` huffman@31565 ` 506` ```*} ``` huffman@31565 ` 507` wenzelm@31902 ` 508` ```setup Tendsto_Intros.setup ``` huffman@31565 ` 509` huffman@31488 ` 510` ```lemma topological_tendstoI: ``` huffman@31492 ` 511` ``` "(\S. open S \ l \ S \ eventually (\x. f x \ S) net) ``` huffman@31487 ` 512` ``` \ (f ---> l) net" ``` huffman@31349 ` 513` ``` unfolding tendsto_def by auto ``` huffman@31349 ` 514` huffman@31488 ` 515` ```lemma topological_tendstoD: ``` huffman@31492 ` 516` ``` "(f ---> l) net \ open S \ l \ S \ eventually (\x. f x \ S) net" ``` huffman@31488 ` 517` ``` unfolding tendsto_def by auto ``` huffman@31488 ` 518` huffman@31488 ` 519` ```lemma tendstoI: ``` huffman@31488 ` 520` ``` assumes "\e. 0 < e \ eventually (\x. dist (f x) l < e) net" ``` huffman@31488 ` 521` ``` shows "(f ---> l) net" ``` huffman@31488 ` 522` ```apply (rule topological_tendstoI) ``` huffman@31492 ` 523` ```apply (simp add: open_dist) ``` huffman@31488 ` 524` ```apply (drule (1) bspec, clarify) ``` huffman@31488 ` 525` ```apply (drule assms) ``` huffman@31488 ` 526` ```apply (erule eventually_elim1, simp) ``` huffman@31488 ` 527` ```done ``` huffman@31488 ` 528` huffman@31349 ` 529` ```lemma tendstoD: ``` huffman@31487 ` 530` ``` "(f ---> l) net \ 0 < e \ eventually (\x. dist (f x) l < e) net" ``` huffman@31488 ` 531` ```apply (drule_tac S="{x. dist x l < e}" in topological_tendstoD) ``` huffman@31492 ` 532` ```apply (clarsimp simp add: open_dist) ``` huffman@31488 ` 533` ```apply (rule_tac x="e - dist x l" in exI, clarsimp) ``` huffman@31488 ` 534` ```apply (simp only: less_diff_eq) ``` huffman@31488 ` 535` ```apply (erule le_less_trans [OF dist_triangle]) ``` huffman@31488 ` 536` ```apply simp ``` huffman@31488 ` 537` ```apply simp ``` huffman@31488 ` 538` ```done ``` huffman@31488 ` 539` huffman@31488 ` 540` ```lemma tendsto_iff: ``` huffman@31488 ` 541` ``` "(f ---> l) net \ (\e>0. eventually (\x. dist (f x) l < e) net)" ``` huffman@31488 ` 542` ```using tendstoI tendstoD by fast ``` huffman@31349 ` 543` huffman@31487 ` 544` ```lemma tendsto_Zfun_iff: "(f ---> a) net = Zfun (\x. f x - a) net" ``` huffman@31488 ` 545` ```by (simp only: tendsto_iff Zfun_def dist_norm) ``` huffman@31349 ` 546` huffman@31565 ` 547` ```lemma tendsto_ident_at [tendsto_intros]: "((\x. x) ---> a) (at a)" ``` huffman@31565 ` 548` ```unfolding tendsto_def eventually_at_topological by auto ``` huffman@31565 ` 549` huffman@31565 ` 550` ```lemma tendsto_ident_at_within [tendsto_intros]: ``` huffman@31565 ` 551` ``` "a \ S \ ((\x. x) ---> a) (at a within S)" ``` huffman@31565 ` 552` ```unfolding tendsto_def eventually_within eventually_at_topological by auto ``` huffman@31565 ` 553` huffman@31565 ` 554` ```lemma tendsto_const [tendsto_intros]: "((\x. k) ---> k) net" ``` huffman@31349 ` 555` ```by (simp add: tendsto_def) ``` huffman@31349 ` 556` huffman@31565 ` 557` ```lemma tendsto_dist [tendsto_intros]: ``` huffman@31565 ` 558` ``` assumes f: "(f ---> l) net" and g: "(g ---> m) net" ``` huffman@31565 ` 559` ``` shows "((\x. dist (f x) (g x)) ---> dist l m) net" ``` huffman@31565 ` 560` ```proof (rule tendstoI) ``` huffman@31565 ` 561` ``` fix e :: real assume "0 < e" ``` huffman@31565 ` 562` ``` hence e2: "0 < e/2" by simp ``` huffman@31565 ` 563` ``` from tendstoD [OF f e2] tendstoD [OF g e2] ``` huffman@31565 ` 564` ``` show "eventually (\x. dist (dist (f x) (g x)) (dist l m) < e) net" ``` huffman@31565 ` 565` ``` proof (rule eventually_elim2) ``` huffman@31565 ` 566` ``` fix x assume "dist (f x) l < e/2" "dist (g x) m < e/2" ``` huffman@31565 ` 567` ``` then show "dist (dist (f x) (g x)) (dist l m) < e" ``` huffman@31565 ` 568` ``` unfolding dist_real_def ``` huffman@31565 ` 569` ``` using dist_triangle2 [of "f x" "g x" "l"] ``` huffman@31565 ` 570` ``` using dist_triangle2 [of "g x" "l" "m"] ``` huffman@31565 ` 571` ``` using dist_triangle3 [of "l" "m" "f x"] ``` huffman@31565 ` 572` ``` using dist_triangle [of "f x" "m" "g x"] ``` huffman@31565 ` 573` ``` by arith ``` huffman@31565 ` 574` ``` qed ``` huffman@31565 ` 575` ```qed ``` huffman@31565 ` 576` huffman@31565 ` 577` ```lemma tendsto_norm [tendsto_intros]: ``` huffman@31565 ` 578` ``` "(f ---> a) net \ ((\x. norm (f x)) ---> norm a) net" ``` huffman@31488 ` 579` ```apply (simp add: tendsto_iff dist_norm, safe) ``` huffman@31349 ` 580` ```apply (drule_tac x="e" in spec, safe) ``` huffman@31349 ` 581` ```apply (erule eventually_elim1) ``` huffman@31349 ` 582` ```apply (erule order_le_less_trans [OF norm_triangle_ineq3]) ``` huffman@31349 ` 583` ```done ``` huffman@31349 ` 584` huffman@31349 ` 585` ```lemma add_diff_add: ``` huffman@31349 ` 586` ``` fixes a b c d :: "'a::ab_group_add" ``` huffman@31349 ` 587` ``` shows "(a + c) - (b + d) = (a - b) + (c - d)" ``` huffman@31349 ` 588` ```by simp ``` huffman@31349 ` 589` huffman@31349 ` 590` ```lemma minus_diff_minus: ``` huffman@31349 ` 591` ``` fixes a b :: "'a::ab_group_add" ``` huffman@31349 ` 592` ``` shows "(- a) - (- b) = - (a - b)" ``` huffman@31349 ` 593` ```by simp ``` huffman@31349 ` 594` huffman@31565 ` 595` ```lemma tendsto_add [tendsto_intros]: ``` huffman@31349 ` 596` ``` fixes a b :: "'a::real_normed_vector" ``` huffman@31487 ` 597` ``` shows "\(f ---> a) net; (g ---> b) net\ \ ((\x. f x + g x) ---> a + b) net" ``` huffman@31349 ` 598` ```by (simp only: tendsto_Zfun_iff add_diff_add Zfun_add) ``` huffman@31349 ` 599` huffman@31565 ` 600` ```lemma tendsto_minus [tendsto_intros]: ``` huffman@31349 ` 601` ``` fixes a :: "'a::real_normed_vector" ``` huffman@31487 ` 602` ``` shows "(f ---> a) net \ ((\x. - f x) ---> - a) net" ``` huffman@31349 ` 603` ```by (simp only: tendsto_Zfun_iff minus_diff_minus Zfun_minus) ``` huffman@31349 ` 604` huffman@31349 ` 605` ```lemma tendsto_minus_cancel: ``` huffman@31349 ` 606` ``` fixes a :: "'a::real_normed_vector" ``` huffman@31487 ` 607` ``` shows "((\x. - f x) ---> - a) net \ (f ---> a) net" ``` huffman@31349 ` 608` ```by (drule tendsto_minus, simp) ``` huffman@31349 ` 609` huffman@31565 ` 610` ```lemma tendsto_diff [tendsto_intros]: ``` huffman@31349 ` 611` ``` fixes a b :: "'a::real_normed_vector" ``` huffman@31487 ` 612` ``` shows "\(f ---> a) net; (g ---> b) net\ \ ((\x. f x - g x) ---> a - b) net" ``` huffman@31349 ` 613` ```by (simp add: diff_minus tendsto_add tendsto_minus) ``` huffman@31349 ` 614` huffman@31588 ` 615` ```lemma tendsto_setsum [tendsto_intros]: ``` huffman@31588 ` 616` ``` fixes f :: "'a \ 'b \ 'c::real_normed_vector" ``` huffman@31588 ` 617` ``` assumes "\i. i \ S \ (f i ---> a i) net" ``` huffman@31588 ` 618` ``` shows "((\x. \i\S. f i x) ---> (\i\S. a i)) net" ``` huffman@31588 ` 619` ```proof (cases "finite S") ``` huffman@31588 ` 620` ``` assume "finite S" thus ?thesis using assms ``` huffman@31588 ` 621` ``` proof (induct set: finite) ``` huffman@31588 ` 622` ``` case empty show ?case ``` huffman@31588 ` 623` ``` by (simp add: tendsto_const) ``` huffman@31588 ` 624` ``` next ``` huffman@31588 ` 625` ``` case (insert i F) thus ?case ``` huffman@31588 ` 626` ``` by (simp add: tendsto_add) ``` huffman@31588 ` 627` ``` qed ``` huffman@31588 ` 628` ```next ``` huffman@31588 ` 629` ``` assume "\ finite S" thus ?thesis ``` huffman@31588 ` 630` ``` by (simp add: tendsto_const) ``` huffman@31588 ` 631` ```qed ``` huffman@31588 ` 632` huffman@31565 ` 633` ```lemma (in bounded_linear) tendsto [tendsto_intros]: ``` huffman@31487 ` 634` ``` "(g ---> a) net \ ((\x. f (g x)) ---> f a) net" ``` huffman@31349 ` 635` ```by (simp only: tendsto_Zfun_iff diff [symmetric] Zfun) ``` huffman@31349 ` 636` huffman@31565 ` 637` ```lemma (in bounded_bilinear) tendsto [tendsto_intros]: ``` huffman@31487 ` 638` ``` "\(f ---> a) net; (g ---> b) net\ \ ((\x. f x ** g x) ---> a ** b) net" ``` huffman@31349 ` 639` ```by (simp only: tendsto_Zfun_iff prod_diff_prod ``` huffman@31349 ` 640` ``` Zfun_add Zfun Zfun_left Zfun_right) ``` huffman@31349 ` 641` huffman@31355 ` 642` huffman@31355 ` 643` ```subsection {* Continuity of Inverse *} ``` huffman@31355 ` 644` huffman@31355 ` 645` ```lemma (in bounded_bilinear) Zfun_prod_Bfun: ``` huffman@31487 ` 646` ``` assumes f: "Zfun f net" ``` huffman@31487 ` 647` ``` assumes g: "Bfun g net" ``` huffman@31487 ` 648` ``` shows "Zfun (\x. f x ** g x) net" ``` huffman@31355 ` 649` ```proof - ``` huffman@31355 ` 650` ``` obtain K where K: "0 \ K" ``` huffman@31355 ` 651` ``` and norm_le: "\x y. norm (x ** y) \ norm x * norm y * K" ``` huffman@31355 ` 652` ``` using nonneg_bounded by fast ``` huffman@31355 ` 653` ``` obtain B where B: "0 < B" ``` huffman@31487 ` 654` ``` and norm_g: "eventually (\x. norm (g x) \ B) net" ``` huffman@31487 ` 655` ``` using g by (rule BfunE) ``` huffman@31487 ` 656` ``` have "eventually (\x. norm (f x ** g x) \ norm (f x) * (B * K)) net" ``` huffman@31487 ` 657` ``` using norm_g proof (rule eventually_elim1) ``` huffman@31487 ` 658` ``` fix x ``` huffman@31487 ` 659` ``` assume *: "norm (g x) \ B" ``` huffman@31487 ` 660` ``` have "norm (f x ** g x) \ norm (f x) * norm (g x) * K" ``` huffman@31355 ` 661` ``` by (rule norm_le) ``` huffman@31487 ` 662` ``` also have "\ \ norm (f x) * B * K" ``` huffman@31487 ` 663` ``` by (intro mult_mono' order_refl norm_g norm_ge_zero ``` huffman@31355 ` 664` ``` mult_nonneg_nonneg K *) ``` huffman@31487 ` 665` ``` also have "\ = norm (f x) * (B * K)" ``` huffman@31355 ` 666` ``` by (rule mult_assoc) ``` huffman@31487 ` 667` ``` finally show "norm (f x ** g x) \ norm (f x) * (B * K)" . ``` huffman@31355 ` 668` ``` qed ``` huffman@31487 ` 669` ``` with f show ?thesis ``` huffman@31487 ` 670` ``` by (rule Zfun_imp_Zfun) ``` huffman@31355 ` 671` ```qed ``` huffman@31355 ` 672` huffman@31355 ` 673` ```lemma (in bounded_bilinear) flip: ``` huffman@31355 ` 674` ``` "bounded_bilinear (\x y. y ** x)" ``` huffman@31355 ` 675` ```apply default ``` huffman@31355 ` 676` ```apply (rule add_right) ``` huffman@31355 ` 677` ```apply (rule add_left) ``` huffman@31355 ` 678` ```apply (rule scaleR_right) ``` huffman@31355 ` 679` ```apply (rule scaleR_left) ``` huffman@31355 ` 680` ```apply (subst mult_commute) ``` huffman@31355 ` 681` ```using bounded by fast ``` huffman@31355 ` 682` huffman@31355 ` 683` ```lemma (in bounded_bilinear) Bfun_prod_Zfun: ``` huffman@31487 ` 684` ``` assumes f: "Bfun f net" ``` huffman@31487 ` 685` ``` assumes g: "Zfun g net" ``` huffman@31487 ` 686` ``` shows "Zfun (\x. f x ** g x) net" ``` huffman@31487 ` 687` ```using flip g f by (rule bounded_bilinear.Zfun_prod_Bfun) ``` huffman@31355 ` 688` huffman@31355 ` 689` ```lemma inverse_diff_inverse: ``` huffman@31355 ` 690` ``` "\(a::'a::division_ring) \ 0; b \ 0\ ``` huffman@31355 ` 691` ``` \ inverse a - inverse b = - (inverse a * (a - b) * inverse b)" ``` huffman@31355 ` 692` ```by (simp add: algebra_simps) ``` huffman@31355 ` 693` huffman@31355 ` 694` ```lemma Bfun_inverse_lemma: ``` huffman@31355 ` 695` ``` fixes x :: "'a::real_normed_div_algebra" ``` huffman@31355 ` 696` ``` shows "\r \ norm x; 0 < r\ \ norm (inverse x) \ inverse r" ``` huffman@31355 ` 697` ```apply (subst nonzero_norm_inverse, clarsimp) ``` huffman@31355 ` 698` ```apply (erule (1) le_imp_inverse_le) ``` huffman@31355 ` 699` ```done ``` huffman@31355 ` 700` huffman@31355 ` 701` ```lemma Bfun_inverse: ``` huffman@31355 ` 702` ``` fixes a :: "'a::real_normed_div_algebra" ``` huffman@31487 ` 703` ``` assumes f: "(f ---> a) net" ``` huffman@31355 ` 704` ``` assumes a: "a \ 0" ``` huffman@31487 ` 705` ``` shows "Bfun (\x. inverse (f x)) net" ``` huffman@31355 ` 706` ```proof - ``` huffman@31355 ` 707` ``` from a have "0 < norm a" by simp ``` huffman@31355 ` 708` ``` hence "\r>0. r < norm a" by (rule dense) ``` huffman@31355 ` 709` ``` then obtain r where r1: "0 < r" and r2: "r < norm a" by fast ``` huffman@31487 ` 710` ``` have "eventually (\x. dist (f x) a < r) net" ``` huffman@31487 ` 711` ``` using tendstoD [OF f r1] by fast ``` huffman@31487 ` 712` ``` hence "eventually (\x. norm (inverse (f x)) \ inverse (norm a - r)) net" ``` huffman@31355 ` 713` ``` proof (rule eventually_elim1) ``` huffman@31487 ` 714` ``` fix x ``` huffman@31487 ` 715` ``` assume "dist (f x) a < r" ``` huffman@31487 ` 716` ``` hence 1: "norm (f x - a) < r" ``` huffman@31355 ` 717` ``` by (simp add: dist_norm) ``` huffman@31487 ` 718` ``` hence 2: "f x \ 0" using r2 by auto ``` huffman@31487 ` 719` ``` hence "norm (inverse (f x)) = inverse (norm (f x))" ``` huffman@31355 ` 720` ``` by (rule nonzero_norm_inverse) ``` huffman@31355 ` 721` ``` also have "\ \ inverse (norm a - r)" ``` huffman@31355 ` 722` ``` proof (rule le_imp_inverse_le) ``` huffman@31355 ` 723` ``` show "0 < norm a - r" using r2 by simp ``` huffman@31355 ` 724` ``` next ``` huffman@31487 ` 725` ``` have "norm a - norm (f x) \ norm (a - f x)" ``` huffman@31355 ` 726` ``` by (rule norm_triangle_ineq2) ``` huffman@31487 ` 727` ``` also have "\ = norm (f x - a)" ``` huffman@31355 ` 728` ``` by (rule norm_minus_commute) ``` huffman@31355 ` 729` ``` also have "\ < r" using 1 . ``` huffman@31487 ` 730` ``` finally show "norm a - r \ norm (f x)" by simp ``` huffman@31355 ` 731` ``` qed ``` huffman@31487 ` 732` ``` finally show "norm (inverse (f x)) \ inverse (norm a - r)" . ``` huffman@31355 ` 733` ``` qed ``` huffman@31355 ` 734` ``` thus ?thesis by (rule BfunI) ``` huffman@31355 ` 735` ```qed ``` huffman@31355 ` 736` huffman@31355 ` 737` ```lemma tendsto_inverse_lemma: ``` huffman@31355 ` 738` ``` fixes a :: "'a::real_normed_div_algebra" ``` huffman@31487 ` 739` ``` shows "\(f ---> a) net; a \ 0; eventually (\x. f x \ 0) net\ ``` huffman@31487 ` 740` ``` \ ((\x. inverse (f x)) ---> inverse a) net" ``` huffman@31355 ` 741` ```apply (subst tendsto_Zfun_iff) ``` huffman@31355 ` 742` ```apply (rule Zfun_ssubst) ``` huffman@31355 ` 743` ```apply (erule eventually_elim1) ``` huffman@31355 ` 744` ```apply (erule (1) inverse_diff_inverse) ``` huffman@31355 ` 745` ```apply (rule Zfun_minus) ``` huffman@31355 ` 746` ```apply (rule Zfun_mult_left) ``` huffman@31355 ` 747` ```apply (rule mult.Bfun_prod_Zfun) ``` huffman@31355 ` 748` ```apply (erule (1) Bfun_inverse) ``` huffman@31355 ` 749` ```apply (simp add: tendsto_Zfun_iff) ``` huffman@31355 ` 750` ```done ``` huffman@31355 ` 751` huffman@31565 ` 752` ```lemma tendsto_inverse [tendsto_intros]: ``` huffman@31355 ` 753` ``` fixes a :: "'a::real_normed_div_algebra" ``` huffman@31487 ` 754` ``` assumes f: "(f ---> a) net" ``` huffman@31355 ` 755` ``` assumes a: "a \ 0" ``` huffman@31487 ` 756` ``` shows "((\x. inverse (f x)) ---> inverse a) net" ``` huffman@31355 ` 757` ```proof - ``` huffman@31355 ` 758` ``` from a have "0 < norm a" by simp ``` huffman@31487 ` 759` ``` with f have "eventually (\x. dist (f x) a < norm a) net" ``` huffman@31355 ` 760` ``` by (rule tendstoD) ``` huffman@31487 ` 761` ``` then have "eventually (\x. f x \ 0) net" ``` huffman@31355 ` 762` ``` unfolding dist_norm by (auto elim!: eventually_elim1) ``` huffman@31487 ` 763` ``` with f a show ?thesis ``` huffman@31355 ` 764` ``` by (rule tendsto_inverse_lemma) ``` huffman@31355 ` 765` ```qed ``` huffman@31355 ` 766` huffman@31565 ` 767` ```lemma tendsto_divide [tendsto_intros]: ``` huffman@31355 ` 768` ``` fixes a b :: "'a::real_normed_field" ``` huffman@31487 ` 769` ``` shows "\(f ---> a) net; (g ---> b) net; b \ 0\ ``` huffman@31487 ` 770` ``` \ ((\x. f x / g x) ---> a / b) net" ``` huffman@31355 ` 771` ```by (simp add: mult.tendsto tendsto_inverse divide_inverse) ``` huffman@31355 ` 772` huffman@31349 ` 773` ```end ```