src/HOL/Real/HahnBanach/Subspace.thy
changeset 7656 2f18c0ffc348
parent 7567 62384a807775
child 7808 fd019ac3485f
equal deleted inserted replaced
7655:21b7b0fd41bd 7656:2f18c0ffc348
    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!);
    69 
    67 
    70 lemma subspace_trans: "[| is_subspace U V; is_subspace V W |] ==> is_subspace U W";
    68 lemma subspace_trans: "[| is_subspace U V; is_subspace V W |] ==> is_subspace U W";
    71 proof; 
    69 proof; 
    72   assume "is_subspace U V" "is_subspace V W";
    70   assume "is_subspace U V" "is_subspace V W";
    73   show "<0> : U"; ..;
    71   show "<0> : U"; ..;
       
    72 
    74   have "U <= V"; ..;
    73   have "U <= V"; ..;
    75   also; have "V <= W"; ..;
    74   also; have "V <= W"; ..;
    76   finally; show "U <= W"; .;
    75   finally; show "U <= W"; .;
       
    76 
    77   show "ALL x:U. ALL y:U. x [+] y : U"; 
    77   show "ALL x:U. ALL y:U. x [+] y : U"; 
    78   proof (intro ballI);
    78   proof (intro ballI);
    79     fix x y; assume "x:U" "y:U";
    79     fix x y; assume "x:U" "y:U";
    80     show "x [+] y : U"; by (simp!);
    80     show "x [+] y : U"; by (simp!);
    81   qed;
    81   qed;
       
    82 
    82   show "ALL x:U. ALL a. a [*] x : U";
    83   show "ALL x:U. ALL a. a [*] x : U";
    83   proof (intro ballI allI);
    84   proof (intro ballI allI);
    84     fix x a; assume "x:U";
    85     fix x a; assume "x:U";
    85     show "a [*] x : U"; by (simp!);
    86     show "a [*] x : U"; by (simp!);
    86   qed;
    87   qed;
    92 constdefs
    93 constdefs
    93   lin :: "'a => 'a set"
    94   lin :: "'a => 'a set"
    94   "lin x == {y. ? a. y = a [*] x}";
    95   "lin x == {y. ? a. y = a [*] x}";
    95 
    96 
    96 lemma linD: "x : lin v = (? a::real. x = a [*] v)";
    97 lemma linD: "x : lin v = (? a::real. x = a [*] v)";
       
    98   by (unfold lin_def) force;
       
    99 
       
   100 lemma linI [intro!!]: "a [*] x0 : lin x0";
    97   by (unfold lin_def) force;
   101   by (unfold lin_def) force;
    98 
   102 
    99 lemma x_lin_x: "[| is_vectorspace V; x:V |] ==> x:lin x";
   103 lemma x_lin_x: "[| is_vectorspace V; x:V |] ==> x:lin x";
   100 proof (unfold lin_def, intro CollectI exI);
   104 proof (unfold lin_def, intro CollectI exI);
   101   assume "is_vectorspace V" "x:V";
   105   assume "is_vectorspace V" "x:V";
   149 constdefs 
   153 constdefs 
   150   vectorspace_sum :: "['a set, 'a set] => 'a set"
   154   vectorspace_sum :: "['a set, 'a set] => 'a set"
   151   "vectorspace_sum U V == {x. ? u:U. ? v:V. x = u [+] v}";
   155   "vectorspace_sum U V == {x. ? u:U. ? v:V. x = u [+] v}";
   152 
   156 
   153 lemma vs_sumD: "x:vectorspace_sum U V = (? u:U. ? v:V. x = u [+] v)";
   157 lemma vs_sumD: "x:vectorspace_sum U V = (? u:U. ? v:V. x = u [+] v)";
   154   by (unfold vectorspace_sum_def) (simp!);
   158   by (unfold vectorspace_sum_def) simp;
   155 
   159 
   156 lemmas vs_sumE = vs_sumD [RS iffD1, elimify];
   160 lemmas vs_sumE = vs_sumD [RS iffD1, elimify];
   157 
   161 
   158 lemma vs_sumI [intro!!]: "[| x: U; y:V; (t::'a) = x [+] y |] ==> (t::'a) : vectorspace_sum U V";
   162 lemma vs_sumI [intro!!]: "[| x: U; y:V; (t::'a) = x [+] y |] ==> (t::'a) : vectorspace_sum U V";
   159   by (unfold vectorspace_sum_def, intro CollectI bexI); 
   163   by (unfold vectorspace_sum_def, intro CollectI bexI); 
   187 
   191 
   188   show "<0> : vectorspace_sum U V";
   192   show "<0> : vectorspace_sum U V";
   189   proof (intro vs_sumI);
   193   proof (intro vs_sumI);
   190     show "<0> : U"; ..;
   194     show "<0> : U"; ..;
   191     show "<0> : V"; ..;
   195     show "<0> : V"; ..;
   192     show "(<0>::'a) = <0> [+] <0>"; 
   196     show "(<0>::'a) = <0> [+] <0>"; by (simp!);
   193       by (simp!);
       
   194   qed;
   197   qed;
   195   
   198   
   196   show "vectorspace_sum U V <= E";
   199   show "vectorspace_sum U V <= E";
   197   proof (intro subsetI, elim vs_sumE bexE);
   200   proof (intro subsetI, elim vs_sumE bexE);
   198     fix x u v; assume "u : U" "v : V" "x = u [+] v";
   201     fix x u v; assume "u : U" "v : V" "x = u [+] v";
   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"
   334     proof -;
   343     proof -;
   335       show "fst xa = fst ya & snd xa = snd ya ==> xa = ya"; 
   344       show "fst xa = fst ya & snd xa = snd ya ==> xa = ya"; 
   336         by (rule Pair_fst_snd_eq [RS iffD2]);
   345         by (rule Pair_fst_snd_eq [RS iffD2]);
   337       have x: "x = (fst xa) [+] (snd xa) [*] x0 & (fst xa) : H"; by (force!);
   346       have x: "x = (fst xa) [+] (snd xa) [*] x0 & (fst xa) : H"; by (force!);
   338       have y: "x = (fst ya) [+] (snd ya) [*] x0 & (fst ya) : H"; by (force!);
   347       have y: "x = (fst ya) [+] (snd ya) [*] x0 & (fst ya) : H"; by (force!);
   339       from x y; show "fst xa = fst ya & snd xa = snd ya"; 
   348       from x y; show "fst xa = fst ya & snd xa = snd ya"; by (elim conjE) (rule decomp4, (simp!)+);
   340         by (elim conjE) (rule decomp4, (simp!)+);
       
   341     qed;
   349     qed;
   342   qed;
   350   qed;
   343   hence eq: "(@ (y, a). (x = y [+] a [*] x0 & y:H)) = (y, a)"; 
   351   hence eq: "(@ (y, a). (x = y [+] a [*] x0 & y:H)) = (y, a)"; by (rule select1_equality) (force!);
   344     by (rule select1_equality) (force!);
   352   thus "h0 x = h y + a * xi"; by (simp! add: Let_def);
   345   thus "h0 x = h y + a * xi"; 
   353 qed;
   346     by (simp! add: Let_def);
       
   347 qed;
       
   348 
       
   349 
   354 
   350 end;
   355 end;
   351 
   356 
   352 
   357