15 & a [*] x : U)"; |
15 & a [*] x : U)"; |
16 |
16 |
17 lemma subspaceI [intro]: |
17 lemma subspaceI [intro]: |
18 "[| <0>:U; U <= V; ALL x:U. ALL y:U. (x [+] y : U); ALL x:U. ALL a. a [*] x : U |] |
18 "[| <0>:U; U <= V; ALL x:U. ALL y:U. (x [+] y : U); ALL x:U. ALL a. a [*] x : U |] |
19 \ ==> is_subspace U V"; |
19 \ ==> is_subspace U V"; |
20 by (unfold is_subspace_def) (simp!); |
20 by (unfold is_subspace_def) simp; |
21 |
21 |
22 lemma "is_subspace U V ==> U ~= {}"; |
22 lemma "is_subspace U V ==> U ~= {}"; |
23 by (unfold is_subspace_def) force; |
23 by (unfold is_subspace_def) force; |
24 |
24 |
25 lemma zero_in_subspace [intro !!]: "is_subspace U V ==> <0>:U"; |
25 lemma zero_in_subspace [intro !!]: "is_subspace U V ==> <0>:U"; |
26 by (unfold is_subspace_def) (simp!);; |
26 by (unfold is_subspace_def) simp;; |
27 |
27 |
28 lemma subspace_subset [intro !!]: "is_subspace U V ==> U <= V"; |
28 lemma subspace_subset [intro !!]: "is_subspace U V ==> U <= V"; |
29 by (unfold is_subspace_def) (simp!); |
29 by (unfold is_subspace_def) simp; |
30 |
30 |
31 lemma subspace_subsetD [simp, intro!!]: "[| is_subspace U V; x:U |]==> x:V"; |
31 lemma subspace_subsetD [simp, intro!!]: "[| is_subspace U V; x:U |]==> x:V"; |
32 by (unfold is_subspace_def) force; |
32 by (unfold is_subspace_def) force; |
33 |
33 |
34 lemma subspace_add_closed [simp, intro!!]: "[| is_subspace U V; x: U; y: U |] ==> x [+] y: U"; |
34 lemma subspace_add_closed [simp, intro!!]: "[| is_subspace U V; x: U; y: U |] ==> x [+] y: U"; |
35 by (unfold is_subspace_def) (simp!); |
35 by (unfold is_subspace_def) simp; |
36 |
36 |
37 lemma subspace_mult_closed [simp, intro!!]: "[| is_subspace U V; x: U |] ==> a [*] x: U"; |
37 lemma subspace_mult_closed [simp, intro!!]: "[| is_subspace U V; x: U |] ==> a [*] x: U"; |
38 by (unfold is_subspace_def) (simp!); |
38 by (unfold is_subspace_def) simp; |
39 |
39 |
40 lemma subspace_diff_closed [simp, intro!!]: "[| is_subspace U V; x: U; y: U |] ==> x [-] y: U"; |
40 lemma subspace_diff_closed [simp, intro!!]: "[| is_subspace U V; x: U; y: U |] ==> x [-] y: U"; |
41 by (unfold diff_def negate_def) (simp!); |
41 by (unfold diff_def negate_def) simp; |
42 |
42 |
43 lemma subspace_neg_closed [simp, intro!!]: "[| is_subspace U V; x: U |] ==> [-] x: U"; |
43 lemma subspace_neg_closed [simp, intro!!]: "[| is_subspace U V; x: U |] ==> [-] x: U"; |
44 by (unfold negate_def) (simp!); |
44 by (unfold negate_def) simp; |
45 |
45 |
46 |
46 |
47 theorem subspace_vs [intro!!]: |
47 theorem subspace_vs [intro!!]: |
48 "[| is_subspace U V; is_vectorspace V |] ==> is_vectorspace U"; |
48 "[| is_subspace U V; is_vectorspace V |] ==> is_vectorspace U"; |
49 proof -; |
49 proof -; |
50 assume "is_subspace U V"; |
50 assume "is_subspace U V" "is_vectorspace V"; |
51 assume "is_vectorspace V"; |
|
52 assume "is_subspace U V"; |
|
53 show ?thesis; |
51 show ?thesis; |
54 proof; |
52 proof; |
55 show "<0>:U"; ..; |
53 show "<0>:U"; ..; |
56 show "ALL x:U. ALL a. a [*] x : U"; by (simp!); |
54 show "ALL x:U. ALL a. a [*] x : U"; by (simp!); |
57 show "ALL x:U. ALL y:U. x [+] y : U"; by (simp!); |
55 show "ALL x:U. ALL y:U. x [+] y : U"; by (simp!); |
230 qed; |
233 qed; |
231 |
234 |
232 |
235 |
233 section {* special case: direct sum of a vectorspace and a linear closure of a vector *}; |
236 section {* special case: direct sum of a vectorspace and a linear closure of a vector *}; |
234 |
237 |
|
238 lemma decomp: "[| is_vectorspace E; is_subspace U E; is_subspace V E; U Int V = {<0>}; |
|
239 u1:U; u2:U; v1:V; v2:V; u1 [+] v1 = u2 [+] v2 |] |
|
240 ==> u1 = u2 & v1 = v2"; |
|
241 proof; |
|
242 assume "is_vectorspace E" "is_subspace U E" "is_subspace V E" "U Int V = {<0>}" |
|
243 "u1:U" "u2:U" "v1:V" "v2:V" "u1 [+] v1 = u2 [+] v2"; |
|
244 have eq: "u1 [-] u2 = v2 [-] v1"; by (simp! add: vs_add_diff_swap); |
|
245 have u: "u1 [-] u2 : U"; by (simp!); with eq; have v': "v2 [-] v1 : U"; by simp; |
|
246 have v: "v2 [-] v1 : V"; by (simp!); with eq; have u': "u1 [-] u2 : V"; by simp; |
|
247 |
|
248 show "u1 = u2"; |
|
249 proof (rule vs_add_minus_eq); |
|
250 show "u1 [-] u2 = <0>"; by (rule Int_singletonD [OF _ u u']); |
|
251 qed (rule); |
|
252 |
|
253 show "v1 = v2"; |
|
254 proof (rule vs_add_minus_eq [RS sym]); |
|
255 show "v2 [-] v1 = <0>"; by (rule Int_singletonD [OF _ v' v]); |
|
256 qed (rule); |
|
257 qed; |
|
258 |
235 lemma decomp4: "[| is_vectorspace E; is_subspace H E; y1 : H; y2 : H; x0 ~: H; x0 :E; |
259 lemma decomp4: "[| is_vectorspace E; is_subspace H E; y1 : H; y2 : H; x0 ~: H; x0 :E; |
236 x0 ~= <0>; y1 [+] a1 [*] x0 = y2 [+] a2 [*] x0 |] |
260 x0 ~= <0>; y1 [+] a1 [*] x0 = y2 [+] a2 [*] x0 |] |
237 ==> y1 = y2 & a1 = a2"; |
261 ==> y1 = y2 & a1 = a2"; |
238 proof; |
262 proof; |
239 assume "is_vectorspace E" "is_subspace H E" |
263 assume "is_vectorspace E" and h: "is_subspace H E" |
240 "y1 : H" "y2 : H" "x0 ~: H" "x0 : E" "x0 ~= <0>" |
264 and "y1 : H" "y2 : H" "x0 ~: H" "x0 : E" "x0 ~= <0>" |
241 "y1 [+] a1 [*] x0 = y2 [+] a2 [*] x0"; |
265 "y1 [+] a1 [*] x0 = y2 [+] a2 [*] x0"; |
242 have h: "is_vectorspace H"; ..; |
266 |
243 have "y1 [-] y2 = a2 [*] x0 [-] a1 [*] x0"; |
267 have c: "y1 = y2 & a1 [*] x0 = a2 [*] x0"; |
244 by (simp! add: vs_add_diff_swap); |
268 proof (rule decomp); |
245 also; have "... = (a2 - a1) [*] x0"; |
269 show "a1 [*] x0 : lin x0"; ..; |
246 by (rule vs_diff_mult_distrib2 [RS sym]); |
270 show "a2 [*] x0 : lin x0"; ..; |
247 finally; have eq: "y1 [-] y2 = (a2 - a1) [*] x0"; .; |
271 show "H Int (lin x0) = {<0>}"; |
248 |
272 proof; |
249 have y: "y1 [-] y2 : H"; by (simp!); |
273 show "H Int lin x0 <= {<0>}"; |
250 have x: "(a2 - a1) [*] x0 : lin x0"; by (simp! add: lin_def) force; |
274 proof (intro subsetI, elim IntE, rule singleton_iff[RS iffD2]); |
251 from eq y x; have y': "y1 [-] y2 : lin x0"; by simp; |
275 fix x; assume "x:H" "x:lin x0"; |
252 from eq y x; have x': "(a2 - a1) [*] x0 : H"; by simp; |
276 thus "x = <0>"; |
253 |
277 proof (unfold lin_def, elim CollectE exE); |
254 have int: "H Int (lin x0) = {<0>}"; |
278 fix a; assume "x = a [*] x0"; |
255 proof; |
279 show ?thesis; |
256 show "H Int lin x0 <= {<0>}"; |
280 proof (rule case_split [of "a = 0r"]); |
257 proof (intro subsetI, elim IntE, rule singleton_iff[RS iffD2]); |
281 assume "a = 0r"; show ?thesis; by (simp!); |
258 fix x; assume "x:H" "x:lin x0"; |
282 next; |
259 thus "x = <0>"; |
283 assume "a ~= 0r"; |
260 proof (unfold lin_def, elim CollectE exE); |
284 from h; have "(rinv a) [*] a [*] x0 : H"; by (rule subspace_mult_closed) (simp!); |
261 fix a; assume "x = a [*] x0"; |
285 also; have "(rinv a) [*] a [*] x0 = x0"; by (simp!); |
262 show ?thesis; |
286 finally; have "x0 : H"; .; |
263 proof (rule case [of "a = 0r"]); |
287 thus ?thesis; by contradiction; |
264 assume "a = 0r"; show ?thesis; by (simp!); |
288 qed; |
265 next; |
289 qed; |
266 assume "a ~= 0r"; |
290 qed; |
267 have "(rinv a) [*] a [*] x0 : H"; |
291 show "{<0>} <= H Int lin x0"; |
268 by (rule vs_mult_closed [OF h]) (simp!); |
292 proof (intro subsetI, elim singletonE, intro IntI, simp+); |
269 also; have "(rinv a) [*] a [*] x0 = x0"; by (simp!); |
293 show "<0> : H"; ..; |
270 finally; have "x0 : H"; .; |
294 from lin_vs; show "<0> : lin x0"; ..; |
271 thus ?thesis; by contradiction; |
295 qed; |
272 qed; |
|
273 qed; |
|
274 qed; |
296 qed; |
275 show "{<0>} <= H Int lin x0"; |
297 show "is_subspace (lin x0) E"; ..; |
276 proof (intro subsetI, elim singletonE, intro IntI, simp+); |
298 qed; |
277 show "<0> : H"; ..; |
299 |
278 from lin_vs; show "<0> : lin x0"; ..; |
300 from c; show "y1 = y2"; by simp; |
279 qed; |
301 |
280 qed; |
302 show "a1 = a2"; |
281 |
303 proof (rule vs_mult_right_cancel [RS iffD1]); |
282 from h; show "y1 = y2"; |
304 from c; show "a1 [*] x0 = a2 [*] x0"; by simp; |
283 proof (rule vs_add_minus_eq); |
305 qed; |
284 show "y1 [-] y2 = <0>"; |
306 qed; |
285 by (rule Int_singletonD [OF int y y']); |
307 |
286 qed; |
|
287 |
|
288 show "a1 = a2"; |
|
289 proof (rule real_add_minus_eq [RS sym]); |
|
290 show "a2 - a1 = 0r"; |
|
291 proof (rule vs_mult_zero_uniq); |
|
292 show "(a2 - a1) [*] x0 = <0>"; by (rule Int_singletonD [OF int x' x]); |
|
293 qed; |
|
294 qed; |
|
295 qed; |
|
296 |
|
297 |
|
298 lemma decomp1: |
308 lemma decomp1: |
299 "[| is_vectorspace E; is_subspace H E; t:H; x0~:H; x0:E; x0 ~= <0> |] |
309 "[| is_vectorspace E; is_subspace H E; t:H; x0~:H; x0:E; x0 ~= <0> |] |
300 ==> (@ (y, a). t = y [+] a [*] x0 & y : H) = (t, 0r)"; |
310 ==> (@ (y, a). t = y [+] a [*] x0 & y : H) = (t, 0r)"; |
301 proof (rule, unfold split_paired_all); |
311 proof (rule, unfold split_paired_all); |
302 assume "is_vectorspace E" "is_subspace H E" "t:H" "x0~:H" "x0:E" "x0 ~= <0>"; |
312 assume "is_vectorspace E" "is_subspace H E" "t:H" "x0~:H" "x0:E" "x0 ~= <0>"; |
303 have h: "is_vectorspace H"; ..; |
313 have h: "is_vectorspace H"; ..; |
304 fix y a; presume t1: "t = y [+] a [*] x0" and "y : H"; |
314 fix y a; presume t1: "t = y [+] a [*] x0" and "y : H"; |
305 have "y = t & a = 0r"; |
315 have "y = t & a = 0r"; |
306 by (rule decomp4) (assumption+, (simp!)); |
316 by (rule decomp4) (assumption | (simp!))+; |
307 thus "(y, a) = (t, 0r)"; by (simp!); |
317 thus "(y, a) = (t, 0r)"; by (simp!); |
308 qed (simp!)+; |
318 qed (simp!)+; |
309 |
|
310 |
319 |
311 lemma decomp3: |
320 lemma decomp3: |
312 "[| h0 = (%x. let (y, a) = @ (y, a). (x = y [+] a [*] x0 & y:H) |
321 "[| h0 = (%x. let (y, a) = @ (y, a). (x = y [+] a [*] x0 & y:H) |
313 in (h y) + a * xi); |
322 in (h y) + a * xi); |
314 x = y [+] a [*] x0; |
323 x = y [+] a [*] x0; |
315 is_vectorspace E; is_subspace H E; y:H; x0 ~: H; x0:E; x0 ~= <0> |] |
324 is_vectorspace E; is_subspace H E; y:H; x0 ~: H; x0:E; x0 ~= <0> |] |
316 ==> h0 x = h y + a * xi"; |
325 ==> h0 x = h y + a * xi"; |
317 proof -; |
326 proof -; |
318 assume "h0 = (%x. let (y, a) = @ (y, a). (x = y [+] a [*] x0 & y:H) |
327 assume "h0 = (%x. let (y, a) = @ (y, a). (x = y [+] a [*] x0 & y:H) |
319 in (h y) + a * xi)"; |
328 in (h y) + a * xi)" |
320 assume "x = y [+] a [*] x0"; |
329 "x = y [+] a [*] x0" |
321 assume "is_vectorspace E" "is_subspace H E" "y:H" "x0 ~: H" "x0:E" "x0 ~= <0>"; |
330 "is_vectorspace E" "is_subspace H E" "y:H" "x0 ~: H" "x0:E" "x0 ~= <0>"; |
322 |
331 |
323 have "x : vectorspace_sum H (lin x0)"; |
332 have "x : vectorspace_sum H (lin x0)"; |
324 by (simp! add: vectorspace_sum_def lin_def, intro bexI exI conjI) force+; |
333 by (simp! add: vectorspace_sum_def lin_def, intro bexI exI conjI) force+; |
325 have "EX! xa. ((%(y, a). x = y [+] a [*] x0 & y:H) xa)"; |
334 have "EX! xa. ((%(y, a). x = y [+] a [*] x0 & y:H) xa)"; |
326 proof; |
335 proof%%; |
327 show "EX xa. ((%(y, a). x = y [+] a [*] x0 & y:H) xa)"; |
336 show "EX xa. ((%(y, a). x = y [+] a [*] x0 & y:H) xa)"; |
328 by (force!); |
337 by (force!); |
329 next; |
338 next; |
330 fix xa ya; |
339 fix xa ya; |
331 assume "(%(y,a). x = y [+] a [*] x0 & y : H) xa" |
340 assume "(%(y,a). x = y [+] a [*] x0 & y : H) xa" |