src/HOL/Limits.thy
changeset 50322 b06b95a5fda2
parent 50247 491c5c81c2e8
child 50323 3764d4620fb3
equal deleted inserted replaced
50321:df5553c4973f 50322:b06b95a5fda2
   612 lemmas Zfun_mult_left = bounded_bilinear.Zfun_left [OF bounded_bilinear_mult]
   612 lemmas Zfun_mult_left = bounded_bilinear.Zfun_left [OF bounded_bilinear_mult]
   613 
   613 
   614 
   614 
   615 subsection {* Limits *}
   615 subsection {* Limits *}
   616 
   616 
   617 definition filter_lim :: "('a \<Rightarrow> 'b) \<Rightarrow> 'b filter \<Rightarrow> 'a filter \<Rightarrow> bool" where
   617 definition filterlim :: "('a \<Rightarrow> 'b) \<Rightarrow> 'b filter \<Rightarrow> 'a filter \<Rightarrow> bool" where
   618   "filter_lim f F2 F1 \<longleftrightarrow> filtermap f F1 \<le> F2"
   618   "filterlim f F2 F1 \<longleftrightarrow> filtermap f F1 \<le> F2"
   619 
   619 
   620 syntax
   620 syntax
   621   "_LIM" :: "pttrns \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'a \<Rightarrow> bool" ("(3LIM (_)/ (_)./ (_) :> (_))" [1000, 10, 0, 10] 10)
   621   "_LIM" :: "pttrns \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'a \<Rightarrow> bool" ("(3LIM (_)/ (_)./ (_) :> (_))" [1000, 10, 0, 10] 10)
   622 
   622 
   623 translations
   623 translations
   624   "LIM x F1. f :> F2"   == "CONST filter_lim (%x. f) F2 F1"
   624   "LIM x F1. f :> F2"   == "CONST filterlim (%x. f) F2 F1"
   625 
   625 
   626 lemma filter_limE: "(LIM x F1. f x :> F2) \<Longrightarrow> eventually P F2 \<Longrightarrow> eventually (\<lambda>x. P (f x)) F1"
   626 lemma filterlimE: "(LIM x F1. f x :> F2) \<Longrightarrow> eventually P F2 \<Longrightarrow> eventually (\<lambda>x. P (f x)) F1"
   627   by (auto simp: filter_lim_def eventually_filtermap le_filter_def)
   627   by (auto simp: filterlim_def eventually_filtermap le_filter_def)
   628 
   628 
   629 lemma filter_limI: "(\<And>P. eventually P F2 \<Longrightarrow> eventually (\<lambda>x. P (f x)) F1) \<Longrightarrow> (LIM x F1. f x :> F2)"
   629 lemma filterlimI: "(\<And>P. eventually P F2 \<Longrightarrow> eventually (\<lambda>x. P (f x)) F1) \<Longrightarrow> (LIM x F1. f x :> F2)"
   630   by (auto simp: filter_lim_def eventually_filtermap le_filter_def)
   630   by (auto simp: filterlim_def eventually_filtermap le_filter_def)
   631 
   631 
   632 abbreviation (in topological_space)
   632 abbreviation (in topological_space)
   633   tendsto :: "('b \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'b filter \<Rightarrow> bool" (infixr "--->" 55) where
   633   tendsto :: "('b \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'b filter \<Rightarrow> bool" (infixr "--->" 55) where
   634   "(f ---> l) F \<equiv> filter_lim f (nhds l) F"
   634   "(f ---> l) F \<equiv> filterlim f (nhds l) F"
   635 
   635 
   636 ML {*
   636 ML {*
   637 structure Tendsto_Intros = Named_Thms
   637 structure Tendsto_Intros = Named_Thms
   638 (
   638 (
   639   val name = @{binding tendsto_intros}
   639   val name = @{binding tendsto_intros}
   642 *}
   642 *}
   643 
   643 
   644 setup Tendsto_Intros.setup
   644 setup Tendsto_Intros.setup
   645 
   645 
   646 lemma tendsto_def: "(f ---> l) F \<longleftrightarrow> (\<forall>S. open S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) F)"
   646 lemma tendsto_def: "(f ---> l) F \<longleftrightarrow> (\<forall>S. open S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) F)"
   647   unfolding filter_lim_def
   647   unfolding filterlim_def
   648 proof safe
   648 proof safe
   649   fix S assume "open S" "l \<in> S" "filtermap f F \<le> nhds l"
   649   fix S assume "open S" "l \<in> S" "filtermap f F \<le> nhds l"
   650   then show "eventually (\<lambda>x. f x \<in> S) F"
   650   then show "eventually (\<lambda>x. f x \<in> S) F"
   651     unfolding eventually_nhds eventually_filtermap le_filter_def
   651     unfolding eventually_nhds eventually_filtermap le_filter_def
   652     by (auto elim!: allE[of _ "\<lambda>x. x \<in> S"] eventually_rev_mp)
   652     by (auto elim!: allE[of _ "\<lambda>x. x \<in> S"] eventually_rev_mp)
  1073   shows "\<lbrakk>(f ---> l) F; l \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. sgn (f x)) ---> sgn l) F"
  1073   shows "\<lbrakk>(f ---> l) F; l \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. sgn (f x)) ---> sgn l) F"
  1074   unfolding sgn_div_norm by (simp add: tendsto_intros)
  1074   unfolding sgn_div_norm by (simp add: tendsto_intros)
  1075 
  1075 
  1076 subsection {* Limits to @{const at_top} and @{const at_bot} *}
  1076 subsection {* Limits to @{const at_top} and @{const at_bot} *}
  1077 
  1077 
  1078 lemma filter_lim_at_top:
  1078 lemma filterlim_at_top:
  1079   fixes f :: "'a \<Rightarrow> ('b::dense_linorder)"
  1079   fixes f :: "'a \<Rightarrow> ('b::dense_linorder)"
  1080   shows "(LIM x F. f x :> at_top) \<longleftrightarrow> (\<forall>Z. eventually (\<lambda>x. Z < f x) F)"
  1080   shows "(LIM x F. f x :> at_top) \<longleftrightarrow> (\<forall>Z. eventually (\<lambda>x. Z < f x) F)"
  1081   by (safe elim!: filter_limE intro!: filter_limI)
  1081   by (safe elim!: filterlimE intro!: filterlimI)
  1082      (auto simp: eventually_at_top_dense elim!: eventually_elim1)
  1082      (auto simp: eventually_at_top_dense elim!: eventually_elim1)
  1083 
  1083 
  1084 lemma filter_lim_at_bot: 
  1084 lemma filterlim_at_bot: 
  1085   fixes f :: "'a \<Rightarrow> ('b::dense_linorder)"
  1085   fixes f :: "'a \<Rightarrow> ('b::dense_linorder)"
  1086   shows "(LIM x F. f x :> at_bot) \<longleftrightarrow> (\<forall>Z. eventually (\<lambda>x. f x < Z) F)"
  1086   shows "(LIM x F. f x :> at_bot) \<longleftrightarrow> (\<forall>Z. eventually (\<lambda>x. f x < Z) F)"
  1087   by (safe elim!: filter_limE intro!: filter_limI)
  1087   by (safe elim!: filterlimE intro!: filterlimI)
  1088      (auto simp: eventually_at_bot_dense elim!: eventually_elim1)
  1088      (auto simp: eventually_at_bot_dense elim!: eventually_elim1)
  1089 
  1089 
  1090 lemma filter_lim_real_sequentially: "LIM x sequentially. real x :> at_top"
  1090 lemma filterlim_real_sequentially: "LIM x sequentially. real x :> at_top"
  1091   unfolding filter_lim_at_top
  1091   unfolding filterlim_at_top
  1092   apply (intro allI)
  1092   apply (intro allI)
  1093   apply (rule_tac c="natceiling (Z + 1)" in eventually_sequentiallyI)
  1093   apply (rule_tac c="natceiling (Z + 1)" in eventually_sequentiallyI)
  1094   apply (auto simp: natceiling_le_eq)
  1094   apply (auto simp: natceiling_le_eq)
  1095   done
  1095   done
  1096 
  1096