src/HOL/Real/HahnBanach/Subspace.thy
changeset 7566 c5a3f980a7af
parent 7535 599d3414b51d
child 7567 62384a807775
equal deleted inserted replaced
7565:bfa85f429629 7566:c5a3f980a7af
       
     1 (*  Title:      HOL/Real/HahnBanach/Subspace.thy
       
     2     ID:         $Id$
       
     3     Author:     Gertrud Bauer, TU Munich
       
     4 *)
     1 
     5 
     2 theory Subspace = LinearSpace:;
     6 theory Subspace = LinearSpace:;
     3 
     7 
     4 
     8 
     5 section {* subspaces *};
     9 section {* subspaces *};
     8   is_subspace ::  "['a set, 'a set] => bool"
    12   is_subspace ::  "['a set, 'a set] => bool"
     9   "is_subspace U V ==  <0>:U  & U <= V 
    13   "is_subspace U V ==  <0>:U  & U <= V 
    10      &  (ALL x:U. ALL y:U. ALL a. x [+] y : U                          
    14      &  (ALL x:U. ALL y:U. ALL a. x [+] y : U                          
    11                        & a [*] x : U)";                            
    15                        & a [*] x : U)";                            
    12 
    16 
    13 lemma subspace_I: 
    17 lemma subspaceI [intro]: 
    14   "[| <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 |]
    15   \ ==> is_subspace U V";
    19   \ ==> is_subspace U V";
    16   by (unfold is_subspace_def) blast;
    20   by (unfold is_subspace_def) (simp!);
    17 
    21 
    18 lemma "is_subspace U V ==> U ~= {}";
    22 lemma "is_subspace U V ==> U ~= {}";
    19   by (unfold is_subspace_def) force;
    23   by (unfold is_subspace_def) force;
    20 
    24 
    21 lemma zero_in_subspace: "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!);;
       
    27 
       
    28 lemma subspace_subset [intro !!]: "is_subspace U V ==> U <= V";
       
    29   by (unfold is_subspace_def) (simp!);
       
    30 
       
    31 lemma subspace_subsetD [simp, intro!!]: "[| is_subspace U V; x:U |]==> x:V";
    22   by (unfold is_subspace_def) force;
    32   by (unfold is_subspace_def) force;
    23 
    33 
    24 lemma subspace_subset: "is_subspace U V ==> U <= V";
    34 lemma subspace_add_closed [simp, intro!!]: "[| is_subspace U V; x: U; y: U |] ==> x [+] y: U";
    25   by (unfold is_subspace_def) fast;
    35   by (unfold is_subspace_def) (simp!);
    26 
    36 
    27 lemma subspace_subset2 [simp]: "[| is_subspace U V; x:U |]==> x:V";
    37 lemma subspace_mult_closed [simp, intro!!]: "[| is_subspace U V; x: U |] ==> a [*] x: U";
    28   by (unfold is_subspace_def) fast;
    38   by (unfold is_subspace_def) (simp!);
    29 
    39 
    30 lemma subspace_add_closed [simp]: "[| 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";
    31   by (unfold is_subspace_def) asm_simp;
    41   by (unfold diff_def negate_def) (simp!);
    32 
    42 
    33 lemma subspace_mult_closed [simp]: "[| is_subspace U V; x: U |] ==> a [*] x: U";
    43 lemma subspace_neg_closed [simp, intro!!]: "[| is_subspace U V; x: U |] ==> [-] x: U";
    34   by (unfold is_subspace_def) asm_simp;
    44  by (unfold negate_def) (simp!);
    35 
    45 
    36 lemma subspace_diff_closed [simp]: "[| is_subspace U V; x: U; y: U |] ==> x [-] y: U";
       
    37   by (unfold diff_def negate_def) asm_simp;
       
    38 
       
    39 lemma subspace_neg_closed [simp]: "[| is_subspace U V; x: U |] ==> [-] x: U";
       
    40  by (unfold negate_def) asm_simp;
       
    41 
    46 
    42 theorem subspace_vs [intro!!]:
    47 theorem subspace_vs [intro!!]:
    43   "[| is_subspace U V; is_vectorspace V |] ==> is_vectorspace U";
    48   "[| is_subspace U V; is_vectorspace V |] ==> is_vectorspace U";
    44 proof -;
    49 proof -;
    45   presume "U <= V";
    50   assume "is_subspace U V";
    46   assume "is_vectorspace V";
    51   assume "is_vectorspace V";
    47   assume "is_subspace U V";
    52   assume "is_subspace U V";
    48   show ?thesis;
    53   show ?thesis;
    49   proof (rule vs_I);
    54   proof; 
    50     show "<0>:U"; by (rule zero_in_subspace);
    55     show "<0>:U"; ..;
    51     show "ALL x:U. ALL a. a [*] x : U"; by asm_simp;
    56     show "ALL x:U. ALL a. a [*] x : U"; by (simp!);
    52     show "ALL x:U. ALL y:U. x [+] y : U"; by asm_simp;
    57     show "ALL x:U. ALL y:U. x [+] y : U"; by (simp!);
    53   qed (asm_simp add: vs_add_mult_distrib1 vs_add_mult_distrib2)+;
    58   qed (simp! add: vs_add_mult_distrib1 vs_add_mult_distrib2)+;
    54 next;
    59 qed;
    55   assume "is_subspace U V";
    60 
    56   show "U <= V"; by (rule subspace_subset);
    61 lemma subspace_refl [intro]: "is_vectorspace V ==> is_subspace V V";
    57 qed;
    62 proof; 
    58 
       
    59 lemma subspace_refl: "is_vectorspace V ==> is_subspace V V";
       
    60 proof (unfold is_subspace_def, intro conjI); 
       
    61   assume "is_vectorspace V";
    63   assume "is_vectorspace V";
    62   show "<0> : V"; by (rule zero_in_vs [of V], assumption);
    64   show "<0> : V"; ..;
    63   show "V <= V"; by (simp);
    65   show "V <= V"; ..;
    64   show "ALL x::'a:V. ALL y::'a:V. ALL a::real. x [+] y : V & a [*] x : V"; by (asm_simp);
    66   show "ALL x:V. ALL y:V. x [+] y : V"; by (simp!);
       
    67   show "ALL x:V. ALL a. a [*] x : V"; by (simp!);
    65 qed;
    68 qed;
    66 
    69 
    67 lemma subspace_trans: "[| is_subspace U V; is_subspace V W |] ==> is_subspace U W";
    70 lemma subspace_trans: "[| is_subspace U V; is_subspace V W |] ==> is_subspace U W";
    68 proof (rule subspace_I); 
    71 proof; 
    69   assume "is_subspace U V" "is_subspace V W";
    72   assume "is_subspace U V" "is_subspace V W";
    70   show "<0> : U"; by (rule zero_in_subspace);;
    73   show "<0> : U"; ..;
    71   from subspace_subset [of U] subspace_subset [of V]; show uw: "U <= W"; by force;
    74   have "U <= V"; ..;
       
    75   also; have "V <= W"; ..;
       
    76   finally; show "U <= W"; .;
    72   show "ALL x:U. ALL y:U. x [+] y : U"; 
    77   show "ALL x:U. ALL y:U. x [+] y : U"; 
    73   proof (intro ballI);
    78   proof (intro ballI);
    74     fix x y; assume "x:U" "y:U";
    79     fix x y; assume "x:U" "y:U";
    75     show "x [+] y : U"; by (rule subspace_add_closed);
    80     show "x [+] y : U"; by (simp!);
    76   qed;
    81   qed;
    77   show "ALL x:U. ALL a. a [*] x : U";
    82   show "ALL x:U. ALL a. a [*] x : U";
    78   proof (intro ballI allI);
    83   proof (intro ballI allI);
    79     fix x a; assume "x:U";
    84     fix x a; assume "x:U";
    80     show "a [*] x : U"; by (rule subspace_mult_closed);
    85     show "a [*] x : U"; by (simp!);
    81   qed;
    86   qed;
    82 qed;
    87 qed;
    83 
    88 
    84 
    89 
    85 section {* linear closure *};
    90 section {* linear closure *};
    87 constdefs
    92 constdefs
    88   lin :: "'a => 'a set"
    93   lin :: "'a => 'a set"
    89   "lin x == {y. ? a. y = a [*] x}";
    94   "lin x == {y. ? a. y = a [*] x}";
    90 
    95 
    91 lemma linD: "x : lin v = (? a::real. x = a [*] v)";
    96 lemma linD: "x : lin v = (? a::real. x = a [*] v)";
    92   by (unfold lin_def) fast;
    97   by (unfold lin_def) force;
    93 
    98 
    94 lemma x_lin_x: "[| is_vectorspace V; x:V |] ==> x:lin x";
    99 lemma x_lin_x: "[| is_vectorspace V; x:V |] ==> x:lin x";
    95 proof (unfold lin_def, intro CollectI exI);
   100 proof (unfold lin_def, intro CollectI exI);
    96   assume "is_vectorspace V" "x:V";
   101   assume "is_vectorspace V" "x:V";
    97   show "x = 1r [*] x"; by (asm_simp);
   102   show "x = 1r [*] x"; by (simp!);
    98 qed;
   103 qed;
    99 
   104 
   100 lemma lin_subspace: "[| is_vectorspace V; x:V |] ==> is_subspace (lin x) V";
   105 lemma lin_subspace [intro!!]: "[| is_vectorspace V; x:V |] ==> is_subspace (lin x) V";
   101 proof (rule subspace_I);
   106 proof;
   102   assume "is_vectorspace V" "x:V";
   107   assume "is_vectorspace V" "x:V";
   103   show "<0> : lin x"; 
   108   show "<0> : lin x"; 
   104   proof (unfold lin_def, intro CollectI exI);
   109   proof (unfold lin_def, intro CollectI exI);
   105     show "<0> = 0r [*] x"; by asm_simp;
   110     show "<0> = 0r [*] x"; by (simp!);
   106   qed;
   111   qed;
       
   112 
   107   show "lin x <= V";
   113   show "lin x <= V";
   108   proof (unfold lin_def, intro subsetI, elim CollectD [elimify] exE); 
   114   proof (unfold lin_def, intro subsetI, elim CollectE exE); 
   109     fix xa a; assume "xa = a [*] x"; show "xa:V"; by asm_simp;
   115     fix xa a; assume "xa = a [*] x"; 
   110   qed;
   116     show "xa:V"; by (simp!);
       
   117   qed;
       
   118 
   111   show "ALL x1 : lin x. ALL x2 : lin x. x1 [+] x2 : lin x"; 
   119   show "ALL x1 : lin x. ALL x2 : lin x. x1 [+] x2 : lin x"; 
   112   proof (intro ballI);
   120   proof (intro ballI);
   113     fix x1 x2; assume "x1 : lin x" "x2 : lin x"; show "x1 [+] x2 : lin x";
   121     fix x1 x2; assume "x1 : lin x" "x2 : lin x"; 
   114     proof (unfold lin_def, elim CollectD [elimify] exE, intro CollectI exI);
   122     thus "x1 [+] x2 : lin x";
       
   123     proof (-, unfold lin_def, elim CollectE exE, intro CollectI exI);   (* FIXME !? *)
   115       fix a1 a2; assume "x1 = a1 [*] x" "x2 = a2 [*] x";
   124       fix a1 a2; assume "x1 = a1 [*] x" "x2 = a2 [*] x";
   116       show "x1 [+] x2 = (a1 + a2) [*] x"; by (asm_simp add: vs_add_mult_distrib2);
   125       show "x1 [+] x2 = (a1 + a2) [*] x"; by (simp! add: vs_add_mult_distrib2);
   117     qed;
   126     qed;
   118   qed;
   127   qed;
       
   128 
   119   show "ALL xa:lin x. ALL a. a [*] xa : lin x"; 
   129   show "ALL xa:lin x. ALL a. a [*] xa : lin x"; 
   120   proof (intro ballI allI);
   130   proof (intro ballI allI);
   121     fix x1 a; assume "x1 : lin x"; show "a [*] x1 : lin x";
   131     fix x1 a; assume "x1 : lin x"; 
   122     proof (unfold lin_def, elim CollectD [elimify] exE, intro CollectI exI);
   132     thus "a [*] x1 : lin x";
       
   133     proof (-, unfold lin_def, elim CollectE exE, intro CollectI exI);
   123       fix a1; assume "x1 = a1 [*] x";
   134       fix a1; assume "x1 = a1 [*] x";
   124       show "a [*] x1 = (a * a1) [*] x"; by asm_simp;
   135       show "a [*] x1 = (a * a1) [*] x"; by (simp!);
   125     qed;
   136     qed;
   126   qed; 
   137   qed; 
   127 qed;
   138 qed;
   128 
   139 
   129 
   140 
   130 lemma lin_vs [intro!!]: "[| is_vectorspace V; x:V |] ==> is_vectorspace (lin x)";
   141 lemma lin_vs [intro!!]: "[| is_vectorspace V; x:V |] ==> is_vectorspace (lin x)";
   131 proof (rule subspace_vs);
   142 proof (rule subspace_vs);
   132   assume "is_vectorspace V" "x:V";
   143   assume "is_vectorspace V" "x:V";
   133   show "is_subspace (lin x) V"; by (rule lin_subspace);
   144   show "is_subspace (lin x) V"; ..;
   134 qed;
   145 qed;
   135 
   146 
   136 section {* sum of two vectorspaces *};
   147 section {* sum of two vectorspaces *};
   137 
   148 
   138 constdefs 
   149 constdefs 
   139   vectorspace_sum :: "['a set, 'a set] => 'a set"
   150   vectorspace_sum :: "['a set, 'a set] => 'a set"
   140   "vectorspace_sum U V == {x. ? u:U. ? v:V. x = u [+] v}";
   151   "vectorspace_sum U V == {x. ? u:U. ? v:V. x = u [+] v}";
   141 
   152 
   142 lemma vs_sumD: "x:vectorspace_sum U V = (? u:U. ? v:V. x = u [+] v)";
   153 lemma vs_sumD: "x:vectorspace_sum U V = (? u:U. ? v:V. x = u [+] v)";
   143   by (unfold vectorspace_sum_def) fast;
   154   by (unfold vectorspace_sum_def) (simp!);
   144 
   155 
   145 lemma vs_sum_I: "[| x: U; y:V; (t::'a) = x [+] y |] ==> (t::'a) : vectorspace_sum U V";
   156 lemmas vs_sumE = vs_sumD [RS iffD1, elimify];
       
   157 
       
   158 lemma vs_sumI [intro!!]: "[| x: U; y:V; (t::'a) = x [+] y |] ==> (t::'a) : vectorspace_sum U V";
   146   by (unfold vectorspace_sum_def, intro CollectI bexI); 
   159   by (unfold vectorspace_sum_def, intro CollectI bexI); 
   147 
   160 
   148 lemma subspace_vs_sum1 [intro!!]: 
   161 lemma subspace_vs_sum1 [intro!!]: 
   149   "[| is_vectorspace U; is_vectorspace V |] ==> is_subspace U (vectorspace_sum U V)";
   162   "[| is_vectorspace U; is_vectorspace V |] ==> is_subspace U (vectorspace_sum U V)";
   150 proof (rule subspace_I);
   163 proof; 
   151   assume "is_vectorspace U" "is_vectorspace V";
   164   assume "is_vectorspace U" "is_vectorspace V";
   152   show "<0> : U"; by (rule zero_in_vs);
   165   show "<0> : U"; ..;
   153   show "U <= vectorspace_sum U V";
   166   show "U <= vectorspace_sum U V";
   154   proof (intro subsetI vs_sum_I);
   167   proof (intro subsetI vs_sumI);
   155   fix x; assume "x:U";
   168   fix x; assume "x:U";
   156     show "x = x [+] <0>"; by asm_simp;
   169     show "x = x [+] <0>"; by (simp!);
   157     show "<0> : V"; by asm_simp;
   170     show "<0> : V"; by (simp!);
   158   qed;
   171   qed;
   159   show "ALL x:U. ALL y:U. x [+] y : U"; 
   172   show "ALL x:U. ALL y:U. x [+] y : U"; 
   160   proof (intro ballI);
   173   proof (intro ballI);
   161     fix x y; assume "x:U" "y:U"; show "x [+] y : U"; by asm_simp;
   174     fix x y; assume "x:U" "y:U"; show "x [+] y : U"; by (simp!);
   162   qed;
   175   qed;
   163   show "ALL x:U. ALL a. a [*] x : U"; 
   176   show "ALL x:U. ALL a. a [*] x : U"; 
   164   proof (intro ballI allI);
   177   proof (intro ballI allI);
   165     fix x a; assume "x:U"; show "a [*] x : U"; by asm_simp;
   178     fix x a; assume "x:U"; show "a [*] x : U"; by (simp!);
   166   qed;
   179   qed;
   167 qed;
   180 qed;
   168 
   181 
   169 lemma vs_sum_subspace: 
   182 lemma vs_sum_subspace [intro!!]: 
   170   "[| is_subspace U E; is_subspace V E; is_vectorspace E |] ==> is_subspace (vectorspace_sum U V) E";
   183   "[| is_subspace U E; is_subspace V E; is_vectorspace E |] 
   171 proof (rule subspace_I);
   184   ==> is_subspace (vectorspace_sum U V) E";
   172   assume u: "is_subspace U E" and v: "is_subspace V E" and e: "is_vectorspace E";
   185 proof; 
       
   186   assume "is_subspace U E" "is_subspace V E" and e: "is_vectorspace E";
   173 
   187 
   174   show "<0> : vectorspace_sum U V";
   188   show "<0> : vectorspace_sum U V";
   175   by (intro vs_sum_I, rule vs_add_zero_left [RS sym], 
   189   proof (intro vs_sumI);
   176       rule zero_in_subspace, rule zero_in_subspace, rule zero_in_vs); 
   190     show "<0> : U"; ..;
   177 
   191     show "<0> : V"; ..;
       
   192     show "(<0>::'a) = <0> [+] <0>"; 
       
   193       by (simp!);
       
   194   qed;
       
   195   
   178   show "vectorspace_sum U V <= E";
   196   show "vectorspace_sum U V <= E";
   179   proof (intro subsetI, elim vs_sumD [RS iffD1, elimify] bexE);
   197   proof (intro subsetI, elim vs_sumE bexE);
   180     fix x u v; assume "u : U" "v : V" "x = u [+] v";
   198     fix x u v; assume "u : U" "v : V" "x = u [+] v";
   181     show "x:E"; by (asm_simp);
   199     show "x:E"; by (simp!);
   182   qed;
   200   qed;
   183   
   201   
   184   show "ALL x:vectorspace_sum U V. ALL y:vectorspace_sum U V. x [+] y : vectorspace_sum U V";
   202   show "ALL x:vectorspace_sum U V. ALL y:vectorspace_sum U V. x [+] y : vectorspace_sum U V";
   185   proof (intro ballI, elim vs_sumD [RS iffD1, elimify] bexE, intro vs_sum_I);
   203   proof (intro ballI);
   186     fix x y ux vx uy vy; assume "ux : U" "vx : V" "x = ux [+] vx" "uy : U" "vy : V" "y = uy [+] vy";
   204     fix x y; assume "x:vectorspace_sum U V" "y:vectorspace_sum U V";
   187     show "x [+] y = (ux [+] uy) [+] (vx [+] vy)"; by asm_simp;
   205     thus "x [+] y : vectorspace_sum U V";
   188   qed asm_simp+;
   206     proof (elim vs_sumE bexE, intro vs_sumI);
       
   207       fix ux vx uy vy; 
       
   208       assume "ux : U" "vx : V" "x = ux [+] vx" "uy : U" "vy : V" "y = uy [+] vy";
       
   209       show "x [+] y = (ux [+] uy) [+] (vx [+] vy)"; by (simp!);
       
   210     qed (simp!)+;
       
   211   qed;
   189 
   212 
   190   show "ALL x:vectorspace_sum U V. ALL a. a [*] x : vectorspace_sum U V";
   213   show "ALL x:vectorspace_sum U V. ALL a. a [*] x : vectorspace_sum U V";
   191   proof (intro ballI allI, elim vs_sumD [RS iffD1, elimify] bexE, intro vs_sum_I);
   214   proof (intro ballI allI);
   192     fix a x u v; assume "u : U" "v : V" "x = u [+] v";
   215     fix x a; assume "x:vectorspace_sum U V";
   193     show "a [*] x = (a [*] u) [+] (a [*] v)"; by (asm_simp add: vs_add_mult_distrib1 [OF e]);
   216     thus "a [*] x : vectorspace_sum U V";
   194   qed asm_simp+;
   217     proof (elim vs_sumE bexE, intro vs_sumI);
   195 qed;
   218       fix a x u v; assume "u : U" "v : V" "x = u [+] v";
   196 
   219       show "a [*] x = (a [*] u) [+] (a [*] v)"; by (simp! add: vs_add_mult_distrib1);
   197 lemma vs_sum_vs: 
   220     qed (simp!)+;
   198   "[| is_subspace U E; is_subspace V E; is_vectorspace E |] ==> is_vectorspace (vectorspace_sum U V)";
   221   qed;
   199   by (rule subspace_vs [OF vs_sum_subspace]);
   222 qed;
       
   223 
       
   224 lemma vs_sum_vs [intro!!]: 
       
   225   "[| is_subspace U E; is_subspace V E; is_vectorspace E |] 
       
   226   ==> is_vectorspace (vectorspace_sum U V)";
       
   227 proof (rule subspace_vs);
       
   228   assume "is_subspace U E" "is_subspace V E" "is_vectorspace E";
       
   229   show "is_subspace (vectorspace_sum U V) E"; ..;
       
   230 qed;
   200 
   231 
   201 
   232 
   202 section {* special case: direct sum of a vectorspace and a linear closure of a vector *};
   233 section {* special case: direct sum of a vectorspace and a linear closure of a vector *};
   203 
   234 
   204 
   235 lemma decomp4: "[| is_vectorspace E; is_subspace H E; y1 : H; y2 : H; x0 ~: H; x0 :E; 
   205 lemma lemma4: "[| is_vectorspace E; is_subspace H E; y1 : H; y2 : H; x0 ~: H; x0 :E; 
       
   206   x0 ~= <0>; y1 [+] a1 [*] x0 = y2 [+] a2 [*] x0 |]
   236   x0 ~= <0>; y1 [+] a1 [*] x0 = y2 [+] a2 [*] x0 |]
   207   ==> y1 = y2 & a1 = a2";
   237   ==> y1 = y2 & a1 = a2";
   208 proof;
   238 proof;
   209   assume "is_vectorspace E" "is_subspace H E"
   239   assume "is_vectorspace E" "is_subspace H E"
   210          "y1 : H" "y2 : H" "x0 ~: H" "x0 : E" "x0 ~= <0>" 
   240          "y1 : H" "y2 : H" "x0 ~: H" "x0 : E" "x0 ~= <0>" 
   211          "y1 [+] a1 [*] x0 = y2 [+] a2 [*] x0";
   241          "y1 [+] a1 [*] x0 = y2 [+] a2 [*] x0";
   212   have h: "is_vectorspace H"; by (rule subspace_vs);
   242   have h: "is_vectorspace H"; ..;
   213   have "y1 [-] y2 = a2 [*] x0 [-] a1 [*] x0"; 
   243   have "y1 [-] y2 = a2 [*] x0 [-] a1 [*] x0";
   214     by (rule vs_add_diff_swap) asm_simp+;
   244     by (simp! add: vs_add_diff_swap);
   215   also; have "... = (a2 - a1) [*] x0";
   245   also; have "... = (a2 - a1) [*] x0";
   216     by (rule vs_diff_mult_distrib2 [RS sym]);
   246     by (rule vs_diff_mult_distrib2 [RS sym]);
   217   finally; have eq: "y1 [-] y2 = (a2 - a1) [*] x0"; .;
   247   finally; have eq: "y1 [-] y2 = (a2 - a1) [*] x0"; .;
   218 
   248 
   219   have y: "y1 [-] y2 : H"; by asm_simp;
   249   have y: "y1 [-] y2 : H"; by (simp!);
   220   have x: "(a2 - a1) [*] x0 : lin x0"; by (asm_simp add: lin_def) force; 
   250   have x: "(a2 - a1) [*] x0 : lin x0"; by (simp! add: lin_def) force; 
   221   from y; have y': "y1 [-] y2 : lin x0"; by (simp only: eq x);
   251   from eq y x; have y': "y1 [-] y2 : lin x0"; by simp;
   222   from x; have x': "(a2 - a1) [*] x0 : H"; by (simp only: eq [RS sym] y);
   252   from eq y x; have x': "(a2 - a1) [*] x0 : H"; by simp;
   223 
   253 
   224   have int: "H Int (lin x0) = {<0>}"; 
   254   have int: "H Int (lin x0) = {<0>}"; 
   225   proof;
   255   proof;
   226     show "H Int lin x0 <= {<0>}"; 
   256     show "H Int lin x0 <= {<0>}"; 
   227     proof (intro subsetI, unfold lin_def, elim IntE CollectD[elimify] exE,
   257     proof (intro subsetI, elim IntE, rule singleton_iff[RS iffD2]);
   228       rule singleton_iff[RS iffD2]);
   258       fix x; assume "x:H" "x:lin x0"; 
   229       fix x a; assume "x : H" and ax0: "x = a [*] x0";
   259       thus "x = <0>";
   230       show "x = <0>";
   260       proof (-, unfold lin_def, elim CollectE exE);
   231       proof (rule case [of "a=0r"]);
   261         fix a; assume "x = a [*] x0";
   232         assume "a = 0r"; show ?thesis; by asm_simp;
   262         show ?thesis;
   233       next;
   263         proof (rule case [of "a = 0r"]);
   234         assume "a ~= 0r"; 
   264           assume "a = 0r"; show ?thesis; by (simp!);
   235         have "(rinv a) [*] a [*] x0 : H"; 
   265         next;
   236           by (rule vs_mult_closed [OF h]) asm_simp;
   266           assume "a ~= 0r"; 
   237         also; have "(rinv a) [*] a [*] x0 = x0"; by asm_simp;
   267           have "(rinv a) [*] a [*] x0 : H"; 
   238         finally; have "x0 : H"; .;
   268             by (rule vs_mult_closed [OF h]) (simp!);
   239         thus ?thesis; by contradiction;
   269           also; have "(rinv a) [*] a [*] x0 = x0"; by (simp!);
   240       qed;
   270           finally; have "x0 : H"; .;
   241     qed;
   271           thus ?thesis; by contradiction;
   242     show "{<0>} <= H Int lin x0"; 
   272         qed;
   243     proof (intro subsetI, elim singletonD[elimify], intro IntI, asm_simp+);
   273      qed;
   244       show "<0> : H"; by (rule zero_in_vs [OF h]);
   274     qed;
   245       show "<0> : lin x0"; by (rule zero_in_vs [OF lin_vs]);
   275     show "{<0>} <= H Int lin x0";
       
   276     proof (intro subsetI, elim singletonE, intro IntI, simp+);
       
   277       show "<0> : H"; ..;
       
   278       from lin_vs; show "<0> : lin x0"; ..;
   246     qed;
   279     qed;
   247   qed;
   280   qed;
   248 
   281 
   249   from h; show "y1 = y2";
   282   from h; show "y1 = y2";
   250   proof (rule vs_add_minus_eq);
   283   proof (rule vs_add_minus_eq);
   251     show "y1 [-] y2 = <0>";
   284     show "y1 [-] y2 = <0>"; 
   252       by (rule Int_singeltonD [OF int y y']); 
   285       by (rule Int_singletonD [OF int y y']); 
   253   qed;
   286   qed;
   254  
   287  
   255   show "a1 = a2";
   288   show "a1 = a2";
   256   proof (rule real_add_minus_eq [RS sym]);
   289   proof (rule real_add_minus_eq [RS sym]);
   257     show "a2 - a1 = 0r";
   290     show "a2 - a1 = 0r";
   258     proof (rule vs_mult_zero_uniq);
   291     proof (rule vs_mult_zero_uniq);
   259       show "(a2 - a1) [*] x0 = <0>";  by (rule Int_singeltonD [OF int x' x]);
   292       show "(a2 - a1) [*] x0 = <0>";  by (rule Int_singletonD [OF int x' x]);
   260     qed;
   293     qed;
   261   qed;
   294   qed;
   262 qed;
   295 qed;
   263 
   296 
   264  
   297  
   265 lemma lemma1: 
   298 lemma decomp1: 
   266   "[| is_vectorspace E; is_subspace H E; t:H; x0~:H; x0:E; x0 ~= <0> |] 
   299   "[| is_vectorspace E; is_subspace H E; t:H; x0~:H; x0:E; x0 ~= <0> |] 
   267   ==> (@ (y, a). t = y [+] a [*] x0 & y : H) = (t, 0r)";
   300   ==> (@ (y, a). t = y [+] a [*] x0 & y : H) = (t, 0r)";
   268 proof (rule, unfold split_paired_all);
   301 proof (rule, unfold split_paired_all);
   269   assume "is_vectorspace E" "is_subspace H E" "t:H" "x0~:H" "x0:E" "x0 ~= <0>";
   302   assume "is_vectorspace E" "is_subspace H E" "t:H" "x0~:H" "x0:E" "x0 ~= <0>";
   270   have h: "is_vectorspace H"; by (rule subspace_vs);
   303   have h: "is_vectorspace H"; ..;
   271   fix y a; presume t1: "t = y [+] a [*] x0" and "y : H";
   304   fix y a; presume t1: "t = y [+] a [*] x0" and "y : H";
   272   have "y = t & a = 0r"; 
   305   have "y = t & a = 0r"; 
   273     by (rule lemma4) (assumption+, asm_simp); 
   306     by (rule decomp4) (assumption+, (simp!)); 
   274   thus "(y, a) = (t, 0r)"; by asm_simp;
   307   thus "(y, a) = (t, 0r)"; by (simp!);
   275 qed asm_simp+;
   308 qed (simp!)+;
   276 
   309 
   277 
   310 
   278 lemma lemma3: "!! x0 h xi x y a H. [| h0 = (%x. let (y, a) = @ (y, a). (x = y [+] a [*] x0 & y:H) 
   311 lemma decomp3:
   279                             in (h y) + a * xi);
   312   "[| h0 = (%x. let (y, a) = @ (y, a). (x = y [+] a [*] x0 & y:H) 
   280                   x = y [+] a [*] x0; 
   313                 in (h y) + a * xi);
   281                   is_vectorspace E; is_subspace H E; y:H; x0 ~: H; x0:E; x0 ~= <0> |]
   314       x = y [+] a [*] x0; 
       
   315       is_vectorspace E; is_subspace H E; y:H; x0 ~: H; x0:E; x0 ~= <0> |]
   282   ==> h0 x = h y + a * xi";
   316   ==> h0 x = h y + a * xi";
   283 proof -;  
   317 proof -;  
   284   fix x0 h xi x y a H;
       
   285   assume "h0 = (%x. let (y, a) = @ (y, a). (x = y [+] a [*] x0 & y:H) 
   318   assume "h0 = (%x. let (y, a) = @ (y, a). (x = y [+] a [*] x0 & y:H) 
   286                             in (h y) + a * xi)";
   319                     in (h y) + a * xi)";
   287   assume "x = y [+] a [*] x0";
   320   assume "x = y [+] a [*] x0";
   288   assume "is_vectorspace E" "is_subspace H E" "y:H" "x0 ~: H" "x0:E" "x0 ~= <0>";
   321   assume "is_vectorspace E" "is_subspace H E" "y:H" "x0 ~: H" "x0:E" "x0 ~= <0>";
   289 
   322 
   290   have "x : vectorspace_sum H (lin x0)"; 
   323   have "x : vectorspace_sum H (lin x0)"; 
   291     by (asm_simp add: vectorspace_sum_def lin_def, intro bexI exI conjI) force+;
   324     by (simp! add: vectorspace_sum_def lin_def, intro bexI exI conjI) force+;
   292   have "EX! xa. ((%(y, a). x = y [+] a [*] x0 & y:H) xa)"; 
   325   have "EX! xa. ((%(y, a). x = y [+] a [*] x0 & y:H) xa)"; 
   293   proof;
   326   proof;
   294     show "EX xa. ((%(y, a). x = y [+] a [*] x0 & y:H) xa)"; 
   327     show "EX xa. ((%(y, a). x = y [+] a [*] x0 & y:H) xa)";
   295       by (asm_simp, rule exI, force);
   328       by (force!);
   296   next;
   329   next;
   297     fix xa ya;
   330     fix xa ya;
   298     assume "(%(y,a). x = y [+] a [*] x0 & y : H) xa"
   331     assume "(%(y,a). x = y [+] a [*] x0 & y : H) xa"
   299            "(%(y,a). x = y [+] a [*] x0 & y : H) ya";
   332            "(%(y,a). x = y [+] a [*] x0 & y : H) ya";
   300     show "xa = ya"; ;
   333     show "xa = ya"; ;
   301     proof -;
   334     proof -;
   302       show "fst xa = fst ya & snd xa = snd ya ==> xa = ya"; 
   335       show "fst xa = fst ya & snd xa = snd ya ==> xa = ya"; 
   303         by(rule Pair_fst_snd_eq [RS iffD2]);
   336         by (rule Pair_fst_snd_eq [RS iffD2]);
   304       have x: "x = (fst xa) [+] (snd xa) [*] x0 & (fst xa) : H"; by force;
   337       have x: "x = (fst xa) [+] (snd xa) [*] x0 & (fst xa) : H"; by (force!);
   305       have y: "x = (fst ya) [+] (snd ya) [*] x0 & (fst ya) : H"; by force;
   338       have y: "x = (fst ya) [+] (snd ya) [*] x0 & (fst ya) : H"; by (force!);
   306       from x y; show "fst xa = fst ya & snd xa = snd ya"; 
   339       from x y; show "fst xa = fst ya & snd xa = snd ya"; 
   307         by (elim conjE) (rule lemma4, asm_simp+);
   340         by (elim conjE) (rule decomp4, (simp!)+);
   308     qed;
   341     qed;
   309   qed;
   342   qed;
   310   hence eq: "(@ (y, a). (x = y [+] a [*] x0 & y:H)) = (y, a)"; 
   343   hence eq: "(@ (y, a). (x = y [+] a [*] x0 & y:H)) = (y, a)"; 
   311     by (rule select1_equality, force);
   344     by (rule select1_equality) (force!);
   312   thus "h0 x = h y + a * xi"; 
   345   thus "h0 x = h y + a * xi"; 
   313     by (asm_simp add: Let_def);
   346     by (simp! add: Let_def);
   314 qed;  
   347 qed;
   315 
   348 
   316 
   349 
   317 end;
   350 end;
   318 
   351 
   319 
   352