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