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