author | immler |
Mon, 07 Jan 2019 14:06:54 +0100 | |
changeset 69619 | 3f7d8e05e0f2 |
parent 69600 | 86e8e7347ac0 |
child 69674 | fc252acb7100 |
permissions | -rw-r--r-- |
63627 | 1 |
(* Title: HOL/Analysis/Linear_Algebra.thy |
44133 | 2 |
Author: Amine Chaieb, University of Cambridge |
3 |
*) |
|
4 |
||
69517 | 5 |
section \<open>Elementary Linear Algebra on Euclidean Spaces\<close> |
44133 | 6 |
|
7 |
theory Linear_Algebra |
|
8 |
imports |
|
9 |
Euclidean_Space |
|
66453
cc19f7ca2ed6
session-qualified theory imports: isabelle imports -U -i -d '~~/src/Benchmarks' -a;
wenzelm
parents:
66447
diff
changeset
|
10 |
"HOL-Library.Infinite_Set" |
44133 | 11 |
begin |
12 |
||
63886
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents:
63881
diff
changeset
|
13 |
lemma linear_simps: |
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents:
63881
diff
changeset
|
14 |
assumes "bounded_linear f" |
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents:
63881
diff
changeset
|
15 |
shows |
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents:
63881
diff
changeset
|
16 |
"f (a + b) = f a + f b" |
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents:
63881
diff
changeset
|
17 |
"f (a - b) = f a - f b" |
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents:
63881
diff
changeset
|
18 |
"f 0 = 0" |
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents:
63881
diff
changeset
|
19 |
"f (- a) = - f a" |
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents:
63881
diff
changeset
|
20 |
"f (s *\<^sub>R v) = s *\<^sub>R (f v)" |
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents:
63881
diff
changeset
|
21 |
proof - |
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents:
63881
diff
changeset
|
22 |
interpret f: bounded_linear f by fact |
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents:
63881
diff
changeset
|
23 |
show "f (a + b) = f a + f b" by (rule f.add) |
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents:
63881
diff
changeset
|
24 |
show "f (a - b) = f a - f b" by (rule f.diff) |
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents:
63881
diff
changeset
|
25 |
show "f 0 = 0" by (rule f.zero) |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
26 |
show "f (- a) = - f a" by (rule f.neg) |
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
27 |
show "f (s *\<^sub>R v) = s *\<^sub>R (f v)" by (rule f.scale) |
44133 | 28 |
qed |
29 |
||
68069
36209dfb981e
tidying up and using real induction methods
paulson <lp15@cam.ac.uk>
parents:
68062
diff
changeset
|
30 |
lemma finite_Atleast_Atmost_nat[simp]: "finite {f x |x. x \<in> (UNIV::'a::finite set)}" |
36209dfb981e
tidying up and using real induction methods
paulson <lp15@cam.ac.uk>
parents:
68062
diff
changeset
|
31 |
using finite finite_image_set by blast |
44133 | 32 |
|
53406 | 33 |
|
68901 | 34 |
subsection%unimportant \<open>More interesting properties of the norm\<close> |
63050 | 35 |
|
36 |
notation inner (infix "\<bullet>" 70) |
|
37 |
||
69597 | 38 |
text\<open>Equality of vectors in terms of \<^term>\<open>(\<bullet>)\<close> products.\<close> |
63050 | 39 |
|
40 |
lemma linear_componentwise: |
|
41 |
fixes f:: "'a::euclidean_space \<Rightarrow> 'b::real_inner" |
|
42 |
assumes lf: "linear f" |
|
43 |
shows "(f x) \<bullet> j = (\<Sum>i\<in>Basis. (x\<bullet>i) * (f i\<bullet>j))" (is "?lhs = ?rhs") |
|
44 |
proof - |
|
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
45 |
interpret linear f by fact |
63050 | 46 |
have "?rhs = (\<Sum>i\<in>Basis. (x\<bullet>i) *\<^sub>R (f i))\<bullet>j" |
64267 | 47 |
by (simp add: inner_sum_left) |
63050 | 48 |
then show ?thesis |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
49 |
by (simp add: euclidean_representation sum[symmetric] scale[symmetric]) |
63050 | 50 |
qed |
51 |
||
52 |
lemma vector_eq: "x = y \<longleftrightarrow> x \<bullet> x = x \<bullet> y \<and> y \<bullet> y = x \<bullet> x" |
|
53 |
(is "?lhs \<longleftrightarrow> ?rhs") |
|
54 |
proof |
|
55 |
assume ?lhs |
|
56 |
then show ?rhs by simp |
|
57 |
next |
|
58 |
assume ?rhs |
|
59 |
then have "x \<bullet> x - x \<bullet> y = 0 \<and> x \<bullet> y - y \<bullet> y = 0" |
|
60 |
by simp |
|
61 |
then have "x \<bullet> (x - y) = 0 \<and> y \<bullet> (x - y) = 0" |
|
62 |
by (simp add: inner_diff inner_commute) |
|
63 |
then have "(x - y) \<bullet> (x - y) = 0" |
|
64 |
by (simp add: field_simps inner_diff inner_commute) |
|
65 |
then show "x = y" by simp |
|
66 |
qed |
|
67 |
||
68 |
lemma norm_triangle_half_r: |
|
69 |
"norm (y - x1) < e / 2 \<Longrightarrow> norm (y - x2) < e / 2 \<Longrightarrow> norm (x1 - x2) < e" |
|
70 |
using dist_triangle_half_r unfolding dist_norm[symmetric] by auto |
|
71 |
||
72 |
lemma norm_triangle_half_l: |
|
73 |
assumes "norm (x - y) < e / 2" |
|
74 |
and "norm (x' - y) < e / 2" |
|
75 |
shows "norm (x - x') < e" |
|
76 |
using dist_triangle_half_l[OF assms[unfolded dist_norm[symmetric]]] |
|
77 |
unfolding dist_norm[symmetric] . |
|
78 |
||
66420 | 79 |
lemma abs_triangle_half_r: |
80 |
fixes y :: "'a::linordered_field" |
|
81 |
shows "abs (y - x1) < e / 2 \<Longrightarrow> abs (y - x2) < e / 2 \<Longrightarrow> abs (x1 - x2) < e" |
|
82 |
by linarith |
|
83 |
||
84 |
lemma abs_triangle_half_l: |
|
85 |
fixes y :: "'a::linordered_field" |
|
86 |
assumes "abs (x - y) < e / 2" |
|
87 |
and "abs (x' - y) < e / 2" |
|
88 |
shows "abs (x - x') < e" |
|
89 |
using assms by linarith |
|
90 |
||
64267 | 91 |
lemma sum_clauses: |
92 |
shows "sum f {} = 0" |
|
93 |
and "finite S \<Longrightarrow> sum f (insert x S) = (if x \<in> S then sum f S else f x + sum f S)" |
|
63050 | 94 |
by (auto simp add: insert_absorb) |
95 |
||
96 |
lemma vector_eq_ldot: "(\<forall>x. x \<bullet> y = x \<bullet> z) \<longleftrightarrow> y = z" |
|
97 |
proof |
|
98 |
assume "\<forall>x. x \<bullet> y = x \<bullet> z" |
|
99 |
then have "\<forall>x. x \<bullet> (y - z) = 0" |
|
100 |
by (simp add: inner_diff) |
|
101 |
then have "(y - z) \<bullet> (y - z) = 0" .. |
|
102 |
then show "y = z" by simp |
|
103 |
qed simp |
|
104 |
||
105 |
lemma vector_eq_rdot: "(\<forall>z. x \<bullet> z = y \<bullet> z) \<longleftrightarrow> x = y" |
|
106 |
proof |
|
107 |
assume "\<forall>z. x \<bullet> z = y \<bullet> z" |
|
108 |
then have "\<forall>z. (x - y) \<bullet> z = 0" |
|
109 |
by (simp add: inner_diff) |
|
110 |
then have "(x - y) \<bullet> (x - y) = 0" .. |
|
111 |
then show "x = y" by simp |
|
112 |
qed simp |
|
113 |
||
69619
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
114 |
subsection \<open>Substandard Basis\<close> |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
115 |
|
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
116 |
lemma ex_card: |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
117 |
assumes "n \<le> card A" |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
118 |
shows "\<exists>S\<subseteq>A. card S = n" |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
119 |
proof (cases "finite A") |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
120 |
case True |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
121 |
from ex_bij_betw_nat_finite[OF this] obtain f where f: "bij_betw f {0..<card A} A" .. |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
122 |
moreover from f \<open>n \<le> card A\<close> have "{..< n} \<subseteq> {..< card A}" "inj_on f {..< n}" |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
123 |
by (auto simp: bij_betw_def intro: subset_inj_on) |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
124 |
ultimately have "f ` {..< n} \<subseteq> A" "card (f ` {..< n}) = n" |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
125 |
by (auto simp: bij_betw_def card_image) |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
126 |
then show ?thesis by blast |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
127 |
next |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
128 |
case False |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
129 |
with \<open>n \<le> card A\<close> show ?thesis by force |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
130 |
qed |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
131 |
|
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
132 |
lemma subspace_substandard: "subspace {x::'a::euclidean_space. (\<forall>i\<in>Basis. P i \<longrightarrow> x\<bullet>i = 0)}" |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
133 |
by (auto simp: subspace_def inner_add_left) |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
134 |
|
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
135 |
lemma dim_substandard: |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
136 |
assumes d: "d \<subseteq> Basis" |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
137 |
shows "dim {x::'a::euclidean_space. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0} = card d" (is "dim ?A = _") |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
138 |
proof (rule dim_unique) |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
139 |
from d show "d \<subseteq> ?A" |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
140 |
by (auto simp: inner_Basis) |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
141 |
from d show "independent d" |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
142 |
by (rule independent_mono [OF independent_Basis]) |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
143 |
have "x \<in> span d" if "\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0" for x |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
144 |
proof - |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
145 |
have "finite d" |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
146 |
by (rule finite_subset [OF d finite_Basis]) |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
147 |
then have "(\<Sum>i\<in>d. (x \<bullet> i) *\<^sub>R i) \<in> span d" |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
148 |
by (simp add: span_sum span_clauses) |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
149 |
also have "(\<Sum>i\<in>d. (x \<bullet> i) *\<^sub>R i) = (\<Sum>i\<in>Basis. (x \<bullet> i) *\<^sub>R i)" |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
150 |
by (rule sum.mono_neutral_cong_left [OF finite_Basis d]) (auto simp: that) |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
151 |
finally show "x \<in> span d" |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
152 |
by (simp only: euclidean_representation) |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
153 |
qed |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
154 |
then show "?A \<subseteq> span d" by auto |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
155 |
qed simp |
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
156 |
|
63050 | 157 |
|
68901 | 158 |
subsection \<open>Orthogonality\<close> |
63050 | 159 |
|
67962 | 160 |
definition%important (in real_inner) "orthogonal x y \<longleftrightarrow> x \<bullet> y = 0" |
161 |
||
63050 | 162 |
context real_inner |
163 |
begin |
|
164 |
||
63072 | 165 |
lemma orthogonal_self: "orthogonal x x \<longleftrightarrow> x = 0" |
166 |
by (simp add: orthogonal_def) |
|
167 |
||
63050 | 168 |
lemma orthogonal_clauses: |
169 |
"orthogonal a 0" |
|
170 |
"orthogonal a x \<Longrightarrow> orthogonal a (c *\<^sub>R x)" |
|
171 |
"orthogonal a x \<Longrightarrow> orthogonal a (- x)" |
|
172 |
"orthogonal a x \<Longrightarrow> orthogonal a y \<Longrightarrow> orthogonal a (x + y)" |
|
173 |
"orthogonal a x \<Longrightarrow> orthogonal a y \<Longrightarrow> orthogonal a (x - y)" |
|
174 |
"orthogonal 0 a" |
|
175 |
"orthogonal x a \<Longrightarrow> orthogonal (c *\<^sub>R x) a" |
|
176 |
"orthogonal x a \<Longrightarrow> orthogonal (- x) a" |
|
177 |
"orthogonal x a \<Longrightarrow> orthogonal y a \<Longrightarrow> orthogonal (x + y) a" |
|
178 |
"orthogonal x a \<Longrightarrow> orthogonal y a \<Longrightarrow> orthogonal (x - y) a" |
|
179 |
unfolding orthogonal_def inner_add inner_diff by auto |
|
180 |
||
181 |
end |
|
182 |
||
183 |
lemma orthogonal_commute: "orthogonal x y \<longleftrightarrow> orthogonal y x" |
|
184 |
by (simp add: orthogonal_def inner_commute) |
|
185 |
||
63114
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
186 |
lemma orthogonal_scaleR [simp]: "c \<noteq> 0 \<Longrightarrow> orthogonal (c *\<^sub>R x) = orthogonal x" |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
187 |
by (rule ext) (simp add: orthogonal_def) |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
188 |
|
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
189 |
lemma pairwise_ortho_scaleR: |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
190 |
"pairwise (\<lambda>i j. orthogonal (f i) (g j)) B |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
191 |
\<Longrightarrow> pairwise (\<lambda>i j. orthogonal (a i *\<^sub>R f i) (a j *\<^sub>R g j)) B" |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
192 |
by (auto simp: pairwise_def orthogonal_clauses) |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
193 |
|
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
194 |
lemma orthogonal_rvsum: |
64267 | 195 |
"\<lbrakk>finite s; \<And>y. y \<in> s \<Longrightarrow> orthogonal x (f y)\<rbrakk> \<Longrightarrow> orthogonal x (sum f s)" |
63114
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
196 |
by (induction s rule: finite_induct) (auto simp: orthogonal_clauses) |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
197 |
|
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
198 |
lemma orthogonal_lvsum: |
64267 | 199 |
"\<lbrakk>finite s; \<And>x. x \<in> s \<Longrightarrow> orthogonal (f x) y\<rbrakk> \<Longrightarrow> orthogonal (sum f s) y" |
63114
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
200 |
by (induction s rule: finite_induct) (auto simp: orthogonal_clauses) |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
201 |
|
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
202 |
lemma norm_add_Pythagorean: |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
203 |
assumes "orthogonal a b" |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
204 |
shows "norm(a + b) ^ 2 = norm a ^ 2 + norm b ^ 2" |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
205 |
proof - |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
206 |
from assms have "(a - (0 - b)) \<bullet> (a - (0 - b)) = a \<bullet> a - (0 - b \<bullet> b)" |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
207 |
by (simp add: algebra_simps orthogonal_def inner_commute) |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
208 |
then show ?thesis |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
209 |
by (simp add: power2_norm_eq_inner) |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
210 |
qed |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
211 |
|
64267 | 212 |
lemma norm_sum_Pythagorean: |
63114
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
213 |
assumes "finite I" "pairwise (\<lambda>i j. orthogonal (f i) (f j)) I" |
64267 | 214 |
shows "(norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)" |
63114
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
215 |
using assms |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
216 |
proof (induction I rule: finite_induct) |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
217 |
case empty then show ?case by simp |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
218 |
next |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
219 |
case (insert x I) |
64267 | 220 |
then have "orthogonal (f x) (sum f I)" |
63114
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
221 |
by (metis pairwise_insert orthogonal_rvsum) |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
222 |
with insert show ?case |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
223 |
by (simp add: pairwise_insert norm_add_Pythagorean) |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
224 |
qed |
27afe7af7379
Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
63075
diff
changeset
|
225 |
|
63050 | 226 |
|
68901 | 227 |
subsection \<open>Bilinear functions\<close> |
63050 | 228 |
|
69600 | 229 |
definition%important |
230 |
bilinear :: "('a::real_vector \<Rightarrow> 'b::real_vector \<Rightarrow> 'c::real_vector) \<Rightarrow> bool" where |
|
231 |
"bilinear f \<longleftrightarrow> (\<forall>x. linear (\<lambda>y. f x y)) \<and> (\<forall>y. linear (\<lambda>x. f x y))" |
|
63050 | 232 |
|
233 |
lemma bilinear_ladd: "bilinear h \<Longrightarrow> h (x + y) z = h x z + h y z" |
|
234 |
by (simp add: bilinear_def linear_iff) |
|
235 |
||
236 |
lemma bilinear_radd: "bilinear h \<Longrightarrow> h x (y + z) = h x y + h x z" |
|
237 |
by (simp add: bilinear_def linear_iff) |
|
238 |
||
239 |
lemma bilinear_lmul: "bilinear h \<Longrightarrow> h (c *\<^sub>R x) y = c *\<^sub>R h x y" |
|
240 |
by (simp add: bilinear_def linear_iff) |
|
241 |
||
242 |
lemma bilinear_rmul: "bilinear h \<Longrightarrow> h x (c *\<^sub>R y) = c *\<^sub>R h x y" |
|
243 |
by (simp add: bilinear_def linear_iff) |
|
244 |
||
245 |
lemma bilinear_lneg: "bilinear h \<Longrightarrow> h (- x) y = - h x y" |
|
246 |
by (drule bilinear_lmul [of _ "- 1"]) simp |
|
247 |
||
248 |
lemma bilinear_rneg: "bilinear h \<Longrightarrow> h x (- y) = - h x y" |
|
249 |
by (drule bilinear_rmul [of _ _ "- 1"]) simp |
|
250 |
||
251 |
lemma (in ab_group_add) eq_add_iff: "x = x + y \<longleftrightarrow> y = 0" |
|
252 |
using add_left_imp_eq[of x y 0] by auto |
|
253 |
||
254 |
lemma bilinear_lzero: |
|
255 |
assumes "bilinear h" |
|
256 |
shows "h 0 x = 0" |
|
257 |
using bilinear_ladd [OF assms, of 0 0 x] by (simp add: eq_add_iff field_simps) |
|
258 |
||
259 |
lemma bilinear_rzero: |
|
260 |
assumes "bilinear h" |
|
261 |
shows "h x 0 = 0" |
|
262 |
using bilinear_radd [OF assms, of x 0 0 ] by (simp add: eq_add_iff field_simps) |
|
263 |
||
264 |
lemma bilinear_lsub: "bilinear h \<Longrightarrow> h (x - y) z = h x z - h y z" |
|
265 |
using bilinear_ladd [of h x "- y"] by (simp add: bilinear_lneg) |
|
266 |
||
267 |
lemma bilinear_rsub: "bilinear h \<Longrightarrow> h z (x - y) = h z x - h z y" |
|
268 |
using bilinear_radd [of h _ x "- y"] by (simp add: bilinear_rneg) |
|
269 |
||
64267 | 270 |
lemma bilinear_sum: |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
271 |
assumes "bilinear h" |
64267 | 272 |
shows "h (sum f S) (sum g T) = sum (\<lambda>(i,j). h (f i) (g j)) (S \<times> T) " |
63050 | 273 |
proof - |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
274 |
interpret l: linear "\<lambda>x. h x y" for y using assms by (simp add: bilinear_def) |
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
275 |
interpret r: linear "\<lambda>y. h x y" for x using assms by (simp add: bilinear_def) |
64267 | 276 |
have "h (sum f S) (sum g T) = sum (\<lambda>x. h (f x) (sum g T)) S" |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
277 |
by (simp add: l.sum) |
64267 | 278 |
also have "\<dots> = sum (\<lambda>x. sum (\<lambda>y. h (f x) (g y)) T) S" |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
279 |
by (rule sum.cong) (simp_all add: r.sum) |
63050 | 280 |
finally show ?thesis |
64267 | 281 |
unfolding sum.cartesian_product . |
63050 | 282 |
qed |
283 |
||
284 |
||
68901 | 285 |
subsection \<open>Adjoints\<close> |
63050 | 286 |
|
69600 | 287 |
definition%important adjoint :: "(('a::real_inner) \<Rightarrow> ('b::real_inner)) \<Rightarrow> 'b \<Rightarrow> 'a" where |
288 |
"adjoint f = (SOME f'. \<forall>x y. f x \<bullet> y = x \<bullet> f' y)" |
|
63050 | 289 |
|
290 |
lemma adjoint_unique: |
|
291 |
assumes "\<forall>x y. inner (f x) y = inner x (g y)" |
|
292 |
shows "adjoint f = g" |
|
293 |
unfolding adjoint_def |
|
294 |
proof (rule some_equality) |
|
295 |
show "\<forall>x y. inner (f x) y = inner x (g y)" |
|
296 |
by (rule assms) |
|
297 |
next |
|
298 |
fix h |
|
299 |
assume "\<forall>x y. inner (f x) y = inner x (h y)" |
|
300 |
then have "\<forall>x y. inner x (g y) = inner x (h y)" |
|
301 |
using assms by simp |
|
302 |
then have "\<forall>x y. inner x (g y - h y) = 0" |
|
303 |
by (simp add: inner_diff_right) |
|
304 |
then have "\<forall>y. inner (g y - h y) (g y - h y) = 0" |
|
305 |
by simp |
|
306 |
then have "\<forall>y. h y = g y" |
|
307 |
by simp |
|
308 |
then show "h = g" by (simp add: ext) |
|
309 |
qed |
|
310 |
||
311 |
text \<open>TODO: The following lemmas about adjoints should hold for any |
|
63680 | 312 |
Hilbert space (i.e. complete inner product space). |
68224 | 313 |
(see \<^url>\<open>https://en.wikipedia.org/wiki/Hermitian_adjoint\<close>) |
63050 | 314 |
\<close> |
315 |
||
316 |
lemma adjoint_works: |
|
317 |
fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
318 |
assumes lf: "linear f" |
|
319 |
shows "x \<bullet> adjoint f y = f x \<bullet> y" |
|
320 |
proof - |
|
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
321 |
interpret linear f by fact |
63050 | 322 |
have "\<forall>y. \<exists>w. \<forall>x. f x \<bullet> y = x \<bullet> w" |
323 |
proof (intro allI exI) |
|
324 |
fix y :: "'m" and x |
|
325 |
let ?w = "(\<Sum>i\<in>Basis. (f i \<bullet> y) *\<^sub>R i) :: 'n" |
|
326 |
have "f x \<bullet> y = f (\<Sum>i\<in>Basis. (x \<bullet> i) *\<^sub>R i) \<bullet> y" |
|
327 |
by (simp add: euclidean_representation) |
|
328 |
also have "\<dots> = (\<Sum>i\<in>Basis. (x \<bullet> i) *\<^sub>R f i) \<bullet> y" |
|
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
329 |
by (simp add: sum scale) |
63050 | 330 |
finally show "f x \<bullet> y = x \<bullet> ?w" |
64267 | 331 |
by (simp add: inner_sum_left inner_sum_right mult.commute) |
63050 | 332 |
qed |
333 |
then show ?thesis |
|
334 |
unfolding adjoint_def choice_iff |
|
335 |
by (intro someI2_ex[where Q="\<lambda>f'. x \<bullet> f' y = f x \<bullet> y"]) auto |
|
336 |
qed |
|
337 |
||
338 |
lemma adjoint_clauses: |
|
339 |
fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
340 |
assumes lf: "linear f" |
|
341 |
shows "x \<bullet> adjoint f y = f x \<bullet> y" |
|
342 |
and "adjoint f y \<bullet> x = y \<bullet> f x" |
|
343 |
by (simp_all add: adjoint_works[OF lf] inner_commute) |
|
344 |
||
345 |
lemma adjoint_linear: |
|
346 |
fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
347 |
assumes lf: "linear f" |
|
348 |
shows "linear (adjoint f)" |
|
349 |
by (simp add: lf linear_iff euclidean_eq_iff[where 'a='n] euclidean_eq_iff[where 'a='m] |
|
350 |
adjoint_clauses[OF lf] inner_distrib) |
|
351 |
||
352 |
lemma adjoint_adjoint: |
|
353 |
fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
354 |
assumes lf: "linear f" |
|
355 |
shows "adjoint (adjoint f) = f" |
|
356 |
by (rule adjoint_unique, simp add: adjoint_clauses [OF lf]) |
|
357 |
||
358 |
||
359 |
subsection \<open>Archimedean properties and useful consequences\<close> |
|
360 |
||
361 |
text\<open>Bernoulli's inequality\<close> |
|
68607
67bb59e49834
make theorem, corollary, and proposition %important for HOL-Analysis manual
immler
parents:
68224
diff
changeset
|
362 |
proposition Bernoulli_inequality: |
63050 | 363 |
fixes x :: real |
364 |
assumes "-1 \<le> x" |
|
365 |
shows "1 + n * x \<le> (1 + x) ^ n" |
|
68607
67bb59e49834
make theorem, corollary, and proposition %important for HOL-Analysis manual
immler
parents:
68224
diff
changeset
|
366 |
proof (induct n) |
63050 | 367 |
case 0 |
368 |
then show ?case by simp |
|
369 |
next |
|
370 |
case (Suc n) |
|
371 |
have "1 + Suc n * x \<le> 1 + (Suc n)*x + n * x^2" |
|
372 |
by (simp add: algebra_simps) |
|
373 |
also have "... = (1 + x) * (1 + n*x)" |
|
374 |
by (auto simp: power2_eq_square algebra_simps of_nat_Suc) |
|
375 |
also have "... \<le> (1 + x) ^ Suc n" |
|
376 |
using Suc.hyps assms mult_left_mono by fastforce |
|
377 |
finally show ?case . |
|
378 |
qed |
|
379 |
||
380 |
corollary Bernoulli_inequality_even: |
|
381 |
fixes x :: real |
|
382 |
assumes "even n" |
|
383 |
shows "1 + n * x \<le> (1 + x) ^ n" |
|
384 |
proof (cases "-1 \<le> x \<or> n=0") |
|
385 |
case True |
|
386 |
then show ?thesis |
|
387 |
by (auto simp: Bernoulli_inequality) |
|
388 |
next |
|
389 |
case False |
|
390 |
then have "real n \<ge> 1" |
|
391 |
by simp |
|
392 |
with False have "n * x \<le> -1" |
|
393 |
by (metis linear minus_zero mult.commute mult.left_neutral mult_left_mono_neg neg_le_iff_le order_trans zero_le_one) |
|
394 |
then have "1 + n * x \<le> 0" |
|
395 |
by auto |
|
396 |
also have "... \<le> (1 + x) ^ n" |
|
397 |
using assms |
|
398 |
using zero_le_even_power by blast |
|
399 |
finally show ?thesis . |
|
400 |
qed |
|
401 |
||
402 |
corollary real_arch_pow: |
|
403 |
fixes x :: real |
|
404 |
assumes x: "1 < x" |
|
405 |
shows "\<exists>n. y < x^n" |
|
406 |
proof - |
|
407 |
from x have x0: "x - 1 > 0" |
|
408 |
by arith |
|
409 |
from reals_Archimedean3[OF x0, rule_format, of y] |
|
410 |
obtain n :: nat where n: "y < real n * (x - 1)" by metis |
|
411 |
from x0 have x00: "x- 1 \<ge> -1" by arith |
|
412 |
from Bernoulli_inequality[OF x00, of n] n |
|
413 |
have "y < x^n" by auto |
|
414 |
then show ?thesis by metis |
|
415 |
qed |
|
416 |
||
417 |
corollary real_arch_pow_inv: |
|
418 |
fixes x y :: real |
|
419 |
assumes y: "y > 0" |
|
420 |
and x1: "x < 1" |
|
421 |
shows "\<exists>n. x^n < y" |
|
422 |
proof (cases "x > 0") |
|
423 |
case True |
|
424 |
with x1 have ix: "1 < 1/x" by (simp add: field_simps) |
|
425 |
from real_arch_pow[OF ix, of "1/y"] |
|
426 |
obtain n where n: "1/y < (1/x)^n" by blast |
|
427 |
then show ?thesis using y \<open>x > 0\<close> |
|
428 |
by (auto simp add: field_simps) |
|
429 |
next |
|
430 |
case False |
|
431 |
with y x1 show ?thesis |
|
68069
36209dfb981e
tidying up and using real induction methods
paulson <lp15@cam.ac.uk>
parents:
68062
diff
changeset
|
432 |
by (metis less_le_trans not_less power_one_right) |
63050 | 433 |
qed |
434 |
||
435 |
lemma forall_pos_mono: |
|
436 |
"(\<And>d e::real. d < e \<Longrightarrow> P d \<Longrightarrow> P e) \<Longrightarrow> |
|
437 |
(\<And>n::nat. n \<noteq> 0 \<Longrightarrow> P (inverse (real n))) \<Longrightarrow> (\<And>e. 0 < e \<Longrightarrow> P e)" |
|
438 |
by (metis real_arch_inverse) |
|
439 |
||
440 |
lemma forall_pos_mono_1: |
|
441 |
"(\<And>d e::real. d < e \<Longrightarrow> P d \<Longrightarrow> P e) \<Longrightarrow> |
|
442 |
(\<And>n. P (inverse (real (Suc n)))) \<Longrightarrow> 0 < e \<Longrightarrow> P e" |
|
443 |
apply (rule forall_pos_mono) |
|
444 |
apply auto |
|
445 |
apply (metis Suc_pred of_nat_Suc) |
|
446 |
done |
|
447 |
||
448 |
||
67962 | 449 |
subsection%unimportant \<open>Euclidean Spaces as Typeclass\<close> |
44133 | 450 |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
451 |
lemma independent_Basis: "independent Basis" |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
452 |
by (rule independent_Basis) |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
453 |
|
53939 | 454 |
lemma span_Basis [simp]: "span Basis = UNIV" |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
455 |
by (rule span_Basis) |
44133 | 456 |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
457 |
lemma in_span_Basis: "x \<in> span Basis" |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
458 |
unfolding span_Basis .. |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
459 |
|
53406 | 460 |
|
67962 | 461 |
subsection%unimportant \<open>Linearity and Bilinearity continued\<close> |
44133 | 462 |
|
463 |
lemma linear_bounded: |
|
56444 | 464 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
44133 | 465 |
assumes lf: "linear f" |
466 |
shows "\<exists>B. \<forall>x. norm (f x) \<le> B * norm x" |
|
53939 | 467 |
proof |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
468 |
interpret linear f by fact |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
469 |
let ?B = "\<Sum>b\<in>Basis. norm (f b)" |
53939 | 470 |
show "\<forall>x. norm (f x) \<le> ?B * norm x" |
471 |
proof |
|
53406 | 472 |
fix x :: 'a |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
473 |
let ?g = "\<lambda>b. (x \<bullet> b) *\<^sub>R f b" |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
474 |
have "norm (f x) = norm (f (\<Sum>b\<in>Basis. (x \<bullet> b) *\<^sub>R b))" |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
475 |
unfolding euclidean_representation .. |
64267 | 476 |
also have "\<dots> = norm (sum ?g Basis)" |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
477 |
by (simp add: sum scale) |
64267 | 478 |
finally have th0: "norm (f x) = norm (sum ?g Basis)" . |
64773
223b2ebdda79
Many new theorems, and more tidying
paulson <lp15@cam.ac.uk>
parents:
64267
diff
changeset
|
479 |
have th: "norm (?g i) \<le> norm (f i) * norm x" if "i \<in> Basis" for i |
223b2ebdda79
Many new theorems, and more tidying
paulson <lp15@cam.ac.uk>
parents:
64267
diff
changeset
|
480 |
proof - |
223b2ebdda79
Many new theorems, and more tidying
paulson <lp15@cam.ac.uk>
parents:
64267
diff
changeset
|
481 |
from Basis_le_norm[OF that, of x] |
53939 | 482 |
show "norm (?g i) \<le> norm (f i) * norm x" |
68069
36209dfb981e
tidying up and using real induction methods
paulson <lp15@cam.ac.uk>
parents:
68062
diff
changeset
|
483 |
unfolding norm_scaleR by (metis mult.commute mult_left_mono norm_ge_zero) |
53939 | 484 |
qed |
64267 | 485 |
from sum_norm_le[of _ ?g, OF th] |
53939 | 486 |
show "norm (f x) \<le> ?B * norm x" |
64267 | 487 |
unfolding th0 sum_distrib_right by metis |
53939 | 488 |
qed |
44133 | 489 |
qed |
490 |
||
491 |
lemma linear_conv_bounded_linear: |
|
492 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
|
493 |
shows "linear f \<longleftrightarrow> bounded_linear f" |
|
494 |
proof |
|
495 |
assume "linear f" |
|
53939 | 496 |
then interpret f: linear f . |
44133 | 497 |
show "bounded_linear f" |
498 |
proof |
|
499 |
have "\<exists>B. \<forall>x. norm (f x) \<le> B * norm x" |
|
60420 | 500 |
using \<open>linear f\<close> by (rule linear_bounded) |
49522 | 501 |
then show "\<exists>K. \<forall>x. norm (f x) \<le> norm x * K" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57418
diff
changeset
|
502 |
by (simp add: mult.commute) |
44133 | 503 |
qed |
504 |
next |
|
505 |
assume "bounded_linear f" |
|
506 |
then interpret f: bounded_linear f . |
|
53939 | 507 |
show "linear f" .. |
508 |
qed |
|
509 |
||
61518
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
paulson
parents:
61306
diff
changeset
|
510 |
lemmas linear_linear = linear_conv_bounded_linear[symmetric] |
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
paulson
parents:
61306
diff
changeset
|
511 |
|
53939 | 512 |
lemma linear_bounded_pos: |
56444 | 513 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
53939 | 514 |
assumes lf: "linear f" |
67982
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
515 |
obtains B where "B > 0" "\<And>x. norm (f x) \<le> B * norm x" |
53939 | 516 |
proof - |
517 |
have "\<exists>B > 0. \<forall>x. norm (f x) \<le> norm x * B" |
|
518 |
using lf unfolding linear_conv_bounded_linear |
|
519 |
by (rule bounded_linear.pos_bounded) |
|
67982
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
520 |
with that show ?thesis |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
521 |
by (auto simp: mult.commute) |
44133 | 522 |
qed |
523 |
||
67982
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
524 |
lemma linear_invertible_bounded_below_pos: |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
525 |
fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::euclidean_space" |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
526 |
assumes "linear f" "linear g" "g \<circ> f = id" |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
527 |
obtains B where "B > 0" "\<And>x. B * norm x \<le> norm(f x)" |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
528 |
proof - |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
529 |
obtain B where "B > 0" and B: "\<And>x. norm (g x) \<le> B * norm x" |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
530 |
using linear_bounded_pos [OF \<open>linear g\<close>] by blast |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
531 |
show thesis |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
532 |
proof |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
533 |
show "0 < 1/B" |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
534 |
by (simp add: \<open>B > 0\<close>) |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
535 |
show "1/B * norm x \<le> norm (f x)" for x |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
536 |
proof - |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
537 |
have "1/B * norm x = 1/B * norm (g (f x))" |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
538 |
using assms by (simp add: pointfree_idE) |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
539 |
also have "\<dots> \<le> norm (f x)" |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
540 |
using B [of "f x"] by (simp add: \<open>B > 0\<close> mult.commute pos_divide_le_eq) |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
541 |
finally show ?thesis . |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
542 |
qed |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
543 |
qed |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
544 |
qed |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
545 |
|
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
546 |
lemma linear_inj_bounded_below_pos: |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
547 |
fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::euclidean_space" |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
548 |
assumes "linear f" "inj f" |
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
549 |
obtains B where "B > 0" "\<And>x. B * norm x \<le> norm(f x)" |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
550 |
using linear_injective_left_inverse [OF assms] |
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
551 |
linear_invertible_bounded_below_pos assms by blast |
67982
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents:
67962
diff
changeset
|
552 |
|
49522 | 553 |
lemma bounded_linearI': |
56444 | 554 |
fixes f ::"'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
53406 | 555 |
assumes "\<And>x y. f (x + y) = f x + f y" |
556 |
and "\<And>c x. f (c *\<^sub>R x) = c *\<^sub>R f x" |
|
49522 | 557 |
shows "bounded_linear f" |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
558 |
using assms linearI linear_conv_bounded_linear by blast |
44133 | 559 |
|
560 |
lemma bilinear_bounded: |
|
56444 | 561 |
fixes h :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space \<Rightarrow> 'k::real_normed_vector" |
44133 | 562 |
assumes bh: "bilinear h" |
563 |
shows "\<exists>B. \<forall>x y. norm (h x y) \<le> B * norm x * norm y" |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
564 |
proof (clarify intro!: exI[of _ "\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. norm (h i j)"]) |
53406 | 565 |
fix x :: 'm |
566 |
fix y :: 'n |
|
64267 | 567 |
have "norm (h x y) = norm (h (sum (\<lambda>i. (x \<bullet> i) *\<^sub>R i) Basis) (sum (\<lambda>i. (y \<bullet> i) *\<^sub>R i) Basis))" |
68069
36209dfb981e
tidying up and using real induction methods
paulson <lp15@cam.ac.uk>
parents:
68062
diff
changeset
|
568 |
by (simp add: euclidean_representation) |
64267 | 569 |
also have "\<dots> = norm (sum (\<lambda> (i,j). h ((x \<bullet> i) *\<^sub>R i) ((y \<bullet> j) *\<^sub>R j)) (Basis \<times> Basis))" |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
570 |
unfolding bilinear_sum[OF bh] .. |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
571 |
finally have th: "norm (h x y) = \<dots>" . |
68069
36209dfb981e
tidying up and using real induction methods
paulson <lp15@cam.ac.uk>
parents:
68062
diff
changeset
|
572 |
have "\<And>i j. \<lbrakk>i \<in> Basis; j \<in> Basis\<rbrakk> |
36209dfb981e
tidying up and using real induction methods
paulson <lp15@cam.ac.uk>
parents:
68062
diff
changeset
|
573 |
\<Longrightarrow> \<bar>x \<bullet> i\<bar> * (\<bar>y \<bullet> j\<bar> * norm (h i j)) \<le> norm x * (norm y * norm (h i j))" |
36209dfb981e
tidying up and using real induction methods
paulson <lp15@cam.ac.uk>
parents:
68062
diff
changeset
|
574 |
by (auto simp add: zero_le_mult_iff Basis_le_norm mult_mono) |
36209dfb981e
tidying up and using real induction methods
paulson <lp15@cam.ac.uk>
parents:
68062
diff
changeset
|
575 |
then show "norm (h x y) \<le> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. norm (h i j)) * norm x * norm y" |
36209dfb981e
tidying up and using real induction methods
paulson <lp15@cam.ac.uk>
parents:
68062
diff
changeset
|
576 |
unfolding sum_distrib_right th sum.cartesian_product |
36209dfb981e
tidying up and using real induction methods
paulson <lp15@cam.ac.uk>
parents:
68062
diff
changeset
|
577 |
by (clarsimp simp add: bilinear_rmul[OF bh] bilinear_lmul[OF bh] |
36209dfb981e
tidying up and using real induction methods
paulson <lp15@cam.ac.uk>
parents:
68062
diff
changeset
|
578 |
field_simps simp del: scaleR_scaleR intro!: sum_norm_le) |
44133 | 579 |
qed |
580 |
||
581 |
lemma bilinear_conv_bounded_bilinear: |
|
582 |
fixes h :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::real_normed_vector" |
|
583 |
shows "bilinear h \<longleftrightarrow> bounded_bilinear h" |
|
584 |
proof |
|
585 |
assume "bilinear h" |
|
586 |
show "bounded_bilinear h" |
|
587 |
proof |
|
53406 | 588 |
fix x y z |
589 |
show "h (x + y) z = h x z + h y z" |
|
60420 | 590 |
using \<open>bilinear h\<close> unfolding bilinear_def linear_iff by simp |
44133 | 591 |
next |
53406 | 592 |
fix x y z |
593 |
show "h x (y + z) = h x y + h x z" |
|
60420 | 594 |
using \<open>bilinear h\<close> unfolding bilinear_def linear_iff by simp |
44133 | 595 |
next |
68069
36209dfb981e
tidying up and using real induction methods
paulson <lp15@cam.ac.uk>
parents:
68062
diff
changeset
|
596 |
show "h (scaleR r x) y = scaleR r (h x y)" "h x (scaleR r y) = scaleR r (h x y)" for r x y |
60420 | 597 |
using \<open>bilinear h\<close> unfolding bilinear_def linear_iff |
68069
36209dfb981e
tidying up and using real induction methods
paulson <lp15@cam.ac.uk>
parents:
68062
diff
changeset
|
598 |
by simp_all |
44133 | 599 |
next |
600 |
have "\<exists>B. \<forall>x y. norm (h x y) \<le> B * norm x * norm y" |
|
60420 | 601 |
using \<open>bilinear h\<close> by (rule bilinear_bounded) |
49522 | 602 |
then show "\<exists>K. \<forall>x y. norm (h x y) \<le> norm x * norm y * K" |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
603 |
by (simp add: ac_simps) |
44133 | 604 |
qed |
605 |
next |
|
606 |
assume "bounded_bilinear h" |
|
607 |
then interpret h: bounded_bilinear h . |
|
608 |
show "bilinear h" |
|
609 |
unfolding bilinear_def linear_conv_bounded_linear |
|
49522 | 610 |
using h.bounded_linear_left h.bounded_linear_right by simp |
44133 | 611 |
qed |
612 |
||
53939 | 613 |
lemma bilinear_bounded_pos: |
56444 | 614 |
fixes h :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::real_normed_vector" |
53939 | 615 |
assumes bh: "bilinear h" |
616 |
shows "\<exists>B > 0. \<forall>x y. norm (h x y) \<le> B * norm x * norm y" |
|
617 |
proof - |
|
618 |
have "\<exists>B > 0. \<forall>x y. norm (h x y) \<le> norm x * norm y * B" |
|
619 |
using bh [unfolded bilinear_conv_bounded_bilinear] |
|
620 |
by (rule bounded_bilinear.pos_bounded) |
|
621 |
then show ?thesis |
|
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
622 |
by (simp only: ac_simps) |
53939 | 623 |
qed |
624 |
||
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
625 |
lemma bounded_linear_imp_has_derivative: "bounded_linear f \<Longrightarrow> (f has_derivative f) net" |
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
626 |
by (auto simp add: has_derivative_def linear_diff linear_linear linear_def |
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
627 |
dest: bounded_linear.linear) |
63469
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents:
63170
diff
changeset
|
628 |
|
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents:
63170
diff
changeset
|
629 |
lemma linear_imp_has_derivative: |
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents:
63170
diff
changeset
|
630 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents:
63170
diff
changeset
|
631 |
shows "linear f \<Longrightarrow> (f has_derivative f) net" |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
632 |
by (simp add: bounded_linear_imp_has_derivative linear_conv_bounded_linear) |
63469
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents:
63170
diff
changeset
|
633 |
|
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents:
63170
diff
changeset
|
634 |
lemma bounded_linear_imp_differentiable: "bounded_linear f \<Longrightarrow> f differentiable net" |
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents:
63170
diff
changeset
|
635 |
using bounded_linear_imp_has_derivative differentiable_def by blast |
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents:
63170
diff
changeset
|
636 |
|
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents:
63170
diff
changeset
|
637 |
lemma linear_imp_differentiable: |
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents:
63170
diff
changeset
|
638 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents:
63170
diff
changeset
|
639 |
shows "linear f \<Longrightarrow> f differentiable net" |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
640 |
by (metis linear_imp_has_derivative differentiable_def) |
63469
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents:
63170
diff
changeset
|
641 |
|
49522 | 642 |
|
68901 | 643 |
subsection%unimportant \<open>We continue\<close> |
44133 | 644 |
|
645 |
lemma independent_bound: |
|
53716 | 646 |
fixes S :: "'a::euclidean_space set" |
647 |
shows "independent S \<Longrightarrow> finite S \<and> card S \<le> DIM('a)" |
|
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
648 |
by (metis dim_subset_UNIV finiteI_independent dim_span_eq_card_independent) |
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
649 |
|
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
650 |
lemmas independent_imp_finite = finiteI_independent |
44133 | 651 |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61520
diff
changeset
|
652 |
corollary |
60303 | 653 |
fixes S :: "'a::euclidean_space set" |
654 |
assumes "independent S" |
|
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
655 |
shows independent_card_le:"card S \<le> DIM('a)" |
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
656 |
using assms independent_bound by auto |
63075
60a42a4166af
lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents:
63072
diff
changeset
|
657 |
|
49663 | 658 |
lemma dependent_biggerset: |
56444 | 659 |
fixes S :: "'a::euclidean_space set" |
660 |
shows "(finite S \<Longrightarrow> card S > DIM('a)) \<Longrightarrow> dependent S" |
|
44133 | 661 |
by (metis independent_bound not_less) |
662 |
||
60420 | 663 |
text \<open>Picking an orthogonal replacement for a spanning set.\<close> |
44133 | 664 |
|
53406 | 665 |
lemma vector_sub_project_orthogonal: |
666 |
fixes b x :: "'a::euclidean_space" |
|
667 |
shows "b \<bullet> (x - ((b \<bullet> x) / (b \<bullet> b)) *\<^sub>R b) = 0" |
|
44133 | 668 |
unfolding inner_simps by auto |
669 |
||
44528 | 670 |
lemma pairwise_orthogonal_insert: |
671 |
assumes "pairwise orthogonal S" |
|
49522 | 672 |
and "\<And>y. y \<in> S \<Longrightarrow> orthogonal x y" |
44528 | 673 |
shows "pairwise orthogonal (insert x S)" |
674 |
using assms unfolding pairwise_def |
|
675 |
by (auto simp add: orthogonal_commute) |
|
676 |
||
44133 | 677 |
lemma basis_orthogonal: |
53406 | 678 |
fixes B :: "'a::real_inner set" |
44133 | 679 |
assumes fB: "finite B" |
680 |
shows "\<exists>C. finite C \<and> card C \<le> card B \<and> span C = span B \<and> pairwise orthogonal C" |
|
681 |
(is " \<exists>C. ?P B C") |
|
49522 | 682 |
using fB |
683 |
proof (induct rule: finite_induct) |
|
684 |
case empty |
|
53406 | 685 |
then show ?case |
686 |
apply (rule exI[where x="{}"]) |
|
687 |
apply (auto simp add: pairwise_def) |
|
688 |
done |
|
44133 | 689 |
next |
49522 | 690 |
case (insert a B) |
60420 | 691 |
note fB = \<open>finite B\<close> and aB = \<open>a \<notin> B\<close> |
692 |
from \<open>\<exists>C. finite C \<and> card C \<le> card B \<and> span C = span B \<and> pairwise orthogonal C\<close> |
|
44133 | 693 |
obtain C where C: "finite C" "card C \<le> card B" |
694 |
"span C = span B" "pairwise orthogonal C" by blast |
|
64267 | 695 |
let ?a = "a - sum (\<lambda>x. (x \<bullet> a / (x \<bullet> x)) *\<^sub>R x) C" |
44133 | 696 |
let ?C = "insert ?a C" |
53406 | 697 |
from C(1) have fC: "finite ?C" |
698 |
by simp |
|
49522 | 699 |
from fB aB C(1,2) have cC: "card ?C \<le> card (insert a B)" |
700 |
by (simp add: card_insert_if) |
|
53406 | 701 |
{ |
702 |
fix x k |
|
49522 | 703 |
have th0: "\<And>(a::'a) b c. a - (b - c) = c + (a - b)" |
704 |
by (simp add: field_simps) |
|
44133 | 705 |
have "x - k *\<^sub>R (a - (\<Sum>x\<in>C. (x \<bullet> a / (x \<bullet> x)) *\<^sub>R x)) \<in> span C \<longleftrightarrow> x - k *\<^sub>R a \<in> span C" |
706 |
apply (simp only: scaleR_right_diff_distrib th0) |
|
707 |
apply (rule span_add_eq) |
|
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
708 |
apply (rule span_scale) |
64267 | 709 |
apply (rule span_sum) |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
710 |
apply (rule span_scale) |
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
711 |
apply (rule span_base) |
49522 | 712 |
apply assumption |
53406 | 713 |
done |
714 |
} |
|
44133 | 715 |
then have SC: "span ?C = span (insert a B)" |
716 |
unfolding set_eq_iff span_breakdown_eq C(3)[symmetric] by auto |
|
53406 | 717 |
{ |
718 |
fix y |
|
719 |
assume yC: "y \<in> C" |
|
720 |
then have Cy: "C = insert y (C - {y})" |
|
721 |
by blast |
|
722 |
have fth: "finite (C - {y})" |
|
723 |
using C by simp |
|
44528 | 724 |
have "orthogonal ?a y" |
725 |
unfolding orthogonal_def |
|
64267 | 726 |
unfolding inner_diff inner_sum_left right_minus_eq |
727 |
unfolding sum.remove [OF \<open>finite C\<close> \<open>y \<in> C\<close>] |
|
44528 | 728 |
apply (clarsimp simp add: inner_commute[of y a]) |
64267 | 729 |
apply (rule sum.neutral) |
44528 | 730 |
apply clarsimp |
731 |
apply (rule C(4)[unfolded pairwise_def orthogonal_def, rule_format]) |
|
60420 | 732 |
using \<open>y \<in> C\<close> by auto |
53406 | 733 |
} |
60420 | 734 |
with \<open>pairwise orthogonal C\<close> have CPO: "pairwise orthogonal ?C" |
44528 | 735 |
by (rule pairwise_orthogonal_insert) |
53406 | 736 |
from fC cC SC CPO have "?P (insert a B) ?C" |
737 |
by blast |
|
44133 | 738 |
then show ?case by blast |
739 |
qed |
|
740 |
||
741 |
lemma orthogonal_basis_exists: |
|
742 |
fixes V :: "('a::euclidean_space) set" |
|
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
743 |
shows "\<exists>B. independent B \<and> B \<subseteq> span V \<and> V \<subseteq> span B \<and> |
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
744 |
(card B = dim V) \<and> pairwise orthogonal B" |
49663 | 745 |
proof - |
49522 | 746 |
from basis_exists[of V] obtain B where |
53406 | 747 |
B: "B \<subseteq> V" "independent B" "V \<subseteq> span B" "card B = dim V" |
68073
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
immler
diff
changeset
|
748 |
by force |
53406 | 749 |
from B have fB: "finite B" "card B = dim V" |
750 |
using independent_bound by auto |
|
44133 | 751 |
from basis_orthogonal[OF fB(1)] obtain C where |
53406 | 752 |
C: "finite C" "card C \<le> card B" "span C = span B" "pairwise orthogonal C" |
753 |
by blast |
|
754 |
from C B have CSV: "C \<subseteq> span V" |
|
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
755 |
by (metis span_superset span_mono subset_trans) |
53406 | 756 |
from span_mono[OF B(3)] C have SVC: "span V \<subseteq> span C" |
757 |
by (simp add: span_span) |
|
44133 | 758 |
from card_le_dim_spanning[OF CSV SVC C(1)] C(2,3) fB |
53406 | 759 |
have iC: "independent C" |
44133 | 760 |
by (simp add: dim_span) |
53406 | 761 |
from C fB have "card C \<le> dim V" |
762 |
by simp |
|
763 |
moreover have "dim V \<le> card C" |
|
764 |
using span_card_ge_dim[OF CSV SVC C(1)] |
|
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
765 |
by simp |
53406 | 766 |
ultimately have CdV: "card C = dim V" |
767 |
using C(1) by simp |
|
768 |
from C B CSV CdV iC show ?thesis |
|
769 |
by auto |
|
44133 | 770 |
qed |
771 |
||
60420 | 772 |
text \<open>Low-dimensional subset is in a hyperplane (weak orthogonal complement).\<close> |
44133 | 773 |
|
49522 | 774 |
lemma span_not_univ_orthogonal: |
53406 | 775 |
fixes S :: "'a::euclidean_space set" |
44133 | 776 |
assumes sU: "span S \<noteq> UNIV" |
56444 | 777 |
shows "\<exists>a::'a. a \<noteq> 0 \<and> (\<forall>x \<in> span S. a \<bullet> x = 0)" |
49522 | 778 |
proof - |
53406 | 779 |
from sU obtain a where a: "a \<notin> span S" |
780 |
by blast |
|
44133 | 781 |
from orthogonal_basis_exists obtain B where |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
782 |
B: "independent B" "B \<subseteq> span S" "S \<subseteq> span B" |
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
783 |
"card B = dim S" "pairwise orthogonal B" |
44133 | 784 |
by blast |
53406 | 785 |
from B have fB: "finite B" "card B = dim S" |
786 |
using independent_bound by auto |
|
44133 | 787 |
from span_mono[OF B(2)] span_mono[OF B(3)] |
53406 | 788 |
have sSB: "span S = span B" |
789 |
by (simp add: span_span) |
|
64267 | 790 |
let ?a = "a - sum (\<lambda>b. (a \<bullet> b / (b \<bullet> b)) *\<^sub>R b) B" |
791 |
have "sum (\<lambda>b. (a \<bullet> b / (b \<bullet> b)) *\<^sub>R b) B \<in> span S" |
|
44133 | 792 |
unfolding sSB |
64267 | 793 |
apply (rule span_sum) |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
794 |
apply (rule span_scale) |
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
795 |
apply (rule span_base) |
49522 | 796 |
apply assumption |
797 |
done |
|
53406 | 798 |
with a have a0:"?a \<noteq> 0" |
799 |
by auto |
|
68058 | 800 |
have "?a \<bullet> x = 0" if "x\<in>span B" for x |
801 |
proof (rule span_induct [OF that]) |
|
49522 | 802 |
show "subspace {x. ?a \<bullet> x = 0}" |
803 |
by (auto simp add: subspace_def inner_add) |
|
804 |
next |
|
53406 | 805 |
{ |
806 |
fix x |
|
807 |
assume x: "x \<in> B" |
|
808 |
from x have B': "B = insert x (B - {x})" |
|
809 |
by blast |
|
810 |
have fth: "finite (B - {x})" |
|
811 |
using fB by simp |
|
44133 | 812 |
have "?a \<bullet> x = 0" |
53406 | 813 |
apply (subst B') |
814 |
using fB fth |
|
64267 | 815 |
unfolding sum_clauses(2)[OF fth] |
44133 | 816 |
apply simp unfolding inner_simps |
64267 | 817 |
apply (clarsimp simp add: inner_add inner_sum_left) |
818 |
apply (rule sum.neutral, rule ballI) |
|
63170 | 819 |
apply (simp only: inner_commute) |
49711 | 820 |
apply (auto simp add: x field_simps |
821 |
intro: B(5)[unfolded pairwise_def orthogonal_def, rule_format]) |
|
53406 | 822 |
done |
823 |
} |
|
68058 | 824 |
then show "?a \<bullet> x = 0" if "x \<in> B" for x |
825 |
using that by blast |
|
826 |
qed |
|
53406 | 827 |
with a0 show ?thesis |
828 |
unfolding sSB by (auto intro: exI[where x="?a"]) |
|
44133 | 829 |
qed |
830 |
||
831 |
lemma span_not_univ_subset_hyperplane: |
|
53406 | 832 |
fixes S :: "'a::euclidean_space set" |
833 |
assumes SU: "span S \<noteq> UNIV" |
|
44133 | 834 |
shows "\<exists> a. a \<noteq>0 \<and> span S \<subseteq> {x. a \<bullet> x = 0}" |
835 |
using span_not_univ_orthogonal[OF SU] by auto |
|
836 |
||
49663 | 837 |
lemma lowdim_subset_hyperplane: |
53406 | 838 |
fixes S :: "'a::euclidean_space set" |
44133 | 839 |
assumes d: "dim S < DIM('a)" |
56444 | 840 |
shows "\<exists>a::'a. a \<noteq> 0 \<and> span S \<subseteq> {x. a \<bullet> x = 0}" |
49522 | 841 |
proof - |
53406 | 842 |
{ |
843 |
assume "span S = UNIV" |
|
844 |
then have "dim (span S) = dim (UNIV :: ('a) set)" |
|
845 |
by simp |
|
846 |
then have "dim S = DIM('a)" |
|
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
847 |
by (metis Euclidean_Space.dim_UNIV dim_span) |
53406 | 848 |
with d have False by arith |
849 |
} |
|
850 |
then have th: "span S \<noteq> UNIV" |
|
851 |
by blast |
|
44133 | 852 |
from span_not_univ_subset_hyperplane[OF th] show ?thesis . |
853 |
qed |
|
854 |
||
855 |
lemma linear_eq_stdbasis: |
|
56444 | 856 |
fixes f :: "'a::euclidean_space \<Rightarrow> _" |
857 |
assumes lf: "linear f" |
|
49663 | 858 |
and lg: "linear g" |
68058 | 859 |
and fg: "\<And>b. b \<in> Basis \<Longrightarrow> f b = g b" |
44133 | 860 |
shows "f = g" |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
861 |
using linear_eq_on_span[OF lf lg, of Basis] fg |
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
862 |
by auto |
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
863 |
|
44133 | 864 |
|
60420 | 865 |
text \<open>Similar results for bilinear functions.\<close> |
44133 | 866 |
|
867 |
lemma bilinear_eq: |
|
868 |
assumes bf: "bilinear f" |
|
49522 | 869 |
and bg: "bilinear g" |
53406 | 870 |
and SB: "S \<subseteq> span B" |
871 |
and TC: "T \<subseteq> span C" |
|
68058 | 872 |
and "x\<in>S" "y\<in>T" |
873 |
and fg: "\<And>x y. \<lbrakk>x \<in> B; y\<in> C\<rbrakk> \<Longrightarrow> f x y = g x y" |
|
874 |
shows "f x y = g x y" |
|
49663 | 875 |
proof - |
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
876 |
let ?P = "{x. \<forall>y\<in> span C. f x y = g x y}" |
44133 | 877 |
from bf bg have sp: "subspace ?P" |
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
878 |
unfolding bilinear_def linear_iff subspace_def bf bg |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
879 |
by (auto simp add: span_zero bilinear_lzero[OF bf] bilinear_lzero[OF bg] |
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
880 |
span_add Ball_def |
49663 | 881 |
intro: bilinear_ladd[OF bf]) |
68058 | 882 |
have sfg: "\<And>x. x \<in> B \<Longrightarrow> subspace {a. f x a = g x a}" |
44133 | 883 |
apply (auto simp add: subspace_def) |
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
884 |
using bf bg unfolding bilinear_def linear_iff |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
885 |
apply (auto simp add: span_zero bilinear_rzero[OF bf] bilinear_rzero[OF bg] |
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
886 |
span_add Ball_def |
49663 | 887 |
intro: bilinear_ladd[OF bf]) |
49522 | 888 |
done |
68058 | 889 |
have "\<forall>y\<in> span C. f x y = g x y" if "x \<in> span B" for x |
890 |
apply (rule span_induct [OF that sp]) |
|
68062 | 891 |
using fg sfg span_induct by blast |
53406 | 892 |
then show ?thesis |
68058 | 893 |
using SB TC assms by auto |
44133 | 894 |
qed |
895 |
||
49522 | 896 |
lemma bilinear_eq_stdbasis: |
53406 | 897 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> _" |
44133 | 898 |
assumes bf: "bilinear f" |
49522 | 899 |
and bg: "bilinear g" |
68058 | 900 |
and fg: "\<And>i j. i \<in> Basis \<Longrightarrow> j \<in> Basis \<Longrightarrow> f i j = g i j" |
44133 | 901 |
shows "f = g" |
68074 | 902 |
using bilinear_eq[OF bf bg equalityD2[OF span_Basis] equalityD2[OF span_Basis]] fg by blast |
49522 | 903 |
|
69619
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
immler
parents:
69600
diff
changeset
|
904 |
|
60420 | 905 |
subsection \<open>Infinity norm\<close> |
44133 | 906 |
|
67962 | 907 |
definition%important "infnorm (x::'a::euclidean_space) = Sup {\<bar>x \<bullet> b\<bar> |b. b \<in> Basis}" |
44133 | 908 |
|
909 |
lemma infnorm_set_image: |
|
53716 | 910 |
fixes x :: "'a::euclidean_space" |
56444 | 911 |
shows "{\<bar>x \<bullet> i\<bar> |i. i \<in> Basis} = (\<lambda>i. \<bar>x \<bullet> i\<bar>) ` Basis" |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
912 |
by blast |
44133 | 913 |
|
53716 | 914 |
lemma infnorm_Max: |
915 |
fixes x :: "'a::euclidean_space" |
|
56444 | 916 |
shows "infnorm x = Max ((\<lambda>i. \<bar>x \<bullet> i\<bar>) ` Basis)" |
62343
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents:
61973
diff
changeset
|
917 |
by (simp add: infnorm_def infnorm_set_image cSup_eq_Max) |
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
918 |
|
44133 | 919 |
lemma infnorm_set_lemma: |
53716 | 920 |
fixes x :: "'a::euclidean_space" |
56444 | 921 |
shows "finite {\<bar>x \<bullet> i\<bar> |i. i \<in> Basis}" |
922 |
and "{\<bar>x \<bullet> i\<bar> |i. i \<in> Basis} \<noteq> {}" |
|
44133 | 923 |
unfolding infnorm_set_image |
924 |
by auto |
|
925 |
||
53406 | 926 |
lemma infnorm_pos_le: |
927 |
fixes x :: "'a::euclidean_space" |
|
928 |
shows "0 \<le> infnorm x" |
|
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
929 |
by (simp add: infnorm_Max Max_ge_iff ex_in_conv) |
44133 | 930 |
|
53406 | 931 |
lemma infnorm_triangle: |
932 |
fixes x :: "'a::euclidean_space" |
|
933 |
shows "infnorm (x + y) \<le> infnorm x + infnorm y" |
|
49522 | 934 |
proof - |
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
935 |
have *: "\<And>a b c d :: real. \<bar>a\<bar> \<le> c \<Longrightarrow> \<bar>b\<bar> \<le> d \<Longrightarrow> \<bar>a + b\<bar> \<le> c + d" |
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
936 |
by simp |
44133 | 937 |
show ?thesis |
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
938 |
by (auto simp: infnorm_Max inner_add_left intro!: *) |
44133 | 939 |
qed |
940 |
||
53406 | 941 |
lemma infnorm_eq_0: |
942 |
fixes x :: "'a::euclidean_space" |
|
943 |
shows "infnorm x = 0 \<longleftrightarrow> x = 0" |
|
49522 | 944 |
proof - |
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
945 |
have "infnorm x \<le> 0 \<longleftrightarrow> x = 0" |
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
946 |
unfolding infnorm_Max by (simp add: euclidean_all_zero_iff) |
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
947 |
then show ?thesis |
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
948 |
using infnorm_pos_le[of x] by simp |
44133 | 949 |
qed |
950 |
||
951 |
lemma infnorm_0: "infnorm 0 = 0" |
|
952 |
by (simp add: infnorm_eq_0) |
|
953 |
||
954 |
lemma infnorm_neg: "infnorm (- x) = infnorm x" |
|
68062 | 955 |
unfolding infnorm_def by simp |
44133 | 956 |
|
957 |
lemma infnorm_sub: "infnorm (x - y) = infnorm (y - x)" |
|
68062 | 958 |
by (metis infnorm_neg minus_diff_eq) |
959 |
||
960 |
lemma absdiff_infnorm: "\<bar>infnorm x - infnorm y\<bar> \<le> infnorm (x - y)" |
|
49522 | 961 |
proof - |
68062 | 962 |
have *: "\<And>(nx::real) n ny. nx \<le> n + ny \<Longrightarrow> ny \<le> n + nx \<Longrightarrow> \<bar>nx - ny\<bar> \<le> n" |
44133 | 963 |
by arith |
68062 | 964 |
show ?thesis |
965 |
proof (rule *) |
|
966 |
from infnorm_triangle[of "x - y" " y"] infnorm_triangle[of "x - y" "-x"] |
|
967 |
show "infnorm x \<le> infnorm (x - y) + infnorm y" "infnorm y \<le> infnorm (x - y) + infnorm x" |
|
968 |
by (simp_all add: field_simps infnorm_neg) |
|
969 |
qed |
|
44133 | 970 |
qed |
971 |
||
53406 | 972 |
lemma real_abs_infnorm: "\<bar>infnorm x\<bar> = infnorm x" |
44133 | 973 |
using infnorm_pos_le[of x] by arith |
974 |
||
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
975 |
lemma Basis_le_infnorm: |
53406 | 976 |
fixes x :: "'a::euclidean_space" |
977 |
shows "b \<in> Basis \<Longrightarrow> \<bar>x \<bullet> b\<bar> \<le> infnorm x" |
|
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
978 |
by (simp add: infnorm_Max) |
44133 | 979 |
|
56444 | 980 |
lemma infnorm_mul: "infnorm (a *\<^sub>R x) = \<bar>a\<bar> * infnorm x" |
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
981 |
unfolding infnorm_Max |
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
982 |
proof (safe intro!: Max_eqI) |
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
983 |
let ?B = "(\<lambda>i. \<bar>x \<bullet> i\<bar>) ` Basis" |
68062 | 984 |
{ fix b :: 'a |
53406 | 985 |
assume "b \<in> Basis" |
986 |
then show "\<bar>a *\<^sub>R x \<bullet> b\<bar> \<le> \<bar>a\<bar> * Max ?B" |
|
987 |
by (simp add: abs_mult mult_left_mono) |
|
988 |
next |
|
989 |
from Max_in[of ?B] obtain b where "b \<in> Basis" "Max ?B = \<bar>x \<bullet> b\<bar>" |
|
990 |
by (auto simp del: Max_in) |
|
991 |
then show "\<bar>a\<bar> * Max ((\<lambda>i. \<bar>x \<bullet> i\<bar>) ` Basis) \<in> (\<lambda>i. \<bar>a *\<^sub>R x \<bullet> i\<bar>) ` Basis" |
|
992 |
by (intro image_eqI[where x=b]) (auto simp: abs_mult) |
|
993 |
} |
|
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
994 |
qed simp |
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
995 |
|
53406 | 996 |
lemma infnorm_mul_lemma: "infnorm (a *\<^sub>R x) \<le> \<bar>a\<bar> * infnorm x" |
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
997 |
unfolding infnorm_mul .. |
44133 | 998 |
|
999 |
lemma infnorm_pos_lt: "infnorm x > 0 \<longleftrightarrow> x \<noteq> 0" |
|
1000 |
using infnorm_pos_le[of x] infnorm_eq_0[of x] by arith |
|
1001 |
||
60420 | 1002 |
text \<open>Prove that it differs only up to a bound from Euclidean norm.\<close> |
44133 | 1003 |
|
1004 |
lemma infnorm_le_norm: "infnorm x \<le> norm x" |
|
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
1005 |
by (simp add: Basis_le_norm infnorm_Max) |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1006 |
|
53716 | 1007 |
lemma norm_le_infnorm: |
1008 |
fixes x :: "'a::euclidean_space" |
|
1009 |
shows "norm x \<le> sqrt DIM('a) * infnorm x" |
|
68062 | 1010 |
unfolding norm_eq_sqrt_inner id_def |
1011 |
proof (rule real_le_lsqrt[OF inner_ge_zero]) |
|
1012 |
show "sqrt DIM('a) * infnorm x \<ge> 0" |
|
44133 | 1013 |
by (simp add: zero_le_mult_iff infnorm_pos_le) |
68062 | 1014 |
have "x \<bullet> x \<le> (\<Sum>b\<in>Basis. x \<bullet> b * (x \<bullet> b))" |
1015 |
by (metis euclidean_inner order_refl) |
|
1016 |
also have "... \<le> DIM('a) * \<bar>infnorm x\<bar>\<^sup>2" |
|
1017 |
by (rule sum_bounded_above) (metis Basis_le_infnorm abs_le_square_iff power2_eq_square real_abs_infnorm) |
|
1018 |
also have "... \<le> (sqrt DIM('a) * infnorm x)\<^sup>2" |
|
1019 |
by (simp add: power_mult_distrib) |
|
1020 |
finally show "x \<bullet> x \<le> (sqrt DIM('a) * infnorm x)\<^sup>2" . |
|
44133 | 1021 |
qed |
1022 |
||
44646 | 1023 |
lemma tendsto_infnorm [tendsto_intros]: |
61973 | 1024 |
assumes "(f \<longlongrightarrow> a) F" |
1025 |
shows "((\<lambda>x. infnorm (f x)) \<longlongrightarrow> infnorm a) F" |
|
44646 | 1026 |
proof (rule tendsto_compose [OF LIM_I assms]) |
53406 | 1027 |
fix r :: real |
1028 |
assume "r > 0" |
|
49522 | 1029 |
then show "\<exists>s>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < s \<longrightarrow> norm (infnorm x - infnorm a) < r" |
68062 | 1030 |
by (metis real_norm_def le_less_trans absdiff_infnorm infnorm_le_norm) |
44646 | 1031 |
qed |
1032 |
||
60420 | 1033 |
text \<open>Equality in Cauchy-Schwarz and triangle inequalities.\<close> |
44133 | 1034 |
|
53406 | 1035 |
lemma norm_cauchy_schwarz_eq: "x \<bullet> y = norm x * norm y \<longleftrightarrow> norm x *\<^sub>R y = norm y *\<^sub>R x" |
1036 |
(is "?lhs \<longleftrightarrow> ?rhs") |
|
68062 | 1037 |
proof (cases "x=0") |
1038 |
case True |
|
1039 |
then show ?thesis |
|
1040 |
by auto |
|
1041 |
next |
|
1042 |
case False |
|
1043 |
from inner_eq_zero_iff[of "norm y *\<^sub>R x - norm x *\<^sub>R y"] |
|
1044 |
have "?rhs \<longleftrightarrow> |
|
49522 | 1045 |
(norm y * (norm y * norm x * norm x - norm x * (x \<bullet> y)) - |
1046 |
norm x * (norm y * (y \<bullet> x) - norm x * norm y * norm y) = 0)" |
|
68062 | 1047 |
using False unfolding inner_simps |
1048 |
by (auto simp add: power2_norm_eq_inner[symmetric] power2_eq_square inner_commute field_simps) |
|
1049 |
also have "\<dots> \<longleftrightarrow> (2 * norm x * norm y * (norm x * norm y - x \<bullet> y) = 0)" |
|
1050 |
using False by (simp add: field_simps inner_commute) |
|
1051 |
also have "\<dots> \<longleftrightarrow> ?lhs" |
|
1052 |
using False by auto |
|
1053 |
finally show ?thesis by metis |
|
44133 | 1054 |
qed |
1055 |
||
1056 |
lemma norm_cauchy_schwarz_abs_eq: |
|
56444 | 1057 |
"\<bar>x \<bullet> y\<bar> = norm x * norm y \<longleftrightarrow> |
53716 | 1058 |
norm x *\<^sub>R y = norm y *\<^sub>R x \<or> norm x *\<^sub>R y = - norm y *\<^sub>R x" |
53406 | 1059 |
(is "?lhs \<longleftrightarrow> ?rhs") |
49522 | 1060 |
proof - |
56444 | 1061 |
have th: "\<And>(x::real) a. a \<ge> 0 \<Longrightarrow> \<bar>x\<bar> = a \<longleftrightarrow> x = a \<or> x = - a" |
53406 | 1062 |
by arith |
44133 | 1063 |
have "?rhs \<longleftrightarrow> norm x *\<^sub>R y = norm y *\<^sub>R x \<or> norm (- x) *\<^sub>R y = norm y *\<^sub>R (- x)" |
1064 |
by simp |
|
68062 | 1065 |
also have "\<dots> \<longleftrightarrow> (x \<bullet> y = norm x * norm y \<or> (- x) \<bullet> y = norm x * norm y)" |
44133 | 1066 |
unfolding norm_cauchy_schwarz_eq[symmetric] |
1067 |
unfolding norm_minus_cancel norm_scaleR .. |
|
1068 |
also have "\<dots> \<longleftrightarrow> ?lhs" |
|
53406 | 1069 |
unfolding th[OF mult_nonneg_nonneg, OF norm_ge_zero[of x] norm_ge_zero[of y]] inner_simps |
1070 |
by auto |
|
44133 | 1071 |
finally show ?thesis .. |
1072 |
qed |
|
1073 |
||
1074 |
lemma norm_triangle_eq: |
|
1075 |
fixes x y :: "'a::real_inner" |
|
53406 | 1076 |
shows "norm (x + y) = norm x + norm y \<longleftrightarrow> norm x *\<^sub>R y = norm y *\<^sub>R x" |
68062 | 1077 |
proof (cases "x = 0 \<or> y = 0") |
1078 |
case True |
|
1079 |
then show ?thesis |
|
1080 |
by force |
|
1081 |
next |
|
1082 |
case False |
|
1083 |
then have n: "norm x > 0" "norm y > 0" |
|
1084 |
by auto |
|
1085 |
have "norm (x + y) = norm x + norm y \<longleftrightarrow> (norm (x + y))\<^sup>2 = (norm x + norm y)\<^sup>2" |
|
1086 |
by simp |
|
1087 |
also have "\<dots> \<longleftrightarrow> norm x *\<^sub>R y = norm y *\<^sub>R x" |
|
1088 |
unfolding norm_cauchy_schwarz_eq[symmetric] |
|
1089 |
unfolding power2_norm_eq_inner inner_simps |
|
1090 |
by (simp add: power2_norm_eq_inner[symmetric] power2_eq_square inner_commute field_simps) |
|
1091 |
finally show ?thesis . |
|
44133 | 1092 |
qed |
1093 |
||
49522 | 1094 |
|
60420 | 1095 |
subsection \<open>Collinearity\<close> |
44133 | 1096 |
|
67962 | 1097 |
definition%important collinear :: "'a::real_vector set \<Rightarrow> bool" |
49522 | 1098 |
where "collinear S \<longleftrightarrow> (\<exists>u. \<forall>x \<in> S. \<forall> y \<in> S. \<exists>c. x - y = c *\<^sub>R u)" |
44133 | 1099 |
|
66287
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1100 |
lemma collinear_alt: |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1101 |
"collinear S \<longleftrightarrow> (\<exists>u v. \<forall>x \<in> S. \<exists>c. x = u + c *\<^sub>R v)" (is "?lhs = ?rhs") |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1102 |
proof |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1103 |
assume ?lhs |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1104 |
then show ?rhs |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1105 |
unfolding collinear_def by (metis Groups.add_ac(2) diff_add_cancel) |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1106 |
next |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1107 |
assume ?rhs |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1108 |
then obtain u v where *: "\<And>x. x \<in> S \<Longrightarrow> \<exists>c. x = u + c *\<^sub>R v" |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1109 |
by (auto simp: ) |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1110 |
have "\<exists>c. x - y = c *\<^sub>R v" if "x \<in> S" "y \<in> S" for x y |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1111 |
by (metis *[OF \<open>x \<in> S\<close>] *[OF \<open>y \<in> S\<close>] scaleR_left.diff add_diff_cancel_left) |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1112 |
then show ?lhs |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1113 |
using collinear_def by blast |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1114 |
qed |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1115 |
|
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1116 |
lemma collinear: |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1117 |
fixes S :: "'a::{perfect_space,real_vector} set" |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1118 |
shows "collinear S \<longleftrightarrow> (\<exists>u. u \<noteq> 0 \<and> (\<forall>x \<in> S. \<forall> y \<in> S. \<exists>c. x - y = c *\<^sub>R u))" |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1119 |
proof - |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1120 |
have "\<exists>v. v \<noteq> 0 \<and> (\<forall>x\<in>S. \<forall>y\<in>S. \<exists>c. x - y = c *\<^sub>R v)" |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1121 |
if "\<forall>x\<in>S. \<forall>y\<in>S. \<exists>c. x - y = c *\<^sub>R u" "u=0" for u |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1122 |
proof - |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1123 |
have "\<forall>x\<in>S. \<forall>y\<in>S. x = y" |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1124 |
using that by auto |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1125 |
moreover |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1126 |
obtain v::'a where "v \<noteq> 0" |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1127 |
using UNIV_not_singleton [of 0] by auto |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1128 |
ultimately have "\<forall>x\<in>S. \<forall>y\<in>S. \<exists>c. x - y = c *\<^sub>R v" |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1129 |
by auto |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1130 |
then show ?thesis |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1131 |
using \<open>v \<noteq> 0\<close> by blast |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1132 |
qed |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1133 |
then show ?thesis |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1134 |
apply (clarsimp simp: collinear_def) |
68072
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents:
67982
diff
changeset
|
1135 |
by (metis scaleR_zero_right vector_fraction_eq_iff) |
66287
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1136 |
qed |
005a30862ed0
new material: Colinearity, convex sets, polytopes
paulson <lp15@cam.ac.uk>
parents:
65680
diff
changeset
|
1137 |
|
63881
b746b19197bd
lots of new results about topology, affine dimension etc
paulson <lp15@cam.ac.uk>
parents:
63680
diff
changeset
|
1138 |
lemma collinear_subset: "\<lbrakk>collinear T; S \<subseteq> T\<rbrakk> \<Longrightarrow> collinear S" |
b746b19197bd
lots of new results about topology, affine dimension etc
paulson <lp15@cam.ac.uk>
parents:
63680
diff
changeset
|
1139 |
by (meson collinear_def subsetCE) |
b746b19197bd
lots of new results about topology, affine dimension etc
paulson <lp15@cam.ac.uk>
parents:
63680
diff
changeset
|
1140 |
|
60762 | 1141 |
lemma collinear_empty [iff]: "collinear {}" |
53406 | 1142 |
by (simp add: collinear_def) |
44133 | 1143 |
|
60762 | 1144 |
lemma collinear_sing [iff]: "collinear {x}" |
44133 | 1145 |
by (simp add: collinear_def) |
1146 |
||
60762 | 1147 |
lemma collinear_2 [iff]: "collinear {x, y}" |
44133 | 1148 |
apply (simp add: collinear_def) |
1149 |
apply (rule exI[where x="x - y"]) |
|
68062 | 1150 |
by (metis minus_diff_eq scaleR_left.minus scaleR_one) |
44133 | 1151 |
|
56444 | 1152 |
lemma collinear_lemma: "collinear {0, x, y} \<longleftrightarrow> x = 0 \<or> y = 0 \<or> (\<exists>c. y = c *\<^sub>R x)" |
53406 | 1153 |
(is "?lhs \<longleftrightarrow> ?rhs") |
68062 | 1154 |
proof (cases "x = 0 \<or> y = 0") |
1155 |
case True |
|
1156 |
then show ?thesis |
|
1157 |
by (auto simp: insert_commute) |
|
1158 |
next |
|
1159 |
case False |
|
1160 |
show ?thesis |
|
1161 |
proof |
|
1162 |
assume h: "?lhs" |
|
1163 |
then obtain u where u: "\<forall> x\<in> {0,x,y}. \<forall>y\<in> {0,x,y}. \<exists>c. x - y = c *\<^sub>R u" |
|
1164 |
unfolding collinear_def by blast |
|
1165 |
from u[rule_format, of x 0] u[rule_format, of y 0] |
|
1166 |
obtain cx and cy where |
|
1167 |
cx: "x = cx *\<^sub>R u" and cy: "y = cy *\<^sub>R u" |
|
1168 |
by auto |
|
1169 |
from cx cy False have cx0: "cx \<noteq> 0" and cy0: "cy \<noteq> 0" by auto |
|
1170 |
let ?d = "cy / cx" |
|
1171 |
from cx cy cx0 have "y = ?d *\<^sub>R x" |
|
1172 |
by simp |
|
1173 |
then show ?rhs using False by blast |
|
1174 |
next |
|
1175 |
assume h: "?rhs" |
|
1176 |
then obtain c where c: "y = c *\<^sub>R x" |
|
1177 |
using False by blast |
|
1178 |
show ?lhs |
|
1179 |
unfolding collinear_def c |
|
1180 |
apply (rule exI[where x=x]) |
|
1181 |
apply auto |
|
1182 |
apply (rule exI[where x="- 1"], simp) |
|
1183 |
apply (rule exI[where x= "-c"], simp) |
|
44133 | 1184 |
apply (rule exI[where x=1], simp) |
68062 | 1185 |
apply (rule exI[where x="1 - c"], simp add: scaleR_left_diff_distrib) |
1186 |
apply (rule exI[where x="c - 1"], simp add: scaleR_left_diff_distrib) |
|
1187 |
done |
|
1188 |
qed |
|
44133 | 1189 |
qed |
1190 |
||
56444 | 1191 |
lemma norm_cauchy_schwarz_equal: "\<bar>x \<bullet> y\<bar> = norm x * norm y \<longleftrightarrow> collinear {0, x, y}" |
68062 | 1192 |
proof (cases "x=0") |
1193 |
case True |
|
1194 |
then show ?thesis |
|
1195 |
by (auto simp: insert_commute) |
|
1196 |
next |
|
1197 |
case False |
|
1198 |
then have nnz: "norm x \<noteq> 0" |
|
1199 |
by auto |
|
1200 |
show ?thesis |
|
1201 |
proof |
|
1202 |
assume "\<bar>x \<bullet> y\<bar> = norm x * norm y" |
|
1203 |
then show "collinear {0, x, y}" |
|
1204 |
unfolding norm_cauchy_schwarz_abs_eq collinear_lemma |
|
1205 |
by (meson eq_vector_fraction_iff nnz) |
|
1206 |
next |
|
1207 |
assume "collinear {0, x, y}" |
|
1208 |
with False show "\<bar>x \<bullet> y\<bar> = norm x * norm y" |
|
1209 |
unfolding norm_cauchy_schwarz_abs_eq collinear_lemma by (auto simp: abs_if) |
|
1210 |
qed |
|
1211 |
qed |
|
49522 | 1212 |
|
54776
db890d9fc5c2
ordered_euclidean_space compatible with more standard pointwise ordering on products; conditionally complete lattice with product order
immler
parents:
54703
diff
changeset
|
1213 |
end |