224 text {* |
224 text {* |
225 The \emph{sum} of two vectorspaces @{text U} and @{text V} is the |
225 The \emph{sum} of two vectorspaces @{text U} and @{text V} is the |
226 set of all sums of elements from @{text U} and @{text V}. |
226 set of all sums of elements from @{text U} and @{text V}. |
227 *} |
227 *} |
228 |
228 |
229 instantiation "fun" :: (type, type) plus |
229 lemma sum_def: "U \<oplus> V = {u + v | u v. u \<in> U \<and> v \<in> V}" |
230 begin |
230 unfolding set_plus_def by auto |
231 |
|
232 definition |
|
233 sum_def: "plus_fun U V = {u + v | u v. u \<in> U \<and> v \<in> V}" (* FIXME not fully general!? *) |
|
234 |
|
235 instance .. |
|
236 |
|
237 end |
|
238 |
231 |
239 lemma sumE [elim]: |
232 lemma sumE [elim]: |
240 "x \<in> U + V \<Longrightarrow> (\<And>u v. x = u + v \<Longrightarrow> u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> C) \<Longrightarrow> C" |
233 "x \<in> U \<oplus> V \<Longrightarrow> (\<And>u v. x = u + v \<Longrightarrow> u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> C) \<Longrightarrow> C" |
241 unfolding sum_def by blast |
234 unfolding sum_def by blast |
242 |
235 |
243 lemma sumI [intro]: |
236 lemma sumI [intro]: |
244 "u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> x = u + v \<Longrightarrow> x \<in> U + V" |
237 "u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> x = u + v \<Longrightarrow> x \<in> U \<oplus> V" |
245 unfolding sum_def by blast |
238 unfolding sum_def by blast |
246 |
239 |
247 lemma sumI' [intro]: |
240 lemma sumI' [intro]: |
248 "u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> u + v \<in> U + V" |
241 "u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> u + v \<in> U \<oplus> V" |
249 unfolding sum_def by blast |
242 unfolding sum_def by blast |
250 |
243 |
251 text {* @{text U} is a subspace of @{text "U + V"}. *} |
244 text {* @{text U} is a subspace of @{text "U \<oplus> V"}. *} |
252 |
245 |
253 lemma subspace_sum1 [iff]: |
246 lemma subspace_sum1 [iff]: |
254 assumes "vectorspace U" "vectorspace V" |
247 assumes "vectorspace U" "vectorspace V" |
255 shows "U \<unlhd> U + V" |
248 shows "U \<unlhd> U \<oplus> V" |
256 proof - |
249 proof - |
257 interpret vectorspace U by fact |
250 interpret vectorspace U by fact |
258 interpret vectorspace V by fact |
251 interpret vectorspace V by fact |
259 show ?thesis |
252 show ?thesis |
260 proof |
253 proof |
261 show "U \<noteq> {}" .. |
254 show "U \<noteq> {}" .. |
262 show "U \<subseteq> U + V" |
255 show "U \<subseteq> U \<oplus> V" |
263 proof |
256 proof |
264 fix x assume x: "x \<in> U" |
257 fix x assume x: "x \<in> U" |
265 moreover have "0 \<in> V" .. |
258 moreover have "0 \<in> V" .. |
266 ultimately have "x + 0 \<in> U + V" .. |
259 ultimately have "x + 0 \<in> U \<oplus> V" .. |
267 with x show "x \<in> U + V" by simp |
260 with x show "x \<in> U \<oplus> V" by simp |
268 qed |
261 qed |
269 fix x y assume x: "x \<in> U" and "y \<in> U" |
262 fix x y assume x: "x \<in> U" and "y \<in> U" |
270 then show "x + y \<in> U" by simp |
263 then show "x + y \<in> U" by simp |
271 from x show "\<And>a. a \<cdot> x \<in> U" by simp |
264 from x show "\<And>a. a \<cdot> x \<in> U" by simp |
272 qed |
265 qed |
274 |
267 |
275 text {* The sum of two subspaces is again a subspace. *} |
268 text {* The sum of two subspaces is again a subspace. *} |
276 |
269 |
277 lemma sum_subspace [intro?]: |
270 lemma sum_subspace [intro?]: |
278 assumes "subspace U E" "vectorspace E" "subspace V E" |
271 assumes "subspace U E" "vectorspace E" "subspace V E" |
279 shows "U + V \<unlhd> E" |
272 shows "U \<oplus> V \<unlhd> E" |
280 proof - |
273 proof - |
281 interpret subspace U E by fact |
274 interpret subspace U E by fact |
282 interpret vectorspace E by fact |
275 interpret vectorspace E by fact |
283 interpret subspace V E by fact |
276 interpret subspace V E by fact |
284 show ?thesis |
277 show ?thesis |
285 proof |
278 proof |
286 have "0 \<in> U + V" |
279 have "0 \<in> U \<oplus> V" |
287 proof |
280 proof |
288 show "0 \<in> U" using `vectorspace E` .. |
281 show "0 \<in> U" using `vectorspace E` .. |
289 show "0 \<in> V" using `vectorspace E` .. |
282 show "0 \<in> V" using `vectorspace E` .. |
290 show "(0::'a) = 0 + 0" by simp |
283 show "(0::'a) = 0 + 0" by simp |
291 qed |
284 qed |
292 then show "U + V \<noteq> {}" by blast |
285 then show "U \<oplus> V \<noteq> {}" by blast |
293 show "U + V \<subseteq> E" |
286 show "U \<oplus> V \<subseteq> E" |
294 proof |
287 proof |
295 fix x assume "x \<in> U + V" |
288 fix x assume "x \<in> U \<oplus> V" |
296 then obtain u v where "x = u + v" and |
289 then obtain u v where "x = u + v" and |
297 "u \<in> U" and "v \<in> V" .. |
290 "u \<in> U" and "v \<in> V" .. |
298 then show "x \<in> E" by simp |
291 then show "x \<in> E" by simp |
299 qed |
292 qed |
300 fix x y assume x: "x \<in> U + V" and y: "y \<in> U + V" |
293 fix x y assume x: "x \<in> U \<oplus> V" and y: "y \<in> U \<oplus> V" |
301 show "x + y \<in> U + V" |
294 show "x + y \<in> U \<oplus> V" |
302 proof - |
295 proof - |
303 from x obtain ux vx where "x = ux + vx" and "ux \<in> U" and "vx \<in> V" .. |
296 from x obtain ux vx where "x = ux + vx" and "ux \<in> U" and "vx \<in> V" .. |
304 moreover |
297 moreover |
305 from y obtain uy vy where "y = uy + vy" and "uy \<in> U" and "vy \<in> V" .. |
298 from y obtain uy vy where "y = uy + vy" and "uy \<in> U" and "vy \<in> V" .. |
306 ultimately |
299 ultimately |
308 and "vx + vy \<in> V" |
301 and "vx + vy \<in> V" |
309 and "x + y = (ux + uy) + (vx + vy)" |
302 and "x + y = (ux + uy) + (vx + vy)" |
310 using x y by (simp_all add: add_ac) |
303 using x y by (simp_all add: add_ac) |
311 then show ?thesis .. |
304 then show ?thesis .. |
312 qed |
305 qed |
313 fix a show "a \<cdot> x \<in> U + V" |
306 fix a show "a \<cdot> x \<in> U \<oplus> V" |
314 proof - |
307 proof - |
315 from x obtain u v where "x = u + v" and "u \<in> U" and "v \<in> V" .. |
308 from x obtain u v where "x = u + v" and "u \<in> U" and "v \<in> V" .. |
316 then have "a \<cdot> u \<in> U" and "a \<cdot> v \<in> V" |
309 then have "a \<cdot> u \<in> U" and "a \<cdot> v \<in> V" |
317 and "a \<cdot> x = (a \<cdot> u) + (a \<cdot> v)" by (simp_all add: distrib) |
310 and "a \<cdot> x = (a \<cdot> u) + (a \<cdot> v)" by (simp_all add: distrib) |
318 then show ?thesis .. |
311 then show ?thesis .. |
321 qed |
314 qed |
322 |
315 |
323 text{* The sum of two subspaces is a vectorspace. *} |
316 text{* The sum of two subspaces is a vectorspace. *} |
324 |
317 |
325 lemma sum_vs [intro?]: |
318 lemma sum_vs [intro?]: |
326 "U \<unlhd> E \<Longrightarrow> V \<unlhd> E \<Longrightarrow> vectorspace E \<Longrightarrow> vectorspace (U + V)" |
319 "U \<unlhd> E \<Longrightarrow> V \<unlhd> E \<Longrightarrow> vectorspace E \<Longrightarrow> vectorspace (U \<oplus> V)" |
327 by (rule subspace.vectorspace) (rule sum_subspace) |
320 by (rule subspace.vectorspace) (rule sum_subspace) |
328 |
321 |
329 |
322 |
330 subsection {* Direct sums *} |
323 subsection {* Direct sums *} |
331 |
324 |
482 and x': "x' \<notin> H" "x' \<in> E" "x' \<noteq> 0" |
475 and x': "x' \<notin> H" "x' \<in> E" "x' \<noteq> 0" |
483 shows "h' x = h y + a * xi" |
476 shows "h' x = h y + a * xi" |
484 proof - |
477 proof - |
485 interpret vectorspace E by fact |
478 interpret vectorspace E by fact |
486 interpret subspace H E by fact |
479 interpret subspace H E by fact |
487 from x y x' have "x \<in> H + lin x'" by auto |
480 from x y x' have "x \<in> H \<oplus> lin x'" by auto |
488 have "\<exists>!p. (\<lambda>(y, a). x = y + a \<cdot> x' \<and> y \<in> H) p" (is "\<exists>!p. ?P p") |
481 have "\<exists>!p. (\<lambda>(y, a). x = y + a \<cdot> x' \<and> y \<in> H) p" (is "\<exists>!p. ?P p") |
489 proof (rule ex_ex1I) |
482 proof (rule ex_ex1I) |
490 from x y show "\<exists>p. ?P p" by blast |
483 from x y show "\<exists>p. ?P p" by blast |
491 fix p q assume p: "?P p" and q: "?P q" |
484 fix p q assume p: "?P p" and q: "?P q" |
492 show "p = q" |
485 show "p = q" |