src/HOL/Multivariate_Analysis/Extended_Real_Limits.thy
changeset 45035 510ac30f44c0
parent 45032 e81d676d598e
child 45442 bd91b77c4cd6
equal deleted inserted replaced
45034:bdcc11b2fdc8 45035:510ac30f44c0
   100     hence "ereal y <= Inf S" by (metis Compl_anti_mono Compl_lessThan atLeast_iff
   100     hence "ereal y <= Inf S" by (metis Compl_anti_mono Compl_lessThan atLeast_iff
   101       complete_lattice_class.Inf_greatest double_complement set_rev_mp)
   101       complete_lattice_class.Inf_greatest double_complement set_rev_mp)
   102     then show False using MInf by auto
   102     then show False using MInf by auto
   103   next
   103   next
   104     case PInf then have "S={\<infinity>}" by (metis Inf_eq_PInfty assms(2))
   104     case PInf then have "S={\<infinity>}" by (metis Inf_eq_PInfty assms(2))
   105     then show False by (metis `Inf S ~: S` insert_code mem_def PInf)
   105     then show False using `Inf S ~: S` by simp
   106   next
   106   next
   107     case (real r) then have fin: "\<bar>Inf S\<bar> \<noteq> \<infinity>" by simp
   107     case (real r) then have fin: "\<bar>Inf S\<bar> \<noteq> \<infinity>" by simp
   108     from ereal_open_cont_interval[OF a this] guess e . note e = this
   108     from ereal_open_cont_interval[OF a this] guess e . note e = this
   109     { fix x assume "x:S" hence "x>=Inf S" by (rule complete_lattice_class.Inf_lower)
   109     { fix x assume "x:S" hence "x>=Inf S" by (rule complete_lattice_class.Inf_lower)
   110       hence *: "x>Inf S-e" using e by (metis fin ereal_between(1) order_less_le_trans)
   110       hence *: "x>Inf S-e" using e by (metis fin ereal_between(1) order_less_le_trans)
   282 qed
   282 qed
   283 
   283 
   284 lemma ereal_open_mono_set:
   284 lemma ereal_open_mono_set:
   285   fixes S :: "ereal set"
   285   fixes S :: "ereal set"
   286   defines "a \<equiv> Inf S"
   286   defines "a \<equiv> Inf S"
   287   shows "(open S \<and> mono S) \<longleftrightarrow> (S = UNIV \<or> S = {a <..})"
   287   shows "(open S \<and> mono_set S) \<longleftrightarrow> (S = UNIV \<or> S = {a <..})"
   288   by (metis Inf_UNIV a_def atLeast_eq_UNIV_iff ereal_open_atLeast
   288   by (metis Inf_UNIV a_def atLeast_eq_UNIV_iff ereal_open_atLeast
   289             ereal_open_closed mono_set_iff open_ereal_greaterThan)
   289             ereal_open_closed mono_set_iff open_ereal_greaterThan)
   290 
   290 
   291 lemma ereal_closed_mono_set:
   291 lemma ereal_closed_mono_set:
   292   fixes S :: "ereal set"
   292   fixes S :: "ereal set"
   293   shows "(closed S \<and> mono S) \<longleftrightarrow> (S = {} \<or> S = {Inf S ..})"
   293   shows "(closed S \<and> mono_set S) \<longleftrightarrow> (S = {} \<or> S = {Inf S ..})"
   294   by (metis Inf_UNIV atLeast_eq_UNIV_iff closed_ereal_atLeast
   294   by (metis Inf_UNIV atLeast_eq_UNIV_iff closed_ereal_atLeast
   295             ereal_open_closed mono_empty mono_set_iff open_ereal_greaterThan)
   295             ereal_open_closed mono_empty mono_set_iff open_ereal_greaterThan)
   296 
   296 
   297 lemma ereal_Liminf_Sup_monoset:
   297 lemma ereal_Liminf_Sup_monoset:
   298   fixes f :: "'a => ereal"
   298   fixes f :: "'a => ereal"
   299   shows "Liminf net f = Sup {l. \<forall>S. open S \<longrightarrow> mono S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) net}"
   299   shows "Liminf net f = Sup {l. \<forall>S. open S \<longrightarrow> mono_set S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) net}"
   300   unfolding Liminf_Sup
   300   unfolding Liminf_Sup
   301 proof (intro arg_cong[where f="\<lambda>P. Sup (Collect P)"] ext iffI allI impI)
   301 proof (intro arg_cong[where f="\<lambda>P. Sup (Collect P)"] ext iffI allI impI)
   302   fix l S assume ev: "\<forall>y<l. eventually (\<lambda>x. y < f x) net" and "open S" "mono S" "l \<in> S"
   302   fix l S assume ev: "\<forall>y<l. eventually (\<lambda>x. y < f x) net" and "open S" "mono_set S" "l \<in> S"
   303   then have "S = UNIV \<or> S = {Inf S <..}"
   303   then have "S = UNIV \<or> S = {Inf S <..}"
   304     using ereal_open_mono_set[of S] by auto
   304     using ereal_open_mono_set[of S] by auto
   305   then show "eventually (\<lambda>x. f x \<in> S) net"
   305   then show "eventually (\<lambda>x. f x \<in> S) net"
   306   proof
   306   proof
   307     assume S: "S = {Inf S<..}"
   307     assume S: "S = {Inf S<..}"
   308     then have "Inf S < l" using `l \<in> S` by auto
   308     then have "Inf S < l" using `l \<in> S` by auto
   309     then have "eventually (\<lambda>x. Inf S < f x) net" using ev by auto
   309     then have "eventually (\<lambda>x. Inf S < f x) net" using ev by auto
   310     then show "eventually (\<lambda>x. f x \<in> S) net"  by (subst S) auto
   310     then show "eventually (\<lambda>x. f x \<in> S) net"  by (subst S) auto
   311   qed auto
   311   qed auto
   312 next
   312 next
   313   fix l y assume S: "\<forall>S. open S \<longrightarrow> mono S \<longrightarrow> l \<in> S \<longrightarrow> eventually  (\<lambda>x. f x \<in> S) net" "y < l"
   313   fix l y assume S: "\<forall>S. open S \<longrightarrow> mono_set S \<longrightarrow> l \<in> S \<longrightarrow> eventually  (\<lambda>x. f x \<in> S) net" "y < l"
   314   have "eventually  (\<lambda>x. f x \<in> {y <..}) net"
   314   have "eventually  (\<lambda>x. f x \<in> {y <..}) net"
   315     using `y < l` by (intro S[rule_format]) auto
   315     using `y < l` by (intro S[rule_format]) auto
   316   then show "eventually (\<lambda>x. y < f x) net" by auto
   316   then show "eventually (\<lambda>x. y < f x) net" by auto
   317 qed
   317 qed
   318 
   318 
   319 lemma ereal_Limsup_Inf_monoset:
   319 lemma ereal_Limsup_Inf_monoset:
   320   fixes f :: "'a => ereal"
   320   fixes f :: "'a => ereal"
   321   shows "Limsup net f = Inf {l. \<forall>S. open S \<longrightarrow> mono (uminus ` S) \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) net}"
   321   shows "Limsup net f = Inf {l. \<forall>S. open S \<longrightarrow> mono_set (uminus ` S) \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) net}"
   322   unfolding Limsup_Inf
   322   unfolding Limsup_Inf
   323 proof (intro arg_cong[where f="\<lambda>P. Inf (Collect P)"] ext iffI allI impI)
   323 proof (intro arg_cong[where f="\<lambda>P. Inf (Collect P)"] ext iffI allI impI)
   324   fix l S assume ev: "\<forall>y>l. eventually (\<lambda>x. f x < y) net" and "open S" "mono (uminus`S)" "l \<in> S"
   324   fix l S assume ev: "\<forall>y>l. eventually (\<lambda>x. f x < y) net" and "open S" "mono_set (uminus`S)" "l \<in> S"
   325   then have "open (uminus`S) \<and> mono (uminus`S)" by (simp add: ereal_open_uminus)
   325   then have "open (uminus`S) \<and> mono_set (uminus`S)" by (simp add: ereal_open_uminus)
   326   then have "S = UNIV \<or> S = {..< Sup S}"
   326   then have "S = UNIV \<or> S = {..< Sup S}"
   327     unfolding ereal_open_mono_set ereal_Inf_uminus_image_eq ereal_image_uminus_shift by simp
   327     unfolding ereal_open_mono_set ereal_Inf_uminus_image_eq ereal_image_uminus_shift by simp
   328   then show "eventually (\<lambda>x. f x \<in> S) net"
   328   then show "eventually (\<lambda>x. f x \<in> S) net"
   329   proof
   329   proof
   330     assume S: "S = {..< Sup S}"
   330     assume S: "S = {..< Sup S}"
   331     then have "l < Sup S" using `l \<in> S` by auto
   331     then have "l < Sup S" using `l \<in> S` by auto
   332     then have "eventually (\<lambda>x. f x < Sup S) net" using ev by auto
   332     then have "eventually (\<lambda>x. f x < Sup S) net" using ev by auto
   333     then show "eventually (\<lambda>x. f x \<in> S) net"  by (subst S) auto
   333     then show "eventually (\<lambda>x. f x \<in> S) net"  by (subst S) auto
   334   qed auto
   334   qed auto
   335 next
   335 next
   336   fix l y assume S: "\<forall>S. open S \<longrightarrow> mono (uminus`S) \<longrightarrow> l \<in> S \<longrightarrow> eventually  (\<lambda>x. f x \<in> S) net" "l < y"
   336   fix l y assume S: "\<forall>S. open S \<longrightarrow> mono_set (uminus`S) \<longrightarrow> l \<in> S \<longrightarrow> eventually  (\<lambda>x. f x \<in> S) net" "l < y"
   337   have "eventually  (\<lambda>x. f x \<in> {..< y}) net"
   337   have "eventually  (\<lambda>x. f x \<in> {..< y}) net"
   338     using `l < y` by (intro S[rule_format]) auto
   338     using `l < y` by (intro S[rule_format]) auto
   339   then show "eventually (\<lambda>x. f x < y) net" by auto
   339   then show "eventually (\<lambda>x. f x < y) net" by auto
   340 qed
   340 qed
   341 
   341 
   467   using dec
   467   using dec
   468   by (intro ereal_lim_mono[of N, OF _ lim tendsto_const]) (simp add: decseq_def)
   468   by (intro ereal_lim_mono[of N, OF _ lim tendsto_const]) (simp add: decseq_def)
   469 
   469 
   470 lemma liminf_bounded_open:
   470 lemma liminf_bounded_open:
   471   fixes x :: "nat \<Rightarrow> ereal"
   471   fixes x :: "nat \<Rightarrow> ereal"
   472   shows "x0 \<le> liminf x \<longleftrightarrow> (\<forall>S. open S \<longrightarrow> mono S \<longrightarrow> x0 \<in> S \<longrightarrow> (\<exists>N. \<forall>n\<ge>N. x n \<in> S))" 
   472   shows "x0 \<le> liminf x \<longleftrightarrow> (\<forall>S. open S \<longrightarrow> mono_set S \<longrightarrow> x0 \<in> S \<longrightarrow> (\<exists>N. \<forall>n\<ge>N. x n \<in> S))" 
   473   (is "_ \<longleftrightarrow> ?P x0")
   473   (is "_ \<longleftrightarrow> ?P x0")
   474 proof
   474 proof
   475   assume "?P x0" then show "x0 \<le> liminf x"
   475   assume "?P x0" then show "x0 \<le> liminf x"
   476     unfolding ereal_Liminf_Sup_monoset eventually_sequentially
   476     unfolding ereal_Liminf_Sup_monoset eventually_sequentially
   477     by (intro complete_lattice_class.Sup_upper) auto
   477     by (intro complete_lattice_class.Sup_upper) auto
   478 next
   478 next
   479   assume "x0 \<le> liminf x"
   479   assume "x0 \<le> liminf x"
   480   { fix S :: "ereal set" assume om: "open S & mono S & x0:S"
   480   { fix S :: "ereal set" assume om: "open S & mono_set S & x0:S"
   481     { assume "S = UNIV" hence "EX N. (ALL n>=N. x n : S)" by auto }
   481     { assume "S = UNIV" hence "EX N. (ALL n>=N. x n : S)" by auto }
   482     moreover
   482     moreover
   483     { assume "~(S=UNIV)"
   483     { assume "~(S=UNIV)"
   484       then obtain B where B_def: "S = {B<..}" using om ereal_open_mono_set by auto
   484       then obtain B where B_def: "S = {B<..}" using om ereal_open_mono_set by auto
   485       hence "B<x0" using om by auto
   485       hence "B<x0" using om by auto
   639 lemma Liminf_within:
   639 lemma Liminf_within:
   640   fixes f :: "'a::metric_space => ereal"
   640   fixes f :: "'a::metric_space => ereal"
   641   shows "Liminf (at x within S) f = (SUP e:{0<..}. INF y:(S Int ball x e - {x}). f y)"
   641   shows "Liminf (at x within S) f = (SUP e:{0<..}. INF y:(S Int ball x e - {x}). f y)"
   642 proof-
   642 proof-
   643 let ?l="(SUP e:{0<..}. INF y:(S Int ball x e - {x}). f y)"
   643 let ?l="(SUP e:{0<..}. INF y:(S Int ball x e - {x}). f y)"
   644 { fix T assume T_def: "open T & mono T & ?l:T"
   644 { fix T assume T_def: "open T & mono_set T & ?l:T"
   645   have "EX d>0. ALL y:S. 0 < dist y x & dist y x < d --> f y : T"
   645   have "EX d>0. ALL y:S. 0 < dist y x & dist y x < d --> f y : T"
   646   proof-
   646   proof-
   647   { assume "T=UNIV" hence ?thesis by (simp add: gt_ex) }
   647   { assume "T=UNIV" hence ?thesis by (simp add: gt_ex) }
   648   moreover
   648   moreover
   649   { assume "~(T=UNIV)"
   649   { assume "~(T=UNIV)"
   658   } ultimately show ?thesis by auto
   658   } ultimately show ?thesis by auto
   659   qed
   659   qed
   660 }
   660 }
   661 moreover
   661 moreover
   662 { fix z
   662 { fix z
   663   assume a: "ALL T. open T --> mono T --> z : T -->
   663   assume a: "ALL T. open T --> mono_set T --> z : T -->
   664      (EX d>0. ALL y:S. 0 < dist y x & dist y x < d --> f y : T)"
   664      (EX d>0. ALL y:S. 0 < dist y x & dist y x < d --> f y : T)"
   665   { fix B assume "B<z"
   665   { fix B assume "B<z"
   666     then obtain d where d_def: "d>0 & (ALL y:S. 0 < dist y x & dist y x < d --> B < f y)"
   666     then obtain d where d_def: "d>0 & (ALL y:S. 0 < dist y x & dist y x < d --> B < f y)"
   667        using a[rule_format, of "{B<..}"] mono_greaterThan by auto
   667        using a[rule_format, of "{B<..}"] mono_greaterThan by auto
   668     { fix y assume "y:(S Int ball x d - {x})"
   668     { fix y assume "y:(S Int ball x d - {x})"
   681 lemma Limsup_within:
   681 lemma Limsup_within:
   682   fixes f :: "'a::metric_space => ereal"
   682   fixes f :: "'a::metric_space => ereal"
   683   shows "Limsup (at x within S) f = (INF e:{0<..}. SUP y:(S Int ball x e - {x}). f y)"
   683   shows "Limsup (at x within S) f = (INF e:{0<..}. SUP y:(S Int ball x e - {x}). f y)"
   684 proof-
   684 proof-
   685 let ?l="(INF e:{0<..}. SUP y:(S Int ball x e - {x}). f y)"
   685 let ?l="(INF e:{0<..}. SUP y:(S Int ball x e - {x}). f y)"
   686 { fix T assume T_def: "open T & mono (uminus ` T) & ?l:T"
   686 { fix T assume T_def: "open T & mono_set (uminus ` T) & ?l:T"
   687   have "EX d>0. ALL y:S. 0 < dist y x & dist y x < d --> f y : T"
   687   have "EX d>0. ALL y:S. 0 < dist y x & dist y x < d --> f y : T"
   688   proof-
   688   proof-
   689   { assume "T=UNIV" hence ?thesis by (simp add: gt_ex) }
   689   { assume "T=UNIV" hence ?thesis by (simp add: gt_ex) }
   690   moreover
   690   moreover
   691   { assume "~(T=UNIV)" hence "~(uminus ` T = UNIV)"
   691   { assume "~(T=UNIV)" hence "~(uminus ` T = UNIV)"
   705   } ultimately show ?thesis by auto
   705   } ultimately show ?thesis by auto
   706   qed
   706   qed
   707 }
   707 }
   708 moreover
   708 moreover
   709 { fix z
   709 { fix z
   710   assume a: "ALL T. open T --> mono (uminus ` T) --> z : T -->
   710   assume a: "ALL T. open T --> mono_set (uminus ` T) --> z : T -->
   711      (EX d>0. ALL y:S. 0 < dist y x & dist y x < d --> f y : T)"
   711      (EX d>0. ALL y:S. 0 < dist y x & dist y x < d --> f y : T)"
   712   { fix B assume "z<B"
   712   { fix B assume "z<B"
   713     then obtain d where d_def: "d>0 & (ALL y:S. 0 < dist y x & dist y x < d --> f y<B)"
   713     then obtain d where d_def: "d>0 & (ALL y:S. 0 < dist y x & dist y x < d --> f y<B)"
   714        using a[rule_format, of "{..<B}"] by auto
   714        using a[rule_format, of "{..<B}"] by auto
   715     { fix y assume "y:(S Int ball x d - {x})"
   715     { fix y assume "y:(S Int ball x d - {x})"