src/HOL/HahnBanach/Subspace.thy
 changeset 29252 ea97aa6aeba2 parent 29234 60f7fb56f8cd parent 29197 6d4cb27ed19c child 30729 461ee3e49ad3
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/HOL/HahnBanach/Subspace.thy	Tue Dec 30 11:10:01 2008 +0100
1.3 @@ -0,0 +1,513 @@
1.4 +(*  Title:      HOL/Real/HahnBanach/Subspace.thy
1.5 +    Author:     Gertrud Bauer, TU Munich
1.6 +*)
1.7 +
1.9 +
1.10 +theory Subspace
1.11 +imports VectorSpace
1.12 +begin
1.13 +
1.14 +subsection {* Definition *}
1.15 +
1.16 +text {*
1.17 +  A non-empty subset @{text U} of a vector space @{text V} is a
1.18 +  \emph{subspace} of @{text V}, iff @{text U} is closed under addition
1.19 +  and scalar multiplication.
1.20 +*}
1.21 +
1.22 +locale subspace =
1.23 +  fixes U :: "'a\<Colon>{minus, plus, zero, uminus} set" and V
1.24 +  assumes non_empty [iff, intro]: "U \<noteq> {}"
1.25 +    and subset [iff]: "U \<subseteq> V"
1.26 +    and add_closed [iff]: "x \<in> U \<Longrightarrow> y \<in> U \<Longrightarrow> x + y \<in> U"
1.27 +    and mult_closed [iff]: "x \<in> U \<Longrightarrow> a \<cdot> x \<in> U"
1.28 +
1.29 +notation (symbols)
1.30 +  subspace  (infix "\<unlhd>" 50)
1.31 +
1.32 +declare vectorspace.intro [intro?] subspace.intro [intro?]
1.33 +
1.34 +lemma subspace_subset [elim]: "U \<unlhd> V \<Longrightarrow> U \<subseteq> V"
1.35 +  by (rule subspace.subset)
1.36 +
1.37 +lemma (in subspace) subsetD [iff]: "x \<in> U \<Longrightarrow> x \<in> V"
1.38 +  using subset by blast
1.39 +
1.40 +lemma subspaceD [elim]: "U \<unlhd> V \<Longrightarrow> x \<in> U \<Longrightarrow> x \<in> V"
1.41 +  by (rule subspace.subsetD)
1.42 +
1.43 +lemma rev_subspaceD [elim?]: "x \<in> U \<Longrightarrow> U \<unlhd> V \<Longrightarrow> x \<in> V"
1.44 +  by (rule subspace.subsetD)
1.45 +
1.46 +lemma (in subspace) diff_closed [iff]:
1.47 +  assumes "vectorspace V"
1.48 +  assumes x: "x \<in> U" and y: "y \<in> U"
1.49 +  shows "x - y \<in> U"
1.50 +proof -
1.51 +  interpret vectorspace V by fact
1.52 +  from x y show ?thesis by (simp add: diff_eq1 negate_eq1)
1.53 +qed
1.54 +
1.55 +text {*
1.56 +  \medskip Similar as for linear spaces, the existence of the zero
1.57 +  element in every subspace follows from the non-emptiness of the
1.58 +  carrier set and by vector space laws.
1.59 +*}
1.60 +
1.61 +lemma (in subspace) zero [intro]:
1.62 +  assumes "vectorspace V"
1.63 +  shows "0 \<in> U"
1.64 +proof -
1.65 +  interpret V!: vectorspace V by fact
1.66 +  have "U \<noteq> {}" by (rule non_empty)
1.67 +  then obtain x where x: "x \<in> U" by blast
1.68 +  then have "x \<in> V" .. then have "0 = x - x" by simp
1.69 +  also from vectorspace V x x have "\<dots> \<in> U" by (rule diff_closed)
1.70 +  finally show ?thesis .
1.71 +qed
1.72 +
1.73 +lemma (in subspace) neg_closed [iff]:
1.74 +  assumes "vectorspace V"
1.75 +  assumes x: "x \<in> U"
1.76 +  shows "- x \<in> U"
1.77 +proof -
1.78 +  interpret vectorspace V by fact
1.79 +  from x show ?thesis by (simp add: negate_eq1)
1.80 +qed
1.81 +
1.82 +text {* \medskip Further derived laws: every subspace is a vector space. *}
1.83 +
1.84 +lemma (in subspace) vectorspace [iff]:
1.85 +  assumes "vectorspace V"
1.86 +  shows "vectorspace U"
1.87 +proof -
1.88 +  interpret vectorspace V by fact
1.89 +  show ?thesis
1.90 +  proof
1.91 +    show "U \<noteq> {}" ..
1.92 +    fix x y z assume x: "x \<in> U" and y: "y \<in> U" and z: "z \<in> U"
1.93 +    fix a b :: real
1.94 +    from x y show "x + y \<in> U" by simp
1.95 +    from x show "a \<cdot> x \<in> U" by simp
1.96 +    from x y z show "(x + y) + z = x + (y + z)" by (simp add: add_ac)
1.97 +    from x y show "x + y = y + x" by (simp add: add_ac)
1.98 +    from x show "x - x = 0" by simp
1.99 +    from x show "0 + x = x" by simp
1.100 +    from x y show "a \<cdot> (x + y) = a \<cdot> x + a \<cdot> y" by (simp add: distrib)
1.101 +    from x show "(a + b) \<cdot> x = a \<cdot> x + b \<cdot> x" by (simp add: distrib)
1.102 +    from x show "(a * b) \<cdot> x = a \<cdot> b \<cdot> x" by (simp add: mult_assoc)
1.103 +    from x show "1 \<cdot> x = x" by simp
1.104 +    from x show "- x = - 1 \<cdot> x" by (simp add: negate_eq1)
1.105 +    from x y show "x - y = x + - y" by (simp add: diff_eq1)
1.106 +  qed
1.107 +qed
1.108 +
1.109 +
1.110 +text {* The subspace relation is reflexive. *}
1.111 +
1.112 +lemma (in vectorspace) subspace_refl [intro]: "V \<unlhd> V"
1.113 +proof
1.114 +  show "V \<noteq> {}" ..
1.115 +  show "V \<subseteq> V" ..
1.116 +  fix x y assume x: "x \<in> V" and y: "y \<in> V"
1.117 +  fix a :: real
1.118 +  from x y show "x + y \<in> V" by simp
1.119 +  from x show "a \<cdot> x \<in> V" by simp
1.120 +qed
1.121 +
1.122 +text {* The subspace relation is transitive. *}
1.123 +
1.124 +lemma (in vectorspace) subspace_trans [trans]:
1.125 +  "U \<unlhd> V \<Longrightarrow> V \<unlhd> W \<Longrightarrow> U \<unlhd> W"
1.126 +proof
1.127 +  assume uv: "U \<unlhd> V" and vw: "V \<unlhd> W"
1.128 +  from uv show "U \<noteq> {}" by (rule subspace.non_empty)
1.129 +  show "U \<subseteq> W"
1.130 +  proof -
1.131 +    from uv have "U \<subseteq> V" by (rule subspace.subset)
1.132 +    also from vw have "V \<subseteq> W" by (rule subspace.subset)
1.133 +    finally show ?thesis .
1.134 +  qed
1.135 +  fix x y assume x: "x \<in> U" and y: "y \<in> U"
1.136 +  from uv and x y show "x + y \<in> U" by (rule subspace.add_closed)
1.137 +  from uv and x show "\<And>a. a \<cdot> x \<in> U" by (rule subspace.mult_closed)
1.138 +qed
1.139 +
1.140 +
1.141 +subsection {* Linear closure *}
1.142 +
1.143 +text {*
1.144 +  The \emph{linear closure} of a vector @{text x} is the set of all
1.145 +  scalar multiples of @{text x}.
1.146 +*}
1.147 +
1.148 +definition
1.149 +  lin :: "('a::{minus, plus, zero}) \<Rightarrow> 'a set" where
1.150 +  "lin x = {a \<cdot> x | a. True}"
1.151 +
1.152 +lemma linI [intro]: "y = a \<cdot> x \<Longrightarrow> y \<in> lin x"
1.153 +  unfolding lin_def by blast
1.154 +
1.155 +lemma linI' [iff]: "a \<cdot> x \<in> lin x"
1.156 +  unfolding lin_def by blast
1.157 +
1.158 +lemma linE [elim]: "x \<in> lin v \<Longrightarrow> (\<And>a::real. x = a \<cdot> v \<Longrightarrow> C) \<Longrightarrow> C"
1.159 +  unfolding lin_def by blast
1.160 +
1.161 +
1.162 +text {* Every vector is contained in its linear closure. *}
1.163 +
1.164 +lemma (in vectorspace) x_lin_x [iff]: "x \<in> V \<Longrightarrow> x \<in> lin x"
1.165 +proof -
1.166 +  assume "x \<in> V"
1.167 +  then have "x = 1 \<cdot> x" by simp
1.168 +  also have "\<dots> \<in> lin x" ..
1.169 +  finally show ?thesis .
1.170 +qed
1.171 +
1.172 +lemma (in vectorspace) "0_lin_x" [iff]: "x \<in> V \<Longrightarrow> 0 \<in> lin x"
1.173 +proof
1.174 +  assume "x \<in> V"
1.175 +  then show "0 = 0 \<cdot> x" by simp
1.176 +qed
1.177 +
1.178 +text {* Any linear closure is a subspace. *}
1.179 +
1.180 +lemma (in vectorspace) lin_subspace [intro]:
1.181 +  "x \<in> V \<Longrightarrow> lin x \<unlhd> V"
1.182 +proof
1.183 +  assume x: "x \<in> V"
1.184 +  then show "lin x \<noteq> {}" by (auto simp add: x_lin_x)
1.185 +  show "lin x \<subseteq> V"
1.186 +  proof
1.187 +    fix x' assume "x' \<in> lin x"
1.188 +    then obtain a where "x' = a \<cdot> x" ..
1.189 +    with x show "x' \<in> V" by simp
1.190 +  qed
1.191 +  fix x' x'' assume x': "x' \<in> lin x" and x'': "x'' \<in> lin x"
1.192 +  show "x' + x'' \<in> lin x"
1.193 +  proof -
1.194 +    from x' obtain a' where "x' = a' \<cdot> x" ..
1.195 +    moreover from x'' obtain a'' where "x'' = a'' \<cdot> x" ..
1.196 +    ultimately have "x' + x'' = (a' + a'') \<cdot> x"
1.197 +      using x by (simp add: distrib)
1.198 +    also have "\<dots> \<in> lin x" ..
1.199 +    finally show ?thesis .
1.200 +  qed
1.201 +  fix a :: real
1.202 +  show "a \<cdot> x' \<in> lin x"
1.203 +  proof -
1.204 +    from x' obtain a' where "x' = a' \<cdot> x" ..
1.205 +    with x have "a \<cdot> x' = (a * a') \<cdot> x" by (simp add: mult_assoc)
1.206 +    also have "\<dots> \<in> lin x" ..
1.207 +    finally show ?thesis .
1.208 +  qed
1.209 +qed
1.210 +
1.211 +
1.212 +text {* Any linear closure is a vector space. *}
1.213 +
1.214 +lemma (in vectorspace) lin_vectorspace [intro]:
1.215 +  assumes "x \<in> V"
1.216 +  shows "vectorspace (lin x)"
1.217 +proof -
1.218 +  from x \<in> V have "subspace (lin x) V"
1.219 +    by (rule lin_subspace)
1.220 +  from this and vectorspace_axioms show ?thesis
1.221 +    by (rule subspace.vectorspace)
1.222 +qed
1.223 +
1.224 +
1.225 +subsection {* Sum of two vectorspaces *}
1.226 +
1.227 +text {*
1.228 +  The \emph{sum} of two vectorspaces @{text U} and @{text V} is the
1.229 +  set of all sums of elements from @{text U} and @{text V}.
1.230 +*}
1.231 +
1.232 +instantiation "fun" :: (type, type) plus
1.233 +begin
1.234 +
1.235 +definition
1.236 +  sum_def: "plus_fun U V = {u + v | u v. u \<in> U \<and> v \<in> V}"  (* FIXME not fully general!? *)
1.237 +
1.238 +instance ..
1.239 +
1.240 +end
1.241 +
1.242 +lemma sumE [elim]:
1.243 +    "x \<in> U + V \<Longrightarrow> (\<And>u v. x = u + v \<Longrightarrow> u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> C) \<Longrightarrow> C"
1.244 +  unfolding sum_def by blast
1.245 +
1.246 +lemma sumI [intro]:
1.247 +    "u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> x = u + v \<Longrightarrow> x \<in> U + V"
1.248 +  unfolding sum_def by blast
1.249 +
1.250 +lemma sumI' [intro]:
1.251 +    "u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> u + v \<in> U + V"
1.252 +  unfolding sum_def by blast
1.253 +
1.254 +text {* @{text U} is a subspace of @{text "U + V"}. *}
1.255 +
1.256 +lemma subspace_sum1 [iff]:
1.257 +  assumes "vectorspace U" "vectorspace V"
1.258 +  shows "U \<unlhd> U + V"
1.259 +proof -
1.260 +  interpret vectorspace U by fact
1.261 +  interpret vectorspace V by fact
1.262 +  show ?thesis
1.263 +  proof
1.264 +    show "U \<noteq> {}" ..
1.265 +    show "U \<subseteq> U + V"
1.266 +    proof
1.267 +      fix x assume x: "x \<in> U"
1.268 +      moreover have "0 \<in> V" ..
1.269 +      ultimately have "x + 0 \<in> U + V" ..
1.270 +      with x show "x \<in> U + V" by simp
1.271 +    qed
1.272 +    fix x y assume x: "x \<in> U" and "y \<in> U"
1.273 +    then show "x + y \<in> U" by simp
1.274 +    from x show "\<And>a. a \<cdot> x \<in> U" by simp
1.275 +  qed
1.276 +qed
1.277 +
1.278 +text {* The sum of two subspaces is again a subspace. *}
1.279 +
1.280 +lemma sum_subspace [intro?]:
1.281 +  assumes "subspace U E" "vectorspace E" "subspace V E"
1.282 +  shows "U + V \<unlhd> E"
1.283 +proof -
1.284 +  interpret subspace U E by fact
1.285 +  interpret vectorspace E by fact
1.286 +  interpret subspace V E by fact
1.287 +  show ?thesis
1.288 +  proof
1.289 +    have "0 \<in> U + V"
1.290 +    proof
1.291 +      show "0 \<in> U" using vectorspace E ..
1.292 +      show "0 \<in> V" using vectorspace E ..
1.293 +      show "(0::'a) = 0 + 0" by simp
1.294 +    qed
1.295 +    then show "U + V \<noteq> {}" by blast
1.296 +    show "U + V \<subseteq> E"
1.297 +    proof
1.298 +      fix x assume "x \<in> U + V"
1.299 +      then obtain u v where "x = u + v" and
1.300 +	"u \<in> U" and "v \<in> V" ..
1.301 +      then show "x \<in> E" by simp
1.302 +    qed
1.303 +    fix x y assume x: "x \<in> U + V" and y: "y \<in> U + V"
1.304 +    show "x + y \<in> U + V"
1.305 +    proof -
1.306 +      from x obtain ux vx where "x = ux + vx" and "ux \<in> U" and "vx \<in> V" ..
1.307 +      moreover
1.308 +      from y obtain uy vy where "y = uy + vy" and "uy \<in> U" and "vy \<in> V" ..
1.309 +      ultimately
1.310 +      have "ux + uy \<in> U"
1.311 +	and "vx + vy \<in> V"
1.312 +	and "x + y = (ux + uy) + (vx + vy)"
1.314 +      then show ?thesis ..
1.315 +    qed
1.316 +    fix a show "a \<cdot> x \<in> U + V"
1.317 +    proof -
1.318 +      from x obtain u v where "x = u + v" and "u \<in> U" and "v \<in> V" ..
1.319 +      then have "a \<cdot> u \<in> U" and "a \<cdot> v \<in> V"
1.320 +	and "a \<cdot> x = (a \<cdot> u) + (a \<cdot> v)" by (simp_all add: distrib)
1.321 +      then show ?thesis ..
1.322 +    qed
1.323 +  qed
1.324 +qed
1.325 +
1.326 +text{* The sum of two subspaces is a vectorspace. *}
1.327 +
1.328 +lemma sum_vs [intro?]:
1.329 +    "U \<unlhd> E \<Longrightarrow> V \<unlhd> E \<Longrightarrow> vectorspace E \<Longrightarrow> vectorspace (U + V)"
1.330 +  by (rule subspace.vectorspace) (rule sum_subspace)
1.331 +
1.332 +
1.333 +subsection {* Direct sums *}
1.334 +
1.335 +text {*
1.336 +  The sum of @{text U} and @{text V} is called \emph{direct}, iff the
1.337 +  zero element is the only common element of @{text U} and @{text
1.338 +  V}. For every element @{text x} of the direct sum of @{text U} and
1.339 +  @{text V} the decomposition in @{text "x = u + v"} with
1.340 +  @{text "u \<in> U"} and @{text "v \<in> V"} is unique.
1.341 +*}
1.342 +
1.343 +lemma decomp:
1.344 +  assumes "vectorspace E" "subspace U E" "subspace V E"
1.345 +  assumes direct: "U \<inter> V = {0}"
1.346 +    and u1: "u1 \<in> U" and u2: "u2 \<in> U"
1.347 +    and v1: "v1 \<in> V" and v2: "v2 \<in> V"
1.348 +    and sum: "u1 + v1 = u2 + v2"
1.349 +  shows "u1 = u2 \<and> v1 = v2"
1.350 +proof -
1.351 +  interpret vectorspace E by fact
1.352 +  interpret subspace U E by fact
1.353 +  interpret subspace V E by fact
1.354 +  show ?thesis
1.355 +  proof
1.356 +    have U: "vectorspace U"  (* FIXME: use interpret *)
1.357 +      using subspace U E vectorspace E by (rule subspace.vectorspace)
1.358 +    have V: "vectorspace V"
1.359 +      using subspace V E vectorspace E by (rule subspace.vectorspace)
1.360 +    from u1 u2 v1 v2 and sum have eq: "u1 - u2 = v2 - v1"
1.362 +    from u1 u2 have u: "u1 - u2 \<in> U"
1.363 +      by (rule vectorspace.diff_closed [OF U])
1.364 +    with eq have v': "v2 - v1 \<in> U" by (simp only:)
1.365 +    from v2 v1 have v: "v2 - v1 \<in> V"
1.366 +      by (rule vectorspace.diff_closed [OF V])
1.367 +    with eq have u': " u1 - u2 \<in> V" by (simp only:)
1.368 +
1.369 +    show "u1 = u2"
1.371 +      from u1 show "u1 \<in> E" ..
1.372 +      from u2 show "u2 \<in> E" ..
1.373 +      from u u' and direct show "u1 - u2 = 0" by blast
1.374 +    qed
1.375 +    show "v1 = v2"
1.376 +    proof (rule add_minus_eq [symmetric])
1.377 +      from v1 show "v1 \<in> E" ..
1.378 +      from v2 show "v2 \<in> E" ..
1.379 +      from v v' and direct show "v2 - v1 = 0" by blast
1.380 +    qed
1.381 +  qed
1.382 +qed
1.383 +
1.384 +text {*
1.385 +  An application of the previous lemma will be used in the proof of
1.386 +  the Hahn-Banach Theorem (see page \pageref{decomp-H-use}): for any
1.387 +  element @{text "y + a \<cdot> x\<^sub>0"} of the direct sum of a
1.388 +  vectorspace @{text H} and the linear closure of @{text "x\<^sub>0"}
1.389 +  the components @{text "y \<in> H"} and @{text a} are uniquely
1.390 +  determined.
1.391 +*}
1.392 +
1.393 +lemma decomp_H':
1.394 +  assumes "vectorspace E" "subspace H E"
1.395 +  assumes y1: "y1 \<in> H" and y2: "y2 \<in> H"
1.396 +    and x': "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
1.397 +    and eq: "y1 + a1 \<cdot> x' = y2 + a2 \<cdot> x'"
1.398 +  shows "y1 = y2 \<and> a1 = a2"
1.399 +proof -
1.400 +  interpret vectorspace E by fact
1.401 +  interpret subspace H E by fact
1.402 +  show ?thesis
1.403 +  proof
1.404 +    have c: "y1 = y2 \<and> a1 \<cdot> x' = a2 \<cdot> x'"
1.405 +    proof (rule decomp)
1.406 +      show "a1 \<cdot> x' \<in> lin x'" ..
1.407 +      show "a2 \<cdot> x' \<in> lin x'" ..
1.408 +      show "H \<inter> lin x' = {0}"
1.409 +      proof
1.410 +	show "H \<inter> lin x' \<subseteq> {0}"
1.411 +	proof
1.412 +          fix x assume x: "x \<in> H \<inter> lin x'"
1.413 +          then obtain a where xx': "x = a \<cdot> x'"
1.414 +            by blast
1.415 +          have "x = 0"
1.416 +          proof cases
1.417 +            assume "a = 0"
1.418 +            with xx' and x' show ?thesis by simp
1.419 +          next
1.420 +            assume a: "a \<noteq> 0"
1.421 +            from x have "x \<in> H" ..
1.422 +            with xx' have "inverse a \<cdot> a \<cdot> x' \<in> H" by simp
1.423 +            with a and x' have "x' \<in> H" by (simp add: mult_assoc2)
1.424 +            with x' \<notin> H show ?thesis by contradiction
1.425 +          qed
1.426 +          then show "x \<in> {0}" ..
1.427 +	qed
1.428 +	show "{0} \<subseteq> H \<inter> lin x'"
1.429 +	proof -
1.430 +          have "0 \<in> H" using vectorspace E ..
1.431 +          moreover have "0 \<in> lin x'" using x' \<in> E ..
1.432 +          ultimately show ?thesis by blast
1.433 +	qed
1.434 +      qed
1.435 +      show "lin x' \<unlhd> E" using x' \<in> E ..
1.436 +    qed (rule vectorspace E, rule subspace H E, rule y1, rule y2, rule eq)
1.437 +    then show "y1 = y2" ..
1.438 +    from c have "a1 \<cdot> x' = a2 \<cdot> x'" ..
1.439 +    with x' show "a1 = a2" by (simp add: mult_right_cancel)
1.440 +  qed
1.441 +qed
1.442 +
1.443 +text {*
1.444 +  Since for any element @{text "y + a \<cdot> x'"} of the direct sum of a
1.445 +  vectorspace @{text H} and the linear closure of @{text x'} the
1.446 +  components @{text "y \<in> H"} and @{text a} are unique, it follows from
1.447 +  @{text "y \<in> H"} that @{text "a = 0"}.
1.448 +*}
1.449 +
1.450 +lemma decomp_H'_H:
1.451 +  assumes "vectorspace E" "subspace H E"
1.452 +  assumes t: "t \<in> H"
1.453 +    and x': "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
1.454 +  shows "(SOME (y, a). t = y + a \<cdot> x' \<and> y \<in> H) = (t, 0)"
1.455 +proof -
1.456 +  interpret vectorspace E by fact
1.457 +  interpret subspace H E by fact
1.458 +  show ?thesis
1.459 +  proof (rule, simp_all only: split_paired_all split_conv)
1.460 +    from t x' show "t = t + 0 \<cdot> x' \<and> t \<in> H" by simp
1.461 +    fix y and a assume ya: "t = y + a \<cdot> x' \<and> y \<in> H"
1.462 +    have "y = t \<and> a = 0"
1.463 +    proof (rule decomp_H')
1.464 +      from ya x' show "y + a \<cdot> x' = t + 0 \<cdot> x'" by simp
1.465 +      from ya show "y \<in> H" ..
1.466 +    qed (rule vectorspace E, rule subspace H E, rule t, (rule x')+)
1.467 +    with t x' show "(y, a) = (y + a \<cdot> x', 0)" by simp
1.468 +  qed
1.469 +qed
1.470 +
1.471 +text {*
1.472 +  The components @{text "y \<in> H"} and @{text a} in @{text "y + a \<cdot> x'"}
1.473 +  are unique, so the function @{text h'} defined by
1.474 +  @{text "h' (y + a \<cdot> x') = h y + a \<cdot> \<xi>"} is definite.
1.475 +*}
1.476 +
1.477 +lemma h'_definite:
1.478 +  fixes H
1.479 +  assumes h'_def:
1.480 +    "h' \<equiv> (\<lambda>x. let (y, a) = SOME (y, a). (x = y + a \<cdot> x' \<and> y \<in> H)
1.481 +                in (h y) + a * xi)"
1.482 +    and x: "x = y + a \<cdot> x'"
1.483 +  assumes "vectorspace E" "subspace H E"
1.484 +  assumes y: "y \<in> H"
1.485 +    and x': "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
1.486 +  shows "h' x = h y + a * xi"
1.487 +proof -
1.488 +  interpret vectorspace E by fact
1.489 +  interpret subspace H E by fact
1.490 +  from x y x' have "x \<in> H + lin x'" by auto
1.491 +  have "\<exists>!p. (\<lambda>(y, a). x = y + a \<cdot> x' \<and> y \<in> H) p" (is "\<exists>!p. ?P p")
1.492 +  proof (rule ex_ex1I)
1.493 +    from x y show "\<exists>p. ?P p" by blast
1.494 +    fix p q assume p: "?P p" and q: "?P q"
1.495 +    show "p = q"
1.496 +    proof -
1.497 +      from p have xp: "x = fst p + snd p \<cdot> x' \<and> fst p \<in> H"
1.498 +        by (cases p) simp
1.499 +      from q have xq: "x = fst q + snd q \<cdot> x' \<and> fst q \<in> H"
1.500 +        by (cases q) simp
1.501 +      have "fst p = fst q \<and> snd p = snd q"
1.502 +      proof (rule decomp_H')
1.503 +        from xp show "fst p \<in> H" ..
1.504 +        from xq show "fst q \<in> H" ..
1.505 +        from xp and xq show "fst p + snd p \<cdot> x' = fst q + snd q \<cdot> x'"
1.506 +          by simp
1.507 +      qed (rule vectorspace E, rule subspace H E, (rule x')+)
1.508 +      then show ?thesis by (cases p, cases q) simp
1.509 +    qed
1.510 +  qed
1.511 +  then have eq: "(SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H) = (y, a)"
1.512 +    by (rule some1_equality) (simp add: x y)
1.513 +  with h'_def show "h' x = h y + a * xi" by (simp add: Let_def)
1.514 +qed
1.515 +
1.516 +end