src/HOL/Library/Product_Vector.thy
 author huffman Fri Jun 12 16:23:07 2009 -0700 (2009-06-12) changeset 31590 776d6a4c1327 parent 31587 a7e187205fc0 child 34110 4c113c744b86 permissions -rw-r--r--
declare inner_add, inner_diff [algebra_simps]; declare inner_scaleR [simp]
```     1 (*  Title:      HOL/Library/Product_Vector.thy
```
```     2     Author:     Brian Huffman
```
```     3 *)
```
```     4
```
```     5 header {* Cartesian Products as Vector Spaces *}
```
```     6
```
```     7 theory Product_Vector
```
```     8 imports Inner_Product Product_plus
```
```     9 begin
```
```    10
```
```    11 subsection {* Product is a real vector space *}
```
```    12
```
```    13 instantiation "*" :: (real_vector, real_vector) real_vector
```
```    14 begin
```
```    15
```
```    16 definition scaleR_prod_def:
```
```    17   "scaleR r A = (scaleR r (fst A), scaleR r (snd A))"
```
```    18
```
```    19 lemma fst_scaleR [simp]: "fst (scaleR r A) = scaleR r (fst A)"
```
```    20   unfolding scaleR_prod_def by simp
```
```    21
```
```    22 lemma snd_scaleR [simp]: "snd (scaleR r A) = scaleR r (snd A)"
```
```    23   unfolding scaleR_prod_def by simp
```
```    24
```
```    25 lemma scaleR_Pair [simp]: "scaleR r (a, b) = (scaleR r a, scaleR r b)"
```
```    26   unfolding scaleR_prod_def by simp
```
```    27
```
```    28 instance proof
```
```    29   fix a b :: real and x y :: "'a \<times> 'b"
```
```    30   show "scaleR a (x + y) = scaleR a x + scaleR a y"
```
```    31     by (simp add: expand_prod_eq scaleR_right_distrib)
```
```    32   show "scaleR (a + b) x = scaleR a x + scaleR b x"
```
```    33     by (simp add: expand_prod_eq scaleR_left_distrib)
```
```    34   show "scaleR a (scaleR b x) = scaleR (a * b) x"
```
```    35     by (simp add: expand_prod_eq)
```
```    36   show "scaleR 1 x = x"
```
```    37     by (simp add: expand_prod_eq)
```
```    38 qed
```
```    39
```
```    40 end
```
```    41
```
```    42 subsection {* Product is a topological space *}
```
```    43
```
```    44 instantiation
```
```    45   "*" :: (topological_space, topological_space) topological_space
```
```    46 begin
```
```    47
```
```    48 definition open_prod_def:
```
```    49   "open (S :: ('a \<times> 'b) set) \<longleftrightarrow>
```
```    50     (\<forall>x\<in>S. \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S)"
```
```    51
```
```    52 instance proof
```
```    53   show "open (UNIV :: ('a \<times> 'b) set)"
```
```    54     unfolding open_prod_def by auto
```
```    55 next
```
```    56   fix S T :: "('a \<times> 'b) set"
```
```    57   assume "open S" "open T" thus "open (S \<inter> T)"
```
```    58     unfolding open_prod_def
```
```    59     apply clarify
```
```    60     apply (drule (1) bspec)+
```
```    61     apply (clarify, rename_tac Sa Ta Sb Tb)
```
```    62     apply (rule_tac x="Sa \<inter> Ta" in exI)
```
```    63     apply (rule_tac x="Sb \<inter> Tb" in exI)
```
```    64     apply (simp add: open_Int)
```
```    65     apply fast
```
```    66     done
```
```    67 next
```
```    68   fix K :: "('a \<times> 'b) set set"
```
```    69   assume "\<forall>S\<in>K. open S" thus "open (\<Union>K)"
```
```    70     unfolding open_prod_def by fast
```
```    71 qed
```
```    72
```
```    73 end
```
```    74
```
```    75 lemma open_Times: "open S \<Longrightarrow> open T \<Longrightarrow> open (S \<times> T)"
```
```    76 unfolding open_prod_def by auto
```
```    77
```
```    78 lemma fst_vimage_eq_Times: "fst -` S = S \<times> UNIV"
```
```    79 by auto
```
```    80
```
```    81 lemma snd_vimage_eq_Times: "snd -` S = UNIV \<times> S"
```
```    82 by auto
```
```    83
```
```    84 lemma open_vimage_fst: "open S \<Longrightarrow> open (fst -` S)"
```
```    85 by (simp add: fst_vimage_eq_Times open_Times)
```
```    86
```
```    87 lemma open_vimage_snd: "open S \<Longrightarrow> open (snd -` S)"
```
```    88 by (simp add: snd_vimage_eq_Times open_Times)
```
```    89
```
```    90 lemma closed_vimage_fst: "closed S \<Longrightarrow> closed (fst -` S)"
```
```    91 unfolding closed_open vimage_Compl [symmetric]
```
```    92 by (rule open_vimage_fst)
```
```    93
```
```    94 lemma closed_vimage_snd: "closed S \<Longrightarrow> closed (snd -` S)"
```
```    95 unfolding closed_open vimage_Compl [symmetric]
```
```    96 by (rule open_vimage_snd)
```
```    97
```
```    98 lemma closed_Times: "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<times> T)"
```
```    99 proof -
```
```   100   have "S \<times> T = (fst -` S) \<inter> (snd -` T)" by auto
```
```   101   thus "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<times> T)"
```
```   102     by (simp add: closed_vimage_fst closed_vimage_snd closed_Int)
```
```   103 qed
```
```   104
```
```   105
```
```   106 subsection {* Product is a metric space *}
```
```   107
```
```   108 instantiation
```
```   109   "*" :: (metric_space, metric_space) metric_space
```
```   110 begin
```
```   111
```
```   112 definition dist_prod_def:
```
```   113   "dist (x::'a \<times> 'b) y = sqrt ((dist (fst x) (fst y))\<twosuperior> + (dist (snd x) (snd y))\<twosuperior>)"
```
```   114
```
```   115 lemma dist_Pair_Pair: "dist (a, b) (c, d) = sqrt ((dist a c)\<twosuperior> + (dist b d)\<twosuperior>)"
```
```   116   unfolding dist_prod_def by simp
```
```   117
```
```   118 instance proof
```
```   119   fix x y :: "'a \<times> 'b"
```
```   120   show "dist x y = 0 \<longleftrightarrow> x = y"
```
```   121     unfolding dist_prod_def expand_prod_eq by simp
```
```   122 next
```
```   123   fix x y z :: "'a \<times> 'b"
```
```   124   show "dist x y \<le> dist x z + dist y z"
```
```   125     unfolding dist_prod_def
```
```   126     by (intro order_trans [OF _ real_sqrt_sum_squares_triangle_ineq]
```
```   127         real_sqrt_le_mono add_mono power_mono dist_triangle2 zero_le_dist)
```
```   128 next
```
```   129   (* FIXME: long proof! *)
```
```   130   (* Maybe it would be easier to define topological spaces *)
```
```   131   (* in terms of neighborhoods instead of open sets? *)
```
```   132   fix S :: "('a \<times> 'b) set"
```
```   133   show "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S)"
```
```   134   proof
```
```   135     assume "open S" thus "\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S"
```
```   136     unfolding open_prod_def open_dist
```
```   137     apply safe
```
```   138     apply (drule (1) bspec)
```
```   139     apply clarify
```
```   140     apply (drule (1) bspec)+
```
```   141     apply (clarify, rename_tac r s)
```
```   142     apply (rule_tac x="min r s" in exI, simp)
```
```   143     apply (clarify, rename_tac c d)
```
```   144     apply (erule subsetD)
```
```   145     apply (simp add: dist_Pair_Pair)
```
```   146     apply (rule conjI)
```
```   147     apply (drule spec, erule mp)
```
```   148     apply (erule le_less_trans [OF real_sqrt_sum_squares_ge1])
```
```   149     apply (drule spec, erule mp)
```
```   150     apply (erule le_less_trans [OF real_sqrt_sum_squares_ge2])
```
```   151     done
```
```   152   next
```
```   153     assume "\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S" thus "open S"
```
```   154     unfolding open_prod_def open_dist
```
```   155     apply safe
```
```   156     apply (drule (1) bspec)
```
```   157     apply clarify
```
```   158     apply (subgoal_tac "\<exists>r>0. \<exists>s>0. e = sqrt (r\<twosuperior> + s\<twosuperior>)")
```
```   159     apply clarify
```
```   160     apply (rule_tac x="{y. dist y a < r}" in exI)
```
```   161     apply (rule_tac x="{y. dist y b < s}" in exI)
```
```   162     apply (rule conjI)
```
```   163     apply clarify
```
```   164     apply (rule_tac x="r - dist x a" in exI, rule conjI, simp)
```
```   165     apply clarify
```
```   166     apply (simp add: less_diff_eq)
```
```   167     apply (erule le_less_trans [OF dist_triangle])
```
```   168     apply (rule conjI)
```
```   169     apply clarify
```
```   170     apply (rule_tac x="s - dist x b" in exI, rule conjI, simp)
```
```   171     apply clarify
```
```   172     apply (simp add: less_diff_eq)
```
```   173     apply (erule le_less_trans [OF dist_triangle])
```
```   174     apply (rule conjI)
```
```   175     apply simp
```
```   176     apply (clarify, rename_tac c d)
```
```   177     apply (drule spec, erule mp)
```
```   178     apply (simp add: dist_Pair_Pair add_strict_mono power_strict_mono)
```
```   179     apply (rule_tac x="e / sqrt 2" in exI, simp add: divide_pos_pos)
```
```   180     apply (rule_tac x="e / sqrt 2" in exI, simp add: divide_pos_pos)
```
```   181     apply (simp add: power_divide)
```
```   182     done
```
```   183   qed
```
```   184 qed
```
```   185
```
```   186 end
```
```   187
```
```   188 subsection {* Continuity of operations *}
```
```   189
```
```   190 lemma dist_fst_le: "dist (fst x) (fst y) \<le> dist x y"
```
```   191 unfolding dist_prod_def by simp
```
```   192
```
```   193 lemma dist_snd_le: "dist (snd x) (snd y) \<le> dist x y"
```
```   194 unfolding dist_prod_def by simp
```
```   195
```
```   196 lemma tendsto_fst [tendsto_intros]:
```
```   197   assumes "(f ---> a) net"
```
```   198   shows "((\<lambda>x. fst (f x)) ---> fst a) net"
```
```   199 proof (rule topological_tendstoI)
```
```   200   fix S assume "open S" "fst a \<in> S"
```
```   201   then have "open (fst -` S)" "a \<in> fst -` S"
```
```   202     unfolding open_prod_def
```
```   203     apply simp_all
```
```   204     apply clarify
```
```   205     apply (rule exI, erule conjI)
```
```   206     apply (rule exI, rule conjI [OF open_UNIV])
```
```   207     apply auto
```
```   208     done
```
```   209   with assms have "eventually (\<lambda>x. f x \<in> fst -` S) net"
```
```   210     by (rule topological_tendstoD)
```
```   211   then show "eventually (\<lambda>x. fst (f x) \<in> S) net"
```
```   212     by simp
```
```   213 qed
```
```   214
```
```   215 lemma tendsto_snd [tendsto_intros]:
```
```   216   assumes "(f ---> a) net"
```
```   217   shows "((\<lambda>x. snd (f x)) ---> snd a) net"
```
```   218 proof (rule topological_tendstoI)
```
```   219   fix S assume "open S" "snd a \<in> S"
```
```   220   then have "open (snd -` S)" "a \<in> snd -` S"
```
```   221     unfolding open_prod_def
```
```   222     apply simp_all
```
```   223     apply clarify
```
```   224     apply (rule exI, rule conjI [OF open_UNIV])
```
```   225     apply (rule exI, erule conjI)
```
```   226     apply auto
```
```   227     done
```
```   228   with assms have "eventually (\<lambda>x. f x \<in> snd -` S) net"
```
```   229     by (rule topological_tendstoD)
```
```   230   then show "eventually (\<lambda>x. snd (f x) \<in> S) net"
```
```   231     by simp
```
```   232 qed
```
```   233
```
```   234 lemma tendsto_Pair [tendsto_intros]:
```
```   235   assumes "(f ---> a) net" and "(g ---> b) net"
```
```   236   shows "((\<lambda>x. (f x, g x)) ---> (a, b)) net"
```
```   237 proof (rule topological_tendstoI)
```
```   238   fix S assume "open S" "(a, b) \<in> S"
```
```   239   then obtain A B where "open A" "open B" "a \<in> A" "b \<in> B" "A \<times> B \<subseteq> S"
```
```   240     unfolding open_prod_def by auto
```
```   241   have "eventually (\<lambda>x. f x \<in> A) net"
```
```   242     using `(f ---> a) net` `open A` `a \<in> A`
```
```   243     by (rule topological_tendstoD)
```
```   244   moreover
```
```   245   have "eventually (\<lambda>x. g x \<in> B) net"
```
```   246     using `(g ---> b) net` `open B` `b \<in> B`
```
```   247     by (rule topological_tendstoD)
```
```   248   ultimately
```
```   249   show "eventually (\<lambda>x. (f x, g x) \<in> S) net"
```
```   250     by (rule eventually_elim2)
```
```   251        (simp add: subsetD [OF `A \<times> B \<subseteq> S`])
```
```   252 qed
```
```   253
```
```   254 lemma LIMSEQ_fst: "(X ----> a) \<Longrightarrow> (\<lambda>n. fst (X n)) ----> fst a"
```
```   255 unfolding LIMSEQ_conv_tendsto by (rule tendsto_fst)
```
```   256
```
```   257 lemma LIMSEQ_snd: "(X ----> a) \<Longrightarrow> (\<lambda>n. snd (X n)) ----> snd a"
```
```   258 unfolding LIMSEQ_conv_tendsto by (rule tendsto_snd)
```
```   259
```
```   260 lemma LIMSEQ_Pair:
```
```   261   assumes "X ----> a" and "Y ----> b"
```
```   262   shows "(\<lambda>n. (X n, Y n)) ----> (a, b)"
```
```   263 using assms unfolding LIMSEQ_conv_tendsto
```
```   264 by (rule tendsto_Pair)
```
```   265
```
```   266 lemma LIM_fst: "f -- x --> a \<Longrightarrow> (\<lambda>x. fst (f x)) -- x --> fst a"
```
```   267 unfolding LIM_conv_tendsto by (rule tendsto_fst)
```
```   268
```
```   269 lemma LIM_snd: "f -- x --> a \<Longrightarrow> (\<lambda>x. snd (f x)) -- x --> snd a"
```
```   270 unfolding LIM_conv_tendsto by (rule tendsto_snd)
```
```   271
```
```   272 lemma LIM_Pair:
```
```   273   assumes "f -- x --> a" and "g -- x --> b"
```
```   274   shows "(\<lambda>x. (f x, g x)) -- x --> (a, b)"
```
```   275 using assms unfolding LIM_conv_tendsto
```
```   276 by (rule tendsto_Pair)
```
```   277
```
```   278 lemma Cauchy_fst: "Cauchy X \<Longrightarrow> Cauchy (\<lambda>n. fst (X n))"
```
```   279 unfolding Cauchy_def by (fast elim: le_less_trans [OF dist_fst_le])
```
```   280
```
```   281 lemma Cauchy_snd: "Cauchy X \<Longrightarrow> Cauchy (\<lambda>n. snd (X n))"
```
```   282 unfolding Cauchy_def by (fast elim: le_less_trans [OF dist_snd_le])
```
```   283
```
```   284 lemma Cauchy_Pair:
```
```   285   assumes "Cauchy X" and "Cauchy Y"
```
```   286   shows "Cauchy (\<lambda>n. (X n, Y n))"
```
```   287 proof (rule metric_CauchyI)
```
```   288   fix r :: real assume "0 < r"
```
```   289   then have "0 < r / sqrt 2" (is "0 < ?s")
```
```   290     by (simp add: divide_pos_pos)
```
```   291   obtain M where M: "\<forall>m\<ge>M. \<forall>n\<ge>M. dist (X m) (X n) < ?s"
```
```   292     using metric_CauchyD [OF `Cauchy X` `0 < ?s`] ..
```
```   293   obtain N where N: "\<forall>m\<ge>N. \<forall>n\<ge>N. dist (Y m) (Y n) < ?s"
```
```   294     using metric_CauchyD [OF `Cauchy Y` `0 < ?s`] ..
```
```   295   have "\<forall>m\<ge>max M N. \<forall>n\<ge>max M N. dist (X m, Y m) (X n, Y n) < r"
```
```   296     using M N by (simp add: real_sqrt_sum_squares_less dist_Pair_Pair)
```
```   297   then show "\<exists>n0. \<forall>m\<ge>n0. \<forall>n\<ge>n0. dist (X m, Y m) (X n, Y n) < r" ..
```
```   298 qed
```
```   299
```
```   300 lemma isCont_Pair [simp]:
```
```   301   "\<lbrakk>isCont f x; isCont g x\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. (f x, g x)) x"
```
```   302   unfolding isCont_def by (rule LIM_Pair)
```
```   303
```
```   304 subsection {* Product is a complete metric space *}
```
```   305
```
```   306 instance "*" :: (complete_space, complete_space) complete_space
```
```   307 proof
```
```   308   fix X :: "nat \<Rightarrow> 'a \<times> 'b" assume "Cauchy X"
```
```   309   have 1: "(\<lambda>n. fst (X n)) ----> lim (\<lambda>n. fst (X n))"
```
```   310     using Cauchy_fst [OF `Cauchy X`]
```
```   311     by (simp add: Cauchy_convergent_iff convergent_LIMSEQ_iff)
```
```   312   have 2: "(\<lambda>n. snd (X n)) ----> lim (\<lambda>n. snd (X n))"
```
```   313     using Cauchy_snd [OF `Cauchy X`]
```
```   314     by (simp add: Cauchy_convergent_iff convergent_LIMSEQ_iff)
```
```   315   have "X ----> (lim (\<lambda>n. fst (X n)), lim (\<lambda>n. snd (X n)))"
```
```   316     using LIMSEQ_Pair [OF 1 2] by simp
```
```   317   then show "convergent X"
```
```   318     by (rule convergentI)
```
```   319 qed
```
```   320
```
```   321 subsection {* Product is a normed vector space *}
```
```   322
```
```   323 instantiation
```
```   324   "*" :: (real_normed_vector, real_normed_vector) real_normed_vector
```
```   325 begin
```
```   326
```
```   327 definition norm_prod_def:
```
```   328   "norm x = sqrt ((norm (fst x))\<twosuperior> + (norm (snd x))\<twosuperior>)"
```
```   329
```
```   330 definition sgn_prod_def:
```
```   331   "sgn (x::'a \<times> 'b) = scaleR (inverse (norm x)) x"
```
```   332
```
```   333 lemma norm_Pair: "norm (a, b) = sqrt ((norm a)\<twosuperior> + (norm b)\<twosuperior>)"
```
```   334   unfolding norm_prod_def by simp
```
```   335
```
```   336 instance proof
```
```   337   fix r :: real and x y :: "'a \<times> 'b"
```
```   338   show "0 \<le> norm x"
```
```   339     unfolding norm_prod_def by simp
```
```   340   show "norm x = 0 \<longleftrightarrow> x = 0"
```
```   341     unfolding norm_prod_def
```
```   342     by (simp add: expand_prod_eq)
```
```   343   show "norm (x + y) \<le> norm x + norm y"
```
```   344     unfolding norm_prod_def
```
```   345     apply (rule order_trans [OF _ real_sqrt_sum_squares_triangle_ineq])
```
```   346     apply (simp add: add_mono power_mono norm_triangle_ineq)
```
```   347     done
```
```   348   show "norm (scaleR r x) = \<bar>r\<bar> * norm x"
```
```   349     unfolding norm_prod_def
```
```   350     apply (simp add: power_mult_distrib)
```
```   351     apply (simp add: right_distrib [symmetric])
```
```   352     apply (simp add: real_sqrt_mult_distrib)
```
```   353     done
```
```   354   show "sgn x = scaleR (inverse (norm x)) x"
```
```   355     by (rule sgn_prod_def)
```
```   356   show "dist x y = norm (x - y)"
```
```   357     unfolding dist_prod_def norm_prod_def
```
```   358     by (simp add: dist_norm)
```
```   359 qed
```
```   360
```
```   361 end
```
```   362
```
```   363 instance "*" :: (banach, banach) banach ..
```
```   364
```
```   365 subsection {* Product is an inner product space *}
```
```   366
```
```   367 instantiation "*" :: (real_inner, real_inner) real_inner
```
```   368 begin
```
```   369
```
```   370 definition inner_prod_def:
```
```   371   "inner x y = inner (fst x) (fst y) + inner (snd x) (snd y)"
```
```   372
```
```   373 lemma inner_Pair [simp]: "inner (a, b) (c, d) = inner a c + inner b d"
```
```   374   unfolding inner_prod_def by simp
```
```   375
```
```   376 instance proof
```
```   377   fix r :: real
```
```   378   fix x y z :: "'a::real_inner * 'b::real_inner"
```
```   379   show "inner x y = inner y x"
```
```   380     unfolding inner_prod_def
```
```   381     by (simp add: inner_commute)
```
```   382   show "inner (x + y) z = inner x z + inner y z"
```
```   383     unfolding inner_prod_def
```
```   384     by (simp add: inner_add_left)
```
```   385   show "inner (scaleR r x) y = r * inner x y"
```
```   386     unfolding inner_prod_def
```
```   387     by (simp add: right_distrib)
```
```   388   show "0 \<le> inner x x"
```
```   389     unfolding inner_prod_def
```
```   390     by (intro add_nonneg_nonneg inner_ge_zero)
```
```   391   show "inner x x = 0 \<longleftrightarrow> x = 0"
```
```   392     unfolding inner_prod_def expand_prod_eq
```
```   393     by (simp add: add_nonneg_eq_0_iff)
```
```   394   show "norm x = sqrt (inner x x)"
```
```   395     unfolding norm_prod_def inner_prod_def
```
```   396     by (simp add: power2_norm_eq_inner)
```
```   397 qed
```
```   398
```
```   399 end
```
```   400
```
```   401 subsection {* Pair operations are linear *}
```
```   402
```
```   403 interpretation fst: bounded_linear fst
```
```   404   apply (unfold_locales)
```
```   405   apply (rule fst_add)
```
```   406   apply (rule fst_scaleR)
```
```   407   apply (rule_tac x="1" in exI, simp add: norm_Pair)
```
```   408   done
```
```   409
```
```   410 interpretation snd: bounded_linear snd
```
```   411   apply (unfold_locales)
```
```   412   apply (rule snd_add)
```
```   413   apply (rule snd_scaleR)
```
```   414   apply (rule_tac x="1" in exI, simp add: norm_Pair)
```
```   415   done
```
```   416
```
```   417 text {* TODO: move to NthRoot *}
```
```   418 lemma sqrt_add_le_add_sqrt:
```
```   419   assumes x: "0 \<le> x" and y: "0 \<le> y"
```
```   420   shows "sqrt (x + y) \<le> sqrt x + sqrt y"
```
```   421 apply (rule power2_le_imp_le)
```
```   422 apply (simp add: real_sum_squared_expand add_nonneg_nonneg x y)
```
```   423 apply (simp add: mult_nonneg_nonneg x y)
```
```   424 apply (simp add: add_nonneg_nonneg x y)
```
```   425 done
```
```   426
```
```   427 lemma bounded_linear_Pair:
```
```   428   assumes f: "bounded_linear f"
```
```   429   assumes g: "bounded_linear g"
```
```   430   shows "bounded_linear (\<lambda>x. (f x, g x))"
```
```   431 proof
```
```   432   interpret f: bounded_linear f by fact
```
```   433   interpret g: bounded_linear g by fact
```
```   434   fix x y and r :: real
```
```   435   show "(f (x + y), g (x + y)) = (f x, g x) + (f y, g y)"
```
```   436     by (simp add: f.add g.add)
```
```   437   show "(f (r *\<^sub>R x), g (r *\<^sub>R x)) = r *\<^sub>R (f x, g x)"
```
```   438     by (simp add: f.scaleR g.scaleR)
```
```   439   obtain Kf where "0 < Kf" and norm_f: "\<And>x. norm (f x) \<le> norm x * Kf"
```
```   440     using f.pos_bounded by fast
```
```   441   obtain Kg where "0 < Kg" and norm_g: "\<And>x. norm (g x) \<le> norm x * Kg"
```
```   442     using g.pos_bounded by fast
```
```   443   have "\<forall>x. norm (f x, g x) \<le> norm x * (Kf + Kg)"
```
```   444     apply (rule allI)
```
```   445     apply (simp add: norm_Pair)
```
```   446     apply (rule order_trans [OF sqrt_add_le_add_sqrt], simp, simp)
```
```   447     apply (simp add: right_distrib)
```
```   448     apply (rule add_mono [OF norm_f norm_g])
```
```   449     done
```
```   450   then show "\<exists>K. \<forall>x. norm (f x, g x) \<le> norm x * K" ..
```
```   451 qed
```
```   452
```
```   453 subsection {* Frechet derivatives involving pairs *}
```
```   454
```
```   455 lemma FDERIV_Pair:
```
```   456   assumes f: "FDERIV f x :> f'" and g: "FDERIV g x :> g'"
```
```   457   shows "FDERIV (\<lambda>x. (f x, g x)) x :> (\<lambda>h. (f' h, g' h))"
```
```   458 apply (rule FDERIV_I)
```
```   459 apply (rule bounded_linear_Pair)
```
```   460 apply (rule FDERIV_bounded_linear [OF f])
```
```   461 apply (rule FDERIV_bounded_linear [OF g])
```
```   462 apply (simp add: norm_Pair)
```
```   463 apply (rule real_LIM_sandwich_zero)
```
```   464 apply (rule LIM_add_zero)
```
```   465 apply (rule FDERIV_D [OF f])
```
```   466 apply (rule FDERIV_D [OF g])
```
```   467 apply (rename_tac h)
```
```   468 apply (simp add: divide_nonneg_pos)
```
```   469 apply (rename_tac h)
```
```   470 apply (subst add_divide_distrib [symmetric])
```
```   471 apply (rule divide_right_mono [OF _ norm_ge_zero])
```
```   472 apply (rule order_trans [OF sqrt_add_le_add_sqrt])
```
```   473 apply simp
```
```   474 apply simp
```
```   475 apply simp
```
```   476 done
```
```   477
```
```   478 end
```