src/HOL/HahnBanach/Subspace.thy
author haftmann
Mon Dec 29 14:08:08 2008 +0100 (2008-12-29)
changeset 29197 6d4cb27ed19c
parent 27612 src/HOL/Real/HahnBanach/Subspace.thy@d3eb431db035
child 29252 ea97aa6aeba2
permissions -rw-r--r--
adapted HOL source structure to distribution layout
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@9035
     6
header {* Subspaces *}
wenzelm@7808
     7
wenzelm@27612
     8
theory Subspace
wenzelm@27612
     9
imports VectorSpace
wenzelm@27612
    10
begin
wenzelm@7535
    11
wenzelm@9035
    12
subsection {* Definition *}
wenzelm@7535
    13
wenzelm@10687
    14
text {*
wenzelm@10687
    15
  A non-empty subset @{text U} of a vector space @{text V} is a
wenzelm@10687
    16
  \emph{subspace} of @{text V}, iff @{text U} is closed under addition
wenzelm@10687
    17
  and scalar multiplication.
wenzelm@10687
    18
*}
wenzelm@7917
    19
wenzelm@13515
    20
locale subspace = var U + var V +
haftmann@25762
    21
  constrains U :: "'a\<Colon>{minus, plus, zero, uminus} set"
wenzelm@13515
    22
  assumes non_empty [iff, intro]: "U \<noteq> {}"
wenzelm@13515
    23
    and subset [iff]: "U \<subseteq> V"
wenzelm@13515
    24
    and add_closed [iff]: "x \<in> U \<Longrightarrow> y \<in> U \<Longrightarrow> x + y \<in> U"
wenzelm@13515
    25
    and mult_closed [iff]: "x \<in> U \<Longrightarrow> a \<cdot> x \<in> U"
wenzelm@7535
    26
wenzelm@21210
    27
notation (symbols)
wenzelm@19736
    28
  subspace  (infix "\<unlhd>" 50)
ballarin@14254
    29
wenzelm@19736
    30
declare vectorspace.intro [intro?] subspace.intro [intro?]
wenzelm@7535
    31
wenzelm@13515
    32
lemma subspace_subset [elim]: "U \<unlhd> V \<Longrightarrow> U \<subseteq> V"
wenzelm@13515
    33
  by (rule subspace.subset)
wenzelm@7566
    34
wenzelm@13515
    35
lemma (in subspace) subsetD [iff]: "x \<in> U \<Longrightarrow> x \<in> V"
wenzelm@13515
    36
  using subset by blast
wenzelm@7566
    37
wenzelm@13515
    38
lemma subspaceD [elim]: "U \<unlhd> V \<Longrightarrow> x \<in> U \<Longrightarrow> x \<in> V"
wenzelm@13515
    39
  by (rule subspace.subsetD)
wenzelm@7535
    40
wenzelm@13515
    41
lemma rev_subspaceD [elim?]: "x \<in> U \<Longrightarrow> U \<unlhd> V \<Longrightarrow> x \<in> V"
wenzelm@13515
    42
  by (rule subspace.subsetD)
wenzelm@13515
    43
wenzelm@13547
    44
lemma (in subspace) diff_closed [iff]:
ballarin@27611
    45
  assumes "vectorspace V"
wenzelm@27612
    46
  assumes x: "x \<in> U" and y: "y \<in> U"
wenzelm@27612
    47
  shows "x - y \<in> U"
ballarin@27611
    48
proof -
ballarin@27611
    49
  interpret vectorspace [V] by fact
wenzelm@27612
    50
  from x y show ?thesis by (simp add: diff_eq1 negate_eq1)
ballarin@27611
    51
qed
wenzelm@7917
    52
wenzelm@13515
    53
text {*
wenzelm@13515
    54
  \medskip Similar as for linear spaces, the existence of the zero
wenzelm@13515
    55
  element in every subspace follows from the non-emptiness of the
wenzelm@13515
    56
  carrier set and by vector space laws.
wenzelm@13515
    57
*}
wenzelm@13515
    58
wenzelm@13547
    59
lemma (in subspace) zero [intro]:
ballarin@27611
    60
  assumes "vectorspace V"
wenzelm@13547
    61
  shows "0 \<in> U"
wenzelm@10687
    62
proof -
ballarin@27611
    63
  interpret vectorspace [V] by fact
wenzelm@13515
    64
  have "U \<noteq> {}" by (rule U_V.non_empty)
wenzelm@13515
    65
  then obtain x where x: "x \<in> U" by blast
wenzelm@27612
    66
  then have "x \<in> V" .. then have "0 = x - x" by simp
wenzelm@27612
    67
  also from `vectorspace V` x x have "\<dots> \<in> U" by (rule U_V.diff_closed)
wenzelm@13515
    68
  finally show ?thesis .
wenzelm@9035
    69
qed
wenzelm@7535
    70
wenzelm@13547
    71
lemma (in subspace) neg_closed [iff]:
ballarin@27611
    72
  assumes "vectorspace V"
wenzelm@27612
    73
  assumes x: "x \<in> U"
wenzelm@27612
    74
  shows "- x \<in> U"
ballarin@27611
    75
proof -
ballarin@27611
    76
  interpret vectorspace [V] by fact
wenzelm@27612
    77
  from x show ?thesis by (simp add: negate_eq1)
ballarin@27611
    78
qed
wenzelm@13515
    79
wenzelm@10687
    80
text {* \medskip Further derived laws: every subspace is a vector space. *}
wenzelm@7535
    81
wenzelm@13547
    82
lemma (in subspace) vectorspace [iff]:
ballarin@27611
    83
  assumes "vectorspace V"
wenzelm@13547
    84
  shows "vectorspace U"
ballarin@27611
    85
proof -
ballarin@27611
    86
  interpret vectorspace [V] by fact
wenzelm@27612
    87
  show ?thesis
wenzelm@27612
    88
  proof
ballarin@27611
    89
    show "U \<noteq> {}" ..
ballarin@27611
    90
    fix x y z assume x: "x \<in> U" and y: "y \<in> U" and z: "z \<in> U"
ballarin@27611
    91
    fix a b :: real
ballarin@27611
    92
    from x y show "x + y \<in> U" by simp
ballarin@27611
    93
    from x show "a \<cdot> x \<in> U" by simp
ballarin@27611
    94
    from x y z show "(x + y) + z = x + (y + z)" by (simp add: add_ac)
ballarin@27611
    95
    from x y show "x + y = y + x" by (simp add: add_ac)
ballarin@27611
    96
    from x show "x - x = 0" by simp
ballarin@27611
    97
    from x show "0 + x = x" by simp
ballarin@27611
    98
    from x y show "a \<cdot> (x + y) = a \<cdot> x + a \<cdot> y" by (simp add: distrib)
ballarin@27611
    99
    from x show "(a + b) \<cdot> x = a \<cdot> x + b \<cdot> x" by (simp add: distrib)
ballarin@27611
   100
    from x show "(a * b) \<cdot> x = a \<cdot> b \<cdot> x" by (simp add: mult_assoc)
ballarin@27611
   101
    from x show "1 \<cdot> x = x" by simp
ballarin@27611
   102
    from x show "- x = - 1 \<cdot> x" by (simp add: negate_eq1)
ballarin@27611
   103
    from x y show "x - y = x + - y" by (simp add: diff_eq1)
ballarin@27611
   104
  qed
wenzelm@9035
   105
qed
wenzelm@7535
   106
wenzelm@13515
   107
wenzelm@9035
   108
text {* The subspace relation is reflexive. *}
wenzelm@7917
   109
wenzelm@13515
   110
lemma (in vectorspace) subspace_refl [intro]: "V \<unlhd> V"
wenzelm@10687
   111
proof
wenzelm@13515
   112
  show "V \<noteq> {}" ..
wenzelm@10687
   113
  show "V \<subseteq> V" ..
wenzelm@13515
   114
  fix x y assume x: "x \<in> V" and y: "y \<in> V"
wenzelm@13515
   115
  fix a :: real
wenzelm@13515
   116
  from x y show "x + y \<in> V" by simp
wenzelm@13515
   117
  from x show "a \<cdot> x \<in> V" by simp
wenzelm@9035
   118
qed
wenzelm@7535
   119
wenzelm@9035
   120
text {* The subspace relation is transitive. *}
wenzelm@7917
   121
wenzelm@13515
   122
lemma (in vectorspace) subspace_trans [trans]:
wenzelm@13515
   123
  "U \<unlhd> V \<Longrightarrow> V \<unlhd> W \<Longrightarrow> U \<unlhd> W"
wenzelm@10687
   124
proof
wenzelm@13515
   125
  assume uv: "U \<unlhd> V" and vw: "V \<unlhd> W"
wenzelm@13515
   126
  from uv show "U \<noteq> {}" by (rule subspace.non_empty)
wenzelm@13515
   127
  show "U \<subseteq> W"
wenzelm@13515
   128
  proof -
wenzelm@13515
   129
    from uv have "U \<subseteq> V" by (rule subspace.subset)
wenzelm@13515
   130
    also from vw have "V \<subseteq> W" by (rule subspace.subset)
wenzelm@13515
   131
    finally show ?thesis .
wenzelm@9035
   132
  qed
wenzelm@13515
   133
  fix x y assume x: "x \<in> U" and y: "y \<in> U"
wenzelm@13515
   134
  from uv and x y show "x + y \<in> U" by (rule subspace.add_closed)
wenzelm@13515
   135
  from uv and x show "\<And>a. a \<cdot> x \<in> U" by (rule subspace.mult_closed)
wenzelm@9035
   136
qed
wenzelm@7535
   137
wenzelm@7535
   138
wenzelm@9035
   139
subsection {* Linear closure *}
wenzelm@7808
   140
wenzelm@10687
   141
text {*
wenzelm@10687
   142
  The \emph{linear closure} of a vector @{text x} is the set of all
wenzelm@10687
   143
  scalar multiples of @{text x}.
wenzelm@10687
   144
*}
wenzelm@7535
   145
wenzelm@19736
   146
definition
wenzelm@21404
   147
  lin :: "('a::{minus, plus, zero}) \<Rightarrow> 'a set" where
wenzelm@19736
   148
  "lin x = {a \<cdot> x | a. True}"
wenzelm@7535
   149
wenzelm@13515
   150
lemma linI [intro]: "y = a \<cdot> x \<Longrightarrow> y \<in> lin x"
wenzelm@27612
   151
  unfolding lin_def by blast
wenzelm@7535
   152
wenzelm@13515
   153
lemma linI' [iff]: "a \<cdot> x \<in> lin x"
wenzelm@27612
   154
  unfolding lin_def by blast
wenzelm@13515
   155
wenzelm@27612
   156
lemma linE [elim]: "x \<in> lin v \<Longrightarrow> (\<And>a::real. x = a \<cdot> v \<Longrightarrow> C) \<Longrightarrow> C"
wenzelm@27612
   157
  unfolding lin_def by blast
wenzelm@13515
   158
wenzelm@7656
   159
wenzelm@9035
   160
text {* Every vector is contained in its linear closure. *}
wenzelm@7917
   161
wenzelm@13515
   162
lemma (in vectorspace) x_lin_x [iff]: "x \<in> V \<Longrightarrow> x \<in> lin x"
wenzelm@13515
   163
proof -
wenzelm@13515
   164
  assume "x \<in> V"
wenzelm@27612
   165
  then have "x = 1 \<cdot> x" by simp
wenzelm@13515
   166
  also have "\<dots> \<in> lin x" ..
wenzelm@13515
   167
  finally show ?thesis .
wenzelm@13515
   168
qed
wenzelm@13515
   169
wenzelm@13515
   170
lemma (in vectorspace) "0_lin_x" [iff]: "x \<in> V \<Longrightarrow> 0 \<in> lin x"
wenzelm@13515
   171
proof
wenzelm@13515
   172
  assume "x \<in> V"
wenzelm@27612
   173
  then show "0 = 0 \<cdot> x" by simp
wenzelm@13515
   174
qed
wenzelm@7535
   175
wenzelm@9035
   176
text {* Any linear closure is a subspace. *}
wenzelm@7917
   177
wenzelm@13515
   178
lemma (in vectorspace) lin_subspace [intro]:
wenzelm@13515
   179
  "x \<in> V \<Longrightarrow> lin x \<unlhd> V"
wenzelm@9035
   180
proof
wenzelm@13515
   181
  assume x: "x \<in> V"
wenzelm@27612
   182
  then show "lin x \<noteq> {}" by (auto simp add: x_lin_x)
wenzelm@10687
   183
  show "lin x \<subseteq> V"
wenzelm@13515
   184
  proof
wenzelm@13515
   185
    fix x' assume "x' \<in> lin x"
wenzelm@13515
   186
    then obtain a where "x' = a \<cdot> x" ..
wenzelm@13515
   187
    with x show "x' \<in> V" by simp
wenzelm@9035
   188
  qed
wenzelm@13515
   189
  fix x' x'' assume x': "x' \<in> lin x" and x'': "x'' \<in> lin x"
wenzelm@13515
   190
  show "x' + x'' \<in> lin x"
wenzelm@13515
   191
  proof -
wenzelm@13515
   192
    from x' obtain a' where "x' = a' \<cdot> x" ..
wenzelm@13515
   193
    moreover from x'' obtain a'' where "x'' = a'' \<cdot> x" ..
wenzelm@13515
   194
    ultimately have "x' + x'' = (a' + a'') \<cdot> x"
wenzelm@13515
   195
      using x by (simp add: distrib)
wenzelm@13515
   196
    also have "\<dots> \<in> lin x" ..
wenzelm@13515
   197
    finally show ?thesis .
wenzelm@9035
   198
  qed
wenzelm@13515
   199
  fix a :: real
wenzelm@13515
   200
  show "a \<cdot> x' \<in> lin x"
wenzelm@13515
   201
  proof -
wenzelm@13515
   202
    from x' obtain a' where "x' = a' \<cdot> x" ..
wenzelm@13515
   203
    with x have "a \<cdot> x' = (a * a') \<cdot> x" by (simp add: mult_assoc)
wenzelm@13515
   204
    also have "\<dots> \<in> lin x" ..
wenzelm@13515
   205
    finally show ?thesis .
wenzelm@10687
   206
  qed
wenzelm@9035
   207
qed
wenzelm@7535
   208
wenzelm@13515
   209
wenzelm@9035
   210
text {* Any linear closure is a vector space. *}
wenzelm@7917
   211
wenzelm@13515
   212
lemma (in vectorspace) lin_vectorspace [intro]:
wenzelm@23378
   213
  assumes "x \<in> V"
wenzelm@23378
   214
  shows "vectorspace (lin x)"
wenzelm@23378
   215
proof -
wenzelm@23378
   216
  from `x \<in> V` have "subspace (lin x) V"
wenzelm@23378
   217
    by (rule lin_subspace)
wenzelm@26199
   218
  from this and vectorspace_axioms show ?thesis
wenzelm@23378
   219
    by (rule subspace.vectorspace)
wenzelm@23378
   220
qed
wenzelm@7808
   221
wenzelm@7808
   222
wenzelm@9035
   223
subsection {* Sum of two vectorspaces *}
wenzelm@7808
   224
wenzelm@10687
   225
text {*
wenzelm@10687
   226
  The \emph{sum} of two vectorspaces @{text U} and @{text V} is the
wenzelm@10687
   227
  set of all sums of elements from @{text U} and @{text V}.
wenzelm@10687
   228
*}
wenzelm@7535
   229
wenzelm@27612
   230
instantiation "fun" :: (type, type) plus
wenzelm@27612
   231
begin
wenzelm@7917
   232
wenzelm@27612
   233
definition
wenzelm@27612
   234
  sum_def: "plus_fun U V = {u + v | u v. u \<in> U \<and> v \<in> V}"  (* FIXME not fully general!? *)
wenzelm@27612
   235
wenzelm@27612
   236
instance ..
wenzelm@27612
   237
wenzelm@27612
   238
end
wenzelm@7917
   239
wenzelm@13515
   240
lemma sumE [elim]:
wenzelm@13515
   241
    "x \<in> U + V \<Longrightarrow> (\<And>u v. x = u + v \<Longrightarrow> u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> C) \<Longrightarrow> C"
wenzelm@27612
   242
  unfolding sum_def by blast
wenzelm@7535
   243
wenzelm@13515
   244
lemma sumI [intro]:
wenzelm@13515
   245
    "u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> x = u + v \<Longrightarrow> x \<in> U + V"
wenzelm@27612
   246
  unfolding sum_def by blast
wenzelm@7566
   247
wenzelm@13515
   248
lemma sumI' [intro]:
wenzelm@13515
   249
    "u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> u + v \<in> U + V"
wenzelm@27612
   250
  unfolding sum_def by blast
wenzelm@7917
   251
wenzelm@10687
   252
text {* @{text U} is a subspace of @{text "U + V"}. *}
wenzelm@7535
   253
wenzelm@13515
   254
lemma subspace_sum1 [iff]:
ballarin@27611
   255
  assumes "vectorspace U" "vectorspace V"
wenzelm@13515
   256
  shows "U \<unlhd> U + V"
ballarin@27611
   257
proof -
ballarin@27611
   258
  interpret vectorspace [U] by fact
ballarin@27611
   259
  interpret vectorspace [V] by fact
wenzelm@27612
   260
  show ?thesis
wenzelm@27612
   261
  proof
ballarin@27611
   262
    show "U \<noteq> {}" ..
ballarin@27611
   263
    show "U \<subseteq> U + V"
ballarin@27611
   264
    proof
ballarin@27611
   265
      fix x assume x: "x \<in> U"
ballarin@27611
   266
      moreover have "0 \<in> V" ..
ballarin@27611
   267
      ultimately have "x + 0 \<in> U + V" ..
ballarin@27611
   268
      with x show "x \<in> U + V" by simp
ballarin@27611
   269
    qed
ballarin@27611
   270
    fix x y assume x: "x \<in> U" and "y \<in> U"
wenzelm@27612
   271
    then show "x + y \<in> U" by simp
ballarin@27611
   272
    from x show "\<And>a. a \<cdot> x \<in> U" by simp
wenzelm@9035
   273
  qed
wenzelm@9035
   274
qed
wenzelm@7535
   275
wenzelm@13515
   276
text {* The sum of two subspaces is again a subspace. *}
wenzelm@7917
   277
wenzelm@13515
   278
lemma sum_subspace [intro?]:
ballarin@27611
   279
  assumes "subspace U E" "vectorspace E" "subspace V E"
wenzelm@13515
   280
  shows "U + V \<unlhd> E"
ballarin@27611
   281
proof -
ballarin@27611
   282
  interpret subspace [U E] by fact
ballarin@27611
   283
  interpret vectorspace [E] by fact
ballarin@27611
   284
  interpret subspace [V E] by fact
wenzelm@27612
   285
  show ?thesis
wenzelm@27612
   286
  proof
ballarin@27611
   287
    have "0 \<in> U + V"
ballarin@27611
   288
    proof
ballarin@27611
   289
      show "0 \<in> U" using `vectorspace E` ..
ballarin@27611
   290
      show "0 \<in> V" using `vectorspace E` ..
ballarin@27611
   291
      show "(0::'a) = 0 + 0" by simp
ballarin@27611
   292
    qed
wenzelm@27612
   293
    then show "U + V \<noteq> {}" by blast
ballarin@27611
   294
    show "U + V \<subseteq> E"
ballarin@27611
   295
    proof
ballarin@27611
   296
      fix x assume "x \<in> U + V"
ballarin@27611
   297
      then obtain u v where "x = u + v" and
ballarin@27611
   298
	"u \<in> U" and "v \<in> V" ..
ballarin@27611
   299
      then show "x \<in> E" by simp
ballarin@27611
   300
    qed
ballarin@27611
   301
    fix x y assume x: "x \<in> U + V" and y: "y \<in> U + V"
ballarin@27611
   302
    show "x + y \<in> U + V"
ballarin@27611
   303
    proof -
ballarin@27611
   304
      from x obtain ux vx where "x = ux + vx" and "ux \<in> U" and "vx \<in> V" ..
ballarin@27611
   305
      moreover
ballarin@27611
   306
      from y obtain uy vy where "y = uy + vy" and "uy \<in> U" and "vy \<in> V" ..
ballarin@27611
   307
      ultimately
ballarin@27611
   308
      have "ux + uy \<in> U"
ballarin@27611
   309
	and "vx + vy \<in> V"
ballarin@27611
   310
	and "x + y = (ux + uy) + (vx + vy)"
ballarin@27611
   311
	using x y by (simp_all add: add_ac)
wenzelm@27612
   312
      then show ?thesis ..
ballarin@27611
   313
    qed
ballarin@27611
   314
    fix a show "a \<cdot> x \<in> U + V"
ballarin@27611
   315
    proof -
ballarin@27611
   316
      from x obtain u v where "x = u + v" and "u \<in> U" and "v \<in> V" ..
wenzelm@27612
   317
      then have "a \<cdot> u \<in> U" and "a \<cdot> v \<in> V"
ballarin@27611
   318
	and "a \<cdot> x = (a \<cdot> u) + (a \<cdot> v)" by (simp_all add: distrib)
wenzelm@27612
   319
      then show ?thesis ..
ballarin@27611
   320
    qed
wenzelm@9035
   321
  qed
wenzelm@9035
   322
qed
wenzelm@7535
   323
wenzelm@9035
   324
text{* The sum of two subspaces is a vectorspace. *}
wenzelm@7917
   325
wenzelm@13515
   326
lemma sum_vs [intro?]:
wenzelm@13515
   327
    "U \<unlhd> E \<Longrightarrow> V \<unlhd> E \<Longrightarrow> vectorspace E \<Longrightarrow> vectorspace (U + V)"
wenzelm@13547
   328
  by (rule subspace.vectorspace) (rule sum_subspace)
wenzelm@7535
   329
wenzelm@7808
   330
wenzelm@9035
   331
subsection {* Direct sums *}
wenzelm@7808
   332
wenzelm@10687
   333
text {*
wenzelm@10687
   334
  The sum of @{text U} and @{text V} is called \emph{direct}, iff the
wenzelm@10687
   335
  zero element is the only common element of @{text U} and @{text
wenzelm@10687
   336
  V}. For every element @{text x} of the direct sum of @{text U} and
wenzelm@10687
   337
  @{text V} the decomposition in @{text "x = u + v"} with
wenzelm@10687
   338
  @{text "u \<in> U"} and @{text "v \<in> V"} is unique.
wenzelm@10687
   339
*}
wenzelm@7808
   340
wenzelm@10687
   341
lemma decomp:
ballarin@27611
   342
  assumes "vectorspace E" "subspace U E" "subspace V E"
wenzelm@13515
   343
  assumes direct: "U \<inter> V = {0}"
wenzelm@13515
   344
    and u1: "u1 \<in> U" and u2: "u2 \<in> U"
wenzelm@13515
   345
    and v1: "v1 \<in> V" and v2: "v2 \<in> V"
wenzelm@13515
   346
    and sum: "u1 + v1 = u2 + v2"
wenzelm@13515
   347
  shows "u1 = u2 \<and> v1 = v2"
ballarin@27611
   348
proof -
ballarin@27611
   349
  interpret vectorspace [E] by fact
ballarin@27611
   350
  interpret subspace [U E] by fact
ballarin@27611
   351
  interpret subspace [V E] by fact
wenzelm@27612
   352
  show ?thesis
wenzelm@27612
   353
  proof
ballarin@27611
   354
    have U: "vectorspace U"  (* FIXME: use interpret *)
ballarin@27611
   355
      using `subspace U E` `vectorspace E` by (rule subspace.vectorspace)
ballarin@27611
   356
    have V: "vectorspace V"
ballarin@27611
   357
      using `subspace V E` `vectorspace E` by (rule subspace.vectorspace)
ballarin@27611
   358
    from u1 u2 v1 v2 and sum have eq: "u1 - u2 = v2 - v1"
ballarin@27611
   359
      by (simp add: add_diff_swap)
ballarin@27611
   360
    from u1 u2 have u: "u1 - u2 \<in> U"
ballarin@27611
   361
      by (rule vectorspace.diff_closed [OF U])
ballarin@27611
   362
    with eq have v': "v2 - v1 \<in> U" by (simp only:)
ballarin@27611
   363
    from v2 v1 have v: "v2 - v1 \<in> V"
ballarin@27611
   364
      by (rule vectorspace.diff_closed [OF V])
ballarin@27611
   365
    with eq have u': " u1 - u2 \<in> V" by (simp only:)
ballarin@27611
   366
    
ballarin@27611
   367
    show "u1 = u2"
ballarin@27611
   368
    proof (rule add_minus_eq)
ballarin@27611
   369
      from u1 show "u1 \<in> E" ..
ballarin@27611
   370
      from u2 show "u2 \<in> E" ..
ballarin@27611
   371
      from u u' and direct show "u1 - u2 = 0" by blast
ballarin@27611
   372
    qed
ballarin@27611
   373
    show "v1 = v2"
ballarin@27611
   374
    proof (rule add_minus_eq [symmetric])
ballarin@27611
   375
      from v1 show "v1 \<in> E" ..
ballarin@27611
   376
      from v2 show "v2 \<in> E" ..
ballarin@27611
   377
      from v v' and direct show "v2 - v1 = 0" by blast
ballarin@27611
   378
    qed
wenzelm@9035
   379
  qed
wenzelm@9035
   380
qed
wenzelm@7656
   381
wenzelm@10687
   382
text {*
wenzelm@10687
   383
  An application of the previous lemma will be used in the proof of
wenzelm@10687
   384
  the Hahn-Banach Theorem (see page \pageref{decomp-H-use}): for any
wenzelm@10687
   385
  element @{text "y + a \<cdot> x\<^sub>0"} of the direct sum of a
wenzelm@10687
   386
  vectorspace @{text H} and the linear closure of @{text "x\<^sub>0"}
wenzelm@10687
   387
  the components @{text "y \<in> H"} and @{text a} are uniquely
wenzelm@10687
   388
  determined.
wenzelm@10687
   389
*}
wenzelm@7917
   390
wenzelm@10687
   391
lemma decomp_H':
ballarin@27611
   392
  assumes "vectorspace E" "subspace H E"
wenzelm@13515
   393
  assumes y1: "y1 \<in> H" and y2: "y2 \<in> H"
wenzelm@13515
   394
    and x': "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
wenzelm@13515
   395
    and eq: "y1 + a1 \<cdot> x' = y2 + a2 \<cdot> x'"
wenzelm@13515
   396
  shows "y1 = y2 \<and> a1 = a2"
ballarin@27611
   397
proof -
ballarin@27611
   398
  interpret vectorspace [E] by fact
ballarin@27611
   399
  interpret subspace [H E] by fact
wenzelm@27612
   400
  show ?thesis
wenzelm@27612
   401
  proof
ballarin@27611
   402
    have c: "y1 = y2 \<and> a1 \<cdot> x' = a2 \<cdot> x'"
ballarin@27611
   403
    proof (rule decomp)
ballarin@27611
   404
      show "a1 \<cdot> x' \<in> lin x'" ..
ballarin@27611
   405
      show "a2 \<cdot> x' \<in> lin x'" ..
ballarin@27611
   406
      show "H \<inter> lin x' = {0}"
wenzelm@13515
   407
      proof
ballarin@27611
   408
	show "H \<inter> lin x' \<subseteq> {0}"
ballarin@27611
   409
	proof
ballarin@27611
   410
          fix x assume x: "x \<in> H \<inter> lin x'"
ballarin@27611
   411
          then obtain a where xx': "x = a \<cdot> x'"
ballarin@27611
   412
            by blast
ballarin@27611
   413
          have "x = 0"
ballarin@27611
   414
          proof cases
ballarin@27611
   415
            assume "a = 0"
ballarin@27611
   416
            with xx' and x' show ?thesis by simp
ballarin@27611
   417
          next
ballarin@27611
   418
            assume a: "a \<noteq> 0"
ballarin@27611
   419
            from x have "x \<in> H" ..
ballarin@27611
   420
            with xx' have "inverse a \<cdot> a \<cdot> x' \<in> H" by simp
ballarin@27611
   421
            with a and x' have "x' \<in> H" by (simp add: mult_assoc2)
ballarin@27611
   422
            with `x' \<notin> H` show ?thesis by contradiction
ballarin@27611
   423
          qed
wenzelm@27612
   424
          then show "x \<in> {0}" ..
ballarin@27611
   425
	qed
ballarin@27611
   426
	show "{0} \<subseteq> H \<inter> lin x'"
ballarin@27611
   427
	proof -
ballarin@27611
   428
          have "0 \<in> H" using `vectorspace E` ..
ballarin@27611
   429
          moreover have "0 \<in> lin x'" using `x' \<in> E` ..
ballarin@27611
   430
          ultimately show ?thesis by blast
ballarin@27611
   431
	qed
wenzelm@9035
   432
      qed
ballarin@27611
   433
      show "lin x' \<unlhd> E" using `x' \<in> E` ..
ballarin@27611
   434
    qed (rule `vectorspace E`, rule `subspace H E`, rule y1, rule y2, rule eq)
wenzelm@27612
   435
    then show "y1 = y2" ..
ballarin@27611
   436
    from c have "a1 \<cdot> x' = a2 \<cdot> x'" ..
ballarin@27611
   437
    with x' show "a1 = a2" by (simp add: mult_right_cancel)
ballarin@27611
   438
  qed
wenzelm@9035
   439
qed
wenzelm@7535
   440
wenzelm@10687
   441
text {*
wenzelm@10687
   442
  Since for any element @{text "y + a \<cdot> x'"} of the direct sum of a
wenzelm@10687
   443
  vectorspace @{text H} and the linear closure of @{text x'} the
wenzelm@10687
   444
  components @{text "y \<in> H"} and @{text a} are unique, it follows from
wenzelm@10687
   445
  @{text "y \<in> H"} that @{text "a = 0"}.
wenzelm@10687
   446
*}
wenzelm@7917
   447
wenzelm@10687
   448
lemma decomp_H'_H:
ballarin@27611
   449
  assumes "vectorspace E" "subspace H E"
wenzelm@13515
   450
  assumes t: "t \<in> H"
wenzelm@13515
   451
    and x': "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
wenzelm@13515
   452
  shows "(SOME (y, a). t = y + a \<cdot> x' \<and> y \<in> H) = (t, 0)"
ballarin@27611
   453
proof -
ballarin@27611
   454
  interpret vectorspace [E] by fact
ballarin@27611
   455
  interpret subspace [H E] by fact
wenzelm@27612
   456
  show ?thesis
wenzelm@27612
   457
  proof (rule, simp_all only: split_paired_all split_conv)
ballarin@27611
   458
    from t x' show "t = t + 0 \<cdot> x' \<and> t \<in> H" by simp
ballarin@27611
   459
    fix y and a assume ya: "t = y + a \<cdot> x' \<and> y \<in> H"
ballarin@27611
   460
    have "y = t \<and> a = 0"
ballarin@27611
   461
    proof (rule decomp_H')
ballarin@27611
   462
      from ya x' show "y + a \<cdot> x' = t + 0 \<cdot> x'" by simp
ballarin@27611
   463
      from ya show "y \<in> H" ..
ballarin@27611
   464
    qed (rule `vectorspace E`, rule `subspace H E`, rule t, (rule x')+)
ballarin@27611
   465
    with t x' show "(y, a) = (y + a \<cdot> x', 0)" by simp
ballarin@27611
   466
  qed
wenzelm@13515
   467
qed
wenzelm@7535
   468
wenzelm@10687
   469
text {*
wenzelm@10687
   470
  The components @{text "y \<in> H"} and @{text a} in @{text "y + a \<cdot> x'"}
wenzelm@10687
   471
  are unique, so the function @{text h'} defined by
wenzelm@10687
   472
  @{text "h' (y + a \<cdot> x') = h y + a \<cdot> \<xi>"} is definite.
wenzelm@10687
   473
*}
wenzelm@7917
   474
bauerg@9374
   475
lemma h'_definite:
ballarin@27611
   476
  fixes H
wenzelm@13515
   477
  assumes h'_def:
wenzelm@13515
   478
    "h' \<equiv> (\<lambda>x. let (y, a) = SOME (y, a). (x = y + a \<cdot> x' \<and> y \<in> H)
wenzelm@13515
   479
                in (h y) + a * xi)"
wenzelm@13515
   480
    and x: "x = y + a \<cdot> x'"
ballarin@27611
   481
  assumes "vectorspace E" "subspace H E"
wenzelm@13515
   482
  assumes y: "y \<in> H"
wenzelm@13515
   483
    and x': "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
wenzelm@13515
   484
  shows "h' x = h y + a * xi"
wenzelm@10687
   485
proof -
ballarin@27611
   486
  interpret vectorspace [E] by fact
ballarin@27611
   487
  interpret subspace [H E] by fact
wenzelm@13515
   488
  from x y x' have "x \<in> H + lin x'" by auto
wenzelm@13515
   489
  have "\<exists>!p. (\<lambda>(y, a). x = y + a \<cdot> x' \<and> y \<in> H) p" (is "\<exists>!p. ?P p")
wenzelm@18689
   490
  proof (rule ex_ex1I)
wenzelm@13515
   491
    from x y show "\<exists>p. ?P p" by blast
wenzelm@13515
   492
    fix p q assume p: "?P p" and q: "?P q"
wenzelm@13515
   493
    show "p = q"
wenzelm@9035
   494
    proof -
wenzelm@13515
   495
      from p have xp: "x = fst p + snd p \<cdot> x' \<and> fst p \<in> H"
wenzelm@13515
   496
        by (cases p) simp
wenzelm@13515
   497
      from q have xq: "x = fst q + snd q \<cdot> x' \<and> fst q \<in> H"
wenzelm@13515
   498
        by (cases q) simp
wenzelm@13515
   499
      have "fst p = fst q \<and> snd p = snd q"
wenzelm@13515
   500
      proof (rule decomp_H')
wenzelm@13515
   501
        from xp show "fst p \<in> H" ..
wenzelm@13515
   502
        from xq show "fst q \<in> H" ..
wenzelm@13515
   503
        from xp and xq show "fst p + snd p \<cdot> x' = fst q + snd q \<cdot> x'"
wenzelm@13515
   504
          by simp
wenzelm@23378
   505
      qed (rule `vectorspace E`, rule `subspace H E`, (rule x')+)
wenzelm@27612
   506
      then show ?thesis by (cases p, cases q) simp
wenzelm@9035
   507
    qed
wenzelm@9035
   508
  qed
wenzelm@27612
   509
  then have eq: "(SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H) = (y, a)"
wenzelm@13515
   510
    by (rule some1_equality) (simp add: x y)
wenzelm@13515
   511
  with h'_def show "h' x = h y + a * xi" by (simp add: Let_def)
wenzelm@9035
   512
qed
wenzelm@7535
   513
wenzelm@10687
   514
end