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