src/HOL/Multivariate_Analysis/Bounded_Linear_Function.thy
changeset 61975 b4b11391c676
parent 61973 0c7e865fa7cb
child 62101 26c0a70f78a3
equal deleted inserted replaced
61974:5b067c681989 61975:b4b11391c676
     1 (*  Title:      HOL/Multivariate_Analysis/Bounded_Linear_Function.thy
     1 (*  Title:      HOL/Multivariate_Analysis/Bounded_Linear_Function.thy
     2     Author:     Fabian Immler, TU München
     2     Author:     Fabian Immler, TU München
     3 *)
     3 *)
     4 
     4 
     5 section {* Bounded Linear Function *}
     5 section \<open>Bounded Linear Function\<close>
     6 
     6 
     7 theory Bounded_Linear_Function
     7 theory Bounded_Linear_Function
     8 imports
     8 imports
     9   Topology_Euclidean_Space
     9   Topology_Euclidean_Space
    10   Operator_Norm
    10   Operator_Norm
    11 begin
    11 begin
    12 
    12 
    13 subsection {* Intro rules for @{term bounded_linear} *}
    13 subsection \<open>Intro rules for @{term bounded_linear}\<close>
    14 
    14 
    15 named_theorems bounded_linear_intros
    15 named_theorems bounded_linear_intros
    16 
    16 
    17 lemma onorm_inner_left:
    17 lemma onorm_inner_left:
    18   assumes "bounded_linear r"
    18   assumes "bounded_linear r"
   216       assume "norm x \<le> 1"
   216       assume "norm x \<le> 1"
   217       have "Cauchy (\<lambda>n. X n x)"
   217       have "Cauchy (\<lambda>n. X n x)"
   218       proof (rule CauchyI)
   218       proof (rule CauchyI)
   219         fix e::real
   219         fix e::real
   220         assume "0 < e"
   220         assume "0 < e"
   221         from CauchyD[OF `Cauchy X` `0 < e`] obtain M
   221         from CauchyD[OF \<open>Cauchy X\<close> \<open>0 < e\<close>] obtain M
   222           where M: "\<And>m n. m \<ge> M \<Longrightarrow> n \<ge> M \<Longrightarrow> norm (X m - X n) < e"
   222           where M: "\<And>m n. m \<ge> M \<Longrightarrow> n \<ge> M \<Longrightarrow> norm (X m - X n) < e"
   223           by auto
   223           by auto
   224         show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m x - X n x) < e"
   224         show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m x - X n x) < e"
   225         proof (safe intro!: exI[where x=M])
   225         proof (safe intro!: exI[where x=M])
   226           fix m n
   226           fix m n
   228           have "norm (X m x - X n x) = norm ((X m - X n) x)"
   228           have "norm (X m x - X n x) = norm ((X m - X n) x)"
   229             by (simp add: blinfun.bilinear_simps)
   229             by (simp add: blinfun.bilinear_simps)
   230           also have "\<dots> \<le> norm (X m - X n) * norm x"
   230           also have "\<dots> \<le> norm (X m - X n) * norm x"
   231              by (rule norm_blinfun)
   231              by (rule norm_blinfun)
   232           also have "\<dots> \<le> norm (X m - X n) * 1"
   232           also have "\<dots> \<le> norm (X m - X n) * 1"
   233             using `norm x \<le> 1` norm_ge_zero by (rule mult_left_mono)
   233             using \<open>norm x \<le> 1\<close> norm_ge_zero by (rule mult_left_mono)
   234           also have "\<dots> = norm (X m - X n)" by simp
   234           also have "\<dots> = norm (X m - X n)" by simp
   235           also have "\<dots> < e" using le by fact
   235           also have "\<dots> < e" using le by fact
   236           finally show "norm (X m x - X n x) < e" .
   236           finally show "norm (X m x - X n x) < e" .
   237         qed
   237         qed
   238       qed
   238       qed
   255 
   255 
   256   have "Cauchy (\<lambda>n. norm (X n))"
   256   have "Cauchy (\<lambda>n. norm (X n))"
   257   proof (rule CauchyI)
   257   proof (rule CauchyI)
   258     fix e::real
   258     fix e::real
   259     assume "e > 0"
   259     assume "e > 0"
   260     from CauchyD[OF `Cauchy X` `0 < e`] obtain M
   260     from CauchyD[OF \<open>Cauchy X\<close> \<open>0 < e\<close>] obtain M
   261       where M: "\<And>m n. m \<ge> M \<Longrightarrow> n \<ge> M \<Longrightarrow> norm (X m - X n) < e"
   261       where M: "\<And>m n. m \<ge> M \<Longrightarrow> n \<ge> M \<Longrightarrow> norm (X m - X n) < e"
   262       by auto
   262       by auto
   263     show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (norm (X m) - norm (X n)) < e"
   263     show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (norm (X m) - norm (X n)) < e"
   264     proof (safe intro!: exI[where x=M])
   264     proof (safe intro!: exI[where x=M])
   265       fix m n assume mn: "m \<ge> M" "n \<ge> M"
   265       fix m n assume mn: "m \<ge> M" "n \<ge> M"
   295 
   295 
   296   have "X \<longlonglongrightarrow> Blinfun v"
   296   have "X \<longlonglongrightarrow> Blinfun v"
   297   proof (rule LIMSEQ_I)
   297   proof (rule LIMSEQ_I)
   298     fix r::real assume "r > 0"
   298     fix r::real assume "r > 0"
   299     def r' \<equiv> "r / 2"
   299     def r' \<equiv> "r / 2"
   300     have "0 < r'" "r' < r" using `r > 0` by (simp_all add: r'_def)
   300     have "0 < r'" "r' < r" using \<open>r > 0\<close> by (simp_all add: r'_def)
   301     from CauchyD[OF `Cauchy X` `r' > 0`]
   301     from CauchyD[OF \<open>Cauchy X\<close> \<open>r' > 0\<close>]
   302     obtain M where M: "\<And>m n. m \<ge> M \<Longrightarrow> n \<ge> M \<Longrightarrow> norm (X m - X n) < r'"
   302     obtain M where M: "\<And>m n. m \<ge> M \<Longrightarrow> n \<ge> M \<Longrightarrow> norm (X m - X n) < r'"
   303       by metis
   303       by metis
   304     show "\<exists>no. \<forall>n\<ge>no. norm (X n - Blinfun v) < r"
   304     show "\<exists>no. \<forall>n\<ge>no. norm (X n - Blinfun v) < r"
   305     proof (safe intro!: exI[where x=M])
   305     proof (safe intro!: exI[where x=M])
   306       fix n assume n: "M \<le> n"
   306       fix n assume n: "M \<le> n"
   322         qed
   322         qed
   323         have tendsto_v: "(\<lambda>m. norm (X n x - X m x)) \<longlonglongrightarrow> norm (X n x - Blinfun v x)"
   323         have tendsto_v: "(\<lambda>m. norm (X n x - X m x)) \<longlonglongrightarrow> norm (X n x - Blinfun v x)"
   324           by (auto intro!: tendsto_intros Bv)
   324           by (auto intro!: tendsto_intros Bv)
   325         show "norm ((X n - Blinfun v) x) \<le> r' * norm x"
   325         show "norm ((X n - Blinfun v) x) \<le> r' * norm x"
   326           by (auto intro!: tendsto_ge_const tendsto_v ev_le simp: blinfun.bilinear_simps)
   326           by (auto intro!: tendsto_ge_const tendsto_v ev_le simp: blinfun.bilinear_simps)
   327       qed (simp add: `0 < r'` less_imp_le)
   327       qed (simp add: \<open>0 < r'\<close> less_imp_le)
   328       thus "norm (X n - Blinfun v) < r"
   328       thus "norm (X n - Blinfun v) < r"
   329         by (metis `r' < r` le_less_trans)
   329         by (metis \<open>r' < r\<close> le_less_trans)
   330     qed
   330     qed
   331   qed
   331   qed
   332   thus "convergent X"
   332   thus "convergent X"
   333     by (rule convergentI)
   333     by (rule convergentI)
   334 qed
   334 qed
   335 
   335 
   336 subsection {* On Euclidean Space *}
   336 subsection \<open>On Euclidean Space\<close>
   337 
   337 
   338 lemma Zfun_setsum:
   338 lemma Zfun_setsum:
   339   assumes "finite s"
   339   assumes "finite s"
   340   assumes f: "\<And>i. i \<in> s \<Longrightarrow> Zfun (f i) F"
   340   assumes f: "\<And>i. i \<in> s \<Longrightarrow> Zfun (f i) F"
   341   shows "Zfun (\<lambda>x. setsum (\<lambda>i. f i x) s) F"
   341   shows "Zfun (\<lambda>x. setsum (\<lambda>i. f i x) s) F"
   460 
   460 
   461 lemma mult_if_delta:
   461 lemma mult_if_delta:
   462   "(if P then (1::'a::comm_semiring_1) else 0) * q = (if P then q else 0)"
   462   "(if P then (1::'a::comm_semiring_1) else 0) * q = (if P then q else 0)"
   463   by auto
   463   by auto
   464 
   464 
   465 text {* TODO: generalize this and @{thm compact_lemma}?! *}
   465 text \<open>TODO: generalize this and @{thm compact_lemma}?!\<close>
   466 lemma compact_blinfun_lemma:
   466 lemma compact_blinfun_lemma:
   467   fixes f :: "nat \<Rightarrow> 'a::euclidean_space \<Rightarrow>\<^sub>L 'b::euclidean_space"
   467   fixes f :: "nat \<Rightarrow> 'a::euclidean_space \<Rightarrow>\<^sub>L 'b::euclidean_space"
   468   assumes "bounded (range f)"
   468   assumes "bounded (range f)"
   469   shows "\<forall>d\<subseteq>Basis. \<exists>l::'a \<Rightarrow>\<^sub>L 'b. \<exists> r.
   469   shows "\<forall>d\<subseteq>Basis. \<exists>l::'a \<Rightarrow>\<^sub>L 'b. \<exists> r.
   470     subseq r \<and> (\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) i) (l i) < e) sequentially)"
   470     subseq r \<and> (\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) i) (l i) < e) sequentially)"
   482   next
   482   next
   483     case (insert k d)
   483     case (insert k d)
   484     have k[intro]: "k \<in> Basis"
   484     have k[intro]: "k \<in> Basis"
   485       using insert by auto
   485       using insert by auto
   486     have s': "bounded ((\<lambda>x. blinfun_apply x k) ` range f)"
   486     have s': "bounded ((\<lambda>x. blinfun_apply x k) ` range f)"
   487       using `bounded (range f)`
   487       using \<open>bounded (range f)\<close>
   488       by (auto intro!: bounded_linear_image bounded_linear_intros)
   488       by (auto intro!: bounded_linear_image bounded_linear_intros)
   489     obtain l1::"'a \<Rightarrow>\<^sub>L 'b" and r1 where r1: "subseq r1"
   489     obtain l1::"'a \<Rightarrow>\<^sub>L 'b" and r1 where r1: "subseq r1"
   490       and lr1: "\<forall>e > 0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) i) (l1 i) < e) sequentially"
   490       and lr1: "\<forall>e > 0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) i) (l1 i) < e) sequentially"
   491       using insert(3) using insert(4) by auto
   491       using insert(3) using insert(4) by auto
   492     have f': "\<forall>n. f (r1 n) k \<in> (\<lambda>x. blinfun_apply x k) ` range f"
   492     have f': "\<forall>n. f (r1 n) k \<in> (\<lambda>x. blinfun_apply x k) ` range f"
   504     moreover
   504     moreover
   505     def l \<equiv> "blinfun_of_matrix (\<lambda>i j. if j = k then l2 \<bullet> i else l1 j \<bullet> i)::'a \<Rightarrow>\<^sub>L 'b"
   505     def l \<equiv> "blinfun_of_matrix (\<lambda>i j. if j = k then l2 \<bullet> i else l1 j \<bullet> i)::'a \<Rightarrow>\<^sub>L 'b"
   506     {
   506     {
   507       fix e::real
   507       fix e::real
   508       assume "e > 0"
   508       assume "e > 0"
   509       from lr1 `e > 0` have N1: "eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n)  i) (l1  i) < e) sequentially"
   509       from lr1 \<open>e > 0\<close> have N1: "eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n)  i) (l1  i) < e) sequentially"
   510         by blast
   510         by blast
   511       from lr2 `e > 0` have N2:"eventually (\<lambda>n. dist (f (r1 (r2 n))  k) l2 < e) sequentially"
   511       from lr2 \<open>e > 0\<close> have N2:"eventually (\<lambda>n. dist (f (r1 (r2 n))  k) l2 < e) sequentially"
   512         by (rule tendstoD)
   512         by (rule tendstoD)
   513       from r2 N1 have N1': "eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 (r2 n))  i) (l1  i) < e) sequentially"
   513       from r2 N1 have N1': "eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 (r2 n))  i) (l1  i) < e) sequentially"
   514         by (rule eventually_subseq)
   514         by (rule eventually_subseq)
   515       have l2: "l k = l2"
   515       have l2: "l k = l2"
   516         using insert.prems
   516         using insert.prems
   536   apply (subst (2) euclidean_representation[symmetric, where 'a='a])
   536   apply (subst (2) euclidean_representation[symmetric, where 'a='a])
   537   apply (subst (1) euclidean_representation[symmetric, where 'a='a])
   537   apply (subst (1) euclidean_representation[symmetric, where 'a='a])
   538   apply (simp add: blinfun.bilinear_simps)
   538   apply (simp add: blinfun.bilinear_simps)
   539   done
   539   done
   540 
   540 
   541 text {* TODO: generalize (via @{thm compact_cball})? *}
   541 text \<open>TODO: generalize (via @{thm compact_cball})?\<close>
   542 instance blinfun :: (euclidean_space, euclidean_space) heine_borel
   542 instance blinfun :: (euclidean_space, euclidean_space) heine_borel
   543 proof
   543 proof
   544   fix f :: "nat \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b"
   544   fix f :: "nat \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b"
   545   assume f: "bounded (range f)"
   545   assume f: "bounded (range f)"
   546   then obtain l::"'a \<Rightarrow>\<^sub>L 'b" and r where r: "subseq r"
   546   then obtain l::"'a \<Rightarrow>\<^sub>L 'b" and r where r: "subseq r"