| author | paulson <lp15@cam.ac.uk> | 
| Tue, 02 Nov 2021 17:01:47 +0000 | |
| changeset 74668 | 2d9d02beaf96 | 
| parent 74475 | 409ca22dee4c | 
| child 77228 | 8c093a4b8ccf | 
| permissions | -rw-r--r-- | 
| 
63971
 
da89140186e2
HOL-Analysis: move Product_Vector and Inner_Product from Library
 
hoelzl 
parents: 
63040 
diff
changeset
 | 
1  | 
(* Title: HOL/Analysis/Product_Vector.thy  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
2  | 
Author: Brian Huffman  | 
| 
74475
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
3  | 
Dominique Unruh, University of Tartu  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
4  | 
*)  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
5  | 
|
| 60500 | 6  | 
section \<open>Cartesian Products as Vector Spaces\<close>  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
7  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
8  | 
theory Product_Vector  | 
| 69511 | 9  | 
imports  | 
10  | 
Complex_Main  | 
|
11  | 
"HOL-Library.Product_Plus"  | 
|
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
12  | 
begin  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
13  | 
|
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
14  | 
lemma Times_eq_image_sum:  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
15  | 
fixes S :: "'a :: comm_monoid_add set" and T :: "'b :: comm_monoid_add set"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
16  | 
  shows "S \<times> T = {u + v |u v. u \<in> (\<lambda>x. (x, 0)) ` S \<and> v \<in> Pair 0 ` T}"
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
17  | 
by force  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
18  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
19  | 
|
| 69541 | 20  | 
subsection \<open>Product is a Module\<close>  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
21  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
22  | 
locale module_prod = module_pair begin  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
23  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
24  | 
definition scale :: "'a \<Rightarrow> 'b \<times> 'c \<Rightarrow> 'b \<times> 'c"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
25  | 
where "scale a v = (s1 a (fst v), s2 a (snd v))"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
26  | 
|
| 70136 | 27  | 
lemma\<^marker>\<open>tag important\<close> scale_prod: "scale x (a, b) = (s1 x a, s2 x b)"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
28  | 
by (auto simp: scale_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
29  | 
|
| 70136 | 30  | 
sublocale\<^marker>\<open>tag important\<close> p: module scale  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
31  | 
proof qed (simp_all add: scale_def  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
32  | 
m1.scale_left_distrib m1.scale_right_distrib m2.scale_left_distrib m2.scale_right_distrib)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
33  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
34  | 
lemma subspace_Times: "m1.subspace A \<Longrightarrow> m2.subspace B \<Longrightarrow> p.subspace (A \<times> B)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
35  | 
unfolding m1.subspace_def m2.subspace_def p.subspace_def  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
36  | 
by (auto simp: zero_prod_def scale_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
37  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
38  | 
lemma module_hom_fst: "module_hom scale s1 fst"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
39  | 
by unfold_locales (auto simp: scale_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
40  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
41  | 
lemma module_hom_snd: "module_hom scale s2 snd"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
42  | 
by unfold_locales (auto simp: scale_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
43  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
44  | 
end  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
45  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
46  | 
locale vector_space_prod = vector_space_pair begin  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
47  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
48  | 
sublocale module_prod s1 s2  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
49  | 
rewrites "module_hom = Vector_Spaces.linear"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
50  | 
by unfold_locales (fact module_hom_eq_linear)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
51  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
52  | 
sublocale p: vector_space scale by unfold_locales (auto simp: algebra_simps)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
53  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
54  | 
lemmas linear_fst = module_hom_fst  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
55  | 
and linear_snd = module_hom_snd  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
56  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
57  | 
end  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
58  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
59  | 
|
| 69541 | 60  | 
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
 | 
61  | 
|
| 68617 | 62  | 
instantiation prod :: (real_vector, real_vector) real_vector  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
63  | 
begin  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
64  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
65  | 
definition scaleR_prod_def:  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
66  | 
"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
 | 
67  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
68  | 
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
 | 
69  | 
unfolding scaleR_prod_def by simp  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
70  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
71  | 
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
 | 
72  | 
unfolding scaleR_prod_def by simp  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
73  | 
|
| 69541 | 74  | 
proposition scaleR_Pair [simp]: "scaleR r (a, b) = (scaleR r a, scaleR r b)"  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
75  | 
unfolding scaleR_prod_def by simp  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
76  | 
|
| 60679 | 77  | 
instance  | 
78  | 
proof  | 
|
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
79  | 
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
 | 
80  | 
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
 | 
81  | 
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
 | 
82  | 
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
 | 
83  | 
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
 | 
84  | 
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
 | 
85  | 
by (simp add: prod_eq_iff)  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
86  | 
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
 | 
87  | 
by (simp add: prod_eq_iff)  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
88  | 
qed  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
89  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
90  | 
end  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
91  | 
|
| 
69064
 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 
nipkow 
parents: 
68617 
diff
changeset
 | 
92  | 
lemma module_prod_scale_eq_scaleR: "module_prod.scale (*\<^sub>R) (*\<^sub>R) = scaleR"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
93  | 
apply (rule ext) apply (rule ext)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
94  | 
apply (subst module_prod.scale_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
95  | 
subgoal by unfold_locales  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
96  | 
by (simp add: scaleR_prod_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
97  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
98  | 
interpretation real_vector?: vector_space_prod "scaleR::_\<Rightarrow>_\<Rightarrow>'a::real_vector" "scaleR::_\<Rightarrow>_\<Rightarrow>'b::real_vector"  | 
| 
69064
 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 
nipkow 
parents: 
68617 
diff
changeset
 | 
99  | 
  rewrites "scale = ((*\<^sub>R)::_\<Rightarrow>_\<Rightarrow>('a \<times> 'b))"
 | 
| 
 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 
nipkow 
parents: 
68617 
diff
changeset
 | 
100  | 
and "module.dependent (*\<^sub>R) = dependent"  | 
| 
 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 
nipkow 
parents: 
68617 
diff
changeset
 | 
101  | 
and "module.representation (*\<^sub>R) = representation"  | 
| 
 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 
nipkow 
parents: 
68617 
diff
changeset
 | 
102  | 
and "module.subspace (*\<^sub>R) = subspace"  | 
| 
 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 
nipkow 
parents: 
68617 
diff
changeset
 | 
103  | 
and "module.span (*\<^sub>R) = span"  | 
| 
 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 
nipkow 
parents: 
68617 
diff
changeset
 | 
104  | 
and "vector_space.extend_basis (*\<^sub>R) = extend_basis"  | 
| 
 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 
nipkow 
parents: 
68617 
diff
changeset
 | 
105  | 
and "vector_space.dim (*\<^sub>R) = dim"  | 
| 
 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 
nipkow 
parents: 
68617 
diff
changeset
 | 
106  | 
and "Vector_Spaces.linear (*\<^sub>R) (*\<^sub>R) = linear"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
107  | 
subgoal by unfold_locales  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
108  | 
subgoal by (fact module_prod_scale_eq_scaleR)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
109  | 
unfolding dependent_raw_def representation_raw_def subspace_raw_def span_raw_def  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
110  | 
extend_basis_raw_def dim_raw_def linear_def  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
111  | 
by (rule refl)+  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
112  | 
|
| 69541 | 113  | 
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
 | 
114  | 
|
| 62101 | 115  | 
(* TODO: Product of uniform spaces and compatibility with metric_spaces! *)  | 
116  | 
||
| 70136 | 117  | 
instantiation\<^marker>\<open>tag unimportant\<close> 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
 | 
118  | 
begin  | 
| 
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
119  | 
|
| 69541 | 120  | 
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
 | 
121  | 
"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
 | 
122  | 
|
| 62101 | 123  | 
instance ..  | 
124  | 
end  | 
|
125  | 
||
| 
74475
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
126  | 
instantiation\<^marker>\<open>tag unimportant\<close> prod :: (uniformity, uniformity) uniformity begin  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
127  | 
|
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
128  | 
definition [code del]: \<open>(uniformity :: (('a \<times> 'b) \<times> ('a \<times> 'b)) filter) = 
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
129  | 
filtermap (\<lambda>((x1,x2),(y1,y2)). ((x1,y1),(x2,y2))) (uniformity \<times>\<^sub>F uniformity)\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
130  | 
|
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
131  | 
instance..  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
132  | 
end  | 
| 62101 | 133  | 
|
| 
74475
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
134  | 
instantiation\<^marker>\<open>tag unimportant\<close> prod :: (uniform_space, uniform_space) uniform_space begin  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
135  | 
instance  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
136  | 
proof standard  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
137  | 
  fix U :: \<open>('a \<times> 'b) set\<close>
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
138  | 
show \<open>open U \<longleftrightarrow> (\<forall>x\<in>U. \<forall>\<^sub>F (x', y) in uniformity. x' = x \<longrightarrow> y \<in> U)\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
139  | 
proof (intro iffI ballI)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
140  | 
fix x assume \<open>open U\<close> and \<open>x \<in> U\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
141  | 
then obtain A B where \<open>open A\<close> \<open>open B\<close> \<open>x \<in> A\<times>B\<close> \<open>A\<times>B \<subseteq> U\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
142  | 
by (metis open_prod_elim)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
143  | 
define UA where \<open>UA = (\<lambda>(x'::'a,y). x' = fst x \<longrightarrow> y \<in> A)\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
144  | 
from \<open>open A\<close> \<open>x \<in> A\<times>B\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
145  | 
have \<open>eventually UA uniformity\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
146  | 
unfolding open_uniformity UA_def by auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
147  | 
define UB where \<open>UB = (\<lambda>(x'::'b,y). x' = snd x \<longrightarrow> y \<in> B)\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
148  | 
from \<open>open A\<close> \<open>open B\<close> \<open>x \<in> A\<times>B\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
149  | 
have \<open>eventually UA uniformity\<close> \<open>eventually UB uniformity\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
150  | 
unfolding open_uniformity UA_def UB_def by auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
151  | 
then have \<open>\<forall>\<^sub>F ((x'1, y1), (x'2, y2)) in uniformity \<times>\<^sub>F uniformity. (x'1,x'2) = x \<longrightarrow> (y1,y2) \<in> U\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
152  | 
apply (auto intro!: exI[of _ UA] exI[of _ UB] simp add: eventually_prod_filter)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
153  | 
using \<open>A\<times>B \<subseteq> U\<close> by (auto simp: UA_def UB_def)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
154  | 
then show \<open>\<forall>\<^sub>F (x', y) in uniformity. x' = x \<longrightarrow> y \<in> U\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
155  | 
by (simp add: uniformity_prod_def eventually_filtermap case_prod_unfold)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
156  | 
next  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
157  | 
assume asm: \<open>\<forall>x\<in>U. \<forall>\<^sub>F (x', y) in uniformity. x' = x \<longrightarrow> y \<in> U\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
158  | 
show \<open>open U\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
159  | 
proof (unfold open_prod_def, intro ballI)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
160  | 
fix x assume \<open>x \<in> U\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
161  | 
with asm have \<open>\<forall>\<^sub>F (x', y) in uniformity. x' = x \<longrightarrow> y \<in> U\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
162  | 
by auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
163  | 
then have \<open>\<forall>\<^sub>F ((x'1, y1), (x'2, y2)) in uniformity \<times>\<^sub>F uniformity. (x'1,x'2) = x \<longrightarrow> (y1,y2) \<in> U\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
164  | 
by (simp add: uniformity_prod_def eventually_filtermap case_prod_unfold)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
165  | 
then obtain UA UB where \<open>eventually UA uniformity\<close> and \<open>eventually UB uniformity\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
166  | 
and UA_UB_U: \<open>UA (a1, a2) \<Longrightarrow> UB (b1, b2) \<Longrightarrow> (a1, b1) = x \<Longrightarrow> (a2, b2) \<in> U\<close> for a1 a2 b1 b2  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
167  | 
apply atomize_elim by (simp add: case_prod_beta eventually_prod_filter)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
168  | 
have \<open>eventually (\<lambda>a. UA (fst x, a)) (nhds (fst x))\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
169  | 
using \<open>eventually UA uniformity\<close> eventually_mono eventually_nhds_uniformity by fastforce  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
170  | 
      then obtain A where \<open>open A\<close> and A_UA: \<open>A \<subseteq> {a. UA (fst x, a)}\<close> and \<open>fst x \<in> A\<close>
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
171  | 
by (metis (mono_tags, lifting) eventually_nhds mem_Collect_eq subsetI)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
172  | 
have \<open>eventually (\<lambda>b. UB (snd x, b)) (nhds (snd x))\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
173  | 
using \<open>eventually UB uniformity\<close> eventually_mono eventually_nhds_uniformity by fastforce  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
174  | 
      then obtain B where \<open>open B\<close> and B_UB: \<open>B \<subseteq> {b. UB (snd x, b)}\<close> and \<open>snd x \<in> B\<close>
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
175  | 
by (metis (mono_tags, lifting) eventually_nhds mem_Collect_eq subsetI)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
176  | 
have \<open>x \<in> A \<times> B\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
177  | 
by (simp add: \<open>fst x \<in> A\<close> \<open>snd x \<in> B\<close> mem_Times_iff)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
178  | 
have \<open>A \<times> B \<subseteq> U\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
179  | 
using A_UA B_UB UA_UB_U by fastforce  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
180  | 
show \<open>\<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> U\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
181  | 
using \<open>A \<times> B \<subseteq> U\<close> \<open>open A\<close> \<open>open B\<close> \<open>x \<in> A \<times> B\<close> by auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
182  | 
qed  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
183  | 
qed  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
184  | 
next  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
185  | 
show \<open>eventually E uniformity \<Longrightarrow> E (x, x)\<close> for E and x :: \<open>'a \<times> 'b\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
186  | 
apply (simp add: uniformity_prod_def eventually_filtermap case_prod_unfold eventually_prod_filter)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
187  | 
by (metis surj_pair uniformity_refl)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
188  | 
next  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
189  | 
show \<open>eventually E uniformity \<Longrightarrow> \<forall>\<^sub>F (x::'a\<times>'b, y) in uniformity. E (y, x)\<close> for E  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
190  | 
apply (simp only: uniformity_prod_def eventually_filtermap case_prod_unfold eventually_prod_filter)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
191  | 
apply (erule exE, erule exE, rename_tac Pf Pg)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
192  | 
apply (rule_tac x=\<open>\<lambda>(x,y). Pf (y,x)\<close> in exI)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
193  | 
apply (rule_tac x=\<open>\<lambda>(x,y). Pg (y,x)\<close> in exI)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
194  | 
by (auto simp add: uniformity_sym)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
195  | 
next  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
196  | 
show \<open>\<exists>D. eventually D uniformity \<and> (\<forall>x y z. D (x::'a\<times>'b, y) \<longrightarrow> D (y, z) \<longrightarrow> E (x, z))\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
197  | 
if \<open>eventually E uniformity\<close> for E  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
198  | 
proof -  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
199  | 
from that  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
200  | 
obtain EA EB where \<open>eventually EA uniformity\<close> and \<open>eventually EB uniformity\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
201  | 
and EA_EB_E: \<open>EA (a1, a2) \<Longrightarrow> EB (b1, b2) \<Longrightarrow> E ((a1, b1), (a2, b2))\<close> for a1 a2 b1 b2  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
202  | 
by (auto simp add: uniformity_prod_def eventually_filtermap case_prod_unfold eventually_prod_filter)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
203  | 
obtain DA where \<open>eventually DA uniformity\<close> and DA_EA: \<open>DA (x,y) \<Longrightarrow> DA (y,z) \<Longrightarrow> EA (x,z)\<close> for x y z  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
204  | 
using \<open>eventually EA uniformity\<close> uniformity_transE by blast  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
205  | 
obtain DB where \<open>eventually DB uniformity\<close> and DB_EB: \<open>DB (x,y) \<Longrightarrow> DB (y,z) \<Longrightarrow> EB (x,z)\<close> for x y z  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
206  | 
using \<open>eventually EB uniformity\<close> uniformity_transE by blast  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
207  | 
define D where \<open>D = (\<lambda>((a1,b1),(a2,b2)). DA (a1,a2) \<and> DB (b1,b2))\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
208  | 
have \<open>eventually D uniformity\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
209  | 
using \<open>eventually DA uniformity\<close> \<open>eventually DB uniformity\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
210  | 
by (auto simp add: uniformity_prod_def eventually_filtermap case_prod_unfold eventually_prod_filter D_def)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
211  | 
moreover have \<open>D ((a1, b1), (a2, b2)) \<Longrightarrow> D ((a2, b2), (a3, b3)) \<Longrightarrow> E ((a1, b1), (a3, b3))\<close> for a1 b1 a2 b2 a3 b3  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
212  | 
using DA_EA DB_EB D_def EA_EB_E by blast  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
213  | 
ultimately show ?thesis  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
214  | 
by auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
215  | 
qed  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
216  | 
qed  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
217  | 
end  | 
| 62101 | 218  | 
|
| 
74475
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
219  | 
instantiation\<^marker>\<open>tag unimportant\<close> prod :: (metric_space, metric_space) uniformity_dist begin  | 
| 
62102
 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 
hoelzl 
parents: 
62101 
diff
changeset
 | 
220  | 
instance  | 
| 
74475
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
221  | 
proof  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
222  | 
  show \<open>uniformity = (INF e\<in>{0 <..}. principal {(x::'a\<times>'b, y). dist x y < e})\<close>
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
223  | 
proof (subst filter_eq_iff, intro allI iffI)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
224  | 
    fix P :: \<open>('a \<times> 'b) \<times> ('a \<times> 'b) \<Rightarrow> bool\<close>
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
225  | 
|
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
226  | 
    have 1: \<open>\<exists>e\<in>{0<..}.
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
227  | 
              {(x,y). dist x y < e} \<subseteq> {(x,y). dist x y < a} \<and>
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
228  | 
              {(x,y). dist x y < e} \<subseteq> {(x,y). dist x y < b}\<close> if \<open>a>0\<close> \<open>b>0\<close> for a b
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
229  | 
apply (rule bexI[of _ \<open>min a b\<close>])  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
230  | 
using that by auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
231  | 
have 2: \<open>mono (\<lambda>P. eventually (\<lambda>x. P (Q x)) F)\<close> for F :: \<open>'z filter\<close> and Q :: \<open>'z \<Rightarrow> 'y\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
232  | 
unfolding mono_def using eventually_mono le_funD by fastforce  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
233  | 
have \<open>\<forall>\<^sub>F ((x1::'a,y1),(x2::'b,y2)) in uniformity \<times>\<^sub>F uniformity. dist x1 y1 < e/2 \<and> dist x2 y2 < e/2\<close> if \<open>e>0\<close> for e  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
234  | 
by (auto intro!: eventually_prodI exI[of _ \<open>e/2\<close>] simp: case_prod_unfold eventually_uniformity_metric that)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
235  | 
then have 3: \<open>\<forall>\<^sub>F ((x1::'a,y1),(x2::'b,y2)) in uniformity \<times>\<^sub>F uniformity. dist (x1,x2) (y1,y2) < e\<close> if \<open>e>0\<close> for e  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
236  | 
apply (rule eventually_rev_mp)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
237  | 
by (auto intro!: that eventuallyI simp: case_prod_unfold dist_prod_def sqrt_sum_squares_half_less)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
238  | 
    show \<open>eventually P (INF e\<in>{0<..}. principal {(x, y). dist x y < e}) \<Longrightarrow> eventually P uniformity\<close>
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
239  | 
apply (subst (asm) eventually_INF_base)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
240  | 
using 1 3 apply (auto simp: uniformity_prod_def case_prod_unfold eventually_filtermap 2 eventually_principal)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
241  | 
by (smt (verit, best) eventually_mono)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
242  | 
next  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
243  | 
    fix P :: \<open>('a \<times> 'b) \<times> ('a \<times> 'b) \<Rightarrow> bool\<close>
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
244  | 
assume \<open>eventually P uniformity\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
245  | 
then obtain P1 P2 where \<open>eventually P1 uniformity\<close> \<open>eventually P2 uniformity\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
246  | 
and P1P2P: \<open>P1 (x1, y1) \<Longrightarrow> P2 (x2, y2) \<Longrightarrow> P ((x1, x2), (y1, y2))\<close> for x1 y1 x2 y2  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
247  | 
by (auto simp: eventually_filtermap case_prod_beta eventually_prod_filter uniformity_prod_def)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
248  | 
from \<open>eventually P1 uniformity\<close> obtain e1 where \<open>e1>0\<close> and e1P1: \<open>dist x y < e1 \<Longrightarrow> P1 (x,y)\<close> for x y  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
249  | 
using eventually_uniformity_metric by blast  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
250  | 
from \<open>eventually P2 uniformity\<close> obtain e2 where \<open>e2>0\<close> and e2P2: \<open>dist x y < e2 \<Longrightarrow> P2 (x,y)\<close> for x y  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
251  | 
using eventually_uniformity_metric by blast  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
252  | 
define e where \<open>e = min e1 e2\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
253  | 
have \<open>e > 0\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
254  | 
using \<open>0 < e1\<close> \<open>0 < e2\<close> e_def by auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
255  | 
have \<open>dist (x1,x2) (y1,y2) < e \<Longrightarrow> dist x1 y1 < e1\<close> for x1 y1 :: 'a and x2 y2 :: 'b  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
256  | 
unfolding dist_prod_def e_def apply auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
257  | 
by (smt (verit, best) real_sqrt_sum_squares_ge1)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
258  | 
moreover have \<open>dist (x1,x2) (y1,y2) < e \<Longrightarrow> dist x2 y2 < e2\<close> for x1 y1 :: 'a and x2 y2 :: 'b  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
259  | 
unfolding dist_prod_def e_def apply auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
260  | 
by (smt (verit, best) real_sqrt_sum_squares_ge1)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
261  | 
ultimately have *: \<open>dist (x1,x2) (y1,y2) < e \<Longrightarrow> P ((x1, x2), (y1, y2))\<close> for x1 y1 x2 y2  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
262  | 
using e1P1 e2P2 P1P2P by auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
263  | 
|
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
264  | 
    show \<open>eventually P (INF e\<in>{0<..}. principal {(x, y). dist x y < e})\<close>
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
265  | 
apply (rule eventually_INF1[where i=e])  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
266  | 
using \<open>e > 0\<close> * by (auto simp: eventually_principal)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
267  | 
qed  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
268  | 
qed  | 
| 62101 | 269  | 
end  | 
270  | 
||
| 
62102
 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 
hoelzl 
parents: 
62101 
diff
changeset
 | 
271  | 
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
 | 
272  | 
|
| 68617 | 273  | 
instantiation prod :: (metric_space, metric_space) metric_space  | 
| 62101 | 274  | 
begin  | 
275  | 
||
| 69541 | 276  | 
proposition 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
 | 
277  | 
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
 | 
278  | 
|
| 36332 | 279  | 
lemma dist_fst_le: "dist (fst x) (fst y) \<le> dist x y"  | 
| 53930 | 280  | 
unfolding dist_prod_def by (rule real_sqrt_sum_squares_ge1)  | 
| 36332 | 281  | 
|
282  | 
lemma dist_snd_le: "dist (snd x) (snd y) \<le> dist x y"  | 
|
| 53930 | 283  | 
unfolding dist_prod_def by (rule real_sqrt_sum_squares_ge2)  | 
| 36332 | 284  | 
|
| 60679 | 285  | 
instance  | 
286  | 
proof  | 
|
| 
31339
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
287  | 
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
 | 
288  | 
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
 | 
289  | 
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
 | 
290  | 
next  | 
| 
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
291  | 
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
 | 
292  | 
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
 | 
293  | 
unfolding dist_prod_def  | 
| 31563 | 294  | 
by (intro order_trans [OF _ real_sqrt_sum_squares_triangle_ineq]  | 
295  | 
real_sqrt_le_mono add_mono power_mono dist_triangle2 zero_le_dist)  | 
|
| 31415 | 296  | 
next  | 
| 
31492
 
5400beeddb55
replace 'topo' with 'open'; add extra type constraint for 'open'
 
huffman 
parents: 
31491 
diff
changeset
 | 
297  | 
  fix S :: "('a \<times> 'b) set"
 | 
| 62101 | 298  | 
have *: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S)"  | 
| 31563 | 299  | 
proof  | 
| 36332 | 300  | 
assume "open S" show "\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S"  | 
301  | 
proof  | 
|
302  | 
fix x assume "x \<in> S"  | 
|
303  | 
obtain A B where "open A" "open B" "x \<in> A \<times> B" "A \<times> B \<subseteq> S"  | 
|
| 60500 | 304  | 
using \<open>open S\<close> and \<open>x \<in> S\<close> by (rule open_prod_elim)  | 
| 36332 | 305  | 
obtain r where r: "0 < r" "\<forall>y. dist y (fst x) < r \<longrightarrow> y \<in> A"  | 
| 60500 | 306  | 
using \<open>open A\<close> and \<open>x \<in> A \<times> B\<close> unfolding open_dist by auto  | 
| 36332 | 307  | 
obtain s where s: "0 < s" "\<forall>y. dist y (snd x) < s \<longrightarrow> y \<in> B"  | 
| 60500 | 308  | 
using \<open>open B\<close> and \<open>x \<in> A \<times> B\<close> unfolding open_dist by auto  | 
| 36332 | 309  | 
let ?e = "min r s"  | 
310  | 
have "0 < ?e \<and> (\<forall>y. dist y x < ?e \<longrightarrow> y \<in> S)"  | 
|
311  | 
proof (intro allI impI conjI)  | 
|
312  | 
show "0 < min r s" by (simp add: r(1) s(1))  | 
|
313  | 
next  | 
|
314  | 
fix y assume "dist y x < min r s"  | 
|
315  | 
hence "dist y x < r" and "dist y x < s"  | 
|
316  | 
by simp_all  | 
|
317  | 
hence "dist (fst y) (fst x) < r" and "dist (snd y) (snd x) < s"  | 
|
318  | 
by (auto intro: le_less_trans dist_fst_le dist_snd_le)  | 
|
319  | 
hence "fst y \<in> A" and "snd y \<in> B"  | 
|
320  | 
by (simp_all add: r(2) s(2))  | 
|
321  | 
hence "y \<in> A \<times> B" by (induct y, simp)  | 
|
| 60500 | 322  | 
with \<open>A \<times> B \<subseteq> S\<close> show "y \<in> S" ..  | 
| 36332 | 323  | 
qed  | 
324  | 
thus "\<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S" ..  | 
|
325  | 
qed  | 
|
| 31563 | 326  | 
next  | 
| 44575 | 327  | 
assume *: "\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S" show "open S"  | 
328  | 
proof (rule open_prod_intro)  | 
|
329  | 
fix x assume "x \<in> S"  | 
|
330  | 
then obtain e where "0 < e" and S: "\<forall>y. dist y x < e \<longrightarrow> y \<in> S"  | 
|
331  | 
using * by fast  | 
|
| 63040 | 332  | 
define r where "r = e / sqrt 2"  | 
333  | 
define s where "s = e / sqrt 2"  | 
|
| 60500 | 334  | 
from \<open>0 < e\<close> have "0 < r" and "0 < s"  | 
| 56541 | 335  | 
unfolding r_def s_def by simp_all  | 
| 60500 | 336  | 
from \<open>0 < e\<close> have "e = sqrt (r\<^sup>2 + s\<^sup>2)"  | 
| 44575 | 337  | 
unfolding r_def s_def by (simp add: power_divide)  | 
| 63040 | 338  | 
      define A where "A = {y. dist (fst x) y < r}"
 | 
339  | 
      define B where "B = {y. dist (snd x) y < s}"
 | 
|
| 44575 | 340  | 
have "open A" and "open B"  | 
341  | 
unfolding A_def B_def by (simp_all add: open_ball)  | 
|
342  | 
moreover have "x \<in> A \<times> B"  | 
|
343  | 
unfolding A_def B_def mem_Times_iff  | 
|
| 60500 | 344  | 
using \<open>0 < r\<close> and \<open>0 < s\<close> by simp  | 
| 44575 | 345  | 
moreover have "A \<times> B \<subseteq> S"  | 
346  | 
proof (clarify)  | 
|
347  | 
fix a b assume "a \<in> A" and "b \<in> B"  | 
|
348  | 
hence "dist a (fst x) < r" and "dist b (snd x) < s"  | 
|
349  | 
unfolding A_def B_def by (simp_all add: dist_commute)  | 
|
350  | 
hence "dist (a, b) x < e"  | 
|
| 60500 | 351  | 
unfolding dist_prod_def \<open>e = sqrt (r\<^sup>2 + s\<^sup>2)\<close>  | 
| 44575 | 352  | 
by (simp add: add_strict_mono power_strict_mono)  | 
353  | 
thus "(a, b) \<in> S"  | 
|
354  | 
by (simp add: S)  | 
|
355  | 
qed  | 
|
356  | 
ultimately show "\<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S" by fast  | 
|
357  | 
qed  | 
|
| 31563 | 358  | 
qed  | 
| 
31339
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
359  | 
qed  | 
| 
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
360  | 
|
| 
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
361  | 
end  | 
| 
 
b4660351e8e7
instance * :: (metric_space, metric_space) metric_space; generalize lemmas to class metric_space
 
huffman 
parents: 
31290 
diff
changeset
 | 
362  | 
|
| 
54890
 
cb892d835803
fundamental treatment of undefined vs. universally partial replaces code_abort
 
haftmann 
parents: 
54779 
diff
changeset
 | 
363  | 
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
 | 
364  | 
|
| 
74475
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
365  | 
lemma Cauchy_fst: "Cauchy X \<Longrightarrow> Cauchy (\<lambda>n. fst (X n :: 'a::metric_space \<times> 'b::metric_space))"  | 
| 53930 | 366  | 
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
 | 
367  | 
|
| 
74475
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
368  | 
lemma Cauchy_snd: "Cauchy X \<Longrightarrow> Cauchy (\<lambda>n. snd (X n :: 'a::metric_space \<times> 'b::metric_space))"  | 
| 53930 | 369  | 
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
 | 
370  | 
|
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
371  | 
lemma Cauchy_Pair:  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
372  | 
assumes "Cauchy X" and "Cauchy Y"  | 
| 
74475
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
373  | 
shows "Cauchy (\<lambda>n. (X n :: 'a::metric_space, Y n :: 'a::metric_space))"  | 
| 
31405
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
374  | 
proof (rule metric_CauchyI)  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
375  | 
fix r :: real assume "0 < r"  | 
| 56541 | 376  | 
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
 | 
377  | 
obtain M where M: "\<forall>m\<ge>M. \<forall>n\<ge>M. dist (X m) (X n) < ?s"  | 
| 60500 | 378  | 
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
 | 
379  | 
obtain N where N: "\<forall>m\<ge>N. \<forall>n\<ge>N. dist (Y m) (Y n) < ?s"  | 
| 60500 | 380  | 
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
 | 
381  | 
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
 | 
382  | 
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
 | 
383  | 
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
 | 
384  | 
qed  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
385  | 
|
| 
74475
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
386  | 
text \<open>Analogue to @{thm [source] uniformly_continuous_on_def} for two-argument functions.\<close>
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
387  | 
lemma uniformly_continuous_on_prod_metric:  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
388  | 
  fixes f :: \<open>('a::metric_space \<times> 'b::metric_space) \<Rightarrow> 'c::metric_space\<close>
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
389  | 
shows \<open>uniformly_continuous_on (S\<times>T) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. \<forall>x\<in>S. \<forall>y\<in>S. \<forall>x'\<in>T. \<forall>y'\<in>T. dist x y < d \<longrightarrow> dist x' y' < d \<longrightarrow> dist (f (x, x')) (f (y, y')) < e)\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
390  | 
proof (unfold uniformly_continuous_on_def, intro iffI impI allI)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
391  | 
fix e :: real  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
392  | 
assume \<open>e > 0\<close> and \<open>\<forall>e>0. \<exists>d>0. \<forall>x\<in>S. \<forall>y\<in>S. \<forall>x'\<in>T. \<forall>y'\<in>T. dist x y < d \<longrightarrow> dist x' y' < d \<longrightarrow> dist (f (x, x')) (f (y, y')) < e\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
393  | 
then obtain d where \<open>d > 0\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
394  | 
and d: \<open>\<forall>x\<in>S. \<forall>y\<in>S. \<forall>x'\<in>T. \<forall>y'\<in>T. dist x y < d \<longrightarrow> dist x' y' < d \<longrightarrow> dist (f (x, x')) (f (y, y')) < e\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
395  | 
by auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
396  | 
show \<open>\<exists>d>0. \<forall>x\<in>S\<times>T. \<forall>y\<in>S\<times>T. dist y x < d \<longrightarrow> dist (f y) (f x) < e\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
397  | 
apply (rule exI[of _ d])  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
398  | 
using \<open>d>0\<close> d[rule_format] apply auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
399  | 
by (smt (verit, del_insts) dist_fst_le dist_snd_le fst_conv snd_conv)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
400  | 
next  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
401  | 
fix e :: real  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
402  | 
assume \<open>e > 0\<close> and \<open>\<forall>e>0. \<exists>d>0. \<forall>x\<in>S\<times>T. \<forall>x'\<in>S\<times>T. dist x' x < d \<longrightarrow> dist (f x') (f x) < e\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
403  | 
then obtain d where \<open>d > 0\<close> and d: \<open>\<forall>x\<in>S\<times>T. \<forall>x'\<in>S\<times>T. dist x' x < d \<longrightarrow> dist (f x') (f x) < e\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
404  | 
by auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
405  | 
show \<open>\<exists>d>0. \<forall>x\<in>S. \<forall>y\<in>S. \<forall>x'\<in>T. \<forall>y'\<in>T. dist x y < d \<longrightarrow> dist x' y' < d \<longrightarrow> dist (f (x, x')) (f (y, y')) < e\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
406  | 
proof (intro exI conjI impI ballI)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
407  | 
from \<open>d > 0\<close> show \<open>d / 2 > 0\<close> by auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
408  | 
fix x y x' y'  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
409  | 
assume [simp]: \<open>x \<in> S\<close> \<open>y \<in> S\<close> \<open>x' \<in> T\<close> \<open>y' \<in> T\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
410  | 
assume \<open>dist x y < d / 2\<close> and \<open>dist x' y' < d / 2\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
411  | 
then have \<open>dist (x, x') (y, y') < d\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
412  | 
by (simp add: dist_Pair_Pair sqrt_sum_squares_half_less)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
413  | 
with d show \<open>dist (f (x, x')) (f (y, y')) < e\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
414  | 
by auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
415  | 
qed  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
416  | 
qed  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
417  | 
|
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
418  | 
text \<open>Analogue to @{thm [source] isUCont_def} for two-argument functions.\<close>
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
419  | 
lemma isUCont_prod_metric:  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
420  | 
  fixes f :: \<open>('a::metric_space \<times> 'b::metric_space) \<Rightarrow> 'c::metric_space\<close>
 | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
421  | 
shows \<open>isUCont f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. \<forall>x. \<forall>y. \<forall>x'. \<forall>y'. dist x y < d \<longrightarrow> dist x' y' < d \<longrightarrow> dist (f (x, x')) (f (y, y')) < e)\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
422  | 
using uniformly_continuous_on_prod_metric[of UNIV UNIV]  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
423  | 
by auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
424  | 
|
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
425  | 
text \<open>This logically belong with the real vector spaces by we only have the necessary lemmas now.\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
426  | 
lemma isUCont_plus[simp]:  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
427  | 
shows \<open>isUCont (\<lambda>(x::'a::real_normed_vector,y). x+y)\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
428  | 
proof (rule isUCont_prod_metric[THEN iffD2], intro allI impI, simp)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
429  | 
fix e :: real assume \<open>0 < e\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
430  | 
show \<open>\<exists>d>0. \<forall>x y :: 'a. dist x y < d \<longrightarrow> (\<forall>x' y'. dist x' y' < d \<longrightarrow> dist (x + x') (y + y') < e)\<close>  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
431  | 
apply (rule exI[of _ \<open>e/2\<close>])  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
432  | 
using \<open>0 < e\<close> apply auto  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
433  | 
by (smt (verit, ccfv_SIG) dist_add_cancel dist_add_cancel2 dist_commute dist_triangle_lt)  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
434  | 
qed  | 
| 
 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 
eberlm <eberlm@in.tum.de> 
parents: 
71174 
diff
changeset
 | 
435  | 
|
| 69541 | 436  | 
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
 | 
437  | 
|
| 70136 | 438  | 
instance\<^marker>\<open>tag important\<close> prod :: (complete_space, complete_space) complete_space  | 
439  | 
proof  | 
|
| 
31405
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
440  | 
fix X :: "nat \<Rightarrow> 'a \<times> 'b" assume "Cauchy X"  | 
| 61969 | 441  | 
have 1: "(\<lambda>n. fst (X n)) \<longlonglongrightarrow> lim (\<lambda>n. fst (X n))"  | 
| 60500 | 442  | 
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
 | 
443  | 
by (simp add: Cauchy_convergent_iff convergent_LIMSEQ_iff)  | 
| 61969 | 444  | 
have 2: "(\<lambda>n. snd (X n)) \<longlonglongrightarrow> lim (\<lambda>n. snd (X n))"  | 
| 60500 | 445  | 
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
 | 
446  | 
by (simp add: Cauchy_convergent_iff convergent_LIMSEQ_iff)  | 
| 61969 | 447  | 
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
 | 
448  | 
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
 | 
449  | 
then show "convergent X"  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
450  | 
by (rule convergentI)  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
451  | 
qed  | 
| 
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
452  | 
|
| 69541 | 453  | 
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
 | 
454  | 
|
| 68617 | 455  | 
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
 | 
456  | 
begin  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
457  | 
|
| 
54779
 
d9edb711ef31
pragmatic executability of instance prod::{open,dist,norm}
 
immler 
parents: 
53930 
diff
changeset
 | 
458  | 
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
 | 
459  | 
"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
 | 
460  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
461  | 
definition sgn_prod_def:  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
462  | 
"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
 | 
463  | 
|
| 69541 | 464  | 
proposition 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
 | 
465  | 
unfolding norm_prod_def by simp  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
466  | 
|
| 60679 | 467  | 
instance  | 
468  | 
proof  | 
|
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
469  | 
fix r :: real and x y :: "'a \<times> 'b"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
470  | 
show "norm x = 0 \<longleftrightarrow> x = 0"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
471  | 
unfolding norm_prod_def  | 
| 
44066
 
d74182c93f04
rename Pair_fst_snd_eq to prod_eq_iff (keeping old name too)
 
huffman 
parents: 
37678 
diff
changeset
 | 
472  | 
by (simp add: prod_eq_iff)  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
473  | 
show "norm (x + y) \<le> norm x + norm y"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
474  | 
unfolding norm_prod_def  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
475  | 
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
 | 
476  | 
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
 | 
477  | 
done  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
478  | 
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
 | 
479  | 
unfolding norm_prod_def  | 
| 31587 | 480  | 
apply (simp add: power_mult_distrib)  | 
| 
49962
 
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
 
webertj 
parents: 
44749 
diff
changeset
 | 
481  | 
apply (simp add: distrib_left [symmetric])  | 
| 68611 | 482  | 
apply (simp add: real_sqrt_mult)  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
483  | 
done  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
484  | 
show "sgn x = scaleR (inverse (norm x)) x"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
485  | 
by (rule sgn_prod_def)  | 
| 31290 | 486  | 
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
 | 
487  | 
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
 | 
488  | 
by (simp add: dist_norm)  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
489  | 
qed  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
490  | 
|
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
491  | 
end  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
492  | 
|
| 
54890
 
cb892d835803
fundamental treatment of undefined vs. universally partial replaces code_abort
 
haftmann 
parents: 
54779 
diff
changeset
 | 
493  | 
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
 | 
494  | 
|
| 70136 | 495  | 
instance\<^marker>\<open>tag important\<close> prod :: (banach, banach) banach ..  | 
| 
31405
 
1f72869f1a2e
instance * :: complete_space; generalize continuity lemmas for fst, snd, Pair
 
huffman 
parents: 
31388 
diff
changeset
 | 
496  | 
|
| 70136 | 497  | 
subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Pair operations are linear\<close>  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
498  | 
|
| 69541 | 499  | 
lemma bounded_linear_fst: "bounded_linear fst"  | 
| 44127 | 500  | 
using fst_add fst_scaleR  | 
501  | 
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
 | 
502  | 
|
| 69541 | 503  | 
lemma bounded_linear_snd: "bounded_linear snd"  | 
| 44127 | 504  | 
using snd_add snd_scaleR  | 
505  | 
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
 | 
506  | 
|
| 
61915
 
e9812a95d108
theory for type of bounded linear functions; differentiation under the integral sign
 
immler 
parents: 
60679 
diff
changeset
 | 
507  | 
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
 | 
508  | 
|
| 
 
e9812a95d108
theory for type of bounded linear functions; differentiation under the integral sign
 
immler 
parents: 
60679 
diff
changeset
 | 
509  | 
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
 | 
510  | 
|
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
511  | 
lemma bounded_linear_Pair:  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
512  | 
assumes f: "bounded_linear f"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
513  | 
assumes g: "bounded_linear g"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
514  | 
shows "bounded_linear (\<lambda>x. (f x, g x))"  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
515  | 
proof  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
516  | 
interpret f: bounded_linear f by fact  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
517  | 
interpret g: bounded_linear g by fact  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
518  | 
fix x y and r :: real  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
519  | 
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
 | 
520  | 
by (simp add: f.add g.add)  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
521  | 
show "(f (r *\<^sub>R x), g (r *\<^sub>R x)) = r *\<^sub>R (f x, g x)"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
522  | 
by (simp add: f.scale g.scale)  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
523  | 
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
 | 
524  | 
using f.pos_bounded by fast  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
525  | 
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
 | 
526  | 
using g.pos_bounded by fast  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
527  | 
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
 | 
528  | 
apply (rule allI)  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
529  | 
apply (simp add: norm_Pair)  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
530  | 
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
 | 
531  | 
apply (simp add: distrib_left)  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
532  | 
apply (rule add_mono [OF norm_f norm_g])  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
533  | 
done  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
534  | 
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
 | 
535  | 
qed  | 
| 
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
536  | 
|
| 70136 | 537  | 
subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Frechet derivatives involving pairs\<close>  | 
| 
30019
 
a2f19e0a28b2
add theory of products as real vector spaces to Library
 
huffman 
parents:  
diff
changeset
 | 
538  | 
|
| 70137 | 539  | 
text\<^marker>\<open>tag important\<close> \<open>%whitespace\<close>  | 
| 
68607
 
67bb59e49834
make theorem, corollary, and proposition %important for HOL-Analysis manual
 
immler 
parents: 
68072 
diff
changeset
 | 
540  | 
proposition has_derivative_Pair [derivative_intros]:  | 
| 69541 | 541  | 
assumes f: "(f has_derivative f') (at x within s)"  | 
542  | 
and g: "(g has_derivative g') (at x within s)"  | 
|
| 
56181
 
2aa0b19e74f3
unify syntax for has_derivative and differentiable
 
hoelzl 
parents: 
54890 
diff
changeset
 | 
543  | 
shows "((\<lambda>x. (f x, g x)) has_derivative (\<lambda>h. (f' h, g' h))) (at x within s)"  | 
| 
68607
 
67bb59e49834
make theorem, corollary, and proposition %important for HOL-Analysis manual
 
immler 
parents: 
68072 
diff
changeset
 | 
544  | 
proof (rule has_derivativeI_sandwich[of 1])  | 
| 44575 | 545  | 
show "bounded_linear (\<lambda>h. (f' h, g' h))"  | 
| 
56181
 
2aa0b19e74f3
unify syntax for has_derivative and differentiable
 
hoelzl 
parents: 
54890 
diff
changeset
 | 
546  | 
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
 | 
547  | 
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
 | 
548  | 
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
 | 
549  | 
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
 | 
550  | 
|
| 61973 | 551  | 
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
 | 
552  | 
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
 | 
553  | 
|
| 
 
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
 | 
554  | 
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
 | 
555  | 
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
 | 
556  | 
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
 | 
557  | 
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
 | 
558  | 
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
 | 
559  | 
|
| 
67685
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
560  | 
lemma differentiable_Pair [simp, derivative_intros]:  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
561  | 
"f differentiable at x within s \<Longrightarrow> g differentiable at x within s \<Longrightarrow>  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
562  | 
(\<lambda>x. (f x, g x)) differentiable at x within s"  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
563  | 
unfolding differentiable_def by (blast intro: has_derivative_Pair)  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
564  | 
|
| 
56381
 
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
 
hoelzl 
parents: 
56371 
diff
changeset
 | 
565  | 
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
 | 
566  | 
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
 | 
567  | 
|
| 
56381
 
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
 
hoelzl 
parents: 
56371 
diff
changeset
 | 
568  | 
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
 | 
569  | 
"((\<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
 | 
570  | 
unfolding split_beta' .  | 
| 44575 | 571  | 
|
| 
67685
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
572  | 
|
| 70136 | 573  | 
subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Vector derivatives involving pairs\<close>  | 
| 
67685
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
574  | 
|
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
575  | 
lemma has_vector_derivative_Pair[derivative_intros]:  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
576  | 
assumes "(f has_vector_derivative f') (at x within s)"  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
577  | 
"(g has_vector_derivative g') (at x within s)"  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
578  | 
shows "((\<lambda>x. (f x, g x)) has_vector_derivative (f', g')) (at x within s)"  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
579  | 
using assms  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
580  | 
by (auto simp: has_vector_derivative_def intro!: derivative_eq_intros)  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
581  | 
|
| 
62102
 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 
hoelzl 
parents: 
62101 
diff
changeset
 | 
582  | 
lemma  | 
| 
60615
 
e5fa1d5d3952
Useful lemmas. The theorem concerning swapping the variables in a double integral.
 
paulson <lp15@cam.ac.uk> 
parents: 
60500 
diff
changeset
 | 
583  | 
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
 | 
584  | 
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
 | 
585  | 
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
 | 
586  | 
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
 | 
587  | 
|
| 
62131
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
62102 
diff
changeset
 | 
588  | 
lemma norm_commute: "norm (x,y) = norm (y,x)"  | 
| 
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
62102 
diff
changeset
 | 
589  | 
by (simp add: norm_Pair)  | 
| 
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
62102 
diff
changeset
 | 
590  | 
|
| 
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
62102 
diff
changeset
 | 
591  | 
lemma norm_fst_le: "norm x \<le> norm (x,y)"  | 
| 
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
62102 
diff
changeset
 | 
592  | 
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
 | 
593  | 
|
| 
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
62102 
diff
changeset
 | 
594  | 
lemma norm_snd_le: "norm y \<le> norm (x,y)"  | 
| 
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
62102 
diff
changeset
 | 
595  | 
by (metis dist_snd_le snd_conv snd_zero norm_conv_dist)  | 
| 59425 | 596  | 
|
| 
67685
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
597  | 
lemma norm_Pair_le:  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
598  | 
shows "norm (x, y) \<le> norm x + norm y"  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
599  | 
unfolding norm_Pair  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
600  | 
by (metis norm_ge_zero sqrt_sum_squares_le_sum)  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66453 
diff
changeset
 | 
601  | 
|
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
602  | 
lemma (in vector_space_prod) span_Times_sing1: "p.span ({0} \<times> B) = {0} \<times> vs2.span B"
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
603  | 
apply (rule p.span_unique)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
604  | 
subgoal by (auto intro!: vs1.span_base vs2.span_base)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
605  | 
subgoal using vs1.subspace_single_0 vs2.subspace_span by (rule subspace_Times)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
606  | 
subgoal for T  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
607  | 
proof safe  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
608  | 
fix b  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
609  | 
    assume subset_T: "{0} \<times> B \<subseteq> T" and subspace: "p.subspace T" and b_span: "b \<in> vs2.span B"
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
610  | 
then obtain t r where b: "b = (\<Sum>a\<in>t. r a *b a)" and t: "finite t" "t \<subseteq> B"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
611  | 
by (auto simp: vs2.span_explicit)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
612  | 
have "(0, b) = (\<Sum>b\<in>t. scale (r b) (0, b))"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
613  | 
unfolding b scale_prod sum_prod  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
614  | 
by simp  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
615  | 
also have "\<dots> \<in> T"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
616  | 
using \<open>t \<subseteq> B\<close> subset_T  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
617  | 
by (auto intro!: p.subspace_sum p.subspace_scale subspace)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
618  | 
finally show "(0, b) \<in> T" .  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
619  | 
qed  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
620  | 
done  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
621  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
622  | 
lemma (in vector_space_prod) span_Times_sing2: "p.span (A \<times> {0}) = vs1.span A \<times> {0}"
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
623  | 
apply (rule p.span_unique)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
624  | 
subgoal by (auto intro!: vs1.span_base vs2.span_base)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
625  | 
subgoal using vs1.subspace_span vs2.subspace_single_0 by (rule subspace_Times)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
626  | 
subgoal for T  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
627  | 
proof safe  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
628  | 
fix a  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
629  | 
    assume subset_T: "A \<times> {0} \<subseteq> T" and subspace: "p.subspace T" and a_span: "a \<in> vs1.span A"
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
630  | 
then obtain t r where a: "a = (\<Sum>a\<in>t. r a *a a)" and t: "finite t" "t \<subseteq> A"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
631  | 
by (auto simp: vs1.span_explicit)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
632  | 
have "(a, 0) = (\<Sum>a\<in>t. scale (r a) (a, 0))"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
633  | 
unfolding a scale_prod sum_prod  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
634  | 
by simp  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
635  | 
also have "\<dots> \<in> T"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
636  | 
using \<open>t \<subseteq> A\<close> subset_T  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
637  | 
by (auto intro!: p.subspace_sum p.subspace_scale subspace)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
638  | 
finally show "(a, 0) \<in> T" .  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
639  | 
qed  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
640  | 
done  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
641  | 
|
| 69541 | 642  | 
subsection \<open>Product is Finite Dimensional\<close>  | 
643  | 
||
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
644  | 
lemma (in finite_dimensional_vector_space) zero_not_in_Basis[simp]: "0 \<notin> Basis"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
645  | 
using dependent_zero local.independent_Basis by blast  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
646  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
647  | 
locale finite_dimensional_vector_space_prod = vector_space_prod + finite_dimensional_vector_space_pair begin  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
648  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
649  | 
definition "Basis_pair = B1 \<times> {0} \<union> {0} \<times> B2"
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
650  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
651  | 
sublocale p: finite_dimensional_vector_space scale Basis_pair  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
652  | 
proof unfold_locales  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
653  | 
show "finite Basis_pair"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
654  | 
by (auto intro!: finite_cartesian_product vs1.finite_Basis vs2.finite_Basis simp: Basis_pair_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
655  | 
show "p.independent Basis_pair"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
656  | 
unfolding p.dependent_def Basis_pair_def  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
657  | 
proof safe  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
658  | 
fix a  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
659  | 
assume a: "a \<in> B1"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
660  | 
    assume "(a, 0) \<in> p.span (B1 \<times> {0} \<union> {0} \<times> B2 - {(a, 0)})"
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
661  | 
    also have "B1 \<times> {0} \<union> {0} \<times> B2 - {(a, 0)} = (B1 - {a}) \<times> {0} \<union> {0} \<times> B2"
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
662  | 
by auto  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
663  | 
finally show False  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
664  | 
using a vs1.dependent_def vs1.independent_Basis  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
665  | 
by (auto simp: p.span_Un span_Times_sing1 span_Times_sing2)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
666  | 
next  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
667  | 
fix b  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
668  | 
assume b: "b \<in> B2"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
669  | 
    assume "(0, b) \<in> p.span (B1 \<times> {0} \<union> {0} \<times> B2 - {(0, b)})"
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
670  | 
    also have "(B1 \<times> {0} \<union> {0} \<times> B2 - {(0, b)}) = B1 \<times> {0} \<union> {0} \<times> (B2 - {b})"
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
671  | 
by auto  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
672  | 
finally show False  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
673  | 
using b vs2.dependent_def vs2.independent_Basis  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
674  | 
by (auto simp: p.span_Un span_Times_sing1 span_Times_sing2)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
675  | 
qed  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
676  | 
show "p.span Basis_pair = UNIV"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
677  | 
by (auto simp: p.span_Un span_Times_sing2 span_Times_sing1 vs1.span_Basis vs2.span_Basis  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
678  | 
Basis_pair_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
679  | 
qed  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
680  | 
|
| 69541 | 681  | 
proposition dim_Times:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
682  | 
assumes "vs1.subspace S" "vs2.subspace T"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
683  | 
shows "p.dim(S \<times> T) = vs1.dim S + vs2.dim T"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
684  | 
proof -  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
685  | 
interpret p1: Vector_Spaces.linear s1 scale "(\<lambda>x. (x, 0))"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
686  | 
by unfold_locales (auto simp: scale_def)  | 
| 
69064
 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 
nipkow 
parents: 
68617 
diff
changeset
 | 
687  | 
interpret pair1: finite_dimensional_vector_space_pair "(*a)" B1 scale Basis_pair  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
688  | 
by unfold_locales  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
689  | 
interpret p2: Vector_Spaces.linear s2 scale "(\<lambda>x. (0, x))"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
690  | 
by unfold_locales (auto simp: scale_def)  | 
| 
69064
 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 
nipkow 
parents: 
68617 
diff
changeset
 | 
691  | 
interpret pair2: finite_dimensional_vector_space_pair "(*b)" B2 scale Basis_pair  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
692  | 
by unfold_locales  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
693  | 
have ss: "p.subspace ((\<lambda>x. (x, 0)) ` S)" "p.subspace (Pair 0 ` T)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
694  | 
by (rule p1.subspace_image p2.subspace_image assms)+  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
695  | 
  have "p.dim(S \<times> T) = p.dim({u + v |u v. u \<in> (\<lambda>x. (x, 0)) ` S \<and> v \<in> Pair 0 ` T})"
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
696  | 
by (simp add: Times_eq_image_sum)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
697  | 
moreover have "p.dim ((\<lambda>x. (x, 0::'c)) ` S) = vs1.dim S" "p.dim (Pair (0::'b) ` T) = vs2.dim T"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
698  | 
by (simp_all add: inj_on_def p1.linear_axioms pair1.dim_image_eq p2.linear_axioms pair2.dim_image_eq)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
699  | 
moreover have "p.dim ((\<lambda>x. (x, 0)) ` S \<inter> Pair 0 ` T) = 0"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
700  | 
by (subst p.dim_eq_0) auto  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
701  | 
ultimately show ?thesis  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
702  | 
using p.dim_sums_Int [OF ss] by linarith  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
703  | 
qed  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
704  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
705  | 
lemma dimension_pair: "p.dimension = vs1.dimension + vs2.dimension"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
706  | 
using dim_Times[OF vs1.subspace_UNIV vs2.subspace_UNIV]  | 
| 71174 | 707  | 
by (auto simp: p.dimension_def vs1.dimension_def vs2.dimension_def)  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
708  | 
|
| 44575 | 709  | 
end  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
710  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67962 
diff
changeset
 | 
711  | 
end  |