| author | immler | 
| Fri, 20 May 2016 22:01:39 +0200 | |
| changeset 63103 | 2394b0db133f | 
| parent 63040 | eb4ddd18d635 | 
| permissions | -rw-r--r-- | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
1  | 
(* Title: HOL/Library/Product_Vector.thy  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
2  | 
Author: Brian Huffman  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
3  | 
*)  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
4  | 
|
| 60500 | 5  | 
section \<open>Cartesian Products as Vector Spaces\<close>  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
6  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
7  | 
theory Product_Vector  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
8  | 
imports Inner_Product Product_plus  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
9  | 
begin  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
10  | 
|
| 60500 | 11  | 
subsection \<open>Product is a real vector space\<close>  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
12  | 
|
| 
37678
 
0040bafffdef
"prod" and "sum" replace "*" and "+" respectively
 
haftmann 
parents: 
36661 
diff
changeset
 | 
13  | 
instantiation prod :: (real_vector, real_vector) real_vector  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
14  | 
begin  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
15  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
16  | 
definition scaleR_prod_def:  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
17  | 
"scaleR r A = (scaleR r (fst A), scaleR r (snd A))"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
18  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
19  | 
lemma fst_scaleR [simp]: "fst (scaleR r A) = scaleR r (fst A)"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
20  | 
unfolding scaleR_prod_def by simp  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
21  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
22  | 
lemma snd_scaleR [simp]: "snd (scaleR r A) = scaleR r (snd A)"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
23  | 
unfolding scaleR_prod_def by simp  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
24  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
25  | 
lemma scaleR_Pair [simp]: "scaleR r (a, b) = (scaleR r a, scaleR r b)"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
26  | 
unfolding scaleR_prod_def by simp  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
27  | 
|
| 60679 | 28  | 
instance  | 
29  | 
proof  | 
|
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
30  | 
fix a b :: real and x y :: "'a \<times> 'b"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
31  | 
show "scaleR a (x + y) = scaleR a x + scaleR a y"  | 
| 
44066
 
d74182c93f04
rename Pair_fst_snd_eq to prod_eq_iff (keeping old name too)
 
huffman 
parents: 
37678 
diff
changeset
 | 
32  | 
by (simp add: prod_eq_iff scaleR_right_distrib)  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
33  | 
show "scaleR (a + b) x = scaleR a x + scaleR b x"  | 
| 
44066
 
d74182c93f04
rename Pair_fst_snd_eq to prod_eq_iff (keeping old name too)
 
huffman 
parents: 
37678 
diff
changeset
 | 
34  | 
by (simp add: prod_eq_iff scaleR_left_distrib)  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
35  | 
show "scaleR a (scaleR b x) = scaleR (a * b) x"  | 
| 
44066
 
d74182c93f04
rename Pair_fst_snd_eq to prod_eq_iff (keeping old name too)
 
huffman 
parents: 
37678 
diff
changeset
 | 
36  | 
by (simp add: prod_eq_iff)  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
37  | 
show "scaleR 1 x = x"  | 
| 
44066
 
d74182c93f04
rename Pair_fst_snd_eq to prod_eq_iff (keeping old name too)
 
huffman 
parents: 
37678 
diff
changeset
 | 
38  | 
by (simp add: prod_eq_iff)  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
39  | 
qed  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
40  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
41  | 
end  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
42  | 
|
| 60500 | 43  | 
subsection \<open>Product is a metric space\<close>  | 
| 
31339
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
44  | 
|
| 62101 | 45  | 
(* TODO: Product of uniform spaces and compatibility with metric_spaces! *)  | 
46  | 
||
47  | 
instantiation prod :: (metric_space, metric_space) dist  | 
|
| 
31339
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
48  | 
begin  | 
| 
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
49  | 
|
| 
54779
 
d9edb711ef31
pragmatic executability of instance prod::{open,dist,norm}
 
immler 
parents: 
53930 
diff
changeset
 | 
50  | 
definition dist_prod_def[code del]:  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51644 
diff
changeset
 | 
51  | 
"dist x y = sqrt ((dist (fst x) (fst y))\<^sup>2 + (dist (snd x) (snd y))\<^sup>2)"  | 
| 
31339
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
52  | 
|
| 62101 | 53  | 
instance ..  | 
54  | 
end  | 
|
55  | 
||
56  | 
instantiation prod :: (metric_space, metric_space) uniformity_dist  | 
|
57  | 
begin  | 
|
58  | 
||
59  | 
definition [code del]:  | 
|
| 
62102
 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 
hoelzl 
parents: 
62101 
diff
changeset
 | 
60  | 
  "(uniformity :: (('a \<times> 'b) \<times> ('a \<times> 'b)) filter) =
 | 
| 62101 | 61  | 
    (INF e:{0 <..}. principal {(x, y). dist x y < e})"
 | 
62  | 
||
| 
62102
 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 
hoelzl 
parents: 
62101 
diff
changeset
 | 
63  | 
instance  | 
| 62101 | 64  | 
by standard (rule uniformity_prod_def)  | 
65  | 
end  | 
|
66  | 
||
| 
62102
 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 
hoelzl 
parents: 
62101 
diff
changeset
 | 
67  | 
declare uniformity_Abort[where 'a="'a :: metric_space \<times> 'b :: metric_space", code]  | 
| 
 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 
hoelzl 
parents: 
62101 
diff
changeset
 | 
68  | 
|
| 62101 | 69  | 
instantiation prod :: (metric_space, metric_space) metric_space  | 
70  | 
begin  | 
|
71  | 
||
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51644 
diff
changeset
 | 
72  | 
lemma dist_Pair_Pair: "dist (a, b) (c, d) = sqrt ((dist a c)\<^sup>2 + (dist b d)\<^sup>2)"  | 
| 
31339
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
73  | 
unfolding dist_prod_def by simp  | 
| 
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
74  | 
|
| 36332 | 75  | 
lemma dist_fst_le: "dist (fst x) (fst y) \<le> dist x y"  | 
| 53930 | 76  | 
unfolding dist_prod_def by (rule real_sqrt_sum_squares_ge1)  | 
| 36332 | 77  | 
|
78  | 
lemma dist_snd_le: "dist (snd x) (snd y) \<le> dist x y"  | 
|
| 53930 | 79  | 
unfolding dist_prod_def by (rule real_sqrt_sum_squares_ge2)  | 
| 36332 | 80  | 
|
| 60679 | 81  | 
instance  | 
82  | 
proof  | 
|
| 
31339
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
83  | 
fix x y :: "'a \<times> 'b"  | 
| 
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
84  | 
show "dist x y = 0 \<longleftrightarrow> x = y"  | 
| 
44066
 
d74182c93f04
rename Pair_fst_snd_eq to prod_eq_iff (keeping old name too)
 
huffman 
parents: 
37678 
diff
changeset
 | 
85  | 
unfolding dist_prod_def prod_eq_iff by simp  | 
| 
31339
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
86  | 
next  | 
| 
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
87  | 
fix x y z :: "'a \<times> 'b"  | 
| 
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
88  | 
show "dist x y \<le> dist x z + dist y z"  | 
| 
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
89  | 
unfolding dist_prod_def  | 
| 31563 | 90  | 
by (intro order_trans [OF _ real_sqrt_sum_squares_triangle_ineq]  | 
91  | 
real_sqrt_le_mono add_mono power_mono dist_triangle2 zero_le_dist)  | 
|
| 31415 | 92  | 
next  | 
| 
31492
 
5400beeddb55
replace 'topo' with 'open'; add extra type constraint for 'open'
 
huffman 
parents: 
31491 
diff
changeset
 | 
93  | 
  fix S :: "('a \<times> 'b) set"
 | 
| 62101 | 94  | 
have *: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S)"  | 
| 31563 | 95  | 
proof  | 
| 36332 | 96  | 
assume "open S" show "\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S"  | 
97  | 
proof  | 
|
98  | 
fix x assume "x \<in> S"  | 
|
99  | 
obtain A B where "open A" "open B" "x \<in> A \<times> B" "A \<times> B \<subseteq> S"  | 
|
| 60500 | 100  | 
using \<open>open S\<close> and \<open>x \<in> S\<close> by (rule open_prod_elim)  | 
| 36332 | 101  | 
obtain r where r: "0 < r" "\<forall>y. dist y (fst x) < r \<longrightarrow> y \<in> A"  | 
| 60500 | 102  | 
using \<open>open A\<close> and \<open>x \<in> A \<times> B\<close> unfolding open_dist by auto  | 
| 36332 | 103  | 
obtain s where s: "0 < s" "\<forall>y. dist y (snd x) < s \<longrightarrow> y \<in> B"  | 
| 60500 | 104  | 
using \<open>open B\<close> and \<open>x \<in> A \<times> B\<close> unfolding open_dist by auto  | 
| 36332 | 105  | 
let ?e = "min r s"  | 
106  | 
have "0 < ?e \<and> (\<forall>y. dist y x < ?e \<longrightarrow> y \<in> S)"  | 
|
107  | 
proof (intro allI impI conjI)  | 
|
108  | 
show "0 < min r s" by (simp add: r(1) s(1))  | 
|
109  | 
next  | 
|
110  | 
fix y assume "dist y x < min r s"  | 
|
111  | 
hence "dist y x < r" and "dist y x < s"  | 
|
112  | 
by simp_all  | 
|
113  | 
hence "dist (fst y) (fst x) < r" and "dist (snd y) (snd x) < s"  | 
|
114  | 
by (auto intro: le_less_trans dist_fst_le dist_snd_le)  | 
|
115  | 
hence "fst y \<in> A" and "snd y \<in> B"  | 
|
116  | 
by (simp_all add: r(2) s(2))  | 
|
117  | 
hence "y \<in> A \<times> B" by (induct y, simp)  | 
|
| 60500 | 118  | 
with \<open>A \<times> B \<subseteq> S\<close> show "y \<in> S" ..  | 
| 36332 | 119  | 
qed  | 
120  | 
thus "\<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S" ..  | 
|
121  | 
qed  | 
|
| 31563 | 122  | 
next  | 
| 44575 | 123  | 
assume *: "\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S" show "open S"  | 
124  | 
proof (rule open_prod_intro)  | 
|
125  | 
fix x assume "x \<in> S"  | 
|
126  | 
then obtain e where "0 < e" and S: "\<forall>y. dist y x < e \<longrightarrow> y \<in> S"  | 
|
127  | 
using * by fast  | 
|
| 63040 | 128  | 
define r where "r = e / sqrt 2"  | 
129  | 
define s where "s = e / sqrt 2"  | 
|
| 60500 | 130  | 
from \<open>0 < e\<close> have "0 < r" and "0 < s"  | 
| 56541 | 131  | 
unfolding r_def s_def by simp_all  | 
| 60500 | 132  | 
from \<open>0 < e\<close> have "e = sqrt (r\<^sup>2 + s\<^sup>2)"  | 
| 44575 | 133  | 
unfolding r_def s_def by (simp add: power_divide)  | 
| 63040 | 134  | 
      define A where "A = {y. dist (fst x) y < r}"
 | 
135  | 
      define B where "B = {y. dist (snd x) y < s}"
 | 
|
| 44575 | 136  | 
have "open A" and "open B"  | 
137  | 
unfolding A_def B_def by (simp_all add: open_ball)  | 
|
138  | 
moreover have "x \<in> A \<times> B"  | 
|
139  | 
unfolding A_def B_def mem_Times_iff  | 
|
| 60500 | 140  | 
using \<open>0 < r\<close> and \<open>0 < s\<close> by simp  | 
| 44575 | 141  | 
moreover have "A \<times> B \<subseteq> S"  | 
142  | 
proof (clarify)  | 
|
143  | 
fix a b assume "a \<in> A" and "b \<in> B"  | 
|
144  | 
hence "dist a (fst x) < r" and "dist b (snd x) < s"  | 
|
145  | 
unfolding A_def B_def by (simp_all add: dist_commute)  | 
|
146  | 
hence "dist (a, b) x < e"  | 
|
| 60500 | 147  | 
unfolding dist_prod_def \<open>e = sqrt (r\<^sup>2 + s\<^sup>2)\<close>  | 
| 44575 | 148  | 
by (simp add: add_strict_mono power_strict_mono)  | 
149  | 
thus "(a, b) \<in> S"  | 
|
150  | 
by (simp add: S)  | 
|
151  | 
qed  | 
|
152  | 
ultimately show "\<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S" by fast  | 
|
153  | 
qed  | 
|
| 31563 | 154  | 
qed  | 
| 62101 | 155  | 
show "open S = (\<forall>x\<in>S. \<forall>\<^sub>F (x', y) in uniformity. x' = x \<longrightarrow> y \<in> S)"  | 
156  | 
unfolding * eventually_uniformity_metric  | 
|
157  | 
by (simp del: split_paired_All add: dist_prod_def dist_commute)  | 
|
| 
31339
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
158  | 
qed  | 
| 
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
159  | 
|
| 
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
160  | 
end  | 
| 
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
161  | 
|
| 
54890
 
cb892d835803
fundamental treatment of undefined vs. universally partial replaces code_abort
 
haftmann 
parents: 
54779 
diff
changeset
 | 
162  | 
declare [[code abort: "dist::('a::metric_space*'b::metric_space)\<Rightarrow>('a*'b) \<Rightarrow> real"]]
 | 
| 
54779
 
d9edb711ef31
pragmatic executability of instance prod::{open,dist,norm}
 
immler 
parents: 
53930 
diff
changeset
 | 
163  | 
|
| 
31405
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
164  | 
lemma Cauchy_fst: "Cauchy X \<Longrightarrow> Cauchy (\<lambda>n. fst (X n))"  | 
| 53930 | 165  | 
unfolding Cauchy_def by (fast elim: le_less_trans [OF dist_fst_le])  | 
| 
31405
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
166  | 
|
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
167  | 
lemma Cauchy_snd: "Cauchy X \<Longrightarrow> Cauchy (\<lambda>n. snd (X n))"  | 
| 53930 | 168  | 
unfolding Cauchy_def by (fast elim: le_less_trans [OF dist_snd_le])  | 
| 
31405
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
169  | 
|
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
170  | 
lemma Cauchy_Pair:  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
171  | 
assumes "Cauchy X" and "Cauchy Y"  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
172  | 
shows "Cauchy (\<lambda>n. (X n, Y n))"  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
173  | 
proof (rule metric_CauchyI)  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
174  | 
fix r :: real assume "0 < r"  | 
| 56541 | 175  | 
hence "0 < r / sqrt 2" (is "0 < ?s") by simp  | 
| 
31405
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
176  | 
obtain M where M: "\<forall>m\<ge>M. \<forall>n\<ge>M. dist (X m) (X n) < ?s"  | 
| 60500 | 177  | 
using metric_CauchyD [OF \<open>Cauchy X\<close> \<open>0 < ?s\<close>] ..  | 
| 
31405
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
178  | 
obtain N where N: "\<forall>m\<ge>N. \<forall>n\<ge>N. dist (Y m) (Y n) < ?s"  | 
| 60500 | 179  | 
using metric_CauchyD [OF \<open>Cauchy Y\<close> \<open>0 < ?s\<close>] ..  | 
| 
31405
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
180  | 
have "\<forall>m\<ge>max M N. \<forall>n\<ge>max M N. dist (X m, Y m) (X n, Y n) < r"  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
181  | 
using M N by (simp add: real_sqrt_sum_squares_less dist_Pair_Pair)  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
182  | 
then show "\<exists>n0. \<forall>m\<ge>n0. \<forall>n\<ge>n0. dist (X m, Y m) (X n, Y n) < r" ..  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
183  | 
qed  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
184  | 
|
| 60500 | 185  | 
subsection \<open>Product is a complete metric space\<close>  | 
| 
31405
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
186  | 
|
| 
37678
 
0040bafffdef
"prod" and "sum" replace "*" and "+" respectively
 
haftmann 
parents: 
36661 
diff
changeset
 | 
187  | 
instance prod :: (complete_space, complete_space) complete_space  | 
| 
31405
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
188  | 
proof  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
189  | 
fix X :: "nat \<Rightarrow> 'a \<times> 'b" assume "Cauchy X"  | 
| 61969 | 190  | 
have 1: "(\<lambda>n. fst (X n)) \<longlonglongrightarrow> lim (\<lambda>n. fst (X n))"  | 
| 60500 | 191  | 
using Cauchy_fst [OF \<open>Cauchy X\<close>]  | 
| 
31405
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
192  | 
by (simp add: Cauchy_convergent_iff convergent_LIMSEQ_iff)  | 
| 61969 | 193  | 
have 2: "(\<lambda>n. snd (X n)) \<longlonglongrightarrow> lim (\<lambda>n. snd (X n))"  | 
| 60500 | 194  | 
using Cauchy_snd [OF \<open>Cauchy X\<close>]  | 
| 
31405
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
195  | 
by (simp add: Cauchy_convergent_iff convergent_LIMSEQ_iff)  | 
| 61969 | 196  | 
have "X \<longlonglongrightarrow> (lim (\<lambda>n. fst (X n)), lim (\<lambda>n. snd (X n)))"  | 
| 
36660
 
1cc4ab4b7ff7
make (X ----> L) an abbreviation for (X ---> L) sequentially
 
huffman 
parents: 
36332 
diff
changeset
 | 
197  | 
using tendsto_Pair [OF 1 2] by simp  | 
| 
31405
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
198  | 
then show "convergent X"  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
199  | 
by (rule convergentI)  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
200  | 
qed  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
201  | 
|
| 60500 | 202  | 
subsection \<open>Product is a normed vector space\<close>  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
203  | 
|
| 
37678
 
0040bafffdef
"prod" and "sum" replace "*" and "+" respectively
 
haftmann 
parents: 
36661 
diff
changeset
 | 
204  | 
instantiation prod :: (real_normed_vector, real_normed_vector) real_normed_vector  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
205  | 
begin  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
206  | 
|
| 
54779
 
d9edb711ef31
pragmatic executability of instance prod::{open,dist,norm}
 
immler 
parents: 
53930 
diff
changeset
 | 
207  | 
definition norm_prod_def[code del]:  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51644 
diff
changeset
 | 
208  | 
"norm x = sqrt ((norm (fst x))\<^sup>2 + (norm (snd x))\<^sup>2)"  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
209  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
210  | 
definition sgn_prod_def:  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
211  | 
"sgn (x::'a \<times> 'b) = scaleR (inverse (norm x)) x"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
212  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51644 
diff
changeset
 | 
213  | 
lemma norm_Pair: "norm (a, b) = sqrt ((norm a)\<^sup>2 + (norm b)\<^sup>2)"  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
214  | 
unfolding norm_prod_def by simp  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
215  | 
|
| 60679 | 216  | 
instance  | 
217  | 
proof  | 
|
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
218  | 
fix r :: real and x y :: "'a \<times> 'b"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
219  | 
show "norm x = 0 \<longleftrightarrow> x = 0"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
220  | 
unfolding norm_prod_def  | 
| 
44066
 
d74182c93f04
rename Pair_fst_snd_eq to prod_eq_iff (keeping old name too)
 
huffman 
parents: 
37678 
diff
changeset
 | 
221  | 
by (simp add: prod_eq_iff)  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
222  | 
show "norm (x + y) \<le> norm x + norm y"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
223  | 
unfolding norm_prod_def  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
224  | 
apply (rule order_trans [OF _ real_sqrt_sum_squares_triangle_ineq])  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
225  | 
apply (simp add: add_mono power_mono norm_triangle_ineq)  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
226  | 
done  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
227  | 
show "norm (scaleR r x) = \<bar>r\<bar> * norm x"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
228  | 
unfolding norm_prod_def  | 
| 31587 | 229  | 
apply (simp add: power_mult_distrib)  | 
| 
49962
 
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
 
webertj 
parents: 
44749 
diff
changeset
 | 
230  | 
apply (simp add: distrib_left [symmetric])  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
231  | 
apply (simp add: real_sqrt_mult_distrib)  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
232  | 
done  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
233  | 
show "sgn x = scaleR (inverse (norm x)) x"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
234  | 
by (rule sgn_prod_def)  | 
| 31290 | 235  | 
show "dist x y = norm (x - y)"  | 
| 
31339
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
236  | 
unfolding dist_prod_def norm_prod_def  | 
| 
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
237  | 
by (simp add: dist_norm)  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
238  | 
qed  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
239  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
240  | 
end  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
241  | 
|
| 
54890
 
cb892d835803
fundamental treatment of undefined vs. universally partial replaces code_abort
 
haftmann 
parents: 
54779 
diff
changeset
 | 
242  | 
declare [[code abort: "norm::('a::real_normed_vector*'b::real_normed_vector) \<Rightarrow> real"]]
 | 
| 
54779
 
d9edb711ef31
pragmatic executability of instance prod::{open,dist,norm}
 
immler 
parents: 
53930 
diff
changeset
 | 
243  | 
|
| 
37678
 
0040bafffdef
"prod" and "sum" replace "*" and "+" respectively
 
haftmann 
parents: 
36661 
diff
changeset
 | 
244  | 
instance prod :: (banach, banach) banach ..  | 
| 
31405
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
245  | 
|
| 60500 | 246  | 
subsubsection \<open>Pair operations are linear\<close>  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
247  | 
|
| 
44282
 
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
 
huffman 
parents: 
44233 
diff
changeset
 | 
248  | 
lemma bounded_linear_fst: "bounded_linear fst"  | 
| 44127 | 249  | 
using fst_add fst_scaleR  | 
250  | 
by (rule bounded_linear_intro [where K=1], simp add: norm_prod_def)  | 
|
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
251  | 
|
| 
44282
 
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
 
huffman 
parents: 
44233 
diff
changeset
 | 
252  | 
lemma bounded_linear_snd: "bounded_linear snd"  | 
| 44127 | 253  | 
using snd_add snd_scaleR  | 
254  | 
by (rule bounded_linear_intro [where K=1], simp add: norm_prod_def)  | 
|
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
255  | 
|
| 
61915
 
e9812a95d108
theory for type of bounded linear functions; differentiation under the integral sign
 
immler 
parents: 
60679 
diff
changeset
 | 
256  | 
lemmas bounded_linear_fst_comp = bounded_linear_fst[THEN bounded_linear_compose]  | 
| 
 
e9812a95d108
theory for type of bounded linear functions; differentiation under the integral sign
 
immler 
parents: 
60679 
diff
changeset
 | 
257  | 
|
| 
 
e9812a95d108
theory for type of bounded linear functions; differentiation under the integral sign
 
immler 
parents: 
60679 
diff
changeset
 | 
258  | 
lemmas bounded_linear_snd_comp = bounded_linear_snd[THEN bounded_linear_compose]  | 
| 
 
e9812a95d108
theory for type of bounded linear functions; differentiation under the integral sign
 
immler 
parents: 
60679 
diff
changeset
 | 
259  | 
|
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
260  | 
lemma bounded_linear_Pair:  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
261  | 
assumes f: "bounded_linear f"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
262  | 
assumes g: "bounded_linear g"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
263  | 
shows "bounded_linear (\<lambda>x. (f x, g x))"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
264  | 
proof  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
265  | 
interpret f: bounded_linear f by fact  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
266  | 
interpret g: bounded_linear g by fact  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
267  | 
fix x y and r :: real  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
268  | 
show "(f (x + y), g (x + y)) = (f x, g x) + (f y, g y)"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
269  | 
by (simp add: f.add g.add)  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
270  | 
show "(f (r *\<^sub>R x), g (r *\<^sub>R x)) = r *\<^sub>R (f x, g x)"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
271  | 
by (simp add: f.scaleR g.scaleR)  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
272  | 
obtain Kf where "0 < Kf" and norm_f: "\<And>x. norm (f x) \<le> norm x * Kf"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
273  | 
using f.pos_bounded by fast  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
274  | 
obtain Kg where "0 < Kg" and norm_g: "\<And>x. norm (g x) \<le> norm x * Kg"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
275  | 
using g.pos_bounded by fast  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
276  | 
have "\<forall>x. norm (f x, g x) \<le> norm x * (Kf + Kg)"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
277  | 
apply (rule allI)  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
278  | 
apply (simp add: norm_Pair)  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
279  | 
apply (rule order_trans [OF sqrt_add_le_add_sqrt], simp, simp)  | 
| 
49962
 
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
 
webertj 
parents: 
44749 
diff
changeset
 | 
280  | 
apply (simp add: distrib_left)  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
281  | 
apply (rule add_mono [OF norm_f norm_g])  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
282  | 
done  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
283  | 
then show "\<exists>K. \<forall>x. norm (f x, g x) \<le> norm x * K" ..  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
284  | 
qed  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
285  | 
|
| 60500 | 286  | 
subsubsection \<open>Frechet derivatives involving pairs\<close>  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
287  | 
|
| 
56381
 
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
 
hoelzl 
parents: 
56371 
diff
changeset
 | 
288  | 
lemma has_derivative_Pair [derivative_intros]:  | 
| 
56181
 
2aa0b19e74f3
unify syntax for has_derivative and differentiable
 
hoelzl 
parents: 
54890 
diff
changeset
 | 
289  | 
assumes f: "(f has_derivative f') (at x within s)" and g: "(g has_derivative g') (at x within s)"  | 
| 
 
2aa0b19e74f3
unify syntax for has_derivative and differentiable
 
hoelzl 
parents: 
54890 
diff
changeset
 | 
290  | 
shows "((\<lambda>x. (f x, g x)) has_derivative (\<lambda>h. (f' h, g' h))) (at x within s)"  | 
| 
 
2aa0b19e74f3
unify syntax for has_derivative and differentiable
 
hoelzl 
parents: 
54890 
diff
changeset
 | 
291  | 
proof (rule has_derivativeI_sandwich[of 1])  | 
| 44575 | 292  | 
show "bounded_linear (\<lambda>h. (f' h, g' h))"  | 
| 
56181
 
2aa0b19e74f3
unify syntax for has_derivative and differentiable
 
hoelzl 
parents: 
54890 
diff
changeset
 | 
293  | 
using f g by (intro bounded_linear_Pair has_derivative_bounded_linear)  | 
| 
51642
 
400ec5ae7f8f
move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
294  | 
let ?Rf = "\<lambda>y. f y - f x - f' (y - x)"  | 
| 
 
400ec5ae7f8f
move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
295  | 
let ?Rg = "\<lambda>y. g y - g x - g' (y - x)"  | 
| 
 
400ec5ae7f8f
move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
296  | 
let ?R = "\<lambda>y. ((f y, g y) - (f x, g x) - (f' (y - x), g' (y - x)))"  | 
| 
 
400ec5ae7f8f
move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
297  | 
|
| 61973 | 298  | 
show "((\<lambda>y. norm (?Rf y) / norm (y - x) + norm (?Rg y) / norm (y - x)) \<longlongrightarrow> 0) (at x within s)"  | 
| 
56181
 
2aa0b19e74f3
unify syntax for has_derivative and differentiable
 
hoelzl 
parents: 
54890 
diff
changeset
 | 
299  | 
using f g by (intro tendsto_add_zero) (auto simp: has_derivative_iff_norm)  | 
| 
51642
 
400ec5ae7f8f
move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
300  | 
|
| 
 
400ec5ae7f8f
move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
301  | 
fix y :: 'a assume "y \<noteq> x"  | 
| 
 
400ec5ae7f8f
move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
302  | 
show "norm (?R y) / norm (y - x) \<le> norm (?Rf y) / norm (y - x) + norm (?Rg y) / norm (y - x)"  | 
| 
 
400ec5ae7f8f
move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
303  | 
unfolding add_divide_distrib [symmetric]  | 
| 
 
400ec5ae7f8f
move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
304  | 
by (simp add: norm_Pair divide_right_mono order_trans [OF sqrt_add_le_add_sqrt])  | 
| 
 
400ec5ae7f8f
move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
305  | 
qed simp  | 
| 
 
400ec5ae7f8f
move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
306  | 
|
| 
56381
 
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
 
hoelzl 
parents: 
56371 
diff
changeset
 | 
307  | 
lemmas has_derivative_fst [derivative_intros] = bounded_linear.has_derivative [OF bounded_linear_fst]  | 
| 
 
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
 
hoelzl 
parents: 
56371 
diff
changeset
 | 
308  | 
lemmas has_derivative_snd [derivative_intros] = bounded_linear.has_derivative [OF bounded_linear_snd]  | 
| 
51642
 
400ec5ae7f8f
move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
309  | 
|
| 
56381
 
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
 
hoelzl 
parents: 
56371 
diff
changeset
 | 
310  | 
lemma has_derivative_split [derivative_intros]:  | 
| 
51642
 
400ec5ae7f8f
move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
311  | 
"((\<lambda>p. f (fst p) (snd p)) has_derivative f') F \<Longrightarrow> ((\<lambda>(a, b). f a b) has_derivative f') F"  | 
| 
 
400ec5ae7f8f
move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
312  | 
unfolding split_beta' .  | 
| 44575 | 313  | 
|
| 60500 | 314  | 
subsection \<open>Product is an inner product space\<close>  | 
| 44575 | 315  | 
|
316  | 
instantiation prod :: (real_inner, real_inner) real_inner  | 
|
317  | 
begin  | 
|
318  | 
||
319  | 
definition inner_prod_def:  | 
|
320  | 
"inner x y = inner (fst x) (fst y) + inner (snd x) (snd y)"  | 
|
321  | 
||
322  | 
lemma inner_Pair [simp]: "inner (a, b) (c, d) = inner a c + inner b d"  | 
|
323  | 
unfolding inner_prod_def by simp  | 
|
324  | 
||
| 60679 | 325  | 
instance  | 
326  | 
proof  | 
|
| 44575 | 327  | 
fix r :: real  | 
328  | 
fix x y z :: "'a::real_inner \<times> 'b::real_inner"  | 
|
329  | 
show "inner x y = inner y x"  | 
|
330  | 
unfolding inner_prod_def  | 
|
331  | 
by (simp add: inner_commute)  | 
|
332  | 
show "inner (x + y) z = inner x z + inner y z"  | 
|
333  | 
unfolding inner_prod_def  | 
|
334  | 
by (simp add: inner_add_left)  | 
|
335  | 
show "inner (scaleR r x) y = r * inner x y"  | 
|
336  | 
unfolding inner_prod_def  | 
|
| 
49962
 
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
 
webertj 
parents: 
44749 
diff
changeset
 | 
337  | 
by (simp add: distrib_left)  | 
| 44575 | 338  | 
show "0 \<le> inner x x"  | 
339  | 
unfolding inner_prod_def  | 
|
340  | 
by (intro add_nonneg_nonneg inner_ge_zero)  | 
|
341  | 
show "inner x x = 0 \<longleftrightarrow> x = 0"  | 
|
342  | 
unfolding inner_prod_def prod_eq_iff  | 
|
343  | 
by (simp add: add_nonneg_eq_0_iff)  | 
|
344  | 
show "norm x = sqrt (inner x x)"  | 
|
345  | 
unfolding norm_prod_def inner_prod_def  | 
|
346  | 
by (simp add: power2_norm_eq_inner)  | 
|
347  | 
qed  | 
|
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
348  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
349  | 
end  | 
| 44575 | 350  | 
|
| 59425 | 351  | 
lemma inner_Pair_0: "inner x (0, b) = inner (snd x) b" "inner x (a, 0) = inner (fst x) a"  | 
352  | 
by (cases x, simp)+  | 
|
353  | 
||
| 
62102
 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 
hoelzl 
parents: 
62101 
diff
changeset
 | 
354  | 
lemma  | 
| 
60615
 
e5fa1d5d3952
Useful lemmas. The theorem concerning swapping the variables in a double integral.
 
paulson <lp15@cam.ac.uk> 
parents: 
60500 
diff
changeset
 | 
355  | 
fixes x :: "'a::real_normed_vector"  | 
| 
62102
 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 
hoelzl 
parents: 
62101 
diff
changeset
 | 
356  | 
shows norm_Pair1 [simp]: "norm (0,x) = norm x"  | 
| 
60615
 
e5fa1d5d3952
Useful lemmas. The theorem concerning swapping the variables in a double integral.
 
paulson <lp15@cam.ac.uk> 
parents: 
60500 
diff
changeset
 | 
357  | 
and norm_Pair2 [simp]: "norm (x,0) = norm x"  | 
| 
 
e5fa1d5d3952
Useful lemmas. The theorem concerning swapping the variables in a double integral.
 
paulson <lp15@cam.ac.uk> 
parents: 
60500 
diff
changeset
 | 
358  | 
by (auto simp: norm_Pair)  | 
| 
 
e5fa1d5d3952
Useful lemmas. The theorem concerning swapping the variables in a double integral.
 
paulson <lp15@cam.ac.uk> 
parents: 
60500 
diff
changeset
 | 
359  | 
|
| 
62131
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
62102 
diff
changeset
 | 
360  | 
lemma norm_commute: "norm (x,y) = norm (y,x)"  | 
| 
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
62102 
diff
changeset
 | 
361  | 
by (simp add: norm_Pair)  | 
| 
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
62102 
diff
changeset
 | 
362  | 
|
| 
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
62102 
diff
changeset
 | 
363  | 
lemma norm_fst_le: "norm x \<le> norm (x,y)"  | 
| 
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
62102 
diff
changeset
 | 
364  | 
by (metis dist_fst_le fst_conv fst_zero norm_conv_dist)  | 
| 
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
62102 
diff
changeset
 | 
365  | 
|
| 
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
62102 
diff
changeset
 | 
366  | 
lemma norm_snd_le: "norm y \<le> norm (x,y)"  | 
| 
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
62102 
diff
changeset
 | 
367  | 
by (metis dist_snd_le snd_conv snd_zero norm_conv_dist)  | 
| 59425 | 368  | 
|
| 44575 | 369  | 
end  |