| author | wenzelm |
| Tue, 08 Apr 2014 14:59:36 +0200 | |
| changeset 56467 | 8d7d6f17c6a7 |
| parent 56444 | f944ae8c80a3 |
| child 56479 | 91958d4b30f7 |
| permissions | -rw-r--r-- |
| 44133 | 1 |
(* Title: HOL/Multivariate_Analysis/Linear_Algebra.thy |
2 |
Author: Amine Chaieb, University of Cambridge |
|
3 |
*) |
|
4 |
||
5 |
header {* Elementary linear algebra on Euclidean spaces *}
|
|
6 |
||
7 |
theory Linear_Algebra |
|
8 |
imports |
|
9 |
Euclidean_Space |
|
10 |
"~~/src/HOL/Library/Infinite_Set" |
|
11 |
begin |
|
12 |
||
13 |
lemma cond_application_beta: "(if b then f else g) x = (if b then f x else g x)" |
|
14 |
by auto |
|
15 |
||
16 |
notation inner (infix "\<bullet>" 70) |
|
17 |
||
| 53716 | 18 |
lemma square_bound_lemma: |
19 |
fixes x :: real |
|
20 |
shows "x < (1 + x) * (1 + x)" |
|
| 49522 | 21 |
proof - |
| 53406 | 22 |
have "(x + 1/2)\<^sup>2 + 3/4 > 0" |
23 |
using zero_le_power2[of "x+1/2"] by arith |
|
24 |
then show ?thesis |
|
25 |
by (simp add: field_simps power2_eq_square) |
|
| 44133 | 26 |
qed |
27 |
||
| 53406 | 28 |
lemma square_continuous: |
29 |
fixes e :: real |
|
| 56444 | 30 |
shows "e > 0 \<Longrightarrow> \<exists>d. 0 < d \<and> (\<forall>y. \<bar>y - x\<bar> < d \<longrightarrow> \<bar>y * y - x * x\<bar> < e)" |
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51475
diff
changeset
|
31 |
using isCont_power[OF isCont_ident, of x, unfolded isCont_def LIM_eq, rule_format, of e 2] |
| 49522 | 32 |
apply (auto simp add: power2_eq_square) |
| 44133 | 33 |
apply (rule_tac x="s" in exI) |
34 |
apply auto |
|
35 |
apply (erule_tac x=y in allE) |
|
36 |
apply auto |
|
37 |
done |
|
38 |
||
39 |
text{* Hence derive more interesting properties of the norm. *}
|
|
40 |
||
| 53406 | 41 |
lemma norm_eq_0_dot: "norm x = 0 \<longleftrightarrow> x \<bullet> x = (0::real)" |
| 44666 | 42 |
by simp (* TODO: delete *) |
| 44133 | 43 |
|
44 |
lemma norm_triangle_sub: |
|
45 |
fixes x y :: "'a::real_normed_vector" |
|
| 53406 | 46 |
shows "norm x \<le> norm y + norm (x - y)" |
| 44133 | 47 |
using norm_triangle_ineq[of "y" "x - y"] by (simp add: field_simps) |
48 |
||
| 53406 | 49 |
lemma norm_le: "norm x \<le> norm y \<longleftrightarrow> x \<bullet> x \<le> y \<bullet> y" |
| 44133 | 50 |
by (simp add: norm_eq_sqrt_inner) |
| 44666 | 51 |
|
| 53406 | 52 |
lemma norm_lt: "norm x < norm y \<longleftrightarrow> x \<bullet> x < y \<bullet> y" |
53 |
by (simp add: norm_eq_sqrt_inner) |
|
54 |
||
55 |
lemma norm_eq: "norm x = norm y \<longleftrightarrow> x \<bullet> x = y \<bullet> y" |
|
| 49522 | 56 |
apply (subst order_eq_iff) |
57 |
apply (auto simp: norm_le) |
|
58 |
done |
|
| 44666 | 59 |
|
| 53406 | 60 |
lemma norm_eq_1: "norm x = 1 \<longleftrightarrow> x \<bullet> x = 1" |
| 44666 | 61 |
by (simp add: norm_eq_sqrt_inner) |
| 44133 | 62 |
|
63 |
text{* Squaring equations and inequalities involving norms. *}
|
|
64 |
||
| 53077 | 65 |
lemma dot_square_norm: "x \<bullet> x = (norm x)\<^sup>2" |
| 44666 | 66 |
by (simp only: power2_norm_eq_inner) (* TODO: move? *) |
| 44133 | 67 |
|
| 53406 | 68 |
lemma norm_eq_square: "norm x = a \<longleftrightarrow> 0 \<le> a \<and> x \<bullet> x = a\<^sup>2" |
| 44133 | 69 |
by (auto simp add: norm_eq_sqrt_inner) |
70 |
||
| 53077 | 71 |
lemma real_abs_le_square_iff: "\<bar>x\<bar> \<le> \<bar>y\<bar> \<longleftrightarrow> (x::real)\<^sup>2 \<le> y\<^sup>2" |
| 44133 | 72 |
proof |
73 |
assume "\<bar>x\<bar> \<le> \<bar>y\<bar>" |
|
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51478
diff
changeset
|
74 |
then have "\<bar>x\<bar>\<^sup>2 \<le> \<bar>y\<bar>\<^sup>2" by (rule power_mono, simp) |
|
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51478
diff
changeset
|
75 |
then show "x\<^sup>2 \<le> y\<^sup>2" by simp |
| 44133 | 76 |
next |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51478
diff
changeset
|
77 |
assume "x\<^sup>2 \<le> y\<^sup>2" |
|
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51478
diff
changeset
|
78 |
then have "sqrt (x\<^sup>2) \<le> sqrt (y\<^sup>2)" by (rule real_sqrt_le_mono) |
| 44133 | 79 |
then show "\<bar>x\<bar> \<le> \<bar>y\<bar>" by simp |
80 |
qed |
|
81 |
||
| 53406 | 82 |
lemma norm_le_square: "norm x \<le> a \<longleftrightarrow> 0 \<le> a \<and> x \<bullet> x \<le> a\<^sup>2" |
| 44133 | 83 |
apply (simp add: dot_square_norm real_abs_le_square_iff[symmetric]) |
84 |
using norm_ge_zero[of x] |
|
85 |
apply arith |
|
86 |
done |
|
87 |
||
| 53406 | 88 |
lemma norm_ge_square: "norm x \<ge> a \<longleftrightarrow> a \<le> 0 \<or> x \<bullet> x \<ge> a\<^sup>2" |
| 44133 | 89 |
apply (simp add: dot_square_norm real_abs_le_square_iff[symmetric]) |
90 |
using norm_ge_zero[of x] |
|
91 |
apply arith |
|
92 |
done |
|
93 |
||
| 53716 | 94 |
lemma norm_lt_square: "norm x < a \<longleftrightarrow> 0 < a \<and> x \<bullet> x < a\<^sup>2" |
| 44133 | 95 |
by (metis not_le norm_ge_square) |
| 53406 | 96 |
|
| 53716 | 97 |
lemma norm_gt_square: "norm x > a \<longleftrightarrow> a < 0 \<or> x \<bullet> x > a\<^sup>2" |
| 44133 | 98 |
by (metis norm_le_square not_less) |
99 |
||
100 |
text{* Dot product in terms of the norm rather than conversely. *}
|
|
101 |
||
| 53406 | 102 |
lemmas inner_simps = inner_add_left inner_add_right inner_diff_right inner_diff_left |
| 49522 | 103 |
inner_scaleR_left inner_scaleR_right |
| 44133 | 104 |
|
| 53077 | 105 |
lemma dot_norm: "x \<bullet> y = ((norm (x + y))\<^sup>2 - (norm x)\<^sup>2 - (norm y)\<^sup>2) / 2" |
| 53406 | 106 |
unfolding power2_norm_eq_inner inner_simps inner_commute by auto |
| 44133 | 107 |
|
| 53077 | 108 |
lemma dot_norm_neg: "x \<bullet> y = (((norm x)\<^sup>2 + (norm y)\<^sup>2) - (norm (x - y))\<^sup>2) / 2" |
| 49525 | 109 |
unfolding power2_norm_eq_inner inner_simps inner_commute |
110 |
by (auto simp add: algebra_simps) |
|
| 44133 | 111 |
|
112 |
text{* Equality of vectors in terms of @{term "op \<bullet>"} products. *}
|
|
113 |
||
| 53406 | 114 |
lemma vector_eq: "x = y \<longleftrightarrow> x \<bullet> x = x \<bullet> y \<and> y \<bullet> y = x \<bullet> x" |
115 |
(is "?lhs \<longleftrightarrow> ?rhs") |
|
| 44133 | 116 |
proof |
| 49652 | 117 |
assume ?lhs |
118 |
then show ?rhs by simp |
|
| 44133 | 119 |
next |
120 |
assume ?rhs |
|
| 53406 | 121 |
then have "x \<bullet> x - x \<bullet> y = 0 \<and> x \<bullet> y - y \<bullet> y = 0" |
122 |
by simp |
|
123 |
then have "x \<bullet> (x - y) = 0 \<and> y \<bullet> (x - y) = 0" |
|
124 |
by (simp add: inner_diff inner_commute) |
|
125 |
then have "(x - y) \<bullet> (x - y) = 0" |
|
126 |
by (simp add: field_simps inner_diff inner_commute) |
|
127 |
then show "x = y" by simp |
|
| 44133 | 128 |
qed |
129 |
||
130 |
lemma norm_triangle_half_r: |
|
| 53406 | 131 |
"norm (y - x1) < e / 2 \<Longrightarrow> norm (y - x2) < e / 2 \<Longrightarrow> norm (x1 - x2) < e" |
132 |
using dist_triangle_half_r unfolding dist_norm[symmetric] by auto |
|
| 44133 | 133 |
|
| 49522 | 134 |
lemma norm_triangle_half_l: |
| 53406 | 135 |
assumes "norm (x - y) < e / 2" |
| 53842 | 136 |
and "norm (x' - y) < e / 2" |
| 44133 | 137 |
shows "norm (x - x') < e" |
| 53406 | 138 |
using dist_triangle_half_l[OF assms[unfolded dist_norm[symmetric]]] |
139 |
unfolding dist_norm[symmetric] . |
|
140 |
||
141 |
lemma norm_triangle_le: "norm x + norm y \<le> e \<Longrightarrow> norm (x + y) \<le> e" |
|
| 44666 | 142 |
by (rule norm_triangle_ineq [THEN order_trans]) |
| 44133 | 143 |
|
| 53406 | 144 |
lemma norm_triangle_lt: "norm x + norm y < e \<Longrightarrow> norm (x + y) < e" |
| 44666 | 145 |
by (rule norm_triangle_ineq [THEN le_less_trans]) |
| 44133 | 146 |
|
147 |
lemma setsum_clauses: |
|
148 |
shows "setsum f {} = 0"
|
|
| 49525 | 149 |
and "finite S \<Longrightarrow> setsum f (insert x S) = (if x \<in> S then setsum f S else f x + setsum f S)" |
| 44133 | 150 |
by (auto simp add: insert_absorb) |
151 |
||
152 |
lemma setsum_norm_le: |
|
153 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" |
|
|
44176
eda112e9cdee
remove redundant lemma setsum_norm in favor of norm_setsum;
huffman
parents:
44170
diff
changeset
|
154 |
assumes fg: "\<forall>x \<in> S. norm (f x) \<le> g x" |
| 44133 | 155 |
shows "norm (setsum f S) \<le> setsum g S" |
| 49522 | 156 |
by (rule order_trans [OF norm_setsum setsum_mono]) (simp add: fg) |
| 44133 | 157 |
|
158 |
lemma setsum_norm_bound: |
|
159 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" |
|
|
56196
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
160 |
assumes K: "\<forall>x \<in> S. norm (f x) \<le> K" |
| 44133 | 161 |
shows "norm (setsum f S) \<le> of_nat (card S) * K" |
|
44176
eda112e9cdee
remove redundant lemma setsum_norm in favor of norm_setsum;
huffman
parents:
44170
diff
changeset
|
162 |
using setsum_norm_le[OF K] setsum_constant[symmetric] |
| 44133 | 163 |
by simp |
164 |
||
165 |
lemma setsum_group: |
|
166 |
assumes fS: "finite S" and fT: "finite T" and fST: "f ` S \<subseteq> T" |
|
| 53939 | 167 |
shows "setsum (\<lambda>y. setsum g {x. x \<in> S \<and> f x = y}) T = setsum g S"
|
| 44133 | 168 |
apply (subst setsum_image_gen[OF fS, of g f]) |
169 |
apply (rule setsum_mono_zero_right[OF fT fST]) |
|
| 49522 | 170 |
apply (auto intro: setsum_0') |
171 |
done |
|
| 44133 | 172 |
|
173 |
lemma vector_eq_ldot: "(\<forall>x. x \<bullet> y = x \<bullet> z) \<longleftrightarrow> y = z" |
|
174 |
proof |
|
175 |
assume "\<forall>x. x \<bullet> y = x \<bullet> z" |
|
| 53406 | 176 |
then have "\<forall>x. x \<bullet> (y - z) = 0" |
177 |
by (simp add: inner_diff) |
|
| 49522 | 178 |
then have "(y - z) \<bullet> (y - z) = 0" .. |
| 49652 | 179 |
then show "y = z" by simp |
| 44133 | 180 |
qed simp |
181 |
||
182 |
lemma vector_eq_rdot: "(\<forall>z. x \<bullet> z = y \<bullet> z) \<longleftrightarrow> x = y" |
|
183 |
proof |
|
184 |
assume "\<forall>z. x \<bullet> z = y \<bullet> z" |
|
| 53406 | 185 |
then have "\<forall>z. (x - y) \<bullet> z = 0" |
186 |
by (simp add: inner_diff) |
|
| 49522 | 187 |
then have "(x - y) \<bullet> (x - y) = 0" .. |
| 49652 | 188 |
then show "x = y" by simp |
| 44133 | 189 |
qed simp |
190 |
||
| 49522 | 191 |
|
192 |
subsection {* Orthogonality. *}
|
|
| 44133 | 193 |
|
194 |
context real_inner |
|
195 |
begin |
|
196 |
||
| 53842 | 197 |
definition "orthogonal x y \<longleftrightarrow> x \<bullet> y = 0" |
| 44133 | 198 |
|
199 |
lemma orthogonal_clauses: |
|
200 |
"orthogonal a 0" |
|
201 |
"orthogonal a x \<Longrightarrow> orthogonal a (c *\<^sub>R x)" |
|
| 53842 | 202 |
"orthogonal a x \<Longrightarrow> orthogonal a (- x)" |
| 44133 | 203 |
"orthogonal a x \<Longrightarrow> orthogonal a y \<Longrightarrow> orthogonal a (x + y)" |
204 |
"orthogonal a x \<Longrightarrow> orthogonal a y \<Longrightarrow> orthogonal a (x - y)" |
|
205 |
"orthogonal 0 a" |
|
206 |
"orthogonal x a \<Longrightarrow> orthogonal (c *\<^sub>R x) a" |
|
| 53842 | 207 |
"orthogonal x a \<Longrightarrow> orthogonal (- x) a" |
| 44133 | 208 |
"orthogonal x a \<Longrightarrow> orthogonal y a \<Longrightarrow> orthogonal (x + y) a" |
209 |
"orthogonal x a \<Longrightarrow> orthogonal y a \<Longrightarrow> orthogonal (x - y) a" |
|
| 44666 | 210 |
unfolding orthogonal_def inner_add inner_diff by auto |
211 |
||
| 44133 | 212 |
end |
213 |
||
214 |
lemma orthogonal_commute: "orthogonal x y \<longleftrightarrow> orthogonal y x" |
|
215 |
by (simp add: orthogonal_def inner_commute) |
|
216 |
||
| 49522 | 217 |
|
218 |
subsection {* Linear functions. *}
|
|
219 |
||
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
220 |
lemma linear_iff: |
| 53716 | 221 |
"linear f \<longleftrightarrow> (\<forall>x y. f (x + y) = f x + f y) \<and> (\<forall>c x. f (c *\<^sub>R x) = c *\<^sub>R f x)" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
222 |
(is "linear f \<longleftrightarrow> ?rhs") |
|
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
223 |
proof |
| 56444 | 224 |
assume "linear f" |
225 |
then interpret f: linear f . |
|
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
226 |
show "?rhs" by (simp add: f.add f.scaleR) |
|
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
227 |
next |
| 56444 | 228 |
assume "?rhs" |
229 |
then show "linear f" by unfold_locales simp_all |
|
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
230 |
qed |
| 44133 | 231 |
|
| 53406 | 232 |
lemma linear_compose_cmul: "linear f \<Longrightarrow> linear (\<lambda>x. c *\<^sub>R f x)" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
233 |
by (simp add: linear_iff algebra_simps) |
| 44133 | 234 |
|
| 53406 | 235 |
lemma linear_compose_neg: "linear f \<Longrightarrow> linear (\<lambda>x. - f x)" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
236 |
by (simp add: linear_iff) |
| 44133 | 237 |
|
| 53406 | 238 |
lemma linear_compose_add: "linear f \<Longrightarrow> linear g \<Longrightarrow> linear (\<lambda>x. f x + g x)" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
239 |
by (simp add: linear_iff algebra_simps) |
| 44133 | 240 |
|
| 53406 | 241 |
lemma linear_compose_sub: "linear f \<Longrightarrow> linear g \<Longrightarrow> linear (\<lambda>x. f x - g x)" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
242 |
by (simp add: linear_iff algebra_simps) |
| 44133 | 243 |
|
| 53406 | 244 |
lemma linear_compose: "linear f \<Longrightarrow> linear g \<Longrightarrow> linear (g \<circ> f)" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
245 |
by (simp add: linear_iff) |
| 44133 | 246 |
|
| 53406 | 247 |
lemma linear_id: "linear id" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
248 |
by (simp add: linear_iff id_def) |
| 53406 | 249 |
|
250 |
lemma linear_zero: "linear (\<lambda>x. 0)" |
|
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
251 |
by (simp add: linear_iff) |
| 44133 | 252 |
|
253 |
lemma linear_compose_setsum: |
|
|
56196
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
254 |
assumes lS: "\<forall>a \<in> S. linear (f a)" |
| 53716 | 255 |
shows "linear (\<lambda>x. setsum (\<lambda>a. f a x) S)" |
|
56196
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
256 |
proof (cases "finite S") |
|
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
257 |
case True |
|
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
258 |
then show ?thesis |
|
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
259 |
using lS by induct (simp_all add: linear_zero linear_compose_add) |
| 56444 | 260 |
next |
261 |
case False |
|
262 |
then show ?thesis |
|
263 |
by (simp add: linear_zero) |
|
264 |
qed |
|
| 44133 | 265 |
|
266 |
lemma linear_0: "linear f \<Longrightarrow> f 0 = 0" |
|
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
267 |
unfolding linear_iff |
| 44133 | 268 |
apply clarsimp |
269 |
apply (erule allE[where x="0::'a"]) |
|
270 |
apply simp |
|
271 |
done |
|
272 |
||
| 53406 | 273 |
lemma linear_cmul: "linear f \<Longrightarrow> f (c *\<^sub>R x) = c *\<^sub>R f x" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
274 |
by (simp add: linear_iff) |
| 44133 | 275 |
|
| 53406 | 276 |
lemma linear_neg: "linear f \<Longrightarrow> f (- x) = - f x" |
| 44133 | 277 |
using linear_cmul [where c="-1"] by simp |
278 |
||
| 53716 | 279 |
lemma linear_add: "linear f \<Longrightarrow> f (x + y) = f x + f y" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
280 |
by (metis linear_iff) |
| 44133 | 281 |
|
| 53716 | 282 |
lemma linear_sub: "linear f \<Longrightarrow> f (x - y) = f x - f y" |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53939
diff
changeset
|
283 |
using linear_add [of f x "- y"] by (simp add: linear_neg) |
| 44133 | 284 |
|
285 |
lemma linear_setsum: |
|
|
56196
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
286 |
assumes f: "linear f" |
| 53406 | 287 |
shows "f (setsum g S) = setsum (f \<circ> g) S" |
|
56196
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
288 |
proof (cases "finite S") |
|
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
289 |
case True |
|
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
290 |
then show ?thesis |
|
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
291 |
by induct (simp_all add: linear_0 [OF f] linear_add [OF f]) |
| 56444 | 292 |
next |
293 |
case False |
|
294 |
then show ?thesis |
|
295 |
by (simp add: linear_0 [OF f]) |
|
296 |
qed |
|
| 44133 | 297 |
|
298 |
lemma linear_setsum_mul: |
|
| 53406 | 299 |
assumes lin: "linear f" |
| 44133 | 300 |
shows "f (setsum (\<lambda>i. c i *\<^sub>R v i) S) = setsum (\<lambda>i. c i *\<^sub>R f (v i)) S" |
|
56196
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
301 |
using linear_setsum[OF lin, of "\<lambda>i. c i *\<^sub>R v i" , unfolded o_def] linear_cmul[OF lin] |
| 49522 | 302 |
by simp |
| 44133 | 303 |
|
304 |
lemma linear_injective_0: |
|
| 53406 | 305 |
assumes lin: "linear f" |
| 44133 | 306 |
shows "inj f \<longleftrightarrow> (\<forall>x. f x = 0 \<longrightarrow> x = 0)" |
| 49663 | 307 |
proof - |
| 53406 | 308 |
have "inj f \<longleftrightarrow> (\<forall> x y. f x = f y \<longrightarrow> x = y)" |
309 |
by (simp add: inj_on_def) |
|
310 |
also have "\<dots> \<longleftrightarrow> (\<forall> x y. f x - f y = 0 \<longrightarrow> x - y = 0)" |
|
311 |
by simp |
|
| 44133 | 312 |
also have "\<dots> \<longleftrightarrow> (\<forall> x y. f (x - y) = 0 \<longrightarrow> x - y = 0)" |
| 53406 | 313 |
by (simp add: linear_sub[OF lin]) |
314 |
also have "\<dots> \<longleftrightarrow> (\<forall> x. f x = 0 \<longrightarrow> x = 0)" |
|
315 |
by auto |
|
| 44133 | 316 |
finally show ?thesis . |
317 |
qed |
|
318 |
||
| 49522 | 319 |
|
320 |
subsection {* Bilinear functions. *}
|
|
| 44133 | 321 |
|
| 53406 | 322 |
definition "bilinear f \<longleftrightarrow> (\<forall>x. linear (\<lambda>y. f x y)) \<and> (\<forall>y. linear (\<lambda>x. f x y))" |
323 |
||
324 |
lemma bilinear_ladd: "bilinear h \<Longrightarrow> h (x + y) z = h x z + h y z" |
|
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
325 |
by (simp add: bilinear_def linear_iff) |
| 49663 | 326 |
|
| 53406 | 327 |
lemma bilinear_radd: "bilinear h \<Longrightarrow> h x (y + z) = h x y + h x z" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
328 |
by (simp add: bilinear_def linear_iff) |
| 44133 | 329 |
|
| 53406 | 330 |
lemma bilinear_lmul: "bilinear h \<Longrightarrow> h (c *\<^sub>R x) y = c *\<^sub>R h x y" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
331 |
by (simp add: bilinear_def linear_iff) |
| 44133 | 332 |
|
| 53406 | 333 |
lemma bilinear_rmul: "bilinear h \<Longrightarrow> h x (c *\<^sub>R y) = c *\<^sub>R h x y" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
334 |
by (simp add: bilinear_def linear_iff) |
| 44133 | 335 |
|
| 53406 | 336 |
lemma bilinear_lneg: "bilinear h \<Longrightarrow> h (- x) y = - h x y" |
|
54489
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54413
diff
changeset
|
337 |
by (drule bilinear_lmul [of _ "- 1"]) simp |
| 44133 | 338 |
|
| 53406 | 339 |
lemma bilinear_rneg: "bilinear h \<Longrightarrow> h x (- y) = - h x y" |
|
54489
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54413
diff
changeset
|
340 |
by (drule bilinear_rmul [of _ _ "- 1"]) simp |
| 44133 | 341 |
|
| 53406 | 342 |
lemma (in ab_group_add) eq_add_iff: "x = x + y \<longleftrightarrow> y = 0" |
| 44133 | 343 |
using add_imp_eq[of x y 0] by auto |
344 |
||
| 53406 | 345 |
lemma bilinear_lzero: |
346 |
assumes "bilinear h" |
|
347 |
shows "h 0 x = 0" |
|
| 49663 | 348 |
using bilinear_ladd [OF assms, of 0 0 x] by (simp add: eq_add_iff field_simps) |
349 |
||
| 53406 | 350 |
lemma bilinear_rzero: |
351 |
assumes "bilinear h" |
|
352 |
shows "h x 0 = 0" |
|
| 49663 | 353 |
using bilinear_radd [OF assms, of x 0 0 ] by (simp add: eq_add_iff field_simps) |
| 44133 | 354 |
|
| 53406 | 355 |
lemma bilinear_lsub: "bilinear h \<Longrightarrow> h (x - y) z = h x z - h y z" |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53939
diff
changeset
|
356 |
using bilinear_ladd [of h x "- y"] by (simp add: bilinear_lneg) |
| 44133 | 357 |
|
| 53406 | 358 |
lemma bilinear_rsub: "bilinear h \<Longrightarrow> h z (x - y) = h z x - h z y" |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53939
diff
changeset
|
359 |
using bilinear_radd [of h _ x "- y"] by (simp add: bilinear_rneg) |
| 44133 | 360 |
|
361 |
lemma bilinear_setsum: |
|
| 49663 | 362 |
assumes bh: "bilinear h" |
363 |
and fS: "finite S" |
|
364 |
and fT: "finite T" |
|
| 44133 | 365 |
shows "h (setsum f S) (setsum g T) = setsum (\<lambda>(i,j). h (f i) (g j)) (S \<times> T) " |
| 49522 | 366 |
proof - |
| 44133 | 367 |
have "h (setsum f S) (setsum g T) = setsum (\<lambda>x. h (f x) (setsum g T)) S" |
368 |
apply (rule linear_setsum[unfolded o_def]) |
|
| 53406 | 369 |
using bh fS |
370 |
apply (auto simp add: bilinear_def) |
|
| 49522 | 371 |
done |
| 44133 | 372 |
also have "\<dots> = setsum (\<lambda>x. setsum (\<lambda>y. h (f x) (g y)) T) S" |
373 |
apply (rule setsum_cong, simp) |
|
374 |
apply (rule linear_setsum[unfolded o_def]) |
|
| 49522 | 375 |
using bh fT |
376 |
apply (auto simp add: bilinear_def) |
|
377 |
done |
|
| 53406 | 378 |
finally show ?thesis |
379 |
unfolding setsum_cartesian_product . |
|
| 44133 | 380 |
qed |
381 |
||
| 49522 | 382 |
|
383 |
subsection {* Adjoints. *}
|
|
| 44133 | 384 |
|
385 |
definition "adjoint f = (SOME f'. \<forall>x y. f x \<bullet> y = x \<bullet> f' y)" |
|
386 |
||
387 |
lemma adjoint_unique: |
|
388 |
assumes "\<forall>x y. inner (f x) y = inner x (g y)" |
|
389 |
shows "adjoint f = g" |
|
| 49522 | 390 |
unfolding adjoint_def |
| 44133 | 391 |
proof (rule some_equality) |
| 53406 | 392 |
show "\<forall>x y. inner (f x) y = inner x (g y)" |
393 |
by (rule assms) |
|
| 44133 | 394 |
next |
| 53406 | 395 |
fix h |
396 |
assume "\<forall>x y. inner (f x) y = inner x (h y)" |
|
397 |
then have "\<forall>x y. inner x (g y) = inner x (h y)" |
|
398 |
using assms by simp |
|
399 |
then have "\<forall>x y. inner x (g y - h y) = 0" |
|
400 |
by (simp add: inner_diff_right) |
|
401 |
then have "\<forall>y. inner (g y - h y) (g y - h y) = 0" |
|
402 |
by simp |
|
403 |
then have "\<forall>y. h y = g y" |
|
404 |
by simp |
|
| 49652 | 405 |
then show "h = g" by (simp add: ext) |
| 44133 | 406 |
qed |
407 |
||
|
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
|
408 |
text {* TODO: The following lemmas about adjoints should hold for any
|
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
409 |
Hilbert space (i.e. complete inner product space). |
| 54703 | 410 |
(see @{url "http://en.wikipedia.org/wiki/Hermitian_adjoint"})
|
|
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
|
411 |
*} |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
412 |
|
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
413 |
lemma adjoint_works: |
| 56444 | 414 |
fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
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
|
415 |
assumes lf: "linear f" |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
416 |
shows "x \<bullet> adjoint f y = f x \<bullet> y" |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
417 |
proof - |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
418 |
have "\<forall>y. \<exists>w. \<forall>x. f x \<bullet> y = x \<bullet> w" |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
419 |
proof (intro allI exI) |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
420 |
fix y :: "'m" and x |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
421 |
let ?w = "(\<Sum>i\<in>Basis. (f i \<bullet> y) *\<^sub>R i) :: 'n" |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
422 |
have "f x \<bullet> y = f (\<Sum>i\<in>Basis. (x \<bullet> i) *\<^sub>R i) \<bullet> y" |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
423 |
by (simp add: euclidean_representation) |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
424 |
also have "\<dots> = (\<Sum>i\<in>Basis. (x \<bullet> i) *\<^sub>R f i) \<bullet> y" |
|
56196
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
425 |
unfolding linear_setsum[OF lf] |
|
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
|
426 |
by (simp add: linear_cmul[OF lf]) |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
427 |
finally show "f x \<bullet> y = x \<bullet> ?w" |
| 53406 | 428 |
by (simp add: inner_setsum_left inner_setsum_right mult_commute) |
|
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
|
429 |
qed |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
430 |
then show ?thesis |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
431 |
unfolding adjoint_def choice_iff |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
432 |
by (intro someI2_ex[where Q="\<lambda>f'. x \<bullet> f' y = f x \<bullet> y"]) auto |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
433 |
qed |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
434 |
|
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
435 |
lemma adjoint_clauses: |
| 56444 | 436 |
fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
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
|
437 |
assumes lf: "linear f" |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
438 |
shows "x \<bullet> adjoint f y = f x \<bullet> y" |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
439 |
and "adjoint f y \<bullet> x = y \<bullet> f x" |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
440 |
by (simp_all add: adjoint_works[OF lf] inner_commute) |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
441 |
|
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
442 |
lemma adjoint_linear: |
| 56444 | 443 |
fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
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
|
444 |
assumes lf: "linear f" |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
445 |
shows "linear (adjoint f)" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
446 |
by (simp add: lf linear_iff euclidean_eq_iff[where 'a='n] euclidean_eq_iff[where 'a='m] |
| 53939 | 447 |
adjoint_clauses[OF lf] inner_distrib) |
|
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
|
448 |
|
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
449 |
lemma adjoint_adjoint: |
| 56444 | 450 |
fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
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 |
assumes lf: "linear f" |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
452 |
shows "adjoint (adjoint f) = f" |
|
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 |
by (rule adjoint_unique, simp add: adjoint_clauses [OF lf]) |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
454 |
|
| 53406 | 455 |
|
| 49522 | 456 |
subsection {* Interlude: Some properties of real sets *}
|
| 44133 | 457 |
|
| 53406 | 458 |
lemma seq_mono_lemma: |
459 |
assumes "\<forall>(n::nat) \<ge> m. (d n :: real) < e n" |
|
460 |
and "\<forall>n \<ge> m. e n \<le> e m" |
|
| 44133 | 461 |
shows "\<forall>n \<ge> m. d n < e m" |
| 53406 | 462 |
using assms |
463 |
apply auto |
|
| 44133 | 464 |
apply (erule_tac x="n" in allE) |
465 |
apply (erule_tac x="n" in allE) |
|
466 |
apply auto |
|
467 |
done |
|
468 |
||
| 53406 | 469 |
lemma infinite_enumerate: |
470 |
assumes fS: "infinite S" |
|
| 44133 | 471 |
shows "\<exists>r. subseq r \<and> (\<forall>n. r n \<in> S)" |
| 49525 | 472 |
unfolding subseq_def |
473 |
using enumerate_in_set[OF fS] enumerate_mono[of _ _ S] fS by auto |
|
| 44133 | 474 |
|
| 56444 | 475 |
lemma approachable_lt_le: "(\<exists>(d::real) > 0. \<forall>x. f x < d \<longrightarrow> P x) \<longleftrightarrow> (\<exists>d>0. \<forall>x. f x \<le> d \<longrightarrow> P x)" |
| 49522 | 476 |
apply auto |
477 |
apply (rule_tac x="d/2" in exI) |
|
478 |
apply auto |
|
479 |
done |
|
| 44133 | 480 |
|
481 |
lemma triangle_lemma: |
|
| 53406 | 482 |
fixes x y z :: real |
483 |
assumes x: "0 \<le> x" |
|
484 |
and y: "0 \<le> y" |
|
485 |
and z: "0 \<le> z" |
|
486 |
and xy: "x\<^sup>2 \<le> y\<^sup>2 + z\<^sup>2" |
|
487 |
shows "x \<le> y + z" |
|
| 49522 | 488 |
proof - |
| 56444 | 489 |
have "y\<^sup>2 + z\<^sup>2 \<le> y\<^sup>2 + 2 * y * z + z\<^sup>2" |
| 53406 | 490 |
using z y by (simp add: mult_nonneg_nonneg) |
491 |
with xy have th: "x\<^sup>2 \<le> (y + z)\<^sup>2" |
|
492 |
by (simp add: power2_eq_square field_simps) |
|
493 |
from y z have yz: "y + z \<ge> 0" |
|
494 |
by arith |
|
| 44133 | 495 |
from power2_le_imp_le[OF th yz] show ?thesis . |
496 |
qed |
|
497 |
||
| 49522 | 498 |
|
| 44133 | 499 |
subsection {* A generic notion of "hull" (convex, affine, conic hull and closure). *}
|
500 |
||
| 53406 | 501 |
definition hull :: "('a set \<Rightarrow> bool) \<Rightarrow> 'a set \<Rightarrow> 'a set" (infixl "hull" 75)
|
502 |
where "S hull s = \<Inter>{t. S t \<and> s \<subseteq> t}"
|
|
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
503 |
|
|
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
504 |
lemma hull_same: "S s \<Longrightarrow> S hull s = s" |
| 44133 | 505 |
unfolding hull_def by auto |
506 |
||
| 53406 | 507 |
lemma hull_in: "(\<And>T. Ball T S \<Longrightarrow> S (\<Inter>T)) \<Longrightarrow> S (S hull s)" |
| 49522 | 508 |
unfolding hull_def Ball_def by auto |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
509 |
|
| 53406 | 510 |
lemma hull_eq: "(\<And>T. Ball T S \<Longrightarrow> S (\<Inter>T)) \<Longrightarrow> (S hull s) = s \<longleftrightarrow> S s" |
| 49522 | 511 |
using hull_same[of S s] hull_in[of S s] by metis |
| 44133 | 512 |
|
513 |
lemma hull_hull: "S hull (S hull s) = S hull s" |
|
514 |
unfolding hull_def by blast |
|
515 |
||
516 |
lemma hull_subset[intro]: "s \<subseteq> (S hull s)" |
|
517 |
unfolding hull_def by blast |
|
518 |
||
| 53406 | 519 |
lemma hull_mono: "s \<subseteq> t \<Longrightarrow> (S hull s) \<subseteq> (S hull t)" |
| 44133 | 520 |
unfolding hull_def by blast |
521 |
||
| 53406 | 522 |
lemma hull_antimono: "\<forall>x. S x \<longrightarrow> T x \<Longrightarrow> (T hull s) \<subseteq> (S hull s)" |
| 44133 | 523 |
unfolding hull_def by blast |
524 |
||
| 53406 | 525 |
lemma hull_minimal: "s \<subseteq> t \<Longrightarrow> S t \<Longrightarrow> (S hull s) \<subseteq> t" |
| 44133 | 526 |
unfolding hull_def by blast |
527 |
||
| 53406 | 528 |
lemma subset_hull: "S t \<Longrightarrow> S hull s \<subseteq> t \<longleftrightarrow> s \<subseteq> t" |
| 44133 | 529 |
unfolding hull_def by blast |
530 |
||
| 53596 | 531 |
lemma hull_UNIV: "S hull UNIV = UNIV" |
532 |
unfolding hull_def by auto |
|
533 |
||
| 53406 | 534 |
lemma hull_unique: "s \<subseteq> t \<Longrightarrow> S t \<Longrightarrow> (\<And>t'. s \<subseteq> t' \<Longrightarrow> S t' \<Longrightarrow> t \<subseteq> t') \<Longrightarrow> (S hull s = t)" |
| 49652 | 535 |
unfolding hull_def by auto |
| 44133 | 536 |
|
537 |
lemma hull_induct: "(\<And>x. x\<in> S \<Longrightarrow> P x) \<Longrightarrow> Q {x. P x} \<Longrightarrow> \<forall>x\<in> Q hull S. P x"
|
|
538 |
using hull_minimal[of S "{x. P x}" Q]
|
|
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
539 |
by (auto simp add: subset_eq) |
| 44133 | 540 |
|
| 49522 | 541 |
lemma hull_inc: "x \<in> S \<Longrightarrow> x \<in> P hull S" |
542 |
by (metis hull_subset subset_eq) |
|
| 44133 | 543 |
|
544 |
lemma hull_union_subset: "(S hull s) \<union> (S hull t) \<subseteq> (S hull (s \<union> t))" |
|
| 49522 | 545 |
unfolding Un_subset_iff by (metis hull_mono Un_upper1 Un_upper2) |
546 |
||
547 |
lemma hull_union: |
|
| 53406 | 548 |
assumes T: "\<And>T. Ball T S \<Longrightarrow> S (\<Inter>T)" |
| 44133 | 549 |
shows "S hull (s \<union> t) = S hull (S hull s \<union> S hull t)" |
| 49522 | 550 |
apply rule |
551 |
apply (rule hull_mono) |
|
552 |
unfolding Un_subset_iff |
|
553 |
apply (metis hull_subset Un_upper1 Un_upper2 subset_trans) |
|
554 |
apply (rule hull_minimal) |
|
555 |
apply (metis hull_union_subset) |
|
556 |
apply (metis hull_in T) |
|
557 |
done |
|
| 44133 | 558 |
|
| 56444 | 559 |
lemma hull_redundant_eq: "a \<in> (S hull s) \<longleftrightarrow> S hull (insert a s) = S hull s" |
| 44133 | 560 |
unfolding hull_def by blast |
561 |
||
| 56444 | 562 |
lemma hull_redundant: "a \<in> (S hull s) \<Longrightarrow> S hull (insert a s) = S hull s" |
| 49522 | 563 |
by (metis hull_redundant_eq) |
564 |
||
| 44133 | 565 |
|
| 44666 | 566 |
subsection {* Archimedean properties and useful consequences *}
|
| 44133 | 567 |
|
| 56444 | 568 |
lemma real_arch_simple: "\<exists>n::nat. x \<le> real n" |
| 44666 | 569 |
unfolding real_of_nat_def by (rule ex_le_of_nat) |
| 44133 | 570 |
|
571 |
lemma real_arch_inv: "0 < e \<longleftrightarrow> (\<exists>n::nat. n \<noteq> 0 \<and> 0 < inverse (real n) \<and> inverse (real n) < e)" |
|
572 |
using reals_Archimedean |
|
573 |
apply (auto simp add: field_simps) |
|
574 |
apply (subgoal_tac "inverse (real n) > 0") |
|
575 |
apply arith |
|
576 |
apply simp |
|
577 |
done |
|
578 |
||
| 53406 | 579 |
lemma real_pow_lbound: "0 \<le> x \<Longrightarrow> 1 + real n * x \<le> (1 + x) ^ n" |
| 49522 | 580 |
proof (induct n) |
581 |
case 0 |
|
582 |
then show ?case by simp |
|
| 44133 | 583 |
next |
584 |
case (Suc n) |
|
| 53406 | 585 |
then have h: "1 + real n * x \<le> (1 + x) ^ n" |
586 |
by simp |
|
587 |
from h have p: "1 \<le> (1 + x) ^ n" |
|
588 |
using Suc.prems by simp |
|
589 |
from h have "1 + real n * x + x \<le> (1 + x) ^ n + x" |
|
590 |
by simp |
|
591 |
also have "\<dots> \<le> (1 + x) ^ Suc n" |
|
592 |
apply (subst diff_le_0_iff_le[symmetric]) |
|
| 44133 | 593 |
apply (simp add: field_simps) |
| 53406 | 594 |
using mult_left_mono[OF p Suc.prems] |
595 |
apply simp |
|
| 49522 | 596 |
done |
| 53406 | 597 |
finally show ?case |
598 |
by (simp add: real_of_nat_Suc field_simps) |
|
| 44133 | 599 |
qed |
600 |
||
| 53406 | 601 |
lemma real_arch_pow: |
602 |
fixes x :: real |
|
603 |
assumes x: "1 < x" |
|
604 |
shows "\<exists>n. y < x^n" |
|
| 49522 | 605 |
proof - |
| 53406 | 606 |
from x have x0: "x - 1 > 0" |
607 |
by arith |
|
| 44666 | 608 |
from reals_Archimedean3[OF x0, rule_format, of y] |
| 53406 | 609 |
obtain n :: nat where n: "y < real n * (x - 1)" by metis |
| 44133 | 610 |
from x0 have x00: "x- 1 \<ge> 0" by arith |
611 |
from real_pow_lbound[OF x00, of n] n |
|
612 |
have "y < x^n" by auto |
|
613 |
then show ?thesis by metis |
|
614 |
qed |
|
615 |
||
| 53406 | 616 |
lemma real_arch_pow2: |
617 |
fixes x :: real |
|
618 |
shows "\<exists>n. x < 2^ n" |
|
| 44133 | 619 |
using real_arch_pow[of 2 x] by simp |
620 |
||
| 49522 | 621 |
lemma real_arch_pow_inv: |
| 53406 | 622 |
fixes x y :: real |
623 |
assumes y: "y > 0" |
|
624 |
and x1: "x < 1" |
|
| 44133 | 625 |
shows "\<exists>n. x^n < y" |
| 53406 | 626 |
proof (cases "x > 0") |
627 |
case True |
|
628 |
with x1 have ix: "1 < 1/x" by (simp add: field_simps) |
|
629 |
from real_arch_pow[OF ix, of "1/y"] |
|
630 |
obtain n where n: "1/y < (1/x)^n" by blast |
|
631 |
then show ?thesis using y `x > 0` |
|
632 |
by (auto simp add: field_simps power_divide) |
|
633 |
next |
|
634 |
case False |
|
635 |
with y x1 show ?thesis |
|
636 |
apply auto |
|
637 |
apply (rule exI[where x=1]) |
|
638 |
apply auto |
|
639 |
done |
|
| 44133 | 640 |
qed |
641 |
||
| 49522 | 642 |
lemma forall_pos_mono: |
| 53406 | 643 |
"(\<And>d e::real. d < e \<Longrightarrow> P d \<Longrightarrow> P e) \<Longrightarrow> |
644 |
(\<And>n::nat. n \<noteq> 0 \<Longrightarrow> P (inverse (real n))) \<Longrightarrow> (\<And>e. 0 < e \<Longrightarrow> P e)" |
|
| 44133 | 645 |
by (metis real_arch_inv) |
646 |
||
| 49522 | 647 |
lemma forall_pos_mono_1: |
| 53406 | 648 |
"(\<And>d e::real. d < e \<Longrightarrow> P d \<Longrightarrow> P e) \<Longrightarrow> |
| 53716 | 649 |
(\<And>n. P (inverse (real (Suc n)))) \<Longrightarrow> 0 < e \<Longrightarrow> P e" |
| 44133 | 650 |
apply (rule forall_pos_mono) |
651 |
apply auto |
|
652 |
apply (atomize) |
|
653 |
apply (erule_tac x="n - 1" in allE) |
|
654 |
apply auto |
|
655 |
done |
|
656 |
||
| 49522 | 657 |
lemma real_archimedian_rdiv_eq_0: |
| 53406 | 658 |
assumes x0: "x \<ge> 0" |
659 |
and c: "c \<ge> 0" |
|
| 56444 | 660 |
and xc: "\<forall>(m::nat) > 0. real m * x \<le> c" |
| 44133 | 661 |
shows "x = 0" |
| 53406 | 662 |
proof (rule ccontr) |
663 |
assume "x \<noteq> 0" |
|
664 |
with x0 have xp: "x > 0" by arith |
|
665 |
from reals_Archimedean3[OF xp, rule_format, of c] |
|
666 |
obtain n :: nat where n: "c < real n * x" |
|
667 |
by blast |
|
668 |
with xc[rule_format, of n] have "n = 0" |
|
669 |
by arith |
|
670 |
with n c show False |
|
671 |
by simp |
|
| 44133 | 672 |
qed |
673 |
||
| 49522 | 674 |
|
| 44133 | 675 |
subsection{* A bit of linear algebra. *}
|
676 |
||
| 49522 | 677 |
definition (in real_vector) subspace :: "'a set \<Rightarrow> bool" |
| 56444 | 678 |
where "subspace S \<longleftrightarrow> 0 \<in> S \<and> (\<forall>x \<in> S. \<forall>y \<in> S. x + y \<in> S) \<and> (\<forall>c. \<forall>x \<in> S. c *\<^sub>R x \<in> S)" |
| 44133 | 679 |
|
680 |
definition (in real_vector) "span S = (subspace hull S)" |
|
| 53716 | 681 |
definition (in real_vector) "dependent S \<longleftrightarrow> (\<exists>a \<in> S. a \<in> span (S - {a}))"
|
| 53406 | 682 |
abbreviation (in real_vector) "independent s \<equiv> \<not> dependent s" |
| 44133 | 683 |
|
684 |
text {* Closure properties of subspaces. *}
|
|
685 |
||
| 53406 | 686 |
lemma subspace_UNIV[simp]: "subspace UNIV" |
687 |
by (simp add: subspace_def) |
|
688 |
||
689 |
lemma (in real_vector) subspace_0: "subspace S \<Longrightarrow> 0 \<in> S" |
|
690 |
by (metis subspace_def) |
|
691 |
||
692 |
lemma (in real_vector) subspace_add: "subspace S \<Longrightarrow> x \<in> S \<Longrightarrow> y \<in> S \<Longrightarrow> x + y \<in> S" |
|
| 44133 | 693 |
by (metis subspace_def) |
694 |
||
695 |
lemma (in real_vector) subspace_mul: "subspace S \<Longrightarrow> x \<in> S \<Longrightarrow> c *\<^sub>R x \<in> S" |
|
696 |
by (metis subspace_def) |
|
697 |
||
698 |
lemma subspace_neg: "subspace S \<Longrightarrow> x \<in> S \<Longrightarrow> - x \<in> S" |
|
699 |
by (metis scaleR_minus1_left subspace_mul) |
|
700 |
||
701 |
lemma subspace_sub: "subspace S \<Longrightarrow> x \<in> S \<Longrightarrow> y \<in> S \<Longrightarrow> x - y \<in> S" |
|
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53939
diff
changeset
|
702 |
using subspace_add [of S x "- y"] by (simp add: subspace_neg) |
| 44133 | 703 |
|
704 |
lemma (in real_vector) subspace_setsum: |
|
| 53406 | 705 |
assumes sA: "subspace A" |
|
56196
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
706 |
and f: "\<forall>x\<in>B. f x \<in> A" |
| 44133 | 707 |
shows "setsum f B \<in> A" |
|
56196
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
708 |
proof (cases "finite B") |
|
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
709 |
case True |
|
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
710 |
then show ?thesis |
|
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
711 |
using f by induct (simp_all add: subspace_0 [OF sA] subspace_add [OF sA]) |
|
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
712 |
qed (simp add: subspace_0 [OF sA]) |
| 44133 | 713 |
|
714 |
lemma subspace_linear_image: |
|
| 53406 | 715 |
assumes lf: "linear f" |
716 |
and sS: "subspace S" |
|
717 |
shows "subspace (f ` S)" |
|
| 44133 | 718 |
using lf sS linear_0[OF lf] |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
719 |
unfolding linear_iff subspace_def |
| 44133 | 720 |
apply (auto simp add: image_iff) |
| 53406 | 721 |
apply (rule_tac x="x + y" in bexI) |
722 |
apply auto |
|
723 |
apply (rule_tac x="c *\<^sub>R x" in bexI) |
|
724 |
apply auto |
|
| 44133 | 725 |
done |
726 |
||
| 44521 | 727 |
lemma subspace_linear_vimage: "linear f \<Longrightarrow> subspace S \<Longrightarrow> subspace (f -` S)" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
728 |
by (auto simp add: subspace_def linear_iff linear_0[of f]) |
| 44521 | 729 |
|
| 53406 | 730 |
lemma subspace_linear_preimage: "linear f \<Longrightarrow> subspace S \<Longrightarrow> subspace {x. f x \<in> S}"
|
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
731 |
by (auto simp add: subspace_def linear_iff linear_0[of f]) |
| 44133 | 732 |
|
733 |
lemma subspace_trivial: "subspace {0}"
|
|
734 |
by (simp add: subspace_def) |
|
735 |
||
| 53406 | 736 |
lemma (in real_vector) subspace_inter: "subspace A \<Longrightarrow> subspace B \<Longrightarrow> subspace (A \<inter> B)" |
| 44133 | 737 |
by (simp add: subspace_def) |
738 |
||
| 53406 | 739 |
lemma subspace_Times: "subspace A \<Longrightarrow> subspace B \<Longrightarrow> subspace (A \<times> B)" |
| 44521 | 740 |
unfolding subspace_def zero_prod_def by simp |
741 |
||
742 |
text {* Properties of span. *}
|
|
743 |
||
| 53406 | 744 |
lemma (in real_vector) span_mono: "A \<subseteq> B \<Longrightarrow> span A \<subseteq> span B" |
| 44133 | 745 |
by (metis span_def hull_mono) |
746 |
||
| 53406 | 747 |
lemma (in real_vector) subspace_span: "subspace (span S)" |
| 44133 | 748 |
unfolding span_def |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
749 |
apply (rule hull_in) |
| 44133 | 750 |
apply (simp only: subspace_def Inter_iff Int_iff subset_eq) |
751 |
apply auto |
|
752 |
done |
|
753 |
||
754 |
lemma (in real_vector) span_clauses: |
|
| 53406 | 755 |
"a \<in> S \<Longrightarrow> a \<in> span S" |
| 44133 | 756 |
"0 \<in> span S" |
| 53406 | 757 |
"x\<in> span S \<Longrightarrow> y \<in> span S \<Longrightarrow> x + y \<in> span S" |
| 44133 | 758 |
"x \<in> span S \<Longrightarrow> c *\<^sub>R x \<in> span S" |
| 53406 | 759 |
by (metis span_def hull_subset subset_eq) (metis subspace_span subspace_def)+ |
| 44133 | 760 |
|
| 44521 | 761 |
lemma span_unique: |
| 49522 | 762 |
"S \<subseteq> T \<Longrightarrow> subspace T \<Longrightarrow> (\<And>T'. S \<subseteq> T' \<Longrightarrow> subspace T' \<Longrightarrow> T \<subseteq> T') \<Longrightarrow> span S = T" |
| 44521 | 763 |
unfolding span_def by (rule hull_unique) |
764 |
||
765 |
lemma span_minimal: "S \<subseteq> T \<Longrightarrow> subspace T \<Longrightarrow> span S \<subseteq> T" |
|
766 |
unfolding span_def by (rule hull_minimal) |
|
767 |
||
768 |
lemma (in real_vector) span_induct: |
|
| 49522 | 769 |
assumes x: "x \<in> span S" |
770 |
and P: "subspace P" |
|
| 53406 | 771 |
and SP: "\<And>x. x \<in> S \<Longrightarrow> x \<in> P" |
| 44521 | 772 |
shows "x \<in> P" |
| 49522 | 773 |
proof - |
| 53406 | 774 |
from SP have SP': "S \<subseteq> P" |
775 |
by (simp add: subset_eq) |
|
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
776 |
from x hull_minimal[where S=subspace, OF SP' P, unfolded span_def[symmetric]] |
| 53406 | 777 |
show "x \<in> P" |
778 |
by (metis subset_eq) |
|
| 44133 | 779 |
qed |
780 |
||
781 |
lemma span_empty[simp]: "span {} = {0}"
|
|
782 |
apply (simp add: span_def) |
|
783 |
apply (rule hull_unique) |
|
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
784 |
apply (auto simp add: subspace_def) |
| 44133 | 785 |
done |
786 |
||
787 |
lemma (in real_vector) independent_empty[intro]: "independent {}"
|
|
788 |
by (simp add: dependent_def) |
|
789 |
||
| 49522 | 790 |
lemma dependent_single[simp]: "dependent {x} \<longleftrightarrow> x = 0"
|
| 44133 | 791 |
unfolding dependent_def by auto |
792 |
||
| 53406 | 793 |
lemma (in real_vector) independent_mono: "independent A \<Longrightarrow> B \<subseteq> A \<Longrightarrow> independent B" |
| 44133 | 794 |
apply (clarsimp simp add: dependent_def span_mono) |
795 |
apply (subgoal_tac "span (B - {a}) \<le> span (A - {a})")
|
|
796 |
apply force |
|
797 |
apply (rule span_mono) |
|
798 |
apply auto |
|
799 |
done |
|
800 |
||
801 |
lemma (in real_vector) span_subspace: "A \<subseteq> B \<Longrightarrow> B \<le> span A \<Longrightarrow> subspace B \<Longrightarrow> span A = B" |
|
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
802 |
by (metis order_antisym span_def hull_minimal) |
| 44133 | 803 |
|
| 49711 | 804 |
lemma (in real_vector) span_induct': |
805 |
assumes SP: "\<forall>x \<in> S. P x" |
|
806 |
and P: "subspace {x. P x}"
|
|
807 |
shows "\<forall>x \<in> span S. P x" |
|
| 44133 | 808 |
using span_induct SP P by blast |
809 |
||
| 56444 | 810 |
inductive_set (in real_vector) span_induct_alt_help for S :: "'a set" |
| 53406 | 811 |
where |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
812 |
span_induct_alt_help_0: "0 \<in> span_induct_alt_help S" |
| 49522 | 813 |
| span_induct_alt_help_S: |
| 53406 | 814 |
"x \<in> S \<Longrightarrow> z \<in> span_induct_alt_help S \<Longrightarrow> |
815 |
(c *\<^sub>R x + z) \<in> span_induct_alt_help S" |
|
| 44133 | 816 |
|
817 |
lemma span_induct_alt': |
|
| 53406 | 818 |
assumes h0: "h 0" |
819 |
and hS: "\<And>c x y. x \<in> S \<Longrightarrow> h y \<Longrightarrow> h (c *\<^sub>R x + y)" |
|
| 49522 | 820 |
shows "\<forall>x \<in> span S. h x" |
821 |
proof - |
|
| 53406 | 822 |
{
|
823 |
fix x :: 'a |
|
824 |
assume x: "x \<in> span_induct_alt_help S" |
|
| 44133 | 825 |
have "h x" |
826 |
apply (rule span_induct_alt_help.induct[OF x]) |
|
827 |
apply (rule h0) |
|
| 53406 | 828 |
apply (rule hS) |
829 |
apply assumption |
|
830 |
apply assumption |
|
831 |
done |
|
832 |
} |
|
| 44133 | 833 |
note th0 = this |
| 53406 | 834 |
{
|
835 |
fix x |
|
836 |
assume x: "x \<in> span S" |
|
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
837 |
have "x \<in> span_induct_alt_help S" |
| 49522 | 838 |
proof (rule span_induct[where x=x and S=S]) |
| 53406 | 839 |
show "x \<in> span S" by (rule x) |
| 49522 | 840 |
next |
| 53406 | 841 |
fix x |
842 |
assume xS: "x \<in> S" |
|
843 |
from span_induct_alt_help_S[OF xS span_induct_alt_help_0, of 1] |
|
844 |
show "x \<in> span_induct_alt_help S" |
|
845 |
by simp |
|
| 49522 | 846 |
next |
847 |
have "0 \<in> span_induct_alt_help S" by (rule span_induct_alt_help_0) |
|
848 |
moreover |
|
| 53406 | 849 |
{
|
850 |
fix x y |
|
| 49522 | 851 |
assume h: "x \<in> span_induct_alt_help S" "y \<in> span_induct_alt_help S" |
852 |
from h have "(x + y) \<in> span_induct_alt_help S" |
|
853 |
apply (induct rule: span_induct_alt_help.induct) |
|
854 |
apply simp |
|
855 |
unfolding add_assoc |
|
856 |
apply (rule span_induct_alt_help_S) |
|
857 |
apply assumption |
|
858 |
apply simp |
|
| 53406 | 859 |
done |
860 |
} |
|
| 49522 | 861 |
moreover |
| 53406 | 862 |
{
|
863 |
fix c x |
|
| 49522 | 864 |
assume xt: "x \<in> span_induct_alt_help S" |
865 |
then have "(c *\<^sub>R x) \<in> span_induct_alt_help S" |
|
866 |
apply (induct rule: span_induct_alt_help.induct) |
|
867 |
apply (simp add: span_induct_alt_help_0) |
|
868 |
apply (simp add: scaleR_right_distrib) |
|
869 |
apply (rule span_induct_alt_help_S) |
|
870 |
apply assumption |
|
871 |
apply simp |
|
872 |
done } |
|
| 53406 | 873 |
ultimately show "subspace (span_induct_alt_help S)" |
| 49522 | 874 |
unfolding subspace_def Ball_def by blast |
| 53406 | 875 |
qed |
876 |
} |
|
| 44133 | 877 |
with th0 show ?thesis by blast |
878 |
qed |
|
879 |
||
880 |
lemma span_induct_alt: |
|
| 53406 | 881 |
assumes h0: "h 0" |
882 |
and hS: "\<And>c x y. x \<in> S \<Longrightarrow> h y \<Longrightarrow> h (c *\<^sub>R x + y)" |
|
883 |
and x: "x \<in> span S" |
|
| 44133 | 884 |
shows "h x" |
| 49522 | 885 |
using span_induct_alt'[of h S] h0 hS x by blast |
| 44133 | 886 |
|
887 |
text {* Individual closure properties. *}
|
|
888 |
||
889 |
lemma span_span: "span (span A) = span A" |
|
890 |
unfolding span_def hull_hull .. |
|
891 |
||
| 53406 | 892 |
lemma (in real_vector) span_superset: "x \<in> S \<Longrightarrow> x \<in> span S" |
893 |
by (metis span_clauses(1)) |
|
894 |
||
895 |
lemma (in real_vector) span_0: "0 \<in> span S" |
|
896 |
by (metis subspace_span subspace_0) |
|
| 44133 | 897 |
|
898 |
lemma span_inc: "S \<subseteq> span S" |
|
899 |
by (metis subset_eq span_superset) |
|
900 |
||
| 53406 | 901 |
lemma (in real_vector) dependent_0: |
902 |
assumes "0 \<in> A" |
|
903 |
shows "dependent A" |
|
904 |
unfolding dependent_def |
|
905 |
apply (rule_tac x=0 in bexI) |
|
906 |
using assms span_0 |
|
907 |
apply auto |
|
908 |
done |
|
909 |
||
910 |
lemma (in real_vector) span_add: "x \<in> span S \<Longrightarrow> y \<in> span S \<Longrightarrow> x + y \<in> span S" |
|
| 44133 | 911 |
by (metis subspace_add subspace_span) |
912 |
||
| 53406 | 913 |
lemma (in real_vector) span_mul: "x \<in> span S \<Longrightarrow> c *\<^sub>R x \<in> span S" |
| 44133 | 914 |
by (metis subspace_span subspace_mul) |
915 |
||
| 53406 | 916 |
lemma span_neg: "x \<in> span S \<Longrightarrow> - x \<in> span S" |
| 44133 | 917 |
by (metis subspace_neg subspace_span) |
918 |
||
| 53406 | 919 |
lemma span_sub: "x \<in> span S \<Longrightarrow> y \<in> span S \<Longrightarrow> x - y \<in> span S" |
| 44133 | 920 |
by (metis subspace_span subspace_sub) |
921 |
||
|
56196
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
922 |
lemma (in real_vector) span_setsum: "\<forall>x\<in>A. f x \<in> span S \<Longrightarrow> setsum f A \<in> span S" |
|
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
923 |
by (rule subspace_setsum [OF subspace_span]) |
| 44133 | 924 |
|
925 |
lemma span_add_eq: "x \<in> span S \<Longrightarrow> x + y \<in> span S \<longleftrightarrow> y \<in> span S" |
|
| 55775 | 926 |
by (metis add_minus_cancel scaleR_minus1_left subspace_def subspace_span) |
| 44133 | 927 |
|
928 |
text {* Mapping under linear image. *}
|
|
929 |
||
| 44521 | 930 |
lemma span_linear_image: |
931 |
assumes lf: "linear f" |
|
| 56444 | 932 |
shows "span (f ` S) = f ` span S" |
| 44521 | 933 |
proof (rule span_unique) |
934 |
show "f ` S \<subseteq> f ` span S" |
|
935 |
by (intro image_mono span_inc) |
|
936 |
show "subspace (f ` span S)" |
|
937 |
using lf subspace_span by (rule subspace_linear_image) |
|
938 |
next |
|
| 53406 | 939 |
fix T |
940 |
assume "f ` S \<subseteq> T" and "subspace T" |
|
| 49522 | 941 |
then show "f ` span S \<subseteq> T" |
| 44521 | 942 |
unfolding image_subset_iff_subset_vimage |
943 |
by (intro span_minimal subspace_linear_vimage lf) |
|
944 |
qed |
|
945 |
||
946 |
lemma span_union: "span (A \<union> B) = (\<lambda>(a, b). a + b) ` (span A \<times> span B)" |
|
947 |
proof (rule span_unique) |
|
948 |
show "A \<union> B \<subseteq> (\<lambda>(a, b). a + b) ` (span A \<times> span B)" |
|
949 |
by safe (force intro: span_clauses)+ |
|
950 |
next |
|
951 |
have "linear (\<lambda>(a, b). a + b)" |
|
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
952 |
by (simp add: linear_iff scaleR_add_right) |
| 44521 | 953 |
moreover have "subspace (span A \<times> span B)" |
954 |
by (intro subspace_Times subspace_span) |
|
955 |
ultimately show "subspace ((\<lambda>(a, b). a + b) ` (span A \<times> span B))" |
|
956 |
by (rule subspace_linear_image) |
|
957 |
next |
|
| 49711 | 958 |
fix T |
959 |
assume "A \<union> B \<subseteq> T" and "subspace T" |
|
| 49522 | 960 |
then show "(\<lambda>(a, b). a + b) ` (span A \<times> span B) \<subseteq> T" |
| 44521 | 961 |
by (auto intro!: subspace_add elim: span_induct) |
| 44133 | 962 |
qed |
963 |
||
964 |
text {* The key breakdown property. *}
|
|
965 |
||
| 44521 | 966 |
lemma span_singleton: "span {x} = range (\<lambda>k. k *\<^sub>R x)"
|
967 |
proof (rule span_unique) |
|
968 |
show "{x} \<subseteq> range (\<lambda>k. k *\<^sub>R x)"
|
|
969 |
by (fast intro: scaleR_one [symmetric]) |
|
970 |
show "subspace (range (\<lambda>k. k *\<^sub>R x))" |
|
971 |
unfolding subspace_def |
|
972 |
by (auto intro: scaleR_add_left [symmetric]) |
|
| 53406 | 973 |
next |
974 |
fix T |
|
975 |
assume "{x} \<subseteq> T" and "subspace T"
|
|
976 |
then show "range (\<lambda>k. k *\<^sub>R x) \<subseteq> T" |
|
| 44521 | 977 |
unfolding subspace_def by auto |
978 |
qed |
|
979 |
||
| 49522 | 980 |
lemma span_insert: "span (insert a S) = {x. \<exists>k. (x - k *\<^sub>R a) \<in> span S}"
|
| 44521 | 981 |
proof - |
982 |
have "span ({a} \<union> S) = {x. \<exists>k. (x - k *\<^sub>R a) \<in> span S}"
|
|
983 |
unfolding span_union span_singleton |
|
984 |
apply safe |
|
985 |
apply (rule_tac x=k in exI, simp) |
|
986 |
apply (erule rev_image_eqI [OF SigmaI [OF rangeI]]) |
|
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53939
diff
changeset
|
987 |
apply auto |
| 44521 | 988 |
done |
| 49522 | 989 |
then show ?thesis by simp |
| 44521 | 990 |
qed |
991 |
||
| 44133 | 992 |
lemma span_breakdown: |
| 53406 | 993 |
assumes bS: "b \<in> S" |
994 |
and aS: "a \<in> span S" |
|
| 44521 | 995 |
shows "\<exists>k. a - k *\<^sub>R b \<in> span (S - {b})"
|
996 |
using assms span_insert [of b "S - {b}"]
|
|
997 |
by (simp add: insert_absorb) |
|
| 44133 | 998 |
|
| 53406 | 999 |
lemma span_breakdown_eq: "x \<in> span (insert a S) \<longleftrightarrow> (\<exists>k. x - k *\<^sub>R a \<in> span S)" |
| 44521 | 1000 |
by (simp add: span_insert) |
| 44133 | 1001 |
|
1002 |
text {* Hence some "reversal" results. *}
|
|
1003 |
||
1004 |
lemma in_span_insert: |
|
| 49711 | 1005 |
assumes a: "a \<in> span (insert b S)" |
1006 |
and na: "a \<notin> span S" |
|
| 44133 | 1007 |
shows "b \<in> span (insert a S)" |
| 49663 | 1008 |
proof - |
| 55910 | 1009 |
from a obtain k where k: "a - k *\<^sub>R b \<in> span S" |
1010 |
unfolding span_insert by fast |
|
| 53406 | 1011 |
show ?thesis |
1012 |
proof (cases "k = 0") |
|
1013 |
case True |
|
| 55910 | 1014 |
with k have "a \<in> span S" by simp |
1015 |
with na show ?thesis by simp |
|
| 53406 | 1016 |
next |
1017 |
case False |
|
| 55910 | 1018 |
from k have "(- inverse k) *\<^sub>R (a - k *\<^sub>R b) \<in> span S" |
| 44133 | 1019 |
by (rule span_mul) |
| 55910 | 1020 |
then have "b - inverse k *\<^sub>R a \<in> span S" |
1021 |
using `k \<noteq> 0` by (simp add: scaleR_diff_right) |
|
1022 |
then show ?thesis |
|
1023 |
unfolding span_insert by fast |
|
| 53406 | 1024 |
qed |
| 44133 | 1025 |
qed |
1026 |
||
1027 |
lemma in_span_delete: |
|
1028 |
assumes a: "a \<in> span S" |
|
| 53716 | 1029 |
and na: "a \<notin> span (S - {b})"
|
| 44133 | 1030 |
shows "b \<in> span (insert a (S - {b}))"
|
1031 |
apply (rule in_span_insert) |
|
1032 |
apply (rule set_rev_mp) |
|
1033 |
apply (rule a) |
|
1034 |
apply (rule span_mono) |
|
1035 |
apply blast |
|
1036 |
apply (rule na) |
|
1037 |
done |
|
1038 |
||
1039 |
text {* Transitivity property. *}
|
|
1040 |
||
| 44521 | 1041 |
lemma span_redundant: "x \<in> span S \<Longrightarrow> span (insert x S) = span S" |
1042 |
unfolding span_def by (rule hull_redundant) |
|
1043 |
||
| 44133 | 1044 |
lemma span_trans: |
| 53406 | 1045 |
assumes x: "x \<in> span S" |
1046 |
and y: "y \<in> span (insert x S)" |
|
| 44133 | 1047 |
shows "y \<in> span S" |
| 44521 | 1048 |
using assms by (simp only: span_redundant) |
| 44133 | 1049 |
|
1050 |
lemma span_insert_0[simp]: "span (insert 0 S) = span S" |
|
| 44521 | 1051 |
by (simp only: span_redundant span_0) |
| 44133 | 1052 |
|
1053 |
text {* An explicit expansion is sometimes needed. *}
|
|
1054 |
||
1055 |
lemma span_explicit: |
|
1056 |
"span P = {y. \<exists>S u. finite S \<and> S \<subseteq> P \<and> setsum (\<lambda>v. u v *\<^sub>R v) S = y}"
|
|
1057 |
(is "_ = ?E" is "_ = {y. ?h y}" is "_ = {y. \<exists>S u. ?Q S u y}")
|
|
| 49663 | 1058 |
proof - |
| 53406 | 1059 |
{
|
1060 |
fix x |
|
| 55910 | 1061 |
assume "?h x" |
1062 |
then obtain S u where "finite S" and "S \<subseteq> P" and "setsum (\<lambda>v. u v *\<^sub>R v) S = x" |
|
| 44133 | 1063 |
by blast |
| 55910 | 1064 |
then have "x \<in> span P" |
1065 |
by (auto intro: span_setsum span_mul span_superset) |
|
| 53406 | 1066 |
} |
| 44133 | 1067 |
moreover |
| 55910 | 1068 |
have "\<forall>x \<in> span P. ?h x" |
| 49522 | 1069 |
proof (rule span_induct_alt') |
| 55910 | 1070 |
show "?h 0" |
1071 |
by (rule exI[where x="{}"], simp)
|
|
| 44133 | 1072 |
next |
1073 |
fix c x y |
|
| 53406 | 1074 |
assume x: "x \<in> P" |
| 55910 | 1075 |
assume hy: "?h y" |
| 44133 | 1076 |
from hy obtain S u where fS: "finite S" and SP: "S\<subseteq>P" |
1077 |
and u: "setsum (\<lambda>v. u v *\<^sub>R v) S = y" by blast |
|
1078 |
let ?S = "insert x S" |
|
| 49522 | 1079 |
let ?u = "\<lambda>y. if y = x then (if x \<in> S then u y + c else c) else u y" |
| 53406 | 1080 |
from fS SP x have th0: "finite (insert x S)" "insert x S \<subseteq> P" |
1081 |
by blast+ |
|
1082 |
have "?Q ?S ?u (c*\<^sub>R x + y)" |
|
1083 |
proof cases |
|
1084 |
assume xS: "x \<in> S" |
|
| 55910 | 1085 |
have "setsum (\<lambda>v. ?u v *\<^sub>R v) ?S = (\<Sum>v\<in>S - {x}. u v *\<^sub>R v) + (u x + c) *\<^sub>R x"
|
1086 |
using xS by (simp add: setsum.remove [OF fS xS] insert_absorb) |
|
| 44133 | 1087 |
also have "\<dots> = (\<Sum>v\<in>S. u v *\<^sub>R v) + c *\<^sub>R x" |
| 55910 | 1088 |
by (simp add: setsum.remove [OF fS xS] algebra_simps) |
| 44133 | 1089 |
also have "\<dots> = c*\<^sub>R x + y" |
1090 |
by (simp add: add_commute u) |
|
1091 |
finally have "setsum (\<lambda>v. ?u v *\<^sub>R v) ?S = c*\<^sub>R x + y" . |
|
| 53406 | 1092 |
then show ?thesis using th0 by blast |
1093 |
next |
|
1094 |
assume xS: "x \<notin> S" |
|
| 49522 | 1095 |
have th00: "(\<Sum>v\<in>S. (if v = x then c else u v) *\<^sub>R v) = y" |
1096 |
unfolding u[symmetric] |
|
1097 |
apply (rule setsum_cong2) |
|
| 53406 | 1098 |
using xS |
1099 |
apply auto |
|
| 49522 | 1100 |
done |
| 53406 | 1101 |
show ?thesis using fS xS th0 |
| 55910 | 1102 |
by (simp add: th00 add_commute cong del: if_weak_cong) |
| 53406 | 1103 |
qed |
| 55910 | 1104 |
then show "?h (c*\<^sub>R x + y)" |
1105 |
by fast |
|
| 44133 | 1106 |
qed |
1107 |
ultimately show ?thesis by blast |
|
1108 |
qed |
|
1109 |
||
1110 |
lemma dependent_explicit: |
|
| 49522 | 1111 |
"dependent P \<longleftrightarrow> (\<exists>S u. finite S \<and> S \<subseteq> P \<and> (\<exists>v\<in>S. u v \<noteq> 0 \<and> setsum (\<lambda>v. u v *\<^sub>R v) S = 0))" |
1112 |
(is "?lhs = ?rhs") |
|
1113 |
proof - |
|
| 53406 | 1114 |
{
|
1115 |
assume dP: "dependent P" |
|
| 44133 | 1116 |
then obtain a S u where aP: "a \<in> P" and fS: "finite S" |
1117 |
and SP: "S \<subseteq> P - {a}" and ua: "setsum (\<lambda>v. u v *\<^sub>R v) S = a"
|
|
1118 |
unfolding dependent_def span_explicit by blast |
|
1119 |
let ?S = "insert a S" |
|
1120 |
let ?u = "\<lambda>y. if y = a then - 1 else u y" |
|
1121 |
let ?v = a |
|
| 53406 | 1122 |
from aP SP have aS: "a \<notin> S" |
1123 |
by blast |
|
1124 |
from fS SP aP have th0: "finite ?S" "?S \<subseteq> P" "?v \<in> ?S" "?u ?v \<noteq> 0" |
|
1125 |
by auto |
|
| 44133 | 1126 |
have s0: "setsum (\<lambda>v. ?u v *\<^sub>R v) ?S = 0" |
1127 |
using fS aS |
|
| 55910 | 1128 |
apply simp |
| 44133 | 1129 |
apply (subst (2) ua[symmetric]) |
1130 |
apply (rule setsum_cong2) |
|
| 49522 | 1131 |
apply auto |
1132 |
done |
|
| 55910 | 1133 |
with th0 have ?rhs by fast |
| 49522 | 1134 |
} |
| 44133 | 1135 |
moreover |
| 53406 | 1136 |
{
|
1137 |
fix S u v |
|
| 49522 | 1138 |
assume fS: "finite S" |
| 53406 | 1139 |
and SP: "S \<subseteq> P" |
1140 |
and vS: "v \<in> S" |
|
1141 |
and uv: "u v \<noteq> 0" |
|
| 49522 | 1142 |
and u: "setsum (\<lambda>v. u v *\<^sub>R v) S = 0" |
| 44133 | 1143 |
let ?a = v |
1144 |
let ?S = "S - {v}"
|
|
1145 |
let ?u = "\<lambda>i. (- u i) / u v" |
|
| 53406 | 1146 |
have th0: "?a \<in> P" "finite ?S" "?S \<subseteq> P" |
1147 |
using fS SP vS by auto |
|
1148 |
have "setsum (\<lambda>v. ?u v *\<^sub>R v) ?S = |
|
1149 |
setsum (\<lambda>v. (- (inverse (u ?a))) *\<^sub>R (u v *\<^sub>R v)) S - ?u v *\<^sub>R v" |
|
| 49522 | 1150 |
using fS vS uv by (simp add: setsum_diff1 divide_inverse field_simps) |
| 53406 | 1151 |
also have "\<dots> = ?a" |
|
56409
36489d77c484
removing simprule status for divide_minus_left and divide_minus_right
paulson <lp15@cam.ac.uk>
parents:
56196
diff
changeset
|
1152 |
unfolding scaleR_right.setsum [symmetric] u using uv by (simp add: divide_minus_left) |
| 53406 | 1153 |
finally have "setsum (\<lambda>v. ?u v *\<^sub>R v) ?S = ?a" . |
| 44133 | 1154 |
with th0 have ?lhs |
1155 |
unfolding dependent_def span_explicit |
|
1156 |
apply - |
|
1157 |
apply (rule bexI[where x= "?a"]) |
|
1158 |
apply (simp_all del: scaleR_minus_left) |
|
1159 |
apply (rule exI[where x= "?S"]) |
|
| 49522 | 1160 |
apply (auto simp del: scaleR_minus_left) |
1161 |
done |
|
1162 |
} |
|
| 44133 | 1163 |
ultimately show ?thesis by blast |
1164 |
qed |
|
1165 |
||
1166 |
||
1167 |
lemma span_finite: |
|
1168 |
assumes fS: "finite S" |
|
1169 |
shows "span S = {y. \<exists>u. setsum (\<lambda>v. u v *\<^sub>R v) S = y}"
|
|
1170 |
(is "_ = ?rhs") |
|
| 49522 | 1171 |
proof - |
| 53406 | 1172 |
{
|
1173 |
fix y |
|
| 49711 | 1174 |
assume y: "y \<in> span S" |
| 53406 | 1175 |
from y obtain S' u where fS': "finite S'" |
1176 |
and SS': "S' \<subseteq> S" |
|
1177 |
and u: "setsum (\<lambda>v. u v *\<^sub>R v) S' = y" |
|
1178 |
unfolding span_explicit by blast |
|
| 44133 | 1179 |
let ?u = "\<lambda>x. if x \<in> S' then u x else 0" |
1180 |
have "setsum (\<lambda>v. ?u v *\<^sub>R v) S = setsum (\<lambda>v. u v *\<^sub>R v) S'" |
|
1181 |
using SS' fS by (auto intro!: setsum_mono_zero_cong_right) |
|
| 49522 | 1182 |
then have "setsum (\<lambda>v. ?u v *\<^sub>R v) S = y" by (metis u) |
| 53406 | 1183 |
then have "y \<in> ?rhs" by auto |
1184 |
} |
|
| 44133 | 1185 |
moreover |
| 53406 | 1186 |
{
|
1187 |
fix y u |
|
| 49522 | 1188 |
assume u: "setsum (\<lambda>v. u v *\<^sub>R v) S = y" |
| 53406 | 1189 |
then have "y \<in> span S" using fS unfolding span_explicit by auto |
1190 |
} |
|
| 44133 | 1191 |
ultimately show ?thesis by blast |
1192 |
qed |
|
1193 |
||
1194 |
text {* This is useful for building a basis step-by-step. *}
|
|
1195 |
||
1196 |
lemma independent_insert: |
|
| 53406 | 1197 |
"independent (insert a S) \<longleftrightarrow> |
1198 |
(if a \<in> S then independent S else independent S \<and> a \<notin> span S)" |
|
1199 |
(is "?lhs \<longleftrightarrow> ?rhs") |
|
1200 |
proof (cases "a \<in> S") |
|
1201 |
case True |
|
1202 |
then show ?thesis |
|
1203 |
using insert_absorb[OF True] by simp |
|
1204 |
next |
|
1205 |
case False |
|
1206 |
show ?thesis |
|
1207 |
proof |
|
1208 |
assume i: ?lhs |
|
1209 |
then show ?rhs |
|
1210 |
using False |
|
1211 |
apply simp |
|
1212 |
apply (rule conjI) |
|
1213 |
apply (rule independent_mono) |
|
1214 |
apply assumption |
|
1215 |
apply blast |
|
1216 |
apply (simp add: dependent_def) |
|
1217 |
done |
|
1218 |
next |
|
1219 |
assume i: ?rhs |
|
1220 |
show ?lhs |
|
1221 |
using i False |
|
1222 |
apply (auto simp add: dependent_def) |
|
| 55775 | 1223 |
by (metis in_span_insert insert_Diff insert_Diff_if insert_iff) |
| 53406 | 1224 |
qed |
| 44133 | 1225 |
qed |
1226 |
||
1227 |
text {* The degenerate case of the Exchange Lemma. *}
|
|
1228 |
||
1229 |
lemma spanning_subset_independent: |
|
| 49711 | 1230 |
assumes BA: "B \<subseteq> A" |
1231 |
and iA: "independent A" |
|
| 49522 | 1232 |
and AsB: "A \<subseteq> span B" |
| 44133 | 1233 |
shows "A = B" |
1234 |
proof |
|
| 49663 | 1235 |
show "B \<subseteq> A" by (rule BA) |
1236 |
||
| 44133 | 1237 |
from span_mono[OF BA] span_mono[OF AsB] |
1238 |
have sAB: "span A = span B" unfolding span_span by blast |
|
1239 |
||
| 53406 | 1240 |
{
|
1241 |
fix x |
|
1242 |
assume x: "x \<in> A" |
|
| 44133 | 1243 |
from iA have th0: "x \<notin> span (A - {x})"
|
1244 |
unfolding dependent_def using x by blast |
|
| 53406 | 1245 |
from x have xsA: "x \<in> span A" |
1246 |
by (blast intro: span_superset) |
|
| 44133 | 1247 |
have "A - {x} \<subseteq> A" by blast
|
| 53406 | 1248 |
then have th1: "span (A - {x}) \<subseteq> span A"
|
1249 |
by (metis span_mono) |
|
1250 |
{
|
|
1251 |
assume xB: "x \<notin> B" |
|
1252 |
from xB BA have "B \<subseteq> A - {x}"
|
|
1253 |
by blast |
|
1254 |
then have "span B \<subseteq> span (A - {x})"
|
|
1255 |
by (metis span_mono) |
|
1256 |
with th1 th0 sAB have "x \<notin> span A" |
|
1257 |
by blast |
|
1258 |
with x have False |
|
1259 |
by (metis span_superset) |
|
1260 |
} |
|
1261 |
then have "x \<in> B" by blast |
|
1262 |
} |
|
| 44133 | 1263 |
then show "A \<subseteq> B" by blast |
1264 |
qed |
|
1265 |
||
1266 |
text {* The general case of the Exchange Lemma, the key to what follows. *}
|
|
1267 |
||
1268 |
lemma exchange_lemma: |
|
| 49711 | 1269 |
assumes f:"finite t" |
1270 |
and i: "independent s" |
|
1271 |
and sp: "s \<subseteq> span t" |
|
| 53406 | 1272 |
shows "\<exists>t'. card t' = card t \<and> finite t' \<and> s \<subseteq> t' \<and> t' \<subseteq> s \<union> t \<and> s \<subseteq> span t'" |
| 49663 | 1273 |
using f i sp |
| 49522 | 1274 |
proof (induct "card (t - s)" arbitrary: s t rule: less_induct) |
| 44133 | 1275 |
case less |
1276 |
note ft = `finite t` and s = `independent s` and sp = `s \<subseteq> span t` |
|
| 53406 | 1277 |
let ?P = "\<lambda>t'. card t' = card t \<and> finite t' \<and> s \<subseteq> t' \<and> t' \<subseteq> s \<union> t \<and> s \<subseteq> span t'" |
| 44133 | 1278 |
let ?ths = "\<exists>t'. ?P t'" |
| 53406 | 1279 |
{
|
| 55775 | 1280 |
assume "s \<subseteq> t" |
1281 |
then have ?ths |
|
1282 |
by (metis ft Un_commute sp sup_ge1) |
|
| 53406 | 1283 |
} |
| 44133 | 1284 |
moreover |
| 53406 | 1285 |
{
|
1286 |
assume st: "t \<subseteq> s" |
|
1287 |
from spanning_subset_independent[OF st s sp] st ft span_mono[OF st] |
|
1288 |
have ?ths |
|
| 55775 | 1289 |
by (metis Un_absorb sp) |
| 53406 | 1290 |
} |
| 44133 | 1291 |
moreover |
| 53406 | 1292 |
{
|
1293 |
assume st: "\<not> s \<subseteq> t" "\<not> t \<subseteq> s" |
|
1294 |
from st(2) obtain b where b: "b \<in> t" "b \<notin> s" |
|
1295 |
by blast |
|
1296 |
from b have "t - {b} - s \<subset> t - s"
|
|
1297 |
by blast |
|
1298 |
then have cardlt: "card (t - {b} - s) < card (t - s)"
|
|
1299 |
using ft by (auto intro: psubset_card_mono) |
|
1300 |
from b ft have ct0: "card t \<noteq> 0" |
|
1301 |
by auto |
|
1302 |
have ?ths |
|
1303 |
proof cases |
|
| 53716 | 1304 |
assume stb: "s \<subseteq> span (t - {b})"
|
1305 |
from ft have ftb: "finite (t - {b})"
|
|
| 53406 | 1306 |
by auto |
| 44133 | 1307 |
from less(1)[OF cardlt ftb s stb] |
| 53716 | 1308 |
obtain u where u: "card u = card (t - {b})" "s \<subseteq> u" "u \<subseteq> s \<union> (t - {b})" "s \<subseteq> span u"
|
| 49522 | 1309 |
and fu: "finite u" by blast |
| 44133 | 1310 |
let ?w = "insert b u" |
| 53406 | 1311 |
have th0: "s \<subseteq> insert b u" |
1312 |
using u by blast |
|
1313 |
from u(3) b have "u \<subseteq> s \<union> t" |
|
1314 |
by blast |
|
1315 |
then have th1: "insert b u \<subseteq> s \<union> t" |
|
1316 |
using u b by blast |
|
1317 |
have bu: "b \<notin> u" |
|
1318 |
using b u by blast |
|
1319 |
from u(1) ft b have "card u = (card t - 1)" |
|
1320 |
by auto |
|
| 49522 | 1321 |
then have th2: "card (insert b u) = card t" |
| 44133 | 1322 |
using card_insert_disjoint[OF fu bu] ct0 by auto |
1323 |
from u(4) have "s \<subseteq> span u" . |
|
| 53406 | 1324 |
also have "\<dots> \<subseteq> span (insert b u)" |
1325 |
by (rule span_mono) blast |
|
| 44133 | 1326 |
finally have th3: "s \<subseteq> span (insert b u)" . |
| 53406 | 1327 |
from th0 th1 th2 th3 fu have th: "?P ?w" |
1328 |
by blast |
|
1329 |
from th show ?thesis by blast |
|
1330 |
next |
|
| 53716 | 1331 |
assume stb: "\<not> s \<subseteq> span (t - {b})"
|
| 53406 | 1332 |
from stb obtain a where a: "a \<in> s" "a \<notin> span (t - {b})"
|
1333 |
by blast |
|
1334 |
have ab: "a \<noteq> b" |
|
1335 |
using a b by blast |
|
1336 |
have at: "a \<notin> t" |
|
1337 |
using a ab span_superset[of a "t- {b}"] by auto
|
|
| 44133 | 1338 |
have mlt: "card ((insert a (t - {b})) - s) < card (t - s)"
|
1339 |
using cardlt ft a b by auto |
|
| 53406 | 1340 |
have ft': "finite (insert a (t - {b}))"
|
1341 |
using ft by auto |
|
1342 |
{
|
|
1343 |
fix x |
|
1344 |
assume xs: "x \<in> s" |
|
1345 |
have t: "t \<subseteq> insert b (insert a (t - {b}))"
|
|
1346 |
using b by auto |
|
1347 |
from b(1) have "b \<in> span t" |
|
1348 |
by (simp add: span_superset) |
|
1349 |
have bs: "b \<in> span (insert a (t - {b}))"
|
|
1350 |
apply (rule in_span_delete) |
|
1351 |
using a sp unfolding subset_eq |
|
1352 |
apply auto |
|
1353 |
done |
|
1354 |
from xs sp have "x \<in> span t" |
|
1355 |
by blast |
|
1356 |
with span_mono[OF t] have x: "x \<in> span (insert b (insert a (t - {b})))" ..
|
|
1357 |
from span_trans[OF bs x] have "x \<in> span (insert a (t - {b}))" .
|
|
1358 |
} |
|
1359 |
then have sp': "s \<subseteq> span (insert a (t - {b}))"
|
|
1360 |
by blast |
|
1361 |
from less(1)[OF mlt ft' s sp'] obtain u where u: |
|
| 53716 | 1362 |
"card u = card (insert a (t - {b}))"
|
1363 |
"finite u" "s \<subseteq> u" "u \<subseteq> s \<union> insert a (t - {b})"
|
|
| 53406 | 1364 |
"s \<subseteq> span u" by blast |
1365 |
from u a b ft at ct0 have "?P u" |
|
1366 |
by auto |
|
1367 |
then show ?thesis by blast |
|
1368 |
qed |
|
| 44133 | 1369 |
} |
| 49522 | 1370 |
ultimately show ?ths by blast |
| 44133 | 1371 |
qed |
1372 |
||
1373 |
text {* This implies corresponding size bounds. *}
|
|
1374 |
||
1375 |
lemma independent_span_bound: |
|
| 53406 | 1376 |
assumes f: "finite t" |
1377 |
and i: "independent s" |
|
1378 |
and sp: "s \<subseteq> span t" |
|
| 44133 | 1379 |
shows "finite s \<and> card s \<le> card t" |
1380 |
by (metis exchange_lemma[OF f i sp] finite_subset card_mono) |
|
1381 |
||
1382 |
lemma finite_Atleast_Atmost_nat[simp]: "finite {f x |x. x\<in> (UNIV::'a::finite set)}"
|
|
| 49522 | 1383 |
proof - |
| 53406 | 1384 |
have eq: "{f x |x. x\<in> UNIV} = f ` UNIV"
|
1385 |
by auto |
|
| 44133 | 1386 |
show ?thesis unfolding eq |
1387 |
apply (rule finite_imageI) |
|
1388 |
apply (rule finite) |
|
1389 |
done |
|
1390 |
qed |
|
1391 |
||
| 53406 | 1392 |
|
1393 |
subsection {* Euclidean Spaces as Typeclass *}
|
|
| 44133 | 1394 |
|
|
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
|
1395 |
lemma independent_Basis: "independent 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
|
1396 |
unfolding dependent_def |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1397 |
apply (subst span_finite) |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1398 |
apply simp |
| 44133 | 1399 |
apply clarify |
|
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
|
1400 |
apply (drule_tac f="inner a" in arg_cong) |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1401 |
apply (simp add: inner_Basis inner_setsum_right eq_commute) |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1402 |
done |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1403 |
|
| 53939 | 1404 |
lemma span_Basis [simp]: "span Basis = UNIV" |
1405 |
unfolding span_finite [OF finite_Basis] |
|
1406 |
by (fast intro: euclidean_representation) |
|
| 44133 | 1407 |
|
|
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
|
1408 |
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
|
1409 |
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
|
1410 |
|
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1411 |
lemma Basis_le_norm: "b \<in> Basis \<Longrightarrow> \<bar>x \<bullet> b\<bar> \<le> norm x" |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1412 |
by (rule order_trans [OF Cauchy_Schwarz_ineq2]) simp |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1413 |
|
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1414 |
lemma norm_bound_Basis_le: "b \<in> Basis \<Longrightarrow> norm x \<le> e \<Longrightarrow> \<bar>x \<bullet> b\<bar> \<le> e" |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1415 |
by (metis Basis_le_norm order_trans) |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1416 |
|
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1417 |
lemma norm_bound_Basis_lt: "b \<in> Basis \<Longrightarrow> norm x < e \<Longrightarrow> \<bar>x \<bullet> b\<bar> < e" |
| 53595 | 1418 |
by (metis Basis_le_norm le_less_trans) |
|
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
|
1419 |
|
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1420 |
lemma norm_le_l1: "norm x \<le> (\<Sum>b\<in>Basis. \<bar>x \<bullet> b\<bar>)" |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1421 |
apply (subst euclidean_representation[of x, symmetric]) |
|
44176
eda112e9cdee
remove redundant lemma setsum_norm in favor of norm_setsum;
huffman
parents:
44170
diff
changeset
|
1422 |
apply (rule order_trans[OF norm_setsum]) |
| 49522 | 1423 |
apply (auto intro!: setsum_mono) |
1424 |
done |
|
| 44133 | 1425 |
|
1426 |
lemma setsum_norm_allsubsets_bound: |
|
| 56444 | 1427 |
fixes f :: "'a \<Rightarrow> 'n::euclidean_space" |
| 53406 | 1428 |
assumes fP: "finite P" |
1429 |
and fPs: "\<And>Q. Q \<subseteq> P \<Longrightarrow> norm (setsum f Q) \<le> e" |
|
|
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
|
1430 |
shows "(\<Sum>x\<in>P. norm (f x)) \<le> 2 * real DIM('n) * e"
|
| 49522 | 1431 |
proof - |
|
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
|
1432 |
have "(\<Sum>x\<in>P. norm (f x)) \<le> (\<Sum>x\<in>P. \<Sum>b\<in>Basis. \<bar>f x \<bullet> b\<bar>)" |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1433 |
by (rule setsum_mono) (rule norm_le_l1) |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1434 |
also have "(\<Sum>x\<in>P. \<Sum>b\<in>Basis. \<bar>f x \<bullet> b\<bar>) = (\<Sum>b\<in>Basis. \<Sum>x\<in>P. \<bar>f x \<bullet> b\<bar>)" |
| 44133 | 1435 |
by (rule setsum_commute) |
|
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
|
1436 |
also have "\<dots> \<le> of_nat (card (Basis :: 'n set)) * (2 * e)" |
| 49522 | 1437 |
proof (rule setsum_bounded) |
| 53406 | 1438 |
fix i :: 'n |
1439 |
assume i: "i \<in> Basis" |
|
1440 |
have "norm (\<Sum>x\<in>P. \<bar>f x \<bullet> i\<bar>) \<le> |
|
|
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
|
1441 |
norm ((\<Sum>x\<in>P \<inter> - {x. f x \<bullet> i < 0}. f x) \<bullet> i) + norm ((\<Sum>x\<in>P \<inter> {x. f x \<bullet> i < 0}. f x) \<bullet> i)"
|
| 56444 | 1442 |
by (simp add: abs_real_def setsum_cases[OF fP] setsum_negf norm_triangle_ineq4 inner_setsum_left |
1443 |
del: real_norm_def) |
|
| 53406 | 1444 |
also have "\<dots> \<le> e + e" |
1445 |
unfolding real_norm_def |
|
|
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
|
1446 |
by (intro add_mono norm_bound_Basis_le i fPs) auto |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1447 |
finally show "(\<Sum>x\<in>P. \<bar>f x \<bullet> i\<bar>) \<le> 2*e" by simp |
| 44133 | 1448 |
qed |
|
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
|
1449 |
also have "\<dots> = 2 * real DIM('n) * e"
|
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1450 |
by (simp add: real_of_nat_def) |
| 44133 | 1451 |
finally show ?thesis . |
1452 |
qed |
|
1453 |
||
| 53406 | 1454 |
|
| 44133 | 1455 |
subsection {* Linearity and Bilinearity continued *}
|
1456 |
||
1457 |
lemma linear_bounded: |
|
| 56444 | 1458 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
| 44133 | 1459 |
assumes lf: "linear f" |
1460 |
shows "\<exists>B. \<forall>x. norm (f x) \<le> B * norm x" |
|
| 53939 | 1461 |
proof |
|
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
|
1462 |
let ?B = "\<Sum>b\<in>Basis. norm (f b)" |
| 53939 | 1463 |
show "\<forall>x. norm (f x) \<le> ?B * norm x" |
1464 |
proof |
|
| 53406 | 1465 |
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
|
1466 |
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
|
1467 |
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
|
1468 |
unfolding euclidean_representation .. |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1469 |
also have "\<dots> = norm (setsum ?g Basis)" |
| 53939 | 1470 |
by (simp add: linear_setsum [OF lf] linear_cmul [OF lf]) |
|
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
|
1471 |
finally have th0: "norm (f x) = norm (setsum ?g Basis)" . |
| 53939 | 1472 |
have th: "\<forall>b\<in>Basis. norm (?g b) \<le> norm (f b) * norm x" |
1473 |
proof |
|
| 53406 | 1474 |
fix i :: 'a |
1475 |
assume i: "i \<in> 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
|
1476 |
from Basis_le_norm[OF i, of x] |
| 53939 | 1477 |
show "norm (?g i) \<le> norm (f i) * norm x" |
| 49663 | 1478 |
unfolding norm_scaleR |
|
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
|
1479 |
apply (subst mult_commute) |
| 49663 | 1480 |
apply (rule mult_mono) |
1481 |
apply (auto simp add: field_simps) |
|
| 53406 | 1482 |
done |
| 53939 | 1483 |
qed |
|
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
|
1484 |
from setsum_norm_le[of _ ?g, OF th] |
| 53939 | 1485 |
show "norm (f x) \<le> ?B * norm x" |
| 53406 | 1486 |
unfolding th0 setsum_left_distrib by metis |
| 53939 | 1487 |
qed |
| 44133 | 1488 |
qed |
1489 |
||
1490 |
lemma linear_conv_bounded_linear: |
|
1491 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
|
1492 |
shows "linear f \<longleftrightarrow> bounded_linear f" |
|
1493 |
proof |
|
1494 |
assume "linear f" |
|
| 53939 | 1495 |
then interpret f: linear f . |
| 44133 | 1496 |
show "bounded_linear f" |
1497 |
proof |
|
1498 |
have "\<exists>B. \<forall>x. norm (f x) \<le> B * norm x" |
|
1499 |
using `linear f` by (rule linear_bounded) |
|
| 49522 | 1500 |
then show "\<exists>K. \<forall>x. norm (f x) \<le> norm x * K" |
| 44133 | 1501 |
by (simp add: mult_commute) |
1502 |
qed |
|
1503 |
next |
|
1504 |
assume "bounded_linear f" |
|
1505 |
then interpret f: bounded_linear f . |
|
| 53939 | 1506 |
show "linear f" .. |
1507 |
qed |
|
1508 |
||
1509 |
lemma linear_bounded_pos: |
|
| 56444 | 1510 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
| 53939 | 1511 |
assumes lf: "linear f" |
1512 |
shows "\<exists>B > 0. \<forall>x. norm (f x) \<le> B * norm x" |
|
1513 |
proof - |
|
1514 |
have "\<exists>B > 0. \<forall>x. norm (f x) \<le> norm x * B" |
|
1515 |
using lf unfolding linear_conv_bounded_linear |
|
1516 |
by (rule bounded_linear.pos_bounded) |
|
1517 |
then show ?thesis |
|
1518 |
by (simp only: mult_commute) |
|
| 44133 | 1519 |
qed |
1520 |
||
| 49522 | 1521 |
lemma bounded_linearI': |
| 56444 | 1522 |
fixes f ::"'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
| 53406 | 1523 |
assumes "\<And>x y. f (x + y) = f x + f y" |
1524 |
and "\<And>c x. f (c *\<^sub>R x) = c *\<^sub>R f x" |
|
| 49522 | 1525 |
shows "bounded_linear f" |
| 53406 | 1526 |
unfolding linear_conv_bounded_linear[symmetric] |
| 49522 | 1527 |
by (rule linearI[OF assms]) |
| 44133 | 1528 |
|
1529 |
lemma bilinear_bounded: |
|
| 56444 | 1530 |
fixes h :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space \<Rightarrow> 'k::real_normed_vector" |
| 44133 | 1531 |
assumes bh: "bilinear h" |
1532 |
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
|
1533 |
proof (clarify intro!: exI[of _ "\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. norm (h i j)"]) |
| 53406 | 1534 |
fix x :: 'm |
1535 |
fix y :: 'n |
|
1536 |
have "norm (h x y) = norm (h (setsum (\<lambda>i. (x \<bullet> i) *\<^sub>R i) Basis) (setsum (\<lambda>i. (y \<bullet> i) *\<^sub>R i) Basis))" |
|
1537 |
apply (subst euclidean_representation[where 'a='m]) |
|
1538 |
apply (subst euclidean_representation[where 'a='n]) |
|
|
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
|
1539 |
apply rule |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1540 |
done |
| 53406 | 1541 |
also have "\<dots> = norm (setsum (\<lambda> (i,j). h ((x \<bullet> i) *\<^sub>R i) ((y \<bullet> j) *\<^sub>R j)) (Basis \<times> 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
|
1542 |
unfolding bilinear_setsum[OF bh finite_Basis finite_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
|
1543 |
finally have th: "norm (h x y) = \<dots>" . |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50105
diff
changeset
|
1544 |
show "norm (h x y) \<le> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. norm (h i j)) * norm x * norm y" |
| 53406 | 1545 |
apply (auto simp add: setsum_left_distrib th setsum_cartesian_product) |
1546 |
apply (rule setsum_norm_le) |
|
1547 |
apply simp |
|
1548 |
apply (auto simp add: bilinear_rmul[OF bh] bilinear_lmul[OF bh] |
|
1549 |
field_simps simp del: scaleR_scaleR) |
|
1550 |
apply (rule mult_mono) |
|
1551 |
apply (auto simp add: zero_le_mult_iff Basis_le_norm) |
|
1552 |
apply (rule mult_mono) |
|
1553 |
apply (auto simp add: zero_le_mult_iff Basis_le_norm) |
|
1554 |
done |
|
| 44133 | 1555 |
qed |
1556 |
||
1557 |
lemma bilinear_conv_bounded_bilinear: |
|
1558 |
fixes h :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::real_normed_vector" |
|
1559 |
shows "bilinear h \<longleftrightarrow> bounded_bilinear h" |
|
1560 |
proof |
|
1561 |
assume "bilinear h" |
|
1562 |
show "bounded_bilinear h" |
|
1563 |
proof |
|
| 53406 | 1564 |
fix x y z |
1565 |
show "h (x + y) z = h x z + h y z" |
|
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
1566 |
using `bilinear h` unfolding bilinear_def linear_iff by simp |
| 44133 | 1567 |
next |
| 53406 | 1568 |
fix x y z |
1569 |
show "h x (y + z) = h x y + h x z" |
|
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
1570 |
using `bilinear h` unfolding bilinear_def linear_iff by simp |
| 44133 | 1571 |
next |
| 53406 | 1572 |
fix r x y |
1573 |
show "h (scaleR r x) y = scaleR r (h x y)" |
|
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
1574 |
using `bilinear h` unfolding bilinear_def linear_iff |
| 44133 | 1575 |
by simp |
1576 |
next |
|
| 53406 | 1577 |
fix r x y |
1578 |
show "h x (scaleR r y) = scaleR r (h x y)" |
|
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
1579 |
using `bilinear h` unfolding bilinear_def linear_iff |
| 44133 | 1580 |
by simp |
1581 |
next |
|
1582 |
have "\<exists>B. \<forall>x y. norm (h x y) \<le> B * norm x * norm y" |
|
1583 |
using `bilinear h` by (rule bilinear_bounded) |
|
| 49522 | 1584 |
then show "\<exists>K. \<forall>x y. norm (h x y) \<le> norm x * norm y * K" |
| 44133 | 1585 |
by (simp add: mult_ac) |
1586 |
qed |
|
1587 |
next |
|
1588 |
assume "bounded_bilinear h" |
|
1589 |
then interpret h: bounded_bilinear h . |
|
1590 |
show "bilinear h" |
|
1591 |
unfolding bilinear_def linear_conv_bounded_linear |
|
| 49522 | 1592 |
using h.bounded_linear_left h.bounded_linear_right by simp |
| 44133 | 1593 |
qed |
1594 |
||
| 53939 | 1595 |
lemma bilinear_bounded_pos: |
| 56444 | 1596 |
fixes h :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::real_normed_vector" |
| 53939 | 1597 |
assumes bh: "bilinear h" |
1598 |
shows "\<exists>B > 0. \<forall>x y. norm (h x y) \<le> B * norm x * norm y" |
|
1599 |
proof - |
|
1600 |
have "\<exists>B > 0. \<forall>x y. norm (h x y) \<le> norm x * norm y * B" |
|
1601 |
using bh [unfolded bilinear_conv_bounded_bilinear] |
|
1602 |
by (rule bounded_bilinear.pos_bounded) |
|
1603 |
then show ?thesis |
|
1604 |
by (simp only: mult_ac) |
|
1605 |
qed |
|
1606 |
||
| 49522 | 1607 |
|
| 44133 | 1608 |
subsection {* We continue. *}
|
1609 |
||
1610 |
lemma independent_bound: |
|
| 53716 | 1611 |
fixes S :: "'a::euclidean_space set" |
1612 |
shows "independent S \<Longrightarrow> finite S \<and> card S \<le> DIM('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
|
1613 |
using independent_span_bound[OF finite_Basis, of S] by auto |
| 44133 | 1614 |
|
| 49663 | 1615 |
lemma dependent_biggerset: |
| 56444 | 1616 |
fixes S :: "'a::euclidean_space set" |
1617 |
shows "(finite S \<Longrightarrow> card S > DIM('a)) \<Longrightarrow> dependent S"
|
|
| 44133 | 1618 |
by (metis independent_bound not_less) |
1619 |
||
1620 |
text {* Hence we can create a maximal independent subset. *}
|
|
1621 |
||
1622 |
lemma maximal_independent_subset_extend: |
|
| 53406 | 1623 |
fixes S :: "'a::euclidean_space set" |
1624 |
assumes sv: "S \<subseteq> V" |
|
| 49663 | 1625 |
and iS: "independent S" |
| 44133 | 1626 |
shows "\<exists>B. S \<subseteq> B \<and> B \<subseteq> V \<and> independent B \<and> V \<subseteq> span B" |
1627 |
using sv iS |
|
| 49522 | 1628 |
proof (induct "DIM('a) - card S" arbitrary: S rule: less_induct)
|
| 44133 | 1629 |
case less |
1630 |
note sv = `S \<subseteq> V` and i = `independent S` |
|
1631 |
let ?P = "\<lambda>B. S \<subseteq> B \<and> B \<subseteq> V \<and> independent B \<and> V \<subseteq> span B" |
|
1632 |
let ?ths = "\<exists>x. ?P x" |
|
1633 |
let ?d = "DIM('a)"
|
|
| 53406 | 1634 |
show ?ths |
1635 |
proof (cases "V \<subseteq> span S") |
|
1636 |
case True |
|
1637 |
then show ?thesis |
|
1638 |
using sv i by blast |
|
1639 |
next |
|
1640 |
case False |
|
1641 |
then obtain a where a: "a \<in> V" "a \<notin> span S" |
|
1642 |
by blast |
|
1643 |
from a have aS: "a \<notin> S" |
|
1644 |
by (auto simp add: span_superset) |
|
1645 |
have th0: "insert a S \<subseteq> V" |
|
1646 |
using a sv by blast |
|
| 44133 | 1647 |
from independent_insert[of a S] i a |
| 53406 | 1648 |
have th1: "independent (insert a S)" |
1649 |
by auto |
|
| 44133 | 1650 |
have mlt: "?d - card (insert a S) < ?d - card S" |
| 49522 | 1651 |
using aS a independent_bound[OF th1] by auto |
| 44133 | 1652 |
|
1653 |
from less(1)[OF mlt th0 th1] |
|
1654 |
obtain B where B: "insert a S \<subseteq> B" "B \<subseteq> V" "independent B" " V \<subseteq> span B" |
|
1655 |
by blast |
|
1656 |
from B have "?P B" by auto |
|
| 53406 | 1657 |
then show ?thesis by blast |
1658 |
qed |
|
| 44133 | 1659 |
qed |
1660 |
||
1661 |
lemma maximal_independent_subset: |
|
1662 |
"\<exists>(B:: ('a::euclidean_space) set). B\<subseteq> V \<and> independent B \<and> V \<subseteq> span B"
|
|
| 49522 | 1663 |
by (metis maximal_independent_subset_extend[of "{}:: ('a::euclidean_space) set"]
|
1664 |
empty_subsetI independent_empty) |
|
| 44133 | 1665 |
|
1666 |
||
1667 |
text {* Notion of dimension. *}
|
|
1668 |
||
| 53406 | 1669 |
definition "dim V = (SOME n. \<exists>B. B \<subseteq> V \<and> independent B \<and> V \<subseteq> span B \<and> card B = n)" |
| 44133 | 1670 |
|
| 49522 | 1671 |
lemma basis_exists: |
1672 |
"\<exists>B. (B :: ('a::euclidean_space) set) \<subseteq> V \<and> independent B \<and> V \<subseteq> span B \<and> (card B = dim V)"
|
|
1673 |
unfolding dim_def some_eq_ex[of "\<lambda>n. \<exists>B. B \<subseteq> V \<and> independent B \<and> V \<subseteq> span B \<and> (card B = n)"] |
|
1674 |
using maximal_independent_subset[of V] independent_bound |
|
1675 |
by auto |
|
| 44133 | 1676 |
|
1677 |
text {* Consequences of independence or spanning for cardinality. *}
|
|
1678 |
||
| 53406 | 1679 |
lemma independent_card_le_dim: |
1680 |
fixes B :: "'a::euclidean_space set" |
|
1681 |
assumes "B \<subseteq> V" |
|
1682 |
and "independent B" |
|
| 49522 | 1683 |
shows "card B \<le> dim V" |
| 44133 | 1684 |
proof - |
1685 |
from basis_exists[of V] `B \<subseteq> V` |
|
| 53406 | 1686 |
obtain B' where "independent B'" |
1687 |
and "B \<subseteq> span B'" |
|
1688 |
and "card B' = dim V" |
|
1689 |
by blast |
|
| 44133 | 1690 |
with independent_span_bound[OF _ `independent B` `B \<subseteq> span B'`] independent_bound[of B'] |
1691 |
show ?thesis by auto |
|
1692 |
qed |
|
1693 |
||
| 49522 | 1694 |
lemma span_card_ge_dim: |
| 53406 | 1695 |
fixes B :: "'a::euclidean_space set" |
1696 |
shows "B \<subseteq> V \<Longrightarrow> V \<subseteq> span B \<Longrightarrow> finite B \<Longrightarrow> dim V \<le> card B" |
|
| 44133 | 1697 |
by (metis basis_exists[of V] independent_span_bound subset_trans) |
1698 |
||
1699 |
lemma basis_card_eq_dim: |
|
| 53406 | 1700 |
fixes V :: "'a::euclidean_space set" |
1701 |
shows "B \<subseteq> V \<Longrightarrow> V \<subseteq> span B \<Longrightarrow> independent B \<Longrightarrow> finite B \<and> card B = dim V" |
|
| 44133 | 1702 |
by (metis order_eq_iff independent_card_le_dim span_card_ge_dim independent_bound) |
1703 |
||
| 53406 | 1704 |
lemma dim_unique: |
1705 |
fixes B :: "'a::euclidean_space set" |
|
1706 |
shows "B \<subseteq> V \<Longrightarrow> V \<subseteq> span B \<Longrightarrow> independent B \<Longrightarrow> card B = n \<Longrightarrow> dim V = n" |
|
| 44133 | 1707 |
by (metis basis_card_eq_dim) |
1708 |
||
1709 |
text {* More lemmas about dimension. *}
|
|
1710 |
||
| 53406 | 1711 |
lemma dim_UNIV: "dim (UNIV :: 'a::euclidean_space set) = DIM('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
|
1712 |
using independent_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
|
1713 |
by (intro dim_unique[of Basis]) auto |
| 44133 | 1714 |
|
1715 |
lemma dim_subset: |
|
| 53406 | 1716 |
fixes S :: "'a::euclidean_space set" |
1717 |
shows "S \<subseteq> T \<Longrightarrow> dim S \<le> dim T" |
|
| 44133 | 1718 |
using basis_exists[of T] basis_exists[of S] |
1719 |
by (metis independent_card_le_dim subset_trans) |
|
1720 |
||
| 53406 | 1721 |
lemma dim_subset_UNIV: |
1722 |
fixes S :: "'a::euclidean_space set" |
|
1723 |
shows "dim S \<le> DIM('a)"
|
|
| 44133 | 1724 |
by (metis dim_subset subset_UNIV dim_UNIV) |
1725 |
||
1726 |
text {* Converses to those. *}
|
|
1727 |
||
1728 |
lemma card_ge_dim_independent: |
|
| 53406 | 1729 |
fixes B :: "'a::euclidean_space set" |
1730 |
assumes BV: "B \<subseteq> V" |
|
1731 |
and iB: "independent B" |
|
1732 |
and dVB: "dim V \<le> card B" |
|
| 44133 | 1733 |
shows "V \<subseteq> span B" |
| 53406 | 1734 |
proof |
1735 |
fix a |
|
1736 |
assume aV: "a \<in> V" |
|
1737 |
{
|
|
1738 |
assume aB: "a \<notin> span B" |
|
1739 |
then have iaB: "independent (insert a B)" |
|
1740 |
using iB aV BV by (simp add: independent_insert) |
|
1741 |
from aV BV have th0: "insert a B \<subseteq> V" |
|
1742 |
by blast |
|
1743 |
from aB have "a \<notin>B" |
|
1744 |
by (auto simp add: span_superset) |
|
1745 |
with independent_card_le_dim[OF th0 iaB] dVB independent_bound[OF iB] |
|
1746 |
have False by auto |
|
1747 |
} |
|
1748 |
then show "a \<in> span B" by blast |
|
| 44133 | 1749 |
qed |
1750 |
||
1751 |
lemma card_le_dim_spanning: |
|
| 49663 | 1752 |
assumes BV: "(B:: ('a::euclidean_space) set) \<subseteq> V"
|
1753 |
and VB: "V \<subseteq> span B" |
|
1754 |
and fB: "finite B" |
|
1755 |
and dVB: "dim V \<ge> card B" |
|
| 44133 | 1756 |
shows "independent B" |
| 49522 | 1757 |
proof - |
| 53406 | 1758 |
{
|
1759 |
fix a |
|
| 53716 | 1760 |
assume a: "a \<in> B" "a \<in> span (B - {a})"
|
| 53406 | 1761 |
from a fB have c0: "card B \<noteq> 0" |
1762 |
by auto |
|
| 53716 | 1763 |
from a fB have cb: "card (B - {a}) = card B - 1"
|
| 53406 | 1764 |
by auto |
| 53716 | 1765 |
from BV a have th0: "B - {a} \<subseteq> V"
|
| 53406 | 1766 |
by blast |
1767 |
{
|
|
1768 |
fix x |
|
1769 |
assume x: "x \<in> V" |
|
| 53716 | 1770 |
from a have eq: "insert a (B - {a}) = B"
|
| 53406 | 1771 |
by blast |
1772 |
from x VB have x': "x \<in> span B" |
|
1773 |
by blast |
|
| 44133 | 1774 |
from span_trans[OF a(2), unfolded eq, OF x'] |
| 53716 | 1775 |
have "x \<in> span (B - {a})" .
|
| 53406 | 1776 |
} |
| 53716 | 1777 |
then have th1: "V \<subseteq> span (B - {a})"
|
| 53406 | 1778 |
by blast |
| 53716 | 1779 |
have th2: "finite (B - {a})"
|
| 53406 | 1780 |
using fB by auto |
| 44133 | 1781 |
from span_card_ge_dim[OF th0 th1 th2] |
| 53716 | 1782 |
have c: "dim V \<le> card (B - {a})" .
|
| 53406 | 1783 |
from c c0 dVB cb have False by simp |
1784 |
} |
|
1785 |
then show ?thesis |
|
1786 |
unfolding dependent_def by blast |
|
| 44133 | 1787 |
qed |
1788 |
||
| 53406 | 1789 |
lemma card_eq_dim: |
1790 |
fixes B :: "'a::euclidean_space set" |
|
1791 |
shows "B \<subseteq> V \<Longrightarrow> card B = dim V \<Longrightarrow> finite B \<Longrightarrow> independent B \<longleftrightarrow> V \<subseteq> span B" |
|
| 49522 | 1792 |
by (metis order_eq_iff card_le_dim_spanning card_ge_dim_independent) |
| 44133 | 1793 |
|
1794 |
text {* More general size bound lemmas. *}
|
|
1795 |
||
1796 |
lemma independent_bound_general: |
|
| 53406 | 1797 |
fixes S :: "'a::euclidean_space set" |
1798 |
shows "independent S \<Longrightarrow> finite S \<and> card S \<le> dim S" |
|
| 44133 | 1799 |
by (metis independent_card_le_dim independent_bound subset_refl) |
1800 |
||
| 49522 | 1801 |
lemma dependent_biggerset_general: |
| 53406 | 1802 |
fixes S :: "'a::euclidean_space set" |
1803 |
shows "(finite S \<Longrightarrow> card S > dim S) \<Longrightarrow> dependent S" |
|
| 44133 | 1804 |
using independent_bound_general[of S] by (metis linorder_not_le) |
1805 |
||
| 53406 | 1806 |
lemma dim_span: |
1807 |
fixes S :: "'a::euclidean_space set" |
|
1808 |
shows "dim (span S) = dim S" |
|
| 49522 | 1809 |
proof - |
| 44133 | 1810 |
have th0: "dim S \<le> dim (span S)" |
1811 |
by (auto simp add: subset_eq intro: dim_subset span_superset) |
|
1812 |
from basis_exists[of S] |
|
| 53406 | 1813 |
obtain B where B: "B \<subseteq> S" "independent B" "S \<subseteq> span B" "card B = dim S" |
1814 |
by blast |
|
1815 |
from B have fB: "finite B" "card B = dim S" |
|
1816 |
using independent_bound by blast+ |
|
1817 |
have bSS: "B \<subseteq> span S" |
|
1818 |
using B(1) by (metis subset_eq span_inc) |
|
1819 |
have sssB: "span S \<subseteq> span B" |
|
1820 |
using span_mono[OF B(3)] by (simp add: span_span) |
|
| 44133 | 1821 |
from span_card_ge_dim[OF bSS sssB fB(1)] th0 show ?thesis |
| 49522 | 1822 |
using fB(2) by arith |
| 44133 | 1823 |
qed |
1824 |
||
| 53406 | 1825 |
lemma subset_le_dim: |
1826 |
fixes S :: "'a::euclidean_space set" |
|
1827 |
shows "S \<subseteq> span T \<Longrightarrow> dim S \<le> dim T" |
|
| 44133 | 1828 |
by (metis dim_span dim_subset) |
1829 |
||
| 53406 | 1830 |
lemma span_eq_dim: |
| 56444 | 1831 |
fixes S :: "'a::euclidean_space set" |
| 53406 | 1832 |
shows "span S = span T \<Longrightarrow> dim S = dim T" |
| 44133 | 1833 |
by (metis dim_span) |
1834 |
||
1835 |
lemma spans_image: |
|
| 49663 | 1836 |
assumes lf: "linear f" |
1837 |
and VB: "V \<subseteq> span B" |
|
| 44133 | 1838 |
shows "f ` V \<subseteq> span (f ` B)" |
| 49522 | 1839 |
unfolding span_linear_image[OF lf] by (metis VB image_mono) |
| 44133 | 1840 |
|
1841 |
lemma dim_image_le: |
|
1842 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
|
| 49663 | 1843 |
assumes lf: "linear f" |
1844 |
shows "dim (f ` S) \<le> dim (S)" |
|
| 49522 | 1845 |
proof - |
| 44133 | 1846 |
from basis_exists[of S] obtain B where |
1847 |
B: "B \<subseteq> S" "independent B" "S \<subseteq> span B" "card B = dim S" by blast |
|
| 53406 | 1848 |
from B have fB: "finite B" "card B = dim S" |
1849 |
using independent_bound by blast+ |
|
| 44133 | 1850 |
have "dim (f ` S) \<le> card (f ` B)" |
1851 |
apply (rule span_card_ge_dim) |
|
| 53406 | 1852 |
using lf B fB |
1853 |
apply (auto simp add: span_linear_image spans_image subset_image_iff) |
|
| 49522 | 1854 |
done |
| 53406 | 1855 |
also have "\<dots> \<le> dim S" |
1856 |
using card_image_le[OF fB(1)] fB by simp |
|
| 44133 | 1857 |
finally show ?thesis . |
1858 |
qed |
|
1859 |
||
1860 |
text {* Relation between bases and injectivity/surjectivity of map. *}
|
|
1861 |
||
1862 |
lemma spanning_surjective_image: |
|
1863 |
assumes us: "UNIV \<subseteq> span S" |
|
| 53406 | 1864 |
and lf: "linear f" |
1865 |
and sf: "surj f" |
|
| 44133 | 1866 |
shows "UNIV \<subseteq> span (f ` S)" |
| 49663 | 1867 |
proof - |
| 53406 | 1868 |
have "UNIV \<subseteq> f ` UNIV" |
1869 |
using sf by (auto simp add: surj_def) |
|
1870 |
also have " \<dots> \<subseteq> span (f ` S)" |
|
1871 |
using spans_image[OF lf us] . |
|
1872 |
finally show ?thesis . |
|
| 44133 | 1873 |
qed |
1874 |
||
1875 |
lemma independent_injective_image: |
|
| 49663 | 1876 |
assumes iS: "independent S" |
1877 |
and lf: "linear f" |
|
1878 |
and fi: "inj f" |
|
| 44133 | 1879 |
shows "independent (f ` S)" |
| 49663 | 1880 |
proof - |
| 53406 | 1881 |
{
|
1882 |
fix a |
|
| 49663 | 1883 |
assume a: "a \<in> S" "f a \<in> span (f ` S - {f a})"
|
| 53406 | 1884 |
have eq: "f ` S - {f a} = f ` (S - {a})"
|
1885 |
using fi by (auto simp add: inj_on_def) |
|
| 53716 | 1886 |
from a have "f a \<in> f ` span (S - {a})"
|
| 53406 | 1887 |
unfolding eq span_linear_image[OF lf, of "S - {a}"] by blast
|
| 53716 | 1888 |
then have "a \<in> span (S - {a})"
|
| 53406 | 1889 |
using fi by (auto simp add: inj_on_def) |
1890 |
with a(1) iS have False |
|
1891 |
by (simp add: dependent_def) |
|
1892 |
} |
|
1893 |
then show ?thesis |
|
1894 |
unfolding dependent_def by blast |
|
| 44133 | 1895 |
qed |
1896 |
||
1897 |
text {* Picking an orthogonal replacement for a spanning set. *}
|
|
1898 |
||
| 53406 | 1899 |
(* FIXME : Move to some general theory ?*) |
| 44133 | 1900 |
definition "pairwise R S \<longleftrightarrow> (\<forall>x \<in> S. \<forall>y\<in> S. x\<noteq>y \<longrightarrow> R x y)" |
1901 |
||
| 53406 | 1902 |
lemma vector_sub_project_orthogonal: |
1903 |
fixes b x :: "'a::euclidean_space" |
|
1904 |
shows "b \<bullet> (x - ((b \<bullet> x) / (b \<bullet> b)) *\<^sub>R b) = 0" |
|
| 44133 | 1905 |
unfolding inner_simps by auto |
1906 |
||
| 44528 | 1907 |
lemma pairwise_orthogonal_insert: |
1908 |
assumes "pairwise orthogonal S" |
|
| 49522 | 1909 |
and "\<And>y. y \<in> S \<Longrightarrow> orthogonal x y" |
| 44528 | 1910 |
shows "pairwise orthogonal (insert x S)" |
1911 |
using assms unfolding pairwise_def |
|
1912 |
by (auto simp add: orthogonal_commute) |
|
1913 |
||
| 44133 | 1914 |
lemma basis_orthogonal: |
| 53406 | 1915 |
fixes B :: "'a::real_inner set" |
| 44133 | 1916 |
assumes fB: "finite B" |
1917 |
shows "\<exists>C. finite C \<and> card C \<le> card B \<and> span C = span B \<and> pairwise orthogonal C" |
|
1918 |
(is " \<exists>C. ?P B C") |
|
| 49522 | 1919 |
using fB |
1920 |
proof (induct rule: finite_induct) |
|
1921 |
case empty |
|
| 53406 | 1922 |
then show ?case |
1923 |
apply (rule exI[where x="{}"])
|
|
1924 |
apply (auto simp add: pairwise_def) |
|
1925 |
done |
|
| 44133 | 1926 |
next |
| 49522 | 1927 |
case (insert a B) |
| 44133 | 1928 |
note fB = `finite B` and aB = `a \<notin> B` |
1929 |
from `\<exists>C. finite C \<and> card C \<le> card B \<and> span C = span B \<and> pairwise orthogonal C` |
|
1930 |
obtain C where C: "finite C" "card C \<le> card B" |
|
1931 |
"span C = span B" "pairwise orthogonal C" by blast |
|
1932 |
let ?a = "a - setsum (\<lambda>x. (x \<bullet> a / (x \<bullet> x)) *\<^sub>R x) C" |
|
1933 |
let ?C = "insert ?a C" |
|
| 53406 | 1934 |
from C(1) have fC: "finite ?C" |
1935 |
by simp |
|
| 49522 | 1936 |
from fB aB C(1,2) have cC: "card ?C \<le> card (insert a B)" |
1937 |
by (simp add: card_insert_if) |
|
| 53406 | 1938 |
{
|
1939 |
fix x k |
|
| 49522 | 1940 |
have th0: "\<And>(a::'a) b c. a - (b - c) = c + (a - b)" |
1941 |
by (simp add: field_simps) |
|
| 44133 | 1942 |
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" |
1943 |
apply (simp only: scaleR_right_diff_distrib th0) |
|
1944 |
apply (rule span_add_eq) |
|
1945 |
apply (rule span_mul) |
|
|
56196
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
1946 |
apply (rule span_setsum) |
| 44133 | 1947 |
apply clarify |
1948 |
apply (rule span_mul) |
|
| 49522 | 1949 |
apply (rule span_superset) |
1950 |
apply assumption |
|
| 53406 | 1951 |
done |
1952 |
} |
|
| 44133 | 1953 |
then have SC: "span ?C = span (insert a B)" |
1954 |
unfolding set_eq_iff span_breakdown_eq C(3)[symmetric] by auto |
|
| 53406 | 1955 |
{
|
1956 |
fix y |
|
1957 |
assume yC: "y \<in> C" |
|
1958 |
then have Cy: "C = insert y (C - {y})"
|
|
1959 |
by blast |
|
1960 |
have fth: "finite (C - {y})"
|
|
1961 |
using C by simp |
|
| 44528 | 1962 |
have "orthogonal ?a y" |
1963 |
unfolding orthogonal_def |
|
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53939
diff
changeset
|
1964 |
unfolding inner_diff inner_setsum_left right_minus_eq |
| 44528 | 1965 |
unfolding setsum_diff1' [OF `finite C` `y \<in> C`] |
1966 |
apply (clarsimp simp add: inner_commute[of y a]) |
|
1967 |
apply (rule setsum_0') |
|
1968 |
apply clarsimp |
|
1969 |
apply (rule C(4)[unfolded pairwise_def orthogonal_def, rule_format]) |
|
| 53406 | 1970 |
using `y \<in> C` by auto |
1971 |
} |
|
| 44528 | 1972 |
with `pairwise orthogonal C` have CPO: "pairwise orthogonal ?C" |
1973 |
by (rule pairwise_orthogonal_insert) |
|
| 53406 | 1974 |
from fC cC SC CPO have "?P (insert a B) ?C" |
1975 |
by blast |
|
| 44133 | 1976 |
then show ?case by blast |
1977 |
qed |
|
1978 |
||
1979 |
lemma orthogonal_basis_exists: |
|
1980 |
fixes V :: "('a::euclidean_space) set"
|
|
1981 |
shows "\<exists>B. independent B \<and> B \<subseteq> span V \<and> V \<subseteq> span B \<and> (card B = dim V) \<and> pairwise orthogonal B" |
|
| 49663 | 1982 |
proof - |
| 49522 | 1983 |
from basis_exists[of V] obtain B where |
| 53406 | 1984 |
B: "B \<subseteq> V" "independent B" "V \<subseteq> span B" "card B = dim V" |
1985 |
by blast |
|
1986 |
from B have fB: "finite B" "card B = dim V" |
|
1987 |
using independent_bound by auto |
|
| 44133 | 1988 |
from basis_orthogonal[OF fB(1)] obtain C where |
| 53406 | 1989 |
C: "finite C" "card C \<le> card B" "span C = span B" "pairwise orthogonal C" |
1990 |
by blast |
|
1991 |
from C B have CSV: "C \<subseteq> span V" |
|
1992 |
by (metis span_inc span_mono subset_trans) |
|
1993 |
from span_mono[OF B(3)] C have SVC: "span V \<subseteq> span C" |
|
1994 |
by (simp add: span_span) |
|
| 44133 | 1995 |
from card_le_dim_spanning[OF CSV SVC C(1)] C(2,3) fB |
| 53406 | 1996 |
have iC: "independent C" |
| 44133 | 1997 |
by (simp add: dim_span) |
| 53406 | 1998 |
from C fB have "card C \<le> dim V" |
1999 |
by simp |
|
2000 |
moreover have "dim V \<le> card C" |
|
2001 |
using span_card_ge_dim[OF CSV SVC C(1)] |
|
2002 |
by (simp add: dim_span) |
|
2003 |
ultimately have CdV: "card C = dim V" |
|
2004 |
using C(1) by simp |
|
2005 |
from C B CSV CdV iC show ?thesis |
|
2006 |
by auto |
|
| 44133 | 2007 |
qed |
2008 |
||
2009 |
lemma span_eq: "span S = span T \<longleftrightarrow> S \<subseteq> span T \<and> T \<subseteq> span S" |
|
2010 |
using span_inc[unfolded subset_eq] using span_mono[of T "span S"] span_mono[of S "span T"] |
|
| 49522 | 2011 |
by (auto simp add: span_span) |
| 44133 | 2012 |
|
2013 |
text {* Low-dimensional subset is in a hyperplane (weak orthogonal complement). *}
|
|
2014 |
||
| 49522 | 2015 |
lemma span_not_univ_orthogonal: |
| 53406 | 2016 |
fixes S :: "'a::euclidean_space set" |
| 44133 | 2017 |
assumes sU: "span S \<noteq> UNIV" |
| 56444 | 2018 |
shows "\<exists>a::'a. a \<noteq> 0 \<and> (\<forall>x \<in> span S. a \<bullet> x = 0)" |
| 49522 | 2019 |
proof - |
| 53406 | 2020 |
from sU obtain a where a: "a \<notin> span S" |
2021 |
by blast |
|
| 44133 | 2022 |
from orthogonal_basis_exists obtain B where |
2023 |
B: "independent B" "B \<subseteq> span S" "S \<subseteq> span B" "card B = dim S" "pairwise orthogonal B" |
|
2024 |
by blast |
|
| 53406 | 2025 |
from B have fB: "finite B" "card B = dim S" |
2026 |
using independent_bound by auto |
|
| 44133 | 2027 |
from span_mono[OF B(2)] span_mono[OF B(3)] |
| 53406 | 2028 |
have sSB: "span S = span B" |
2029 |
by (simp add: span_span) |
|
| 44133 | 2030 |
let ?a = "a - setsum (\<lambda>b. (a \<bullet> b / (b \<bullet> b)) *\<^sub>R b) B" |
2031 |
have "setsum (\<lambda>b. (a \<bullet> b / (b \<bullet> b)) *\<^sub>R b) B \<in> span S" |
|
2032 |
unfolding sSB |
|
|
56196
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56166
diff
changeset
|
2033 |
apply (rule span_setsum) |
| 44133 | 2034 |
apply clarsimp |
2035 |
apply (rule span_mul) |
|
| 49522 | 2036 |
apply (rule span_superset) |
2037 |
apply assumption |
|
2038 |
done |
|
| 53406 | 2039 |
with a have a0:"?a \<noteq> 0" |
2040 |
by auto |
|
| 44133 | 2041 |
have "\<forall>x\<in>span B. ?a \<bullet> x = 0" |
| 49522 | 2042 |
proof (rule span_induct') |
2043 |
show "subspace {x. ?a \<bullet> x = 0}"
|
|
2044 |
by (auto simp add: subspace_def inner_add) |
|
2045 |
next |
|
| 53406 | 2046 |
{
|
2047 |
fix x |
|
2048 |
assume x: "x \<in> B" |
|
2049 |
from x have B': "B = insert x (B - {x})"
|
|
2050 |
by blast |
|
2051 |
have fth: "finite (B - {x})"
|
|
2052 |
using fB by simp |
|
| 44133 | 2053 |
have "?a \<bullet> x = 0" |
| 53406 | 2054 |
apply (subst B') |
2055 |
using fB fth |
|
| 44133 | 2056 |
unfolding setsum_clauses(2)[OF fth] |
2057 |
apply simp unfolding inner_simps |
|
|
44527
bf8014b4f933
remove dot_lsum and dot_rsum in favor of inner_setsum_{left,right}
huffman
parents:
44521
diff
changeset
|
2058 |
apply (clarsimp simp add: inner_add inner_setsum_left) |
| 44133 | 2059 |
apply (rule setsum_0', rule ballI) |
2060 |
unfolding inner_commute |
|
| 49711 | 2061 |
apply (auto simp add: x field_simps |
2062 |
intro: B(5)[unfolded pairwise_def orthogonal_def, rule_format]) |
|
| 53406 | 2063 |
done |
2064 |
} |
|
2065 |
then show "\<forall>x \<in> B. ?a \<bullet> x = 0" |
|
2066 |
by blast |
|
| 44133 | 2067 |
qed |
| 53406 | 2068 |
with a0 show ?thesis |
2069 |
unfolding sSB by (auto intro: exI[where x="?a"]) |
|
| 44133 | 2070 |
qed |
2071 |
||
2072 |
lemma span_not_univ_subset_hyperplane: |
|
| 53406 | 2073 |
fixes S :: "'a::euclidean_space set" |
2074 |
assumes SU: "span S \<noteq> UNIV" |
|
| 44133 | 2075 |
shows "\<exists> a. a \<noteq>0 \<and> span S \<subseteq> {x. a \<bullet> x = 0}"
|
2076 |
using span_not_univ_orthogonal[OF SU] by auto |
|
2077 |
||
| 49663 | 2078 |
lemma lowdim_subset_hyperplane: |
| 53406 | 2079 |
fixes S :: "'a::euclidean_space set" |
| 44133 | 2080 |
assumes d: "dim S < DIM('a)"
|
| 56444 | 2081 |
shows "\<exists>a::'a. a \<noteq> 0 \<and> span S \<subseteq> {x. a \<bullet> x = 0}"
|
| 49522 | 2082 |
proof - |
| 53406 | 2083 |
{
|
2084 |
assume "span S = UNIV" |
|
2085 |
then have "dim (span S) = dim (UNIV :: ('a) set)"
|
|
2086 |
by simp |
|
2087 |
then have "dim S = DIM('a)"
|
|
2088 |
by (simp add: dim_span dim_UNIV) |
|
2089 |
with d have False by arith |
|
2090 |
} |
|
2091 |
then have th: "span S \<noteq> UNIV" |
|
2092 |
by blast |
|
| 44133 | 2093 |
from span_not_univ_subset_hyperplane[OF th] show ?thesis . |
2094 |
qed |
|
2095 |
||
2096 |
text {* We can extend a linear basis-basis injection to the whole set. *}
|
|
2097 |
||
2098 |
lemma linear_indep_image_lemma: |
|
| 49663 | 2099 |
assumes lf: "linear f" |
2100 |
and fB: "finite B" |
|
| 49522 | 2101 |
and ifB: "independent (f ` B)" |
| 49663 | 2102 |
and fi: "inj_on f B" |
2103 |
and xsB: "x \<in> span B" |
|
| 49522 | 2104 |
and fx: "f x = 0" |
| 44133 | 2105 |
shows "x = 0" |
2106 |
using fB ifB fi xsB fx |
|
| 49522 | 2107 |
proof (induct arbitrary: x rule: finite_induct[OF fB]) |
| 49663 | 2108 |
case 1 |
2109 |
then show ?case by auto |
|
| 44133 | 2110 |
next |
2111 |
case (2 a b x) |
|
2112 |
have fb: "finite b" using "2.prems" by simp |
|
2113 |
have th0: "f ` b \<subseteq> f ` (insert a b)" |
|
| 53406 | 2114 |
apply (rule image_mono) |
2115 |
apply blast |
|
2116 |
done |
|
| 44133 | 2117 |
from independent_mono[ OF "2.prems"(2) th0] |
2118 |
have ifb: "independent (f ` b)" . |
|
2119 |
have fib: "inj_on f b" |
|
2120 |
apply (rule subset_inj_on [OF "2.prems"(3)]) |
|
| 49522 | 2121 |
apply blast |
2122 |
done |
|
| 44133 | 2123 |
from span_breakdown[of a "insert a b", simplified, OF "2.prems"(4)] |
| 53406 | 2124 |
obtain k where k: "x - k*\<^sub>R a \<in> span (b - {a})"
|
2125 |
by blast |
|
| 44133 | 2126 |
have "f (x - k*\<^sub>R a) \<in> span (f ` b)" |
2127 |
unfolding span_linear_image[OF lf] |
|
2128 |
apply (rule imageI) |
|
| 53716 | 2129 |
using k span_mono[of "b - {a}" b]
|
| 53406 | 2130 |
apply blast |
| 49522 | 2131 |
done |
2132 |
then have "f x - k*\<^sub>R f a \<in> span (f ` b)" |
|
| 44133 | 2133 |
by (simp add: linear_sub[OF lf] linear_cmul[OF lf]) |
| 49522 | 2134 |
then have th: "-k *\<^sub>R f a \<in> span (f ` b)" |
| 44133 | 2135 |
using "2.prems"(5) by simp |
| 53406 | 2136 |
have xsb: "x \<in> span b" |
2137 |
proof (cases "k = 0") |
|
2138 |
case True |
|
| 53716 | 2139 |
with k have "x \<in> span (b - {a})" by simp
|
2140 |
then show ?thesis using span_mono[of "b - {a}" b]
|
|
| 53406 | 2141 |
by blast |
2142 |
next |
|
2143 |
case False |
|
2144 |
with span_mul[OF th, of "- 1/ k"] |
|
| 44133 | 2145 |
have th1: "f a \<in> span (f ` b)" |
|
56409
36489d77c484
removing simprule status for divide_minus_left and divide_minus_right
paulson <lp15@cam.ac.uk>
parents:
56196
diff
changeset
|
2146 |
by (auto simp: divide_minus_left) |
| 44133 | 2147 |
from inj_on_image_set_diff[OF "2.prems"(3), of "insert a b " "{a}", symmetric]
|
2148 |
have tha: "f ` insert a b - f ` {a} = f ` (insert a b - {a})" by blast
|
|
2149 |
from "2.prems"(2) [unfolded dependent_def bex_simps(8), rule_format, of "f a"] |
|
2150 |
have "f a \<notin> span (f ` b)" using tha |
|
2151 |
using "2.hyps"(2) |
|
2152 |
"2.prems"(3) by auto |
|
2153 |
with th1 have False by blast |
|
| 53406 | 2154 |
then show ?thesis by blast |
2155 |
qed |
|
2156 |
from "2.hyps"(3)[OF fb ifb fib xsb "2.prems"(5)] show "x = 0" . |
|
| 44133 | 2157 |
qed |
2158 |
||
2159 |
text {* We can extend a linear mapping from basis. *}
|
|
2160 |
||
2161 |
lemma linear_independent_extend_lemma: |
|
2162 |
fixes f :: "'a::real_vector \<Rightarrow> 'b::real_vector" |
|
| 53406 | 2163 |
assumes fi: "finite B" |
2164 |
and ib: "independent B" |
|
2165 |
shows "\<exists>g. |
|
2166 |
(\<forall>x\<in> span B. \<forall>y\<in> span B. g (x + y) = g x + g y) \<and> |
|
2167 |
(\<forall>x\<in> span B. \<forall>c. g (c*\<^sub>R x) = c *\<^sub>R g x) \<and> |
|
2168 |
(\<forall>x\<in> B. g x = f x)" |
|
| 49663 | 2169 |
using ib fi |
| 49522 | 2170 |
proof (induct rule: finite_induct[OF fi]) |
| 49663 | 2171 |
case 1 |
2172 |
then show ?case by auto |
|
| 44133 | 2173 |
next |
2174 |
case (2 a b) |
|
2175 |
from "2.prems" "2.hyps" have ibf: "independent b" "finite b" |
|
2176 |
by (simp_all add: independent_insert) |
|
2177 |
from "2.hyps"(3)[OF ibf] obtain g where |
|
2178 |
g: "\<forall>x\<in>span b. \<forall>y\<in>span b. g (x + y) = g x + g y" |
|
2179 |
"\<forall>x\<in>span b. \<forall>c. g (c *\<^sub>R x) = c *\<^sub>R g x" "\<forall>x\<in>b. g x = f x" by blast |
|
2180 |
let ?h = "\<lambda>z. SOME k. (z - k *\<^sub>R a) \<in> span b" |
|
| 53406 | 2181 |
{
|
2182 |
fix z |
|
2183 |
assume z: "z \<in> span (insert a b)" |
|
| 44133 | 2184 |
have th0: "z - ?h z *\<^sub>R a \<in> span b" |
2185 |
apply (rule someI_ex) |
|
2186 |
unfolding span_breakdown_eq[symmetric] |
|
| 53406 | 2187 |
apply (rule z) |
2188 |
done |
|
2189 |
{
|
|
2190 |
fix k |
|
2191 |
assume k: "z - k *\<^sub>R a \<in> span b" |
|
| 44133 | 2192 |
have eq: "z - ?h z *\<^sub>R a - (z - k*\<^sub>R a) = (k - ?h z) *\<^sub>R a" |
2193 |
by (simp add: field_simps scaleR_left_distrib [symmetric]) |
|
| 53406 | 2194 |
from span_sub[OF th0 k] have khz: "(k - ?h z) *\<^sub>R a \<in> span b" |
2195 |
by (simp add: eq) |
|
2196 |
{
|
|
2197 |
assume "k \<noteq> ?h z" |
|
2198 |
then have k0: "k - ?h z \<noteq> 0" by simp |
|
| 44133 | 2199 |
from k0 span_mul[OF khz, of "1 /(k - ?h z)"] |
2200 |
have "a \<in> span b" by simp |
|
2201 |
with "2.prems"(1) "2.hyps"(2) have False |
|
| 53406 | 2202 |
by (auto simp add: dependent_def) |
2203 |
} |
|
2204 |
then have "k = ?h z" by blast |
|
2205 |
} |
|
2206 |
with th0 have "z - ?h z *\<^sub>R a \<in> span b \<and> (\<forall>k. z - k *\<^sub>R a \<in> span b \<longrightarrow> k = ?h z)" |
|
2207 |
by blast |
|
2208 |
} |
|
| 44133 | 2209 |
note h = this |
2210 |
let ?g = "\<lambda>z. ?h z *\<^sub>R f a + g (z - ?h z *\<^sub>R a)" |
|
| 53406 | 2211 |
{
|
2212 |
fix x y |
|
2213 |
assume x: "x \<in> span (insert a b)" |
|
2214 |
and y: "y \<in> span (insert a b)" |
|
| 44133 | 2215 |
have tha: "\<And>(x::'a) y a k l. (x + y) - (k + l) *\<^sub>R a = (x - k *\<^sub>R a) + (y - l *\<^sub>R a)" |
2216 |
by (simp add: algebra_simps) |
|
2217 |
have addh: "?h (x + y) = ?h x + ?h y" |
|
2218 |
apply (rule conjunct2[OF h, rule_format, symmetric]) |
|
2219 |
apply (rule span_add[OF x y]) |
|
2220 |
unfolding tha |
|
| 53406 | 2221 |
apply (metis span_add x y conjunct1[OF h, rule_format]) |
2222 |
done |
|
| 44133 | 2223 |
have "?g (x + y) = ?g x + ?g y" |
2224 |
unfolding addh tha |
|
2225 |
g(1)[rule_format,OF conjunct1[OF h, OF x] conjunct1[OF h, OF y]] |
|
2226 |
by (simp add: scaleR_left_distrib)} |
|
2227 |
moreover |
|
| 53406 | 2228 |
{
|
2229 |
fix x :: "'a" |
|
2230 |
fix c :: real |
|
| 49522 | 2231 |
assume x: "x \<in> span (insert a b)" |
| 44133 | 2232 |
have tha: "\<And>(x::'a) c k a. c *\<^sub>R x - (c * k) *\<^sub>R a = c *\<^sub>R (x - k *\<^sub>R a)" |
2233 |
by (simp add: algebra_simps) |
|
2234 |
have hc: "?h (c *\<^sub>R x) = c * ?h x" |
|
2235 |
apply (rule conjunct2[OF h, rule_format, symmetric]) |
|
2236 |
apply (metis span_mul x) |
|
| 49522 | 2237 |
apply (metis tha span_mul x conjunct1[OF h]) |
2238 |
done |
|
| 44133 | 2239 |
have "?g (c *\<^sub>R x) = c*\<^sub>R ?g x" |
2240 |
unfolding hc tha g(2)[rule_format, OF conjunct1[OF h, OF x]] |
|
| 53406 | 2241 |
by (simp add: algebra_simps) |
2242 |
} |
|
| 44133 | 2243 |
moreover |
| 53406 | 2244 |
{
|
2245 |
fix x |
|
2246 |
assume x: "x \<in> insert a b" |
|
2247 |
{
|
|
2248 |
assume xa: "x = a" |
|
| 44133 | 2249 |
have ha1: "1 = ?h a" |
2250 |
apply (rule conjunct2[OF h, rule_format]) |
|
2251 |
apply (metis span_superset insertI1) |
|
2252 |
using conjunct1[OF h, OF span_superset, OF insertI1] |
|
| 49522 | 2253 |
apply (auto simp add: span_0) |
2254 |
done |
|
| 44133 | 2255 |
from xa ha1[symmetric] have "?g x = f x" |
2256 |
apply simp |
|
2257 |
using g(2)[rule_format, OF span_0, of 0] |
|
| 49522 | 2258 |
apply simp |
| 53406 | 2259 |
done |
2260 |
} |
|
| 44133 | 2261 |
moreover |
| 53406 | 2262 |
{
|
2263 |
assume xb: "x \<in> b" |
|
| 44133 | 2264 |
have h0: "0 = ?h x" |
2265 |
apply (rule conjunct2[OF h, rule_format]) |
|
2266 |
apply (metis span_superset x) |
|
2267 |
apply simp |
|
2268 |
apply (metis span_superset xb) |
|
2269 |
done |
|
2270 |
have "?g x = f x" |
|
| 53406 | 2271 |
by (simp add: h0[symmetric] g(3)[rule_format, OF xb]) |
2272 |
} |
|
2273 |
ultimately have "?g x = f x" |
|
2274 |
using x by blast |
|
2275 |
} |
|
| 49663 | 2276 |
ultimately show ?case |
2277 |
apply - |
|
2278 |
apply (rule exI[where x="?g"]) |
|
2279 |
apply blast |
|
2280 |
done |
|
| 44133 | 2281 |
qed |
2282 |
||
2283 |
lemma linear_independent_extend: |
|
| 53406 | 2284 |
fixes B :: "'a::euclidean_space set" |
2285 |
assumes iB: "independent B" |
|
| 44133 | 2286 |
shows "\<exists>g. linear g \<and> (\<forall>x\<in>B. g x = f x)" |
| 49522 | 2287 |
proof - |
| 44133 | 2288 |
from maximal_independent_subset_extend[of B UNIV] iB |
| 53406 | 2289 |
obtain C where C: "B \<subseteq> C" "independent C" "\<And>x. x \<in> span C" |
2290 |
by auto |
|
| 44133 | 2291 |
|
2292 |
from C(2) independent_bound[of C] linear_independent_extend_lemma[of C f] |
|
| 53406 | 2293 |
obtain g where g: |
2294 |
"(\<forall>x\<in> span C. \<forall>y\<in> span C. g (x + y) = g x + g y) \<and> |
|
2295 |
(\<forall>x\<in> span C. \<forall>c. g (c*\<^sub>R x) = c *\<^sub>R g x) \<and> |
|
2296 |
(\<forall>x\<in> C. g x = f x)" by blast |
|
2297 |
from g show ?thesis |
|
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
2298 |
unfolding linear_iff |
| 53406 | 2299 |
using C |
| 49663 | 2300 |
apply clarsimp |
2301 |
apply blast |
|
2302 |
done |
|
| 44133 | 2303 |
qed |
2304 |
||
2305 |
text {* Can construct an isomorphism between spaces of same dimension. *}
|
|
2306 |
||
2307 |
lemma subspace_isomorphism: |
|
| 53406 | 2308 |
fixes S :: "'a::euclidean_space set" |
2309 |
and T :: "'b::euclidean_space set" |
|
2310 |
assumes s: "subspace S" |
|
2311 |
and t: "subspace T" |
|
| 49522 | 2312 |
and d: "dim S = dim T" |
| 44133 | 2313 |
shows "\<exists>f. linear f \<and> f ` S = T \<and> inj_on f S" |
| 49522 | 2314 |
proof - |
| 53406 | 2315 |
from basis_exists[of S] independent_bound |
2316 |
obtain B where B: "B \<subseteq> S" "independent B" "S \<subseteq> span B" "card B = dim S" and fB: "finite B" |
|
2317 |
by blast |
|
2318 |
from basis_exists[of T] independent_bound |
|
2319 |
obtain C where C: "C \<subseteq> T" "independent C" "T \<subseteq> span C" "card C = dim T" and fC: "finite C" |
|
2320 |
by blast |
|
2321 |
from B(4) C(4) card_le_inj[of B C] d |
|
2322 |
obtain f where f: "f ` B \<subseteq> C" "inj_on f B" using `finite B` `finite C` |
|
2323 |
by auto |
|
2324 |
from linear_independent_extend[OF B(2)] |
|
2325 |
obtain g where g: "linear g" "\<forall>x\<in> B. g x = f x" |
|
2326 |
by blast |
|
2327 |
from inj_on_iff_eq_card[OF fB, of f] f(2) have "card (f ` B) = card B" |
|
| 44133 | 2328 |
by simp |
| 53406 | 2329 |
with B(4) C(4) have ceq: "card (f ` B) = card C" |
2330 |
using d by simp |
|
2331 |
have "g ` B = f ` B" |
|
2332 |
using g(2) by (auto simp add: image_iff) |
|
| 44133 | 2333 |
also have "\<dots> = C" using card_subset_eq[OF fC f(1) ceq] . |
2334 |
finally have gBC: "g ` B = C" . |
|
| 53406 | 2335 |
have gi: "inj_on g B" |
2336 |
using f(2) g(2) by (auto simp add: inj_on_def) |
|
| 44133 | 2337 |
note g0 = linear_indep_image_lemma[OF g(1) fB, unfolded gBC, OF C(2) gi] |
| 53406 | 2338 |
{
|
2339 |
fix x y |
|
2340 |
assume x: "x \<in> S" and y: "y \<in> S" and gxy: "g x = g y" |
|
2341 |
from B(3) x y have x': "x \<in> span B" and y': "y \<in> span B" |
|
2342 |
by blast+ |
|
2343 |
from gxy have th0: "g (x - y) = 0" |
|
2344 |
by (simp add: linear_sub[OF g(1)]) |
|
2345 |
have th1: "x - y \<in> span B" |
|
2346 |
using x' y' by (metis span_sub) |
|
2347 |
have "x = y" |
|
2348 |
using g0[OF th1 th0] by simp |
|
2349 |
} |
|
| 44133 | 2350 |
then have giS: "inj_on g S" |
2351 |
unfolding inj_on_def by blast |
|
| 53406 | 2352 |
from span_subspace[OF B(1,3) s] have "g ` S = span (g ` B)" |
2353 |
by (simp add: span_linear_image[OF g(1)]) |
|
| 44133 | 2354 |
also have "\<dots> = span C" unfolding gBC .. |
2355 |
also have "\<dots> = T" using span_subspace[OF C(1,3) t] . |
|
2356 |
finally have gS: "g ` S = T" . |
|
| 53406 | 2357 |
from g(1) gS giS show ?thesis |
2358 |
by blast |
|
| 44133 | 2359 |
qed |
2360 |
||
2361 |
text {* Linear functions are equal on a subspace if they are on a spanning set. *}
|
|
2362 |
||
2363 |
lemma subspace_kernel: |
|
2364 |
assumes lf: "linear f" |
|
2365 |
shows "subspace {x. f x = 0}"
|
|
| 49522 | 2366 |
apply (simp add: subspace_def) |
2367 |
apply (simp add: linear_add[OF lf] linear_cmul[OF lf] linear_0[OF lf]) |
|
2368 |
done |
|
| 44133 | 2369 |
|
2370 |
lemma linear_eq_0_span: |
|
2371 |
assumes lf: "linear f" and f0: "\<forall>x\<in>B. f x = 0" |
|
2372 |
shows "\<forall>x \<in> span B. f x = 0" |
|
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
2373 |
using f0 subspace_kernel[OF lf] |
|
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
2374 |
by (rule span_induct') |
| 44133 | 2375 |
|
2376 |
lemma linear_eq_0: |
|
| 49663 | 2377 |
assumes lf: "linear f" |
2378 |
and SB: "S \<subseteq> span B" |
|
2379 |
and f0: "\<forall>x\<in>B. f x = 0" |
|
| 44133 | 2380 |
shows "\<forall>x \<in> S. f x = 0" |
2381 |
by (metis linear_eq_0_span[OF lf] subset_eq SB f0) |
|
2382 |
||
2383 |
lemma linear_eq: |
|
| 49663 | 2384 |
assumes lf: "linear f" |
2385 |
and lg: "linear g" |
|
2386 |
and S: "S \<subseteq> span B" |
|
| 49522 | 2387 |
and fg: "\<forall> x\<in> B. f x = g x" |
| 44133 | 2388 |
shows "\<forall>x\<in> S. f x = g x" |
| 49663 | 2389 |
proof - |
| 44133 | 2390 |
let ?h = "\<lambda>x. f x - g x" |
2391 |
from fg have fg': "\<forall>x\<in> B. ?h x = 0" by simp |
|
2392 |
from linear_eq_0[OF linear_compose_sub[OF lf lg] S fg'] |
|
2393 |
show ?thesis by simp |
|
2394 |
qed |
|
2395 |
||
2396 |
lemma linear_eq_stdbasis: |
|
| 56444 | 2397 |
fixes f :: "'a::euclidean_space \<Rightarrow> _" |
2398 |
assumes lf: "linear f" |
|
| 49663 | 2399 |
and lg: "linear g" |
|
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
|
2400 |
and fg: "\<forall>b\<in>Basis. f b = g b" |
| 44133 | 2401 |
shows "f = g" |
|
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
|
2402 |
using linear_eq[OF lf lg, of _ Basis] fg by auto |
| 44133 | 2403 |
|
2404 |
text {* Similar results for bilinear functions. *}
|
|
2405 |
||
2406 |
lemma bilinear_eq: |
|
2407 |
assumes bf: "bilinear f" |
|
| 49522 | 2408 |
and bg: "bilinear g" |
| 53406 | 2409 |
and SB: "S \<subseteq> span B" |
2410 |
and TC: "T \<subseteq> span C" |
|
| 49522 | 2411 |
and fg: "\<forall>x\<in> B. \<forall>y\<in> C. f x y = g x y" |
| 44133 | 2412 |
shows "\<forall>x\<in>S. \<forall>y\<in>T. f x y = g x y " |
| 49663 | 2413 |
proof - |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
2414 |
let ?P = "{x. \<forall>y\<in> span C. f x y = g x y}"
|
| 44133 | 2415 |
from bf bg have sp: "subspace ?P" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
2416 |
unfolding bilinear_def linear_iff subspace_def bf bg |
| 49663 | 2417 |
by (auto simp add: span_0 bilinear_lzero[OF bf] bilinear_lzero[OF bg] span_add Ball_def |
2418 |
intro: bilinear_ladd[OF bf]) |
|
| 44133 | 2419 |
|
2420 |
have "\<forall>x \<in> span B. \<forall>y\<in> span C. f x y = g x y" |
|
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
2421 |
apply (rule span_induct' [OF _ sp]) |
| 44133 | 2422 |
apply (rule ballI) |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
2423 |
apply (rule span_induct') |
|
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44166
diff
changeset
|
2424 |
apply (simp add: fg) |
| 44133 | 2425 |
apply (auto simp add: subspace_def) |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53596
diff
changeset
|
2426 |
using bf bg unfolding bilinear_def linear_iff |
| 49522 | 2427 |
apply (auto simp add: span_0 bilinear_rzero[OF bf] bilinear_rzero[OF bg] span_add Ball_def |
| 49663 | 2428 |
intro: bilinear_ladd[OF bf]) |
| 49522 | 2429 |
done |
| 53406 | 2430 |
then show ?thesis |
2431 |
using SB TC by auto |
|
| 44133 | 2432 |
qed |
2433 |
||
| 49522 | 2434 |
lemma bilinear_eq_stdbasis: |
| 53406 | 2435 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> _" |
| 44133 | 2436 |
assumes bf: "bilinear f" |
| 49522 | 2437 |
and bg: "bilinear g" |
|
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
|
2438 |
and fg: "\<forall>i\<in>Basis. \<forall>j\<in>Basis. f i j = g i j" |
| 44133 | 2439 |
shows "f = g" |
|
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
|
2440 |
using bilinear_eq[OF bf bg equalityD2[OF span_Basis] equalityD2[OF span_Basis] fg] by blast |
| 44133 | 2441 |
|
2442 |
text {* Detailed theorems about left and right invertibility in general case. *}
|
|
2443 |
||
| 49522 | 2444 |
lemma linear_injective_left_inverse: |
| 56444 | 2445 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
2446 |
assumes lf: "linear f" |
|
2447 |
and fi: "inj f" |
|
2448 |
shows "\<exists>g. linear g \<and> g \<circ> f = id" |
|
| 49522 | 2449 |
proof - |
|
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
|
2450 |
from linear_independent_extend[OF independent_injective_image, OF independent_Basis, OF lf fi] |
| 56444 | 2451 |
obtain h :: "'b \<Rightarrow> 'a" where h: "linear h" "\<forall>x \<in> f ` Basis. h x = inv f x" |
| 53406 | 2452 |
by blast |
|
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
|
2453 |
from h(2) have th: "\<forall>i\<in>Basis. (h \<circ> f) i = id i" |
| 44133 | 2454 |
using inv_o_cancel[OF fi, unfolded fun_eq_iff id_def o_def] |
2455 |
by auto |
|
2456 |
from linear_eq_stdbasis[OF linear_compose[OF lf h(1)] linear_id th] |
|
| 56444 | 2457 |
have "h \<circ> f = id" . |
| 53406 | 2458 |
then show ?thesis |
2459 |
using h(1) by blast |
|
| 44133 | 2460 |
qed |
2461 |
||
| 49522 | 2462 |
lemma linear_surjective_right_inverse: |
| 53406 | 2463 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
2464 |
assumes lf: "linear f" |
|
2465 |
and sf: "surj f" |
|
| 56444 | 2466 |
shows "\<exists>g. linear g \<and> f \<circ> g = id" |
| 49522 | 2467 |
proof - |
|
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
|
2468 |
from linear_independent_extend[OF independent_Basis[where 'a='b],of "inv f"] |
| 56444 | 2469 |
obtain h :: "'b \<Rightarrow> 'a" where h: "linear h" "\<forall>x\<in>Basis. h x = inv f x" |
| 53406 | 2470 |
by blast |
| 56444 | 2471 |
from h(2) have th: "\<forall>i\<in>Basis. (f \<circ> h) i = id i" |
|
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
|
2472 |
using sf by (auto simp add: surj_iff_all) |
| 44133 | 2473 |
from linear_eq_stdbasis[OF linear_compose[OF h(1) lf] linear_id th] |
| 56444 | 2474 |
have "f \<circ> h = id" . |
| 53406 | 2475 |
then show ?thesis |
2476 |
using h(1) by blast |
|
| 44133 | 2477 |
qed |
2478 |
||
2479 |
text {* An injective map @{typ "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"} is also surjective. *}
|
|
2480 |
||
| 49522 | 2481 |
lemma linear_injective_imp_surjective: |
| 56444 | 2482 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'a::euclidean_space" |
| 53406 | 2483 |
assumes lf: "linear f" |
2484 |
and fi: "inj f" |
|
| 44133 | 2485 |
shows "surj f" |
| 49522 | 2486 |
proof - |
| 44133 | 2487 |
let ?U = "UNIV :: 'a set" |
2488 |
from basis_exists[of ?U] obtain B |
|
2489 |
where B: "B \<subseteq> ?U" "independent B" "?U \<subseteq> span B" "card B = dim ?U" |
|
2490 |
by blast |
|
| 53406 | 2491 |
from B(4) have d: "dim ?U = card B" |
2492 |
by simp |
|
| 44133 | 2493 |
have th: "?U \<subseteq> span (f ` B)" |
2494 |
apply (rule card_ge_dim_independent) |
|
2495 |
apply blast |
|
2496 |
apply (rule independent_injective_image[OF B(2) lf fi]) |
|
2497 |
apply (rule order_eq_refl) |
|
2498 |
apply (rule sym) |
|
2499 |
unfolding d |
|
2500 |
apply (rule card_image) |
|
2501 |
apply (rule subset_inj_on[OF fi]) |
|
| 49522 | 2502 |
apply blast |
2503 |
done |
|
| 44133 | 2504 |
from th show ?thesis |
2505 |
unfolding span_linear_image[OF lf] surj_def |
|
2506 |
using B(3) by blast |
|
2507 |
qed |
|
2508 |
||
2509 |
text {* And vice versa. *}
|
|
2510 |
||
2511 |
lemma surjective_iff_injective_gen: |
|
| 49663 | 2512 |
assumes fS: "finite S" |
2513 |
and fT: "finite T" |
|
2514 |
and c: "card S = card T" |
|
| 49522 | 2515 |
and ST: "f ` S \<subseteq> T" |
| 53406 | 2516 |
shows "(\<forall>y \<in> T. \<exists>x \<in> S. f x = y) \<longleftrightarrow> inj_on f S" |
2517 |
(is "?lhs \<longleftrightarrow> ?rhs") |
|
2518 |
proof |
|
2519 |
assume h: "?lhs" |
|
2520 |
{
|
|
2521 |
fix x y |
|
2522 |
assume x: "x \<in> S" |
|
2523 |
assume y: "y \<in> S" |
|
2524 |
assume f: "f x = f y" |
|
2525 |
from x fS have S0: "card S \<noteq> 0" |
|
2526 |
by auto |
|
2527 |
have "x = y" |
|
2528 |
proof (rule ccontr) |
|
| 53716 | 2529 |
assume xy: "\<not> ?thesis" |
| 53406 | 2530 |
have th: "card S \<le> card (f ` (S - {y}))"
|
2531 |
unfolding c |
|
2532 |
apply (rule card_mono) |
|
2533 |
apply (rule finite_imageI) |
|
2534 |
using fS apply simp |
|
2535 |
using h xy x y f unfolding subset_eq image_iff |
|
2536 |
apply auto |
|
2537 |
apply (case_tac "xa = f x") |
|
2538 |
apply (rule bexI[where x=x]) |
|
2539 |
apply auto |
|
2540 |
done |
|
| 53716 | 2541 |
also have " \<dots> \<le> card (S - {y})"
|
| 53406 | 2542 |
apply (rule card_image_le) |
2543 |
using fS by simp |
|
2544 |
also have "\<dots> \<le> card S - 1" using y fS by simp |
|
2545 |
finally show False using S0 by arith |
|
2546 |
qed |
|
2547 |
} |
|
2548 |
then show ?rhs |
|
2549 |
unfolding inj_on_def by blast |
|
2550 |
next |
|
2551 |
assume h: ?rhs |
|
2552 |
have "f ` S = T" |
|
2553 |
apply (rule card_subset_eq[OF fT ST]) |
|
2554 |
unfolding card_image[OF h] |
|
2555 |
apply (rule c) |
|
2556 |
done |
|
2557 |
then show ?lhs by blast |
|
| 44133 | 2558 |
qed |
2559 |
||
| 49522 | 2560 |
lemma linear_surjective_imp_injective: |
| 53406 | 2561 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'a::euclidean_space" |
2562 |
assumes lf: "linear f" |
|
2563 |
and sf: "surj f" |
|
| 44133 | 2564 |
shows "inj f" |
| 49522 | 2565 |
proof - |
| 44133 | 2566 |
let ?U = "UNIV :: 'a set" |
2567 |
from basis_exists[of ?U] obtain B |
|
2568 |
where B: "B \<subseteq> ?U" "independent B" "?U \<subseteq> span B" and d: "card B = dim ?U" |
|
2569 |
by blast |
|
| 53406 | 2570 |
{
|
2571 |
fix x |
|
2572 |
assume x: "x \<in> span B" |
|
2573 |
assume fx: "f x = 0" |
|
2574 |
from B(2) have fB: "finite B" |
|
2575 |
using independent_bound by auto |
|
| 44133 | 2576 |
have fBi: "independent (f ` B)" |
2577 |
apply (rule card_le_dim_spanning[of "f ` B" ?U]) |
|
2578 |
apply blast |
|
2579 |
using sf B(3) |
|
2580 |
unfolding span_linear_image[OF lf] surj_def subset_eq image_iff |
|
2581 |
apply blast |
|
2582 |
using fB apply blast |
|
2583 |
unfolding d[symmetric] |
|
2584 |
apply (rule card_image_le) |
|
2585 |
apply (rule fB) |
|
2586 |
done |
|
2587 |
have th0: "dim ?U \<le> card (f ` B)" |
|
2588 |
apply (rule span_card_ge_dim) |
|
2589 |
apply blast |
|
2590 |
unfolding span_linear_image[OF lf] |
|
2591 |
apply (rule subset_trans[where B = "f ` UNIV"]) |
|
| 53406 | 2592 |
using sf unfolding surj_def |
2593 |
apply blast |
|
| 44133 | 2594 |
apply (rule image_mono) |
2595 |
apply (rule B(3)) |
|
2596 |
apply (metis finite_imageI fB) |
|
2597 |
done |
|
2598 |
moreover have "card (f ` B) \<le> card B" |
|
2599 |
by (rule card_image_le, rule fB) |
|
| 53406 | 2600 |
ultimately have th1: "card B = card (f ` B)" |
2601 |
unfolding d by arith |
|
| 44133 | 2602 |
have fiB: "inj_on f B" |
| 49522 | 2603 |
unfolding surjective_iff_injective_gen[OF fB finite_imageI[OF fB] th1 subset_refl, symmetric] |
2604 |
by blast |
|
| 44133 | 2605 |
from linear_indep_image_lemma[OF lf fB fBi fiB x] fx |
| 53406 | 2606 |
have "x = 0" by blast |
2607 |
} |
|
2608 |
then show ?thesis |
|
2609 |
unfolding linear_injective_0[OF lf] |
|
2610 |
using B(3) |
|
2611 |
by blast |
|
| 44133 | 2612 |
qed |
2613 |
||
2614 |
text {* Hence either is enough for isomorphism. *}
|
|
2615 |
||
2616 |
lemma left_right_inverse_eq: |
|
| 53406 | 2617 |
assumes fg: "f \<circ> g = id" |
2618 |
and gh: "g \<circ> h = id" |
|
| 44133 | 2619 |
shows "f = h" |
| 49522 | 2620 |
proof - |
| 53406 | 2621 |
have "f = f \<circ> (g \<circ> h)" |
2622 |
unfolding gh by simp |
|
2623 |
also have "\<dots> = (f \<circ> g) \<circ> h" |
|
2624 |
by (simp add: o_assoc) |
|
2625 |
finally show "f = h" |
|
2626 |
unfolding fg by simp |
|
| 44133 | 2627 |
qed |
2628 |
||
2629 |
lemma isomorphism_expand: |
|
| 53406 | 2630 |
"f \<circ> g = id \<and> g \<circ> f = id \<longleftrightarrow> (\<forall>x. f (g x) = x) \<and> (\<forall>x. g (f x) = x)" |
| 44133 | 2631 |
by (simp add: fun_eq_iff o_def id_def) |
2632 |
||
| 49522 | 2633 |
lemma linear_injective_isomorphism: |
| 56444 | 2634 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'a::euclidean_space" |
| 53406 | 2635 |
assumes lf: "linear f" |
2636 |
and fi: "inj f" |
|
| 44133 | 2637 |
shows "\<exists>f'. linear f' \<and> (\<forall>x. f' (f x) = x) \<and> (\<forall>x. f (f' x) = x)" |
| 49522 | 2638 |
unfolding isomorphism_expand[symmetric] |
2639 |
using linear_surjective_right_inverse[OF lf linear_injective_imp_surjective[OF lf fi]] |
|
2640 |
linear_injective_left_inverse[OF lf fi] |
|
2641 |
by (metis left_right_inverse_eq) |
|
| 44133 | 2642 |
|
| 53406 | 2643 |
lemma linear_surjective_isomorphism: |
2644 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'a::euclidean_space" |
|
2645 |
assumes lf: "linear f" |
|
2646 |
and sf: "surj f" |
|
| 44133 | 2647 |
shows "\<exists>f'. linear f' \<and> (\<forall>x. f' (f x) = x) \<and> (\<forall>x. f (f' x) = x)" |
| 49522 | 2648 |
unfolding isomorphism_expand[symmetric] |
2649 |
using linear_surjective_right_inverse[OF lf sf] |
|
2650 |
linear_injective_left_inverse[OF lf linear_surjective_imp_injective[OF lf sf]] |
|
2651 |
by (metis left_right_inverse_eq) |
|
| 44133 | 2652 |
|
| 53406 | 2653 |
text {* Left and right inverses are the same for
|
2654 |
@{typ "'a::euclidean_space \<Rightarrow> 'a::euclidean_space"}. *}
|
|
| 44133 | 2655 |
|
| 49522 | 2656 |
lemma linear_inverse_left: |
| 53406 | 2657 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'a::euclidean_space" |
2658 |
assumes lf: "linear f" |
|
2659 |
and lf': "linear f'" |
|
2660 |
shows "f \<circ> f' = id \<longleftrightarrow> f' \<circ> f = id" |
|
| 49522 | 2661 |
proof - |
| 53406 | 2662 |
{
|
2663 |
fix f f':: "'a \<Rightarrow> 'a" |
|
2664 |
assume lf: "linear f" "linear f'" |
|
2665 |
assume f: "f \<circ> f' = id" |
|
| 44133 | 2666 |
from f have sf: "surj f" |
2667 |
apply (auto simp add: o_def id_def surj_def) |
|
| 49522 | 2668 |
apply metis |
2669 |
done |
|
| 44133 | 2670 |
from linear_surjective_isomorphism[OF lf(1) sf] lf f |
| 53406 | 2671 |
have "f' \<circ> f = id" |
2672 |
unfolding fun_eq_iff o_def id_def by metis |
|
2673 |
} |
|
2674 |
then show ?thesis |
|
2675 |
using lf lf' by metis |
|
| 44133 | 2676 |
qed |
2677 |
||
2678 |
text {* Moreover, a one-sided inverse is automatically linear. *}
|
|
2679 |
||
| 49522 | 2680 |
lemma left_inverse_linear: |
| 53406 | 2681 |
fixes f :: "'a::euclidean_space \<Rightarrow> 'a::euclidean_space" |
2682 |
assumes lf: "linear f" |
|
2683 |
and gf: "g \<circ> f = id" |
|
| 44133 | 2684 |
shows "linear g" |
| 49522 | 2685 |
proof - |
2686 |
from gf have fi: "inj f" |
|
2687 |
apply (auto simp add: inj_on_def o_def id_def fun_eq_iff) |
|
2688 |
apply metis |
|
2689 |
done |
|
| 44133 | 2690 |
from linear_injective_isomorphism[OF lf fi] |
| 53406 | 2691 |
obtain h :: "'a \<Rightarrow> 'a" where h: "linear h" "\<forall>x. h (f x) = x" "\<forall>x. f (h x) = x" |
2692 |
by blast |
|
| 49522 | 2693 |
have "h = g" |
2694 |
apply (rule ext) using gf h(2,3) |
|
| 44133 | 2695 |
apply (simp add: o_def id_def fun_eq_iff) |
| 49522 | 2696 |
apply metis |
2697 |
done |
|
| 44133 | 2698 |
with h(1) show ?thesis by blast |
2699 |
qed |
|
2700 |
||
| 49522 | 2701 |
|
| 44133 | 2702 |
subsection {* Infinity norm *}
|
2703 |
||
| 56444 | 2704 |
definition "infnorm (x::'a::euclidean_space) = Sup {\<bar>x \<bullet> b\<bar> |b. b \<in> Basis}"
|
| 44133 | 2705 |
|
2706 |
lemma infnorm_set_image: |
|
| 53716 | 2707 |
fixes x :: "'a::euclidean_space" |
| 56444 | 2708 |
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
|
2709 |
by blast |
| 44133 | 2710 |
|
| 53716 | 2711 |
lemma infnorm_Max: |
2712 |
fixes x :: "'a::euclidean_space" |
|
| 56444 | 2713 |
shows "infnorm x = Max ((\<lambda>i. \<bar>x \<bullet> i\<bar>) ` Basis)" |
| 56166 | 2714 |
by (simp add: infnorm_def infnorm_set_image cSup_eq_Max del: Sup_image_eq) |
|
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
2715 |
|
| 44133 | 2716 |
lemma infnorm_set_lemma: |
| 53716 | 2717 |
fixes x :: "'a::euclidean_space" |
| 56444 | 2718 |
shows "finite {\<bar>x \<bullet> i\<bar> |i. i \<in> Basis}"
|
2719 |
and "{\<bar>x \<bullet> i\<bar> |i. i \<in> Basis} \<noteq> {}"
|
|
| 44133 | 2720 |
unfolding infnorm_set_image |
2721 |
by auto |
|
2722 |
||
| 53406 | 2723 |
lemma infnorm_pos_le: |
2724 |
fixes x :: "'a::euclidean_space" |
|
2725 |
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
|
2726 |
by (simp add: infnorm_Max Max_ge_iff ex_in_conv) |
| 44133 | 2727 |
|
| 53406 | 2728 |
lemma infnorm_triangle: |
2729 |
fixes x :: "'a::euclidean_space" |
|
2730 |
shows "infnorm (x + y) \<le> infnorm x + infnorm y" |
|
| 49522 | 2731 |
proof - |
|
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
2732 |
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
|
2733 |
by simp |
| 44133 | 2734 |
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
|
2735 |
by (auto simp: infnorm_Max inner_add_left intro!: *) |
| 44133 | 2736 |
qed |
2737 |
||
| 53406 | 2738 |
lemma infnorm_eq_0: |
2739 |
fixes x :: "'a::euclidean_space" |
|
2740 |
shows "infnorm x = 0 \<longleftrightarrow> x = 0" |
|
| 49522 | 2741 |
proof - |
|
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
2742 |
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
|
2743 |
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
|
2744 |
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
|
2745 |
using infnorm_pos_le[of x] by simp |
| 44133 | 2746 |
qed |
2747 |
||
2748 |
lemma infnorm_0: "infnorm 0 = 0" |
|
2749 |
by (simp add: infnorm_eq_0) |
|
2750 |
||
2751 |
lemma infnorm_neg: "infnorm (- x) = infnorm x" |
|
2752 |
unfolding infnorm_def |
|
2753 |
apply (rule cong[of "Sup" "Sup"]) |
|
| 49522 | 2754 |
apply blast |
2755 |
apply auto |
|
2756 |
done |
|
| 44133 | 2757 |
|
2758 |
lemma infnorm_sub: "infnorm (x - y) = infnorm (y - x)" |
|
| 49522 | 2759 |
proof - |
| 44133 | 2760 |
have "y - x = - (x - y)" by simp |
| 53406 | 2761 |
then show ?thesis |
2762 |
by (metis infnorm_neg) |
|
| 44133 | 2763 |
qed |
2764 |
||
| 53406 | 2765 |
lemma real_abs_sub_infnorm: "\<bar>infnorm x - infnorm y\<bar> \<le> infnorm (x - y)" |
| 49522 | 2766 |
proof - |
| 56444 | 2767 |
have th: "\<And>(nx::real) n ny. nx \<le> n + ny \<Longrightarrow> ny \<le> n + nx \<Longrightarrow> \<bar>nx - ny\<bar> \<le> n" |
| 44133 | 2768 |
by arith |
2769 |
from infnorm_triangle[of "x - y" " y"] infnorm_triangle[of "x - y" "-x"] |
|
2770 |
have ths: "infnorm x \<le> infnorm (x - y) + infnorm y" |
|
2771 |
"infnorm y \<le> infnorm (x - y) + infnorm x" |
|
| 44454 | 2772 |
by (simp_all add: field_simps infnorm_neg) |
| 53406 | 2773 |
from th[OF ths] show ?thesis . |
| 44133 | 2774 |
qed |
2775 |
||
| 53406 | 2776 |
lemma real_abs_infnorm: "\<bar>infnorm x\<bar> = infnorm x" |
| 44133 | 2777 |
using infnorm_pos_le[of x] by arith |
2778 |
||
|
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
|
2779 |
lemma Basis_le_infnorm: |
| 53406 | 2780 |
fixes x :: "'a::euclidean_space" |
2781 |
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
|
2782 |
by (simp add: infnorm_Max) |
| 44133 | 2783 |
|
| 56444 | 2784 |
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
|
2785 |
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
|
2786 |
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
|
2787 |
let ?B = "(\<lambda>i. \<bar>x \<bullet> i\<bar>) ` Basis" |
| 53406 | 2788 |
{
|
2789 |
fix b :: 'a |
|
2790 |
assume "b \<in> Basis" |
|
2791 |
then show "\<bar>a *\<^sub>R x \<bullet> b\<bar> \<le> \<bar>a\<bar> * Max ?B" |
|
2792 |
by (simp add: abs_mult mult_left_mono) |
|
2793 |
next |
|
2794 |
from Max_in[of ?B] obtain b where "b \<in> Basis" "Max ?B = \<bar>x \<bullet> b\<bar>" |
|
2795 |
by (auto simp del: Max_in) |
|
2796 |
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" |
|
2797 |
by (intro image_eqI[where x=b]) (auto simp: abs_mult) |
|
2798 |
} |
|
|
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
2799 |
qed simp |
|
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
2800 |
|
| 53406 | 2801 |
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
|
2802 |
unfolding infnorm_mul .. |
| 44133 | 2803 |
|
2804 |
lemma infnorm_pos_lt: "infnorm x > 0 \<longleftrightarrow> x \<noteq> 0" |
|
2805 |
using infnorm_pos_le[of x] infnorm_eq_0[of x] by arith |
|
2806 |
||
2807 |
text {* Prove that it differs only up to a bound from Euclidean norm. *}
|
|
2808 |
||
2809 |
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
|
2810 |
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
|
2811 |
|
|
54776
db890d9fc5c2
ordered_euclidean_space compatible with more standard pointwise ordering on products; conditionally complete lattice with product order
immler
parents:
54703
diff
changeset
|
2812 |
lemma (in euclidean_space) euclidean_inner: "inner x y = (\<Sum>b\<in>Basis. (x \<bullet> b) * (y \<bullet> b))" |
|
db890d9fc5c2
ordered_euclidean_space compatible with more standard pointwise ordering on products; conditionally complete lattice with product order
immler
parents:
54703
diff
changeset
|
2813 |
by (subst (1 2) euclidean_representation[symmetric]) |
|
db890d9fc5c2
ordered_euclidean_space compatible with more standard pointwise ordering on products; conditionally complete lattice with product order
immler
parents:
54703
diff
changeset
|
2814 |
(simp add: inner_setsum_left inner_setsum_right setsum_cases inner_Basis ac_simps if_distrib) |
|
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
|
2815 |
|
| 53716 | 2816 |
lemma norm_le_infnorm: |
2817 |
fixes x :: "'a::euclidean_space" |
|
2818 |
shows "norm x \<le> sqrt DIM('a) * infnorm x"
|
|
| 49522 | 2819 |
proof - |
| 44133 | 2820 |
let ?d = "DIM('a)"
|
| 53406 | 2821 |
have "real ?d \<ge> 0" |
2822 |
by simp |
|
| 53077 | 2823 |
then have d2: "(sqrt (real ?d))\<^sup>2 = real ?d" |
| 44133 | 2824 |
by (auto intro: real_sqrt_pow2) |
2825 |
have th: "sqrt (real ?d) * infnorm x \<ge> 0" |
|
2826 |
by (simp add: zero_le_mult_iff infnorm_pos_le) |
|
| 53077 | 2827 |
have th1: "x \<bullet> x \<le> (sqrt (real ?d) * infnorm x)\<^sup>2" |
| 44133 | 2828 |
unfolding power_mult_distrib d2 |
|
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
|
2829 |
unfolding real_of_nat_def |
| 53716 | 2830 |
apply (subst euclidean_inner) |
| 44133 | 2831 |
apply (subst power2_abs[symmetric]) |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51478
diff
changeset
|
2832 |
apply (rule order_trans[OF setsum_bounded[where K="\<bar>infnorm x\<bar>\<^sup>2"]]) |
| 49663 | 2833 |
apply (auto simp add: power2_eq_square[symmetric]) |
| 44133 | 2834 |
apply (subst power2_abs[symmetric]) |
2835 |
apply (rule power_mono) |
|
|
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50526
diff
changeset
|
2836 |
apply (auto simp: infnorm_Max) |
| 49522 | 2837 |
done |
| 44133 | 2838 |
from real_le_lsqrt[OF inner_ge_zero th th1] |
| 53406 | 2839 |
show ?thesis |
2840 |
unfolding norm_eq_sqrt_inner id_def . |
|
| 44133 | 2841 |
qed |
2842 |
||
| 44646 | 2843 |
lemma tendsto_infnorm [tendsto_intros]: |
| 49522 | 2844 |
assumes "(f ---> a) F" |
2845 |
shows "((\<lambda>x. infnorm (f x)) ---> infnorm a) F" |
|
| 44646 | 2846 |
proof (rule tendsto_compose [OF LIM_I assms]) |
| 53406 | 2847 |
fix r :: real |
2848 |
assume "r > 0" |
|
| 49522 | 2849 |
then show "\<exists>s>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < s \<longrightarrow> norm (infnorm x - infnorm a) < r" |
| 44646 | 2850 |
by (metis real_norm_def le_less_trans real_abs_sub_infnorm infnorm_le_norm) |
2851 |
qed |
|
2852 |
||
| 44133 | 2853 |
text {* Equality in Cauchy-Schwarz and triangle inequalities. *}
|
2854 |
||
| 53406 | 2855 |
lemma norm_cauchy_schwarz_eq: "x \<bullet> y = norm x * norm y \<longleftrightarrow> norm x *\<^sub>R y = norm y *\<^sub>R x" |
2856 |
(is "?lhs \<longleftrightarrow> ?rhs") |
|
| 49522 | 2857 |
proof - |
| 53406 | 2858 |
{
|
2859 |
assume h: "x = 0" |
|
2860 |
then have ?thesis by simp |
|
2861 |
} |
|
| 44133 | 2862 |
moreover |
| 53406 | 2863 |
{
|
2864 |
assume h: "y = 0" |
|
2865 |
then have ?thesis by simp |
|
2866 |
} |
|
| 44133 | 2867 |
moreover |
| 53406 | 2868 |
{
|
2869 |
assume x: "x \<noteq> 0" and y: "y \<noteq> 0" |
|
| 44133 | 2870 |
from inner_eq_zero_iff[of "norm y *\<^sub>R x - norm x *\<^sub>R y"] |
| 49522 | 2871 |
have "?rhs \<longleftrightarrow> |
2872 |
(norm y * (norm y * norm x * norm x - norm x * (x \<bullet> y)) - |
|
2873 |
norm x * (norm y * (y \<bullet> x) - norm x * norm y * norm y) = 0)" |
|
| 44133 | 2874 |
using x y |
2875 |
unfolding inner_simps |
|
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53939
diff
changeset
|
2876 |
unfolding power2_norm_eq_inner[symmetric] power2_eq_square right_minus_eq |
| 49522 | 2877 |
apply (simp add: inner_commute) |
2878 |
apply (simp add: field_simps) |
|
2879 |
apply metis |
|
2880 |
done |
|
| 44133 | 2881 |
also have "\<dots> \<longleftrightarrow> (2 * norm x * norm y * (norm x * norm y - x \<bullet> y) = 0)" using x y |
2882 |
by (simp add: field_simps inner_commute) |
|
2883 |
also have "\<dots> \<longleftrightarrow> ?lhs" using x y |
|
2884 |
apply simp |
|
| 49522 | 2885 |
apply metis |
2886 |
done |
|
| 53406 | 2887 |
finally have ?thesis by blast |
2888 |
} |
|
| 44133 | 2889 |
ultimately show ?thesis by blast |
2890 |
qed |
|
2891 |
||
2892 |
lemma norm_cauchy_schwarz_abs_eq: |
|
| 56444 | 2893 |
"\<bar>x \<bullet> y\<bar> = norm x * norm y \<longleftrightarrow> |
| 53716 | 2894 |
norm x *\<^sub>R y = norm y *\<^sub>R x \<or> norm x *\<^sub>R y = - norm y *\<^sub>R x" |
| 53406 | 2895 |
(is "?lhs \<longleftrightarrow> ?rhs") |
| 49522 | 2896 |
proof - |
| 56444 | 2897 |
have th: "\<And>(x::real) a. a \<ge> 0 \<Longrightarrow> \<bar>x\<bar> = a \<longleftrightarrow> x = a \<or> x = - a" |
| 53406 | 2898 |
by arith |
| 44133 | 2899 |
have "?rhs \<longleftrightarrow> norm x *\<^sub>R y = norm y *\<^sub>R x \<or> norm (- x) *\<^sub>R y = norm y *\<^sub>R (- x)" |
2900 |
by simp |
|
| 53406 | 2901 |
also have "\<dots> \<longleftrightarrow>(x \<bullet> y = norm x * norm y \<or> (- x) \<bullet> y = norm x * norm y)" |
| 44133 | 2902 |
unfolding norm_cauchy_schwarz_eq[symmetric] |
2903 |
unfolding norm_minus_cancel norm_scaleR .. |
|
2904 |
also have "\<dots> \<longleftrightarrow> ?lhs" |
|
| 53406 | 2905 |
unfolding th[OF mult_nonneg_nonneg, OF norm_ge_zero[of x] norm_ge_zero[of y]] inner_simps |
2906 |
by auto |
|
| 44133 | 2907 |
finally show ?thesis .. |
2908 |
qed |
|
2909 |
||
2910 |
lemma norm_triangle_eq: |
|
2911 |
fixes x y :: "'a::real_inner" |
|
| 53406 | 2912 |
shows "norm (x + y) = norm x + norm y \<longleftrightarrow> norm x *\<^sub>R y = norm y *\<^sub>R x" |
| 49522 | 2913 |
proof - |
| 53406 | 2914 |
{
|
2915 |
assume x: "x = 0 \<or> y = 0" |
|
2916 |
then have ?thesis |
|
2917 |
by (cases "x = 0") simp_all |
|
2918 |
} |
|
| 44133 | 2919 |
moreover |
| 53406 | 2920 |
{
|
2921 |
assume x: "x \<noteq> 0" and y: "y \<noteq> 0" |
|
| 49522 | 2922 |
then have "norm x \<noteq> 0" "norm y \<noteq> 0" |
| 44133 | 2923 |
by simp_all |
| 49522 | 2924 |
then have n: "norm x > 0" "norm y > 0" |
2925 |
using norm_ge_zero[of x] norm_ge_zero[of y] by arith+ |
|
| 53406 | 2926 |
have th: "\<And>(a::real) b c. a + b + c \<noteq> 0 \<Longrightarrow> a = b + c \<longleftrightarrow> a\<^sup>2 = (b + c)\<^sup>2" |
| 49522 | 2927 |
by algebra |
| 53077 | 2928 |
have "norm (x + y) = norm x + norm y \<longleftrightarrow> (norm (x + y))\<^sup>2 = (norm x + norm y)\<^sup>2" |
| 53406 | 2929 |
apply (rule th) |
2930 |
using n norm_ge_zero[of "x + y"] |
|
| 49522 | 2931 |
apply arith |
2932 |
done |
|
| 44133 | 2933 |
also have "\<dots> \<longleftrightarrow> norm x *\<^sub>R y = norm y *\<^sub>R x" |
2934 |
unfolding norm_cauchy_schwarz_eq[symmetric] |
|
2935 |
unfolding power2_norm_eq_inner inner_simps |
|
2936 |
by (simp add: power2_norm_eq_inner[symmetric] power2_eq_square inner_commute field_simps) |
|
| 53406 | 2937 |
finally have ?thesis . |
2938 |
} |
|
| 44133 | 2939 |
ultimately show ?thesis by blast |
2940 |
qed |
|
2941 |
||
| 49522 | 2942 |
|
| 44133 | 2943 |
subsection {* Collinearity *}
|
2944 |
||
| 49522 | 2945 |
definition collinear :: "'a::real_vector set \<Rightarrow> bool" |
2946 |
where "collinear S \<longleftrightarrow> (\<exists>u. \<forall>x \<in> S. \<forall> y \<in> S. \<exists>c. x - y = c *\<^sub>R u)" |
|
| 44133 | 2947 |
|
| 53406 | 2948 |
lemma collinear_empty: "collinear {}"
|
2949 |
by (simp add: collinear_def) |
|
| 44133 | 2950 |
|
2951 |
lemma collinear_sing: "collinear {x}"
|
|
2952 |
by (simp add: collinear_def) |
|
2953 |
||
2954 |
lemma collinear_2: "collinear {x, y}"
|
|
2955 |
apply (simp add: collinear_def) |
|
2956 |
apply (rule exI[where x="x - y"]) |
|
2957 |
apply auto |
|
2958 |
apply (rule exI[where x=1], simp) |
|
2959 |
apply (rule exI[where x="- 1"], simp) |
|
2960 |
done |
|
2961 |
||
| 56444 | 2962 |
lemma collinear_lemma: "collinear {0, x, y} \<longleftrightarrow> x = 0 \<or> y = 0 \<or> (\<exists>c. y = c *\<^sub>R x)"
|
| 53406 | 2963 |
(is "?lhs \<longleftrightarrow> ?rhs") |
| 49522 | 2964 |
proof - |
| 53406 | 2965 |
{
|
2966 |
assume "x = 0 \<or> y = 0" |
|
2967 |
then have ?thesis |
|
2968 |
by (cases "x = 0") (simp_all add: collinear_2 insert_commute) |
|
2969 |
} |
|
| 44133 | 2970 |
moreover |
| 53406 | 2971 |
{
|
2972 |
assume x: "x \<noteq> 0" and y: "y \<noteq> 0" |
|
2973 |
have ?thesis |
|
2974 |
proof |
|
2975 |
assume h: "?lhs" |
|
| 49522 | 2976 |
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"
|
2977 |
unfolding collinear_def by blast |
|
| 44133 | 2978 |
from u[rule_format, of x 0] u[rule_format, of y 0] |
2979 |
obtain cx and cy where |
|
2980 |
cx: "x = cx *\<^sub>R u" and cy: "y = cy *\<^sub>R u" |
|
2981 |
by auto |
|
2982 |
from cx x have cx0: "cx \<noteq> 0" by auto |
|
2983 |
from cy y have cy0: "cy \<noteq> 0" by auto |
|
2984 |
let ?d = "cy / cx" |
|
2985 |
from cx cy cx0 have "y = ?d *\<^sub>R x" |
|
2986 |
by simp |
|
| 53406 | 2987 |
then show ?rhs using x y by blast |
2988 |
next |
|
2989 |
assume h: "?rhs" |
|
2990 |
then obtain c where c: "y = c *\<^sub>R x" |
|
2991 |
using x y by blast |
|
2992 |
show ?lhs |
|
2993 |
unfolding collinear_def c |
|
| 44133 | 2994 |
apply (rule exI[where x=x]) |
2995 |
apply auto |
|
2996 |
apply (rule exI[where x="- 1"], simp) |
|
2997 |
apply (rule exI[where x= "-c"], simp) |
|
2998 |
apply (rule exI[where x=1], simp) |
|
2999 |
apply (rule exI[where x="1 - c"], simp add: scaleR_left_diff_distrib) |
|
3000 |
apply (rule exI[where x="c - 1"], simp add: scaleR_left_diff_distrib) |
|
| 53406 | 3001 |
done |
3002 |
qed |
|
3003 |
} |
|
| 44133 | 3004 |
ultimately show ?thesis by blast |
3005 |
qed |
|
3006 |
||
| 56444 | 3007 |
lemma norm_cauchy_schwarz_equal: "\<bar>x \<bullet> y\<bar> = norm x * norm y \<longleftrightarrow> collinear {0, x, y}"
|
| 49522 | 3008 |
unfolding norm_cauchy_schwarz_abs_eq |
3009 |
apply (cases "x=0", simp_all add: collinear_2) |
|
3010 |
apply (cases "y=0", simp_all add: collinear_2 insert_commute) |
|
3011 |
unfolding collinear_lemma |
|
3012 |
apply simp |
|
3013 |
apply (subgoal_tac "norm x \<noteq> 0") |
|
3014 |
apply (subgoal_tac "norm y \<noteq> 0") |
|
3015 |
apply (rule iffI) |
|
3016 |
apply (cases "norm x *\<^sub>R y = norm y *\<^sub>R x") |
|
3017 |
apply (rule exI[where x="(1/norm x) * norm y"]) |
|
3018 |
apply (drule sym) |
|
3019 |
unfolding scaleR_scaleR[symmetric] |
|
3020 |
apply (simp add: field_simps) |
|
3021 |
apply (rule exI[where x="(1/norm x) * - norm y"]) |
|
3022 |
apply clarify |
|
3023 |
apply (drule sym) |
|
3024 |
unfolding scaleR_scaleR[symmetric] |
|
3025 |
apply (simp add: field_simps) |
|
3026 |
apply (erule exE) |
|
3027 |
apply (erule ssubst) |
|
3028 |
unfolding scaleR_scaleR |
|
3029 |
unfolding norm_scaleR |
|
3030 |
apply (subgoal_tac "norm x * c = \<bar>c\<bar> * norm x \<or> norm x * c = - \<bar>c\<bar> * norm x") |
|
| 55775 | 3031 |
apply (auto simp add: field_simps) |
| 49522 | 3032 |
done |
3033 |
||
|
54776
db890d9fc5c2
ordered_euclidean_space compatible with more standard pointwise ordering on products; conditionally complete lattice with product order
immler
parents:
54703
diff
changeset
|
3034 |
end |