src/HOL/Real/HahnBanach/Subspace.thy
author wenzelm
Fri Jan 28 21:58:39 2000 +0100 (2000-01-28)
changeset 8169 77b3bc101de5
parent 7978 1b99ee57d131
child 8203 2fcc6017cb72
permissions -rw-r--r--
eliminated proof script;
wenzelm@7566
     1
(*  Title:      HOL/Real/HahnBanach/Subspace.thy
wenzelm@7566
     2
    ID:         $Id$
wenzelm@7566
     3
    Author:     Gertrud Bauer, TU Munich
wenzelm@7566
     4
*)
wenzelm@7535
     5
wenzelm@7808
     6
wenzelm@7808
     7
header {* Subspaces *};
wenzelm@7808
     8
wenzelm@7917
     9
theory Subspace = VectorSpace:;
wenzelm@7535
    10
wenzelm@7535
    11
wenzelm@7917
    12
subsection {* Definition *};
wenzelm@7535
    13
wenzelm@7917
    14
text {* A non-empty subset $U$ of a vector space $V$ is a 
wenzelm@7917
    15
\emph{subspace} of $V$, iff $U$ is closed under addition and 
wenzelm@7917
    16
scalar multiplication. *};
wenzelm@7917
    17
wenzelm@7917
    18
constdefs 
wenzelm@7917
    19
  is_subspace ::  "['a::{minus, plus} set, 'a set] => bool"
wenzelm@7978
    20
  "is_subspace U V == U ~= {} & U <= V 
wenzelm@7978
    21
     & (ALL x:U. ALL y:U. ALL a. x + y : U & a <*> x : U)";
wenzelm@7535
    22
wenzelm@7566
    23
lemma subspaceI [intro]: 
wenzelm@7978
    24
  "[| <0> : U; U <= V; ALL x:U. ALL y:U. (x + y : U); 
wenzelm@7917
    25
  ALL x:U. ALL a. a <*> x : U |]
wenzelm@7808
    26
  ==> is_subspace U V";
wenzelm@7917
    27
proof (unfold is_subspace_def, intro conjI); 
wenzelm@7978
    28
  assume "<0> : U"; thus "U ~= {}"; by fast;
wenzelm@7917
    29
qed (simp+);
wenzelm@7535
    30
wenzelm@7917
    31
lemma subspace_not_empty [intro!!]: "is_subspace U V ==> U ~= {}";
wenzelm@7917
    32
  by (unfold is_subspace_def) simp; 
wenzelm@7566
    33
wenzelm@7566
    34
lemma subspace_subset [intro !!]: "is_subspace U V ==> U <= V";
wenzelm@7656
    35
  by (unfold is_subspace_def) simp;
wenzelm@7566
    36
wenzelm@7808
    37
lemma subspace_subsetD [simp, intro!!]: 
wenzelm@7978
    38
  "[| is_subspace U V; x:U |] ==> x:V";
wenzelm@7535
    39
  by (unfold is_subspace_def) force;
wenzelm@7535
    40
wenzelm@7808
    41
lemma subspace_add_closed [simp, intro!!]: 
wenzelm@7978
    42
  "[| is_subspace U V; x:U; y:U |] ==> x + y : U";
wenzelm@7656
    43
  by (unfold is_subspace_def) simp;
wenzelm@7535
    44
wenzelm@7808
    45
lemma subspace_mult_closed [simp, intro!!]: 
wenzelm@7978
    46
  "[| is_subspace U V; x:U |] ==> a <*> x : U";
wenzelm@7808
    47
  by (unfold is_subspace_def) simp;
wenzelm@7808
    48
wenzelm@7808
    49
lemma subspace_diff_closed [simp, intro!!]: 
wenzelm@7978
    50
  "[| is_subspace U V; is_vectorspace V; x:U; y:U |] 
wenzelm@7978
    51
  ==> x - y : U";
wenzelm@7917
    52
  by (simp! add: diff_eq1 negate_eq1);
wenzelm@7917
    53
wenzelm@7917
    54
text {* Similar as for linear spaces, the existence of the 
wenzelm@7978
    55
zero element in every subspace follows from the non-emptiness 
wenzelm@7978
    56
of the carrier set and by vector space laws.*};
wenzelm@7917
    57
wenzelm@7917
    58
lemma zero_in_subspace [intro !!]:
wenzelm@7978
    59
  "[| is_subspace U V; is_vectorspace V |] ==> <0> : U";
wenzelm@7917
    60
proof -; 
wenzelm@7917
    61
  assume "is_subspace U V" and v: "is_vectorspace V";
wenzelm@7917
    62
  have "U ~= {}"; ..;
wenzelm@7917
    63
  hence "EX x. x:U"; by force;
wenzelm@7917
    64
  thus ?thesis; 
wenzelm@7917
    65
  proof; 
wenzelm@7917
    66
    fix x; assume u: "x:U"; 
wenzelm@7917
    67
    hence "x:V"; by (simp!);
wenzelm@7917
    68
    with v; have "<0> = x - x"; by (simp!);
wenzelm@7917
    69
    also; have "... : U"; by (rule subspace_diff_closed);
wenzelm@7917
    70
    finally; show ?thesis; .;
wenzelm@7917
    71
  qed;
wenzelm@7917
    72
qed;
wenzelm@7535
    73
wenzelm@7808
    74
lemma subspace_neg_closed [simp, intro!!]: 
wenzelm@7978
    75
  "[| is_subspace U V; is_vectorspace V; x:U |] ==> - x : U";
wenzelm@7917
    76
  by (simp add: negate_eq1);
wenzelm@7917
    77
wenzelm@7917
    78
text_raw {* \medskip *};
wenzelm@7978
    79
text {* Further derived laws: every subspace is a vector space. *};
wenzelm@7535
    80
wenzelm@7808
    81
lemma subspace_vs [intro!!]:
wenzelm@7535
    82
  "[| is_subspace U V; is_vectorspace V |] ==> is_vectorspace U";
wenzelm@7535
    83
proof -;
wenzelm@7656
    84
  assume "is_subspace U V" "is_vectorspace V";
wenzelm@7535
    85
  show ?thesis;
wenzelm@7566
    86
  proof; 
wenzelm@7978
    87
    show "<0> : U"; ..;
wenzelm@7917
    88
    show "ALL x:U. ALL a. a <*> x : U"; by (simp!);
wenzelm@7917
    89
    show "ALL x:U. ALL y:U. x + y : U"; by (simp!);
wenzelm@7917
    90
    show "ALL x:U. - x = -1r <*> x"; by (simp! add: negate_eq1);
wenzelm@7917
    91
    show "ALL x:U. ALL y:U. x - y =  x + - y"; 
wenzelm@7917
    92
      by (simp! add: diff_eq1);
wenzelm@7566
    93
  qed (simp! add: vs_add_mult_distrib1 vs_add_mult_distrib2)+;
wenzelm@7535
    94
qed;
wenzelm@7535
    95
wenzelm@7917
    96
text {* The subspace relation is reflexive. *};
wenzelm@7917
    97
wenzelm@7566
    98
lemma subspace_refl [intro]: "is_vectorspace V ==> is_subspace V V";
wenzelm@7566
    99
proof; 
wenzelm@7535
   100
  assume "is_vectorspace V";
wenzelm@7566
   101
  show "<0> : V"; ..;
wenzelm@7566
   102
  show "V <= V"; ..;
wenzelm@7917
   103
  show "ALL x:V. ALL y:V. x + y : V"; by (simp!);
wenzelm@7917
   104
  show "ALL x:V. ALL a. a <*> x : V"; by (simp!);
wenzelm@7535
   105
qed;
wenzelm@7535
   106
wenzelm@7917
   107
text {* The subspace relation is transitive. *};
wenzelm@7917
   108
wenzelm@7808
   109
lemma subspace_trans: 
wenzelm@7917
   110
  "[| is_subspace U V; is_vectorspace V; is_subspace V W |] 
wenzelm@7917
   111
  ==> is_subspace U W";
wenzelm@7566
   112
proof; 
wenzelm@7917
   113
  assume "is_subspace U V" "is_subspace V W" "is_vectorspace V";
wenzelm@7566
   114
  show "<0> : U"; ..;
wenzelm@7656
   115
wenzelm@7566
   116
  have "U <= V"; ..;
wenzelm@7566
   117
  also; have "V <= W"; ..;
wenzelm@7566
   118
  finally; show "U <= W"; .;
wenzelm@7656
   119
wenzelm@7917
   120
  show "ALL x:U. ALL y:U. x + y : U"; 
wenzelm@7535
   121
  proof (intro ballI);
wenzelm@7535
   122
    fix x y; assume "x:U" "y:U";
wenzelm@7917
   123
    show "x + y : U"; by (simp!);
wenzelm@7535
   124
  qed;
wenzelm@7656
   125
wenzelm@7917
   126
  show "ALL x:U. ALL a. a <*> x : U";
wenzelm@7535
   127
  proof (intro ballI allI);
wenzelm@7535
   128
    fix x a; assume "x:U";
wenzelm@7917
   129
    show "a <*> x : U"; by (simp!);
wenzelm@7535
   130
  qed;
wenzelm@7535
   131
qed;
wenzelm@7535
   132
wenzelm@7535
   133
wenzelm@7808
   134
wenzelm@7808
   135
subsection {* Linear closure *};
wenzelm@7808
   136
wenzelm@7978
   137
text {* The \emph{linear closure} of a vector $x$ is the set of all
wenzelm@7978
   138
scalar multiples of $x$. *};
wenzelm@7535
   139
wenzelm@7535
   140
constdefs
wenzelm@7535
   141
  lin :: "'a => 'a set"
wenzelm@7978
   142
  "lin x == {a <*> x | a. True}"; 
wenzelm@7535
   143
wenzelm@7917
   144
lemma linD: "x : lin v = (EX a::real. x = a <*> v)";
wenzelm@7978
   145
  by (unfold lin_def) fast;
wenzelm@7535
   146
wenzelm@7917
   147
lemma linI [intro!!]: "a <*> x0 : lin x0";
wenzelm@7978
   148
  by (unfold lin_def) fast;
wenzelm@7656
   149
wenzelm@7917
   150
text {* Every vector is contained in its linear closure. *};
wenzelm@7917
   151
wenzelm@7978
   152
lemma x_lin_x: "[| is_vectorspace V; x:V |] ==> x : lin x";
wenzelm@7978
   153
proof (unfold lin_def, intro CollectI exI conjI);
wenzelm@7535
   154
  assume "is_vectorspace V" "x:V";
wenzelm@7917
   155
  show "x = 1r <*> x"; by (simp!);
wenzelm@7978
   156
qed simp;
wenzelm@7535
   157
wenzelm@7917
   158
text {* Any linear closure is a subspace. *};
wenzelm@7917
   159
wenzelm@7808
   160
lemma lin_subspace [intro!!]: 
wenzelm@7808
   161
  "[| is_vectorspace V; x:V |] ==> is_subspace (lin x) V";
wenzelm@7566
   162
proof;
wenzelm@7535
   163
  assume "is_vectorspace V" "x:V";
wenzelm@7535
   164
  show "<0> : lin x"; 
wenzelm@7978
   165
  proof (unfold lin_def, intro CollectI exI conjI);
wenzelm@7917
   166
    show "<0> = 0r <*> x"; by (simp!);
wenzelm@7978
   167
  qed simp;
wenzelm@7566
   168
wenzelm@7535
   169
  show "lin x <= V";
wenzelm@7978
   170
  proof (unfold lin_def, intro subsetI, elim CollectE exE conjE); 
wenzelm@7917
   171
    fix xa a; assume "xa = a <*> x"; 
wenzelm@7566
   172
    show "xa:V"; by (simp!);
wenzelm@7535
   173
  qed;
wenzelm@7566
   174
wenzelm@7917
   175
  show "ALL x1 : lin x. ALL x2 : lin x. x1 + x2 : lin x"; 
wenzelm@7535
   176
  proof (intro ballI);
wenzelm@7566
   177
    fix x1 x2; assume "x1 : lin x" "x2 : lin x"; 
wenzelm@7917
   178
    thus "x1 + x2 : lin x";
wenzelm@7978
   179
    proof (unfold lin_def, elim CollectE exE conjE, 
wenzelm@7978
   180
      intro CollectI exI conjI);
wenzelm@7917
   181
      fix a1 a2; assume "x1 = a1 <*> x" "x2 = a2 <*> x";
wenzelm@7917
   182
      show "x1 + x2 = (a1 + a2) <*> x"; 
wenzelm@7808
   183
        by (simp! add: vs_add_mult_distrib2);
wenzelm@7978
   184
    qed simp;
wenzelm@7535
   185
  qed;
wenzelm@7566
   186
wenzelm@7917
   187
  show "ALL xa:lin x. ALL a. a <*> xa : lin x"; 
wenzelm@7535
   188
  proof (intro ballI allI);
wenzelm@7566
   189
    fix x1 a; assume "x1 : lin x"; 
wenzelm@7917
   190
    thus "a <*> x1 : lin x";
wenzelm@7978
   191
    proof (unfold lin_def, elim CollectE exE conjE,
wenzelm@7978
   192
      intro CollectI exI conjI);
wenzelm@7917
   193
      fix a1; assume "x1 = a1 <*> x";
wenzelm@7917
   194
      show "a <*> x1 = (a * a1) <*> x"; by (simp!);
wenzelm@7978
   195
    qed simp;
wenzelm@7535
   196
  qed; 
wenzelm@7535
   197
qed;
wenzelm@7535
   198
wenzelm@7917
   199
text {* Any linear closure is a vector space. *};
wenzelm@7917
   200
wenzelm@7808
   201
lemma lin_vs [intro!!]: 
wenzelm@7808
   202
  "[| is_vectorspace V; x:V |] ==> is_vectorspace (lin x)";
wenzelm@7535
   203
proof (rule subspace_vs);
wenzelm@7535
   204
  assume "is_vectorspace V" "x:V";
wenzelm@7566
   205
  show "is_subspace (lin x) V"; ..;
wenzelm@7535
   206
qed;
wenzelm@7535
   207
wenzelm@7808
   208
wenzelm@7808
   209
wenzelm@7808
   210
subsection {* Sum of two vectorspaces *};
wenzelm@7808
   211
wenzelm@7917
   212
text {* The \emph{sum} of two vectorspaces $U$ and $V$ is the set of
wenzelm@7917
   213
all sums of elements from $U$ and $V$. *};
wenzelm@7535
   214
wenzelm@7917
   215
instance set :: (plus) plus; by intro_classes;
wenzelm@7917
   216
wenzelm@7917
   217
defs vs_sum_def:
wenzelm@7978
   218
  "U + V == {u + v | u v. u:U & v:V}"; (***
wenzelm@7917
   219
wenzelm@7535
   220
constdefs 
wenzelm@7917
   221
  vs_sum :: 
wenzelm@7917
   222
  "['a::{minus, plus} set, 'a set] => 'a set"         (infixl "+" 65)
wenzelm@7917
   223
  "vs_sum U V == {x. EX u:U. EX v:V. x = u + v}";
wenzelm@7917
   224
***)
wenzelm@7535
   225
wenzelm@7917
   226
lemma vs_sumD: 
wenzelm@7917
   227
  "x: U + V = (EX u:U. EX v:V. x = u + v)";
wenzelm@7978
   228
    by (unfold vs_sum_def) fast;
wenzelm@7535
   229
wenzelm@7566
   230
lemmas vs_sumE = vs_sumD [RS iffD1, elimify];
wenzelm@7566
   231
wenzelm@7808
   232
lemma vs_sumI [intro!!]: 
wenzelm@7917
   233
  "[| x:U; y:V; t= x + y |] ==> t : U + V";
wenzelm@7978
   234
  by (unfold vs_sum_def) fast;
wenzelm@7917
   235
wenzelm@7917
   236
text{* $U$ is a subspace of $U + V$. *};
wenzelm@7535
   237
wenzelm@7535
   238
lemma subspace_vs_sum1 [intro!!]: 
wenzelm@7917
   239
  "[| is_vectorspace U; is_vectorspace V |]
wenzelm@7917
   240
  ==> is_subspace U (U + V)";
wenzelm@7566
   241
proof; 
wenzelm@7535
   242
  assume "is_vectorspace U" "is_vectorspace V";
wenzelm@7566
   243
  show "<0> : U"; ..;
wenzelm@7917
   244
  show "U <= U + V";
wenzelm@7566
   245
  proof (intro subsetI vs_sumI);
wenzelm@7535
   246
  fix x; assume "x:U";
wenzelm@7917
   247
    show "x = x + <0>"; by (simp!);
wenzelm@7566
   248
    show "<0> : V"; by (simp!);
wenzelm@7535
   249
  qed;
wenzelm@7917
   250
  show "ALL x:U. ALL y:U. x + y : U"; 
wenzelm@7535
   251
  proof (intro ballI);
wenzelm@7917
   252
    fix x y; assume "x:U" "y:U"; show "x + y : U"; by (simp!);
wenzelm@7535
   253
  qed;
wenzelm@7917
   254
  show "ALL x:U. ALL a. a <*> x : U"; 
wenzelm@7535
   255
  proof (intro ballI allI);
wenzelm@7917
   256
    fix x a; assume "x:U"; show "a <*> x : U"; by (simp!);
wenzelm@7535
   257
  qed;
wenzelm@7535
   258
qed;
wenzelm@7535
   259
wenzelm@7917
   260
text{* The sum of two subspaces is again a subspace.*};
wenzelm@7917
   261
wenzelm@7566
   262
lemma vs_sum_subspace [intro!!]: 
wenzelm@7566
   263
  "[| is_subspace U E; is_subspace V E; is_vectorspace E |] 
wenzelm@7917
   264
  ==> is_subspace (U + V) E";
wenzelm@7566
   265
proof; 
wenzelm@7917
   266
  assume "is_subspace U E" "is_subspace V E" "is_vectorspace E";
wenzelm@7917
   267
  show "<0> : U + V";
wenzelm@7566
   268
  proof (intro vs_sumI);
wenzelm@7566
   269
    show "<0> : U"; ..;
wenzelm@7566
   270
    show "<0> : V"; ..;
wenzelm@7917
   271
    show "(<0>::'a) = <0> + <0>"; by (simp!);
wenzelm@7566
   272
  qed;
wenzelm@7566
   273
  
wenzelm@7917
   274
  show "U + V <= E";
wenzelm@7566
   275
  proof (intro subsetI, elim vs_sumE bexE);
wenzelm@7917
   276
    fix x u v; assume "u : U" "v : V" "x = u + v";
wenzelm@7566
   277
    show "x:E"; by (simp!);
wenzelm@7535
   278
  qed;
wenzelm@7535
   279
  
wenzelm@7917
   280
  show "ALL x: U + V. ALL y: U + V. x + y : U + V";
wenzelm@7566
   281
  proof (intro ballI);
wenzelm@7917
   282
    fix x y; assume "x : U + V" "y : U + V";
wenzelm@7917
   283
    thus "x + y : U + V";
wenzelm@7566
   284
    proof (elim vs_sumE bexE, intro vs_sumI);
wenzelm@7566
   285
      fix ux vx uy vy; 
wenzelm@7917
   286
      assume "ux : U" "vx : V" "x = ux + vx" 
wenzelm@7917
   287
	and "uy : U" "vy : V" "y = uy + vy";
wenzelm@7917
   288
      show "x + y = (ux + uy) + (vx + vy)"; by (simp!);
wenzelm@7566
   289
    qed (simp!)+;
wenzelm@7566
   290
  qed;
wenzelm@7535
   291
wenzelm@7978
   292
  show "ALL x : U + V. ALL a. a <*> x : U + V";
wenzelm@7566
   293
  proof (intro ballI allI);
wenzelm@7917
   294
    fix x a; assume "x : U + V";
wenzelm@7917
   295
    thus "a <*> x : U + V";
wenzelm@7566
   296
    proof (elim vs_sumE bexE, intro vs_sumI);
wenzelm@7917
   297
      fix a x u v; assume "u : U" "v : V" "x = u + v";
wenzelm@7917
   298
      show "a <*> x = (a <*> u) + (a <*> v)"; 
wenzelm@7808
   299
        by (simp! add: vs_add_mult_distrib1);
wenzelm@7566
   300
    qed (simp!)+;
wenzelm@7566
   301
  qed;
wenzelm@7535
   302
qed;
wenzelm@7535
   303
wenzelm@7917
   304
text{* The sum of two subspaces is a vectorspace. *};
wenzelm@7917
   305
wenzelm@7566
   306
lemma vs_sum_vs [intro!!]: 
wenzelm@7566
   307
  "[| is_subspace U E; is_subspace V E; is_vectorspace E |] 
wenzelm@7917
   308
  ==> is_vectorspace (U + V)";
wenzelm@7566
   309
proof (rule subspace_vs);
wenzelm@7566
   310
  assume "is_subspace U E" "is_subspace V E" "is_vectorspace E";
wenzelm@7917
   311
  show "is_subspace (U + V) E"; ..;
wenzelm@7566
   312
qed;
wenzelm@7535
   313
wenzelm@7535
   314
wenzelm@7808
   315
wenzelm@7917
   316
subsection {* Direct sums *};
wenzelm@7808
   317
wenzelm@7535
   318
wenzelm@7917
   319
text {* The sum of $U$ and $V$ is called \emph{direct}, iff the zero 
wenzelm@7917
   320
element is the only common element of $U$ and $V$. For every element
wenzelm@7917
   321
$x$ of the direct sum of $U$ and $V$ the decomposition in
wenzelm@7927
   322
$x = u + v$ with $u \in U$ and $v \in V$ is unique.*}; 
wenzelm@7808
   323
wenzelm@7917
   324
lemma decomp: 
wenzelm@7917
   325
  "[| is_vectorspace E; is_subspace U E; is_subspace V E; 
wenzelm@7917
   326
  U Int V = {<0>}; u1:U; u2:U; v1:V; v2:V; u1 + v1 = u2 + v2 |] 
wenzelm@7656
   327
  ==> u1 = u2 & v1 = v2"; 
wenzelm@7656
   328
proof; 
wenzelm@7808
   329
  assume "is_vectorspace E" "is_subspace U E" "is_subspace V E"  
wenzelm@7808
   330
    "U Int V = {<0>}" "u1:U" "u2:U" "v1:V" "v2:V" 
wenzelm@7917
   331
    "u1 + v1 = u2 + v2"; 
wenzelm@7917
   332
  have eq: "u1 - u2 = v2 - v1"; by (simp! add: vs_add_diff_swap);
wenzelm@7917
   333
  have u: "u1 - u2 : U"; by (simp!); 
wenzelm@7917
   334
  with eq; have v': "v2 - v1 : U"; by simp; 
wenzelm@7917
   335
  have v: "v2 - v1 : V"; by (simp!); 
wenzelm@7917
   336
  with eq; have u': "u1 - u2 : V"; by simp;
wenzelm@7656
   337
  
wenzelm@7656
   338
  show "u1 = u2";
wenzelm@7656
   339
  proof (rule vs_add_minus_eq);
wenzelm@7917
   340
    show "u1 - u2 = <0>"; by (rule Int_singletonD [OF _ u u']); 
wenzelm@7917
   341
    show "u1 : E"; ..;
wenzelm@7917
   342
    show "u2 : E"; ..;
wenzelm@7917
   343
  qed;
wenzelm@7656
   344
wenzelm@7656
   345
  show "v1 = v2";
wenzelm@7656
   346
  proof (rule vs_add_minus_eq [RS sym]);
wenzelm@7917
   347
    show "v2 - v1 = <0>"; by (rule Int_singletonD [OF _ v' v]);
wenzelm@7917
   348
    show "v1 : E"; ..;
wenzelm@7917
   349
    show "v2 : E"; ..;
wenzelm@7917
   350
  qed;
wenzelm@7656
   351
qed;
wenzelm@7656
   352
wenzelm@7978
   353
text {* An application of the previous lemma will be used in the proof
wenzelm@7978
   354
of the Hahn-Banach Theorem (see page \pageref{decomp-H0-use}): for any
wenzelm@7978
   355
element $y + a \mult x_0$ of the direct sum of a vectorspace $H$ and
wenzelm@7978
   356
the linear closure of $x_0$ the components $y \in H$ and $a$ are
wenzelm@7978
   357
uniquely determined. *};
wenzelm@7917
   358
wenzelm@7917
   359
lemma decomp_H0: 
wenzelm@7917
   360
  "[| is_vectorspace E; is_subspace H E; y1 : H; y2 : H; 
wenzelm@7917
   361
  x0 ~: H; x0 : E; x0 ~= <0>; y1 + a1 <*> x0 = y2 + a2 <*> x0 |]
wenzelm@7535
   362
  ==> y1 = y2 & a1 = a2";
wenzelm@7535
   363
proof;
wenzelm@7656
   364
  assume "is_vectorspace E" and h: "is_subspace H E"
wenzelm@7656
   365
     and "y1 : H" "y2 : H" "x0 ~: H" "x0 : E" "x0 ~= <0>" 
wenzelm@7917
   366
         "y1 + a1 <*> x0 = y2 + a2 <*> x0";
wenzelm@7535
   367
wenzelm@7917
   368
  have c: "y1 = y2 & a1 <*> x0 = a2 <*> x0";
wenzelm@7656
   369
  proof (rule decomp); 
wenzelm@7917
   370
    show "a1 <*> x0 : lin x0"; ..; 
wenzelm@7917
   371
    show "a2 <*> x0 : lin x0"; ..;
wenzelm@7656
   372
    show "H Int (lin x0) = {<0>}"; 
wenzelm@7656
   373
    proof;
wenzelm@7656
   374
      show "H Int lin x0 <= {<0>}"; 
wenzelm@7656
   375
      proof (intro subsetI, elim IntE, rule singleton_iff[RS iffD2]);
wenzelm@7978
   376
        fix x; assume "x:H" "x : lin x0"; 
wenzelm@7656
   377
        thus "x = <0>";
wenzelm@7978
   378
        proof (unfold lin_def, elim CollectE exE conjE);
wenzelm@7917
   379
          fix a; assume "x = a <*> x0";
wenzelm@7656
   380
          show ?thesis;
wenzelm@7917
   381
          proof (rule case_split);
wenzelm@7656
   382
            assume "a = 0r"; show ?thesis; by (simp!);
wenzelm@7656
   383
          next;
wenzelm@7656
   384
            assume "a ~= 0r"; 
wenzelm@7917
   385
            from h; have "rinv a <*> a <*> x0 : H"; 
wenzelm@7808
   386
              by (rule subspace_mult_closed) (simp!);
wenzelm@7917
   387
            also; have "rinv a <*> a <*> x0 = x0"; by (simp!);
wenzelm@7656
   388
            finally; have "x0 : H"; .;
wenzelm@7656
   389
            thus ?thesis; by contradiction;
wenzelm@7656
   390
          qed;
wenzelm@7656
   391
       qed;
wenzelm@7656
   392
      qed;
wenzelm@7656
   393
      show "{<0>} <= H Int lin x0";
wenzelm@8169
   394
      proof -;
wenzelm@8169
   395
	have "<0>: H Int lin x0";
wenzelm@8169
   396
	proof (rule IntI);
wenzelm@8169
   397
	  show "<0>:H"; ..;
wenzelm@8169
   398
	  from lin_vs; show "<0> : lin x0"; ..;
wenzelm@8169
   399
	qed;
wenzelm@8169
   400
	thus ?thesis; by simp;
wenzelm@7656
   401
      qed;
wenzelm@7535
   402
    qed;
wenzelm@7656
   403
    show "is_subspace (lin x0) E"; ..;
wenzelm@7535
   404
  qed;
wenzelm@7656
   405
  
wenzelm@7656
   406
  from c; show "y1 = y2"; by simp;
wenzelm@7656
   407
  
wenzelm@7656
   408
  show  "a1 = a2"; 
wenzelm@7656
   409
  proof (rule vs_mult_right_cancel [RS iffD1]);
wenzelm@7917
   410
    from c; show "a1 <*> x0 = a2 <*> x0"; by simp;
wenzelm@7535
   411
  qed;
wenzelm@7535
   412
qed;
wenzelm@7535
   413
wenzelm@7978
   414
text {* Since for any element $y + a \mult x_0$ of the direct sum 
wenzelm@7917
   415
of a vectorspace $H$ and the linear closure of $x_0$ the components
wenzelm@7978
   416
$y\in H$ and $a$ are unique, it follows from $y\in H$ that 
wenzelm@7917
   417
$a = 0$.*}; 
wenzelm@7917
   418
wenzelm@7917
   419
lemma decomp_H0_H: 
wenzelm@7978
   420
  "[| is_vectorspace E; is_subspace H E; t:H; x0 ~: H; x0:E;
wenzelm@7917
   421
  x0 ~= <0> |] 
wenzelm@7917
   422
  ==> (SOME (y, a). t = y + a <*> x0 & y : H) = (t, 0r)";
wenzelm@7535
   423
proof (rule, unfold split_paired_all);
wenzelm@7978
   424
  assume "is_vectorspace E" "is_subspace H E" "t:H" "x0 ~: H" "x0:E"
wenzelm@7808
   425
    "x0 ~= <0>";
wenzelm@7566
   426
  have h: "is_vectorspace H"; ..;
wenzelm@7978
   427
  fix y a; presume t1: "t = y + a <*> x0" and "y:H";
wenzelm@7535
   428
  have "y = t & a = 0r"; 
wenzelm@7917
   429
    by (rule decomp_H0) (assumption | (simp!))+;
wenzelm@7566
   430
  thus "(y, a) = (t, 0r)"; by (simp!);
wenzelm@7566
   431
qed (simp!)+;
wenzelm@7535
   432
wenzelm@7917
   433
text {* The components $y\in H$ and $a$ in $y \plus a \mult x_0$ 
wenzelm@7917
   434
are unique, so the function $h_0$ defined by 
wenzelm@7927
   435
$h_0 (y \plus a \mult x_0) = h y + a \cdot \xi$ is definite. *};
wenzelm@7917
   436
wenzelm@7917
   437
lemma h0_definite:
wenzelm@7978
   438
  "[| h0 == (\<lambda>x. let (y, a) = SOME (y, a). (x = y + a <*> x0 & y:H)
wenzelm@7566
   439
                in (h y) + a * xi);
wenzelm@7917
   440
  x = y + a <*> x0; is_vectorspace E; is_subspace H E;
wenzelm@7808
   441
  y:H; x0 ~: H; x0:E; x0 ~= <0> |]
wenzelm@7535
   442
  ==> h0 x = h y + a * xi";
wenzelm@7535
   443
proof -;  
wenzelm@7917
   444
  assume 
wenzelm@7978
   445
    "h0 == (\<lambda>x. let (y, a) = SOME (y, a). (x = y + a <*> x0 & y:H)
wenzelm@7917
   446
               in (h y) + a * xi)"
wenzelm@7917
   447
    "x = y + a <*> x0" "is_vectorspace E" "is_subspace H E"
wenzelm@7917
   448
    "y:H" "x0 ~: H" "x0:E" "x0 ~= <0>";
wenzelm@7917
   449
  have "x : H + (lin x0)"; 
wenzelm@7917
   450
    by (simp! add: vs_sum_def lin_def) force+;
wenzelm@7917
   451
  have "EX! xa. ((\<lambda>(y, a). x = y + a <*> x0 & y:H) xa)"; 
wenzelm@7917
   452
  proof;
wenzelm@7978
   453
    show "EX xa. ((\<lambda>(y, a). x = y + a <*> x0 & y:H) xa)";
wenzelm@7566
   454
      by (force!);
wenzelm@7535
   455
  next;
wenzelm@7535
   456
    fix xa ya;
wenzelm@7978
   457
    assume "(\<lambda>(y,a). x = y + a <*> x0 & y : H) xa"
wenzelm@7978
   458
           "(\<lambda>(y,a). x = y + a <*> x0 & y : H) ya";
wenzelm@7535
   459
    show "xa = ya"; ;
wenzelm@7535
   460
    proof -;
wenzelm@7535
   461
      show "fst xa = fst ya & snd xa = snd ya ==> xa = ya"; 
wenzelm@7566
   462
        by (rule Pair_fst_snd_eq [RS iffD2]);
wenzelm@7978
   463
      have x: "x = fst xa + snd xa <*> x0 & fst xa : H"; 
wenzelm@7808
   464
        by (force!);
wenzelm@7978
   465
      have y: "x = fst ya + snd ya <*> x0 & fst ya : H"; 
wenzelm@7808
   466
        by (force!);
wenzelm@7808
   467
      from x y; show "fst xa = fst ya & snd xa = snd ya"; 
wenzelm@7917
   468
        by (elim conjE) (rule decomp_H0, (simp!)+);
wenzelm@7535
   469
    qed;
wenzelm@7535
   470
  qed;
wenzelm@7978
   471
  hence eq: "(SOME (y, a). x = y + a <*> x0 & y:H) = (y, a)"; 
wenzelm@7808
   472
    by (rule select1_equality) (force!);
wenzelm@7656
   473
  thus "h0 x = h y + a * xi"; by (simp! add: Let_def);
wenzelm@7566
   474
qed;
wenzelm@7535
   475
wenzelm@7808
   476
end;