rename type 'a net to 'a filter, following standard mathematical terminology
authorhuffman
Mon Aug 08 19:26:53 2011 -0700 (2011-08-08)
changeset 44081730f7cced3a6
parent 44080 53d95b52954c
child 44086 c0847967a25a
child 44122 5469da57ab77
rename type 'a net to 'a filter, following standard mathematical terminology
NEWS
src/HOL/Limits.thy
src/HOL/Multivariate_Analysis/Derivative.thy
src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy
     1.1 --- a/NEWS	Mon Aug 08 18:36:32 2011 -0700
     1.2 +++ b/NEWS	Mon Aug 08 19:26:53 2011 -0700
     1.3 @@ -170,6 +170,9 @@
     1.4  Every theorem name containing "inat", "Fin", "Infty", or "iSuc" has
     1.5  been renamed accordingly.
     1.6  
     1.7 +* Limits.thy: Type "'a net" has been renamed to "'a filter", in
     1.8 +accordance with standard mathematical terminology. INCOMPATIBILITY.
     1.9 +
    1.10  
    1.11  *** Document preparation ***
    1.12  
     2.1 --- a/src/HOL/Limits.thy	Mon Aug 08 18:36:32 2011 -0700
     2.2 +++ b/src/HOL/Limits.thy	Mon Aug 08 19:26:53 2011 -0700
     2.3 @@ -8,263 +8,262 @@
     2.4  imports RealVector
     2.5  begin
     2.6  
     2.7 -subsection {* Nets *}
     2.8 +subsection {* Filters *}
     2.9  
    2.10  text {*
    2.11 -  A net is now defined simply as a filter on a set.
    2.12 -  The definition also allows non-proper filters.
    2.13 +  This definition also allows non-proper filters.
    2.14  *}
    2.15  
    2.16  locale is_filter =
    2.17 -  fixes net :: "('a \<Rightarrow> bool) \<Rightarrow> bool"
    2.18 -  assumes True: "net (\<lambda>x. True)"
    2.19 -  assumes conj: "net (\<lambda>x. P x) \<Longrightarrow> net (\<lambda>x. Q x) \<Longrightarrow> net (\<lambda>x. P x \<and> Q x)"
    2.20 -  assumes mono: "\<forall>x. P x \<longrightarrow> Q x \<Longrightarrow> net (\<lambda>x. P x) \<Longrightarrow> net (\<lambda>x. Q x)"
    2.21 +  fixes F :: "('a \<Rightarrow> bool) \<Rightarrow> bool"
    2.22 +  assumes True: "F (\<lambda>x. True)"
    2.23 +  assumes conj: "F (\<lambda>x. P x) \<Longrightarrow> F (\<lambda>x. Q x) \<Longrightarrow> F (\<lambda>x. P x \<and> Q x)"
    2.24 +  assumes mono: "\<forall>x. P x \<longrightarrow> Q x \<Longrightarrow> F (\<lambda>x. P x) \<Longrightarrow> F (\<lambda>x. Q x)"
    2.25  
    2.26 -typedef (open) 'a net =
    2.27 -  "{net :: ('a \<Rightarrow> bool) \<Rightarrow> bool. is_filter net}"
    2.28 +typedef (open) 'a filter = "{F :: ('a \<Rightarrow> bool) \<Rightarrow> bool. is_filter F}"
    2.29  proof
    2.30 -  show "(\<lambda>x. True) \<in> ?net" by (auto intro: is_filter.intro)
    2.31 +  show "(\<lambda>x. True) \<in> ?filter" by (auto intro: is_filter.intro)
    2.32  qed
    2.33  
    2.34 -lemma is_filter_Rep_net: "is_filter (Rep_net net)"
    2.35 -using Rep_net [of net] by simp
    2.36 +lemma is_filter_Rep_filter: "is_filter (Rep_filter A)"
    2.37 +  using Rep_filter [of A] by simp
    2.38  
    2.39 -lemma Abs_net_inverse':
    2.40 -  assumes "is_filter net" shows "Rep_net (Abs_net net) = net"
    2.41 -using assms by (simp add: Abs_net_inverse)
    2.42 +lemma Abs_filter_inverse':
    2.43 +  assumes "is_filter F" shows "Rep_filter (Abs_filter F) = F"
    2.44 +  using assms by (simp add: Abs_filter_inverse)
    2.45  
    2.46  
    2.47  subsection {* Eventually *}
    2.48  
    2.49 -definition eventually :: "('a \<Rightarrow> bool) \<Rightarrow> 'a net \<Rightarrow> bool" where
    2.50 -  "eventually P net \<longleftrightarrow> Rep_net net P"
    2.51 +definition eventually :: "('a \<Rightarrow> bool) \<Rightarrow> 'a filter \<Rightarrow> bool"
    2.52 +  where "eventually P A \<longleftrightarrow> Rep_filter A P"
    2.53  
    2.54 -lemma eventually_Abs_net:
    2.55 -  assumes "is_filter net" shows "eventually P (Abs_net net) = net P"
    2.56 -unfolding eventually_def using assms by (simp add: Abs_net_inverse)
    2.57 +lemma eventually_Abs_filter:
    2.58 +  assumes "is_filter F" shows "eventually P (Abs_filter F) = F P"
    2.59 +  unfolding eventually_def using assms by (simp add: Abs_filter_inverse)
    2.60  
    2.61 -lemma expand_net_eq:
    2.62 -  shows "net = net' \<longleftrightarrow> (\<forall>P. eventually P net = eventually P net')"
    2.63 -unfolding Rep_net_inject [symmetric] fun_eq_iff eventually_def ..
    2.64 +lemma filter_eq_iff:
    2.65 +  shows "A = B \<longleftrightarrow> (\<forall>P. eventually P A = eventually P B)"
    2.66 +  unfolding Rep_filter_inject [symmetric] fun_eq_iff eventually_def ..
    2.67  
    2.68 -lemma eventually_True [simp]: "eventually (\<lambda>x. True) net"
    2.69 -unfolding eventually_def
    2.70 -by (rule is_filter.True [OF is_filter_Rep_net])
    2.71 +lemma eventually_True [simp]: "eventually (\<lambda>x. True) A"
    2.72 +  unfolding eventually_def
    2.73 +  by (rule is_filter.True [OF is_filter_Rep_filter])
    2.74  
    2.75 -lemma always_eventually: "\<forall>x. P x \<Longrightarrow> eventually P net"
    2.76 +lemma always_eventually: "\<forall>x. P x \<Longrightarrow> eventually P A"
    2.77  proof -
    2.78    assume "\<forall>x. P x" hence "P = (\<lambda>x. True)" by (simp add: ext)
    2.79 -  thus "eventually P net" by simp
    2.80 +  thus "eventually P A" by simp
    2.81  qed
    2.82  
    2.83  lemma eventually_mono:
    2.84 -  "(\<forall>x. P x \<longrightarrow> Q x) \<Longrightarrow> eventually P net \<Longrightarrow> eventually Q net"
    2.85 -unfolding eventually_def
    2.86 -by (rule is_filter.mono [OF is_filter_Rep_net])
    2.87 +  "(\<forall>x. P x \<longrightarrow> Q x) \<Longrightarrow> eventually P A \<Longrightarrow> eventually Q A"
    2.88 +  unfolding eventually_def
    2.89 +  by (rule is_filter.mono [OF is_filter_Rep_filter])
    2.90  
    2.91  lemma eventually_conj:
    2.92 -  assumes P: "eventually (\<lambda>x. P x) net"
    2.93 -  assumes Q: "eventually (\<lambda>x. Q x) net"
    2.94 -  shows "eventually (\<lambda>x. P x \<and> Q x) net"
    2.95 -using assms unfolding eventually_def
    2.96 -by (rule is_filter.conj [OF is_filter_Rep_net])
    2.97 +  assumes P: "eventually (\<lambda>x. P x) A"
    2.98 +  assumes Q: "eventually (\<lambda>x. Q x) A"
    2.99 +  shows "eventually (\<lambda>x. P x \<and> Q x) A"
   2.100 +  using assms unfolding eventually_def
   2.101 +  by (rule is_filter.conj [OF is_filter_Rep_filter])
   2.102  
   2.103  lemma eventually_mp:
   2.104 -  assumes "eventually (\<lambda>x. P x \<longrightarrow> Q x) net"
   2.105 -  assumes "eventually (\<lambda>x. P x) net"
   2.106 -  shows "eventually (\<lambda>x. Q x) net"
   2.107 +  assumes "eventually (\<lambda>x. P x \<longrightarrow> Q x) A"
   2.108 +  assumes "eventually (\<lambda>x. P x) A"
   2.109 +  shows "eventually (\<lambda>x. Q x) A"
   2.110  proof (rule eventually_mono)
   2.111    show "\<forall>x. (P x \<longrightarrow> Q x) \<and> P x \<longrightarrow> Q x" by simp
   2.112 -  show "eventually (\<lambda>x. (P x \<longrightarrow> Q x) \<and> P x) net"
   2.113 +  show "eventually (\<lambda>x. (P x \<longrightarrow> Q x) \<and> P x) A"
   2.114      using assms by (rule eventually_conj)
   2.115  qed
   2.116  
   2.117  lemma eventually_rev_mp:
   2.118 -  assumes "eventually (\<lambda>x. P x) net"
   2.119 -  assumes "eventually (\<lambda>x. P x \<longrightarrow> Q x) net"
   2.120 -  shows "eventually (\<lambda>x. Q x) net"
   2.121 +  assumes "eventually (\<lambda>x. P x) A"
   2.122 +  assumes "eventually (\<lambda>x. P x \<longrightarrow> Q x) A"
   2.123 +  shows "eventually (\<lambda>x. Q x) A"
   2.124  using assms(2) assms(1) by (rule eventually_mp)
   2.125  
   2.126  lemma eventually_conj_iff:
   2.127 -  "eventually (\<lambda>x. P x \<and> Q x) net \<longleftrightarrow> eventually P net \<and> eventually Q net"
   2.128 -by (auto intro: eventually_conj elim: eventually_rev_mp)
   2.129 +  "eventually (\<lambda>x. P x \<and> Q x) A \<longleftrightarrow> eventually P A \<and> eventually Q A"
   2.130 +  by (auto intro: eventually_conj elim: eventually_rev_mp)
   2.131  
   2.132  lemma eventually_elim1:
   2.133 -  assumes "eventually (\<lambda>i. P i) net"
   2.134 +  assumes "eventually (\<lambda>i. P i) A"
   2.135    assumes "\<And>i. P i \<Longrightarrow> Q i"
   2.136 -  shows "eventually (\<lambda>i. Q i) net"
   2.137 -using assms by (auto elim!: eventually_rev_mp)
   2.138 +  shows "eventually (\<lambda>i. Q i) A"
   2.139 +  using assms by (auto elim!: eventually_rev_mp)
   2.140  
   2.141  lemma eventually_elim2:
   2.142 -  assumes "eventually (\<lambda>i. P i) net"
   2.143 -  assumes "eventually (\<lambda>i. Q i) net"
   2.144 +  assumes "eventually (\<lambda>i. P i) A"
   2.145 +  assumes "eventually (\<lambda>i. Q i) A"
   2.146    assumes "\<And>i. P i \<Longrightarrow> Q i \<Longrightarrow> R i"
   2.147 -  shows "eventually (\<lambda>i. R i) net"
   2.148 -using assms by (auto elim!: eventually_rev_mp)
   2.149 +  shows "eventually (\<lambda>i. R i) A"
   2.150 +  using assms by (auto elim!: eventually_rev_mp)
   2.151  
   2.152  subsection {* Finer-than relation *}
   2.153  
   2.154 -text {* @{term "net \<le> net'"} means that @{term net} is finer than
   2.155 -@{term net'}. *}
   2.156 +text {* @{term "A \<le> B"} means that filter @{term A} is finer than
   2.157 +filter @{term B}. *}
   2.158  
   2.159 -instantiation net :: (type) complete_lattice
   2.160 +instantiation filter :: (type) complete_lattice
   2.161  begin
   2.162  
   2.163 -definition
   2.164 -  le_net_def: "net \<le> net' \<longleftrightarrow> (\<forall>P. eventually P net' \<longrightarrow> eventually P net)"
   2.165 +definition le_filter_def:
   2.166 +  "A \<le> B \<longleftrightarrow> (\<forall>P. eventually P B \<longrightarrow> eventually P A)"
   2.167  
   2.168  definition
   2.169 -  less_net_def: "(net :: 'a net) < net' \<longleftrightarrow> net \<le> net' \<and> \<not> net' \<le> net"
   2.170 +  "(A :: 'a filter) < B \<longleftrightarrow> A \<le> B \<and> \<not> B \<le> A"
   2.171  
   2.172  definition
   2.173 -  top_net_def: "top = Abs_net (\<lambda>P. \<forall>x. P x)"
   2.174 +  "top = Abs_filter (\<lambda>P. \<forall>x. P x)"
   2.175  
   2.176  definition
   2.177 -  bot_net_def: "bot = Abs_net (\<lambda>P. True)"
   2.178 +  "bot = Abs_filter (\<lambda>P. True)"
   2.179  
   2.180  definition
   2.181 -  sup_net_def: "sup net net' = Abs_net (\<lambda>P. eventually P net \<and> eventually P net')"
   2.182 +  "sup A B = Abs_filter (\<lambda>P. eventually P A \<and> eventually P B)"
   2.183  
   2.184  definition
   2.185 -  inf_net_def: "inf a b = Abs_net
   2.186 -      (\<lambda>P. \<exists>Q R. eventually Q a \<and> eventually R b \<and> (\<forall>x. Q x \<and> R x \<longrightarrow> P x))"
   2.187 +  "inf A B = Abs_filter
   2.188 +      (\<lambda>P. \<exists>Q R. eventually Q A \<and> eventually R B \<and> (\<forall>x. Q x \<and> R x \<longrightarrow> P x))"
   2.189  
   2.190  definition
   2.191 -  Sup_net_def: "Sup A = Abs_net (\<lambda>P. \<forall>net\<in>A. eventually P net)"
   2.192 +  "Sup S = Abs_filter (\<lambda>P. \<forall>A\<in>S. eventually P A)"
   2.193  
   2.194  definition
   2.195 -  Inf_net_def: "Inf A = Sup {x::'a net. \<forall>y\<in>A. x \<le> y}"
   2.196 +  "Inf S = Sup {A::'a filter. \<forall>B\<in>S. A \<le> B}"
   2.197  
   2.198  lemma eventually_top [simp]: "eventually P top \<longleftrightarrow> (\<forall>x. P x)"
   2.199 -unfolding top_net_def
   2.200 -by (rule eventually_Abs_net, rule is_filter.intro, auto)
   2.201 +  unfolding top_filter_def
   2.202 +  by (rule eventually_Abs_filter, rule is_filter.intro, auto)
   2.203  
   2.204  lemma eventually_bot [simp]: "eventually P bot"
   2.205 -unfolding bot_net_def
   2.206 -by (subst eventually_Abs_net, rule is_filter.intro, auto)
   2.207 +  unfolding bot_filter_def
   2.208 +  by (subst eventually_Abs_filter, rule is_filter.intro, auto)
   2.209  
   2.210  lemma eventually_sup:
   2.211 -  "eventually P (sup net net') \<longleftrightarrow> eventually P net \<and> eventually P net'"
   2.212 -unfolding sup_net_def
   2.213 -by (rule eventually_Abs_net, rule is_filter.intro)
   2.214 -   (auto elim!: eventually_rev_mp)
   2.215 +  "eventually P (sup A B) \<longleftrightarrow> eventually P A \<and> eventually P B"
   2.216 +  unfolding sup_filter_def
   2.217 +  by (rule eventually_Abs_filter, rule is_filter.intro)
   2.218 +     (auto elim!: eventually_rev_mp)
   2.219  
   2.220  lemma eventually_inf:
   2.221 -  "eventually P (inf a b) \<longleftrightarrow>
   2.222 -   (\<exists>Q R. eventually Q a \<and> eventually R b \<and> (\<forall>x. Q x \<and> R x \<longrightarrow> P x))"
   2.223 -unfolding inf_net_def
   2.224 -apply (rule eventually_Abs_net, rule is_filter.intro)
   2.225 -apply (fast intro: eventually_True)
   2.226 -apply clarify
   2.227 -apply (intro exI conjI)
   2.228 -apply (erule (1) eventually_conj)
   2.229 -apply (erule (1) eventually_conj)
   2.230 -apply simp
   2.231 -apply auto
   2.232 -done
   2.233 +  "eventually P (inf A B) \<longleftrightarrow>
   2.234 +   (\<exists>Q R. eventually Q A \<and> eventually R B \<and> (\<forall>x. Q x \<and> R x \<longrightarrow> P x))"
   2.235 +  unfolding inf_filter_def
   2.236 +  apply (rule eventually_Abs_filter, rule is_filter.intro)
   2.237 +  apply (fast intro: eventually_True)
   2.238 +  apply clarify
   2.239 +  apply (intro exI conjI)
   2.240 +  apply (erule (1) eventually_conj)
   2.241 +  apply (erule (1) eventually_conj)
   2.242 +  apply simp
   2.243 +  apply auto
   2.244 +  done
   2.245  
   2.246  lemma eventually_Sup:
   2.247 -  "eventually P (Sup A) \<longleftrightarrow> (\<forall>net\<in>A. eventually P net)"
   2.248 -unfolding Sup_net_def
   2.249 -apply (rule eventually_Abs_net, rule is_filter.intro)
   2.250 -apply (auto intro: eventually_conj elim!: eventually_rev_mp)
   2.251 -done
   2.252 +  "eventually P (Sup S) \<longleftrightarrow> (\<forall>A\<in>S. eventually P A)"
   2.253 +  unfolding Sup_filter_def
   2.254 +  apply (rule eventually_Abs_filter, rule is_filter.intro)
   2.255 +  apply (auto intro: eventually_conj elim!: eventually_rev_mp)
   2.256 +  done
   2.257  
   2.258  instance proof
   2.259 -  fix x y :: "'a net" show "x < y \<longleftrightarrow> x \<le> y \<and> \<not> y \<le> x"
   2.260 -    by (rule less_net_def)
   2.261 +  fix A B :: "'a filter" show "A < B \<longleftrightarrow> A \<le> B \<and> \<not> B \<le> A"
   2.262 +    by (rule less_filter_def)
   2.263  next
   2.264 -  fix x :: "'a net" show "x \<le> x"
   2.265 -    unfolding le_net_def by simp
   2.266 +  fix A :: "'a filter" show "A \<le> A"
   2.267 +    unfolding le_filter_def by simp
   2.268  next
   2.269 -  fix x y z :: "'a net" assume "x \<le> y" and "y \<le> z" thus "x \<le> z"
   2.270 -    unfolding le_net_def by simp
   2.271 +  fix A B C :: "'a filter" assume "A \<le> B" and "B \<le> C" thus "A \<le> C"
   2.272 +    unfolding le_filter_def by simp
   2.273  next
   2.274 -  fix x y :: "'a net" assume "x \<le> y" and "y \<le> x" thus "x = y"
   2.275 -    unfolding le_net_def expand_net_eq by fast
   2.276 +  fix A B :: "'a filter" assume "A \<le> B" and "B \<le> A" thus "A = B"
   2.277 +    unfolding le_filter_def filter_eq_iff by fast
   2.278  next
   2.279 -  fix x :: "'a net" show "x \<le> top"
   2.280 -    unfolding le_net_def eventually_top by (simp add: always_eventually)
   2.281 +  fix A :: "'a filter" show "A \<le> top"
   2.282 +    unfolding le_filter_def eventually_top by (simp add: always_eventually)
   2.283  next
   2.284 -  fix x :: "'a net" show "bot \<le> x"
   2.285 -    unfolding le_net_def by simp
   2.286 +  fix A :: "'a filter" show "bot \<le> A"
   2.287 +    unfolding le_filter_def by simp
   2.288  next
   2.289 -  fix x y :: "'a net" show "x \<le> sup x y" and "y \<le> sup x y"
   2.290 -    unfolding le_net_def eventually_sup by simp_all
   2.291 +  fix A B :: "'a filter" show "A \<le> sup A B" and "B \<le> sup A B"
   2.292 +    unfolding le_filter_def eventually_sup by simp_all
   2.293  next
   2.294 -  fix x y z :: "'a net" assume "x \<le> z" and "y \<le> z" thus "sup x y \<le> z"
   2.295 -    unfolding le_net_def eventually_sup by simp
   2.296 +  fix A B C :: "'a filter" assume "A \<le> C" and "B \<le> C" thus "sup A B \<le> C"
   2.297 +    unfolding le_filter_def eventually_sup by simp
   2.298  next
   2.299 -  fix x y :: "'a net" show "inf x y \<le> x" and "inf x y \<le> y"
   2.300 -    unfolding le_net_def eventually_inf by (auto intro: eventually_True)
   2.301 +  fix A B :: "'a filter" show "inf A B \<le> A" and "inf A B \<le> B"
   2.302 +    unfolding le_filter_def eventually_inf by (auto intro: eventually_True)
   2.303  next
   2.304 -  fix x y z :: "'a net" assume "x \<le> y" and "x \<le> z" thus "x \<le> inf y z"
   2.305 -    unfolding le_net_def eventually_inf
   2.306 +  fix A B C :: "'a filter" assume "A \<le> B" and "A \<le> C" thus "A \<le> inf B C"
   2.307 +    unfolding le_filter_def eventually_inf
   2.308      by (auto elim!: eventually_mono intro: eventually_conj)
   2.309  next
   2.310 -  fix x :: "'a net" and A assume "x \<in> A" thus "x \<le> Sup A"
   2.311 -    unfolding le_net_def eventually_Sup by simp
   2.312 +  fix A :: "'a filter" and S assume "A \<in> S" thus "A \<le> Sup S"
   2.313 +    unfolding le_filter_def eventually_Sup by simp
   2.314  next
   2.315 -  fix A and y :: "'a net" assume "\<And>x. x \<in> A \<Longrightarrow> x \<le> y" thus "Sup A \<le> y"
   2.316 -    unfolding le_net_def eventually_Sup by simp
   2.317 +  fix S and B :: "'a filter" assume "\<And>A. A \<in> S \<Longrightarrow> A \<le> B" thus "Sup S \<le> B"
   2.318 +    unfolding le_filter_def eventually_Sup by simp
   2.319  next
   2.320 -  fix z :: "'a net" and A assume "z \<in> A" thus "Inf A \<le> z"
   2.321 -    unfolding le_net_def Inf_net_def eventually_Sup Ball_def by simp
   2.322 +  fix C :: "'a filter" and S assume "C \<in> S" thus "Inf S \<le> C"
   2.323 +    unfolding le_filter_def Inf_filter_def eventually_Sup Ball_def by simp
   2.324  next
   2.325 -  fix A and x :: "'a net" assume "\<And>y. y \<in> A \<Longrightarrow> x \<le> y" thus "x \<le> Inf A"
   2.326 -    unfolding le_net_def Inf_net_def eventually_Sup Ball_def by simp
   2.327 +  fix S and A :: "'a filter" assume "\<And>B. B \<in> S \<Longrightarrow> A \<le> B" thus "A \<le> Inf S"
   2.328 +    unfolding le_filter_def Inf_filter_def eventually_Sup Ball_def by simp
   2.329  qed
   2.330  
   2.331  end
   2.332  
   2.333 -lemma net_leD:
   2.334 -  "net \<le> net' \<Longrightarrow> eventually P net' \<Longrightarrow> eventually P net"
   2.335 -unfolding le_net_def by simp
   2.336 +lemma filter_leD:
   2.337 +  "A \<le> B \<Longrightarrow> eventually P B \<Longrightarrow> eventually P A"
   2.338 +  unfolding le_filter_def by simp
   2.339  
   2.340 -lemma net_leI:
   2.341 -  "(\<And>P. eventually P net' \<Longrightarrow> eventually P net) \<Longrightarrow> net \<le> net'"
   2.342 -unfolding le_net_def by simp
   2.343 +lemma filter_leI:
   2.344 +  "(\<And>P. eventually P B \<Longrightarrow> eventually P A) \<Longrightarrow> A \<le> B"
   2.345 +  unfolding le_filter_def by simp
   2.346  
   2.347  lemma eventually_False:
   2.348 -  "eventually (\<lambda>x. False) net \<longleftrightarrow> net = bot"
   2.349 -unfolding expand_net_eq by (auto elim: eventually_rev_mp)
   2.350 +  "eventually (\<lambda>x. False) A \<longleftrightarrow> A = bot"
   2.351 +  unfolding filter_eq_iff by (auto elim: eventually_rev_mp)
   2.352  
   2.353 -subsection {* Map function for nets *}
   2.354 +subsection {* Map function for filters *}
   2.355  
   2.356 -definition netmap :: "('a \<Rightarrow> 'b) \<Rightarrow> 'a net \<Rightarrow> 'b net" where
   2.357 -  "netmap f net = Abs_net (\<lambda>P. eventually (\<lambda>x. P (f x)) net)"
   2.358 +definition filtermap :: "('a \<Rightarrow> 'b) \<Rightarrow> 'a filter \<Rightarrow> 'b filter"
   2.359 +  where "filtermap f A = Abs_filter (\<lambda>P. eventually (\<lambda>x. P (f x)) A)"
   2.360  
   2.361 -lemma eventually_netmap:
   2.362 -  "eventually P (netmap f net) = eventually (\<lambda>x. P (f x)) net"
   2.363 -unfolding netmap_def
   2.364 -apply (rule eventually_Abs_net)
   2.365 -apply (rule is_filter.intro)
   2.366 -apply (auto elim!: eventually_rev_mp)
   2.367 -done
   2.368 +lemma eventually_filtermap:
   2.369 +  "eventually P (filtermap f A) = eventually (\<lambda>x. P (f x)) A"
   2.370 +  unfolding filtermap_def
   2.371 +  apply (rule eventually_Abs_filter)
   2.372 +  apply (rule is_filter.intro)
   2.373 +  apply (auto elim!: eventually_rev_mp)
   2.374 +  done
   2.375  
   2.376 -lemma netmap_ident: "netmap (\<lambda>x. x) net = net"
   2.377 -by (simp add: expand_net_eq eventually_netmap)
   2.378 -
   2.379 -lemma netmap_netmap: "netmap f (netmap g net) = netmap (\<lambda>x. f (g x)) net"
   2.380 -by (simp add: expand_net_eq eventually_netmap)
   2.381 +lemma filtermap_ident: "filtermap (\<lambda>x. x) A = A"
   2.382 +  by (simp add: filter_eq_iff eventually_filtermap)
   2.383  
   2.384 -lemma netmap_mono: "net \<le> net' \<Longrightarrow> netmap f net \<le> netmap f net'"
   2.385 -unfolding le_net_def eventually_netmap by simp
   2.386 +lemma filtermap_filtermap:
   2.387 +  "filtermap f (filtermap g A) = filtermap (\<lambda>x. f (g x)) A"
   2.388 +  by (simp add: filter_eq_iff eventually_filtermap)
   2.389  
   2.390 -lemma netmap_bot [simp]: "netmap f bot = bot"
   2.391 -by (simp add: expand_net_eq eventually_netmap)
   2.392 +lemma filtermap_mono: "A \<le> B \<Longrightarrow> filtermap f A \<le> filtermap f B"
   2.393 +  unfolding le_filter_def eventually_filtermap by simp
   2.394 +
   2.395 +lemma filtermap_bot [simp]: "filtermap f bot = bot"
   2.396 +  by (simp add: filter_eq_iff eventually_filtermap)
   2.397  
   2.398  
   2.399  subsection {* Sequentially *}
   2.400  
   2.401 -definition sequentially :: "nat net" where
   2.402 -  "sequentially = Abs_net (\<lambda>P. \<exists>k. \<forall>n\<ge>k. P n)"
   2.403 +definition sequentially :: "nat filter"
   2.404 +  where "sequentially = Abs_filter (\<lambda>P. \<exists>k. \<forall>n\<ge>k. P n)"
   2.405  
   2.406  lemma eventually_sequentially:
   2.407    "eventually P sequentially \<longleftrightarrow> (\<exists>N. \<forall>n\<ge>N. P n)"
   2.408  unfolding sequentially_def
   2.409 -proof (rule eventually_Abs_net, rule is_filter.intro)
   2.410 +proof (rule eventually_Abs_filter, rule is_filter.intro)
   2.411    fix P Q :: "nat \<Rightarrow> bool"
   2.412    assume "\<exists>i. \<forall>n\<ge>i. P n" and "\<exists>j. \<forall>n\<ge>j. Q n"
   2.413    then obtain i j where "\<forall>n\<ge>i. P n" and "\<forall>n\<ge>j. Q n" by auto
   2.414 @@ -273,49 +272,48 @@
   2.415  qed auto
   2.416  
   2.417  lemma sequentially_bot [simp]: "sequentially \<noteq> bot"
   2.418 -unfolding expand_net_eq eventually_sequentially by auto
   2.419 +  unfolding filter_eq_iff eventually_sequentially by auto
   2.420  
   2.421  lemma eventually_False_sequentially [simp]:
   2.422    "\<not> eventually (\<lambda>n. False) sequentially"
   2.423 -by (simp add: eventually_False)
   2.424 +  by (simp add: eventually_False)
   2.425  
   2.426  lemma le_sequentially:
   2.427 -  "net \<le> sequentially \<longleftrightarrow> (\<forall>N. eventually (\<lambda>n. N \<le> n) net)"
   2.428 -unfolding le_net_def eventually_sequentially
   2.429 -by (safe, fast, drule_tac x=N in spec, auto elim: eventually_rev_mp)
   2.430 +  "A \<le> sequentially \<longleftrightarrow> (\<forall>N. eventually (\<lambda>n. N \<le> n) A)"
   2.431 +  unfolding le_filter_def eventually_sequentially
   2.432 +  by (safe, fast, drule_tac x=N in spec, auto elim: eventually_rev_mp)
   2.433  
   2.434  
   2.435 -definition
   2.436 -  trivial_limit :: "'a net \<Rightarrow> bool" where
   2.437 -  "trivial_limit net \<longleftrightarrow> eventually (\<lambda>x. False) net"
   2.438 +definition trivial_limit :: "'a filter \<Rightarrow> bool"
   2.439 +  where "trivial_limit A \<longleftrightarrow> eventually (\<lambda>x. False) A"
   2.440  
   2.441 -lemma trivial_limit_sequentially[intro]: "\<not> trivial_limit sequentially"
   2.442 +lemma trivial_limit_sequentially [intro]: "\<not> trivial_limit sequentially"
   2.443    by (auto simp add: trivial_limit_def eventually_sequentially)
   2.444  
   2.445 -subsection {* Standard Nets *}
   2.446 +subsection {* Standard filters *}
   2.447  
   2.448 -definition within :: "'a net \<Rightarrow> 'a set \<Rightarrow> 'a net" (infixr "within" 70) where
   2.449 -  "net within S = Abs_net (\<lambda>P. eventually (\<lambda>x. x \<in> S \<longrightarrow> P x) net)"
   2.450 +definition within :: "'a filter \<Rightarrow> 'a set \<Rightarrow> 'a filter" (infixr "within" 70)
   2.451 +  where "A within S = Abs_filter (\<lambda>P. eventually (\<lambda>x. x \<in> S \<longrightarrow> P x) A)"
   2.452  
   2.453 -definition nhds :: "'a::topological_space \<Rightarrow> 'a net" where
   2.454 -  "nhds a = Abs_net (\<lambda>P. \<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x))"
   2.455 +definition nhds :: "'a::topological_space \<Rightarrow> 'a filter"
   2.456 +  where "nhds a = Abs_filter (\<lambda>P. \<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x))"
   2.457  
   2.458 -definition at :: "'a::topological_space \<Rightarrow> 'a net" where
   2.459 -  "at a = nhds a within - {a}"
   2.460 +definition at :: "'a::topological_space \<Rightarrow> 'a filter"
   2.461 +  where "at a = nhds a within - {a}"
   2.462  
   2.463  lemma eventually_within:
   2.464 -  "eventually P (net within S) = eventually (\<lambda>x. x \<in> S \<longrightarrow> P x) net"
   2.465 -unfolding within_def
   2.466 -by (rule eventually_Abs_net, rule is_filter.intro)
   2.467 -   (auto elim!: eventually_rev_mp)
   2.468 +  "eventually P (A within S) = eventually (\<lambda>x. x \<in> S \<longrightarrow> P x) A"
   2.469 +  unfolding within_def
   2.470 +  by (rule eventually_Abs_filter, rule is_filter.intro)
   2.471 +     (auto elim!: eventually_rev_mp)
   2.472  
   2.473 -lemma within_UNIV: "net within UNIV = net"
   2.474 -  unfolding expand_net_eq eventually_within by simp
   2.475 +lemma within_UNIV: "A within UNIV = A"
   2.476 +  unfolding filter_eq_iff eventually_within by simp
   2.477  
   2.478  lemma eventually_nhds:
   2.479    "eventually P (nhds a) \<longleftrightarrow> (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x))"
   2.480  unfolding nhds_def
   2.481 -proof (rule eventually_Abs_net, rule is_filter.intro)
   2.482 +proof (rule eventually_Abs_filter, rule is_filter.intro)
   2.483    have "open UNIV \<and> a \<in> UNIV \<and> (\<forall>x\<in>UNIV. True)" by simp
   2.484    thus "\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. True)" by - rule
   2.485  next
   2.486 @@ -354,52 +352,52 @@
   2.487  
   2.488  subsection {* Boundedness *}
   2.489  
   2.490 -definition Bfun :: "('a \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a net \<Rightarrow> bool" where
   2.491 -  "Bfun f net = (\<exists>K>0. eventually (\<lambda>x. norm (f x) \<le> K) net)"
   2.492 +definition Bfun :: "('a \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a filter \<Rightarrow> bool"
   2.493 +  where "Bfun f A = (\<exists>K>0. eventually (\<lambda>x. norm (f x) \<le> K) A)"
   2.494  
   2.495  lemma BfunI:
   2.496 -  assumes K: "eventually (\<lambda>x. norm (f x) \<le> K) net" shows "Bfun f net"
   2.497 +  assumes K: "eventually (\<lambda>x. norm (f x) \<le> K) A" shows "Bfun f A"
   2.498  unfolding Bfun_def
   2.499  proof (intro exI conjI allI)
   2.500    show "0 < max K 1" by simp
   2.501  next
   2.502 -  show "eventually (\<lambda>x. norm (f x) \<le> max K 1) net"
   2.503 +  show "eventually (\<lambda>x. norm (f x) \<le> max K 1) A"
   2.504      using K by (rule eventually_elim1, simp)
   2.505  qed
   2.506  
   2.507  lemma BfunE:
   2.508 -  assumes "Bfun f net"
   2.509 -  obtains B where "0 < B" and "eventually (\<lambda>x. norm (f x) \<le> B) net"
   2.510 +  assumes "Bfun f A"
   2.511 +  obtains B where "0 < B" and "eventually (\<lambda>x. norm (f x) \<le> B) A"
   2.512  using assms unfolding Bfun_def by fast
   2.513  
   2.514  
   2.515  subsection {* Convergence to Zero *}
   2.516  
   2.517 -definition Zfun :: "('a \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a net \<Rightarrow> bool" where
   2.518 -  "Zfun f net = (\<forall>r>0. eventually (\<lambda>x. norm (f x) < r) net)"
   2.519 +definition Zfun :: "('a \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a filter \<Rightarrow> bool"
   2.520 +  where "Zfun f A = (\<forall>r>0. eventually (\<lambda>x. norm (f x) < r) A)"
   2.521  
   2.522  lemma ZfunI:
   2.523 -  "(\<And>r. 0 < r \<Longrightarrow> eventually (\<lambda>x. norm (f x) < r) net) \<Longrightarrow> Zfun f net"
   2.524 -unfolding Zfun_def by simp
   2.525 +  "(\<And>r. 0 < r \<Longrightarrow> eventually (\<lambda>x. norm (f x) < r) A) \<Longrightarrow> Zfun f A"
   2.526 +  unfolding Zfun_def by simp
   2.527  
   2.528  lemma ZfunD:
   2.529 -  "\<lbrakk>Zfun f net; 0 < r\<rbrakk> \<Longrightarrow> eventually (\<lambda>x. norm (f x) < r) net"
   2.530 -unfolding Zfun_def by simp
   2.531 +  "\<lbrakk>Zfun f A; 0 < r\<rbrakk> \<Longrightarrow> eventually (\<lambda>x. norm (f x) < r) A"
   2.532 +  unfolding Zfun_def by simp
   2.533  
   2.534  lemma Zfun_ssubst:
   2.535 -  "eventually (\<lambda>x. f x = g x) net \<Longrightarrow> Zfun g net \<Longrightarrow> Zfun f net"
   2.536 -unfolding Zfun_def by (auto elim!: eventually_rev_mp)
   2.537 +  "eventually (\<lambda>x. f x = g x) A \<Longrightarrow> Zfun g A \<Longrightarrow> Zfun f A"
   2.538 +  unfolding Zfun_def by (auto elim!: eventually_rev_mp)
   2.539  
   2.540 -lemma Zfun_zero: "Zfun (\<lambda>x. 0) net"
   2.541 -unfolding Zfun_def by simp
   2.542 +lemma Zfun_zero: "Zfun (\<lambda>x. 0) A"
   2.543 +  unfolding Zfun_def by simp
   2.544  
   2.545 -lemma Zfun_norm_iff: "Zfun (\<lambda>x. norm (f x)) net = Zfun (\<lambda>x. f x) net"
   2.546 -unfolding Zfun_def by simp
   2.547 +lemma Zfun_norm_iff: "Zfun (\<lambda>x. norm (f x)) A = Zfun (\<lambda>x. f x) A"
   2.548 +  unfolding Zfun_def by simp
   2.549  
   2.550  lemma Zfun_imp_Zfun:
   2.551 -  assumes f: "Zfun f net"
   2.552 -  assumes g: "eventually (\<lambda>x. norm (g x) \<le> norm (f x) * K) net"
   2.553 -  shows "Zfun (\<lambda>x. g x) net"
   2.554 +  assumes f: "Zfun f A"
   2.555 +  assumes g: "eventually (\<lambda>x. norm (g x) \<le> norm (f x) * K) A"
   2.556 +  shows "Zfun (\<lambda>x. g x) A"
   2.557  proof (cases)
   2.558    assume K: "0 < K"
   2.559    show ?thesis
   2.560 @@ -407,9 +405,9 @@
   2.561      fix r::real assume "0 < r"
   2.562      hence "0 < r / K"
   2.563        using K by (rule divide_pos_pos)
   2.564 -    then have "eventually (\<lambda>x. norm (f x) < r / K) net"
   2.565 +    then have "eventually (\<lambda>x. norm (f x) < r / K) A"
   2.566        using ZfunD [OF f] by fast
   2.567 -    with g show "eventually (\<lambda>x. norm (g x) < r) net"
   2.568 +    with g show "eventually (\<lambda>x. norm (g x) < r) A"
   2.569      proof (rule eventually_elim2)
   2.570        fix x
   2.571        assume *: "norm (g x) \<le> norm (f x) * K"
   2.572 @@ -427,7 +425,7 @@
   2.573    proof (rule ZfunI)
   2.574      fix r :: real
   2.575      assume "0 < r"
   2.576 -    from g show "eventually (\<lambda>x. norm (g x) < r) net"
   2.577 +    from g show "eventually (\<lambda>x. norm (g x) < r) A"
   2.578      proof (rule eventually_elim1)
   2.579        fix x
   2.580        assume "norm (g x) \<le> norm (f x) * K"
   2.581 @@ -439,22 +437,22 @@
   2.582    qed
   2.583  qed
   2.584  
   2.585 -lemma Zfun_le: "\<lbrakk>Zfun g net; \<forall>x. norm (f x) \<le> norm (g x)\<rbrakk> \<Longrightarrow> Zfun f net"
   2.586 -by (erule_tac K="1" in Zfun_imp_Zfun, simp)
   2.587 +lemma Zfun_le: "\<lbrakk>Zfun g A; \<forall>x. norm (f x) \<le> norm (g x)\<rbrakk> \<Longrightarrow> Zfun f A"
   2.588 +  by (erule_tac K="1" in Zfun_imp_Zfun, simp)
   2.589  
   2.590  lemma Zfun_add:
   2.591 -  assumes f: "Zfun f net" and g: "Zfun g net"
   2.592 -  shows "Zfun (\<lambda>x. f x + g x) net"
   2.593 +  assumes f: "Zfun f A" and g: "Zfun g A"
   2.594 +  shows "Zfun (\<lambda>x. f x + g x) A"
   2.595  proof (rule ZfunI)
   2.596    fix r::real assume "0 < r"
   2.597    hence r: "0 < r / 2" by simp
   2.598 -  have "eventually (\<lambda>x. norm (f x) < r/2) net"
   2.599 +  have "eventually (\<lambda>x. norm (f x) < r/2) A"
   2.600      using f r by (rule ZfunD)
   2.601    moreover
   2.602 -  have "eventually (\<lambda>x. norm (g x) < r/2) net"
   2.603 +  have "eventually (\<lambda>x. norm (g x) < r/2) A"
   2.604      using g r by (rule ZfunD)
   2.605    ultimately
   2.606 -  show "eventually (\<lambda>x. norm (f x + g x) < r) net"
   2.607 +  show "eventually (\<lambda>x. norm (f x + g x) < r) A"
   2.608    proof (rule eventually_elim2)
   2.609      fix x
   2.610      assume *: "norm (f x) < r/2" "norm (g x) < r/2"
   2.611 @@ -467,28 +465,28 @@
   2.612    qed
   2.613  qed
   2.614  
   2.615 -lemma Zfun_minus: "Zfun f net \<Longrightarrow> Zfun (\<lambda>x. - f x) net"
   2.616 -unfolding Zfun_def by simp
   2.617 +lemma Zfun_minus: "Zfun f A \<Longrightarrow> Zfun (\<lambda>x. - f x) A"
   2.618 +  unfolding Zfun_def by simp
   2.619  
   2.620 -lemma Zfun_diff: "\<lbrakk>Zfun f net; Zfun g net\<rbrakk> \<Longrightarrow> Zfun (\<lambda>x. f x - g x) net"
   2.621 -by (simp only: diff_minus Zfun_add Zfun_minus)
   2.622 +lemma Zfun_diff: "\<lbrakk>Zfun f A; Zfun g A\<rbrakk> \<Longrightarrow> Zfun (\<lambda>x. f x - g x) A"
   2.623 +  by (simp only: diff_minus Zfun_add Zfun_minus)
   2.624  
   2.625  lemma (in bounded_linear) Zfun:
   2.626 -  assumes g: "Zfun g net"
   2.627 -  shows "Zfun (\<lambda>x. f (g x)) net"
   2.628 +  assumes g: "Zfun g A"
   2.629 +  shows "Zfun (\<lambda>x. f (g x)) A"
   2.630  proof -
   2.631    obtain K where "\<And>x. norm (f x) \<le> norm x * K"
   2.632      using bounded by fast
   2.633 -  then have "eventually (\<lambda>x. norm (f (g x)) \<le> norm (g x) * K) net"
   2.634 +  then have "eventually (\<lambda>x. norm (f (g x)) \<le> norm (g x) * K) A"
   2.635      by simp
   2.636    with g show ?thesis
   2.637      by (rule Zfun_imp_Zfun)
   2.638  qed
   2.639  
   2.640  lemma (in bounded_bilinear) Zfun:
   2.641 -  assumes f: "Zfun f net"
   2.642 -  assumes g: "Zfun g net"
   2.643 -  shows "Zfun (\<lambda>x. f x ** g x) net"
   2.644 +  assumes f: "Zfun f A"
   2.645 +  assumes g: "Zfun g A"
   2.646 +  shows "Zfun (\<lambda>x. f x ** g x) A"
   2.647  proof (rule ZfunI)
   2.648    fix r::real assume r: "0 < r"
   2.649    obtain K where K: "0 < K"
   2.650 @@ -496,13 +494,13 @@
   2.651      using pos_bounded by fast
   2.652    from K have K': "0 < inverse K"
   2.653      by (rule positive_imp_inverse_positive)
   2.654 -  have "eventually (\<lambda>x. norm (f x) < r) net"
   2.655 +  have "eventually (\<lambda>x. norm (f x) < r) A"
   2.656      using f r by (rule ZfunD)
   2.657    moreover
   2.658 -  have "eventually (\<lambda>x. norm (g x) < inverse K) net"
   2.659 +  have "eventually (\<lambda>x. norm (g x) < inverse K) A"
   2.660      using g K' by (rule ZfunD)
   2.661    ultimately
   2.662 -  show "eventually (\<lambda>x. norm (f x ** g x) < r) net"
   2.663 +  show "eventually (\<lambda>x. norm (f x ** g x) < r) A"
   2.664    proof (rule eventually_elim2)
   2.665      fix x
   2.666      assume *: "norm (f x) < r" "norm (g x) < inverse K"
   2.667 @@ -517,12 +515,12 @@
   2.668  qed
   2.669  
   2.670  lemma (in bounded_bilinear) Zfun_left:
   2.671 -  "Zfun f net \<Longrightarrow> Zfun (\<lambda>x. f x ** a) net"
   2.672 -by (rule bounded_linear_left [THEN bounded_linear.Zfun])
   2.673 +  "Zfun f A \<Longrightarrow> Zfun (\<lambda>x. f x ** a) A"
   2.674 +  by (rule bounded_linear_left [THEN bounded_linear.Zfun])
   2.675  
   2.676  lemma (in bounded_bilinear) Zfun_right:
   2.677 -  "Zfun f net \<Longrightarrow> Zfun (\<lambda>x. a ** f x) net"
   2.678 -by (rule bounded_linear_right [THEN bounded_linear.Zfun])
   2.679 +  "Zfun f A \<Longrightarrow> Zfun (\<lambda>x. a ** f x) A"
   2.680 +  by (rule bounded_linear_right [THEN bounded_linear.Zfun])
   2.681  
   2.682  lemmas Zfun_mult = mult.Zfun
   2.683  lemmas Zfun_mult_right = mult.Zfun_right
   2.684 @@ -531,9 +529,9 @@
   2.685  
   2.686  subsection {* Limits *}
   2.687  
   2.688 -definition tendsto :: "('a \<Rightarrow> 'b::topological_space) \<Rightarrow> 'b \<Rightarrow> 'a net \<Rightarrow> bool"
   2.689 +definition tendsto :: "('a \<Rightarrow> 'b::topological_space) \<Rightarrow> 'b \<Rightarrow> 'a filter \<Rightarrow> bool"
   2.690      (infixr "--->" 55) where
   2.691 -  "(f ---> l) net \<longleftrightarrow> (\<forall>S. open S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) net)"
   2.692 +  "(f ---> l) A \<longleftrightarrow> (\<forall>S. open S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) A)"
   2.693  
   2.694  ML {*
   2.695  structure Tendsto_Intros = Named_Thms
   2.696 @@ -545,74 +543,74 @@
   2.697  
   2.698  setup Tendsto_Intros.setup
   2.699  
   2.700 -lemma tendsto_mono: "net \<le> net' \<Longrightarrow> (f ---> l) net' \<Longrightarrow> (f ---> l) net"
   2.701 -unfolding tendsto_def le_net_def by fast
   2.702 +lemma tendsto_mono: "A \<le> A' \<Longrightarrow> (f ---> l) A' \<Longrightarrow> (f ---> l) A"
   2.703 +  unfolding tendsto_def le_filter_def by fast
   2.704  
   2.705  lemma topological_tendstoI:
   2.706 -  "(\<And>S. open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>x. f x \<in> S) net)
   2.707 -    \<Longrightarrow> (f ---> l) net"
   2.708 +  "(\<And>S. open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>x. f x \<in> S) A)
   2.709 +    \<Longrightarrow> (f ---> l) A"
   2.710    unfolding tendsto_def by auto
   2.711  
   2.712  lemma topological_tendstoD:
   2.713 -  "(f ---> l) net \<Longrightarrow> open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>x. f x \<in> S) net"
   2.714 +  "(f ---> l) A \<Longrightarrow> open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>x. f x \<in> S) A"
   2.715    unfolding tendsto_def by auto
   2.716  
   2.717  lemma tendstoI:
   2.718 -  assumes "\<And>e. 0 < e \<Longrightarrow> eventually (\<lambda>x. dist (f x) l < e) net"
   2.719 -  shows "(f ---> l) net"
   2.720 -apply (rule topological_tendstoI)
   2.721 -apply (simp add: open_dist)
   2.722 -apply (drule (1) bspec, clarify)
   2.723 -apply (drule assms)
   2.724 -apply (erule eventually_elim1, simp)
   2.725 -done
   2.726 +  assumes "\<And>e. 0 < e \<Longrightarrow> eventually (\<lambda>x. dist (f x) l < e) A"
   2.727 +  shows "(f ---> l) A"
   2.728 +  apply (rule topological_tendstoI)
   2.729 +  apply (simp add: open_dist)
   2.730 +  apply (drule (1) bspec, clarify)
   2.731 +  apply (drule assms)
   2.732 +  apply (erule eventually_elim1, simp)
   2.733 +  done
   2.734  
   2.735  lemma tendstoD:
   2.736 -  "(f ---> l) net \<Longrightarrow> 0 < e \<Longrightarrow> eventually (\<lambda>x. dist (f x) l < e) net"
   2.737 -apply (drule_tac S="{x. dist x l < e}" in topological_tendstoD)
   2.738 -apply (clarsimp simp add: open_dist)
   2.739 -apply (rule_tac x="e - dist x l" in exI, clarsimp)
   2.740 -apply (simp only: less_diff_eq)
   2.741 -apply (erule le_less_trans [OF dist_triangle])
   2.742 -apply simp
   2.743 -apply simp
   2.744 -done
   2.745 +  "(f ---> l) A \<Longrightarrow> 0 < e \<Longrightarrow> eventually (\<lambda>x. dist (f x) l < e) A"
   2.746 +  apply (drule_tac S="{x. dist x l < e}" in topological_tendstoD)
   2.747 +  apply (clarsimp simp add: open_dist)
   2.748 +  apply (rule_tac x="e - dist x l" in exI, clarsimp)
   2.749 +  apply (simp only: less_diff_eq)
   2.750 +  apply (erule le_less_trans [OF dist_triangle])
   2.751 +  apply simp
   2.752 +  apply simp
   2.753 +  done
   2.754  
   2.755  lemma tendsto_iff:
   2.756 -  "(f ---> l) net \<longleftrightarrow> (\<forall>e>0. eventually (\<lambda>x. dist (f x) l < e) net)"
   2.757 -using tendstoI tendstoD by fast
   2.758 +  "(f ---> l) A \<longleftrightarrow> (\<forall>e>0. eventually (\<lambda>x. dist (f x) l < e) A)"
   2.759 +  using tendstoI tendstoD by fast
   2.760  
   2.761 -lemma tendsto_Zfun_iff: "(f ---> a) net = Zfun (\<lambda>x. f x - a) net"
   2.762 -by (simp only: tendsto_iff Zfun_def dist_norm)
   2.763 +lemma tendsto_Zfun_iff: "(f ---> a) A = Zfun (\<lambda>x. f x - a) A"
   2.764 +  by (simp only: tendsto_iff Zfun_def dist_norm)
   2.765  
   2.766  lemma tendsto_ident_at [tendsto_intros]: "((\<lambda>x. x) ---> a) (at a)"
   2.767 -unfolding tendsto_def eventually_at_topological by auto
   2.768 +  unfolding tendsto_def eventually_at_topological by auto
   2.769  
   2.770  lemma tendsto_ident_at_within [tendsto_intros]:
   2.771    "((\<lambda>x. x) ---> a) (at a within S)"
   2.772 -unfolding tendsto_def eventually_within eventually_at_topological by auto
   2.773 +  unfolding tendsto_def eventually_within eventually_at_topological by auto
   2.774  
   2.775 -lemma tendsto_const [tendsto_intros]: "((\<lambda>x. k) ---> k) net"
   2.776 -by (simp add: tendsto_def)
   2.777 +lemma tendsto_const [tendsto_intros]: "((\<lambda>x. k) ---> k) A"
   2.778 +  by (simp add: tendsto_def)
   2.779  
   2.780  lemma tendsto_const_iff:
   2.781    fixes k l :: "'a::metric_space"
   2.782 -  assumes "net \<noteq> bot" shows "((\<lambda>n. k) ---> l) net \<longleftrightarrow> k = l"
   2.783 -apply (safe intro!: tendsto_const)
   2.784 -apply (rule ccontr)
   2.785 -apply (drule_tac e="dist k l" in tendstoD)
   2.786 -apply (simp add: zero_less_dist_iff)
   2.787 -apply (simp add: eventually_False assms)
   2.788 -done
   2.789 +  assumes "A \<noteq> bot" shows "((\<lambda>n. k) ---> l) A \<longleftrightarrow> k = l"
   2.790 +  apply (safe intro!: tendsto_const)
   2.791 +  apply (rule ccontr)
   2.792 +  apply (drule_tac e="dist k l" in tendstoD)
   2.793 +  apply (simp add: zero_less_dist_iff)
   2.794 +  apply (simp add: eventually_False assms)
   2.795 +  done
   2.796  
   2.797  lemma tendsto_dist [tendsto_intros]:
   2.798 -  assumes f: "(f ---> l) net" and g: "(g ---> m) net"
   2.799 -  shows "((\<lambda>x. dist (f x) (g x)) ---> dist l m) net"
   2.800 +  assumes f: "(f ---> l) A" and g: "(g ---> m) A"
   2.801 +  shows "((\<lambda>x. dist (f x) (g x)) ---> dist l m) A"
   2.802  proof (rule tendstoI)
   2.803    fix e :: real assume "0 < e"
   2.804    hence e2: "0 < e/2" by simp
   2.805    from tendstoD [OF f e2] tendstoD [OF g e2]
   2.806 -  show "eventually (\<lambda>x. dist (dist (f x) (g x)) (dist l m) < e) net"
   2.807 +  show "eventually (\<lambda>x. dist (dist (f x) (g x)) (dist l m) < e) A"
   2.808    proof (rule eventually_elim2)
   2.809      fix x assume "dist (f x) l < e/2" "dist (g x) m < e/2"
   2.810      then show "dist (dist (f x) (g x)) (dist l m) < e"
   2.811 @@ -626,48 +624,48 @@
   2.812  qed
   2.813  
   2.814  lemma norm_conv_dist: "norm x = dist x 0"
   2.815 -unfolding dist_norm by simp
   2.816 +  unfolding dist_norm by simp
   2.817  
   2.818  lemma tendsto_norm [tendsto_intros]:
   2.819 -  "(f ---> a) net \<Longrightarrow> ((\<lambda>x. norm (f x)) ---> norm a) net"
   2.820 -unfolding norm_conv_dist by (intro tendsto_intros)
   2.821 +  "(f ---> a) A \<Longrightarrow> ((\<lambda>x. norm (f x)) ---> norm a) A"
   2.822 +  unfolding norm_conv_dist by (intro tendsto_intros)
   2.823  
   2.824  lemma tendsto_norm_zero:
   2.825 -  "(f ---> 0) net \<Longrightarrow> ((\<lambda>x. norm (f x)) ---> 0) net"
   2.826 -by (drule tendsto_norm, simp)
   2.827 +  "(f ---> 0) A \<Longrightarrow> ((\<lambda>x. norm (f x)) ---> 0) A"
   2.828 +  by (drule tendsto_norm, simp)
   2.829  
   2.830  lemma tendsto_norm_zero_cancel:
   2.831 -  "((\<lambda>x. norm (f x)) ---> 0) net \<Longrightarrow> (f ---> 0) net"
   2.832 -unfolding tendsto_iff dist_norm by simp
   2.833 +  "((\<lambda>x. norm (f x)) ---> 0) A \<Longrightarrow> (f ---> 0) A"
   2.834 +  unfolding tendsto_iff dist_norm by simp
   2.835  
   2.836  lemma tendsto_norm_zero_iff:
   2.837 -  "((\<lambda>x. norm (f x)) ---> 0) net \<longleftrightarrow> (f ---> 0) net"
   2.838 -unfolding tendsto_iff dist_norm by simp
   2.839 +  "((\<lambda>x. norm (f x)) ---> 0) A \<longleftrightarrow> (f ---> 0) A"
   2.840 +  unfolding tendsto_iff dist_norm by simp
   2.841  
   2.842  lemma tendsto_add [tendsto_intros]:
   2.843    fixes a b :: "'a::real_normed_vector"
   2.844 -  shows "\<lbrakk>(f ---> a) net; (g ---> b) net\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x + g x) ---> a + b) net"
   2.845 -by (simp only: tendsto_Zfun_iff add_diff_add Zfun_add)
   2.846 +  shows "\<lbrakk>(f ---> a) A; (g ---> b) A\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x + g x) ---> a + b) A"
   2.847 +  by (simp only: tendsto_Zfun_iff add_diff_add Zfun_add)
   2.848  
   2.849  lemma tendsto_minus [tendsto_intros]:
   2.850    fixes a :: "'a::real_normed_vector"
   2.851 -  shows "(f ---> a) net \<Longrightarrow> ((\<lambda>x. - f x) ---> - a) net"
   2.852 -by (simp only: tendsto_Zfun_iff minus_diff_minus Zfun_minus)
   2.853 +  shows "(f ---> a) A \<Longrightarrow> ((\<lambda>x. - f x) ---> - a) A"
   2.854 +  by (simp only: tendsto_Zfun_iff minus_diff_minus Zfun_minus)
   2.855  
   2.856  lemma tendsto_minus_cancel:
   2.857    fixes a :: "'a::real_normed_vector"
   2.858 -  shows "((\<lambda>x. - f x) ---> - a) net \<Longrightarrow> (f ---> a) net"
   2.859 -by (drule tendsto_minus, simp)
   2.860 +  shows "((\<lambda>x. - f x) ---> - a) A \<Longrightarrow> (f ---> a) A"
   2.861 +  by (drule tendsto_minus, simp)
   2.862  
   2.863  lemma tendsto_diff [tendsto_intros]:
   2.864    fixes a b :: "'a::real_normed_vector"
   2.865 -  shows "\<lbrakk>(f ---> a) net; (g ---> b) net\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x - g x) ---> a - b) net"
   2.866 -by (simp add: diff_minus tendsto_add tendsto_minus)
   2.867 +  shows "\<lbrakk>(f ---> a) A; (g ---> b) A\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x - g x) ---> a - b) A"
   2.868 +  by (simp add: diff_minus tendsto_add tendsto_minus)
   2.869  
   2.870  lemma tendsto_setsum [tendsto_intros]:
   2.871    fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c::real_normed_vector"
   2.872 -  assumes "\<And>i. i \<in> S \<Longrightarrow> (f i ---> a i) net"
   2.873 -  shows "((\<lambda>x. \<Sum>i\<in>S. f i x) ---> (\<Sum>i\<in>S. a i)) net"
   2.874 +  assumes "\<And>i. i \<in> S \<Longrightarrow> (f i ---> a i) A"
   2.875 +  shows "((\<lambda>x. \<Sum>i\<in>S. f i x) ---> (\<Sum>i\<in>S. a i)) A"
   2.876  proof (cases "finite S")
   2.877    assume "finite S" thus ?thesis using assms
   2.878    proof (induct set: finite)
   2.879 @@ -683,29 +681,29 @@
   2.880  qed
   2.881  
   2.882  lemma (in bounded_linear) tendsto [tendsto_intros]:
   2.883 -  "(g ---> a) net \<Longrightarrow> ((\<lambda>x. f (g x)) ---> f a) net"
   2.884 -by (simp only: tendsto_Zfun_iff diff [symmetric] Zfun)
   2.885 +  "(g ---> a) A \<Longrightarrow> ((\<lambda>x. f (g x)) ---> f a) A"
   2.886 +  by (simp only: tendsto_Zfun_iff diff [symmetric] Zfun)
   2.887  
   2.888  lemma (in bounded_bilinear) tendsto [tendsto_intros]:
   2.889 -  "\<lbrakk>(f ---> a) net; (g ---> b) net\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x ** g x) ---> a ** b) net"
   2.890 -by (simp only: tendsto_Zfun_iff prod_diff_prod
   2.891 -               Zfun_add Zfun Zfun_left Zfun_right)
   2.892 +  "\<lbrakk>(f ---> a) A; (g ---> b) A\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x ** g x) ---> a ** b) A"
   2.893 +  by (simp only: tendsto_Zfun_iff prod_diff_prod
   2.894 +                 Zfun_add Zfun Zfun_left Zfun_right)
   2.895  
   2.896  
   2.897  subsection {* Continuity of Inverse *}
   2.898  
   2.899  lemma (in bounded_bilinear) Zfun_prod_Bfun:
   2.900 -  assumes f: "Zfun f net"
   2.901 -  assumes g: "Bfun g net"
   2.902 -  shows "Zfun (\<lambda>x. f x ** g x) net"
   2.903 +  assumes f: "Zfun f A"
   2.904 +  assumes g: "Bfun g A"
   2.905 +  shows "Zfun (\<lambda>x. f x ** g x) A"
   2.906  proof -
   2.907    obtain K where K: "0 \<le> K"
   2.908      and norm_le: "\<And>x y. norm (x ** y) \<le> norm x * norm y * K"
   2.909      using nonneg_bounded by fast
   2.910    obtain B where B: "0 < B"
   2.911 -    and norm_g: "eventually (\<lambda>x. norm (g x) \<le> B) net"
   2.912 +    and norm_g: "eventually (\<lambda>x. norm (g x) \<le> B) A"
   2.913      using g by (rule BfunE)
   2.914 -  have "eventually (\<lambda>x. norm (f x ** g x) \<le> norm (f x) * (B * K)) net"
   2.915 +  have "eventually (\<lambda>x. norm (f x ** g x) \<le> norm (f x) * (B * K)) A"
   2.916    using norm_g proof (rule eventually_elim1)
   2.917      fix x
   2.918      assume *: "norm (g x) \<le> B"
   2.919 @@ -724,39 +722,39 @@
   2.920  
   2.921  lemma (in bounded_bilinear) flip:
   2.922    "bounded_bilinear (\<lambda>x y. y ** x)"
   2.923 -apply default
   2.924 -apply (rule add_right)
   2.925 -apply (rule add_left)
   2.926 -apply (rule scaleR_right)
   2.927 -apply (rule scaleR_left)
   2.928 -apply (subst mult_commute)
   2.929 -using bounded by fast
   2.930 +  apply default
   2.931 +  apply (rule add_right)
   2.932 +  apply (rule add_left)
   2.933 +  apply (rule scaleR_right)
   2.934 +  apply (rule scaleR_left)
   2.935 +  apply (subst mult_commute)
   2.936 +  using bounded by fast
   2.937  
   2.938  lemma (in bounded_bilinear) Bfun_prod_Zfun:
   2.939 -  assumes f: "Bfun f net"
   2.940 -  assumes g: "Zfun g net"
   2.941 -  shows "Zfun (\<lambda>x. f x ** g x) net"
   2.942 -using flip g f by (rule bounded_bilinear.Zfun_prod_Bfun)
   2.943 +  assumes f: "Bfun f A"
   2.944 +  assumes g: "Zfun g A"
   2.945 +  shows "Zfun (\<lambda>x. f x ** g x) A"
   2.946 +  using flip g f by (rule bounded_bilinear.Zfun_prod_Bfun)
   2.947  
   2.948  lemma Bfun_inverse_lemma:
   2.949    fixes x :: "'a::real_normed_div_algebra"
   2.950    shows "\<lbrakk>r \<le> norm x; 0 < r\<rbrakk> \<Longrightarrow> norm (inverse x) \<le> inverse r"
   2.951 -apply (subst nonzero_norm_inverse, clarsimp)
   2.952 -apply (erule (1) le_imp_inverse_le)
   2.953 -done
   2.954 +  apply (subst nonzero_norm_inverse, clarsimp)
   2.955 +  apply (erule (1) le_imp_inverse_le)
   2.956 +  done
   2.957  
   2.958  lemma Bfun_inverse:
   2.959    fixes a :: "'a::real_normed_div_algebra"
   2.960 -  assumes f: "(f ---> a) net"
   2.961 +  assumes f: "(f ---> a) A"
   2.962    assumes a: "a \<noteq> 0"
   2.963 -  shows "Bfun (\<lambda>x. inverse (f x)) net"
   2.964 +  shows "Bfun (\<lambda>x. inverse (f x)) A"
   2.965  proof -
   2.966    from a have "0 < norm a" by simp
   2.967    hence "\<exists>r>0. r < norm a" by (rule dense)
   2.968    then obtain r where r1: "0 < r" and r2: "r < norm a" by fast
   2.969 -  have "eventually (\<lambda>x. dist (f x) a < r) net"
   2.970 +  have "eventually (\<lambda>x. dist (f x) a < r) A"
   2.971      using tendstoD [OF f r1] by fast
   2.972 -  hence "eventually (\<lambda>x. norm (inverse (f x)) \<le> inverse (norm a - r)) net"
   2.973 +  hence "eventually (\<lambda>x. norm (inverse (f x)) \<le> inverse (norm a - r)) A"
   2.974    proof (rule eventually_elim1)
   2.975      fix x
   2.976      assume "dist (f x) a < r"
   2.977 @@ -783,29 +781,29 @@
   2.978  
   2.979  lemma tendsto_inverse_lemma:
   2.980    fixes a :: "'a::real_normed_div_algebra"
   2.981 -  shows "\<lbrakk>(f ---> a) net; a \<noteq> 0; eventually (\<lambda>x. f x \<noteq> 0) net\<rbrakk>
   2.982 -         \<Longrightarrow> ((\<lambda>x. inverse (f x)) ---> inverse a) net"
   2.983 -apply (subst tendsto_Zfun_iff)
   2.984 -apply (rule Zfun_ssubst)
   2.985 -apply (erule eventually_elim1)
   2.986 -apply (erule (1) inverse_diff_inverse)
   2.987 -apply (rule Zfun_minus)
   2.988 -apply (rule Zfun_mult_left)
   2.989 -apply (rule mult.Bfun_prod_Zfun)
   2.990 -apply (erule (1) Bfun_inverse)
   2.991 -apply (simp add: tendsto_Zfun_iff)
   2.992 -done
   2.993 +  shows "\<lbrakk>(f ---> a) A; a \<noteq> 0; eventually (\<lambda>x. f x \<noteq> 0) A\<rbrakk>
   2.994 +         \<Longrightarrow> ((\<lambda>x. inverse (f x)) ---> inverse a) A"
   2.995 +  apply (subst tendsto_Zfun_iff)
   2.996 +  apply (rule Zfun_ssubst)
   2.997 +  apply (erule eventually_elim1)
   2.998 +  apply (erule (1) inverse_diff_inverse)
   2.999 +  apply (rule Zfun_minus)
  2.1000 +  apply (rule Zfun_mult_left)
  2.1001 +  apply (rule mult.Bfun_prod_Zfun)
  2.1002 +  apply (erule (1) Bfun_inverse)
  2.1003 +  apply (simp add: tendsto_Zfun_iff)
  2.1004 +  done
  2.1005  
  2.1006  lemma tendsto_inverse [tendsto_intros]:
  2.1007    fixes a :: "'a::real_normed_div_algebra"
  2.1008 -  assumes f: "(f ---> a) net"
  2.1009 +  assumes f: "(f ---> a) A"
  2.1010    assumes a: "a \<noteq> 0"
  2.1011 -  shows "((\<lambda>x. inverse (f x)) ---> inverse a) net"
  2.1012 +  shows "((\<lambda>x. inverse (f x)) ---> inverse a) A"
  2.1013  proof -
  2.1014    from a have "0 < norm a" by simp
  2.1015 -  with f have "eventually (\<lambda>x. dist (f x) a < norm a) net"
  2.1016 +  with f have "eventually (\<lambda>x. dist (f x) a < norm a) A"
  2.1017      by (rule tendstoD)
  2.1018 -  then have "eventually (\<lambda>x. f x \<noteq> 0) net"
  2.1019 +  then have "eventually (\<lambda>x. f x \<noteq> 0) A"
  2.1020      unfolding dist_norm by (auto elim!: eventually_elim1)
  2.1021    with f a show ?thesis
  2.1022      by (rule tendsto_inverse_lemma)
  2.1023 @@ -813,32 +811,32 @@
  2.1024  
  2.1025  lemma tendsto_divide [tendsto_intros]:
  2.1026    fixes a b :: "'a::real_normed_field"
  2.1027 -  shows "\<lbrakk>(f ---> a) net; (g ---> b) net; b \<noteq> 0\<rbrakk>
  2.1028 -    \<Longrightarrow> ((\<lambda>x. f x / g x) ---> a / b) net"
  2.1029 -by (simp add: mult.tendsto tendsto_inverse divide_inverse)
  2.1030 +  shows "\<lbrakk>(f ---> a) A; (g ---> b) A; b \<noteq> 0\<rbrakk>
  2.1031 +    \<Longrightarrow> ((\<lambda>x. f x / g x) ---> a / b) A"
  2.1032 +  by (simp add: mult.tendsto tendsto_inverse divide_inverse)
  2.1033  
  2.1034  lemma tendsto_unique:
  2.1035    fixes f :: "'a \<Rightarrow> 'b::t2_space"
  2.1036 -  assumes "\<not> trivial_limit net"  "(f ---> l) net"  "(f ---> l') net"
  2.1037 +  assumes "\<not> trivial_limit A"  "(f ---> l) A"  "(f ---> l') A"
  2.1038    shows "l = l'"
  2.1039  proof (rule ccontr)
  2.1040    assume "l \<noteq> l'"
  2.1041    obtain U V where "open U" "open V" "l \<in> U" "l' \<in> V" "U \<inter> V = {}"
  2.1042      using hausdorff [OF `l \<noteq> l'`] by fast
  2.1043 -  have "eventually (\<lambda>x. f x \<in> U) net"
  2.1044 -    using `(f ---> l) net` `open U` `l \<in> U` by (rule topological_tendstoD)
  2.1045 +  have "eventually (\<lambda>x. f x \<in> U) A"
  2.1046 +    using `(f ---> l) A` `open U` `l \<in> U` by (rule topological_tendstoD)
  2.1047    moreover
  2.1048 -  have "eventually (\<lambda>x. f x \<in> V) net"
  2.1049 -    using `(f ---> l') net` `open V` `l' \<in> V` by (rule topological_tendstoD)
  2.1050 +  have "eventually (\<lambda>x. f x \<in> V) A"
  2.1051 +    using `(f ---> l') A` `open V` `l' \<in> V` by (rule topological_tendstoD)
  2.1052    ultimately
  2.1053 -  have "eventually (\<lambda>x. False) net"
  2.1054 +  have "eventually (\<lambda>x. False) A"
  2.1055    proof (rule eventually_elim2)
  2.1056      fix x
  2.1057      assume "f x \<in> U" "f x \<in> V"
  2.1058      hence "f x \<in> U \<inter> V" by simp
  2.1059      with `U \<inter> V = {}` show "False" by simp
  2.1060    qed
  2.1061 -  with `\<not> trivial_limit net` show "False"
  2.1062 +  with `\<not> trivial_limit A` show "False"
  2.1063      by (simp add: trivial_limit_def)
  2.1064  qed
  2.1065  
     3.1 --- a/src/HOL/Multivariate_Analysis/Derivative.thy	Mon Aug 08 18:36:32 2011 -0700
     3.2 +++ b/src/HOL/Multivariate_Analysis/Derivative.thy	Mon Aug 08 19:26:53 2011 -0700
     3.3 @@ -18,7 +18,7 @@
     3.4    nets of a particular form. This lets us prove theorems generally and use 
     3.5    "at a" or "at a within s" for restriction to a set (1-sided on R etc.) *}
     3.6  
     3.7 -definition has_derivative :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('a net \<Rightarrow> bool)"
     3.8 +definition has_derivative :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('a filter \<Rightarrow> bool)"
     3.9  (infixl "(has'_derivative)" 12) where
    3.10   "(f has_derivative f') net \<equiv> bounded_linear f' \<and> ((\<lambda>y. (1 / (norm (y - netlimit net))) *\<^sub>R
    3.11     (f y - (f (netlimit net) + f'(y - netlimit net)))) ---> 0) net"
    3.12 @@ -291,7 +291,7 @@
    3.13  
    3.14  no_notation Deriv.differentiable (infixl "differentiable" 60)
    3.15  
    3.16 -definition differentiable :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a net \<Rightarrow> bool" (infixr "differentiable" 30) where
    3.17 +definition differentiable :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a filter \<Rightarrow> bool" (infixr "differentiable" 30) where
    3.18    "f differentiable net \<equiv> (\<exists>f'. (f has_derivative f') net)"
    3.19  
    3.20  definition differentiable_on :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a set \<Rightarrow> bool" (infixr "differentiable'_on" 30) where
    3.21 @@ -469,25 +469,25 @@
    3.22  
    3.23  subsection {* Composition rules stated just for differentiability. *}
    3.24  
    3.25 -lemma differentiable_const[intro]: "(\<lambda>z. c) differentiable (net::'a::real_normed_vector net)"
    3.26 +lemma differentiable_const[intro]: "(\<lambda>z. c) differentiable (net::'a::real_normed_vector filter)"
    3.27    unfolding differentiable_def using has_derivative_const by auto
    3.28  
    3.29 -lemma differentiable_id[intro]: "(\<lambda>z. z) differentiable (net::'a::real_normed_vector net)"
    3.30 +lemma differentiable_id[intro]: "(\<lambda>z. z) differentiable (net::'a::real_normed_vector filter)"
    3.31      unfolding differentiable_def using has_derivative_id by auto
    3.32  
    3.33 -lemma differentiable_cmul[intro]: "f differentiable net \<Longrightarrow> (\<lambda>x. c *\<^sub>R f(x)) differentiable (net::'a::real_normed_vector net)"
    3.34 +lemma differentiable_cmul[intro]: "f differentiable net \<Longrightarrow> (\<lambda>x. c *\<^sub>R f(x)) differentiable (net::'a::real_normed_vector filter)"
    3.35    unfolding differentiable_def apply(erule exE, drule has_derivative_cmul) by auto
    3.36  
    3.37 -lemma differentiable_neg[intro]: "f differentiable net \<Longrightarrow> (\<lambda>z. -(f z)) differentiable (net::'a::real_normed_vector net)"
    3.38 +lemma differentiable_neg[intro]: "f differentiable net \<Longrightarrow> (\<lambda>z. -(f z)) differentiable (net::'a::real_normed_vector filter)"
    3.39    unfolding differentiable_def apply(erule exE, drule has_derivative_neg) by auto
    3.40  
    3.41  lemma differentiable_add: "f differentiable net \<Longrightarrow> g differentiable net
    3.42 -   \<Longrightarrow> (\<lambda>z. f z + g z) differentiable (net::'a::real_normed_vector net)"
    3.43 +   \<Longrightarrow> (\<lambda>z. f z + g z) differentiable (net::'a::real_normed_vector filter)"
    3.44      unfolding differentiable_def apply(erule exE)+ apply(rule_tac x="\<lambda>z. f' z + f'a z" in exI)
    3.45      apply(rule has_derivative_add) by auto
    3.46  
    3.47  lemma differentiable_sub: "f differentiable net \<Longrightarrow> g differentiable net
    3.48 -  \<Longrightarrow> (\<lambda>z. f z - g z) differentiable (net::'a::real_normed_vector net)"
    3.49 +  \<Longrightarrow> (\<lambda>z. f z - g z) differentiable (net::'a::real_normed_vector filter)"
    3.50    unfolding differentiable_def apply(erule exE)+ apply(rule_tac x="\<lambda>z. f' z - f'a z" in exI)
    3.51      apply(rule has_derivative_sub) by auto 
    3.52  
    3.53 @@ -1259,7 +1259,7 @@
    3.54  
    3.55  subsection {* Considering derivative @{typ "real \<Rightarrow> 'b\<Colon>real_normed_vector"} as a vector. *}
    3.56  
    3.57 -definition has_vector_derivative :: "(real \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'b \<Rightarrow> (real net \<Rightarrow> bool)"
    3.58 +definition has_vector_derivative :: "(real \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'b \<Rightarrow> (real filter \<Rightarrow> bool)"
    3.59  (infixl "has'_vector'_derivative" 12) where
    3.60   "(f has_vector_derivative f') net \<equiv> (f has_derivative (\<lambda>x. x *\<^sub>R f')) net"
    3.61  
     4.1 --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy	Mon Aug 08 18:36:32 2011 -0700
     4.2 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy	Mon Aug 08 19:26:53 2011 -0700
     4.3 @@ -882,24 +882,25 @@
     4.4    using frontier_complement frontier_subset_eq[of "- S"]
     4.5    unfolding open_closed by auto
     4.6  
     4.7 -subsection {* Nets and the ``eventually true'' quantifier *}
     4.8 -
     4.9 -text {* Common nets and The "within" modifier for nets. *}
    4.10 +subsection {* Filters and the ``eventually true'' quantifier *}
    4.11 +
    4.12 +text {* Common filters and The "within" modifier for filters. *}
    4.13  
    4.14  definition
    4.15 -  at_infinity :: "'a::real_normed_vector net" where
    4.16 -  "at_infinity = Abs_net (\<lambda>P. \<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x)"
    4.17 +  at_infinity :: "'a::real_normed_vector filter" where
    4.18 +  "at_infinity = Abs_filter (\<lambda>P. \<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x)"
    4.19  
    4.20  definition
    4.21 -  indirection :: "'a::real_normed_vector \<Rightarrow> 'a \<Rightarrow> 'a net" (infixr "indirection" 70) where
    4.22 +  indirection :: "'a::real_normed_vector \<Rightarrow> 'a \<Rightarrow> 'a filter"
    4.23 +    (infixr "indirection" 70) where
    4.24    "a indirection v = (at a) within {b. \<exists>c\<ge>0. b - a = scaleR c v}"
    4.25  
    4.26 -text{* Prove That They are all nets. *}
    4.27 +text{* Prove That They are all filters. *}
    4.28  
    4.29  lemma eventually_at_infinity:
    4.30    "eventually P at_infinity \<longleftrightarrow> (\<exists>b. \<forall>x. norm x >= b \<longrightarrow> P x)"
    4.31  unfolding at_infinity_def
    4.32 -proof (rule eventually_Abs_net, rule is_filter.intro)
    4.33 +proof (rule eventually_Abs_filter, rule is_filter.intro)
    4.34    fix P Q :: "'a \<Rightarrow> bool"
    4.35    assume "\<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x" and "\<exists>s. \<forall>x. s \<le> norm x \<longrightarrow> Q x"
    4.36    then obtain r s where
    4.37 @@ -944,7 +945,7 @@
    4.38    by (simp add: trivial_limit_at_iff)
    4.39  
    4.40  lemma trivial_limit_at_infinity:
    4.41 -  "\<not> trivial_limit (at_infinity :: ('a::{real_normed_vector,perfect_space}) net)"
    4.42 +  "\<not> trivial_limit (at_infinity :: ('a::{real_normed_vector,perfect_space}) filter)"
    4.43    unfolding trivial_limit_def eventually_at_infinity
    4.44    apply clarsimp
    4.45    apply (subgoal_tac "\<exists>x::'a. x \<noteq> 0", clarify)
    4.46 @@ -972,12 +973,6 @@
    4.47    unfolding trivial_limit_def
    4.48    by (auto elim: eventually_rev_mp)
    4.49  
    4.50 -lemma always_eventually: "(\<forall>x. P x) ==> eventually P net"
    4.51 -proof -
    4.52 -  assume "\<forall>x. P x" hence "P = (\<lambda>x. True)" by (simp add: ext)
    4.53 -  thus "eventually P net" by simp
    4.54 -qed
    4.55 -
    4.56  lemma trivial_limit_eventually: "trivial_limit net \<Longrightarrow> eventually P net"
    4.57    unfolding trivial_limit_def by (auto elim: eventually_rev_mp)
    4.58  
    4.59 @@ -1012,10 +1007,10 @@
    4.60  
    4.61  subsection {* Limits *}
    4.62  
    4.63 -  text{* Notation Lim to avoid collition with lim defined in analysis *}
    4.64 -definition
    4.65 -  Lim :: "'a net \<Rightarrow> ('a \<Rightarrow> 'b::t2_space) \<Rightarrow> 'b" where
    4.66 -  "Lim net f = (THE l. (f ---> l) net)"
    4.67 +text{* Notation Lim to avoid collition with lim defined in analysis *}
    4.68 +
    4.69 +definition Lim :: "'a filter \<Rightarrow> ('a \<Rightarrow> 'b::t2_space) \<Rightarrow> 'b"
    4.70 +  where "Lim A f = (THE l. (f ---> l) A)"
    4.71  
    4.72  lemma Lim:
    4.73   "(f ---> l) net \<longleftrightarrow>
    4.74 @@ -1281,9 +1276,9 @@
    4.75    using assms by (rule scaleR.tendsto)
    4.76  
    4.77  lemma Lim_inv:
    4.78 -  fixes f :: "'a \<Rightarrow> real"
    4.79 -  assumes "(f ---> l) (net::'a net)"  "l \<noteq> 0"
    4.80 -  shows "((inverse o f) ---> inverse l) net"
    4.81 +  fixes f :: "'a \<Rightarrow> real" and A :: "'a filter"
    4.82 +  assumes "(f ---> l) A" and "l \<noteq> 0"
    4.83 +  shows "((inverse o f) ---> inverse l) A"
    4.84    unfolding o_def using assms by (rule tendsto_inverse)
    4.85  
    4.86  lemma Lim_vmul:
    4.87 @@ -1485,10 +1480,10 @@
    4.88    thus "?lhs" by (rule topological_tendstoI)
    4.89  qed
    4.90  
    4.91 -text{* It's also sometimes useful to extract the limit point from the net.  *}
    4.92 +text{* It's also sometimes useful to extract the limit point from the filter. *}
    4.93  
    4.94  definition
    4.95 -  netlimit :: "'a::t2_space net \<Rightarrow> 'a" where
    4.96 +  netlimit :: "'a::t2_space filter \<Rightarrow> 'a" where
    4.97    "netlimit net = (SOME a. ((\<lambda>x. x) ---> a) net)"
    4.98  
    4.99  lemma netlimit_within:
   4.100 @@ -1943,7 +1938,7 @@
   4.101  
   4.102  lemma at_within_interior:
   4.103    "x \<in> interior S \<Longrightarrow> at x within S = at x"
   4.104 -  by (simp add: expand_net_eq eventually_within_interior)
   4.105 +  by (simp add: filter_eq_iff eventually_within_interior)
   4.106  
   4.107  lemma lim_within_interior:
   4.108    "x \<in> interior S \<Longrightarrow> (f ---> l) (at x within S) \<longleftrightarrow> (f ---> l) (at x)"
   4.109 @@ -3338,8 +3333,8 @@
   4.110  text {* Define continuity over a net to take in restrictions of the set. *}
   4.111  
   4.112  definition
   4.113 -  continuous :: "'a::t2_space net \<Rightarrow> ('a \<Rightarrow> 'b::topological_space) \<Rightarrow> bool" where
   4.114 -  "continuous net f \<longleftrightarrow> (f ---> f(netlimit net)) net"
   4.115 +  continuous :: "'a::t2_space filter \<Rightarrow> ('a \<Rightarrow> 'b::topological_space) \<Rightarrow> bool"
   4.116 +  where "continuous net f \<longleftrightarrow> (f ---> f(netlimit net)) net"
   4.117  
   4.118  lemma continuous_trivial_limit:
   4.119   "trivial_limit net ==> continuous net f"