standard naming conventions for session and theories;
authorwenzelm
Wed, 24 Jun 2009 21:46:54 +0200
changeset 31795be3e1cc5005c
parent 31794 71af1fd6a5e4
child 31797 294b955d0e80
child 31799 117300d72398
standard naming conventions for session and theories;
src/HOL/HahnBanach/Bounds.thy
src/HOL/HahnBanach/FunctionNorm.thy
src/HOL/HahnBanach/FunctionOrder.thy
src/HOL/HahnBanach/HahnBanach.thy
src/HOL/HahnBanach/HahnBanachExtLemmas.thy
src/HOL/HahnBanach/HahnBanachLemmas.thy
src/HOL/HahnBanach/HahnBanachSupLemmas.thy
src/HOL/HahnBanach/Linearform.thy
src/HOL/HahnBanach/NormedSpace.thy
src/HOL/HahnBanach/README.html
src/HOL/HahnBanach/ROOT.ML
src/HOL/HahnBanach/Subspace.thy
src/HOL/HahnBanach/VectorSpace.thy
src/HOL/HahnBanach/ZornLemma.thy
src/HOL/HahnBanach/document/root.bib
src/HOL/HahnBanach/document/root.tex
src/HOL/Hahn_Banach/Bounds.thy
src/HOL/Hahn_Banach/Function_Norm.thy
src/HOL/Hahn_Banach/Function_Order.thy
src/HOL/Hahn_Banach/Hahn_Banach.thy
src/HOL/Hahn_Banach/Hahn_Banach_Ext_Lemmas.thy
src/HOL/Hahn_Banach/Hahn_Banach_Lemmas.thy
src/HOL/Hahn_Banach/Hahn_Banach_Sup_Lemmas.thy
src/HOL/Hahn_Banach/Linearform.thy
src/HOL/Hahn_Banach/Normed_Space.thy
src/HOL/Hahn_Banach/README.html
src/HOL/Hahn_Banach/ROOT.ML
src/HOL/Hahn_Banach/Subspace.thy
src/HOL/Hahn_Banach/Vector_Space.thy
src/HOL/Hahn_Banach/Zorn_Lemma.thy
src/HOL/Hahn_Banach/document/root.bib
src/HOL/Hahn_Banach/document/root.tex
src/HOL/IsaMakefile
src/HOL/README.html
     1.1 --- a/src/HOL/HahnBanach/Bounds.thy	Wed Jun 24 21:28:02 2009 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,82 +0,0 @@
     1.4 -(*  Title:      HOL/Real/HahnBanach/Bounds.thy
     1.5 -    Author:     Gertrud Bauer, TU Munich
     1.6 -*)
     1.7 -
     1.8 -header {* Bounds *}
     1.9 -
    1.10 -theory Bounds
    1.11 -imports Main ContNotDenum
    1.12 -begin
    1.13 -
    1.14 -locale lub =
    1.15 -  fixes A and x
    1.16 -  assumes least [intro?]: "(\<And>a. a \<in> A \<Longrightarrow> a \<le> b) \<Longrightarrow> x \<le> b"
    1.17 -    and upper [intro?]: "a \<in> A \<Longrightarrow> a \<le> x"
    1.18 -
    1.19 -lemmas [elim?] = lub.least lub.upper
    1.20 -
    1.21 -definition
    1.22 -  the_lub :: "'a::order set \<Rightarrow> 'a" where
    1.23 -  "the_lub A = The (lub A)"
    1.24 -
    1.25 -notation (xsymbols)
    1.26 -  the_lub  ("\<Squnion>_" [90] 90)
    1.27 -
    1.28 -lemma the_lub_equality [elim?]:
    1.29 -  assumes "lub A x"
    1.30 -  shows "\<Squnion>A = (x::'a::order)"
    1.31 -proof -
    1.32 -  interpret lub A x by fact
    1.33 -  show ?thesis
    1.34 -  proof (unfold the_lub_def)
    1.35 -    from `lub A x` show "The (lub A) = x"
    1.36 -    proof
    1.37 -      fix x' assume lub': "lub A x'"
    1.38 -      show "x' = x"
    1.39 -      proof (rule order_antisym)
    1.40 -	from lub' show "x' \<le> x"
    1.41 -	proof
    1.42 -          fix a assume "a \<in> A"
    1.43 -          then show "a \<le> x" ..
    1.44 -	qed
    1.45 -	show "x \<le> x'"
    1.46 -	proof
    1.47 -          fix a assume "a \<in> A"
    1.48 -          with lub' show "a \<le> x'" ..
    1.49 -	qed
    1.50 -      qed
    1.51 -    qed
    1.52 -  qed
    1.53 -qed
    1.54 -
    1.55 -lemma the_lubI_ex:
    1.56 -  assumes ex: "\<exists>x. lub A x"
    1.57 -  shows "lub A (\<Squnion>A)"
    1.58 -proof -
    1.59 -  from ex obtain x where x: "lub A x" ..
    1.60 -  also from x have [symmetric]: "\<Squnion>A = x" ..
    1.61 -  finally show ?thesis .
    1.62 -qed
    1.63 -
    1.64 -lemma lub_compat: "lub A x = isLub UNIV A x"
    1.65 -proof -
    1.66 -  have "isUb UNIV A = (\<lambda>x. A *<= x \<and> x \<in> UNIV)"
    1.67 -    by (rule ext) (simp only: isUb_def)
    1.68 -  then show ?thesis
    1.69 -    by (simp only: lub_def isLub_def leastP_def setge_def setle_def) blast
    1.70 -qed
    1.71 -
    1.72 -lemma real_complete:
    1.73 -  fixes A :: "real set"
    1.74 -  assumes nonempty: "\<exists>a. a \<in> A"
    1.75 -    and ex_upper: "\<exists>y. \<forall>a \<in> A. a \<le> y"
    1.76 -  shows "\<exists>x. lub A x"
    1.77 -proof -
    1.78 -  from ex_upper have "\<exists>y. isUb UNIV A y"
    1.79 -    unfolding isUb_def setle_def by blast
    1.80 -  with nonempty have "\<exists>x. isLub UNIV A x"
    1.81 -    by (rule reals_complete)
    1.82 -  then show ?thesis by (simp only: lub_compat)
    1.83 -qed
    1.84 -
    1.85 -end
     2.1 --- a/src/HOL/HahnBanach/FunctionNorm.thy	Wed Jun 24 21:28:02 2009 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,278 +0,0 @@
     2.4 -(*  Title:      HOL/Real/HahnBanach/FunctionNorm.thy
     2.5 -    Author:     Gertrud Bauer, TU Munich
     2.6 -*)
     2.7 -
     2.8 -header {* The norm of a function *}
     2.9 -
    2.10 -theory FunctionNorm
    2.11 -imports NormedSpace FunctionOrder
    2.12 -begin
    2.13 -
    2.14 -subsection {* Continuous linear forms*}
    2.15 -
    2.16 -text {*
    2.17 -  A linear form @{text f} on a normed vector space @{text "(V, \<parallel>\<cdot>\<parallel>)"}
    2.18 -  is \emph{continuous}, iff it is bounded, i.e.
    2.19 -  \begin{center}
    2.20 -  @{text "\<exists>c \<in> R. \<forall>x \<in> V. \<bar>f x\<bar> \<le> c \<cdot> \<parallel>x\<parallel>"}
    2.21 -  \end{center}
    2.22 -  In our application no other functions than linear forms are
    2.23 -  considered, so we can define continuous linear forms as bounded
    2.24 -  linear forms:
    2.25 -*}
    2.26 -
    2.27 -locale continuous = var_V + norm_syntax + linearform +
    2.28 -  assumes bounded: "\<exists>c. \<forall>x \<in> V. \<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>"
    2.29 -
    2.30 -declare continuous.intro [intro?] continuous_axioms.intro [intro?]
    2.31 -
    2.32 -lemma continuousI [intro]:
    2.33 -  fixes norm :: "_ \<Rightarrow> real"  ("\<parallel>_\<parallel>")
    2.34 -  assumes "linearform V f"
    2.35 -  assumes r: "\<And>x. x \<in> V \<Longrightarrow> \<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>"
    2.36 -  shows "continuous V norm f"
    2.37 -proof
    2.38 -  show "linearform V f" by fact
    2.39 -  from r have "\<exists>c. \<forall>x\<in>V. \<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>" by blast
    2.40 -  then show "continuous_axioms V norm f" ..
    2.41 -qed
    2.42 -
    2.43 -
    2.44 -subsection {* The norm of a linear form *}
    2.45 -
    2.46 -text {*
    2.47 -  The least real number @{text c} for which holds
    2.48 -  \begin{center}
    2.49 -  @{text "\<forall>x \<in> V. \<bar>f x\<bar> \<le> c \<cdot> \<parallel>x\<parallel>"}
    2.50 -  \end{center}
    2.51 -  is called the \emph{norm} of @{text f}.
    2.52 -
    2.53 -  For non-trivial vector spaces @{text "V \<noteq> {0}"} the norm can be
    2.54 -  defined as
    2.55 -  \begin{center}
    2.56 -  @{text "\<parallel>f\<parallel> = \<sup>x \<noteq> 0. \<bar>f x\<bar> / \<parallel>x\<parallel>"}
    2.57 -  \end{center}
    2.58 -
    2.59 -  For the case @{text "V = {0}"} the supremum would be taken from an
    2.60 -  empty set. Since @{text \<real>} is unbounded, there would be no supremum.
    2.61 -  To avoid this situation it must be guaranteed that there is an
    2.62 -  element in this set. This element must be @{text "{} \<ge> 0"} so that
    2.63 -  @{text fn_norm} has the norm properties. Furthermore it does not
    2.64 -  have to change the norm in all other cases, so it must be @{text 0},
    2.65 -  as all other elements are @{text "{} \<ge> 0"}.
    2.66 -
    2.67 -  Thus we define the set @{text B} where the supremum is taken from as
    2.68 -  follows:
    2.69 -  \begin{center}
    2.70 -  @{text "{0} \<union> {\<bar>f x\<bar> / \<parallel>x\<parallel>. x \<noteq> 0 \<and> x \<in> F}"}
    2.71 -  \end{center}
    2.72 -
    2.73 -  @{text fn_norm} is equal to the supremum of @{text B}, if the
    2.74 -  supremum exists (otherwise it is undefined).
    2.75 -*}
    2.76 -
    2.77 -locale fn_norm = norm_syntax +
    2.78 -  fixes B defines "B V f \<equiv> {0} \<union> {\<bar>f x\<bar> / \<parallel>x\<parallel> | x. x \<noteq> 0 \<and> x \<in> V}"
    2.79 -  fixes fn_norm ("\<parallel>_\<parallel>\<hyphen>_" [0, 1000] 999)
    2.80 -  defines "\<parallel>f\<parallel>\<hyphen>V \<equiv> \<Squnion>(B V f)"
    2.81 -
    2.82 -locale normed_vectorspace_with_fn_norm = normed_vectorspace + fn_norm
    2.83 -
    2.84 -lemma (in fn_norm) B_not_empty [intro]: "0 \<in> B V f"
    2.85 -  by (simp add: B_def)
    2.86 -
    2.87 -text {*
    2.88 -  The following lemma states that every continuous linear form on a
    2.89 -  normed space @{text "(V, \<parallel>\<cdot>\<parallel>)"} has a function norm.
    2.90 -*}
    2.91 -
    2.92 -lemma (in normed_vectorspace_with_fn_norm) fn_norm_works:
    2.93 -  assumes "continuous V norm f"
    2.94 -  shows "lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)"
    2.95 -proof -
    2.96 -  interpret continuous V norm f by fact
    2.97 -  txt {* The existence of the supremum is shown using the
    2.98 -    completeness of the reals. Completeness means, that every
    2.99 -    non-empty bounded set of reals has a supremum. *}
   2.100 -  have "\<exists>a. lub (B V f) a"
   2.101 -  proof (rule real_complete)
   2.102 -    txt {* First we have to show that @{text B} is non-empty: *}
   2.103 -    have "0 \<in> B V f" ..
   2.104 -    then show "\<exists>x. x \<in> B V f" ..
   2.105 -
   2.106 -    txt {* Then we have to show that @{text B} is bounded: *}
   2.107 -    show "\<exists>c. \<forall>y \<in> B V f. y \<le> c"
   2.108 -    proof -
   2.109 -      txt {* We know that @{text f} is bounded by some value @{text c}. *}
   2.110 -      from bounded obtain c where c: "\<forall>x \<in> V. \<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>" ..
   2.111 -
   2.112 -      txt {* To prove the thesis, we have to show that there is some
   2.113 -        @{text b}, such that @{text "y \<le> b"} for all @{text "y \<in>
   2.114 -        B"}. Due to the definition of @{text B} there are two cases. *}
   2.115 -
   2.116 -      def b \<equiv> "max c 0"
   2.117 -      have "\<forall>y \<in> B V f. y \<le> b"
   2.118 -      proof
   2.119 -        fix y assume y: "y \<in> B V f"
   2.120 -        show "y \<le> b"
   2.121 -        proof cases
   2.122 -          assume "y = 0"
   2.123 -          then show ?thesis unfolding b_def by arith
   2.124 -        next
   2.125 -          txt {* The second case is @{text "y = \<bar>f x\<bar> / \<parallel>x\<parallel>"} for some
   2.126 -            @{text "x \<in> V"} with @{text "x \<noteq> 0"}. *}
   2.127 -          assume "y \<noteq> 0"
   2.128 -          with y obtain x where y_rep: "y = \<bar>f x\<bar> * inverse \<parallel>x\<parallel>"
   2.129 -              and x: "x \<in> V" and neq: "x \<noteq> 0"
   2.130 -            by (auto simp add: B_def real_divide_def)
   2.131 -          from x neq have gt: "0 < \<parallel>x\<parallel>" ..
   2.132 -
   2.133 -          txt {* The thesis follows by a short calculation using the
   2.134 -            fact that @{text f} is bounded. *}
   2.135 -
   2.136 -          note y_rep
   2.137 -          also have "\<bar>f x\<bar> * inverse \<parallel>x\<parallel> \<le> (c * \<parallel>x\<parallel>) * inverse \<parallel>x\<parallel>"
   2.138 -          proof (rule mult_right_mono)
   2.139 -            from c x show "\<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>" ..
   2.140 -            from gt have "0 < inverse \<parallel>x\<parallel>" 
   2.141 -              by (rule positive_imp_inverse_positive)
   2.142 -            then show "0 \<le> inverse \<parallel>x\<parallel>" by (rule order_less_imp_le)
   2.143 -          qed
   2.144 -          also have "\<dots> = c * (\<parallel>x\<parallel> * inverse \<parallel>x\<parallel>)"
   2.145 -            by (rule real_mult_assoc)
   2.146 -          also
   2.147 -          from gt have "\<parallel>x\<parallel> \<noteq> 0" by simp
   2.148 -          then have "\<parallel>x\<parallel> * inverse \<parallel>x\<parallel> = 1" by simp 
   2.149 -          also have "c * 1 \<le> b" by (simp add: b_def le_maxI1)
   2.150 -          finally show "y \<le> b" .
   2.151 -        qed
   2.152 -      qed
   2.153 -      then show ?thesis ..
   2.154 -    qed
   2.155 -  qed
   2.156 -  then show ?thesis unfolding fn_norm_def by (rule the_lubI_ex)
   2.157 -qed
   2.158 -
   2.159 -lemma (in normed_vectorspace_with_fn_norm) fn_norm_ub [iff?]:
   2.160 -  assumes "continuous V norm f"
   2.161 -  assumes b: "b \<in> B V f"
   2.162 -  shows "b \<le> \<parallel>f\<parallel>\<hyphen>V"
   2.163 -proof -
   2.164 -  interpret continuous V norm f by fact
   2.165 -  have "lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)"
   2.166 -    using `continuous V norm f` by (rule fn_norm_works)
   2.167 -  from this and b show ?thesis ..
   2.168 -qed
   2.169 -
   2.170 -lemma (in normed_vectorspace_with_fn_norm) fn_norm_leastB:
   2.171 -  assumes "continuous V norm f"
   2.172 -  assumes b: "\<And>b. b \<in> B V f \<Longrightarrow> b \<le> y"
   2.173 -  shows "\<parallel>f\<parallel>\<hyphen>V \<le> y"
   2.174 -proof -
   2.175 -  interpret continuous V norm f by fact
   2.176 -  have "lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)"
   2.177 -    using `continuous V norm f` by (rule fn_norm_works)
   2.178 -  from this and b show ?thesis ..
   2.179 -qed
   2.180 -
   2.181 -text {* The norm of a continuous function is always @{text "\<ge> 0"}. *}
   2.182 -
   2.183 -lemma (in normed_vectorspace_with_fn_norm) fn_norm_ge_zero [iff]:
   2.184 -  assumes "continuous V norm f"
   2.185 -  shows "0 \<le> \<parallel>f\<parallel>\<hyphen>V"
   2.186 -proof -
   2.187 -  interpret continuous V norm f by fact
   2.188 -  txt {* The function norm is defined as the supremum of @{text B}.
   2.189 -    So it is @{text "\<ge> 0"} if all elements in @{text B} are @{text "\<ge>
   2.190 -    0"}, provided the supremum exists and @{text B} is not empty. *}
   2.191 -  have "lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)"
   2.192 -    using `continuous V norm f` by (rule fn_norm_works)
   2.193 -  moreover have "0 \<in> B V f" ..
   2.194 -  ultimately show ?thesis ..
   2.195 -qed
   2.196 -
   2.197 -text {*
   2.198 -  \medskip The fundamental property of function norms is:
   2.199 -  \begin{center}
   2.200 -  @{text "\<bar>f x\<bar> \<le> \<parallel>f\<parallel> \<cdot> \<parallel>x\<parallel>"}
   2.201 -  \end{center}
   2.202 -*}
   2.203 -
   2.204 -lemma (in normed_vectorspace_with_fn_norm) fn_norm_le_cong:
   2.205 -  assumes "continuous V norm f" "linearform V f"
   2.206 -  assumes x: "x \<in> V"
   2.207 -  shows "\<bar>f x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>V * \<parallel>x\<parallel>"
   2.208 -proof -
   2.209 -  interpret continuous V norm f by fact
   2.210 -  interpret linearform V f by fact
   2.211 -  show ?thesis
   2.212 -  proof cases
   2.213 -    assume "x = 0"
   2.214 -    then have "\<bar>f x\<bar> = \<bar>f 0\<bar>" by simp
   2.215 -    also have "f 0 = 0" by rule unfold_locales
   2.216 -    also have "\<bar>\<dots>\<bar> = 0" by simp
   2.217 -    also have a: "0 \<le> \<parallel>f\<parallel>\<hyphen>V"
   2.218 -      using `continuous V norm f` by (rule fn_norm_ge_zero)
   2.219 -    from x have "0 \<le> norm x" ..
   2.220 -    with a have "0 \<le> \<parallel>f\<parallel>\<hyphen>V * \<parallel>x\<parallel>" by (simp add: zero_le_mult_iff)
   2.221 -    finally show "\<bar>f x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>V * \<parallel>x\<parallel>" .
   2.222 -  next
   2.223 -    assume "x \<noteq> 0"
   2.224 -    with x have neq: "\<parallel>x\<parallel> \<noteq> 0" by simp
   2.225 -    then have "\<bar>f x\<bar> = (\<bar>f x\<bar> * inverse \<parallel>x\<parallel>) * \<parallel>x\<parallel>" by simp
   2.226 -    also have "\<dots> \<le>  \<parallel>f\<parallel>\<hyphen>V * \<parallel>x\<parallel>"
   2.227 -    proof (rule mult_right_mono)
   2.228 -      from x show "0 \<le> \<parallel>x\<parallel>" ..
   2.229 -      from x and neq have "\<bar>f x\<bar> * inverse \<parallel>x\<parallel> \<in> B V f"
   2.230 -	by (auto simp add: B_def real_divide_def)
   2.231 -      with `continuous V norm f` show "\<bar>f x\<bar> * inverse \<parallel>x\<parallel> \<le> \<parallel>f\<parallel>\<hyphen>V"
   2.232 -	by (rule fn_norm_ub)
   2.233 -    qed
   2.234 -    finally show ?thesis .
   2.235 -  qed
   2.236 -qed
   2.237 -
   2.238 -text {*
   2.239 -  \medskip The function norm is the least positive real number for
   2.240 -  which the following inequation holds:
   2.241 -  \begin{center}
   2.242 -    @{text "\<bar>f x\<bar> \<le> c \<cdot> \<parallel>x\<parallel>"}
   2.243 -  \end{center}
   2.244 -*}
   2.245 -
   2.246 -lemma (in normed_vectorspace_with_fn_norm) fn_norm_least [intro?]:
   2.247 -  assumes "continuous V norm f"
   2.248 -  assumes ineq: "\<forall>x \<in> V. \<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>" and ge: "0 \<le> c"
   2.249 -  shows "\<parallel>f\<parallel>\<hyphen>V \<le> c"
   2.250 -proof -
   2.251 -  interpret continuous V norm f by fact
   2.252 -  show ?thesis
   2.253 -  proof (rule fn_norm_leastB [folded B_def fn_norm_def])
   2.254 -    fix b assume b: "b \<in> B V f"
   2.255 -    show "b \<le> c"
   2.256 -    proof cases
   2.257 -      assume "b = 0"
   2.258 -      with ge show ?thesis by simp
   2.259 -    next
   2.260 -      assume "b \<noteq> 0"
   2.261 -      with b obtain x where b_rep: "b = \<bar>f x\<bar> * inverse \<parallel>x\<parallel>"
   2.262 -        and x_neq: "x \<noteq> 0" and x: "x \<in> V"
   2.263 -	by (auto simp add: B_def real_divide_def)
   2.264 -      note b_rep
   2.265 -      also have "\<bar>f x\<bar> * inverse \<parallel>x\<parallel> \<le> (c * \<parallel>x\<parallel>) * inverse \<parallel>x\<parallel>"
   2.266 -      proof (rule mult_right_mono)
   2.267 -	have "0 < \<parallel>x\<parallel>" using x x_neq ..
   2.268 -	then show "0 \<le> inverse \<parallel>x\<parallel>" by simp
   2.269 -	from ineq and x show "\<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>" ..
   2.270 -      qed
   2.271 -      also have "\<dots> = c"
   2.272 -      proof -
   2.273 -	from x_neq and x have "\<parallel>x\<parallel> \<noteq> 0" by simp
   2.274 -	then show ?thesis by simp
   2.275 -      qed
   2.276 -      finally show ?thesis .
   2.277 -    qed
   2.278 -  qed (insert `continuous V norm f`, simp_all add: continuous_def)
   2.279 -qed
   2.280 -
   2.281 -end
     3.1 --- a/src/HOL/HahnBanach/FunctionOrder.thy	Wed Jun 24 21:28:02 2009 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,142 +0,0 @@
     3.4 -(*  Title:      HOL/Real/HahnBanach/FunctionOrder.thy
     3.5 -    ID:         $Id$
     3.6 -    Author:     Gertrud Bauer, TU Munich
     3.7 -*)
     3.8 -
     3.9 -header {* An order on functions *}
    3.10 -
    3.11 -theory FunctionOrder
    3.12 -imports Subspace Linearform
    3.13 -begin
    3.14 -
    3.15 -subsection {* The graph of a function *}
    3.16 -
    3.17 -text {*
    3.18 -  We define the \emph{graph} of a (real) function @{text f} with
    3.19 -  domain @{text F} as the set
    3.20 -  \begin{center}
    3.21 -  @{text "{(x, f x). x \<in> F}"}
    3.22 -  \end{center}
    3.23 -  So we are modeling partial functions by specifying the domain and
    3.24 -  the mapping function. We use the term ``function'' also for its
    3.25 -  graph.
    3.26 -*}
    3.27 -
    3.28 -types 'a graph = "('a \<times> real) set"
    3.29 -
    3.30 -definition
    3.31 -  graph :: "'a set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> 'a graph" where
    3.32 -  "graph F f = {(x, f x) | x. x \<in> F}"
    3.33 -
    3.34 -lemma graphI [intro]: "x \<in> F \<Longrightarrow> (x, f x) \<in> graph F f"
    3.35 -  unfolding graph_def by blast
    3.36 -
    3.37 -lemma graphI2 [intro?]: "x \<in> F \<Longrightarrow> \<exists>t \<in> graph F f. t = (x, f x)"
    3.38 -  unfolding graph_def by blast
    3.39 -
    3.40 -lemma graphE [elim?]:
    3.41 -    "(x, y) \<in> graph F f \<Longrightarrow> (x \<in> F \<Longrightarrow> y = f x \<Longrightarrow> C) \<Longrightarrow> C"
    3.42 -  unfolding graph_def by blast
    3.43 -
    3.44 -
    3.45 -subsection {* Functions ordered by domain extension *}
    3.46 -
    3.47 -text {*
    3.48 -  A function @{text h'} is an extension of @{text h}, iff the graph of
    3.49 -  @{text h} is a subset of the graph of @{text h'}.
    3.50 -*}
    3.51 -
    3.52 -lemma graph_extI:
    3.53 -  "(\<And>x. x \<in> H \<Longrightarrow> h x = h' x) \<Longrightarrow> H \<subseteq> H'
    3.54 -    \<Longrightarrow> graph H h \<subseteq> graph H' h'"
    3.55 -  unfolding graph_def by blast
    3.56 -
    3.57 -lemma graph_extD1 [dest?]:
    3.58 -  "graph H h \<subseteq> graph H' h' \<Longrightarrow> x \<in> H \<Longrightarrow> h x = h' x"
    3.59 -  unfolding graph_def by blast
    3.60 -
    3.61 -lemma graph_extD2 [dest?]:
    3.62 -  "graph H h \<subseteq> graph H' h' \<Longrightarrow> H \<subseteq> H'"
    3.63 -  unfolding graph_def by blast
    3.64 -
    3.65 -
    3.66 -subsection {* Domain and function of a graph *}
    3.67 -
    3.68 -text {*
    3.69 -  The inverse functions to @{text graph} are @{text domain} and @{text
    3.70 -  funct}.
    3.71 -*}
    3.72 -
    3.73 -definition
    3.74 -  "domain" :: "'a graph \<Rightarrow> 'a set" where
    3.75 -  "domain g = {x. \<exists>y. (x, y) \<in> g}"
    3.76 -
    3.77 -definition
    3.78 -  funct :: "'a graph \<Rightarrow> ('a \<Rightarrow> real)" where
    3.79 -  "funct g = (\<lambda>x. (SOME y. (x, y) \<in> g))"
    3.80 -
    3.81 -text {*
    3.82 -  The following lemma states that @{text g} is the graph of a function
    3.83 -  if the relation induced by @{text g} is unique.
    3.84 -*}
    3.85 -
    3.86 -lemma graph_domain_funct:
    3.87 -  assumes uniq: "\<And>x y z. (x, y) \<in> g \<Longrightarrow> (x, z) \<in> g \<Longrightarrow> z = y"
    3.88 -  shows "graph (domain g) (funct g) = g"
    3.89 -  unfolding domain_def funct_def graph_def
    3.90 -proof auto  (* FIXME !? *)
    3.91 -  fix a b assume g: "(a, b) \<in> g"
    3.92 -  from g show "(a, SOME y. (a, y) \<in> g) \<in> g" by (rule someI2)
    3.93 -  from g show "\<exists>y. (a, y) \<in> g" ..
    3.94 -  from g show "b = (SOME y. (a, y) \<in> g)"
    3.95 -  proof (rule some_equality [symmetric])
    3.96 -    fix y assume "(a, y) \<in> g"
    3.97 -    with g show "y = b" by (rule uniq)
    3.98 -  qed
    3.99 -qed
   3.100 -
   3.101 -
   3.102 -subsection {* Norm-preserving extensions of a function *}
   3.103 -
   3.104 -text {*
   3.105 -  Given a linear form @{text f} on the space @{text F} and a seminorm
   3.106 -  @{text p} on @{text E}. The set of all linear extensions of @{text
   3.107 -  f}, to superspaces @{text H} of @{text F}, which are bounded by
   3.108 -  @{text p}, is defined as follows.
   3.109 -*}
   3.110 -
   3.111 -definition
   3.112 -  norm_pres_extensions ::
   3.113 -    "'a::{plus, minus, uminus, zero} set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> 'a set \<Rightarrow> ('a \<Rightarrow> real)
   3.114 -      \<Rightarrow> 'a graph set" where
   3.115 -    "norm_pres_extensions E p F f
   3.116 -      = {g. \<exists>H h. g = graph H h
   3.117 -          \<and> linearform H h
   3.118 -          \<and> H \<unlhd> E
   3.119 -          \<and> F \<unlhd> H
   3.120 -          \<and> graph F f \<subseteq> graph H h
   3.121 -          \<and> (\<forall>x \<in> H. h x \<le> p x)}"
   3.122 -
   3.123 -lemma norm_pres_extensionE [elim]:
   3.124 -  "g \<in> norm_pres_extensions E p F f
   3.125 -  \<Longrightarrow> (\<And>H h. g = graph H h \<Longrightarrow> linearform H h
   3.126 -        \<Longrightarrow> H \<unlhd> E \<Longrightarrow> F \<unlhd> H \<Longrightarrow> graph F f \<subseteq> graph H h
   3.127 -        \<Longrightarrow> \<forall>x \<in> H. h x \<le> p x \<Longrightarrow> C) \<Longrightarrow> C"
   3.128 -  unfolding norm_pres_extensions_def by blast
   3.129 -
   3.130 -lemma norm_pres_extensionI2 [intro]:
   3.131 -  "linearform H h \<Longrightarrow> H \<unlhd> E \<Longrightarrow> F \<unlhd> H
   3.132 -    \<Longrightarrow> graph F f \<subseteq> graph H h \<Longrightarrow> \<forall>x \<in> H. h x \<le> p x
   3.133 -    \<Longrightarrow> graph H h \<in> norm_pres_extensions E p F f"
   3.134 -  unfolding norm_pres_extensions_def by blast
   3.135 -
   3.136 -lemma norm_pres_extensionI:  (* FIXME ? *)
   3.137 -  "\<exists>H h. g = graph H h
   3.138 -    \<and> linearform H h
   3.139 -    \<and> H \<unlhd> E
   3.140 -    \<and> F \<unlhd> H
   3.141 -    \<and> graph F f \<subseteq> graph H h
   3.142 -    \<and> (\<forall>x \<in> H. h x \<le> p x) \<Longrightarrow> g \<in> norm_pres_extensions E p F f"
   3.143 -  unfolding norm_pres_extensions_def by blast
   3.144 -
   3.145 -end
     4.1 --- a/src/HOL/HahnBanach/HahnBanach.thy	Wed Jun 24 21:28:02 2009 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,509 +0,0 @@
     4.4 -(*  Title:      HOL/Real/HahnBanach/HahnBanach.thy
     4.5 -    Author:     Gertrud Bauer, TU Munich
     4.6 -*)
     4.7 -
     4.8 -header {* The Hahn-Banach Theorem *}
     4.9 -
    4.10 -theory HahnBanach
    4.11 -imports HahnBanachLemmas
    4.12 -begin
    4.13 -
    4.14 -text {*
    4.15 -  We present the proof of two different versions of the Hahn-Banach
    4.16 -  Theorem, closely following \cite[\S36]{Heuser:1986}.
    4.17 -*}
    4.18 -
    4.19 -subsection {* The Hahn-Banach Theorem for vector spaces *}
    4.20 -
    4.21 -text {*
    4.22 -  \textbf{Hahn-Banach Theorem.} Let @{text F} be a subspace of a real
    4.23 -  vector space @{text E}, let @{text p} be a semi-norm on @{text E},
    4.24 -  and @{text f} be a linear form defined on @{text F} such that @{text
    4.25 -  f} is bounded by @{text p}, i.e.  @{text "\<forall>x \<in> F. f x \<le> p x"}.  Then
    4.26 -  @{text f} can be extended to a linear form @{text h} on @{text E}
    4.27 -  such that @{text h} is norm-preserving, i.e. @{text h} is also
    4.28 -  bounded by @{text p}.
    4.29 -
    4.30 -  \bigskip
    4.31 -  \textbf{Proof Sketch.}
    4.32 -  \begin{enumerate}
    4.33 -
    4.34 -  \item Define @{text M} as the set of norm-preserving extensions of
    4.35 -  @{text f} to subspaces of @{text E}. The linear forms in @{text M}
    4.36 -  are ordered by domain extension.
    4.37 -
    4.38 -  \item We show that every non-empty chain in @{text M} has an upper
    4.39 -  bound in @{text M}.
    4.40 -
    4.41 -  \item With Zorn's Lemma we conclude that there is a maximal function
    4.42 -  @{text g} in @{text M}.
    4.43 -
    4.44 -  \item The domain @{text H} of @{text g} is the whole space @{text
    4.45 -  E}, as shown by classical contradiction:
    4.46 -
    4.47 -  \begin{itemize}
    4.48 -
    4.49 -  \item Assuming @{text g} is not defined on whole @{text E}, it can
    4.50 -  still be extended in a norm-preserving way to a super-space @{text
    4.51 -  H'} of @{text H}.
    4.52 -
    4.53 -  \item Thus @{text g} can not be maximal. Contradiction!
    4.54 -
    4.55 -  \end{itemize}
    4.56 -  \end{enumerate}
    4.57 -*}
    4.58 -
    4.59 -theorem HahnBanach:
    4.60 -  assumes E: "vectorspace E" and "subspace F E"
    4.61 -    and "seminorm E p" and "linearform F f"
    4.62 -  assumes fp: "\<forall>x \<in> F. f x \<le> p x"
    4.63 -  shows "\<exists>h. linearform E h \<and> (\<forall>x \<in> F. h x = f x) \<and> (\<forall>x \<in> E. h x \<le> p x)"
    4.64 -    -- {* Let @{text E} be a vector space, @{text F} a subspace of @{text E}, @{text p} a seminorm on @{text E}, *}
    4.65 -    -- {* and @{text f} a linear form on @{text F} such that @{text f} is bounded by @{text p}, *}
    4.66 -    -- {* then @{text f} can be extended to a linear form @{text h} on @{text E} in a norm-preserving way. \skp *}
    4.67 -proof -
    4.68 -  interpret vectorspace E by fact
    4.69 -  interpret subspace F E by fact
    4.70 -  interpret seminorm E p by fact
    4.71 -  interpret linearform F f by fact
    4.72 -  def M \<equiv> "norm_pres_extensions E p F f"
    4.73 -  then have M: "M = \<dots>" by (simp only:)
    4.74 -  from E have F: "vectorspace F" ..
    4.75 -  note FE = `F \<unlhd> E`
    4.76 -  {
    4.77 -    fix c assume cM: "c \<in> chain M" and ex: "\<exists>x. x \<in> c"
    4.78 -    have "\<Union>c \<in> M"
    4.79 -      -- {* Show that every non-empty chain @{text c} of @{text M} has an upper bound in @{text M}: *}
    4.80 -      -- {* @{text "\<Union>c"} is greater than any element of the chain @{text c}, so it suffices to show @{text "\<Union>c \<in> M"}. *}
    4.81 -      unfolding M_def
    4.82 -    proof (rule norm_pres_extensionI)
    4.83 -      let ?H = "domain (\<Union>c)"
    4.84 -      let ?h = "funct (\<Union>c)"
    4.85 -
    4.86 -      have a: "graph ?H ?h = \<Union>c"
    4.87 -      proof (rule graph_domain_funct)
    4.88 -        fix x y z assume "(x, y) \<in> \<Union>c" and "(x, z) \<in> \<Union>c"
    4.89 -        with M_def cM show "z = y" by (rule sup_definite)
    4.90 -      qed
    4.91 -      moreover from M cM a have "linearform ?H ?h"
    4.92 -        by (rule sup_lf)
    4.93 -      moreover from a M cM ex FE E have "?H \<unlhd> E"
    4.94 -        by (rule sup_subE)
    4.95 -      moreover from a M cM ex FE have "F \<unlhd> ?H"
    4.96 -        by (rule sup_supF)
    4.97 -      moreover from a M cM ex have "graph F f \<subseteq> graph ?H ?h"
    4.98 -        by (rule sup_ext)
    4.99 -      moreover from a M cM have "\<forall>x \<in> ?H. ?h x \<le> p x"
   4.100 -        by (rule sup_norm_pres)
   4.101 -      ultimately show "\<exists>H h. \<Union>c = graph H h
   4.102 -          \<and> linearform H h
   4.103 -          \<and> H \<unlhd> E
   4.104 -          \<and> F \<unlhd> H
   4.105 -          \<and> graph F f \<subseteq> graph H h
   4.106 -          \<and> (\<forall>x \<in> H. h x \<le> p x)" by blast
   4.107 -    qed
   4.108 -  }
   4.109 -  then have "\<exists>g \<in> M. \<forall>x \<in> M. g \<subseteq> x \<longrightarrow> g = x"
   4.110 -  -- {* With Zorn's Lemma we can conclude that there is a maximal element in @{text M}. \skp *}
   4.111 -  proof (rule Zorn's_Lemma)
   4.112 -      -- {* We show that @{text M} is non-empty: *}
   4.113 -    show "graph F f \<in> M"
   4.114 -      unfolding M_def
   4.115 -    proof (rule norm_pres_extensionI2)
   4.116 -      show "linearform F f" by fact
   4.117 -      show "F \<unlhd> E" by fact
   4.118 -      from F show "F \<unlhd> F" by (rule vectorspace.subspace_refl)
   4.119 -      show "graph F f \<subseteq> graph F f" ..
   4.120 -      show "\<forall>x\<in>F. f x \<le> p x" by fact
   4.121 -    qed
   4.122 -  qed
   4.123 -  then obtain g where gM: "g \<in> M" and gx: "\<forall>x \<in> M. g \<subseteq> x \<longrightarrow> g = x"
   4.124 -    by blast
   4.125 -  from gM obtain H h where
   4.126 -      g_rep: "g = graph H h"
   4.127 -    and linearform: "linearform H h"
   4.128 -    and HE: "H \<unlhd> E" and FH: "F \<unlhd> H"
   4.129 -    and graphs: "graph F f \<subseteq> graph H h"
   4.130 -    and hp: "\<forall>x \<in> H. h x \<le> p x" unfolding M_def ..
   4.131 -      -- {* @{text g} is a norm-preserving extension of @{text f}, in other words: *}
   4.132 -      -- {* @{text g} is the graph of some linear form @{text h} defined on a subspace @{text H} of @{text E}, *}
   4.133 -      -- {* and @{text h} is an extension of @{text f} that is again bounded by @{text p}. \skp *}
   4.134 -  from HE E have H: "vectorspace H"
   4.135 -    by (rule subspace.vectorspace)
   4.136 -
   4.137 -  have HE_eq: "H = E"
   4.138 -    -- {* We show that @{text h} is defined on whole @{text E} by classical contradiction. \skp *}
   4.139 -  proof (rule classical)
   4.140 -    assume neq: "H \<noteq> E"
   4.141 -      -- {* Assume @{text h} is not defined on whole @{text E}. Then show that @{text h} can be extended *}
   4.142 -      -- {* in a norm-preserving way to a function @{text h'} with the graph @{text g'}. \skp *}
   4.143 -    have "\<exists>g' \<in> M. g \<subseteq> g' \<and> g \<noteq> g'"
   4.144 -    proof -
   4.145 -      from HE have "H \<subseteq> E" ..
   4.146 -      with neq obtain x' where x'E: "x' \<in> E" and "x' \<notin> H" by blast
   4.147 -      obtain x': "x' \<noteq> 0"
   4.148 -      proof
   4.149 -        show "x' \<noteq> 0"
   4.150 -        proof
   4.151 -          assume "x' = 0"
   4.152 -          with H have "x' \<in> H" by (simp only: vectorspace.zero)
   4.153 -          with `x' \<notin> H` show False by contradiction
   4.154 -        qed
   4.155 -      qed
   4.156 -
   4.157 -      def H' \<equiv> "H + lin x'"
   4.158 -        -- {* Define @{text H'} as the direct sum of @{text H} and the linear closure of @{text x'}. \skp *}
   4.159 -      have HH': "H \<unlhd> H'"
   4.160 -      proof (unfold H'_def)
   4.161 -        from x'E have "vectorspace (lin x')" ..
   4.162 -        with H show "H \<unlhd> H + lin x'" ..
   4.163 -      qed
   4.164 -
   4.165 -      obtain xi where
   4.166 -        xi: "\<forall>y \<in> H. - p (y + x') - h y \<le> xi
   4.167 -          \<and> xi \<le> p (y + x') - h y"
   4.168 -        -- {* Pick a real number @{text \<xi>} that fulfills certain inequations; this will *}
   4.169 -        -- {* be used to establish that @{text h'} is a norm-preserving extension of @{text h}.
   4.170 -           \label{ex-xi-use}\skp *}
   4.171 -      proof -
   4.172 -        from H have "\<exists>xi. \<forall>y \<in> H. - p (y + x') - h y \<le> xi
   4.173 -            \<and> xi \<le> p (y + x') - h y"
   4.174 -        proof (rule ex_xi)
   4.175 -          fix u v assume u: "u \<in> H" and v: "v \<in> H"
   4.176 -          with HE have uE: "u \<in> E" and vE: "v \<in> E" by auto
   4.177 -          from H u v linearform have "h v - h u = h (v - u)"
   4.178 -            by (simp add: linearform.diff)
   4.179 -          also from hp and H u v have "\<dots> \<le> p (v - u)"
   4.180 -            by (simp only: vectorspace.diff_closed)
   4.181 -          also from x'E uE vE have "v - u = x' + - x' + v + - u"
   4.182 -            by (simp add: diff_eq1)
   4.183 -          also from x'E uE vE have "\<dots> = v + x' + - (u + x')"
   4.184 -            by (simp add: add_ac)
   4.185 -          also from x'E uE vE have "\<dots> = (v + x') - (u + x')"
   4.186 -            by (simp add: diff_eq1)
   4.187 -          also from x'E uE vE E have "p \<dots> \<le> p (v + x') + p (u + x')"
   4.188 -            by (simp add: diff_subadditive)
   4.189 -          finally have "h v - h u \<le> p (v + x') + p (u + x')" .
   4.190 -          then show "- p (u + x') - h u \<le> p (v + x') - h v" by simp
   4.191 -        qed
   4.192 -        then show thesis by (blast intro: that)
   4.193 -      qed
   4.194 -
   4.195 -      def h' \<equiv> "\<lambda>x. let (y, a) =
   4.196 -          SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H in h y + a * xi"
   4.197 -        -- {* Define the extension @{text h'} of @{text h} to @{text H'} using @{text \<xi>}. \skp *}
   4.198 -
   4.199 -      have "g \<subseteq> graph H' h' \<and> g \<noteq> graph H' h'"
   4.200 -        -- {* @{text h'} is an extension of @{text h} \dots \skp *}
   4.201 -      proof
   4.202 -        show "g \<subseteq> graph H' h'"
   4.203 -        proof -
   4.204 -          have  "graph H h \<subseteq> graph H' h'"
   4.205 -          proof (rule graph_extI)
   4.206 -            fix t assume t: "t \<in> H"
   4.207 -            from E HE t have "(SOME (y, a). t = y + a \<cdot> x' \<and> y \<in> H) = (t, 0)"
   4.208 -	      using `x' \<notin> H` `x' \<in> E` `x' \<noteq> 0` by (rule decomp_H'_H)
   4.209 -            with h'_def show "h t = h' t" by (simp add: Let_def)
   4.210 -          next
   4.211 -            from HH' show "H \<subseteq> H'" ..
   4.212 -          qed
   4.213 -          with g_rep show ?thesis by (simp only:)
   4.214 -        qed
   4.215 -
   4.216 -        show "g \<noteq> graph H' h'"
   4.217 -        proof -
   4.218 -          have "graph H h \<noteq> graph H' h'"
   4.219 -          proof
   4.220 -            assume eq: "graph H h = graph H' h'"
   4.221 -            have "x' \<in> H'"
   4.222 -	      unfolding H'_def
   4.223 -            proof
   4.224 -              from H show "0 \<in> H" by (rule vectorspace.zero)
   4.225 -              from x'E show "x' \<in> lin x'" by (rule x_lin_x)
   4.226 -              from x'E show "x' = 0 + x'" by simp
   4.227 -            qed
   4.228 -            then have "(x', h' x') \<in> graph H' h'" ..
   4.229 -            with eq have "(x', h' x') \<in> graph H h" by (simp only:)
   4.230 -            then have "x' \<in> H" ..
   4.231 -            with `x' \<notin> H` show False by contradiction
   4.232 -          qed
   4.233 -          with g_rep show ?thesis by simp
   4.234 -        qed
   4.235 -      qed
   4.236 -      moreover have "graph H' h' \<in> M"
   4.237 -        -- {* and @{text h'} is norm-preserving. \skp *}
   4.238 -      proof (unfold M_def)
   4.239 -        show "graph H' h' \<in> norm_pres_extensions E p F f"
   4.240 -        proof (rule norm_pres_extensionI2)
   4.241 -          show "linearform H' h'"
   4.242 -	    using h'_def H'_def HE linearform `x' \<notin> H` `x' \<in> E` `x' \<noteq> 0` E
   4.243 -	    by (rule h'_lf)
   4.244 -          show "H' \<unlhd> E"
   4.245 -	  unfolding H'_def
   4.246 -          proof
   4.247 -            show "H \<unlhd> E" by fact
   4.248 -            show "vectorspace E" by fact
   4.249 -            from x'E show "lin x' \<unlhd> E" ..
   4.250 -          qed
   4.251 -          from H `F \<unlhd> H` HH' show FH': "F \<unlhd> H'"
   4.252 -            by (rule vectorspace.subspace_trans)
   4.253 -          show "graph F f \<subseteq> graph H' h'"
   4.254 -          proof (rule graph_extI)
   4.255 -            fix x assume x: "x \<in> F"
   4.256 -            with graphs have "f x = h x" ..
   4.257 -            also have "\<dots> = h x + 0 * xi" by simp
   4.258 -            also have "\<dots> = (let (y, a) = (x, 0) in h y + a * xi)"
   4.259 -              by (simp add: Let_def)
   4.260 -            also have "(x, 0) =
   4.261 -                (SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H)"
   4.262 -	      using E HE
   4.263 -            proof (rule decomp_H'_H [symmetric])
   4.264 -              from FH x show "x \<in> H" ..
   4.265 -              from x' show "x' \<noteq> 0" .
   4.266 -	      show "x' \<notin> H" by fact
   4.267 -	      show "x' \<in> E" by fact
   4.268 -            qed
   4.269 -            also have
   4.270 -              "(let (y, a) = (SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H)
   4.271 -              in h y + a * xi) = h' x" by (simp only: h'_def)
   4.272 -            finally show "f x = h' x" .
   4.273 -          next
   4.274 -            from FH' show "F \<subseteq> H'" ..
   4.275 -          qed
   4.276 -          show "\<forall>x \<in> H'. h' x \<le> p x"
   4.277 -	    using h'_def H'_def `x' \<notin> H` `x' \<in> E` `x' \<noteq> 0` E HE
   4.278 -	      `seminorm E p` linearform and hp xi
   4.279 -	    by (rule h'_norm_pres)
   4.280 -        qed
   4.281 -      qed
   4.282 -      ultimately show ?thesis ..
   4.283 -    qed
   4.284 -    then have "\<not> (\<forall>x \<in> M. g \<subseteq> x \<longrightarrow> g = x)" by simp
   4.285 -      -- {* So the graph @{text g} of @{text h} cannot be maximal. Contradiction! \skp *}
   4.286 -    with gx show "H = E" by contradiction
   4.287 -  qed
   4.288 -
   4.289 -  from HE_eq and linearform have "linearform E h"
   4.290 -    by (simp only:)
   4.291 -  moreover have "\<forall>x \<in> F. h x = f x"
   4.292 -  proof
   4.293 -    fix x assume "x \<in> F"
   4.294 -    with graphs have "f x = h x" ..
   4.295 -    then show "h x = f x" ..
   4.296 -  qed
   4.297 -  moreover from HE_eq and hp have "\<forall>x \<in> E. h x \<le> p x"
   4.298 -    by (simp only:)
   4.299 -  ultimately show ?thesis by blast
   4.300 -qed
   4.301 -
   4.302 -
   4.303 -subsection  {* Alternative formulation *}
   4.304 -
   4.305 -text {*
   4.306 -  The following alternative formulation of the Hahn-Banach
   4.307 -  Theorem\label{abs-HahnBanach} uses the fact that for a real linear
   4.308 -  form @{text f} and a seminorm @{text p} the following inequations
   4.309 -  are equivalent:\footnote{This was shown in lemma @{thm [source]
   4.310 -  abs_ineq_iff} (see page \pageref{abs-ineq-iff}).}
   4.311 -  \begin{center}
   4.312 -  \begin{tabular}{lll}
   4.313 -  @{text "\<forall>x \<in> H. \<bar>h x\<bar> \<le> p x"} & and &
   4.314 -  @{text "\<forall>x \<in> H. h x \<le> p x"} \\
   4.315 -  \end{tabular}
   4.316 -  \end{center}
   4.317 -*}
   4.318 -
   4.319 -theorem abs_HahnBanach:
   4.320 -  assumes E: "vectorspace E" and FE: "subspace F E"
   4.321 -    and lf: "linearform F f" and sn: "seminorm E p"
   4.322 -  assumes fp: "\<forall>x \<in> F. \<bar>f x\<bar> \<le> p x"
   4.323 -  shows "\<exists>g. linearform E g
   4.324 -    \<and> (\<forall>x \<in> F. g x = f x)
   4.325 -    \<and> (\<forall>x \<in> E. \<bar>g x\<bar> \<le> p x)"
   4.326 -proof -
   4.327 -  interpret vectorspace E by fact
   4.328 -  interpret subspace F E by fact
   4.329 -  interpret linearform F f by fact
   4.330 -  interpret seminorm E p by fact
   4.331 -  have "\<exists>g. linearform E g \<and> (\<forall>x \<in> F. g x = f x) \<and> (\<forall>x \<in> E. g x \<le> p x)"
   4.332 -    using E FE sn lf
   4.333 -  proof (rule HahnBanach)
   4.334 -    show "\<forall>x \<in> F. f x \<le> p x"
   4.335 -      using FE E sn lf and fp by (rule abs_ineq_iff [THEN iffD1])
   4.336 -  qed
   4.337 -  then obtain g where lg: "linearform E g" and *: "\<forall>x \<in> F. g x = f x"
   4.338 -      and **: "\<forall>x \<in> E. g x \<le> p x" by blast
   4.339 -  have "\<forall>x \<in> E. \<bar>g x\<bar> \<le> p x"
   4.340 -    using _ E sn lg **
   4.341 -  proof (rule abs_ineq_iff [THEN iffD2])
   4.342 -    show "E \<unlhd> E" ..
   4.343 -  qed
   4.344 -  with lg * show ?thesis by blast
   4.345 -qed
   4.346 -
   4.347 -
   4.348 -subsection {* The Hahn-Banach Theorem for normed spaces *}
   4.349 -
   4.350 -text {*
   4.351 -  Every continuous linear form @{text f} on a subspace @{text F} of a
   4.352 -  norm space @{text E}, can be extended to a continuous linear form
   4.353 -  @{text g} on @{text E} such that @{text "\<parallel>f\<parallel> = \<parallel>g\<parallel>"}.
   4.354 -*}
   4.355 -
   4.356 -theorem norm_HahnBanach:
   4.357 -  fixes V and norm ("\<parallel>_\<parallel>")
   4.358 -  fixes B defines "\<And>V f. B V f \<equiv> {0} \<union> {\<bar>f x\<bar> / \<parallel>x\<parallel> | x. x \<noteq> 0 \<and> x \<in> V}"
   4.359 -  fixes fn_norm ("\<parallel>_\<parallel>\<hyphen>_" [0, 1000] 999)
   4.360 -  defines "\<And>V f. \<parallel>f\<parallel>\<hyphen>V \<equiv> \<Squnion>(B V f)"
   4.361 -  assumes E_norm: "normed_vectorspace E norm" and FE: "subspace F E"
   4.362 -    and linearform: "linearform F f" and "continuous F norm f"
   4.363 -  shows "\<exists>g. linearform E g
   4.364 -     \<and> continuous E norm g
   4.365 -     \<and> (\<forall>x \<in> F. g x = f x)
   4.366 -     \<and> \<parallel>g\<parallel>\<hyphen>E = \<parallel>f\<parallel>\<hyphen>F"
   4.367 -proof -
   4.368 -  interpret normed_vectorspace E norm by fact
   4.369 -  interpret normed_vectorspace_with_fn_norm E norm B fn_norm
   4.370 -    by (auto simp: B_def fn_norm_def) intro_locales
   4.371 -  interpret subspace F E by fact
   4.372 -  interpret linearform F f by fact
   4.373 -  interpret continuous F norm f by fact
   4.374 -  have E: "vectorspace E" by intro_locales
   4.375 -  have F: "vectorspace F" by rule intro_locales
   4.376 -  have F_norm: "normed_vectorspace F norm"
   4.377 -    using FE E_norm by (rule subspace_normed_vs)
   4.378 -  have ge_zero: "0 \<le> \<parallel>f\<parallel>\<hyphen>F"
   4.379 -    by (rule normed_vectorspace_with_fn_norm.fn_norm_ge_zero
   4.380 -      [OF normed_vectorspace_with_fn_norm.intro,
   4.381 -       OF F_norm `continuous F norm f` , folded B_def fn_norm_def])
   4.382 -  txt {* We define a function @{text p} on @{text E} as follows:
   4.383 -    @{text "p x = \<parallel>f\<parallel> \<cdot> \<parallel>x\<parallel>"} *}
   4.384 -  def p \<equiv> "\<lambda>x. \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>"
   4.385 -
   4.386 -  txt {* @{text p} is a seminorm on @{text E}: *}
   4.387 -  have q: "seminorm E p"
   4.388 -  proof
   4.389 -    fix x y a assume x: "x \<in> E" and y: "y \<in> E"
   4.390 -    
   4.391 -    txt {* @{text p} is positive definite: *}
   4.392 -    have "0 \<le> \<parallel>f\<parallel>\<hyphen>F" by (rule ge_zero)
   4.393 -    moreover from x have "0 \<le> \<parallel>x\<parallel>" ..
   4.394 -    ultimately show "0 \<le> p x"  
   4.395 -      by (simp add: p_def zero_le_mult_iff)
   4.396 -
   4.397 -    txt {* @{text p} is absolutely homogenous: *}
   4.398 -
   4.399 -    show "p (a \<cdot> x) = \<bar>a\<bar> * p x"
   4.400 -    proof -
   4.401 -      have "p (a \<cdot> x) = \<parallel>f\<parallel>\<hyphen>F * \<parallel>a \<cdot> x\<parallel>" by (simp only: p_def)
   4.402 -      also from x have "\<parallel>a \<cdot> x\<parallel> = \<bar>a\<bar> * \<parallel>x\<parallel>" by (rule abs_homogenous)
   4.403 -      also have "\<parallel>f\<parallel>\<hyphen>F * (\<bar>a\<bar> * \<parallel>x\<parallel>) = \<bar>a\<bar> * (\<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>)" by simp
   4.404 -      also have "\<dots> = \<bar>a\<bar> * p x" by (simp only: p_def)
   4.405 -      finally show ?thesis .
   4.406 -    qed
   4.407 -
   4.408 -    txt {* Furthermore, @{text p} is subadditive: *}
   4.409 -
   4.410 -    show "p (x + y) \<le> p x + p y"
   4.411 -    proof -
   4.412 -      have "p (x + y) = \<parallel>f\<parallel>\<hyphen>F * \<parallel>x + y\<parallel>" by (simp only: p_def)
   4.413 -      also have a: "0 \<le> \<parallel>f\<parallel>\<hyphen>F" by (rule ge_zero)
   4.414 -      from x y have "\<parallel>x + y\<parallel> \<le> \<parallel>x\<parallel> + \<parallel>y\<parallel>" ..
   4.415 -      with a have " \<parallel>f\<parallel>\<hyphen>F * \<parallel>x + y\<parallel> \<le> \<parallel>f\<parallel>\<hyphen>F * (\<parallel>x\<parallel> + \<parallel>y\<parallel>)"
   4.416 -        by (simp add: mult_left_mono)
   4.417 -      also have "\<dots> = \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel> + \<parallel>f\<parallel>\<hyphen>F * \<parallel>y\<parallel>" by (simp only: right_distrib)
   4.418 -      also have "\<dots> = p x + p y" by (simp only: p_def)
   4.419 -      finally show ?thesis .
   4.420 -    qed
   4.421 -  qed
   4.422 -
   4.423 -  txt {* @{text f} is bounded by @{text p}. *}
   4.424 -
   4.425 -  have "\<forall>x \<in> F. \<bar>f x\<bar> \<le> p x"
   4.426 -  proof
   4.427 -    fix x assume "x \<in> F"
   4.428 -    with `continuous F norm f` and linearform
   4.429 -    show "\<bar>f x\<bar> \<le> p x"
   4.430 -      unfolding p_def by (rule normed_vectorspace_with_fn_norm.fn_norm_le_cong
   4.431 -        [OF normed_vectorspace_with_fn_norm.intro,
   4.432 -         OF F_norm, folded B_def fn_norm_def])
   4.433 -  qed
   4.434 -
   4.435 -  txt {* Using the fact that @{text p} is a seminorm and @{text f} is bounded
   4.436 -    by @{text p} we can apply the Hahn-Banach Theorem for real vector
   4.437 -    spaces. So @{text f} can be extended in a norm-preserving way to
   4.438 -    some function @{text g} on the whole vector space @{text E}. *}
   4.439 -
   4.440 -  with E FE linearform q obtain g where
   4.441 -      linearformE: "linearform E g"
   4.442 -    and a: "\<forall>x \<in> F. g x = f x"
   4.443 -    and b: "\<forall>x \<in> E. \<bar>g x\<bar> \<le> p x"
   4.444 -    by (rule abs_HahnBanach [elim_format]) iprover
   4.445 -
   4.446 -  txt {* We furthermore have to show that @{text g} is also continuous: *}
   4.447 -
   4.448 -  have g_cont: "continuous E norm g" using linearformE
   4.449 -  proof
   4.450 -    fix x assume "x \<in> E"
   4.451 -    with b show "\<bar>g x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>"
   4.452 -      by (simp only: p_def)
   4.453 -  qed
   4.454 -
   4.455 -  txt {* To complete the proof, we show that @{text "\<parallel>g\<parallel> = \<parallel>f\<parallel>"}. *}
   4.456 -
   4.457 -  have "\<parallel>g\<parallel>\<hyphen>E = \<parallel>f\<parallel>\<hyphen>F"
   4.458 -  proof (rule order_antisym)
   4.459 -    txt {*
   4.460 -      First we show @{text "\<parallel>g\<parallel> \<le> \<parallel>f\<parallel>"}.  The function norm @{text
   4.461 -      "\<parallel>g\<parallel>"} is defined as the smallest @{text "c \<in> \<real>"} such that
   4.462 -      \begin{center}
   4.463 -      \begin{tabular}{l}
   4.464 -      @{text "\<forall>x \<in> E. \<bar>g x\<bar> \<le> c \<cdot> \<parallel>x\<parallel>"}
   4.465 -      \end{tabular}
   4.466 -      \end{center}
   4.467 -      \noindent Furthermore holds
   4.468 -      \begin{center}
   4.469 -      \begin{tabular}{l}
   4.470 -      @{text "\<forall>x \<in> E. \<bar>g x\<bar> \<le> \<parallel>f\<parallel> \<cdot> \<parallel>x\<parallel>"}
   4.471 -      \end{tabular}
   4.472 -      \end{center}
   4.473 -    *}
   4.474 -
   4.475 -    have "\<forall>x \<in> E. \<bar>g x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>"
   4.476 -    proof
   4.477 -      fix x assume "x \<in> E"
   4.478 -      with b show "\<bar>g x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>"
   4.479 -        by (simp only: p_def)
   4.480 -    qed
   4.481 -    from g_cont this ge_zero
   4.482 -    show "\<parallel>g\<parallel>\<hyphen>E \<le> \<parallel>f\<parallel>\<hyphen>F"
   4.483 -      by (rule fn_norm_least [of g, folded B_def fn_norm_def])
   4.484 -
   4.485 -    txt {* The other direction is achieved by a similar argument. *}
   4.486 -
   4.487 -    show "\<parallel>f\<parallel>\<hyphen>F \<le> \<parallel>g\<parallel>\<hyphen>E"
   4.488 -    proof (rule normed_vectorspace_with_fn_norm.fn_norm_least
   4.489 -	[OF normed_vectorspace_with_fn_norm.intro,
   4.490 -	 OF F_norm, folded B_def fn_norm_def])
   4.491 -      show "\<forall>x \<in> F. \<bar>f x\<bar> \<le> \<parallel>g\<parallel>\<hyphen>E * \<parallel>x\<parallel>"
   4.492 -      proof
   4.493 -	fix x assume x: "x \<in> F"
   4.494 -	from a x have "g x = f x" ..
   4.495 -	then have "\<bar>f x\<bar> = \<bar>g x\<bar>" by (simp only:)
   4.496 -	also from g_cont
   4.497 -	have "\<dots> \<le> \<parallel>g\<parallel>\<hyphen>E * \<parallel>x\<parallel>"
   4.498 -	proof (rule fn_norm_le_cong [OF _ linearformE, folded B_def fn_norm_def])
   4.499 -	  from FE x show "x \<in> E" ..
   4.500 -	qed
   4.501 -	finally show "\<bar>f x\<bar> \<le> \<parallel>g\<parallel>\<hyphen>E * \<parallel>x\<parallel>" .
   4.502 -      qed
   4.503 -      show "0 \<le> \<parallel>g\<parallel>\<hyphen>E"
   4.504 -	using g_cont
   4.505 -	by (rule fn_norm_ge_zero [of g, folded B_def fn_norm_def])
   4.506 -      show "continuous F norm f" by fact
   4.507 -    qed
   4.508 -  qed
   4.509 -  with linearformE a g_cont show ?thesis by blast
   4.510 -qed
   4.511 -
   4.512 -end
     5.1 --- a/src/HOL/HahnBanach/HahnBanachExtLemmas.thy	Wed Jun 24 21:28:02 2009 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,280 +0,0 @@
     5.4 -(*  Title:      HOL/Real/HahnBanach/HahnBanachExtLemmas.thy
     5.5 -    Author:     Gertrud Bauer, TU Munich
     5.6 -*)
     5.7 -
     5.8 -header {* Extending non-maximal functions *}
     5.9 -
    5.10 -theory HahnBanachExtLemmas
    5.11 -imports FunctionNorm
    5.12 -begin
    5.13 -
    5.14 -text {*
    5.15 -  In this section the following context is presumed.  Let @{text E} be
    5.16 -  a real vector space with a seminorm @{text q} on @{text E}. @{text
    5.17 -  F} is a subspace of @{text E} and @{text f} a linear function on
    5.18 -  @{text F}. We consider a subspace @{text H} of @{text E} that is a
    5.19 -  superspace of @{text F} and a linear form @{text h} on @{text
    5.20 -  H}. @{text H} is a not equal to @{text E} and @{text "x\<^sub>0"} is
    5.21 -  an element in @{text "E - H"}.  @{text H} is extended to the direct
    5.22 -  sum @{text "H' = H + lin x\<^sub>0"}, so for any @{text "x \<in> H'"}
    5.23 -  the decomposition of @{text "x = y + a \<cdot> x"} with @{text "y \<in> H"} is
    5.24 -  unique. @{text h'} is defined on @{text H'} by @{text "h' x = h y +
    5.25 -  a \<cdot> \<xi>"} for a certain @{text \<xi>}.
    5.26 -
    5.27 -  Subsequently we show some properties of this extension @{text h'} of
    5.28 -  @{text h}.
    5.29 -
    5.30 -  \medskip This lemma will be used to show the existence of a linear
    5.31 -  extension of @{text f} (see page \pageref{ex-xi-use}). It is a
    5.32 -  consequence of the completeness of @{text \<real>}. To show
    5.33 -  \begin{center}
    5.34 -  \begin{tabular}{l}
    5.35 -  @{text "\<exists>\<xi>. \<forall>y \<in> F. a y \<le> \<xi> \<and> \<xi> \<le> b y"}
    5.36 -  \end{tabular}
    5.37 -  \end{center}
    5.38 -  \noindent it suffices to show that
    5.39 -  \begin{center}
    5.40 -  \begin{tabular}{l}
    5.41 -  @{text "\<forall>u \<in> F. \<forall>v \<in> F. a u \<le> b v"}
    5.42 -  \end{tabular}
    5.43 -  \end{center}
    5.44 -*}
    5.45 -
    5.46 -lemma ex_xi:
    5.47 -  assumes "vectorspace F"
    5.48 -  assumes r: "\<And>u v. u \<in> F \<Longrightarrow> v \<in> F \<Longrightarrow> a u \<le> b v"
    5.49 -  shows "\<exists>xi::real. \<forall>y \<in> F. a y \<le> xi \<and> xi \<le> b y"
    5.50 -proof -
    5.51 -  interpret vectorspace F by fact
    5.52 -  txt {* From the completeness of the reals follows:
    5.53 -    The set @{text "S = {a u. u \<in> F}"} has a supremum, if it is
    5.54 -    non-empty and has an upper bound. *}
    5.55 -
    5.56 -  let ?S = "{a u | u. u \<in> F}"
    5.57 -  have "\<exists>xi. lub ?S xi"
    5.58 -  proof (rule real_complete)
    5.59 -    have "a 0 \<in> ?S" by blast
    5.60 -    then show "\<exists>X. X \<in> ?S" ..
    5.61 -    have "\<forall>y \<in> ?S. y \<le> b 0"
    5.62 -    proof
    5.63 -      fix y assume y: "y \<in> ?S"
    5.64 -      then obtain u where u: "u \<in> F" and y: "y = a u" by blast
    5.65 -      from u and zero have "a u \<le> b 0" by (rule r)
    5.66 -      with y show "y \<le> b 0" by (simp only:)
    5.67 -    qed
    5.68 -    then show "\<exists>u. \<forall>y \<in> ?S. y \<le> u" ..
    5.69 -  qed
    5.70 -  then obtain xi where xi: "lub ?S xi" ..
    5.71 -  {
    5.72 -    fix y assume "y \<in> F"
    5.73 -    then have "a y \<in> ?S" by blast
    5.74 -    with xi have "a y \<le> xi" by (rule lub.upper)
    5.75 -  } moreover {
    5.76 -    fix y assume y: "y \<in> F"
    5.77 -    from xi have "xi \<le> b y"
    5.78 -    proof (rule lub.least)
    5.79 -      fix au assume "au \<in> ?S"
    5.80 -      then obtain u where u: "u \<in> F" and au: "au = a u" by blast
    5.81 -      from u y have "a u \<le> b y" by (rule r)
    5.82 -      with au show "au \<le> b y" by (simp only:)
    5.83 -    qed
    5.84 -  } ultimately show "\<exists>xi. \<forall>y \<in> F. a y \<le> xi \<and> xi \<le> b y" by blast
    5.85 -qed
    5.86 -
    5.87 -text {*
    5.88 -  \medskip The function @{text h'} is defined as a @{text "h' x = h y
    5.89 -  + a \<cdot> \<xi>"} where @{text "x = y + a \<cdot> \<xi>"} is a linear extension of
    5.90 -  @{text h} to @{text H'}.
    5.91 -*}
    5.92 -
    5.93 -lemma h'_lf:
    5.94 -  assumes h'_def: "h' \<equiv> \<lambda>x. let (y, a) =
    5.95 -      SOME (y, a). x = y + a \<cdot> x0 \<and> y \<in> H in h y + a * xi"
    5.96 -    and H'_def: "H' \<equiv> H + lin x0"
    5.97 -    and HE: "H \<unlhd> E"
    5.98 -  assumes "linearform H h"
    5.99 -  assumes x0: "x0 \<notin> H"  "x0 \<in> E"  "x0 \<noteq> 0"
   5.100 -  assumes E: "vectorspace E"
   5.101 -  shows "linearform H' h'"
   5.102 -proof -
   5.103 -  interpret linearform H h by fact
   5.104 -  interpret vectorspace E by fact
   5.105 -  show ?thesis
   5.106 -  proof
   5.107 -    note E = `vectorspace E`
   5.108 -    have H': "vectorspace H'"
   5.109 -    proof (unfold H'_def)
   5.110 -      from `x0 \<in> E`
   5.111 -      have "lin x0 \<unlhd> E" ..
   5.112 -      with HE show "vectorspace (H + lin x0)" using E ..
   5.113 -    qed
   5.114 -    {
   5.115 -      fix x1 x2 assume x1: "x1 \<in> H'" and x2: "x2 \<in> H'"
   5.116 -      show "h' (x1 + x2) = h' x1 + h' x2"
   5.117 -      proof -
   5.118 -	from H' x1 x2 have "x1 + x2 \<in> H'"
   5.119 -          by (rule vectorspace.add_closed)
   5.120 -	with x1 x2 obtain y y1 y2 a a1 a2 where
   5.121 -          x1x2: "x1 + x2 = y + a \<cdot> x0" and y: "y \<in> H"
   5.122 -          and x1_rep: "x1 = y1 + a1 \<cdot> x0" and y1: "y1 \<in> H"
   5.123 -          and x2_rep: "x2 = y2 + a2 \<cdot> x0" and y2: "y2 \<in> H"
   5.124 -          unfolding H'_def sum_def lin_def by blast
   5.125 -	
   5.126 -	have ya: "y1 + y2 = y \<and> a1 + a2 = a" using E HE _ y x0
   5.127 -	proof (rule decomp_H') txt_raw {* \label{decomp-H-use} *}
   5.128 -          from HE y1 y2 show "y1 + y2 \<in> H"
   5.129 -            by (rule subspace.add_closed)
   5.130 -          from x0 and HE y y1 y2
   5.131 -          have "x0 \<in> E"  "y \<in> E"  "y1 \<in> E"  "y2 \<in> E" by auto
   5.132 -          with x1_rep x2_rep have "(y1 + y2) + (a1 + a2) \<cdot> x0 = x1 + x2"
   5.133 -            by (simp add: add_ac add_mult_distrib2)
   5.134 -          also note x1x2
   5.135 -          finally show "(y1 + y2) + (a1 + a2) \<cdot> x0 = y + a \<cdot> x0" .
   5.136 -	qed
   5.137 -	
   5.138 -	from h'_def x1x2 E HE y x0
   5.139 -	have "h' (x1 + x2) = h y + a * xi"
   5.140 -          by (rule h'_definite)
   5.141 -	also have "\<dots> = h (y1 + y2) + (a1 + a2) * xi"
   5.142 -          by (simp only: ya)
   5.143 -	also from y1 y2 have "h (y1 + y2) = h y1 + h y2"
   5.144 -          by simp
   5.145 -	also have "\<dots> + (a1 + a2) * xi = (h y1 + a1 * xi) + (h y2 + a2 * xi)"
   5.146 -          by (simp add: left_distrib)
   5.147 -	also from h'_def x1_rep E HE y1 x0
   5.148 -	have "h y1 + a1 * xi = h' x1"
   5.149 -          by (rule h'_definite [symmetric])
   5.150 -	also from h'_def x2_rep E HE y2 x0
   5.151 -	have "h y2 + a2 * xi = h' x2"
   5.152 -          by (rule h'_definite [symmetric])
   5.153 -	finally show ?thesis .
   5.154 -      qed
   5.155 -    next
   5.156 -      fix x1 c assume x1: "x1 \<in> H'"
   5.157 -      show "h' (c \<cdot> x1) = c * (h' x1)"
   5.158 -      proof -
   5.159 -	from H' x1 have ax1: "c \<cdot> x1 \<in> H'"
   5.160 -          by (rule vectorspace.mult_closed)
   5.161 -	with x1 obtain y a y1 a1 where
   5.162 -            cx1_rep: "c \<cdot> x1 = y + a \<cdot> x0" and y: "y \<in> H"
   5.163 -          and x1_rep: "x1 = y1 + a1 \<cdot> x0" and y1: "y1 \<in> H"
   5.164 -          unfolding H'_def sum_def lin_def by blast
   5.165 -	
   5.166 -	have ya: "c \<cdot> y1 = y \<and> c * a1 = a" using E HE _ y x0
   5.167 -	proof (rule decomp_H')
   5.168 -          from HE y1 show "c \<cdot> y1 \<in> H"
   5.169 -            by (rule subspace.mult_closed)
   5.170 -          from x0 and HE y y1
   5.171 -          have "x0 \<in> E"  "y \<in> E"  "y1 \<in> E" by auto
   5.172 -          with x1_rep have "c \<cdot> y1 + (c * a1) \<cdot> x0 = c \<cdot> x1"
   5.173 -            by (simp add: mult_assoc add_mult_distrib1)
   5.174 -          also note cx1_rep
   5.175 -          finally show "c \<cdot> y1 + (c * a1) \<cdot> x0 = y + a \<cdot> x0" .
   5.176 -	qed
   5.177 -	
   5.178 -	from h'_def cx1_rep E HE y x0 have "h' (c \<cdot> x1) = h y + a * xi"
   5.179 -          by (rule h'_definite)
   5.180 -	also have "\<dots> = h (c \<cdot> y1) + (c * a1) * xi"
   5.181 -          by (simp only: ya)
   5.182 -	also from y1 have "h (c \<cdot> y1) = c * h y1"
   5.183 -          by simp
   5.184 -	also have "\<dots> + (c * a1) * xi = c * (h y1 + a1 * xi)"
   5.185 -          by (simp only: right_distrib)
   5.186 -	also from h'_def x1_rep E HE y1 x0 have "h y1 + a1 * xi = h' x1"
   5.187 -          by (rule h'_definite [symmetric])
   5.188 -	finally show ?thesis .
   5.189 -      qed
   5.190 -    }
   5.191 -  qed
   5.192 -qed
   5.193 -
   5.194 -text {* \medskip The linear extension @{text h'} of @{text h}
   5.195 -  is bounded by the seminorm @{text p}. *}
   5.196 -
   5.197 -lemma h'_norm_pres:
   5.198 -  assumes h'_def: "h' \<equiv> \<lambda>x. let (y, a) =
   5.199 -      SOME (y, a). x = y + a \<cdot> x0 \<and> y \<in> H in h y + a * xi"
   5.200 -    and H'_def: "H' \<equiv> H + lin x0"
   5.201 -    and x0: "x0 \<notin> H"  "x0 \<in> E"  "x0 \<noteq> 0"
   5.202 -  assumes E: "vectorspace E" and HE: "subspace H E"
   5.203 -    and "seminorm E p" and "linearform H h"
   5.204 -  assumes a: "\<forall>y \<in> H. h y \<le> p y"
   5.205 -    and a': "\<forall>y \<in> H. - p (y + x0) - h y \<le> xi \<and> xi \<le> p (y + x0) - h y"
   5.206 -  shows "\<forall>x \<in> H'. h' x \<le> p x"
   5.207 -proof -
   5.208 -  interpret vectorspace E by fact
   5.209 -  interpret subspace H E by fact
   5.210 -  interpret seminorm E p by fact
   5.211 -  interpret linearform H h by fact
   5.212 -  show ?thesis
   5.213 -  proof
   5.214 -    fix x assume x': "x \<in> H'"
   5.215 -    show "h' x \<le> p x"
   5.216 -    proof -
   5.217 -      from a' have a1: "\<forall>ya \<in> H. - p (ya + x0) - h ya \<le> xi"
   5.218 -	and a2: "\<forall>ya \<in> H. xi \<le> p (ya + x0) - h ya" by auto
   5.219 -      from x' obtain y a where
   5.220 -          x_rep: "x = y + a \<cdot> x0" and y: "y \<in> H"
   5.221 -	unfolding H'_def sum_def lin_def by blast
   5.222 -      from y have y': "y \<in> E" ..
   5.223 -      from y have ay: "inverse a \<cdot> y \<in> H" by simp
   5.224 -      
   5.225 -      from h'_def x_rep E HE y x0 have "h' x = h y + a * xi"
   5.226 -	by (rule h'_definite)
   5.227 -      also have "\<dots> \<le> p (y + a \<cdot> x0)"
   5.228 -      proof (rule linorder_cases)
   5.229 -	assume z: "a = 0"
   5.230 -	then have "h y + a * xi = h y" by simp
   5.231 -	also from a y have "\<dots> \<le> p y" ..
   5.232 -	also from x0 y' z have "p y = p (y + a \<cdot> x0)" by simp
   5.233 -	finally show ?thesis .
   5.234 -      next
   5.235 -	txt {* In the case @{text "a < 0"}, we use @{text "a\<^sub>1"}
   5.236 -          with @{text ya} taken as @{text "y / a"}: *}
   5.237 -	assume lz: "a < 0" then have nz: "a \<noteq> 0" by simp
   5.238 -	from a1 ay
   5.239 -	have "- p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y) \<le> xi" ..
   5.240 -	with lz have "a * xi \<le>
   5.241 -          a * (- p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y))"
   5.242 -          by (simp add: mult_left_mono_neg order_less_imp_le)
   5.243 -	
   5.244 -	also have "\<dots> =
   5.245 -          - a * (p (inverse a \<cdot> y + x0)) - a * (h (inverse a \<cdot> y))"
   5.246 -	  by (simp add: right_diff_distrib)
   5.247 -	also from lz x0 y' have "- a * (p (inverse a \<cdot> y + x0)) =
   5.248 -          p (a \<cdot> (inverse a \<cdot> y + x0))"
   5.249 -          by (simp add: abs_homogenous)
   5.250 -	also from nz x0 y' have "\<dots> = p (y + a \<cdot> x0)"
   5.251 -          by (simp add: add_mult_distrib1 mult_assoc [symmetric])
   5.252 -	also from nz y have "a * (h (inverse a \<cdot> y)) =  h y"
   5.253 -          by simp
   5.254 -	finally have "a * xi \<le> p (y + a \<cdot> x0) - h y" .
   5.255 -	then show ?thesis by simp
   5.256 -      next
   5.257 -	txt {* In the case @{text "a > 0"}, we use @{text "a\<^sub>2"}
   5.258 -          with @{text ya} taken as @{text "y / a"}: *}
   5.259 -	assume gz: "0 < a" then have nz: "a \<noteq> 0" by simp
   5.260 -	from a2 ay
   5.261 -	have "xi \<le> p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y)" ..
   5.262 -	with gz have "a * xi \<le>
   5.263 -          a * (p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y))"
   5.264 -          by simp
   5.265 -	also have "\<dots> = a * p (inverse a \<cdot> y + x0) - a * h (inverse a \<cdot> y)"
   5.266 -	  by (simp add: right_diff_distrib)
   5.267 -	also from gz x0 y'
   5.268 -	have "a * p (inverse a \<cdot> y + x0) = p (a \<cdot> (inverse a \<cdot> y + x0))"
   5.269 -          by (simp add: abs_homogenous)
   5.270 -	also from nz x0 y' have "\<dots> = p (y + a \<cdot> x0)"
   5.271 -          by (simp add: add_mult_distrib1 mult_assoc [symmetric])
   5.272 -	also from nz y have "a * h (inverse a \<cdot> y) = h y"
   5.273 -          by simp
   5.274 -	finally have "a * xi \<le> p (y + a \<cdot> x0) - h y" .
   5.275 -	then show ?thesis by simp
   5.276 -      qed
   5.277 -      also from x_rep have "\<dots> = p x" by (simp only:)
   5.278 -      finally show ?thesis .
   5.279 -    qed
   5.280 -  qed
   5.281 -qed
   5.282 -
   5.283 -end
     6.1 --- a/src/HOL/HahnBanach/HahnBanachLemmas.thy	Wed Jun 24 21:28:02 2009 +0200
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,4 +0,0 @@
     6.4 -(*<*)
     6.5 -theory HahnBanachLemmas imports HahnBanachSupLemmas HahnBanachExtLemmas begin
     6.6 -end
     6.7 -(*>*)
     6.8 \ No newline at end of file
     7.1 --- a/src/HOL/HahnBanach/HahnBanachSupLemmas.thy	Wed Jun 24 21:28:02 2009 +0200
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,446 +0,0 @@
     7.4 -(*  Title:      HOL/Real/HahnBanach/HahnBanachSupLemmas.thy
     7.5 -    ID:         $Id$
     7.6 -    Author:     Gertrud Bauer, TU Munich
     7.7 -*)
     7.8 -
     7.9 -header {* The supremum w.r.t.~the function order *}
    7.10 -
    7.11 -theory HahnBanachSupLemmas
    7.12 -imports FunctionNorm ZornLemma
    7.13 -begin
    7.14 -
    7.15 -text {*
    7.16 -  This section contains some lemmas that will be used in the proof of
    7.17 -  the Hahn-Banach Theorem.  In this section the following context is
    7.18 -  presumed.  Let @{text E} be a real vector space with a seminorm
    7.19 -  @{text p} on @{text E}.  @{text F} is a subspace of @{text E} and
    7.20 -  @{text f} a linear form on @{text F}. We consider a chain @{text c}
    7.21 -  of norm-preserving extensions of @{text f}, such that @{text "\<Union>c =
    7.22 -  graph H h"}.  We will show some properties about the limit function
    7.23 -  @{text h}, i.e.\ the supremum of the chain @{text c}.
    7.24 -
    7.25 -  \medskip Let @{text c} be a chain of norm-preserving extensions of
    7.26 -  the function @{text f} and let @{text "graph H h"} be the supremum
    7.27 -  of @{text c}.  Every element in @{text H} is member of one of the
    7.28 -  elements of the chain.
    7.29 -*}
    7.30 -lemmas [dest?] = chainD
    7.31 -lemmas chainE2 [elim?] = chainD2 [elim_format, standard]
    7.32 -
    7.33 -lemma some_H'h't:
    7.34 -  assumes M: "M = norm_pres_extensions E p F f"
    7.35 -    and cM: "c \<in> chain M"
    7.36 -    and u: "graph H h = \<Union>c"
    7.37 -    and x: "x \<in> H"
    7.38 -  shows "\<exists>H' h'. graph H' h' \<in> c
    7.39 -    \<and> (x, h x) \<in> graph H' h'
    7.40 -    \<and> linearform H' h' \<and> H' \<unlhd> E
    7.41 -    \<and> F \<unlhd> H' \<and> graph F f \<subseteq> graph H' h'
    7.42 -    \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
    7.43 -proof -
    7.44 -  from x have "(x, h x) \<in> graph H h" ..
    7.45 -  also from u have "\<dots> = \<Union>c" .
    7.46 -  finally obtain g where gc: "g \<in> c" and gh: "(x, h x) \<in> g" by blast
    7.47 -
    7.48 -  from cM have "c \<subseteq> M" ..
    7.49 -  with gc have "g \<in> M" ..
    7.50 -  also from M have "\<dots> = norm_pres_extensions E p F f" .
    7.51 -  finally obtain H' and h' where g: "g = graph H' h'"
    7.52 -    and * : "linearform H' h'"  "H' \<unlhd> E"  "F \<unlhd> H'"
    7.53 -      "graph F f \<subseteq> graph H' h'"  "\<forall>x \<in> H'. h' x \<le> p x" ..
    7.54 -
    7.55 -  from gc and g have "graph H' h' \<in> c" by (simp only:)
    7.56 -  moreover from gh and g have "(x, h x) \<in> graph H' h'" by (simp only:)
    7.57 -  ultimately show ?thesis using * by blast
    7.58 -qed
    7.59 -
    7.60 -text {*
    7.61 -  \medskip Let @{text c} be a chain of norm-preserving extensions of
    7.62 -  the function @{text f} and let @{text "graph H h"} be the supremum
    7.63 -  of @{text c}.  Every element in the domain @{text H} of the supremum
    7.64 -  function is member of the domain @{text H'} of some function @{text
    7.65 -  h'}, such that @{text h} extends @{text h'}.
    7.66 -*}
    7.67 -
    7.68 -lemma some_H'h':
    7.69 -  assumes M: "M = norm_pres_extensions E p F f"
    7.70 -    and cM: "c \<in> chain M"
    7.71 -    and u: "graph H h = \<Union>c"
    7.72 -    and x: "x \<in> H"
    7.73 -  shows "\<exists>H' h'. x \<in> H' \<and> graph H' h' \<subseteq> graph H h
    7.74 -    \<and> linearform H' h' \<and> H' \<unlhd> E \<and> F \<unlhd> H'
    7.75 -    \<and> graph F f \<subseteq> graph H' h' \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
    7.76 -proof -
    7.77 -  from M cM u x obtain H' h' where
    7.78 -      x_hx: "(x, h x) \<in> graph H' h'"
    7.79 -    and c: "graph H' h' \<in> c"
    7.80 -    and * : "linearform H' h'"  "H' \<unlhd> E"  "F \<unlhd> H'"
    7.81 -      "graph F f \<subseteq> graph H' h'"  "\<forall>x \<in> H'. h' x \<le> p x"
    7.82 -    by (rule some_H'h't [elim_format]) blast
    7.83 -  from x_hx have "x \<in> H'" ..
    7.84 -  moreover from cM u c have "graph H' h' \<subseteq> graph H h"
    7.85 -    by (simp only: chain_ball_Union_upper)
    7.86 -  ultimately show ?thesis using * by blast
    7.87 -qed
    7.88 -
    7.89 -text {*
    7.90 -  \medskip Any two elements @{text x} and @{text y} in the domain
    7.91 -  @{text H} of the supremum function @{text h} are both in the domain
    7.92 -  @{text H'} of some function @{text h'}, such that @{text h} extends
    7.93 -  @{text h'}.
    7.94 -*}
    7.95 -
    7.96 -lemma some_H'h'2:
    7.97 -  assumes M: "M = norm_pres_extensions E p F f"
    7.98 -    and cM: "c \<in> chain M"
    7.99 -    and u: "graph H h = \<Union>c"
   7.100 -    and x: "x \<in> H"
   7.101 -    and y: "y \<in> H"
   7.102 -  shows "\<exists>H' h'. x \<in> H' \<and> y \<in> H'
   7.103 -    \<and> graph H' h' \<subseteq> graph H h
   7.104 -    \<and> linearform H' h' \<and> H' \<unlhd> E \<and> F \<unlhd> H'
   7.105 -    \<and> graph F f \<subseteq> graph H' h' \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
   7.106 -proof -
   7.107 -  txt {* @{text y} is in the domain @{text H''} of some function @{text h''},
   7.108 -  such that @{text h} extends @{text h''}. *}
   7.109 -
   7.110 -  from M cM u and y obtain H' h' where
   7.111 -      y_hy: "(y, h y) \<in> graph H' h'"
   7.112 -    and c': "graph H' h' \<in> c"
   7.113 -    and * :
   7.114 -      "linearform H' h'"  "H' \<unlhd> E"  "F \<unlhd> H'"
   7.115 -      "graph F f \<subseteq> graph H' h'"  "\<forall>x \<in> H'. h' x \<le> p x"
   7.116 -    by (rule some_H'h't [elim_format]) blast
   7.117 -
   7.118 -  txt {* @{text x} is in the domain @{text H'} of some function @{text h'},
   7.119 -    such that @{text h} extends @{text h'}. *}
   7.120 -
   7.121 -  from M cM u and x obtain H'' h'' where
   7.122 -      x_hx: "(x, h x) \<in> graph H'' h''"
   7.123 -    and c'': "graph H'' h'' \<in> c"
   7.124 -    and ** :
   7.125 -      "linearform H'' h''"  "H'' \<unlhd> E"  "F \<unlhd> H''"
   7.126 -      "graph F f \<subseteq> graph H'' h''"  "\<forall>x \<in> H''. h'' x \<le> p x"
   7.127 -    by (rule some_H'h't [elim_format]) blast
   7.128 -
   7.129 -  txt {* Since both @{text h'} and @{text h''} are elements of the chain,
   7.130 -    @{text h''} is an extension of @{text h'} or vice versa. Thus both
   7.131 -    @{text x} and @{text y} are contained in the greater
   7.132 -    one. \label{cases1}*}
   7.133 -
   7.134 -  from cM c'' c' have "graph H'' h'' \<subseteq> graph H' h' \<or> graph H' h' \<subseteq> graph H'' h''"
   7.135 -    (is "?case1 \<or> ?case2") ..
   7.136 -  then show ?thesis
   7.137 -  proof
   7.138 -    assume ?case1
   7.139 -    have "(x, h x) \<in> graph H'' h''" by fact
   7.140 -    also have "\<dots> \<subseteq> graph H' h'" by fact
   7.141 -    finally have xh:"(x, h x) \<in> graph H' h'" .
   7.142 -    then have "x \<in> H'" ..
   7.143 -    moreover from y_hy have "y \<in> H'" ..
   7.144 -    moreover from cM u and c' have "graph H' h' \<subseteq> graph H h"
   7.145 -      by (simp only: chain_ball_Union_upper)
   7.146 -    ultimately show ?thesis using * by blast
   7.147 -  next
   7.148 -    assume ?case2
   7.149 -    from x_hx have "x \<in> H''" ..
   7.150 -    moreover {
   7.151 -      have "(y, h y) \<in> graph H' h'" by (rule y_hy)
   7.152 -      also have "\<dots> \<subseteq> graph H'' h''" by fact
   7.153 -      finally have "(y, h y) \<in> graph H'' h''" .
   7.154 -    } then have "y \<in> H''" ..
   7.155 -    moreover from cM u and c'' have "graph H'' h'' \<subseteq> graph H h"
   7.156 -      by (simp only: chain_ball_Union_upper)
   7.157 -    ultimately show ?thesis using ** by blast
   7.158 -  qed
   7.159 -qed
   7.160 -
   7.161 -text {*
   7.162 -  \medskip The relation induced by the graph of the supremum of a
   7.163 -  chain @{text c} is definite, i.~e.~t is the graph of a function.
   7.164 -*}
   7.165 -
   7.166 -lemma sup_definite:
   7.167 -  assumes M_def: "M \<equiv> norm_pres_extensions E p F f"
   7.168 -    and cM: "c \<in> chain M"
   7.169 -    and xy: "(x, y) \<in> \<Union>c"
   7.170 -    and xz: "(x, z) \<in> \<Union>c"
   7.171 -  shows "z = y"
   7.172 -proof -
   7.173 -  from cM have c: "c \<subseteq> M" ..
   7.174 -  from xy obtain G1 where xy': "(x, y) \<in> G1" and G1: "G1 \<in> c" ..
   7.175 -  from xz obtain G2 where xz': "(x, z) \<in> G2" and G2: "G2 \<in> c" ..
   7.176 -
   7.177 -  from G1 c have "G1 \<in> M" ..
   7.178 -  then obtain H1 h1 where G1_rep: "G1 = graph H1 h1"
   7.179 -    unfolding M_def by blast
   7.180 -
   7.181 -  from G2 c have "G2 \<in> M" ..
   7.182 -  then obtain H2 h2 where G2_rep: "G2 = graph H2 h2"
   7.183 -    unfolding M_def by blast
   7.184 -
   7.185 -  txt {* @{text "G\<^sub>1"} is contained in @{text "G\<^sub>2"}
   7.186 -    or vice versa, since both @{text "G\<^sub>1"} and @{text
   7.187 -    "G\<^sub>2"} are members of @{text c}. \label{cases2}*}
   7.188 -
   7.189 -  from cM G1 G2 have "G1 \<subseteq> G2 \<or> G2 \<subseteq> G1" (is "?case1 \<or> ?case2") ..
   7.190 -  then show ?thesis
   7.191 -  proof
   7.192 -    assume ?case1
   7.193 -    with xy' G2_rep have "(x, y) \<in> graph H2 h2" by blast
   7.194 -    then have "y = h2 x" ..
   7.195 -    also
   7.196 -    from xz' G2_rep have "(x, z) \<in> graph H2 h2" by (simp only:)
   7.197 -    then have "z = h2 x" ..
   7.198 -    finally show ?thesis .
   7.199 -  next
   7.200 -    assume ?case2
   7.201 -    with xz' G1_rep have "(x, z) \<in> graph H1 h1" by blast
   7.202 -    then have "z = h1 x" ..
   7.203 -    also
   7.204 -    from xy' G1_rep have "(x, y) \<in> graph H1 h1" by (simp only:)
   7.205 -    then have "y = h1 x" ..
   7.206 -    finally show ?thesis ..
   7.207 -  qed
   7.208 -qed
   7.209 -
   7.210 -text {*
   7.211 -  \medskip The limit function @{text h} is linear. Every element
   7.212 -  @{text x} in the domain of @{text h} is in the domain of a function
   7.213 -  @{text h'} in the chain of norm preserving extensions.  Furthermore,
   7.214 -  @{text h} is an extension of @{text h'} so the function values of
   7.215 -  @{text x} are identical for @{text h'} and @{text h}.  Finally, the
   7.216 -  function @{text h'} is linear by construction of @{text M}.
   7.217 -*}
   7.218 -
   7.219 -lemma sup_lf:
   7.220 -  assumes M: "M = norm_pres_extensions E p F f"
   7.221 -    and cM: "c \<in> chain M"
   7.222 -    and u: "graph H h = \<Union>c"
   7.223 -  shows "linearform H h"
   7.224 -proof
   7.225 -  fix x y assume x: "x \<in> H" and y: "y \<in> H"
   7.226 -  with M cM u obtain H' h' where
   7.227 -        x': "x \<in> H'" and y': "y \<in> H'"
   7.228 -      and b: "graph H' h' \<subseteq> graph H h"
   7.229 -      and linearform: "linearform H' h'"
   7.230 -      and subspace: "H' \<unlhd> E"
   7.231 -    by (rule some_H'h'2 [elim_format]) blast
   7.232 -
   7.233 -  show "h (x + y) = h x + h y"
   7.234 -  proof -
   7.235 -    from linearform x' y' have "h' (x + y) = h' x + h' y"
   7.236 -      by (rule linearform.add)
   7.237 -    also from b x' have "h' x = h x" ..
   7.238 -    also from b y' have "h' y = h y" ..
   7.239 -    also from subspace x' y' have "x + y \<in> H'"
   7.240 -      by (rule subspace.add_closed)
   7.241 -    with b have "h' (x + y) = h (x + y)" ..
   7.242 -    finally show ?thesis .
   7.243 -  qed
   7.244 -next
   7.245 -  fix x a assume x: "x \<in> H"
   7.246 -  with M cM u obtain H' h' where
   7.247 -        x': "x \<in> H'"
   7.248 -      and b: "graph H' h' \<subseteq> graph H h"
   7.249 -      and linearform: "linearform H' h'"
   7.250 -      and subspace: "H' \<unlhd> E"
   7.251 -    by (rule some_H'h' [elim_format]) blast
   7.252 -
   7.253 -  show "h (a \<cdot> x) = a * h x"
   7.254 -  proof -
   7.255 -    from linearform x' have "h' (a \<cdot> x) = a * h' x"
   7.256 -      by (rule linearform.mult)
   7.257 -    also from b x' have "h' x = h x" ..
   7.258 -    also from subspace x' have "a \<cdot> x \<in> H'"
   7.259 -      by (rule subspace.mult_closed)
   7.260 -    with b have "h' (a \<cdot> x) = h (a \<cdot> x)" ..
   7.261 -    finally show ?thesis .
   7.262 -  qed
   7.263 -qed
   7.264 -
   7.265 -text {*
   7.266 -  \medskip The limit of a non-empty chain of norm preserving
   7.267 -  extensions of @{text f} is an extension of @{text f}, since every
   7.268 -  element of the chain is an extension of @{text f} and the supremum
   7.269 -  is an extension for every element of the chain.
   7.270 -*}
   7.271 -
   7.272 -lemma sup_ext:
   7.273 -  assumes graph: "graph H h = \<Union>c"
   7.274 -    and M: "M = norm_pres_extensions E p F f"
   7.275 -    and cM: "c \<in> chain M"
   7.276 -    and ex: "\<exists>x. x \<in> c"
   7.277 -  shows "graph F f \<subseteq> graph H h"
   7.278 -proof -
   7.279 -  from ex obtain x where xc: "x \<in> c" ..
   7.280 -  from cM have "c \<subseteq> M" ..
   7.281 -  with xc have "x \<in> M" ..
   7.282 -  with M have "x \<in> norm_pres_extensions E p F f"
   7.283 -    by (simp only:)
   7.284 -  then obtain G g where "x = graph G g" and "graph F f \<subseteq> graph G g" ..
   7.285 -  then have "graph F f \<subseteq> x" by (simp only:)
   7.286 -  also from xc have "\<dots> \<subseteq> \<Union>c" by blast
   7.287 -  also from graph have "\<dots> = graph H h" ..
   7.288 -  finally show ?thesis .
   7.289 -qed
   7.290 -
   7.291 -text {*
   7.292 -  \medskip The domain @{text H} of the limit function is a superspace
   7.293 -  of @{text F}, since @{text F} is a subset of @{text H}. The
   7.294 -  existence of the @{text 0} element in @{text F} and the closure
   7.295 -  properties follow from the fact that @{text F} is a vector space.
   7.296 -*}
   7.297 -
   7.298 -lemma sup_supF:
   7.299 -  assumes graph: "graph H h = \<Union>c"
   7.300 -    and M: "M = norm_pres_extensions E p F f"
   7.301 -    and cM: "c \<in> chain M"
   7.302 -    and ex: "\<exists>x. x \<in> c"
   7.303 -    and FE: "F \<unlhd> E"
   7.304 -  shows "F \<unlhd> H"
   7.305 -proof
   7.306 -  from FE show "F \<noteq> {}" by (rule subspace.non_empty)
   7.307 -  from graph M cM ex have "graph F f \<subseteq> graph H h" by (rule sup_ext)
   7.308 -  then show "F \<subseteq> H" ..
   7.309 -  fix x y assume "x \<in> F" and "y \<in> F"
   7.310 -  with FE show "x + y \<in> F" by (rule subspace.add_closed)
   7.311 -next
   7.312 -  fix x a assume "x \<in> F"
   7.313 -  with FE show "a \<cdot> x \<in> F" by (rule subspace.mult_closed)
   7.314 -qed
   7.315 -
   7.316 -text {*
   7.317 -  \medskip The domain @{text H} of the limit function is a subspace of
   7.318 -  @{text E}.
   7.319 -*}
   7.320 -
   7.321 -lemma sup_subE:
   7.322 -  assumes graph: "graph H h = \<Union>c"
   7.323 -    and M: "M = norm_pres_extensions E p F f"
   7.324 -    and cM: "c \<in> chain M"
   7.325 -    and ex: "\<exists>x. x \<in> c"
   7.326 -    and FE: "F \<unlhd> E"
   7.327 -    and E: "vectorspace E"
   7.328 -  shows "H \<unlhd> E"
   7.329 -proof
   7.330 -  show "H \<noteq> {}"
   7.331 -  proof -
   7.332 -    from FE E have "0 \<in> F" by (rule subspace.zero)
   7.333 -    also from graph M cM ex FE have "F \<unlhd> H" by (rule sup_supF)
   7.334 -    then have "F \<subseteq> H" ..
   7.335 -    finally show ?thesis by blast
   7.336 -  qed
   7.337 -  show "H \<subseteq> E"
   7.338 -  proof
   7.339 -    fix x assume "x \<in> H"
   7.340 -    with M cM graph
   7.341 -    obtain H' h' where x: "x \<in> H'" and H'E: "H' \<unlhd> E"
   7.342 -      by (rule some_H'h' [elim_format]) blast
   7.343 -    from H'E have "H' \<subseteq> E" ..
   7.344 -    with x show "x \<in> E" ..
   7.345 -  qed
   7.346 -  fix x y assume x: "x \<in> H" and y: "y \<in> H"
   7.347 -  show "x + y \<in> H"
   7.348 -  proof -
   7.349 -    from M cM graph x y obtain H' h' where
   7.350 -          x': "x \<in> H'" and y': "y \<in> H'" and H'E: "H' \<unlhd> E"
   7.351 -        and graphs: "graph H' h' \<subseteq> graph H h"
   7.352 -      by (rule some_H'h'2 [elim_format]) blast
   7.353 -    from H'E x' y' have "x + y \<in> H'"
   7.354 -      by (rule subspace.add_closed)
   7.355 -    also from graphs have "H' \<subseteq> H" ..
   7.356 -    finally show ?thesis .
   7.357 -  qed
   7.358 -next
   7.359 -  fix x a assume x: "x \<in> H"
   7.360 -  show "a \<cdot> x \<in> H"
   7.361 -  proof -
   7.362 -    from M cM graph x
   7.363 -    obtain H' h' where x': "x \<in> H'" and H'E: "H' \<unlhd> E"
   7.364 -        and graphs: "graph H' h' \<subseteq> graph H h"
   7.365 -      by (rule some_H'h' [elim_format]) blast
   7.366 -    from H'E x' have "a \<cdot> x \<in> H'" by (rule subspace.mult_closed)
   7.367 -    also from graphs have "H' \<subseteq> H" ..
   7.368 -    finally show ?thesis .
   7.369 -  qed
   7.370 -qed
   7.371 -
   7.372 -text {*
   7.373 -  \medskip The limit function is bounded by the norm @{text p} as
   7.374 -  well, since all elements in the chain are bounded by @{text p}.
   7.375 -*}
   7.376 -
   7.377 -lemma sup_norm_pres:
   7.378 -  assumes graph: "graph H h = \<Union>c"
   7.379 -    and M: "M = norm_pres_extensions E p F f"
   7.380 -    and cM: "c \<in> chain M"
   7.381 -  shows "\<forall>x \<in> H. h x \<le> p x"
   7.382 -proof
   7.383 -  fix x assume "x \<in> H"
   7.384 -  with M cM graph obtain H' h' where x': "x \<in> H'"
   7.385 -      and graphs: "graph H' h' \<subseteq> graph H h"
   7.386 -      and a: "\<forall>x \<in> H'. h' x \<le> p x"
   7.387 -    by (rule some_H'h' [elim_format]) blast
   7.388 -  from graphs x' have [symmetric]: "h' x = h x" ..
   7.389 -  also from a x' have "h' x \<le> p x " ..
   7.390 -  finally show "h x \<le> p x" .
   7.391 -qed
   7.392 -
   7.393 -text {*
   7.394 -  \medskip The following lemma is a property of linear forms on real
   7.395 -  vector spaces. It will be used for the lemma @{text abs_HahnBanach}
   7.396 -  (see page \pageref{abs-HahnBanach}). \label{abs-ineq-iff} For real
   7.397 -  vector spaces the following inequations are equivalent:
   7.398 -  \begin{center}
   7.399 -  \begin{tabular}{lll}
   7.400 -  @{text "\<forall>x \<in> H. \<bar>h x\<bar> \<le> p x"} & and &
   7.401 -  @{text "\<forall>x \<in> H. h x \<le> p x"} \\
   7.402 -  \end{tabular}
   7.403 -  \end{center}
   7.404 -*}
   7.405 -
   7.406 -lemma abs_ineq_iff:
   7.407 -  assumes "subspace H E" and "vectorspace E" and "seminorm E p"
   7.408 -    and "linearform H h"
   7.409 -  shows "(\<forall>x \<in> H. \<bar>h x\<bar> \<le> p x) = (\<forall>x \<in> H. h x \<le> p x)" (is "?L = ?R")
   7.410 -proof
   7.411 -  interpret subspace H E by fact
   7.412 -  interpret vectorspace E by fact
   7.413 -  interpret seminorm E p by fact
   7.414 -  interpret linearform H h by fact
   7.415 -  have H: "vectorspace H" using `vectorspace E` ..
   7.416 -  {
   7.417 -    assume l: ?L
   7.418 -    show ?R
   7.419 -    proof
   7.420 -      fix x assume x: "x \<in> H"
   7.421 -      have "h x \<le> \<bar>h x\<bar>" by arith
   7.422 -      also from l x have "\<dots> \<le> p x" ..
   7.423 -      finally show "h x \<le> p x" .
   7.424 -    qed
   7.425 -  next
   7.426 -    assume r: ?R
   7.427 -    show ?L
   7.428 -    proof
   7.429 -      fix x assume x: "x \<in> H"
   7.430 -      show "\<And>a b :: real. - a \<le> b \<Longrightarrow> b \<le> a \<Longrightarrow> \<bar>b\<bar> \<le> a"
   7.431 -        by arith
   7.432 -      from `linearform H h` and H x
   7.433 -      have "- h x = h (- x)" by (rule linearform.neg [symmetric])
   7.434 -      also
   7.435 -      from H x have "- x \<in> H" by (rule vectorspace.neg_closed)
   7.436 -      with r have "h (- x) \<le> p (- x)" ..
   7.437 -      also have "\<dots> = p x"
   7.438 -	using `seminorm E p` `vectorspace E`
   7.439 -      proof (rule seminorm.minus)
   7.440 -        from x show "x \<in> E" ..
   7.441 -      qed
   7.442 -      finally have "- h x \<le> p x" .
   7.443 -      then show "- p x \<le> h x" by simp
   7.444 -      from r x show "h x \<le> p x" ..
   7.445 -    qed
   7.446 -  }
   7.447 -qed
   7.448 -
   7.449 -end
     8.1 --- a/src/HOL/HahnBanach/Linearform.thy	Wed Jun 24 21:28:02 2009 +0200
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,60 +0,0 @@
     8.4 -(*  Title:      HOL/Real/HahnBanach/Linearform.thy
     8.5 -    Author:     Gertrud Bauer, TU Munich
     8.6 -*)
     8.7 -
     8.8 -header {* Linearforms *}
     8.9 -
    8.10 -theory Linearform
    8.11 -imports VectorSpace
    8.12 -begin
    8.13 -
    8.14 -text {*
    8.15 -  A \emph{linear form} is a function on a vector space into the reals
    8.16 -  that is additive and multiplicative.
    8.17 -*}
    8.18 -
    8.19 -locale linearform =
    8.20 -  fixes V :: "'a\<Colon>{minus, plus, zero, uminus} set" and f
    8.21 -  assumes add [iff]: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> f (x + y) = f x + f y"
    8.22 -    and mult [iff]: "x \<in> V \<Longrightarrow> f (a \<cdot> x) = a * f x"
    8.23 -
    8.24 -declare linearform.intro [intro?]
    8.25 -
    8.26 -lemma (in linearform) neg [iff]:
    8.27 -  assumes "vectorspace V"
    8.28 -  shows "x \<in> V \<Longrightarrow> f (- x) = - f x"
    8.29 -proof -
    8.30 -  interpret vectorspace V by fact
    8.31 -  assume x: "x \<in> V"
    8.32 -  then have "f (- x) = f ((- 1) \<cdot> x)" by (simp add: negate_eq1)
    8.33 -  also from x have "\<dots> = (- 1) * (f x)" by (rule mult)
    8.34 -  also from x have "\<dots> = - (f x)" by simp
    8.35 -  finally show ?thesis .
    8.36 -qed
    8.37 -
    8.38 -lemma (in linearform) diff [iff]:
    8.39 -  assumes "vectorspace V"
    8.40 -  shows "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> f (x - y) = f x - f y"
    8.41 -proof -
    8.42 -  interpret vectorspace V by fact
    8.43 -  assume x: "x \<in> V" and y: "y \<in> V"
    8.44 -  then have "x - y = x + - y" by (rule diff_eq1)
    8.45 -  also have "f \<dots> = f x + f (- y)" by (rule add) (simp_all add: x y)
    8.46 -  also have "f (- y) = - f y" using `vectorspace V` y by (rule neg)
    8.47 -  finally show ?thesis by simp
    8.48 -qed
    8.49 -
    8.50 -text {* Every linear form yields @{text 0} for the @{text 0} vector. *}
    8.51 -
    8.52 -lemma (in linearform) zero [iff]:
    8.53 -  assumes "vectorspace V"
    8.54 -  shows "f 0 = 0"
    8.55 -proof -
    8.56 -  interpret vectorspace V by fact
    8.57 -  have "f 0 = f (0 - 0)" by simp
    8.58 -  also have "\<dots> = f 0 - f 0" using `vectorspace V` by (rule diff) simp_all
    8.59 -  also have "\<dots> = 0" by simp
    8.60 -  finally show ?thesis .
    8.61 -qed
    8.62 -
    8.63 -end
     9.1 --- a/src/HOL/HahnBanach/NormedSpace.thy	Wed Jun 24 21:28:02 2009 +0200
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,117 +0,0 @@
     9.4 -(*  Title:      HOL/Real/HahnBanach/NormedSpace.thy
     9.5 -    Author:     Gertrud Bauer, TU Munich
     9.6 -*)
     9.7 -
     9.8 -header {* Normed vector spaces *}
     9.9 -
    9.10 -theory NormedSpace
    9.11 -imports Subspace
    9.12 -begin
    9.13 -
    9.14 -subsection {* Quasinorms *}
    9.15 -
    9.16 -text {*
    9.17 -  A \emph{seminorm} @{text "\<parallel>\<cdot>\<parallel>"} is a function on a real vector space
    9.18 -  into the reals that has the following properties: it is positive
    9.19 -  definite, absolute homogenous and subadditive.
    9.20 -*}
    9.21 -
    9.22 -locale norm_syntax =
    9.23 -  fixes norm :: "'a \<Rightarrow> real"    ("\<parallel>_\<parallel>")
    9.24 -
    9.25 -locale seminorm = var_V + norm_syntax +
    9.26 -  constrains V :: "'a\<Colon>{minus, plus, zero, uminus} set"
    9.27 -  assumes ge_zero [iff?]: "x \<in> V \<Longrightarrow> 0 \<le> \<parallel>x\<parallel>"
    9.28 -    and abs_homogenous [iff?]: "x \<in> V \<Longrightarrow> \<parallel>a \<cdot> x\<parallel> = \<bar>a\<bar> * \<parallel>x\<parallel>"
    9.29 -    and subadditive [iff?]: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> \<parallel>x + y\<parallel> \<le> \<parallel>x\<parallel> + \<parallel>y\<parallel>"
    9.30 -
    9.31 -declare seminorm.intro [intro?]
    9.32 -
    9.33 -lemma (in seminorm) diff_subadditive:
    9.34 -  assumes "vectorspace V"
    9.35 -  shows "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> \<parallel>x - y\<parallel> \<le> \<parallel>x\<parallel> + \<parallel>y\<parallel>"
    9.36 -proof -
    9.37 -  interpret vectorspace V by fact
    9.38 -  assume x: "x \<in> V" and y: "y \<in> V"
    9.39 -  then have "x - y = x + - 1 \<cdot> y"
    9.40 -    by (simp add: diff_eq2 negate_eq2a)
    9.41 -  also from x y have "\<parallel>\<dots>\<parallel> \<le> \<parallel>x\<parallel> + \<parallel>- 1 \<cdot> y\<parallel>"
    9.42 -    by (simp add: subadditive)
    9.43 -  also from y have "\<parallel>- 1 \<cdot> y\<parallel> = \<bar>- 1\<bar> * \<parallel>y\<parallel>"
    9.44 -    by (rule abs_homogenous)
    9.45 -  also have "\<dots> = \<parallel>y\<parallel>" by simp
    9.46 -  finally show ?thesis .
    9.47 -qed
    9.48 -
    9.49 -lemma (in seminorm) minus:
    9.50 -  assumes "vectorspace V"
    9.51 -  shows "x \<in> V \<Longrightarrow> \<parallel>- x\<parallel> = \<parallel>x\<parallel>"
    9.52 -proof -
    9.53 -  interpret vectorspace V by fact
    9.54 -  assume x: "x \<in> V"
    9.55 -  then have "- x = - 1 \<cdot> x" by (simp only: negate_eq1)
    9.56 -  also from x have "\<parallel>\<dots>\<parallel> = \<bar>- 1\<bar> * \<parallel>x\<parallel>"
    9.57 -    by (rule abs_homogenous)
    9.58 -  also have "\<dots> = \<parallel>x\<parallel>" by simp
    9.59 -  finally show ?thesis .
    9.60 -qed
    9.61 -
    9.62 -
    9.63 -subsection {* Norms *}
    9.64 -
    9.65 -text {*
    9.66 -  A \emph{norm} @{text "\<parallel>\<cdot>\<parallel>"} is a seminorm that maps only the
    9.67 -  @{text 0} vector to @{text 0}.
    9.68 -*}
    9.69 -
    9.70 -locale norm = seminorm +
    9.71 -  assumes zero_iff [iff]: "x \<in> V \<Longrightarrow> (\<parallel>x\<parallel> = 0) = (x = 0)"
    9.72 -
    9.73 -
    9.74 -subsection {* Normed vector spaces *}
    9.75 -
    9.76 -text {*
    9.77 -  A vector space together with a norm is called a \emph{normed
    9.78 -  space}.
    9.79 -*}
    9.80 -
    9.81 -locale normed_vectorspace = vectorspace + norm
    9.82 -
    9.83 -declare normed_vectorspace.intro [intro?]
    9.84 -
    9.85 -lemma (in normed_vectorspace) gt_zero [intro?]:
    9.86 -  "x \<in> V \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> 0 < \<parallel>x\<parallel>"
    9.87 -proof -
    9.88 -  assume x: "x \<in> V" and neq: "x \<noteq> 0"
    9.89 -  from x have "0 \<le> \<parallel>x\<parallel>" ..
    9.90 -  also have [symmetric]: "\<dots> \<noteq> 0"
    9.91 -  proof
    9.92 -    assume "\<parallel>x\<parallel> = 0"
    9.93 -    with x have "x = 0" by simp
    9.94 -    with neq show False by contradiction
    9.95 -  qed
    9.96 -  finally show ?thesis .
    9.97 -qed
    9.98 -
    9.99 -text {*
   9.100 -  Any subspace of a normed vector space is again a normed vectorspace.
   9.101 -*}
   9.102 -
   9.103 -lemma subspace_normed_vs [intro?]:
   9.104 -  fixes F E norm
   9.105 -  assumes "subspace F E" "normed_vectorspace E norm"
   9.106 -  shows "normed_vectorspace F norm"
   9.107 -proof -
   9.108 -  interpret subspace F E by fact
   9.109 -  interpret normed_vectorspace E norm by fact
   9.110 -  show ?thesis
   9.111 -  proof
   9.112 -    show "vectorspace F" by (rule vectorspace) unfold_locales
   9.113 -  next
   9.114 -    have "NormedSpace.norm E norm" ..
   9.115 -    with subset show "NormedSpace.norm F norm"
   9.116 -      by (simp add: norm_def seminorm_def norm_axioms_def)
   9.117 -  qed
   9.118 -qed
   9.119 -
   9.120 -end
    10.1 --- a/src/HOL/HahnBanach/README.html	Wed Jun 24 21:28:02 2009 +0200
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,38 +0,0 @@
    10.4 -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    10.5 -
    10.6 -<!-- $Id$ -->
    10.7 -
    10.8 -<HTML>
    10.9 -
   10.10 -<HEAD>
   10.11 -  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   10.12 -  <TITLE>HOL/Real/HahnBanach/README</TITLE>
   10.13 -</HEAD>
   10.14 -
   10.15 -<BODY>
   10.16 -
   10.17 -<H3>The Hahn-Banach Theorem for Real Vector Spaces (Isabelle/Isar)</H3>
   10.18 -
   10.19 -Author: Gertrud Bauer, Technische Universit&auml;t M&uuml;nchen<P>
   10.20 -
   10.21 -This directory contains the proof of the Hahn-Banach theorem for real vectorspaces,
   10.22 -following H. Heuser, Funktionalanalysis, p. 228 -232.
   10.23 -The Hahn-Banach theorem is one of the fundamental theorems of functioal analysis.
   10.24 -It is a conclusion of Zorn's lemma.<P>
   10.25 -
   10.26 -Two different formaulations of the theorem are presented, one for general real vectorspaces
   10.27 -and its application to normed vectorspaces. <P>
   10.28 -
   10.29 -The theorem says, that every continous linearform, defined on arbitrary subspaces
   10.30 -(not only one-dimensional subspaces), can be extended to a continous linearform on
   10.31 -the whole vectorspace.
   10.32 -
   10.33 -
   10.34 -<HR>
   10.35 -
   10.36 -<ADDRESS>
   10.37 -<A NAME="bauerg@in.tum.de" HREF="mailto:bauerg@in.tum.de">bauerg@in.tum.de</A>
   10.38 -</ADDRESS>
   10.39 -
   10.40 -</BODY>
   10.41 -</HTML>
    11.1 --- a/src/HOL/HahnBanach/ROOT.ML	Wed Jun 24 21:28:02 2009 +0200
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,8 +0,0 @@
    11.4 -(*  Title:      HOL/Real/HahnBanach/ROOT.ML
    11.5 -    ID:         $Id$
    11.6 -    Author:     Gertrud Bauer, TU Munich
    11.7 -
    11.8 -The Hahn-Banach theorem for real vector spaces (Isabelle/Isar).
    11.9 -*)
   11.10 -
   11.11 -time_use_thy "HahnBanach";
    12.1 --- a/src/HOL/HahnBanach/Subspace.thy	Wed Jun 24 21:28:02 2009 +0200
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,513 +0,0 @@
    12.4 -(*  Title:      HOL/Real/HahnBanach/Subspace.thy
    12.5 -    Author:     Gertrud Bauer, TU Munich
    12.6 -*)
    12.7 -
    12.8 -header {* Subspaces *}
    12.9 -
   12.10 -theory Subspace
   12.11 -imports VectorSpace
   12.12 -begin
   12.13 -
   12.14 -subsection {* Definition *}
   12.15 -
   12.16 -text {*
   12.17 -  A non-empty subset @{text U} of a vector space @{text V} is a
   12.18 -  \emph{subspace} of @{text V}, iff @{text U} is closed under addition
   12.19 -  and scalar multiplication.
   12.20 -*}
   12.21 -
   12.22 -locale subspace =
   12.23 -  fixes U :: "'a\<Colon>{minus, plus, zero, uminus} set" and V
   12.24 -  assumes non_empty [iff, intro]: "U \<noteq> {}"
   12.25 -    and subset [iff]: "U \<subseteq> V"
   12.26 -    and add_closed [iff]: "x \<in> U \<Longrightarrow> y \<in> U \<Longrightarrow> x + y \<in> U"
   12.27 -    and mult_closed [iff]: "x \<in> U \<Longrightarrow> a \<cdot> x \<in> U"
   12.28 -
   12.29 -notation (symbols)
   12.30 -  subspace  (infix "\<unlhd>" 50)
   12.31 -
   12.32 -declare vectorspace.intro [intro?] subspace.intro [intro?]
   12.33 -
   12.34 -lemma subspace_subset [elim]: "U \<unlhd> V \<Longrightarrow> U \<subseteq> V"
   12.35 -  by (rule subspace.subset)
   12.36 -
   12.37 -lemma (in subspace) subsetD [iff]: "x \<in> U \<Longrightarrow> x \<in> V"
   12.38 -  using subset by blast
   12.39 -
   12.40 -lemma subspaceD [elim]: "U \<unlhd> V \<Longrightarrow> x \<in> U \<Longrightarrow> x \<in> V"
   12.41 -  by (rule subspace.subsetD)
   12.42 -
   12.43 -lemma rev_subspaceD [elim?]: "x \<in> U \<Longrightarrow> U \<unlhd> V \<Longrightarrow> x \<in> V"
   12.44 -  by (rule subspace.subsetD)
   12.45 -
   12.46 -lemma (in subspace) diff_closed [iff]:
   12.47 -  assumes "vectorspace V"
   12.48 -  assumes x: "x \<in> U" and y: "y \<in> U"
   12.49 -  shows "x - y \<in> U"
   12.50 -proof -
   12.51 -  interpret vectorspace V by fact
   12.52 -  from x y show ?thesis by (simp add: diff_eq1 negate_eq1)
   12.53 -qed
   12.54 -
   12.55 -text {*
   12.56 -  \medskip Similar as for linear spaces, the existence of the zero
   12.57 -  element in every subspace follows from the non-emptiness of the
   12.58 -  carrier set and by vector space laws.
   12.59 -*}
   12.60 -
   12.61 -lemma (in subspace) zero [intro]:
   12.62 -  assumes "vectorspace V"
   12.63 -  shows "0 \<in> U"
   12.64 -proof -
   12.65 -  interpret V: vectorspace V by fact
   12.66 -  have "U \<noteq> {}" by (rule non_empty)
   12.67 -  then obtain x where x: "x \<in> U" by blast
   12.68 -  then have "x \<in> V" .. then have "0 = x - x" by simp
   12.69 -  also from `vectorspace V` x x have "\<dots> \<in> U" by (rule diff_closed)
   12.70 -  finally show ?thesis .
   12.71 -qed
   12.72 -
   12.73 -lemma (in subspace) neg_closed [iff]:
   12.74 -  assumes "vectorspace V"
   12.75 -  assumes x: "x \<in> U"
   12.76 -  shows "- x \<in> U"
   12.77 -proof -
   12.78 -  interpret vectorspace V by fact
   12.79 -  from x show ?thesis by (simp add: negate_eq1)
   12.80 -qed
   12.81 -
   12.82 -text {* \medskip Further derived laws: every subspace is a vector space. *}
   12.83 -
   12.84 -lemma (in subspace) vectorspace [iff]:
   12.85 -  assumes "vectorspace V"
   12.86 -  shows "vectorspace U"
   12.87 -proof -
   12.88 -  interpret vectorspace V by fact
   12.89 -  show ?thesis
   12.90 -  proof
   12.91 -    show "U \<noteq> {}" ..
   12.92 -    fix x y z assume x: "x \<in> U" and y: "y \<in> U" and z: "z \<in> U"
   12.93 -    fix a b :: real
   12.94 -    from x y show "x + y \<in> U" by simp
   12.95 -    from x show "a \<cdot> x \<in> U" by simp
   12.96 -    from x y z show "(x + y) + z = x + (y + z)" by (simp add: add_ac)
   12.97 -    from x y show "x + y = y + x" by (simp add: add_ac)
   12.98 -    from x show "x - x = 0" by simp
   12.99 -    from x show "0 + x = x" by simp
  12.100 -    from x y show "a \<cdot> (x + y) = a \<cdot> x + a \<cdot> y" by (simp add: distrib)
  12.101 -    from x show "(a + b) \<cdot> x = a \<cdot> x + b \<cdot> x" by (simp add: distrib)
  12.102 -    from x show "(a * b) \<cdot> x = a \<cdot> b \<cdot> x" by (simp add: mult_assoc)
  12.103 -    from x show "1 \<cdot> x = x" by simp
  12.104 -    from x show "- x = - 1 \<cdot> x" by (simp add: negate_eq1)
  12.105 -    from x y show "x - y = x + - y" by (simp add: diff_eq1)
  12.106 -  qed
  12.107 -qed
  12.108 -
  12.109 -
  12.110 -text {* The subspace relation is reflexive. *}
  12.111 -
  12.112 -lemma (in vectorspace) subspace_refl [intro]: "V \<unlhd> V"
  12.113 -proof
  12.114 -  show "V \<noteq> {}" ..
  12.115 -  show "V \<subseteq> V" ..
  12.116 -  fix x y assume x: "x \<in> V" and y: "y \<in> V"
  12.117 -  fix a :: real
  12.118 -  from x y show "x + y \<in> V" by simp
  12.119 -  from x show "a \<cdot> x \<in> V" by simp
  12.120 -qed
  12.121 -
  12.122 -text {* The subspace relation is transitive. *}
  12.123 -
  12.124 -lemma (in vectorspace) subspace_trans [trans]:
  12.125 -  "U \<unlhd> V \<Longrightarrow> V \<unlhd> W \<Longrightarrow> U \<unlhd> W"
  12.126 -proof
  12.127 -  assume uv: "U \<unlhd> V" and vw: "V \<unlhd> W"
  12.128 -  from uv show "U \<noteq> {}" by (rule subspace.non_empty)
  12.129 -  show "U \<subseteq> W"
  12.130 -  proof -
  12.131 -    from uv have "U \<subseteq> V" by (rule subspace.subset)
  12.132 -    also from vw have "V \<subseteq> W" by (rule subspace.subset)
  12.133 -    finally show ?thesis .
  12.134 -  qed
  12.135 -  fix x y assume x: "x \<in> U" and y: "y \<in> U"
  12.136 -  from uv and x y show "x + y \<in> U" by (rule subspace.add_closed)
  12.137 -  from uv and x show "\<And>a. a \<cdot> x \<in> U" by (rule subspace.mult_closed)
  12.138 -qed
  12.139 -
  12.140 -
  12.141 -subsection {* Linear closure *}
  12.142 -
  12.143 -text {*
  12.144 -  The \emph{linear closure} of a vector @{text x} is the set of all
  12.145 -  scalar multiples of @{text x}.
  12.146 -*}
  12.147 -
  12.148 -definition
  12.149 -  lin :: "('a::{minus, plus, zero}) \<Rightarrow> 'a set" where
  12.150 -  "lin x = {a \<cdot> x | a. True}"
  12.151 -
  12.152 -lemma linI [intro]: "y = a \<cdot> x \<Longrightarrow> y \<in> lin x"
  12.153 -  unfolding lin_def by blast
  12.154 -
  12.155 -lemma linI' [iff]: "a \<cdot> x \<in> lin x"
  12.156 -  unfolding lin_def by blast
  12.157 -
  12.158 -lemma linE [elim]: "x \<in> lin v \<Longrightarrow> (\<And>a::real. x = a \<cdot> v \<Longrightarrow> C) \<Longrightarrow> C"
  12.159 -  unfolding lin_def by blast
  12.160 -
  12.161 -
  12.162 -text {* Every vector is contained in its linear closure. *}
  12.163 -
  12.164 -lemma (in vectorspace) x_lin_x [iff]: "x \<in> V \<Longrightarrow> x \<in> lin x"
  12.165 -proof -
  12.166 -  assume "x \<in> V"
  12.167 -  then have "x = 1 \<cdot> x" by simp
  12.168 -  also have "\<dots> \<in> lin x" ..
  12.169 -  finally show ?thesis .
  12.170 -qed
  12.171 -
  12.172 -lemma (in vectorspace) "0_lin_x" [iff]: "x \<in> V \<Longrightarrow> 0 \<in> lin x"
  12.173 -proof
  12.174 -  assume "x \<in> V"
  12.175 -  then show "0 = 0 \<cdot> x" by simp
  12.176 -qed
  12.177 -
  12.178 -text {* Any linear closure is a subspace. *}
  12.179 -
  12.180 -lemma (in vectorspace) lin_subspace [intro]:
  12.181 -  "x \<in> V \<Longrightarrow> lin x \<unlhd> V"
  12.182 -proof
  12.183 -  assume x: "x \<in> V"
  12.184 -  then show "lin x \<noteq> {}" by (auto simp add: x_lin_x)
  12.185 -  show "lin x \<subseteq> V"
  12.186 -  proof
  12.187 -    fix x' assume "x' \<in> lin x"
  12.188 -    then obtain a where "x' = a \<cdot> x" ..
  12.189 -    with x show "x' \<in> V" by simp
  12.190 -  qed
  12.191 -  fix x' x'' assume x': "x' \<in> lin x" and x'': "x'' \<in> lin x"
  12.192 -  show "x' + x'' \<in> lin x"
  12.193 -  proof -
  12.194 -    from x' obtain a' where "x' = a' \<cdot> x" ..
  12.195 -    moreover from x'' obtain a'' where "x'' = a'' \<cdot> x" ..
  12.196 -    ultimately have "x' + x'' = (a' + a'') \<cdot> x"
  12.197 -      using x by (simp add: distrib)
  12.198 -    also have "\<dots> \<in> lin x" ..
  12.199 -    finally show ?thesis .
  12.200 -  qed
  12.201 -  fix a :: real
  12.202 -  show "a \<cdot> x' \<in> lin x"
  12.203 -  proof -
  12.204 -    from x' obtain a' where "x' = a' \<cdot> x" ..
  12.205 -    with x have "a \<cdot> x' = (a * a') \<cdot> x" by (simp add: mult_assoc)
  12.206 -    also have "\<dots> \<in> lin x" ..
  12.207 -    finally show ?thesis .
  12.208 -  qed
  12.209 -qed
  12.210 -
  12.211 -
  12.212 -text {* Any linear closure is a vector space. *}
  12.213 -
  12.214 -lemma (in vectorspace) lin_vectorspace [intro]:
  12.215 -  assumes "x \<in> V"
  12.216 -  shows "vectorspace (lin x)"
  12.217 -proof -
  12.218 -  from `x \<in> V` have "subspace (lin x) V"
  12.219 -    by (rule lin_subspace)
  12.220 -  from this and vectorspace_axioms show ?thesis
  12.221 -    by (rule subspace.vectorspace)
  12.222 -qed
  12.223 -
  12.224 -
  12.225 -subsection {* Sum of two vectorspaces *}
  12.226 -
  12.227 -text {*
  12.228 -  The \emph{sum} of two vectorspaces @{text U} and @{text V} is the
  12.229 -  set of all sums of elements from @{text U} and @{text V}.
  12.230 -*}
  12.231 -
  12.232 -instantiation "fun" :: (type, type) plus
  12.233 -begin
  12.234 -
  12.235 -definition
  12.236 -  sum_def: "plus_fun U V = {u + v | u v. u \<in> U \<and> v \<in> V}"  (* FIXME not fully general!? *)
  12.237 -
  12.238 -instance ..
  12.239 -
  12.240 -end
  12.241 -
  12.242 -lemma sumE [elim]:
  12.243 -    "x \<in> U + V \<Longrightarrow> (\<And>u v. x = u + v \<Longrightarrow> u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> C) \<Longrightarrow> C"
  12.244 -  unfolding sum_def by blast
  12.245 -
  12.246 -lemma sumI [intro]:
  12.247 -    "u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> x = u + v \<Longrightarrow> x \<in> U + V"
  12.248 -  unfolding sum_def by blast
  12.249 -
  12.250 -lemma sumI' [intro]:
  12.251 -    "u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> u + v \<in> U + V"
  12.252 -  unfolding sum_def by blast
  12.253 -
  12.254 -text {* @{text U} is a subspace of @{text "U + V"}. *}
  12.255 -
  12.256 -lemma subspace_sum1 [iff]:
  12.257 -  assumes "vectorspace U" "vectorspace V"
  12.258 -  shows "U \<unlhd> U + V"
  12.259 -proof -
  12.260 -  interpret vectorspace U by fact
  12.261 -  interpret vectorspace V by fact
  12.262 -  show ?thesis
  12.263 -  proof
  12.264 -    show "U \<noteq> {}" ..
  12.265 -    show "U \<subseteq> U + V"
  12.266 -    proof
  12.267 -      fix x assume x: "x \<in> U"
  12.268 -      moreover have "0 \<in> V" ..
  12.269 -      ultimately have "x + 0 \<in> U + V" ..
  12.270 -      with x show "x \<in> U + V" by simp
  12.271 -    qed
  12.272 -    fix x y assume x: "x \<in> U" and "y \<in> U"
  12.273 -    then show "x + y \<in> U" by simp
  12.274 -    from x show "\<And>a. a \<cdot> x \<in> U" by simp
  12.275 -  qed
  12.276 -qed
  12.277 -
  12.278 -text {* The sum of two subspaces is again a subspace. *}
  12.279 -
  12.280 -lemma sum_subspace [intro?]:
  12.281 -  assumes "subspace U E" "vectorspace E" "subspace V E"
  12.282 -  shows "U + V \<unlhd> E"
  12.283 -proof -
  12.284 -  interpret subspace U E by fact
  12.285 -  interpret vectorspace E by fact
  12.286 -  interpret subspace V E by fact
  12.287 -  show ?thesis
  12.288 -  proof
  12.289 -    have "0 \<in> U + V"
  12.290 -    proof
  12.291 -      show "0 \<in> U" using `vectorspace E` ..
  12.292 -      show "0 \<in> V" using `vectorspace E` ..
  12.293 -      show "(0::'a) = 0 + 0" by simp
  12.294 -    qed
  12.295 -    then show "U + V \<noteq> {}" by blast
  12.296 -    show "U + V \<subseteq> E"
  12.297 -    proof
  12.298 -      fix x assume "x \<in> U + V"
  12.299 -      then obtain u v where "x = u + v" and
  12.300 -	"u \<in> U" and "v \<in> V" ..
  12.301 -      then show "x \<in> E" by simp
  12.302 -    qed
  12.303 -    fix x y assume x: "x \<in> U + V" and y: "y \<in> U + V"
  12.304 -    show "x + y \<in> U + V"
  12.305 -    proof -
  12.306 -      from x obtain ux vx where "x = ux + vx" and "ux \<in> U" and "vx \<in> V" ..
  12.307 -      moreover
  12.308 -      from y obtain uy vy where "y = uy + vy" and "uy \<in> U" and "vy \<in> V" ..
  12.309 -      ultimately
  12.310 -      have "ux + uy \<in> U"
  12.311 -	and "vx + vy \<in> V"
  12.312 -	and "x + y = (ux + uy) + (vx + vy)"
  12.313 -	using x y by (simp_all add: add_ac)
  12.314 -      then show ?thesis ..
  12.315 -    qed
  12.316 -    fix a show "a \<cdot> x \<in> U + V"
  12.317 -    proof -
  12.318 -      from x obtain u v where "x = u + v" and "u \<in> U" and "v \<in> V" ..
  12.319 -      then have "a \<cdot> u \<in> U" and "a \<cdot> v \<in> V"
  12.320 -	and "a \<cdot> x = (a \<cdot> u) + (a \<cdot> v)" by (simp_all add: distrib)
  12.321 -      then show ?thesis ..
  12.322 -    qed
  12.323 -  qed
  12.324 -qed
  12.325 -
  12.326 -text{* The sum of two subspaces is a vectorspace. *}
  12.327 -
  12.328 -lemma sum_vs [intro?]:
  12.329 -    "U \<unlhd> E \<Longrightarrow> V \<unlhd> E \<Longrightarrow> vectorspace E \<Longrightarrow> vectorspace (U + V)"
  12.330 -  by (rule subspace.vectorspace) (rule sum_subspace)
  12.331 -
  12.332 -
  12.333 -subsection {* Direct sums *}
  12.334 -
  12.335 -text {*
  12.336 -  The sum of @{text U} and @{text V} is called \emph{direct}, iff the
  12.337 -  zero element is the only common element of @{text U} and @{text
  12.338 -  V}. For every element @{text x} of the direct sum of @{text U} and
  12.339 -  @{text V} the decomposition in @{text "x = u + v"} with
  12.340 -  @{text "u \<in> U"} and @{text "v \<in> V"} is unique.
  12.341 -*}
  12.342 -
  12.343 -lemma decomp:
  12.344 -  assumes "vectorspace E" "subspace U E" "subspace V E"
  12.345 -  assumes direct: "U \<inter> V = {0}"
  12.346 -    and u1: "u1 \<in> U" and u2: "u2 \<in> U"
  12.347 -    and v1: "v1 \<in> V" and v2: "v2 \<in> V"
  12.348 -    and sum: "u1 + v1 = u2 + v2"
  12.349 -  shows "u1 = u2 \<and> v1 = v2"
  12.350 -proof -
  12.351 -  interpret vectorspace E by fact
  12.352 -  interpret subspace U E by fact
  12.353 -  interpret subspace V E by fact
  12.354 -  show ?thesis
  12.355 -  proof
  12.356 -    have U: "vectorspace U"  (* FIXME: use interpret *)
  12.357 -      using `subspace U E` `vectorspace E` by (rule subspace.vectorspace)
  12.358 -    have V: "vectorspace V"
  12.359 -      using `subspace V E` `vectorspace E` by (rule subspace.vectorspace)
  12.360 -    from u1 u2 v1 v2 and sum have eq: "u1 - u2 = v2 - v1"
  12.361 -      by (simp add: add_diff_swap)
  12.362 -    from u1 u2 have u: "u1 - u2 \<in> U"
  12.363 -      by (rule vectorspace.diff_closed [OF U])
  12.364 -    with eq have v': "v2 - v1 \<in> U" by (simp only:)
  12.365 -    from v2 v1 have v: "v2 - v1 \<in> V"
  12.366 -      by (rule vectorspace.diff_closed [OF V])
  12.367 -    with eq have u': " u1 - u2 \<in> V" by (simp only:)
  12.368 -    
  12.369 -    show "u1 = u2"
  12.370 -    proof (rule add_minus_eq)
  12.371 -      from u1 show "u1 \<in> E" ..
  12.372 -      from u2 show "u2 \<in> E" ..
  12.373 -      from u u' and direct show "u1 - u2 = 0" by blast
  12.374 -    qed
  12.375 -    show "v1 = v2"
  12.376 -    proof (rule add_minus_eq [symmetric])
  12.377 -      from v1 show "v1 \<in> E" ..
  12.378 -      from v2 show "v2 \<in> E" ..
  12.379 -      from v v' and direct show "v2 - v1 = 0" by blast
  12.380 -    qed
  12.381 -  qed
  12.382 -qed
  12.383 -
  12.384 -text {*
  12.385 -  An application of the previous lemma will be used in the proof of
  12.386 -  the Hahn-Banach Theorem (see page \pageref{decomp-H-use}): for any
  12.387 -  element @{text "y + a \<cdot> x\<^sub>0"} of the direct sum of a
  12.388 -  vectorspace @{text H} and the linear closure of @{text "x\<^sub>0"}
  12.389 -  the components @{text "y \<in> H"} and @{text a} are uniquely
  12.390 -  determined.
  12.391 -*}
  12.392 -
  12.393 -lemma decomp_H':
  12.394 -  assumes "vectorspace E" "subspace H E"
  12.395 -  assumes y1: "y1 \<in> H" and y2: "y2 \<in> H"
  12.396 -    and x': "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
  12.397 -    and eq: "y1 + a1 \<cdot> x' = y2 + a2 \<cdot> x'"
  12.398 -  shows "y1 = y2 \<and> a1 = a2"
  12.399 -proof -
  12.400 -  interpret vectorspace E by fact
  12.401 -  interpret subspace H E by fact
  12.402 -  show ?thesis
  12.403 -  proof
  12.404 -    have c: "y1 = y2 \<and> a1 \<cdot> x' = a2 \<cdot> x'"
  12.405 -    proof (rule decomp)
  12.406 -      show "a1 \<cdot> x' \<in> lin x'" ..
  12.407 -      show "a2 \<cdot> x' \<in> lin x'" ..
  12.408 -      show "H \<inter> lin x' = {0}"
  12.409 -      proof
  12.410 -	show "H \<inter> lin x' \<subseteq> {0}"
  12.411 -	proof
  12.412 -          fix x assume x: "x \<in> H \<inter> lin x'"
  12.413 -          then obtain a where xx': "x = a \<cdot> x'"
  12.414 -            by blast
  12.415 -          have "x = 0"
  12.416 -          proof cases
  12.417 -            assume "a = 0"
  12.418 -            with xx' and x' show ?thesis by simp
  12.419 -          next
  12.420 -            assume a: "a \<noteq> 0"
  12.421 -            from x have "x \<in> H" ..
  12.422 -            with xx' have "inverse a \<cdot> a \<cdot> x' \<in> H" by simp
  12.423 -            with a and x' have "x' \<in> H" by (simp add: mult_assoc2)
  12.424 -            with `x' \<notin> H` show ?thesis by contradiction
  12.425 -          qed
  12.426 -          then show "x \<in> {0}" ..
  12.427 -	qed
  12.428 -	show "{0} \<subseteq> H \<inter> lin x'"
  12.429 -	proof -
  12.430 -          have "0 \<in> H" using `vectorspace E` ..
  12.431 -          moreover have "0 \<in> lin x'" using `x' \<in> E` ..
  12.432 -          ultimately show ?thesis by blast
  12.433 -	qed
  12.434 -      qed
  12.435 -      show "lin x' \<unlhd> E" using `x' \<in> E` ..
  12.436 -    qed (rule `vectorspace E`, rule `subspace H E`, rule y1, rule y2, rule eq)
  12.437 -    then show "y1 = y2" ..
  12.438 -    from c have "a1 \<cdot> x' = a2 \<cdot> x'" ..
  12.439 -    with x' show "a1 = a2" by (simp add: mult_right_cancel)
  12.440 -  qed
  12.441 -qed
  12.442 -
  12.443 -text {*
  12.444 -  Since for any element @{text "y + a \<cdot> x'"} of the direct sum of a
  12.445 -  vectorspace @{text H} and the linear closure of @{text x'} the
  12.446 -  components @{text "y \<in> H"} and @{text a} are unique, it follows from
  12.447 -  @{text "y \<in> H"} that @{text "a = 0"}.
  12.448 -*}
  12.449 -
  12.450 -lemma decomp_H'_H:
  12.451 -  assumes "vectorspace E" "subspace H E"
  12.452 -  assumes t: "t \<in> H"
  12.453 -    and x': "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
  12.454 -  shows "(SOME (y, a). t = y + a \<cdot> x' \<and> y \<in> H) = (t, 0)"
  12.455 -proof -
  12.456 -  interpret vectorspace E by fact
  12.457 -  interpret subspace H E by fact
  12.458 -  show ?thesis
  12.459 -  proof (rule, simp_all only: split_paired_all split_conv)
  12.460 -    from t x' show "t = t + 0 \<cdot> x' \<and> t \<in> H" by simp
  12.461 -    fix y and a assume ya: "t = y + a \<cdot> x' \<and> y \<in> H"
  12.462 -    have "y = t \<and> a = 0"
  12.463 -    proof (rule decomp_H')
  12.464 -      from ya x' show "y + a \<cdot> x' = t + 0 \<cdot> x'" by simp
  12.465 -      from ya show "y \<in> H" ..
  12.466 -    qed (rule `vectorspace E`, rule `subspace H E`, rule t, (rule x')+)
  12.467 -    with t x' show "(y, a) = (y + a \<cdot> x', 0)" by simp
  12.468 -  qed
  12.469 -qed
  12.470 -
  12.471 -text {*
  12.472 -  The components @{text "y \<in> H"} and @{text a} in @{text "y + a \<cdot> x'"}
  12.473 -  are unique, so the function @{text h'} defined by
  12.474 -  @{text "h' (y + a \<cdot> x') = h y + a \<cdot> \<xi>"} is definite.
  12.475 -*}
  12.476 -
  12.477 -lemma h'_definite:
  12.478 -  fixes H
  12.479 -  assumes h'_def:
  12.480 -    "h' \<equiv> (\<lambda>x. let (y, a) = SOME (y, a). (x = y + a \<cdot> x' \<and> y \<in> H)
  12.481 -                in (h y) + a * xi)"
  12.482 -    and x: "x = y + a \<cdot> x'"
  12.483 -  assumes "vectorspace E" "subspace H E"
  12.484 -  assumes y: "y \<in> H"
  12.485 -    and x': "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
  12.486 -  shows "h' x = h y + a * xi"
  12.487 -proof -
  12.488 -  interpret vectorspace E by fact
  12.489 -  interpret subspace H E by fact
  12.490 -  from x y x' have "x \<in> H + lin x'" by auto
  12.491 -  have "\<exists>!p. (\<lambda>(y, a). x = y + a \<cdot> x' \<and> y \<in> H) p" (is "\<exists>!p. ?P p")
  12.492 -  proof (rule ex_ex1I)
  12.493 -    from x y show "\<exists>p. ?P p" by blast
  12.494 -    fix p q assume p: "?P p" and q: "?P q"
  12.495 -    show "p = q"
  12.496 -    proof -
  12.497 -      from p have xp: "x = fst p + snd p \<cdot> x' \<and> fst p \<in> H"
  12.498 -        by (cases p) simp
  12.499 -      from q have xq: "x = fst q + snd q \<cdot> x' \<and> fst q \<in> H"
  12.500 -        by (cases q) simp
  12.501 -      have "fst p = fst q \<and> snd p = snd q"
  12.502 -      proof (rule decomp_H')
  12.503 -        from xp show "fst p \<in> H" ..
  12.504 -        from xq show "fst q \<in> H" ..
  12.505 -        from xp and xq show "fst p + snd p \<cdot> x' = fst q + snd q \<cdot> x'"
  12.506 -          by simp
  12.507 -      qed (rule `vectorspace E`, rule `subspace H E`, (rule x')+)
  12.508 -      then show ?thesis by (cases p, cases q) simp
  12.509 -    qed
  12.510 -  qed
  12.511 -  then have eq: "(SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H) = (y, a)"
  12.512 -    by (rule some1_equality) (simp add: x y)
  12.513 -  with h'_def show "h' x = h y + a * xi" by (simp add: Let_def)
  12.514 -qed
  12.515 -
  12.516 -end
    13.1 --- a/src/HOL/HahnBanach/VectorSpace.thy	Wed Jun 24 21:28:02 2009 +0200
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,419 +0,0 @@
    13.4 -(*  Title:      HOL/Real/HahnBanach/VectorSpace.thy
    13.5 -    ID:         $Id$
    13.6 -    Author:     Gertrud Bauer, TU Munich
    13.7 -*)
    13.8 -
    13.9 -header {* Vector spaces *}
   13.10 -
   13.11 -theory VectorSpace
   13.12 -imports Real Bounds Zorn
   13.13 -begin
   13.14 -
   13.15 -subsection {* Signature *}
   13.16 -
   13.17 -text {*
   13.18 -  For the definition of real vector spaces a type @{typ 'a} of the
   13.19 -  sort @{text "{plus, minus, zero}"} is considered, on which a real
   13.20 -  scalar multiplication @{text \<cdot>} is declared.
   13.21 -*}
   13.22 -
   13.23 -consts
   13.24 -  prod  :: "real \<Rightarrow> 'a::{plus, minus, zero} \<Rightarrow> 'a"     (infixr "'(*')" 70)
   13.25 -
   13.26 -notation (xsymbols)
   13.27 -  prod  (infixr "\<cdot>" 70)
   13.28 -notation (HTML output)
   13.29 -  prod  (infixr "\<cdot>" 70)
   13.30 -
   13.31 -
   13.32 -subsection {* Vector space laws *}
   13.33 -
   13.34 -text {*
   13.35 -  A \emph{vector space} is a non-empty set @{text V} of elements from
   13.36 -  @{typ 'a} with the following vector space laws: The set @{text V} is
   13.37 -  closed under addition and scalar multiplication, addition is
   13.38 -  associative and commutative; @{text "- x"} is the inverse of @{text
   13.39 -  x} w.~r.~t.~addition and @{text 0} is the neutral element of
   13.40 -  addition.  Addition and multiplication are distributive; scalar
   13.41 -  multiplication is associative and the real number @{text "1"} is
   13.42 -  the neutral element of scalar multiplication.
   13.43 -*}
   13.44 -
   13.45 -locale var_V = fixes V
   13.46 -
   13.47 -locale vectorspace = var_V +
   13.48 -  assumes non_empty [iff, intro?]: "V \<noteq> {}"
   13.49 -    and add_closed [iff]: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + y \<in> V"
   13.50 -    and mult_closed [iff]: "x \<in> V \<Longrightarrow> a \<cdot> x \<in> V"
   13.51 -    and add_assoc: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> (x + y) + z = x + (y + z)"
   13.52 -    and add_commute: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + y = y + x"
   13.53 -    and diff_self [simp]: "x \<in> V \<Longrightarrow> x - x = 0"
   13.54 -    and add_zero_left [simp]: "x \<in> V \<Longrightarrow> 0 + x = x"
   13.55 -    and add_mult_distrib1: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> a \<cdot> (x + y) = a \<cdot> x + a \<cdot> y"
   13.56 -    and add_mult_distrib2: "x \<in> V \<Longrightarrow> (a + b) \<cdot> x = a \<cdot> x + b \<cdot> x"
   13.57 -    and mult_assoc: "x \<in> V \<Longrightarrow> (a * b) \<cdot> x = a \<cdot> (b \<cdot> x)"
   13.58 -    and mult_1 [simp]: "x \<in> V \<Longrightarrow> 1 \<cdot> x = x"
   13.59 -    and negate_eq1: "x \<in> V \<Longrightarrow> - x = (- 1) \<cdot> x"
   13.60 -    and diff_eq1: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x - y = x + - y"
   13.61 -
   13.62 -lemma (in vectorspace) negate_eq2: "x \<in> V \<Longrightarrow> (- 1) \<cdot> x = - x"
   13.63 -  by (rule negate_eq1 [symmetric])
   13.64 -
   13.65 -lemma (in vectorspace) negate_eq2a: "x \<in> V \<Longrightarrow> -1 \<cdot> x = - x"
   13.66 -  by (simp add: negate_eq1)
   13.67 -
   13.68 -lemma (in vectorspace) diff_eq2: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + - y = x - y"
   13.69 -  by (rule diff_eq1 [symmetric])
   13.70 -
   13.71 -lemma (in vectorspace) diff_closed [iff]: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x - y \<in> V"
   13.72 -  by (simp add: diff_eq1 negate_eq1)
   13.73 -
   13.74 -lemma (in vectorspace) neg_closed [iff]: "x \<in> V \<Longrightarrow> - x \<in> V"
   13.75 -  by (simp add: negate_eq1)
   13.76 -
   13.77 -lemma (in vectorspace) add_left_commute:
   13.78 -  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> x + (y + z) = y + (x + z)"
   13.79 -proof -
   13.80 -  assume xyz: "x \<in> V"  "y \<in> V"  "z \<in> V"
   13.81 -  then have "x + (y + z) = (x + y) + z"
   13.82 -    by (simp only: add_assoc)
   13.83 -  also from xyz have "\<dots> = (y + x) + z" by (simp only: add_commute)
   13.84 -  also from xyz have "\<dots> = y + (x + z)" by (simp only: add_assoc)
   13.85 -  finally show ?thesis .
   13.86 -qed
   13.87 -
   13.88 -theorems (in vectorspace) add_ac =
   13.89 -  add_assoc add_commute add_left_commute
   13.90 -
   13.91 -
   13.92 -text {* The existence of the zero element of a vector space
   13.93 -  follows from the non-emptiness of carrier set. *}
   13.94 -
   13.95 -lemma (in vectorspace) zero [iff]: "0 \<in> V"
   13.96 -proof -
   13.97 -  from non_empty obtain x where x: "x \<in> V" by blast
   13.98 -  then have "0 = x - x" by (rule diff_self [symmetric])
   13.99 -  also from x x have "\<dots> \<in> V" by (rule diff_closed)
  13.100 -  finally show ?thesis .
  13.101 -qed
  13.102 -
  13.103 -lemma (in vectorspace) add_zero_right [simp]:
  13.104 -  "x \<in> V \<Longrightarrow>  x + 0 = x"
  13.105 -proof -
  13.106 -  assume x: "x \<in> V"
  13.107 -  from this and zero have "x + 0 = 0 + x" by (rule add_commute)
  13.108 -  also from x have "\<dots> = x" by (rule add_zero_left)
  13.109 -  finally show ?thesis .
  13.110 -qed
  13.111 -
  13.112 -lemma (in vectorspace) mult_assoc2:
  13.113 -    "x \<in> V \<Longrightarrow> a \<cdot> b \<cdot> x = (a * b) \<cdot> x"
  13.114 -  by (simp only: mult_assoc)
  13.115 -
  13.116 -lemma (in vectorspace) diff_mult_distrib1:
  13.117 -    "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> a \<cdot> (x - y) = a \<cdot> x - a \<cdot> y"
  13.118 -  by (simp add: diff_eq1 negate_eq1 add_mult_distrib1 mult_assoc2)
  13.119 -
  13.120 -lemma (in vectorspace) diff_mult_distrib2:
  13.121 -  "x \<in> V \<Longrightarrow> (a - b) \<cdot> x = a \<cdot> x - (b \<cdot> x)"
  13.122 -proof -
  13.123 -  assume x: "x \<in> V"
  13.124 -  have " (a - b) \<cdot> x = (a + - b) \<cdot> x"
  13.125 -    by (simp add: real_diff_def)
  13.126 -  also from x have "\<dots> = a \<cdot> x + (- b) \<cdot> x"
  13.127 -    by (rule add_mult_distrib2)
  13.128 -  also from x have "\<dots> = a \<cdot> x + - (b \<cdot> x)"
  13.129 -    by (simp add: negate_eq1 mult_assoc2)
  13.130 -  also from x have "\<dots> = a \<cdot> x - (b \<cdot> x)"
  13.131 -    by (simp add: diff_eq1)
  13.132 -  finally show ?thesis .
  13.133 -qed
  13.134 -
  13.135 -lemmas (in vectorspace) distrib =
  13.136 -  add_mult_distrib1 add_mult_distrib2
  13.137 -  diff_mult_distrib1 diff_mult_distrib2
  13.138 -
  13.139 -
  13.140 -text {* \medskip Further derived laws: *}
  13.141 -
  13.142 -lemma (in vectorspace) mult_zero_left [simp]:
  13.143 -  "x \<in> V \<Longrightarrow> 0 \<cdot> x = 0"
  13.144 -proof -
  13.145 -  assume x: "x \<in> V"
  13.146 -  have "0 \<cdot> x = (1 - 1) \<cdot> x" by simp
  13.147 -  also have "\<dots> = (1 + - 1) \<cdot> x" by simp
  13.148 -  also from x have "\<dots> =  1 \<cdot> x + (- 1) \<cdot> x"
  13.149 -    by (rule add_mult_distrib2)
  13.150 -  also from x have "\<dots> = x + (- 1) \<cdot> x" by simp
  13.151 -  also from x have "\<dots> = x + - x" by (simp add: negate_eq2a)
  13.152 -  also from x have "\<dots> = x - x" by (simp add: diff_eq2)
  13.153 -  also from x have "\<dots> = 0" by simp
  13.154 -  finally show ?thesis .
  13.155 -qed
  13.156 -
  13.157 -lemma (in vectorspace) mult_zero_right [simp]:
  13.158 -  "a \<cdot> 0 = (0::'a)"
  13.159 -proof -
  13.160 -  have "a \<cdot> 0 = a \<cdot> (0 - (0::'a))" by simp
  13.161 -  also have "\<dots> =  a \<cdot> 0 - a \<cdot> 0"
  13.162 -    by (rule diff_mult_distrib1) simp_all
  13.163 -  also have "\<dots> = 0" by simp
  13.164 -  finally show ?thesis .
  13.165 -qed
  13.166 -
  13.167 -lemma (in vectorspace) minus_mult_cancel [simp]:
  13.168 -    "x \<in> V \<Longrightarrow> (- a) \<cdot> - x = a \<cdot> x"
  13.169 -  by (simp add: negate_eq1 mult_assoc2)
  13.170 -
  13.171 -lemma (in vectorspace) add_minus_left_eq_diff:
  13.172 -  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> - x + y = y - x"
  13.173 -proof -
  13.174 -  assume xy: "x \<in> V"  "y \<in> V"
  13.175 -  then have "- x + y = y + - x" by (simp add: add_commute)
  13.176 -  also from xy have "\<dots> = y - x" by (simp add: diff_eq1)
  13.177 -  finally show ?thesis .
  13.178 -qed
  13.179 -
  13.180 -lemma (in vectorspace) add_minus [simp]:
  13.181 -    "x \<in> V \<Longrightarrow> x + - x = 0"
  13.182 -  by (simp add: diff_eq2)
  13.183 -
  13.184 -lemma (in vectorspace) add_minus_left [simp]:
  13.185 -    "x \<in> V \<Longrightarrow> - x + x = 0"
  13.186 -  by (simp add: diff_eq2 add_commute)
  13.187 -
  13.188 -lemma (in vectorspace) minus_minus [simp]:
  13.189 -    "x \<in> V \<Longrightarrow> - (- x) = x"
  13.190 -  by (simp add: negate_eq1 mult_assoc2)
  13.191 -
  13.192 -lemma (in vectorspace) minus_zero [simp]:
  13.193 -    "- (0::'a) = 0"
  13.194 -  by (simp add: negate_eq1)
  13.195 -
  13.196 -lemma (in vectorspace) minus_zero_iff [simp]:
  13.197 -  "x \<in> V \<Longrightarrow> (- x = 0) = (x = 0)"
  13.198 -proof
  13.199 -  assume x: "x \<in> V"
  13.200 -  {
  13.201 -    from x have "x = - (- x)" by (simp add: minus_minus)
  13.202 -    also assume "- x = 0"
  13.203 -    also have "- \<dots> = 0" by (rule minus_zero)
  13.204 -    finally show "x = 0" .
  13.205 -  next
  13.206 -    assume "x = 0"
  13.207 -    then show "- x = 0" by simp
  13.208 -  }
  13.209 -qed
  13.210 -
  13.211 -lemma (in vectorspace) add_minus_cancel [simp]:
  13.212 -    "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + (- x + y) = y"
  13.213 -  by (simp add: add_assoc [symmetric] del: add_commute)
  13.214 -
  13.215 -lemma (in vectorspace) minus_add_cancel [simp]:
  13.216 -    "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> - x + (x + y) = y"
  13.217 -  by (simp add: add_assoc [symmetric] del: add_commute)
  13.218 -
  13.219 -lemma (in vectorspace) minus_add_distrib [simp]:
  13.220 -    "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> - (x + y) = - x + - y"
  13.221 -  by (simp add: negate_eq1 add_mult_distrib1)
  13.222 -
  13.223 -lemma (in vectorspace) diff_zero [simp]:
  13.224 -    "x \<in> V \<Longrightarrow> x - 0 = x"
  13.225 -  by (simp add: diff_eq1)
  13.226 -
  13.227 -lemma (in vectorspace) diff_zero_right [simp]:
  13.228 -    "x \<in> V \<Longrightarrow> 0 - x = - x"
  13.229 -  by (simp add: diff_eq1)
  13.230 -
  13.231 -lemma (in vectorspace) add_left_cancel:
  13.232 -  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> (x + y = x + z) = (y = z)"
  13.233 -proof
  13.234 -  assume x: "x \<in> V" and y: "y \<in> V" and z: "z \<in> V"
  13.235 -  {
  13.236 -    from y have "y = 0 + y" by simp
  13.237 -    also from x y have "\<dots> = (- x + x) + y" by simp
  13.238 -    also from x y have "\<dots> = - x + (x + y)"
  13.239 -      by (simp add: add_assoc neg_closed)
  13.240 -    also assume "x + y = x + z"
  13.241 -    also from x z have "- x + (x + z) = - x + x + z"
  13.242 -      by (simp add: add_assoc [symmetric] neg_closed)
  13.243 -    also from x z have "\<dots> = z" by simp
  13.244 -    finally show "y = z" .
  13.245 -  next
  13.246 -    assume "y = z"
  13.247 -    then show "x + y = x + z" by (simp only:)
  13.248 -  }
  13.249 -qed
  13.250 -
  13.251 -lemma (in vectorspace) add_right_cancel:
  13.252 -    "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> (y + x = z + x) = (y = z)"
  13.253 -  by (simp only: add_commute add_left_cancel)
  13.254 -
  13.255 -lemma (in vectorspace) add_assoc_cong:
  13.256 -  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x' \<in> V \<Longrightarrow> y' \<in> V \<Longrightarrow> z \<in> V
  13.257 -    \<Longrightarrow> x + y = x' + y' \<Longrightarrow> x + (y + z) = x' + (y' + z)"
  13.258 -  by (simp only: add_assoc [symmetric])
  13.259 -
  13.260 -lemma (in vectorspace) mult_left_commute:
  13.261 -    "x \<in> V \<Longrightarrow> a \<cdot> b \<cdot> x = b \<cdot> a \<cdot> x"
  13.262 -  by (simp add: real_mult_commute mult_assoc2)
  13.263 -
  13.264 -lemma (in vectorspace) mult_zero_uniq:
  13.265 -  "x \<in> V \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> a \<cdot> x = 0 \<Longrightarrow> a = 0"
  13.266 -proof (rule classical)
  13.267 -  assume a: "a \<noteq> 0"
  13.268 -  assume x: "x \<in> V"  "x \<noteq> 0" and ax: "a \<cdot> x = 0"
  13.269 -  from x a have "x = (inverse a * a) \<cdot> x" by simp
  13.270 -  also from `x \<in> V` have "\<dots> = inverse a \<cdot> (a \<cdot> x)" by (rule mult_assoc)
  13.271 -  also from ax have "\<dots> = inverse a \<cdot> 0" by simp
  13.272 -  also have "\<dots> = 0" by simp
  13.273 -  finally have "x = 0" .
  13.274 -  with `x \<noteq> 0` show "a = 0" by contradiction
  13.275 -qed
  13.276 -
  13.277 -lemma (in vectorspace) mult_left_cancel:
  13.278 -  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> a \<noteq> 0 \<Longrightarrow> (a \<cdot> x = a \<cdot> y) = (x = y)"
  13.279 -proof
  13.280 -  assume x: "x \<in> V" and y: "y \<in> V" and a: "a \<noteq> 0"
  13.281 -  from x have "x = 1 \<cdot> x" by simp
  13.282 -  also from a have "\<dots> = (inverse a * a) \<cdot> x" by simp
  13.283 -  also from x have "\<dots> = inverse a \<cdot> (a \<cdot> x)"
  13.284 -    by (simp only: mult_assoc)
  13.285 -  also assume "a \<cdot> x = a \<cdot> y"
  13.286 -  also from a y have "inverse a \<cdot> \<dots> = y"
  13.287 -    by (simp add: mult_assoc2)
  13.288 -  finally show "x = y" .
  13.289 -next
  13.290 -  assume "x = y"
  13.291 -  then show "a \<cdot> x = a \<cdot> y" by (simp only:)
  13.292 -qed
  13.293 -
  13.294 -lemma (in vectorspace) mult_right_cancel:
  13.295 -  "x \<in> V \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> (a \<cdot> x = b \<cdot> x) = (a = b)"
  13.296 -proof
  13.297 -  assume x: "x \<in> V" and neq: "x \<noteq> 0"
  13.298 -  {
  13.299 -    from x have "(a - b) \<cdot> x = a \<cdot> x - b \<cdot> x"
  13.300 -      by (simp add: diff_mult_distrib2)
  13.301 -    also assume "a \<cdot> x = b \<cdot> x"
  13.302 -    with x have "a \<cdot> x - b \<cdot> x = 0" by simp
  13.303 -    finally have "(a - b) \<cdot> x = 0" .
  13.304 -    with x neq have "a - b = 0" by (rule mult_zero_uniq)
  13.305 -    then show "a = b" by simp
  13.306 -  next
  13.307 -    assume "a = b"
  13.308 -    then show "a \<cdot> x = b \<cdot> x" by (simp only:)
  13.309 -  }
  13.310 -qed
  13.311 -
  13.312 -lemma (in vectorspace) eq_diff_eq:
  13.313 -  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> (x = z - y) = (x + y = z)"
  13.314 -proof
  13.315 -  assume x: "x \<in> V" and y: "y \<in> V" and z: "z \<in> V"
  13.316 -  {
  13.317 -    assume "x = z - y"
  13.318 -    then have "x + y = z - y + y" by simp
  13.319 -    also from y z have "\<dots> = z + - y + y"
  13.320 -      by (simp add: diff_eq1)
  13.321 -    also have "\<dots> = z + (- y + y)"
  13.322 -      by (rule add_assoc) (simp_all add: y z)
  13.323 -    also from y z have "\<dots> = z + 0"
  13.324 -      by (simp only: add_minus_left)
  13.325 -    also from z have "\<dots> = z"
  13.326 -      by (simp only: add_zero_right)
  13.327 -    finally show "x + y = z" .
  13.328 -  next
  13.329 -    assume "x + y = z"
  13.330 -    then have "z - y = (x + y) - y" by simp
  13.331 -    also from x y have "\<dots> = x + y + - y"
  13.332 -      by (simp add: diff_eq1)
  13.333 -    also have "\<dots> = x + (y + - y)"
  13.334 -      by (rule add_assoc) (simp_all add: x y)
  13.335 -    also from x y have "\<dots> = x" by simp
  13.336 -    finally show "x = z - y" ..
  13.337 -  }
  13.338 -qed
  13.339 -
  13.340 -lemma (in vectorspace) add_minus_eq_minus:
  13.341 -  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + y = 0 \<Longrightarrow> x = - y"
  13.342 -proof -
  13.343 -  assume x: "x \<in> V" and y: "y \<in> V"
  13.344 -  from x y have "x = (- y + y) + x" by simp
  13.345 -  also from x y have "\<dots> = - y + (x + y)" by (simp add: add_ac)
  13.346 -  also assume "x + y = 0"
  13.347 -  also from y have "- y + 0 = - y" by simp
  13.348 -  finally show "x = - y" .
  13.349 -qed
  13.350 -
  13.351 -lemma (in vectorspace) add_minus_eq:
  13.352 -  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x - y = 0 \<Longrightarrow> x = y"
  13.353 -proof -
  13.354 -  assume x: "x \<in> V" and y: "y \<in> V"
  13.355 -  assume "x - y = 0"
  13.356 -  with x y have eq: "x + - y = 0" by (simp add: diff_eq1)
  13.357 -  with _ _ have "x = - (- y)"
  13.358 -    by (rule add_minus_eq_minus) (simp_all add: x y)
  13.359 -  with x y show "x = y" by simp
  13.360 -qed
  13.361 -
  13.362 -lemma (in vectorspace) add_diff_swap:
  13.363 -  "a \<in> V \<Longrightarrow> b \<in> V \<Longrightarrow> c \<in> V \<Longrightarrow> d \<in> V \<Longrightarrow> a + b = c + d
  13.364 -    \<Longrightarrow> a - c = d - b"
  13.365 -proof -
  13.366 -  assume vs: "a \<in> V"  "b \<in> V"  "c \<in> V"  "d \<in> V"
  13.367 -    and eq: "a + b = c + d"
  13.368 -  then have "- c + (a + b) = - c + (c + d)"
  13.369 -    by (simp add: add_left_cancel)
  13.370 -  also have "\<dots> = d" using `c \<in> V` `d \<in> V` by (rule minus_add_cancel)
  13.371 -  finally have eq: "- c + (a + b) = d" .
  13.372 -  from vs have "a - c = (- c + (a + b)) + - b"
  13.373 -    by (simp add: add_ac diff_eq1)
  13.374 -  also from vs eq have "\<dots>  = d + - b"
  13.375 -    by (simp add: add_right_cancel)
  13.376 -  also from vs have "\<dots> = d - b" by (simp add: diff_eq2)
  13.377 -  finally show "a - c = d - b" .
  13.378 -qed
  13.379 -
  13.380 -lemma (in vectorspace) vs_add_cancel_21:
  13.381 -  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> u \<in> V
  13.382 -    \<Longrightarrow> (x + (y + z) = y + u) = (x + z = u)"
  13.383 -proof
  13.384 -  assume vs: "x \<in> V"  "y \<in> V"  "z \<in> V"  "u \<in> V"
  13.385 -  {
  13.386 -    from vs have "x + z = - y + y + (x + z)" by simp
  13.387 -    also have "\<dots> = - y + (y + (x + z))"
  13.388 -      by (rule add_assoc) (simp_all add: vs)
  13.389 -    also from vs have "y + (x + z) = x + (y + z)"
  13.390 -      by (simp add: add_ac)
  13.391 -    also assume "x + (y + z) = y + u"
  13.392 -    also from vs have "- y + (y + u) = u" by simp
  13.393 -    finally show "x + z = u" .
  13.394 -  next
  13.395 -    assume "x + z = u"
  13.396 -    with vs show "x + (y + z) = y + u"
  13.397 -      by (simp only: add_left_commute [of x])
  13.398 -  }
  13.399 -qed
  13.400 -
  13.401 -lemma (in vectorspace) add_cancel_end:
  13.402 -  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> (x + (y + z) = y) = (x = - z)"
  13.403 -proof
  13.404 -  assume vs: "x \<in> V"  "y \<in> V"  "z \<in> V"
  13.405 -  {
  13.406 -    assume "x + (y + z) = y"
  13.407 -    with vs have "(x + z) + y = 0 + y"
  13.408 -      by (simp add: add_ac)
  13.409 -    with vs have "x + z = 0"
  13.410 -      by (simp only: add_right_cancel add_closed zero)
  13.411 -    with vs show "x = - z" by (simp add: add_minus_eq_minus)
  13.412 -  next
  13.413 -    assume eq: "x = - z"
  13.414 -    then have "x + (y + z) = - z + (y + z)" by simp
  13.415 -    also have "\<dots> = y + (- z + z)"
  13.416 -      by (rule add_left_commute) (simp_all add: vs)
  13.417 -    also from vs have "\<dots> = y"  by simp
  13.418 -    finally show "x + (y + z) = y" .
  13.419 -  }
  13.420 -qed
  13.421 -
  13.422 -end
    14.1 --- a/src/HOL/HahnBanach/ZornLemma.thy	Wed Jun 24 21:28:02 2009 +0200
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,57 +0,0 @@
    14.4 -(*  Title:      HOL/Real/HahnBanach/ZornLemma.thy
    14.5 -    Author:     Gertrud Bauer, TU Munich
    14.6 -*)
    14.7 -
    14.8 -header {* Zorn's Lemma *}
    14.9 -
   14.10 -theory ZornLemma
   14.11 -imports Zorn
   14.12 -begin
   14.13 -
   14.14 -text {*
   14.15 -  Zorn's Lemmas states: if every linear ordered subset of an ordered
   14.16 -  set @{text S} has an upper bound in @{text S}, then there exists a
   14.17 -  maximal element in @{text S}.  In our application, @{text S} is a
   14.18 -  set of sets ordered by set inclusion. Since the union of a chain of
   14.19 -  sets is an upper bound for all elements of the chain, the conditions
   14.20 -  of Zorn's lemma can be modified: if @{text S} is non-empty, it
   14.21 -  suffices to show that for every non-empty chain @{text c} in @{text
   14.22 -  S} the union of @{text c} also lies in @{text S}.
   14.23 -*}
   14.24 -
   14.25 -theorem Zorn's_Lemma:
   14.26 -  assumes r: "\<And>c. c \<in> chain S \<Longrightarrow> \<exists>x. x \<in> c \<Longrightarrow> \<Union>c \<in> S"
   14.27 -    and aS: "a \<in> S"
   14.28 -  shows "\<exists>y \<in> S. \<forall>z \<in> S. y \<subseteq> z \<longrightarrow> y = z"
   14.29 -proof (rule Zorn_Lemma2)
   14.30 -  show "\<forall>c \<in> chain S. \<exists>y \<in> S. \<forall>z \<in> c. z \<subseteq> y"
   14.31 -  proof
   14.32 -    fix c assume "c \<in> chain S"
   14.33 -    show "\<exists>y \<in> S. \<forall>z \<in> c. z \<subseteq> y"
   14.34 -    proof cases
   14.35 -
   14.36 -      txt {* If @{text c} is an empty chain, then every element in
   14.37 -	@{text S} is an upper bound of @{text c}. *}
   14.38 -
   14.39 -      assume "c = {}"
   14.40 -      with aS show ?thesis by fast
   14.41 -
   14.42 -      txt {* If @{text c} is non-empty, then @{text "\<Union>c"} is an upper
   14.43 -	bound of @{text c}, lying in @{text S}. *}
   14.44 -
   14.45 -    next
   14.46 -      assume "c \<noteq> {}"
   14.47 -      show ?thesis
   14.48 -      proof
   14.49 -        show "\<forall>z \<in> c. z \<subseteq> \<Union>c" by fast
   14.50 -        show "\<Union>c \<in> S"
   14.51 -        proof (rule r)
   14.52 -          from `c \<noteq> {}` show "\<exists>x. x \<in> c" by fast
   14.53 -	  show "c \<in> chain S" by fact
   14.54 -        qed
   14.55 -      qed
   14.56 -    qed
   14.57 -  qed
   14.58 -qed
   14.59 -
   14.60 -end
    15.1 --- a/src/HOL/HahnBanach/document/root.bib	Wed Jun 24 21:28:02 2009 +0200
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,27 +0,0 @@
    15.4 -
    15.5 -@Book{Heuser:1986,
    15.6 -  author = 	 {H. Heuser},
    15.7 -  title = 	 {Funktionalanalysis: Theorie und Anwendung},
    15.8 -  publisher = 	 {Teubner},
    15.9 -  year = 	 1986
   15.10 -}
   15.11 -
   15.12 -@InCollection{Narici:1996,
   15.13 -  author = 	 {L. Narici and E. Beckenstein},
   15.14 -  title = 	 {The {Hahn-Banach Theorem}: The Life and Times},
   15.15 -  booktitle = 	 {Topology Atlas},
   15.16 -  publisher =	 {York University, Toronto, Ontario, Canada},
   15.17 -  year =	 1996,
   15.18 -  note =	 {\url{http://at.yorku.ca/topology/preprint.htm} and
   15.19 -                  \url{http://at.yorku.ca/p/a/a/a/16.htm}}
   15.20 -}
   15.21 -
   15.22 -@Article{Nowak:1993,
   15.23 -  author =       {B. Nowak and A. Trybulec},
   15.24 -  title =	 {{Hahn-Banach} Theorem},
   15.25 -  journal =      {Journal of Formalized Mathematics},
   15.26 -  year =         {1993},
   15.27 -  volume =       {5},
   15.28 -  institution =  {University of Bialystok},
   15.29 -  note =         {\url{http://mizar.uwb.edu.pl/JFM/Vol5/hahnban.html}}
   15.30 -}
    16.1 --- a/src/HOL/HahnBanach/document/root.tex	Wed Jun 24 21:28:02 2009 +0200
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,83 +0,0 @@
    16.4 -\documentclass[10pt,a4paper,twoside]{article}
    16.5 -\usepackage{graphicx}
    16.6 -\usepackage{latexsym,theorem}
    16.7 -\usepackage{isabelle,isabellesym}
    16.8 -\usepackage{pdfsetup} %last one!
    16.9 -
   16.10 -\isabellestyle{it}
   16.11 -\urlstyle{rm}
   16.12 -
   16.13 -\newcommand{\isasymsup}{\isamath{\sup\,}}
   16.14 -\newcommand{\skp}{\smallskip}
   16.15 -
   16.16 -
   16.17 -\begin{document}
   16.18 -
   16.19 -\pagestyle{headings}
   16.20 -\pagenumbering{arabic}
   16.21 -
   16.22 -\title{The Hahn-Banach Theorem \\ for Real Vector Spaces}
   16.23 -\author{Gertrud Bauer \\ \url{http://www.in.tum.de/~bauerg/}}
   16.24 -\maketitle
   16.25 -
   16.26 -\begin{abstract}
   16.27 -  The Hahn-Banach Theorem is one of the most fundamental results in functional
   16.28 -  analysis. We present a fully formal proof of two versions of the theorem,
   16.29 -  one for general linear spaces and another for normed spaces.  This
   16.30 -  development is based on simply-typed classical set-theory, as provided by
   16.31 -  Isabelle/HOL.
   16.32 -\end{abstract}
   16.33 -
   16.34 -
   16.35 -\tableofcontents
   16.36 -\parindent 0pt \parskip 0.5ex
   16.37 -
   16.38 -\clearpage
   16.39 -\section{Preface}
   16.40 -
   16.41 -This is a fully formal proof of the Hahn-Banach Theorem. It closely follows
   16.42 -the informal presentation given in Heuser's textbook \cite[{\S} 36]{Heuser:1986}.
   16.43 -Another formal proof of the same theorem has been done in Mizar
   16.44 -\cite{Nowak:1993}.  A general overview of the relevance and history of the
   16.45 -Hahn-Banach Theorem is given by Narici and Beckenstein \cite{Narici:1996}.
   16.46 -
   16.47 -\medskip The document is structured as follows.  The first part contains
   16.48 -definitions of basic notions of linear algebra: vector spaces, subspaces,
   16.49 -normed spaces, continuous linear-forms, norm of functions and an order on
   16.50 -functions by domain extension.  The second part contains some lemmas about the
   16.51 -supremum (w.r.t.\ the function order) and extension of non-maximal functions.
   16.52 -With these preliminaries, the main proof of the theorem (in its two versions)
   16.53 -is conducted in the third part.  The dependencies of individual theories are
   16.54 -as follows.
   16.55 -
   16.56 -\begin{center}
   16.57 -  \includegraphics[scale=0.5]{session_graph}  
   16.58 -\end{center}
   16.59 -
   16.60 -\clearpage
   16.61 -\part {Basic Notions}
   16.62 -
   16.63 -\input{Bounds}
   16.64 -\input{VectorSpace}
   16.65 -\input{Subspace}
   16.66 -\input{NormedSpace}
   16.67 -\input{Linearform}
   16.68 -\input{FunctionOrder}
   16.69 -\input{FunctionNorm}
   16.70 -\input{ZornLemma}
   16.71 -
   16.72 -\clearpage
   16.73 -\part {Lemmas for the Proof}
   16.74 -
   16.75 -\input{HahnBanachSupLemmas}
   16.76 -\input{HahnBanachExtLemmas}
   16.77 -\input{HahnBanachLemmas}
   16.78 -
   16.79 -\clearpage
   16.80 -\part {The Main Proof}
   16.81 -
   16.82 -\input{HahnBanach}
   16.83 -\bibliographystyle{abbrv}
   16.84 -\bibliography{root}
   16.85 -
   16.86 -\end{document}
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/src/HOL/Hahn_Banach/Bounds.thy	Wed Jun 24 21:46:54 2009 +0200
    17.3 @@ -0,0 +1,82 @@
    17.4 +(*  Title:      HOL/Hahn_Banach/Bounds.thy
    17.5 +    Author:     Gertrud Bauer, TU Munich
    17.6 +*)
    17.7 +
    17.8 +header {* Bounds *}
    17.9 +
   17.10 +theory Bounds
   17.11 +imports Main ContNotDenum
   17.12 +begin
   17.13 +
   17.14 +locale lub =
   17.15 +  fixes A and x
   17.16 +  assumes least [intro?]: "(\<And>a. a \<in> A \<Longrightarrow> a \<le> b) \<Longrightarrow> x \<le> b"
   17.17 +    and upper [intro?]: "a \<in> A \<Longrightarrow> a \<le> x"
   17.18 +
   17.19 +lemmas [elim?] = lub.least lub.upper
   17.20 +
   17.21 +definition
   17.22 +  the_lub :: "'a::order set \<Rightarrow> 'a" where
   17.23 +  "the_lub A = The (lub A)"
   17.24 +
   17.25 +notation (xsymbols)
   17.26 +  the_lub  ("\<Squnion>_" [90] 90)
   17.27 +
   17.28 +lemma the_lub_equality [elim?]:
   17.29 +  assumes "lub A x"
   17.30 +  shows "\<Squnion>A = (x::'a::order)"
   17.31 +proof -
   17.32 +  interpret lub A x by fact
   17.33 +  show ?thesis
   17.34 +  proof (unfold the_lub_def)
   17.35 +    from `lub A x` show "The (lub A) = x"
   17.36 +    proof
   17.37 +      fix x' assume lub': "lub A x'"
   17.38 +      show "x' = x"
   17.39 +      proof (rule order_antisym)
   17.40 +	from lub' show "x' \<le> x"
   17.41 +	proof
   17.42 +          fix a assume "a \<in> A"
   17.43 +          then show "a \<le> x" ..
   17.44 +	qed
   17.45 +	show "x \<le> x'"
   17.46 +	proof
   17.47 +          fix a assume "a \<in> A"
   17.48 +          with lub' show "a \<le> x'" ..
   17.49 +	qed
   17.50 +      qed
   17.51 +    qed
   17.52 +  qed
   17.53 +qed
   17.54 +
   17.55 +lemma the_lubI_ex:
   17.56 +  assumes ex: "\<exists>x. lub A x"
   17.57 +  shows "lub A (\<Squnion>A)"
   17.58 +proof -
   17.59 +  from ex obtain x where x: "lub A x" ..
   17.60 +  also from x have [symmetric]: "\<Squnion>A = x" ..
   17.61 +  finally show ?thesis .
   17.62 +qed
   17.63 +
   17.64 +lemma lub_compat: "lub A x = isLub UNIV A x"
   17.65 +proof -
   17.66 +  have "isUb UNIV A = (\<lambda>x. A *<= x \<and> x \<in> UNIV)"
   17.67 +    by (rule ext) (simp only: isUb_def)
   17.68 +  then show ?thesis
   17.69 +    by (simp only: lub_def isLub_def leastP_def setge_def setle_def) blast
   17.70 +qed
   17.71 +
   17.72 +lemma real_complete:
   17.73 +  fixes A :: "real set"
   17.74 +  assumes nonempty: "\<exists>a. a \<in> A"
   17.75 +    and ex_upper: "\<exists>y. \<forall>a \<in> A. a \<le> y"
   17.76 +  shows "\<exists>x. lub A x"
   17.77 +proof -
   17.78 +  from ex_upper have "\<exists>y. isUb UNIV A y"
   17.79 +    unfolding isUb_def setle_def by blast
   17.80 +  with nonempty have "\<exists>x. isLub UNIV A x"
   17.81 +    by (rule reals_complete)
   17.82 +  then show ?thesis by (simp only: lub_compat)
   17.83 +qed
   17.84 +
   17.85 +end
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/src/HOL/Hahn_Banach/Function_Norm.thy	Wed Jun 24 21:46:54 2009 +0200
    18.3 @@ -0,0 +1,278 @@
    18.4 +(*  Title:      HOL/Hahn_Banach/Function_Norm.thy
    18.5 +    Author:     Gertrud Bauer, TU Munich
    18.6 +*)
    18.7 +
    18.8 +header {* The norm of a function *}
    18.9 +
   18.10 +theory Function_Norm
   18.11 +imports Normed_Space Function_Order
   18.12 +begin
   18.13 +
   18.14 +subsection {* Continuous linear forms*}
   18.15 +
   18.16 +text {*
   18.17 +  A linear form @{text f} on a normed vector space @{text "(V, \<parallel>\<cdot>\<parallel>)"}
   18.18 +  is \emph{continuous}, iff it is bounded, i.e.
   18.19 +  \begin{center}
   18.20 +  @{text "\<exists>c \<in> R. \<forall>x \<in> V. \<bar>f x\<bar> \<le> c \<cdot> \<parallel>x\<parallel>"}
   18.21 +  \end{center}
   18.22 +  In our application no other functions than linear forms are
   18.23 +  considered, so we can define continuous linear forms as bounded
   18.24 +  linear forms:
   18.25 +*}
   18.26 +
   18.27 +locale continuous = var_V + norm_syntax + linearform +
   18.28 +  assumes bounded: "\<exists>c. \<forall>x \<in> V. \<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>"
   18.29 +
   18.30 +declare continuous.intro [intro?] continuous_axioms.intro [intro?]
   18.31 +
   18.32 +lemma continuousI [intro]:
   18.33 +  fixes norm :: "_ \<Rightarrow> real"  ("\<parallel>_\<parallel>")
   18.34 +  assumes "linearform V f"
   18.35 +  assumes r: "\<And>x. x \<in> V \<Longrightarrow> \<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>"
   18.36 +  shows "continuous V norm f"
   18.37 +proof
   18.38 +  show "linearform V f" by fact
   18.39 +  from r have "\<exists>c. \<forall>x\<in>V. \<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>" by blast
   18.40 +  then show "continuous_axioms V norm f" ..
   18.41 +qed
   18.42 +
   18.43 +
   18.44 +subsection {* The norm of a linear form *}
   18.45 +
   18.46 +text {*
   18.47 +  The least real number @{text c} for which holds
   18.48 +  \begin{center}
   18.49 +  @{text "\<forall>x \<in> V. \<bar>f x\<bar> \<le> c \<cdot> \<parallel>x\<parallel>"}
   18.50 +  \end{center}
   18.51 +  is called the \emph{norm} of @{text f}.
   18.52 +
   18.53 +  For non-trivial vector spaces @{text "V \<noteq> {0}"} the norm can be
   18.54 +  defined as
   18.55 +  \begin{center}
   18.56 +  @{text "\<parallel>f\<parallel> = \<sup>x \<noteq> 0. \<bar>f x\<bar> / \<parallel>x\<parallel>"}
   18.57 +  \end{center}
   18.58 +
   18.59 +  For the case @{text "V = {0}"} the supremum would be taken from an
   18.60 +  empty set. Since @{text \<real>} is unbounded, there would be no supremum.
   18.61 +  To avoid this situation it must be guaranteed that there is an
   18.62 +  element in this set. This element must be @{text "{} \<ge> 0"} so that
   18.63 +  @{text fn_norm} has the norm properties. Furthermore it does not
   18.64 +  have to change the norm in all other cases, so it must be @{text 0},
   18.65 +  as all other elements are @{text "{} \<ge> 0"}.
   18.66 +
   18.67 +  Thus we define the set @{text B} where the supremum is taken from as
   18.68 +  follows:
   18.69 +  \begin{center}
   18.70 +  @{text "{0} \<union> {\<bar>f x\<bar> / \<parallel>x\<parallel>. x \<noteq> 0 \<and> x \<in> F}"}
   18.71 +  \end{center}
   18.72 +
   18.73 +  @{text fn_norm} is equal to the supremum of @{text B}, if the
   18.74 +  supremum exists (otherwise it is undefined).
   18.75 +*}
   18.76 +
   18.77 +locale fn_norm = norm_syntax +
   18.78 +  fixes B defines "B V f \<equiv> {0} \<union> {\<bar>f x\<bar> / \<parallel>x\<parallel> | x. x \<noteq> 0 \<and> x \<in> V}"
   18.79 +  fixes fn_norm ("\<parallel>_\<parallel>\<hyphen>_" [0, 1000] 999)
   18.80 +  defines "\<parallel>f\<parallel>\<hyphen>V \<equiv> \<Squnion>(B V f)"
   18.81 +
   18.82 +locale normed_vectorspace_with_fn_norm = normed_vectorspace + fn_norm
   18.83 +
   18.84 +lemma (in fn_norm) B_not_empty [intro]: "0 \<in> B V f"
   18.85 +  by (simp add: B_def)
   18.86 +
   18.87 +text {*
   18.88 +  The following lemma states that every continuous linear form on a
   18.89 +  normed space @{text "(V, \<parallel>\<cdot>\<parallel>)"} has a function norm.
   18.90 +*}
   18.91 +
   18.92 +lemma (in normed_vectorspace_with_fn_norm) fn_norm_works:
   18.93 +  assumes "continuous V norm f"
   18.94 +  shows "lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)"
   18.95 +proof -
   18.96 +  interpret continuous V norm f by fact
   18.97 +  txt {* The existence of the supremum is shown using the
   18.98 +    completeness of the reals. Completeness means, that every
   18.99 +    non-empty bounded set of reals has a supremum. *}
  18.100 +  have "\<exists>a. lub (B V f) a"
  18.101 +  proof (rule real_complete)
  18.102 +    txt {* First we have to show that @{text B} is non-empty: *}
  18.103 +    have "0 \<in> B V f" ..
  18.104 +    then show "\<exists>x. x \<in> B V f" ..
  18.105 +
  18.106 +    txt {* Then we have to show that @{text B} is bounded: *}
  18.107 +    show "\<exists>c. \<forall>y \<in> B V f. y \<le> c"
  18.108 +    proof -
  18.109 +      txt {* We know that @{text f} is bounded by some value @{text c}. *}
  18.110 +      from bounded obtain c where c: "\<forall>x \<in> V. \<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>" ..
  18.111 +
  18.112 +      txt {* To prove the thesis, we have to show that there is some
  18.113 +        @{text b}, such that @{text "y \<le> b"} for all @{text "y \<in>
  18.114 +        B"}. Due to the definition of @{text B} there are two cases. *}
  18.115 +
  18.116 +      def b \<equiv> "max c 0"
  18.117 +      have "\<forall>y \<in> B V f. y \<le> b"
  18.118 +      proof
  18.119 +        fix y assume y: "y \<in> B V f"
  18.120 +        show "y \<le> b"
  18.121 +        proof cases
  18.122 +          assume "y = 0"
  18.123 +          then show ?thesis unfolding b_def by arith
  18.124 +        next
  18.125 +          txt {* The second case is @{text "y = \<bar>f x\<bar> / \<parallel>x\<parallel>"} for some
  18.126 +            @{text "x \<in> V"} with @{text "x \<noteq> 0"}. *}
  18.127 +          assume "y \<noteq> 0"
  18.128 +          with y obtain x where y_rep: "y = \<bar>f x\<bar> * inverse \<parallel>x\<parallel>"
  18.129 +              and x: "x \<in> V" and neq: "x \<noteq> 0"
  18.130 +            by (auto simp add: B_def real_divide_def)
  18.131 +          from x neq have gt: "0 < \<parallel>x\<parallel>" ..
  18.132 +
  18.133 +          txt {* The thesis follows by a short calculation using the
  18.134 +            fact that @{text f} is bounded. *}
  18.135 +
  18.136 +          note y_rep
  18.137 +          also have "\<bar>f x\<bar> * inverse \<parallel>x\<parallel> \<le> (c * \<parallel>x\<parallel>) * inverse \<parallel>x\<parallel>"
  18.138 +          proof (rule mult_right_mono)
  18.139 +            from c x show "\<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>" ..
  18.140 +            from gt have "0 < inverse \<parallel>x\<parallel>" 
  18.141 +              by (rule positive_imp_inverse_positive)
  18.142 +            then show "0 \<le> inverse \<parallel>x\<parallel>" by (rule order_less_imp_le)
  18.143 +          qed
  18.144 +          also have "\<dots> = c * (\<parallel>x\<parallel> * inverse \<parallel>x\<parallel>)"
  18.145 +            by (rule real_mult_assoc)
  18.146 +          also
  18.147 +          from gt have "\<parallel>x\<parallel> \<noteq> 0" by simp
  18.148 +          then have "\<parallel>x\<parallel> * inverse \<parallel>x\<parallel> = 1" by simp 
  18.149 +          also have "c * 1 \<le> b" by (simp add: b_def le_maxI1)
  18.150 +          finally show "y \<le> b" .
  18.151 +        qed
  18.152 +      qed
  18.153 +      then show ?thesis ..
  18.154 +    qed
  18.155 +  qed
  18.156 +  then show ?thesis unfolding fn_norm_def by (rule the_lubI_ex)
  18.157 +qed
  18.158 +
  18.159 +lemma (in normed_vectorspace_with_fn_norm) fn_norm_ub [iff?]:
  18.160 +  assumes "continuous V norm f"
  18.161 +  assumes b: "b \<in> B V f"
  18.162 +  shows "b \<le> \<parallel>f\<parallel>\<hyphen>V"
  18.163 +proof -
  18.164 +  interpret continuous V norm f by fact
  18.165 +  have "lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)"
  18.166 +    using `continuous V norm f` by (rule fn_norm_works)
  18.167 +  from this and b show ?thesis ..
  18.168 +qed
  18.169 +
  18.170 +lemma (in normed_vectorspace_with_fn_norm) fn_norm_leastB:
  18.171 +  assumes "continuous V norm f"
  18.172 +  assumes b: "\<And>b. b \<in> B V f \<Longrightarrow> b \<le> y"
  18.173 +  shows "\<parallel>f\<parallel>\<hyphen>V \<le> y"
  18.174 +proof -
  18.175 +  interpret continuous V norm f by fact
  18.176 +  have "lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)"
  18.177 +    using `continuous V norm f` by (rule fn_norm_works)
  18.178 +  from this and b show ?thesis ..
  18.179 +qed
  18.180 +
  18.181 +text {* The norm of a continuous function is always @{text "\<ge> 0"}. *}
  18.182 +
  18.183 +lemma (in normed_vectorspace_with_fn_norm) fn_norm_ge_zero [iff]:
  18.184 +  assumes "continuous V norm f"
  18.185 +  shows "0 \<le> \<parallel>f\<parallel>\<hyphen>V"
  18.186 +proof -
  18.187 +  interpret continuous V norm f by fact
  18.188 +  txt {* The function norm is defined as the supremum of @{text B}.
  18.189 +    So it is @{text "\<ge> 0"} if all elements in @{text B} are @{text "\<ge>
  18.190 +    0"}, provided the supremum exists and @{text B} is not empty. *}
  18.191 +  have "lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)"
  18.192 +    using `continuous V norm f` by (rule fn_norm_works)
  18.193 +  moreover have "0 \<in> B V f" ..
  18.194 +  ultimately show ?thesis ..
  18.195 +qed
  18.196 +
  18.197 +text {*
  18.198 +  \medskip The fundamental property of function norms is:
  18.199 +  \begin{center}
  18.200 +  @{text "\<bar>f x\<bar> \<le> \<parallel>f\<parallel> \<cdot> \<parallel>x\<parallel>"}
  18.201 +  \end{center}
  18.202 +*}
  18.203 +
  18.204 +lemma (in normed_vectorspace_with_fn_norm) fn_norm_le_cong:
  18.205 +  assumes "continuous V norm f" "linearform V f"
  18.206 +  assumes x: "x \<in> V"
  18.207 +  shows "\<bar>f x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>V * \<parallel>x\<parallel>"
  18.208 +proof -
  18.209 +  interpret continuous V norm f by fact
  18.210 +  interpret linearform V f by fact
  18.211 +  show ?thesis
  18.212 +  proof cases
  18.213 +    assume "x = 0"
  18.214 +    then have "\<bar>f x\<bar> = \<bar>f 0\<bar>" by simp
  18.215 +    also have "f 0 = 0" by rule unfold_locales
  18.216 +    also have "\<bar>\<dots>\<bar> = 0" by simp
  18.217 +    also have a: "0 \<le> \<parallel>f\<parallel>\<hyphen>V"
  18.218 +      using `continuous V norm f` by (rule fn_norm_ge_zero)
  18.219 +    from x have "0 \<le> norm x" ..
  18.220 +    with a have "0 \<le> \<parallel>f\<parallel>\<hyphen>V * \<parallel>x\<parallel>" by (simp add: zero_le_mult_iff)
  18.221 +    finally show "\<bar>f x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>V * \<parallel>x\<parallel>" .
  18.222 +  next
  18.223 +    assume "x \<noteq> 0"
  18.224 +    with x have neq: "\<parallel>x\<parallel> \<noteq> 0" by simp
  18.225 +    then have "\<bar>f x\<bar> = (\<bar>f x\<bar> * inverse \<parallel>x\<parallel>) * \<parallel>x\<parallel>" by simp
  18.226 +    also have "\<dots> \<le>  \<parallel>f\<parallel>\<hyphen>V * \<parallel>x\<parallel>"
  18.227 +    proof (rule mult_right_mono)
  18.228 +      from x show "0 \<le> \<parallel>x\<parallel>" ..
  18.229 +      from x and neq have "\<bar>f x\<bar> * inverse \<parallel>x\<parallel> \<in> B V f"
  18.230 +	by (auto simp add: B_def real_divide_def)
  18.231 +      with `continuous V norm f` show "\<bar>f x\<bar> * inverse \<parallel>x\<parallel> \<le> \<parallel>f\<parallel>\<hyphen>V"
  18.232 +	by (rule fn_norm_ub)
  18.233 +    qed
  18.234 +    finally show ?thesis .
  18.235 +  qed
  18.236 +qed
  18.237 +
  18.238 +text {*
  18.239 +  \medskip The function norm is the least positive real number for
  18.240 +  which the following inequation holds:
  18.241 +  \begin{center}
  18.242 +    @{text "\<bar>f x\<bar> \<le> c \<cdot> \<parallel>x\<parallel>"}
  18.243 +  \end{center}
  18.244 +*}
  18.245 +
  18.246 +lemma (in normed_vectorspace_with_fn_norm) fn_norm_least [intro?]:
  18.247 +  assumes "continuous V norm f"
  18.248 +  assumes ineq: "\<forall>x \<in> V. \<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>" and ge: "0 \<le> c"
  18.249 +  shows "\<parallel>f\<parallel>\<hyphen>V \<le> c"
  18.250 +proof -
  18.251 +  interpret continuous V norm f by fact
  18.252 +  show ?thesis
  18.253 +  proof (rule fn_norm_leastB [folded B_def fn_norm_def])
  18.254 +    fix b assume b: "b \<in> B V f"
  18.255 +    show "b \<le> c"
  18.256 +    proof cases
  18.257 +      assume "b = 0"
  18.258 +      with ge show ?thesis by simp
  18.259 +    next
  18.260 +      assume "b \<noteq> 0"
  18.261 +      with b obtain x where b_rep: "b = \<bar>f x\<bar> * inverse \<parallel>x\<parallel>"
  18.262 +        and x_neq: "x \<noteq> 0" and x: "x \<in> V"
  18.263 +	by (auto simp add: B_def real_divide_def)
  18.264 +      note b_rep
  18.265 +      also have "\<bar>f x\<bar> * inverse \<parallel>x\<parallel> \<le> (c * \<parallel>x\<parallel>) * inverse \<parallel>x\<parallel>"
  18.266 +      proof (rule mult_right_mono)
  18.267 +	have "0 < \<parallel>x\<parallel>" using x x_neq ..
  18.268 +	then show "0 \<le> inverse \<parallel>x\<parallel>" by simp
  18.269 +	from ineq and x show "\<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>" ..
  18.270 +      qed
  18.271 +      also have "\<dots> = c"
  18.272 +      proof -
  18.273 +	from x_neq and x have "\<parallel>x\<parallel> \<noteq> 0" by simp
  18.274 +	then show ?thesis by simp
  18.275 +      qed
  18.276 +      finally show ?thesis .
  18.277 +    qed
  18.278 +  qed (insert `continuous V norm f`, simp_all add: continuous_def)
  18.279 +qed
  18.280 +
  18.281 +end
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/src/HOL/Hahn_Banach/Function_Order.thy	Wed Jun 24 21:46:54 2009 +0200
    19.3 @@ -0,0 +1,141 @@
    19.4 +(*  Title:      HOL/Hahn_Banach/Function_Order.thy
    19.5 +    Author:     Gertrud Bauer, TU Munich
    19.6 +*)
    19.7 +
    19.8 +header {* An order on functions *}
    19.9 +
   19.10 +theory Function_Order
   19.11 +imports Subspace Linearform
   19.12 +begin
   19.13 +
   19.14 +subsection {* The graph of a function *}
   19.15 +
   19.16 +text {*
   19.17 +  We define the \emph{graph} of a (real) function @{text f} with
   19.18 +  domain @{text F} as the set
   19.19 +  \begin{center}
   19.20 +  @{text "{(x, f x). x \<in> F}"}
   19.21 +  \end{center}
   19.22 +  So we are modeling partial functions by specifying the domain and
   19.23 +  the mapping function. We use the term ``function'' also for its
   19.24 +  graph.
   19.25 +*}
   19.26 +
   19.27 +types 'a graph = "('a \<times> real) set"
   19.28 +
   19.29 +definition
   19.30 +  graph :: "'a set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> 'a graph" where
   19.31 +  "graph F f = {(x, f x) | x. x \<in> F}"
   19.32 +
   19.33 +lemma graphI [intro]: "x \<in> F \<Longrightarrow> (x, f x) \<in> graph F f"
   19.34 +  unfolding graph_def by blast
   19.35 +
   19.36 +lemma graphI2 [intro?]: "x \<in> F \<Longrightarrow> \<exists>t \<in> graph F f. t = (x, f x)"
   19.37 +  unfolding graph_def by blast
   19.38 +
   19.39 +lemma graphE [elim?]:
   19.40 +    "(x, y) \<in> graph F f \<Longrightarrow> (x \<in> F \<Longrightarrow> y = f x \<Longrightarrow> C) \<Longrightarrow> C"
   19.41 +  unfolding graph_def by blast
   19.42 +
   19.43 +
   19.44 +subsection {* Functions ordered by domain extension *}
   19.45 +
   19.46 +text {*
   19.47 +  A function @{text h'} is an extension of @{text h}, iff the graph of
   19.48 +  @{text h} is a subset of the graph of @{text h'}.
   19.49 +*}
   19.50 +
   19.51 +lemma graph_extI:
   19.52 +  "(\<And>x. x \<in> H \<Longrightarrow> h x = h' x) \<Longrightarrow> H \<subseteq> H'
   19.53 +    \<Longrightarrow> graph H h \<subseteq> graph H' h'"
   19.54 +  unfolding graph_def by blast
   19.55 +
   19.56 +lemma graph_extD1 [dest?]:
   19.57 +  "graph H h \<subseteq> graph H' h' \<Longrightarrow> x \<in> H \<Longrightarrow> h x = h' x"
   19.58 +  unfolding graph_def by blast
   19.59 +
   19.60 +lemma graph_extD2 [dest?]:
   19.61 +  "graph H h \<subseteq> graph H' h' \<Longrightarrow> H \<subseteq> H'"
   19.62 +  unfolding graph_def by blast
   19.63 +
   19.64 +
   19.65 +subsection {* Domain and function of a graph *}
   19.66 +
   19.67 +text {*
   19.68 +  The inverse functions to @{text graph} are @{text domain} and @{text
   19.69 +  funct}.
   19.70 +*}
   19.71 +
   19.72 +definition
   19.73 +  "domain" :: "'a graph \<Rightarrow> 'a set" where
   19.74 +  "domain g = {x. \<exists>y. (x, y) \<in> g}"
   19.75 +
   19.76 +definition
   19.77 +  funct :: "'a graph \<Rightarrow> ('a \<Rightarrow> real)" where
   19.78 +  "funct g = (\<lambda>x. (SOME y. (x, y) \<in> g))"
   19.79 +
   19.80 +text {*
   19.81 +  The following lemma states that @{text g} is the graph of a function
   19.82 +  if the relation induced by @{text g} is unique.
   19.83 +*}
   19.84 +
   19.85 +lemma graph_domain_funct:
   19.86 +  assumes uniq: "\<And>x y z. (x, y) \<in> g \<Longrightarrow> (x, z) \<in> g \<Longrightarrow> z = y"
   19.87 +  shows "graph (domain g) (funct g) = g"
   19.88 +  unfolding domain_def funct_def graph_def
   19.89 +proof auto  (* FIXME !? *)
   19.90 +  fix a b assume g: "(a, b) \<in> g"
   19.91 +  from g show "(a, SOME y. (a, y) \<in> g) \<in> g" by (rule someI2)
   19.92 +  from g show "\<exists>y. (a, y) \<in> g" ..
   19.93 +  from g show "b = (SOME y. (a, y) \<in> g)"
   19.94 +  proof (rule some_equality [symmetric])
   19.95 +    fix y assume "(a, y) \<in> g"
   19.96 +    with g show "y = b" by (rule uniq)
   19.97 +  qed
   19.98 +qed
   19.99 +
  19.100 +
  19.101 +subsection {* Norm-preserving extensions of a function *}
  19.102 +
  19.103 +text {*
  19.104 +  Given a linear form @{text f} on the space @{text F} and a seminorm
  19.105 +  @{text p} on @{text E}. The set of all linear extensions of @{text
  19.106 +  f}, to superspaces @{text H} of @{text F}, which are bounded by
  19.107 +  @{text p}, is defined as follows.
  19.108 +*}
  19.109 +
  19.110 +definition
  19.111 +  norm_pres_extensions ::
  19.112 +    "'a::{plus, minus, uminus, zero} set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> 'a set \<Rightarrow> ('a \<Rightarrow> real)
  19.113 +      \<Rightarrow> 'a graph set" where
  19.114 +    "norm_pres_extensions E p F f
  19.115 +      = {g. \<exists>H h. g = graph H h
  19.116 +          \<and> linearform H h
  19.117 +          \<and> H \<unlhd> E
  19.118 +          \<and> F \<unlhd> H
  19.119 +          \<and> graph F f \<subseteq> graph H h
  19.120 +          \<and> (\<forall>x \<in> H. h x \<le> p x)}"
  19.121 +
  19.122 +lemma norm_pres_extensionE [elim]:
  19.123 +  "g \<in> norm_pres_extensions E p F f
  19.124 +  \<Longrightarrow> (\<And>H h. g = graph H h \<Longrightarrow> linearform H h
  19.125 +        \<Longrightarrow> H \<unlhd> E \<Longrightarrow> F \<unlhd> H \<Longrightarrow> graph F f \<subseteq> graph H h
  19.126 +        \<Longrightarrow> \<forall>x \<in> H. h x \<le> p x \<Longrightarrow> C) \<Longrightarrow> C"
  19.127 +  unfolding norm_pres_extensions_def by blast
  19.128 +
  19.129 +lemma norm_pres_extensionI2 [intro]:
  19.130 +  "linearform H h \<Longrightarrow> H \<unlhd> E \<Longrightarrow> F \<unlhd> H
  19.131 +    \<Longrightarrow> graph F f \<subseteq> graph H h \<Longrightarrow> \<forall>x \<in> H. h x \<le> p x
  19.132 +    \<Longrightarrow> graph H h \<in> norm_pres_extensions E p F f"
  19.133 +  unfolding norm_pres_extensions_def by blast
  19.134 +
  19.135 +lemma norm_pres_extensionI:  (* FIXME ? *)
  19.136 +  "\<exists>H h. g = graph H h
  19.137 +    \<and> linearform H h
  19.138 +    \<and> H \<unlhd> E
  19.139 +    \<and> F \<unlhd> H
  19.140 +    \<and> graph F f \<subseteq> graph H h
  19.141 +    \<and> (\<forall>x \<in> H. h x \<le> p x) \<Longrightarrow> g \<in> norm_pres_extensions E p F f"
  19.142 +  unfolding norm_pres_extensions_def by blast
  19.143 +
  19.144 +end
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/src/HOL/Hahn_Banach/Hahn_Banach.thy	Wed Jun 24 21:46:54 2009 +0200
    20.3 @@ -0,0 +1,509 @@
    20.4 +(*  Title:      HOL/Hahn_Banach/Hahn_Banach.thy
    20.5 +    Author:     Gertrud Bauer, TU Munich
    20.6 +*)
    20.7 +
    20.8 +header {* The Hahn-Banach Theorem *}
    20.9 +
   20.10 +theory Hahn_Banach
   20.11 +imports Hahn_Banach_Lemmas
   20.12 +begin
   20.13 +
   20.14 +text {*
   20.15 +  We present the proof of two different versions of the Hahn-Banach
   20.16 +  Theorem, closely following \cite[\S36]{Heuser:1986}.
   20.17 +*}
   20.18 +
   20.19 +subsection {* The Hahn-Banach Theorem for vector spaces *}
   20.20 +
   20.21 +text {*
   20.22 +  \textbf{Hahn-Banach Theorem.} Let @{text F} be a subspace of a real
   20.23 +  vector space @{text E}, let @{text p} be a semi-norm on @{text E},
   20.24 +  and @{text f} be a linear form defined on @{text F} such that @{text
   20.25 +  f} is bounded by @{text p}, i.e.  @{text "\<forall>x \<in> F. f x \<le> p x"}.  Then
   20.26 +  @{text f} can be extended to a linear form @{text h} on @{text E}
   20.27 +  such that @{text h} is norm-preserving, i.e. @{text h} is also
   20.28 +  bounded by @{text p}.
   20.29 +
   20.30 +  \bigskip
   20.31 +  \textbf{Proof Sketch.}
   20.32 +  \begin{enumerate}
   20.33 +
   20.34 +  \item Define @{text M} as the set of norm-preserving extensions of
   20.35 +  @{text f} to subspaces of @{text E}. The linear forms in @{text M}
   20.36 +  are ordered by domain extension.
   20.37 +
   20.38 +  \item We show that every non-empty chain in @{text M} has an upper
   20.39 +  bound in @{text M}.
   20.40 +
   20.41 +  \item With Zorn's Lemma we conclude that there is a maximal function
   20.42 +  @{text g} in @{text M}.
   20.43 +
   20.44 +  \item The domain @{text H} of @{text g} is the whole space @{text
   20.45 +  E}, as shown by classical contradiction:
   20.46 +
   20.47 +  \begin{itemize}
   20.48 +
   20.49 +  \item Assuming @{text g} is not defined on whole @{text E}, it can
   20.50 +  still be extended in a norm-preserving way to a super-space @{text
   20.51 +  H'} of @{text H}.
   20.52 +
   20.53 +  \item Thus @{text g} can not be maximal. Contradiction!
   20.54 +
   20.55 +  \end{itemize}
   20.56 +  \end{enumerate}
   20.57 +*}
   20.58 +
   20.59 +theorem Hahn_Banach:
   20.60 +  assumes E: "vectorspace E" and "subspace F E"
   20.61 +    and "seminorm E p" and "linearform F f"
   20.62 +  assumes fp: "\<forall>x \<in> F. f x \<le> p x"
   20.63 +  shows "\<exists>h. linearform E h \<and> (\<forall>x \<in> F. h x = f x) \<and> (\<forall>x \<in> E. h x \<le> p x)"
   20.64 +    -- {* Let @{text E} be a vector space, @{text F} a subspace of @{text E}, @{text p} a seminorm on @{text E}, *}
   20.65 +    -- {* and @{text f} a linear form on @{text F} such that @{text f} is bounded by @{text p}, *}
   20.66 +    -- {* then @{text f} can be extended to a linear form @{text h} on @{text E} in a norm-preserving way. \skp *}
   20.67 +proof -
   20.68 +  interpret vectorspace E by fact
   20.69 +  interpret subspace F E by fact
   20.70 +  interpret seminorm E p by fact
   20.71 +  interpret linearform F f by fact
   20.72 +  def M \<equiv> "norm_pres_extensions E p F f"
   20.73 +  then have M: "M = \<dots>" by (simp only:)
   20.74 +  from E have F: "vectorspace F" ..
   20.75 +  note FE = `F \<unlhd> E`
   20.76 +  {
   20.77 +    fix c assume cM: "c \<in> chain M" and ex: "\<exists>x. x \<in> c"
   20.78 +    have "\<Union>c \<in> M"
   20.79 +      -- {* Show that every non-empty chain @{text c} of @{text M} has an upper bound in @{text M}: *}
   20.80 +      -- {* @{text "\<Union>c"} is greater than any element of the chain @{text c}, so it suffices to show @{text "\<Union>c \<in> M"}. *}
   20.81 +      unfolding M_def
   20.82 +    proof (rule norm_pres_extensionI)
   20.83 +      let ?H = "domain (\<Union>c)"
   20.84 +      let ?h = "funct (\<Union>c)"
   20.85 +
   20.86 +      have a: "graph ?H ?h = \<Union>c"
   20.87 +      proof (rule graph_domain_funct)
   20.88 +        fix x y z assume "(x, y) \<in> \<Union>c" and "(x, z) \<in> \<Union>c"
   20.89 +        with M_def cM show "z = y" by (rule sup_definite)
   20.90 +      qed
   20.91 +      moreover from M cM a have "linearform ?H ?h"
   20.92 +        by (rule sup_lf)
   20.93 +      moreover from a M cM ex FE E have "?H \<unlhd> E"
   20.94 +        by (rule sup_subE)
   20.95 +      moreover from a M cM ex FE have "F \<unlhd> ?H"
   20.96 +        by (rule sup_supF)
   20.97 +      moreover from a M cM ex have "graph F f \<subseteq> graph ?H ?h"
   20.98 +        by (rule sup_ext)
   20.99 +      moreover from a M cM have "\<forall>x \<in> ?H. ?h x \<le> p x"
  20.100 +        by (rule sup_norm_pres)
  20.101 +      ultimately show "\<exists>H h. \<Union>c = graph H h
  20.102 +          \<and> linearform H h
  20.103 +          \<and> H \<unlhd> E
  20.104 +          \<and> F \<unlhd> H
  20.105 +          \<and> graph F f \<subseteq> graph H h
  20.106 +          \<and> (\<forall>x \<in> H. h x \<le> p x)" by blast
  20.107 +    qed
  20.108 +  }
  20.109 +  then have "\<exists>g \<in> M. \<forall>x \<in> M. g \<subseteq> x \<longrightarrow> g = x"
  20.110 +  -- {* With Zorn's Lemma we can conclude that there is a maximal element in @{text M}. \skp *}
  20.111 +  proof (rule Zorn's_Lemma)
  20.112 +      -- {* We show that @{text M} is non-empty: *}
  20.113 +    show "graph F f \<in> M"
  20.114 +      unfolding M_def
  20.115 +    proof (rule norm_pres_extensionI2)
  20.116 +      show "linearform F f" by fact
  20.117 +      show "F \<unlhd> E" by fact
  20.118 +      from F show "F \<unlhd> F" by (rule vectorspace.subspace_refl)
  20.119 +      show "graph F f \<subseteq> graph F f" ..
  20.120 +      show "\<forall>x\<in>F. f x \<le> p x" by fact
  20.121 +    qed
  20.122 +  qed
  20.123 +  then obtain g where gM: "g \<in> M" and gx: "\<forall>x \<in> M. g \<subseteq> x \<longrightarrow> g = x"
  20.124 +    by blast
  20.125 +  from gM obtain H h where
  20.126 +      g_rep: "g = graph H h"
  20.127 +    and linearform: "linearform H h"
  20.128 +    and HE: "H \<unlhd> E" and FH: "F \<unlhd> H"
  20.129 +    and graphs: "graph F f \<subseteq> graph H h"
  20.130 +    and hp: "\<forall>x \<in> H. h x \<le> p x" unfolding M_def ..
  20.131 +      -- {* @{text g} is a norm-preserving extension of @{text f}, in other words: *}
  20.132 +      -- {* @{text g} is the graph of some linear form @{text h} defined on a subspace @{text H} of @{text E}, *}
  20.133 +      -- {* and @{text h} is an extension of @{text f} that is again bounded by @{text p}. \skp *}
  20.134 +  from HE E have H: "vectorspace H"
  20.135 +    by (rule subspace.vectorspace)
  20.136 +
  20.137 +  have HE_eq: "H = E"
  20.138 +    -- {* We show that @{text h} is defined on whole @{text E} by classical contradiction. \skp *}
  20.139 +  proof (rule classical)
  20.140 +    assume neq: "H \<noteq> E"
  20.141 +      -- {* Assume @{text h} is not defined on whole @{text E}. Then show that @{text h} can be extended *}
  20.142 +      -- {* in a norm-preserving way to a function @{text h'} with the graph @{text g'}. \skp *}
  20.143 +    have "\<exists>g' \<in> M. g \<subseteq> g' \<and> g \<noteq> g'"
  20.144 +    proof -
  20.145 +      from HE have "H \<subseteq> E" ..
  20.146 +      with neq obtain x' where x'E: "x' \<in> E" and "x' \<notin> H" by blast
  20.147 +      obtain x': "x' \<noteq> 0"
  20.148 +      proof
  20.149 +        show "x' \<noteq> 0"
  20.150 +        proof
  20.151 +          assume "x' = 0"
  20.152 +          with H have "x' \<in> H" by (simp only: vectorspace.zero)
  20.153 +          with `x' \<notin> H` show False by contradiction
  20.154 +        qed
  20.155 +      qed
  20.156 +
  20.157 +      def H' \<equiv> "H + lin x'"
  20.158 +        -- {* Define @{text H'} as the direct sum of @{text H} and the linear closure of @{text x'}. \skp *}
  20.159 +      have HH': "H \<unlhd> H'"
  20.160 +      proof (unfold H'_def)
  20.161 +        from x'E have "vectorspace (lin x')" ..
  20.162 +        with H show "H \<unlhd> H + lin x'" ..
  20.163 +      qed
  20.164 +
  20.165 +      obtain xi where
  20.166 +        xi: "\<forall>y \<in> H. - p (y + x') - h y \<le> xi
  20.167 +          \<and> xi \<le> p (y + x') - h y"
  20.168 +        -- {* Pick a real number @{text \<xi>} that fulfills certain inequations; this will *}
  20.169 +        -- {* be used to establish that @{text h'} is a norm-preserving extension of @{text h}.
  20.170 +           \label{ex-xi-use}\skp *}
  20.171 +      proof -
  20.172 +        from H have "\<exists>xi. \<forall>y \<in> H. - p (y + x') - h y \<le> xi
  20.173 +            \<and> xi \<le> p (y + x') - h y"
  20.174 +        proof (rule ex_xi)
  20.175 +          fix u v assume u: "u \<in> H" and v: "v \<in> H"
  20.176 +          with HE have uE: "u \<in> E" and vE: "v \<in> E" by auto
  20.177 +          from H u v linearform have "h v - h u = h (v - u)"
  20.178 +            by (simp add: linearform.diff)
  20.179 +          also from hp and H u v have "\<dots> \<le> p (v - u)"
  20.180 +            by (simp only: vectorspace.diff_closed)
  20.181 +          also from x'E uE vE have "v - u = x' + - x' + v + - u"
  20.182 +            by (simp add: diff_eq1)
  20.183 +          also from x'E uE vE have "\<dots> = v + x' + - (u + x')"
  20.184 +            by (simp add: add_ac)
  20.185 +          also from x'E uE vE have "\<dots> = (v + x') - (u + x')"
  20.186 +            by (simp add: diff_eq1)
  20.187 +          also from x'E uE vE E have "p \<dots> \<le> p (v + x') + p (u + x')"
  20.188 +            by (simp add: diff_subadditive)
  20.189 +          finally have "h v - h u \<le> p (v + x') + p (u + x')" .
  20.190 +          then show "- p (u + x') - h u \<le> p (v + x') - h v" by simp
  20.191 +        qed
  20.192 +        then show thesis by (blast intro: that)
  20.193 +      qed
  20.194 +
  20.195 +      def h' \<equiv> "\<lambda>x. let (y, a) =
  20.196 +          SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H in h y + a * xi"
  20.197 +        -- {* Define the extension @{text h'} of @{text h} to @{text H'} using @{text \<xi>}. \skp *}
  20.198 +
  20.199 +      have "g \<subseteq> graph H' h' \<and> g \<noteq> graph H' h'"
  20.200 +        -- {* @{text h'} is an extension of @{text h} \dots \skp *}
  20.201 +      proof
  20.202 +        show "g \<subseteq> graph H' h'"
  20.203 +        proof -
  20.204 +          have  "graph H h \<subseteq> graph H' h'"
  20.205 +          proof (rule graph_extI)
  20.206 +            fix t assume t: "t \<in> H"
  20.207 +            from E HE t have "(SOME (y, a). t = y + a \<cdot> x' \<and> y \<in> H) = (t, 0)"
  20.208 +	      using `x' \<notin> H` `x' \<in> E` `x' \<noteq> 0` by (rule decomp_H'_H)
  20.209 +            with h'_def show "h t = h' t" by (simp add: Let_def)
  20.210 +          next
  20.211 +            from HH' show "H \<subseteq> H'" ..
  20.212 +          qed
  20.213 +          with g_rep show ?thesis by (simp only:)
  20.214 +        qed
  20.215 +
  20.216 +        show "g \<noteq> graph H' h'"
  20.217 +        proof -
  20.218 +          have "graph H h \<noteq> graph H' h'"
  20.219 +          proof
  20.220 +            assume eq: "graph H h = graph H' h'"
  20.221 +            have "x' \<in> H'"
  20.222 +	      unfolding H'_def
  20.223 +            proof
  20.224 +              from H show "0 \<in> H" by (rule vectorspace.zero)
  20.225 +              from x'E show "x' \<in> lin x'" by (rule x_lin_x)
  20.226 +              from x'E show "x' = 0 + x'" by simp
  20.227 +            qed
  20.228 +            then have "(x', h' x') \<in> graph H' h'" ..
  20.229 +            with eq have "(x', h' x') \<in> graph H h" by (simp only:)
  20.230 +            then have "x' \<in> H" ..
  20.231 +            with `x' \<notin> H` show False by contradiction
  20.232 +          qed
  20.233 +          with g_rep show ?thesis by simp
  20.234 +        qed
  20.235 +      qed
  20.236 +      moreover have "graph H' h' \<in> M"
  20.237 +        -- {* and @{text h'} is norm-preserving. \skp *}
  20.238 +      proof (unfold M_def)
  20.239 +        show "graph H' h' \<in> norm_pres_extensions E p F f"
  20.240 +        proof (rule norm_pres_extensionI2)
  20.241 +          show "linearform H' h'"
  20.242 +	    using h'_def H'_def HE linearform `x' \<notin> H` `x' \<in> E` `x' \<noteq> 0` E
  20.243 +	    by (rule h'_lf)
  20.244 +          show "H' \<unlhd> E"
  20.245 +	  unfolding H'_def
  20.246 +          proof
  20.247 +            show "H \<unlhd> E" by fact
  20.248 +            show "vectorspace E" by fact
  20.249 +            from x'E show "lin x' \<unlhd> E" ..
  20.250 +          qed
  20.251 +          from H `F \<unlhd> H` HH' show FH': "F \<unlhd> H'"
  20.252 +            by (rule vectorspace.subspace_trans)
  20.253 +          show "graph F f \<subseteq> graph H' h'"
  20.254 +          proof (rule graph_extI)
  20.255 +            fix x assume x: "x \<in> F"
  20.256 +            with graphs have "f x = h x" ..
  20.257 +            also have "\<dots> = h x + 0 * xi" by simp
  20.258 +            also have "\<dots> = (let (y, a) = (x, 0) in h y + a * xi)"
  20.259 +              by (simp add: Let_def)
  20.260 +            also have "(x, 0) =
  20.261 +                (SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H)"
  20.262 +	      using E HE
  20.263 +            proof (rule decomp_H'_H [symmetric])
  20.264 +              from FH x show "x \<in> H" ..
  20.265 +              from x' show "x' \<noteq> 0" .
  20.266 +	      show "x' \<notin> H" by fact
  20.267 +	      show "x' \<in> E" by fact
  20.268 +            qed
  20.269 +            also have
  20.270 +              "(let (y, a) = (SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H)
  20.271 +              in h y + a * xi) = h' x" by (simp only: h'_def)
  20.272 +            finally show "f x = h' x" .
  20.273 +          next
  20.274 +            from FH' show "F \<subseteq> H'" ..
  20.275 +          qed
  20.276 +          show "\<forall>x \<in> H'. h' x \<le> p x"
  20.277 +	    using h'_def H'_def `x' \<notin> H` `x' \<in> E` `x' \<noteq> 0` E HE
  20.278 +	      `seminorm E p` linearform and hp xi
  20.279 +	    by (rule h'_norm_pres)
  20.280 +        qed
  20.281 +      qed
  20.282 +      ultimately show ?thesis ..
  20.283 +    qed
  20.284 +    then have "\<not> (\<forall>x \<in> M. g \<subseteq> x \<longrightarrow> g = x)" by simp
  20.285 +      -- {* So the graph @{text g} of @{text h} cannot be maximal. Contradiction! \skp *}
  20.286 +    with gx show "H = E" by contradiction
  20.287 +  qed
  20.288 +
  20.289 +  from HE_eq and linearform have "linearform E h"
  20.290 +    by (simp only:)
  20.291 +  moreover have "\<forall>x \<in> F. h x = f x"
  20.292 +  proof
  20.293 +    fix x assume "x \<in> F"
  20.294 +    with graphs have "f x = h x" ..
  20.295 +    then show "h x = f x" ..
  20.296 +  qed
  20.297 +  moreover from HE_eq and hp have "\<forall>x \<in> E. h x \<le> p x"
  20.298 +    by (simp only:)
  20.299 +  ultimately show ?thesis by blast
  20.300 +qed
  20.301 +
  20.302 +
  20.303 +subsection  {* Alternative formulation *}
  20.304 +
  20.305 +text {*
  20.306 +  The following alternative formulation of the Hahn-Banach
  20.307 +  Theorem\label{abs-Hahn-Banach} uses the fact that for a real linear
  20.308 +  form @{text f} and a seminorm @{text p} the following inequations
  20.309 +  are equivalent:\footnote{This was shown in lemma @{thm [source]
  20.310 +  abs_ineq_iff} (see page \pageref{abs-ineq-iff}).}
  20.311 +  \begin{center}
  20.312 +  \begin{tabular}{lll}
  20.313 +  @{text "\<forall>x \<in> H. \<bar>h x\<bar> \<le> p x"} & and &
  20.314 +  @{text "\<forall>x \<in> H. h x \<le> p x"} \\
  20.315 +  \end{tabular}
  20.316 +  \end{center}
  20.317 +*}
  20.318 +
  20.319 +theorem abs_Hahn_Banach:
  20.320 +  assumes E: "vectorspace E" and FE: "subspace F E"
  20.321 +    and lf: "linearform F f" and sn: "seminorm E p"
  20.322 +  assumes fp: "\<forall>x \<in> F. \<bar>f x\<bar> \<le> p x"
  20.323 +  shows "\<exists>g. linearform E g
  20.324 +    \<and> (\<forall>x \<in> F. g x = f x)
  20.325 +    \<and> (\<forall>x \<in> E. \<bar>g x\<bar> \<le> p x)"
  20.326 +proof -
  20.327 +  interpret vectorspace E by fact
  20.328 +  interpret subspace F E by fact
  20.329 +  interpret linearform F f by fact
  20.330 +  interpret seminorm E p by fact
  20.331 +  have "\<exists>g. linearform E g \<and> (\<forall>x \<in> F. g x = f x) \<and> (\<forall>x \<in> E. g x \<le> p x)"
  20.332 +    using E FE sn lf
  20.333 +  proof (rule Hahn_Banach)
  20.334 +    show "\<forall>x \<in> F. f x \<le> p x"
  20.335 +      using FE E sn lf and fp by (rule abs_ineq_iff [THEN iffD1])
  20.336 +  qed
  20.337 +  then obtain g where lg: "linearform E g" and *: "\<forall>x \<in> F. g x = f x"
  20.338 +      and **: "\<forall>x \<in> E. g x \<le> p x" by blast
  20.339 +  have "\<forall>x \<in> E. \<bar>g x\<bar> \<le> p x"
  20.340 +    using _ E sn lg **
  20.341 +  proof (rule abs_ineq_iff [THEN iffD2])
  20.342 +    show "E \<unlhd> E" ..
  20.343 +  qed
  20.344 +  with lg * show ?thesis by blast
  20.345 +qed
  20.346 +
  20.347 +
  20.348 +subsection {* The Hahn-Banach Theorem for normed spaces *}
  20.349 +
  20.350 +text {*
  20.351 +  Every continuous linear form @{text f} on a subspace @{text F} of a
  20.352 +  norm space @{text E}, can be extended to a continuous linear form
  20.353 +  @{text g} on @{text E} such that @{text "\<parallel>f\<parallel> = \<parallel>g\<parallel>"}.
  20.354 +*}
  20.355 +
  20.356 +theorem norm_Hahn_Banach:
  20.357 +  fixes V and norm ("\<parallel>_\<parallel>")
  20.358 +  fixes B defines "\<And>V f. B V f \<equiv> {0} \<union> {\<bar>f x\<bar> / \<parallel>x\<parallel> | x. x \<noteq> 0 \<and> x \<in> V}"
  20.359 +  fixes fn_norm ("\<parallel>_\<parallel>\<hyphen>_" [0, 1000] 999)
  20.360 +  defines "\<And>V f. \<parallel>f\<parallel>\<hyphen>V \<equiv> \<Squnion>(B V f)"
  20.361 +  assumes E_norm: "normed_vectorspace E norm" and FE: "subspace F E"
  20.362 +    and linearform: "linearform F f" and "continuous F norm f"
  20.363 +  shows "\<exists>g. linearform E g
  20.364 +     \<and> continuous E norm g
  20.365 +     \<and> (\<forall>x \<in> F. g x = f x)
  20.366 +     \<and> \<parallel>g\<parallel>\<hyphen>E = \<parallel>f\<parallel>\<hyphen>F"
  20.367 +proof -
  20.368 +  interpret normed_vectorspace E norm by fact
  20.369 +  interpret normed_vectorspace_with_fn_norm E norm B fn_norm
  20.370 +    by (auto simp: B_def fn_norm_def) intro_locales
  20.371 +  interpret subspace F E by fact
  20.372 +  interpret linearform F f by fact
  20.373 +  interpret continuous F norm f by fact
  20.374 +  have E: "vectorspace E" by intro_locales
  20.375 +  have F: "vectorspace F" by rule intro_locales
  20.376 +  have F_norm: "normed_vectorspace F norm"
  20.377 +    using FE E_norm by (rule subspace_normed_vs)
  20.378 +  have ge_zero: "0 \<le> \<parallel>f\<parallel>\<hyphen>F"
  20.379 +    by (rule normed_vectorspace_with_fn_norm.fn_norm_ge_zero
  20.380 +      [OF normed_vectorspace_with_fn_norm.intro,
  20.381 +       OF F_norm `continuous F norm f` , folded B_def fn_norm_def])
  20.382 +  txt {* We define a function @{text p} on @{text E} as follows:
  20.383 +    @{text "p x = \<parallel>f\<parallel> \<cdot> \<parallel>x\<parallel>"} *}
  20.384 +  def p \<equiv> "\<lambda>x. \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>"
  20.385 +
  20.386 +  txt {* @{text p} is a seminorm on @{text E}: *}
  20.387 +  have q: "seminorm E p"
  20.388 +  proof
  20.389 +    fix x y a assume x: "x \<in> E" and y: "y \<in> E"
  20.390 +    
  20.391 +    txt {* @{text p} is positive definite: *}
  20.392 +    have "0 \<le> \<parallel>f\<parallel>\<hyphen>F" by (rule ge_zero)
  20.393 +    moreover from x have "0 \<le> \<parallel>x\<parallel>" ..
  20.394 +    ultimately show "0 \<le> p x"  
  20.395 +      by (simp add: p_def zero_le_mult_iff)
  20.396 +
  20.397 +    txt {* @{text p} is absolutely homogenous: *}
  20.398 +
  20.399 +    show "p (a \<cdot> x) = \<bar>a\<bar> * p x"
  20.400 +    proof -
  20.401 +      have "p (a \<cdot> x) = \<parallel>f\<parallel>\<hyphen>F * \<parallel>a \<cdot> x\<parallel>" by (simp only: p_def)
  20.402 +      also from x have "\<parallel>a \<cdot> x\<parallel> = \<bar>a\<bar> * \<parallel>x\<parallel>" by (rule abs_homogenous)
  20.403 +      also have "\<parallel>f\<parallel>\<hyphen>F * (\<bar>a\<bar> * \<parallel>x\<parallel>) = \<bar>a\<bar> * (\<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>)" by simp
  20.404 +      also have "\<dots> = \<bar>a\<bar> * p x" by (simp only: p_def)
  20.405 +      finally show ?thesis .
  20.406 +    qed
  20.407 +
  20.408 +    txt {* Furthermore, @{text p} is subadditive: *}
  20.409 +
  20.410 +    show "p (x + y) \<le> p x + p y"
  20.411 +    proof -
  20.412 +      have "p (x + y) = \<parallel>f\<parallel>\<hyphen>F * \<parallel>x + y\<parallel>" by (simp only: p_def)
  20.413 +      also have a: "0 \<le> \<parallel>f\<parallel>\<hyphen>F" by (rule ge_zero)
  20.414 +      from x y have "\<parallel>x + y\<parallel> \<le> \<parallel>x\<parallel> + \<parallel>y\<parallel>" ..
  20.415 +      with a have " \<parallel>f\<parallel>\<hyphen>F * \<parallel>x + y\<parallel> \<le> \<parallel>f\<parallel>\<hyphen>F * (\<parallel>x\<parallel> + \<parallel>y\<parallel>)"
  20.416 +        by (simp add: mult_left_mono)
  20.417 +      also have "\<dots> = \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel> + \<parallel>f\<parallel>\<hyphen>F * \<parallel>y\<parallel>" by (simp only: right_distrib)
  20.418 +      also have "\<dots> = p x + p y" by (simp only: p_def)
  20.419 +      finally show ?thesis .
  20.420 +    qed
  20.421 +  qed
  20.422 +
  20.423 +  txt {* @{text f} is bounded by @{text p}. *}
  20.424 +
  20.425 +  have "\<forall>x \<in> F. \<bar>f x\<bar> \<le> p x"
  20.426 +  proof
  20.427 +    fix x assume "x \<in> F"
  20.428 +    with `continuous F norm f` and linearform
  20.429 +    show "\<bar>f x\<bar> \<le> p x"
  20.430 +      unfolding p_def by (rule normed_vectorspace_with_fn_norm.fn_norm_le_cong
  20.431 +        [OF normed_vectorspace_with_fn_norm.intro,
  20.432 +         OF F_norm, folded B_def fn_norm_def])
  20.433 +  qed
  20.434 +
  20.435 +  txt {* Using the fact that @{text p} is a seminorm and @{text f} is bounded
  20.436 +    by @{text p} we can apply the Hahn-Banach Theorem for real vector
  20.437 +    spaces. So @{text f} can be extended in a norm-preserving way to
  20.438 +    some function @{text g} on the whole vector space @{text E}. *}
  20.439 +
  20.440 +  with E FE linearform q obtain g where
  20.441 +      linearformE: "linearform E g"
  20.442 +    and a: "\<forall>x \<in> F. g x = f x"
  20.443 +    and b: "\<forall>x \<in> E. \<bar>g x\<bar> \<le> p x"
  20.444 +    by (rule abs_Hahn_Banach [elim_format]) iprover
  20.445 +
  20.446 +  txt {* We furthermore have to show that @{text g} is also continuous: *}
  20.447 +
  20.448 +  have g_cont: "continuous E norm g" using linearformE
  20.449 +  proof
  20.450 +    fix x assume "x \<in> E"
  20.451 +    with b show "\<bar>g x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>"
  20.452 +      by (simp only: p_def)
  20.453 +  qed
  20.454 +
  20.455 +  txt {* To complete the proof, we show that @{text "\<parallel>g\<parallel> = \<parallel>f\<parallel>"}. *}
  20.456 +
  20.457 +  have "\<parallel>g\<parallel>\<hyphen>E = \<parallel>f\<parallel>\<hyphen>F"
  20.458 +  proof (rule order_antisym)
  20.459 +    txt {*
  20.460 +      First we show @{text "\<parallel>g\<parallel> \<le> \<parallel>f\<parallel>"}.  The function norm @{text
  20.461 +      "\<parallel>g\<parallel>"} is defined as the smallest @{text "c \<in> \<real>"} such that
  20.462 +      \begin{center}
  20.463 +      \begin{tabular}{l}
  20.464 +      @{text "\<forall>x \<in> E. \<bar>g x\<bar> \<le> c \<cdot> \<parallel>x\<parallel>"}
  20.465 +      \end{tabular}
  20.466 +      \end{center}
  20.467 +      \noindent Furthermore holds
  20.468 +      \begin{center}
  20.469 +      \begin{tabular}{l}
  20.470 +      @{text "\<forall>x \<in> E. \<bar>g x\<bar> \<le> \<parallel>f\<parallel> \<cdot> \<parallel>x\<parallel>"}
  20.471 +      \end{tabular}
  20.472 +      \end{center}
  20.473 +    *}
  20.474 +
  20.475 +    have "\<forall>x \<in> E. \<bar>g x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>"
  20.476 +    proof
  20.477 +      fix x assume "x \<in> E"
  20.478 +      with b show "\<bar>g x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>"
  20.479 +        by (simp only: p_def)
  20.480 +    qed
  20.481 +    from g_cont this ge_zero
  20.482 +    show "\<parallel>g\<parallel>\<hyphen>E \<le> \<parallel>f\<parallel>\<hyphen>F"
  20.483 +      by (rule fn_norm_least [of g, folded B_def fn_norm_def])
  20.484 +
  20.485 +    txt {* The other direction is achieved by a similar argument. *}
  20.486 +
  20.487 +    show "\<parallel>f\<parallel>\<hyphen>F \<le> \<parallel>g\<parallel>\<hyphen>E"
  20.488 +    proof (rule normed_vectorspace_with_fn_norm.fn_norm_least
  20.489 +	[OF normed_vectorspace_with_fn_norm.intro,
  20.490 +	 OF F_norm, folded B_def fn_norm_def])
  20.491 +      show "\<forall>x \<in> F. \<bar>f x\<bar> \<le> \<parallel>g\<parallel>\<hyphen>E * \<parallel>x\<parallel>"
  20.492 +      proof
  20.493 +	fix x assume x: "x \<in> F"
  20.494 +	from a x have "g x = f x" ..
  20.495 +	then have "\<bar>f x\<bar> = \<bar>g x\<bar>" by (simp only:)
  20.496 +	also from g_cont
  20.497 +	have "\<dots> \<le> \<parallel>g\<parallel>\<hyphen>E * \<parallel>x\<parallel>"
  20.498 +	proof (rule fn_norm_le_cong [OF _ linearformE, folded B_def fn_norm_def])
  20.499 +	  from FE x show "x \<in> E" ..
  20.500 +	qed
  20.501 +	finally show "\<bar>f x\<bar> \<le> \<parallel>g\<parallel>\<hyphen>E * \<parallel>x\<parallel>" .
  20.502 +      qed
  20.503 +      show "0 \<le> \<parallel>g\<parallel>\<hyphen>E"
  20.504 +	using g_cont
  20.505 +	by (rule fn_norm_ge_zero [of g, folded B_def fn_norm_def])
  20.506 +      show "continuous F norm f" by fact
  20.507 +    qed
  20.508 +  qed
  20.509 +  with linearformE a g_cont show ?thesis by blast
  20.510 +qed
  20.511 +
  20.512 +end
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/src/HOL/Hahn_Banach/Hahn_Banach_Ext_Lemmas.thy	Wed Jun 24 21:46:54 2009 +0200
    21.3 @@ -0,0 +1,280 @@
    21.4 +(*  Title:      HOL/Hahn_Banach/Hahn_Banach_Ext_Lemmas.thy
    21.5 +    Author:     Gertrud Bauer, TU Munich
    21.6 +*)
    21.7 +
    21.8 +header {* Extending non-maximal functions *}
    21.9 +
   21.10 +theory Hahn_Banach_Ext_Lemmas
   21.11 +imports Function_Norm
   21.12 +begin
   21.13 +
   21.14 +text {*
   21.15 +  In this section the following context is presumed.  Let @{text E} be
   21.16 +  a real vector space with a seminorm @{text q} on @{text E}. @{text
   21.17 +  F} is a subspace of @{text E} and @{text f} a linear function on
   21.18 +  @{text F}. We consider a subspace @{text H} of @{text E} that is a
   21.19 +  superspace of @{text F} and a linear form @{text h} on @{text
   21.20 +  H}. @{text H} is a not equal to @{text E} and @{text "x\<^sub>0"} is
   21.21 +  an element in @{text "E - H"}.  @{text H} is extended to the direct
   21.22 +  sum @{text "H' = H + lin x\<^sub>0"}, so for any @{text "x \<in> H'"}
   21.23 +  the decomposition of @{text "x = y + a \<cdot> x"} with @{text "y \<in> H"} is
   21.24 +  unique. @{text h'} is defined on @{text H'} by @{text "h' x = h y +
   21.25 +  a \<cdot> \<xi>"} for a certain @{text \<xi>}.
   21.26 +
   21.27 +  Subsequently we show some properties of this extension @{text h'} of
   21.28 +  @{text h}.
   21.29 +
   21.30 +  \medskip This lemma will be used to show the existence of a linear
   21.31 +  extension of @{text f} (see page \pageref{ex-xi-use}). It is a
   21.32 +  consequence of the completeness of @{text \<real>}. To show
   21.33 +  \begin{center}
   21.34 +  \begin{tabular}{l}
   21.35 +  @{text "\<exists>\<xi>. \<forall>y \<in> F. a y \<le> \<xi> \<and> \<xi> \<le> b y"}
   21.36 +  \end{tabular}
   21.37 +  \end{center}
   21.38 +  \noindent it suffices to show that
   21.39 +  \begin{center}
   21.40 +  \begin{tabular}{l}
   21.41 +  @{text "\<forall>u \<in> F. \<forall>v \<in> F. a u \<le> b v"}
   21.42 +  \end{tabular}
   21.43 +  \end{center}
   21.44 +*}
   21.45 +
   21.46 +lemma ex_xi:
   21.47 +  assumes "vectorspace F"
   21.48 +  assumes r: "\<And>u v. u \<in> F \<Longrightarrow> v \<in> F \<Longrightarrow> a u \<le> b v"
   21.49 +  shows "\<exists>xi::real. \<forall>y \<in> F. a y \<le> xi \<and> xi \<le> b y"
   21.50 +proof -
   21.51 +  interpret vectorspace F by fact
   21.52 +  txt {* From the completeness of the reals follows:
   21.53 +    The set @{text "S = {a u. u \<in> F}"} has a supremum, if it is
   21.54 +    non-empty and has an upper bound. *}
   21.55 +
   21.56 +  let ?S = "{a u | u. u \<in> F}"
   21.57 +  have "\<exists>xi. lub ?S xi"
   21.58 +  proof (rule real_complete)
   21.59 +    have "a 0 \<in> ?S" by blast
   21.60 +    then show "\<exists>X. X \<in> ?S" ..
   21.61 +    have "\<forall>y \<in> ?S. y \<le> b 0"
   21.62 +    proof
   21.63 +      fix y assume y: "y \<in> ?S"
   21.64 +      then obtain u where u: "u \<in> F" and y: "y = a u" by blast
   21.65 +      from u and zero have "a u \<le> b 0" by (rule r)
   21.66 +      with y show "y \<le> b 0" by (simp only:)
   21.67 +    qed
   21.68 +    then show "\<exists>u. \<forall>y \<in> ?S. y \<le> u" ..
   21.69 +  qed
   21.70 +  then obtain xi where xi: "lub ?S xi" ..
   21.71 +  {
   21.72 +    fix y assume "y \<in> F"
   21.73 +    then have "a y \<in> ?S" by blast
   21.74 +    with xi have "a y \<le> xi" by (rule lub.upper)
   21.75 +  } moreover {
   21.76 +    fix y assume y: "y \<in> F"
   21.77 +    from xi have "xi \<le> b y"
   21.78 +    proof (rule lub.least)
   21.79 +      fix au assume "au \<in> ?S"
   21.80 +      then obtain u where u: "u \<in> F" and au: "au = a u" by blast
   21.81 +      from u y have "a u \<le> b y" by (rule r)
   21.82 +      with au show "au \<le> b y" by (simp only:)
   21.83 +    qed
   21.84 +  } ultimately show "\<exists>xi. \<forall>y \<in> F. a y \<le> xi \<and> xi \<le> b y" by blast
   21.85 +qed
   21.86 +
   21.87 +text {*
   21.88 +  \medskip The function @{text h'} is defined as a @{text "h' x = h y
   21.89 +  + a \<cdot> \<xi>"} where @{text "x = y + a \<cdot> \<xi>"} is a linear extension of
   21.90 +  @{text h} to @{text H'}.
   21.91 +*}
   21.92 +
   21.93 +lemma h'_lf:
   21.94 +  assumes h'_def: "h' \<equiv> \<lambda>x. let (y, a) =
   21.95 +      SOME (y, a). x = y + a \<cdot> x0 \<and> y \<in> H in h y + a * xi"
   21.96 +    and H'_def: "H' \<equiv> H + lin x0"
   21.97 +    and HE: "H \<unlhd> E"
   21.98 +  assumes "linearform H h"
   21.99 +  assumes x0: "x0 \<notin> H"  "x0 \<in> E"  "x0 \<noteq> 0"
  21.100 +  assumes E: "vectorspace E"
  21.101 +  shows "linearform H' h'"
  21.102 +proof -
  21.103 +  interpret linearform H h by fact
  21.104 +  interpret vectorspace E by fact
  21.105 +  show ?thesis
  21.106 +  proof
  21.107 +    note E = `vectorspace E`
  21.108 +    have H': "vectorspace H'"
  21.109 +    proof (unfold H'_def)
  21.110 +      from `x0 \<in> E`
  21.111 +      have "lin x0 \<unlhd> E" ..
  21.112 +      with HE show "vectorspace (H + lin x0)" using E ..
  21.113 +    qed
  21.114 +    {
  21.115 +      fix x1 x2 assume x1: "x1 \<in> H'" and x2: "x2 \<in> H'"
  21.116 +      show "h' (x1 + x2) = h' x1 + h' x2"
  21.117 +      proof -
  21.118 +	from H' x1 x2 have "x1 + x2 \<in> H'"
  21.119 +          by (rule vectorspace.add_closed)
  21.120 +	with x1 x2 obtain y y1 y2 a a1 a2 where
  21.121 +          x1x2: "x1 + x2 = y + a \<cdot> x0" and y: "y \<in> H"
  21.122 +          and x1_rep: "x1 = y1 + a1 \<cdot> x0" and y1: "y1 \<in> H"
  21.123 +          and x2_rep: "x2 = y2 + a2 \<cdot> x0" and y2: "y2 \<in> H"
  21.124 +          unfolding H'_def sum_def lin_def by blast
  21.125 +	
  21.126 +	have ya: "y1 + y2 = y \<and> a1 + a2 = a" using E HE _ y x0
  21.127 +	proof (rule decomp_H') txt_raw {* \label{decomp-H-use} *}
  21.128 +          from HE y1 y2 show "y1 + y2 \<in> H"
  21.129 +            by (rule subspace.add_closed)
  21.130 +          from x0 and HE y y1 y2
  21.131 +          have "x0 \<in> E"  "y \<in> E"  "y1 \<in> E"  "y2 \<in> E" by auto
  21.132 +          with x1_rep x2_rep have "(y1 + y2) + (a1 + a2) \<cdot> x0 = x1 + x2"
  21.133 +            by (simp add: add_ac add_mult_distrib2)
  21.134 +          also note x1x2
  21.135 +          finally show "(y1 + y2) + (a1 + a2) \<cdot> x0 = y + a \<cdot> x0" .
  21.136 +	qed
  21.137 +	
  21.138 +	from h'_def x1x2 E HE y x0
  21.139 +	have "h' (x1 + x2) = h y + a * xi"
  21.140 +          by (rule h'_definite)
  21.141 +	also have "\<dots> = h (y1 + y2) + (a1 + a2) * xi"
  21.142 +          by (simp only: ya)
  21.143 +	also from y1 y2 have "h (y1 + y2) = h y1 + h y2"
  21.144 +          by simp
  21.145 +	also have "\<dots> + (a1 + a2) * xi = (h y1 + a1 * xi) + (h y2 + a2 * xi)"
  21.146 +          by (simp add: left_distrib)
  21.147 +	also from h'_def x1_rep E HE y1 x0
  21.148 +	have "h y1 + a1 * xi = h' x1"
  21.149 +          by (rule h'_definite [symmetric])
  21.150 +	also from h'_def x2_rep E HE y2 x0
  21.151 +	have "h y2 + a2 * xi = h' x2"
  21.152 +          by (rule h'_definite [symmetric])
  21.153 +	finally show ?thesis .
  21.154 +      qed
  21.155 +    next
  21.156 +      fix x1 c assume x1: "x1 \<in> H'"
  21.157 +      show "h' (c \<cdot> x1) = c * (h' x1)"
  21.158 +      proof -
  21.159 +	from H' x1 have ax1: "c \<cdot> x1 \<in> H'"
  21.160 +          by (rule vectorspace.mult_closed)
  21.161 +	with x1 obtain y a y1 a1 where
  21.162 +            cx1_rep: "c \<cdot> x1 = y + a \<cdot> x0" and y: "y \<in> H"
  21.163 +          and x1_rep: "x1 = y1 + a1 \<cdot> x0" and y1: "y1 \<in> H"
  21.164 +          unfolding H'_def sum_def lin_def by blast
  21.165 +	
  21.166 +	have ya: "c \<cdot> y1 = y \<and> c * a1 = a" using E HE _ y x0
  21.167 +	proof (rule decomp_H')
  21.168 +          from HE y1 show "c \<cdot> y1 \<in> H"
  21.169 +            by (rule subspace.mult_closed)
  21.170 +          from x0 and HE y y1
  21.171 +          have "x0 \<in> E"  "y \<in> E"  "y1 \<in> E" by auto
  21.172 +          with x1_rep have "c \<cdot> y1 + (c * a1) \<cdot> x0 = c \<cdot> x1"
  21.173 +            by (simp add: mult_assoc add_mult_distrib1)
  21.174 +          also note cx1_rep
  21.175 +          finally show "c \<cdot> y1 + (c * a1) \<cdot> x0 = y + a \<cdot> x0" .
  21.176 +	qed
  21.177 +	
  21.178 +	from h'_def cx1_rep E HE y x0 have "h' (c \<cdot> x1) = h y + a * xi"
  21.179 +          by (rule h'_definite)
  21.180 +	also have "\<dots> = h (c \<cdot> y1) + (c * a1) * xi"
  21.181 +          by (simp only: ya)
  21.182 +	also from y1 have "h (c \<cdot> y1) = c * h y1"
  21.183 +          by simp
  21.184 +	also have "\<dots> + (c * a1) * xi = c * (h y1 + a1 * xi)"
  21.185 +          by (simp only: right_distrib)
  21.186 +	also from h'_def x1_rep E HE y1 x0 have "h y1 + a1 * xi = h' x1"
  21.187 +          by (rule h'_definite [symmetric])
  21.188 +	finally show ?thesis .
  21.189 +      qed
  21.190 +    }
  21.191 +  qed
  21.192 +qed
  21.193 +
  21.194 +text {* \medskip The linear extension @{text h'} of @{text h}
  21.195 +  is bounded by the seminorm @{text p}. *}
  21.196 +
  21.197 +lemma h'_norm_pres:
  21.198 +  assumes h'_def: "h' \<equiv> \<lambda>x. let (y, a) =
  21.199 +      SOME (y, a). x = y + a \<cdot> x0 \<and> y \<in> H in h y + a * xi"
  21.200 +    and H'_def: "H' \<equiv> H + lin x0"
  21.201 +    and x0: "x0 \<notin> H"  "x0 \<in> E"  "x0 \<noteq> 0"
  21.202 +  assumes E: "vectorspace E" and HE: "subspace H E"
  21.203 +    and "seminorm E p" and "linearform H h"
  21.204 +  assumes a: "\<forall>y \<in> H. h y \<le> p y"
  21.205 +    and a': "\<forall>y \<in> H. - p (y + x0) - h y \<le> xi \<and> xi \<le> p (y + x0) - h y"
  21.206 +  shows "\<forall>x \<in> H'. h' x \<le> p x"
  21.207 +proof -
  21.208 +  interpret vectorspace E by fact
  21.209 +  interpret subspace H E by fact
  21.210 +  interpret seminorm E p by fact
  21.211 +  interpret linearform H h by fact
  21.212 +  show ?thesis
  21.213 +  proof
  21.214 +    fix x assume x': "x \<in> H'"
  21.215 +    show "h' x \<le> p x"
  21.216 +    proof -
  21.217 +      from a' have a1: "\<forall>ya \<in> H. - p (ya + x0) - h ya \<le> xi"
  21.218 +	and a2: "\<forall>ya \<in> H. xi \<le> p (ya + x0) - h ya" by auto
  21.219 +      from x' obtain y a where
  21.220 +          x_rep: "x = y + a \<cdot> x0" and y: "y \<in> H"
  21.221 +	unfolding H'_def sum_def lin_def by blast
  21.222 +      from y have y': "y \<in> E" ..
  21.223 +      from y have ay: "inverse a \<cdot> y \<in> H" by simp
  21.224 +      
  21.225 +      from h'_def x_rep E HE y x0 have "h' x = h y + a * xi"
  21.226 +	by (rule h'_definite)
  21.227 +      also have "\<dots> \<le> p (y + a \<cdot> x0)"
  21.228 +      proof (rule linorder_cases)
  21.229 +	assume z: "a = 0"
  21.230 +	then have "h y + a * xi = h y" by simp
  21.231 +	also from a y have "\<dots> \<le> p y" ..
  21.232 +	also from x0 y' z have "p y = p (y + a \<cdot> x0)" by simp
  21.233 +	finally show ?thesis .
  21.234 +      next
  21.235 +	txt {* In the case @{text "a < 0"}, we use @{text "a\<^sub>1"}
  21.236 +          with @{text ya} taken as @{text "y / a"}: *}
  21.237 +	assume lz: "a < 0" then have nz: "a \<noteq> 0" by simp
  21.238 +	from a1 ay
  21.239 +	have "- p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y) \<le> xi" ..
  21.240 +	with lz have "a * xi \<le>
  21.241 +          a * (- p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y))"
  21.242 +          by (simp add: mult_left_mono_neg order_less_imp_le)
  21.243 +	
  21.244 +	also have "\<dots> =
  21.245 +          - a * (p (inverse a \<cdot> y + x0)) - a * (h (inverse a \<cdot> y))"
  21.246 +	  by (simp add: right_diff_distrib)
  21.247 +	also from lz x0 y' have "- a * (p (inverse a \<cdot> y + x0)) =
  21.248 +          p (a \<cdot> (inverse a \<cdot> y + x0))"
  21.249 +          by (simp add: abs_homogenous)
  21.250 +	also from nz x0 y' have "\<dots> = p (y + a \<cdot> x0)"
  21.251 +          by (simp add: add_mult_distrib1 mult_assoc [symmetric])
  21.252 +	also from nz y have "a * (h (inverse a \<cdot> y)) =  h y"
  21.253 +          by simp
  21.254 +	finally have "a * xi \<le> p (y + a \<cdot> x0) - h y" .
  21.255 +	then show ?thesis by simp
  21.256 +      next
  21.257 +	txt {* In the case @{text "a > 0"}, we use @{text "a\<^sub>2"}
  21.258 +          with @{text ya} taken as @{text "y / a"}: *}
  21.259 +	assume gz: "0 < a" then have nz: "a \<noteq> 0" by simp
  21.260 +	from a2 ay
  21.261 +	have "xi \<le> p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y)" ..
  21.262 +	with gz have "a * xi \<le>
  21.263 +          a * (p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y))"
  21.264 +          by simp
  21.265 +	also have "\<dots> = a * p (inverse a \<cdot> y + x0) - a * h (inverse a \<cdot> y)"
  21.266 +	  by (simp add: right_diff_distrib)
  21.267 +	also from gz x0 y'
  21.268 +	have "a * p (inverse a \<cdot> y + x0) = p (a \<cdot> (inverse a \<cdot> y + x0))"
  21.269 +          by (simp add: abs_homogenous)
  21.270 +	also from nz x0 y' have "\<dots> = p (y + a \<cdot> x0)"
  21.271 +          by (simp add: add_mult_distrib1 mult_assoc [symmetric])
  21.272 +	also from nz y have "a * h (inverse a \<cdot> y) = h y"
  21.273 +          by simp
  21.274 +	finally have "a * xi \<le> p (y + a \<cdot> x0) - h y" .
  21.275 +	then show ?thesis by simp
  21.276 +      qed
  21.277 +      also from x_rep have "\<dots> = p x" by (simp only:)
  21.278 +      finally show ?thesis .
  21.279 +    qed
  21.280 +  qed
  21.281 +qed
  21.282 +
  21.283 +end
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/src/HOL/Hahn_Banach/Hahn_Banach_Lemmas.thy	Wed Jun 24 21:46:54 2009 +0200
    22.3 @@ -0,0 +1,4 @@
    22.4 +(*<*)
    22.5 +theory Hahn_Banach_Lemmas imports Hahn_Banach_Sup_Lemmas Hahn_Banach_Ext_Lemmas begin
    22.6 +end
    22.7 +(*>*)
    22.8 \ No newline at end of file
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/src/HOL/Hahn_Banach/Hahn_Banach_Sup_Lemmas.thy	Wed Jun 24 21:46:54 2009 +0200
    23.3 @@ -0,0 +1,445 @@
    23.4 +(*  Title:      HOL/Hahn_Banach/Hahn_Banach_Sup_Lemmas.thy
    23.5 +    Author:     Gertrud Bauer, TU Munich
    23.6 +*)
    23.7 +
    23.8 +header {* The supremum w.r.t.~the function order *}
    23.9 +
   23.10 +theory Hahn_Banach_Sup_Lemmas
   23.11 +imports Function_Norm Zorn_Lemma
   23.12 +begin
   23.13 +
   23.14 +text {*
   23.15 +  This section contains some lemmas that will be used in the proof of
   23.16 +  the Hahn-Banach Theorem.  In this section the following context is
   23.17 +  presumed.  Let @{text E} be a real vector space with a seminorm
   23.18 +  @{text p} on @{text E}.  @{text F} is a subspace of @{text E} and
   23.19 +  @{text f} a linear form on @{text F}. We consider a chain @{text c}
   23.20 +  of norm-preserving extensions of @{text f}, such that @{text "\<Union>c =
   23.21 +  graph H h"}.  We will show some properties about the limit function
   23.22 +  @{text h}, i.e.\ the supremum of the chain @{text c}.
   23.23 +
   23.24 +  \medskip Let @{text c} be a chain of norm-preserving extensions of
   23.25 +  the function @{text f} and let @{text "graph H h"} be the supremum
   23.26 +  of @{text c}.  Every element in @{text H} is member of one of the
   23.27 +  elements of the chain.
   23.28 +*}
   23.29 +lemmas [dest?] = chainD
   23.30 +lemmas chainE2 [elim?] = chainD2 [elim_format, standard]
   23.31 +
   23.32 +lemma some_H'h't:
   23.33 +  assumes M: "M = norm_pres_extensions E p F f"
   23.34 +    and cM: "c \<in> chain M"
   23.35 +    and u: "graph H h = \<Union>c"
   23.36 +    and x: "x \<in> H"
   23.37 +  shows "\<exists>H' h'. graph H' h' \<in> c
   23.38 +    \<and> (x, h x) \<in> graph H' h'
   23.39 +    \<and> linearform H' h' \<and> H' \<unlhd> E
   23.40 +    \<and> F \<unlhd> H' \<and> graph F f \<subseteq> graph H' h'
   23.41 +    \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
   23.42 +proof -
   23.43 +  from x have "(x, h x) \<in> graph H h" ..
   23.44 +  also from u have "\<dots> = \<Union>c" .
   23.45 +  finally obtain g where gc: "g \<in> c" and gh: "(x, h x) \<in> g" by blast
   23.46 +
   23.47 +  from cM have "c \<subseteq> M" ..
   23.48 +  with gc have "g \<in> M" ..
   23.49 +  also from M have "\<dots> = norm_pres_extensions E p F f" .
   23.50 +  finally obtain H' and h' where g: "g = graph H' h'"
   23.51 +    and * : "linearform H' h'"  "H' \<unlhd> E"  "F \<unlhd> H'"
   23.52 +      "graph F f \<subseteq> graph H' h'"  "\<forall>x \<in> H'. h' x \<le> p x" ..
   23.53 +
   23.54 +  from gc and g have "graph H' h' \<in> c" by (simp only:)
   23.55 +  moreover from gh and g have "(x, h x) \<in> graph H' h'" by (simp only:)
   23.56 +  ultimately show ?thesis using * by blast
   23.57 +qed
   23.58 +
   23.59 +text {*
   23.60 +  \medskip Let @{text c} be a chain of norm-preserving extensions of
   23.61 +  the function @{text f} and let @{text "graph H h"} be the supremum
   23.62 +  of @{text c}.  Every element in the domain @{text H} of the supremum
   23.63 +  function is member of the domain @{text H'} of some function @{text
   23.64 +  h'}, such that @{text h} extends @{text h'}.
   23.65 +*}
   23.66 +
   23.67 +lemma some_H'h':
   23.68 +  assumes M: "M = norm_pres_extensions E p F f"
   23.69 +    and cM: "c \<in> chain M"
   23.70 +    and u: "graph H h = \<Union>c"
   23.71 +    and x: "x \<in> H"
   23.72 +  shows "\<exists>H' h'. x \<in> H' \<and> graph H' h' \<subseteq> graph H h
   23.73 +    \<and> linearform H' h' \<and> H' \<unlhd> E \<and> F \<unlhd> H'
   23.74 +    \<and> graph F f \<subseteq> graph H' h' \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
   23.75 +proof -
   23.76 +  from M cM u x obtain H' h' where
   23.77 +      x_hx: "(x, h x) \<in> graph H' h'"
   23.78 +    and c: "graph H' h' \<in> c"
   23.79 +    and * : "linearform H' h'"  "H' \<unlhd> E"  "F \<unlhd> H'"
   23.80 +      "graph F f \<subseteq> graph H' h'"  "\<forall>x \<in> H'. h' x \<le> p x"
   23.81 +    by (rule some_H'h't [elim_format]) blast
   23.82 +  from x_hx have "x \<in> H'" ..
   23.83 +  moreover from cM u c have "graph H' h' \<subseteq> graph H h"
   23.84 +    by (simp only: chain_ball_Union_upper)
   23.85 +  ultimately show ?thesis using * by blast
   23.86 +qed
   23.87 +
   23.88 +text {*
   23.89 +  \medskip Any two elements @{text x} and @{text y} in the domain
   23.90 +  @{text H} of the supremum function @{text h} are both in the domain
   23.91 +  @{text H'} of some function @{text h'}, such that @{text h} extends
   23.92 +  @{text h'}.
   23.93 +*}
   23.94 +
   23.95 +lemma some_H'h'2:
   23.96 +  assumes M: "M = norm_pres_extensions E p F f"
   23.97 +    and cM: "c \<in> chain M"
   23.98 +    and u: "graph H h = \<Union>c"
   23.99 +    and x: "x \<in> H"
  23.100 +    and y: "y \<in> H"
  23.101 +  shows "\<exists>H' h'. x \<in> H' \<and> y \<in> H'
  23.102 +    \<and> graph H' h' \<subseteq> graph H h
  23.103 +    \<and> linearform H' h' \<and> H' \<unlhd> E \<and> F \<unlhd> H'
  23.104 +    \<and> graph F f \<subseteq> graph H' h' \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
  23.105 +proof -
  23.106 +  txt {* @{text y} is in the domain @{text H''} of some function @{text h''},
  23.107 +  such that @{text h} extends @{text h''}. *}
  23.108 +
  23.109 +  from M cM u and y obtain H' h' where
  23.110 +      y_hy: "(y, h y) \<in> graph H' h'"
  23.111 +    and c': "graph H' h' \<in> c"
  23.112 +    and * :
  23.113 +      "linearform H' h'"  "H' \<unlhd> E"  "F \<unlhd> H'"
  23.114 +      "graph F f \<subseteq> graph H' h'"  "\<forall>x \<in> H'. h' x \<le> p x"
  23.115 +    by (rule some_H'h't [elim_format]) blast
  23.116 +
  23.117 +  txt {* @{text x} is in the domain @{text H'} of some function @{text h'},
  23.118 +    such that @{text h} extends @{text h'}. *}
  23.119 +
  23.120 +  from M cM u and x obtain H'' h'' where
  23.121 +      x_hx: "(x, h x) \<in> graph H'' h''"
  23.122 +    and c'': "graph H'' h'' \<in> c"
  23.123 +    and ** :
  23.124 +      "linearform H'' h''"  "H'' \<unlhd> E"  "F \<unlhd> H''"
  23.125 +      "graph F f \<subseteq> graph H'' h''"  "\<forall>x \<in> H''. h'' x \<le> p x"
  23.126 +    by (rule some_H'h't [elim_format]) blast
  23.127 +
  23.128 +  txt {* Since both @{text h'} and @{text h''} are elements of the chain,
  23.129 +    @{text h''} is an extension of @{text h'} or vice versa. Thus both
  23.130 +    @{text x} and @{text y} are contained in the greater
  23.131 +    one. \label{cases1}*}
  23.132 +
  23.133 +  from cM c'' c' have "graph H'' h'' \<subseteq> graph H' h' \<or> graph H' h' \<subseteq> graph H'' h''"
  23.134 +    (is "?case1 \<or> ?case2") ..
  23.135 +  then show ?thesis
  23.136 +  proof
  23.137 +    assume ?case1
  23.138 +    have "(x, h x) \<in> graph H'' h''" by fact
  23.139 +    also have "\<dots> \<subseteq> graph H' h'" by fact
  23.140 +    finally have xh:"(x, h x) \<in> graph H' h'" .
  23.141 +    then have "x \<in> H'" ..
  23.142 +    moreover from y_hy have "y \<in> H'" ..
  23.143 +    moreover from cM u and c' have "graph H' h' \<subseteq> graph H h"
  23.144 +      by (simp only: chain_ball_Union_upper)
  23.145 +    ultimately show ?thesis using * by blast
  23.146 +  next
  23.147 +    assume ?case2
  23.148 +    from x_hx have "x \<in> H''" ..
  23.149 +    moreover {
  23.150 +      have "(y, h y) \<in> graph H' h'" by (rule y_hy)
  23.151 +      also have "\<dots> \<subseteq> graph H'' h''" by fact
  23.152 +      finally have "(y, h y) \<in> graph H'' h''" .
  23.153 +    } then have "y \<in> H''" ..
  23.154 +    moreover from cM u and c'' have "graph H'' h'' \<subseteq> graph H h"
  23.155 +      by (simp only: chain_ball_Union_upper)
  23.156 +    ultimately show ?thesis using ** by blast
  23.157 +  qed
  23.158 +qed
  23.159 +
  23.160 +text {*
  23.161 +  \medskip The relation induced by the graph of the supremum of a
  23.162 +  chain @{text c} is definite, i.~e.~t is the graph of a function.
  23.163 +*}
  23.164 +
  23.165 +lemma sup_definite:
  23.166 +  assumes M_def: "M \<equiv> norm_pres_extensions E p F f"
  23.167 +    and cM: "c \<in> chain M"
  23.168 +    and xy: "(x, y) \<in> \<Union>c"
  23.169 +    and xz: "(x, z) \<in> \<Union>c"
  23.170 +  shows "z = y"
  23.171 +proof -
  23.172 +  from cM have c: "c \<subseteq> M" ..
  23.173 +  from xy obtain G1 where xy': "(x, y) \<in> G1" and G1: "G1 \<in> c" ..
  23.174 +  from xz obtain G2 where xz': "(x, z) \<in> G2" and G2: "G2 \<in> c" ..
  23.175 +
  23.176 +  from G1 c have "G1 \<in> M" ..
  23.177 +  then obtain H1 h1 where G1_rep: "G1 = graph H1 h1"
  23.178 +    unfolding M_def by blast
  23.179 +
  23.180 +  from G2 c have "G2 \<in> M" ..
  23.181 +  then obtain H2 h2 where G2_rep: "G2 = graph H2 h2"
  23.182 +    unfolding M_def by blast
  23.183 +
  23.184 +  txt {* @{text "G\<^sub>1"} is contained in @{text "G\<^sub>2"}
  23.185 +    or vice versa, since both @{text "G\<^sub>1"} and @{text
  23.186 +    "G\<^sub>2"} are members of @{text c}. \label{cases2}*}
  23.187 +
  23.188 +  from cM G1 G2 have "G1 \<subseteq> G2 \<or> G2 \<subseteq> G1" (is "?case1 \<or> ?case2") ..
  23.189 +  then show ?thesis
  23.190 +  proof
  23.191 +    assume ?case1
  23.192 +    with xy' G2_rep have "(x, y) \<in> graph H2 h2" by blast
  23.193 +    then have "y = h2 x" ..
  23.194 +    also
  23.195 +    from xz' G2_rep have "(x, z) \<in> graph H2 h2" by (simp only:)
  23.196 +    then have "z = h2 x" ..
  23.197 +    finally show ?thesis .
  23.198 +  next
  23.199 +    assume ?case2
  23.200 +    with xz' G1_rep have "(x, z) \<in> graph H1 h1" by blast
  23.201 +    then have "z = h1 x" ..
  23.202 +    also
  23.203 +    from xy' G1_rep have "(x, y) \<in> graph H1 h1" by (simp only:)
  23.204 +    then have "y = h1 x" ..
  23.205 +    finally show ?thesis ..
  23.206 +  qed
  23.207 +qed
  23.208 +
  23.209 +text {*
  23.210 +  \medskip The limit function @{text h} is linear. Every element
  23.211 +  @{text x} in the domain of @{text h} is in the domain of a function
  23.212 +  @{text h'} in the chain of norm preserving extensions.  Furthermore,
  23.213 +  @{text h} is an extension of @{text h'} so the function values of
  23.214 +  @{text x} are identical for @{text h'} and @{text h}.  Finally, the
  23.215 +  function @{text h'} is linear by construction of @{text M}.
  23.216 +*}
  23.217 +
  23.218 +lemma sup_lf:
  23.219 +  assumes M: "M = norm_pres_extensions E p F f"
  23.220 +    and cM: "c \<in> chain M"
  23.221 +    and u: "graph H h = \<Union>c"
  23.222 +  shows "linearform H h"
  23.223 +proof
  23.224 +  fix x y assume x: "x \<in> H" and y: "y \<in> H"
  23.225 +  with M cM u obtain H' h' where
  23.226 +        x': "x \<in> H'" and y': "y \<in> H'"
  23.227 +      and b: "graph H' h' \<subseteq> graph H h"
  23.228 +      and linearform: "linearform H' h'"
  23.229 +      and subspace: "H' \<unlhd> E"
  23.230 +    by (rule some_H'h'2 [elim_format]) blast
  23.231 +
  23.232 +  show "h (x + y) = h x + h y"
  23.233 +  proof -
  23.234 +    from linearform x' y' have "h' (x + y) = h' x + h' y"
  23.235 +      by (rule linearform.add)
  23.236 +    also from b x' have "h' x = h x" ..
  23.237 +    also from b y' have "h' y = h y" ..
  23.238 +    also from subspace x' y' have "x + y \<in> H'"
  23.239 +      by (rule subspace.add_closed)
  23.240 +    with b have "h' (x + y) = h (x + y)" ..
  23.241 +    finally show ?thesis .
  23.242 +  qed
  23.243 +next
  23.244 +  fix x a assume x: "x \<in> H"
  23.245 +  with M cM u obtain H' h' where
  23.246 +        x': "x \<in> H'"
  23.247 +      and b: "graph H' h' \<subseteq> graph H h"
  23.248 +      and linearform: "linearform H' h'"
  23.249 +      and subspace: "H' \<unlhd> E"
  23.250 +    by (rule some_H'h' [elim_format]) blast
  23.251 +
  23.252 +  show "h (a \<cdot> x) = a * h x"
  23.253 +  proof -
  23.254 +    from linearform x' have "h' (a \<cdot> x) = a * h' x"
  23.255 +      by (rule linearform.mult)
  23.256 +    also from b x' have "h' x = h x" ..
  23.257 +    also from subspace x' have "a \<cdot> x \<in> H'"
  23.258 +      by (rule subspace.mult_closed)
  23.259 +    with b have "h' (a \<cdot> x) = h (a \<cdot> x)" ..
  23.260 +    finally show ?thesis .
  23.261 +  qed
  23.262 +qed
  23.263 +
  23.264 +text {*
  23.265 +  \medskip The limit of a non-empty chain of norm preserving
  23.266 +  extensions of @{text f} is an extension of @{text f}, since every
  23.267 +  element of the chain is an extension of @{text f} and the supremum
  23.268 +  is an extension for every element of the chain.
  23.269 +*}
  23.270 +
  23.271 +lemma sup_ext:
  23.272 +  assumes graph: "graph H h = \<Union>c"
  23.273 +    and M: "M = norm_pres_extensions E p F f"
  23.274 +    and cM: "c \<in> chain M"
  23.275 +    and ex: "\<exists>x. x \<in> c"
  23.276 +  shows "graph F f \<subseteq> graph H h"
  23.277 +proof -
  23.278 +  from ex obtain x where xc: "x \<in> c" ..
  23.279 +  from cM have "c \<subseteq> M" ..
  23.280 +  with xc have "x \<in> M" ..
  23.281 +  with M have "x \<in> norm_pres_extensions E p F f"
  23.282 +    by (simp only:)
  23.283 +  then obtain G g where "x = graph G g" and "graph F f \<subseteq> graph G g" ..
  23.284 +  then have "graph F f \<subseteq> x" by (simp only:)
  23.285 +  also from xc have "\<dots> \<subseteq> \<Union>c" by blast
  23.286 +  also from graph have "\<dots> = graph H h" ..
  23.287 +  finally show ?thesis .
  23.288 +qed
  23.289 +
  23.290 +text {*
  23.291 +  \medskip The domain @{text H} of the limit function is a superspace
  23.292 +  of @{text F}, since @{text F} is a subset of @{text H}. The
  23.293 +  existence of the @{text 0} element in @{text F} and the closure
  23.294 +  properties follow from the fact that @{text F} is a vector space.
  23.295 +*}
  23.296 +
  23.297 +lemma sup_supF:
  23.298 +  assumes graph: "graph H h = \<Union>c"
  23.299 +    and M: "M = norm_pres_extensions E p F f"
  23.300 +    and cM: "c \<in> chain M"
  23.301 +    and ex: "\<exists>x. x \<in> c"
  23.302 +    and FE: "F \<unlhd> E"
  23.303 +  shows "F \<unlhd> H"
  23.304 +proof
  23.305 +  from FE show "F \<noteq> {}" by (rule subspace.non_empty)
  23.306 +  from graph M cM ex have "graph F f \<subseteq> graph H h" by (rule sup_ext)
  23.307 +  then show "F \<subseteq> H" ..
  23.308 +  fix x y assume "x \<in> F" and "y \<in> F"
  23.309 +  with FE show "x + y \<in> F" by (rule subspace.add_closed)
  23.310 +next
  23.311 +  fix x a assume "x \<in> F"
  23.312 +  with FE show "a \<cdot> x \<in> F" by (rule subspace.mult_closed)
  23.313 +qed
  23.314 +
  23.315 +text {*
  23.316 +  \medskip The domain @{text H} of the limit function is a subspace of
  23.317 +  @{text E}.
  23.318 +*}
  23.319 +
  23.320 +lemma sup_subE:
  23.321 +  assumes graph: "graph H h = \<Union>c"
  23.322 +    and M: "M = norm_pres_extensions E p F f"
  23.323 +    and cM: "c \<in> chain M"
  23.324 +    and ex: "\<exists>x. x \<in> c"
  23.325 +    and FE: "F \<unlhd> E"
  23.326 +    and E: "vectorspace E"
  23.327 +  shows "H \<unlhd> E"
  23.328 +proof
  23.329 +  show "H \<noteq> {}"
  23.330 +  proof -
  23.331 +    from FE E have "0 \<in> F" by (rule subspace.zero)
  23.332 +    also from graph M cM ex FE have "F \<unlhd> H" by (rule sup_supF)
  23.333 +    then have "F \<subseteq> H" ..
  23.334 +    finally show ?thesis by blast
  23.335 +  qed
  23.336 +  show "H \<subseteq> E"
  23.337 +  proof
  23.338 +    fix x assume "x \<in> H"
  23.339 +    with M cM graph
  23.340 +    obtain H' h' where x: "x \<in> H'" and H'E: "H' \<unlhd> E"
  23.341 +      by (rule some_H'h' [elim_format]) blast
  23.342 +    from H'E have "H' \<subseteq> E" ..
  23.343 +    with x show "x \<in> E" ..
  23.344 +  qed
  23.345 +  fix x y assume x: "x \<in> H" and y: "y \<in> H"
  23.346 +  show "x + y \<in> H"
  23.347 +  proof -
  23.348 +    from M cM graph x y obtain H' h' where
  23.349 +          x': "x \<in> H'" and y': "y \<in> H'" and H'E: "H' \<unlhd> E"
  23.350 +        and graphs: "graph H' h' \<subseteq> graph H h"
  23.351 +      by (rule some_H'h'2 [elim_format]) blast
  23.352 +    from H'E x' y' have "x + y \<in> H'"
  23.353 +      by (rule subspace.add_closed)
  23.354 +    also from graphs have "H' \<subseteq> H" ..
  23.355 +    finally show ?thesis .
  23.356 +  qed
  23.357 +next
  23.358 +  fix x a assume x: "x \<in> H"
  23.359 +  show "a \<cdot> x \<in> H"
  23.360 +  proof -
  23.361 +    from M cM graph x
  23.362 +    obtain H' h' where x': "x \<in> H'" and H'E: "H' \<unlhd> E"
  23.363 +        and graphs: "graph H' h' \<subseteq> graph H h"
  23.364 +      by (rule some_H'h' [elim_format]) blast
  23.365 +    from H'E x' have "a \<cdot> x \<in> H'" by (rule subspace.mult_closed)
  23.366 +    also from graphs have "H' \<subseteq> H" ..
  23.367 +    finally show ?thesis .
  23.368 +  qed
  23.369 +qed
  23.370 +
  23.371 +text {*
  23.372 +  \medskip The limit function is bounded by the norm @{text p} as
  23.373 +  well, since all elements in the chain are bounded by @{text p}.
  23.374 +*}
  23.375 +
  23.376 +lemma sup_norm_pres:
  23.377 +  assumes graph: "graph H h = \<Union>c"
  23.378 +    and M: "M = norm_pres_extensions E p F f"
  23.379 +    and cM: "c \<in> chain M"
  23.380 +  shows "\<forall>x \<in> H. h x \<le> p x"
  23.381 +proof
  23.382 +  fix x assume "x \<in> H"
  23.383 +  with M cM graph obtain H' h' where x': "x \<in> H'"
  23.384 +      and graphs: "graph H' h' \<subseteq> graph H h"
  23.385 +      and a: "\<forall>x \<in> H'. h' x \<le> p x"
  23.386 +    by (rule some_H'h' [elim_format]) blast
  23.387 +  from graphs x' have [symmetric]: "h' x = h x" ..
  23.388 +  also from a x' have "h' x \<le> p x " ..
  23.389 +  finally show "h x \<le> p x" .
  23.390 +qed
  23.391 +
  23.392 +text {*
  23.393 +  \medskip The following lemma is a property of linear forms on real
  23.394 +  vector spaces. It will be used for the lemma @{text abs_Hahn_Banach}
  23.395 +  (see page \pageref{abs-Hahn_Banach}). \label{abs-ineq-iff} For real
  23.396 +  vector spaces the following inequations are equivalent:
  23.397 +  \begin{center}
  23.398 +  \begin{tabular}{lll}
  23.399 +  @{text "\<forall>x \<in> H. \<bar>h x\<bar> \<le> p x"} & and &
  23.400 +  @{text "\<forall>x \<in> H. h x \<le> p x"} \\
  23.401 +  \end{tabular}
  23.402 +  \end{center}
  23.403 +*}
  23.404 +
  23.405 +lemma abs_ineq_iff:
  23.406 +  assumes "subspace H E" and "vectorspace E" and "seminorm E p"
  23.407 +    and "linearform H h"
  23.408 +  shows "(\<forall>x \<in> H. \<bar>h x\<bar> \<le> p x) = (\<forall>x \<in> H. h x \<le> p x)" (is "?L = ?R")
  23.409 +proof
  23.410 +  interpret subspace H E by fact
  23.411 +  interpret vectorspace E by fact
  23.412 +  interpret seminorm E p by fact
  23.413 +  interpret linearform H h by fact
  23.414 +  have H: "vectorspace H" using `vectorspace E` ..
  23.415 +  {
  23.416 +    assume l: ?L
  23.417 +    show ?R
  23.418 +    proof
  23.419 +      fix x assume x: "x \<in> H"
  23.420 +      have "h x \<le> \<bar>h x\<bar>" by arith
  23.421 +      also from l x have "\<dots> \<le> p x" ..
  23.422 +      finally show "h x \<le> p x" .
  23.423 +    qed
  23.424 +  next
  23.425 +    assume r: ?R
  23.426 +    show ?L
  23.427 +    proof
  23.428 +      fix x assume x: "x \<in> H"
  23.429 +      show "\<And>a b :: real. - a \<le> b \<Longrightarrow> b \<le> a \<Longrightarrow> \<bar>b\<bar> \<le> a"
  23.430 +        by arith
  23.431 +      from `linearform H h` and H x
  23.432 +      have "- h x = h (- x)" by (rule linearform.neg [symmetric])
  23.433 +      also
  23.434 +      from H x have "- x \<in> H" by (rule vectorspace.neg_closed)
  23.435 +      with r have "h (- x) \<le> p (- x)" ..
  23.436 +      also have "\<dots> = p x"
  23.437 +	using `seminorm E p` `vectorspace E`
  23.438 +      proof (rule seminorm.minus)
  23.439 +        from x show "x \<in> E" ..
  23.440 +      qed
  23.441 +      finally have "- h x \<le> p x" .
  23.442 +      then show "- p x \<le> h x" by simp
  23.443 +      from r x show "h x \<le> p x" ..
  23.444 +    qed
  23.445 +  }
  23.446 +qed
  23.447 +
  23.448 +end
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/src/HOL/Hahn_Banach/Linearform.thy	Wed Jun 24 21:46:54 2009 +0200
    24.3 @@ -0,0 +1,60 @@
    24.4 +(*  Title:      HOL/Hahn_Banach/Linearform.thy
    24.5 +    Author:     Gertrud Bauer, TU Munich
    24.6 +*)
    24.7 +
    24.8 +header {* Linearforms *}
    24.9 +
   24.10 +theory Linearform
   24.11 +imports Vector_Space
   24.12 +begin
   24.13 +
   24.14 +text {*
   24.15 +  A \emph{linear form} is a function on a vector space into the reals
   24.16 +  that is additive and multiplicative.
   24.17 +*}
   24.18 +
   24.19 +locale linearform =
   24.20 +  fixes V :: "'a\<Colon>{minus, plus, zero, uminus} set" and f
   24.21 +  assumes add [iff]: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> f (x + y) = f x + f y"
   24.22 +    and mult [iff]: "x \<in> V \<Longrightarrow> f (a \<cdot> x) = a * f x"
   24.23 +
   24.24 +declare linearform.intro [intro?]
   24.25 +
   24.26 +lemma (in linearform) neg [iff]:
   24.27 +  assumes "vectorspace V"
   24.28 +  shows "x \<in> V \<Longrightarrow> f (- x) = - f x"
   24.29 +proof -
   24.30 +  interpret vectorspace V by fact
   24.31 +  assume x: "x \<in> V"
   24.32 +  then have "f (- x) = f ((- 1) \<cdot> x)" by (simp add: negate_eq1)
   24.33 +  also from x have "\<dots> = (- 1) * (f x)" by (rule mult)
   24.34 +  also from x have "\<dots> = - (f x)" by simp
   24.35 +  finally show ?thesis .
   24.36 +qed
   24.37 +
   24.38 +lemma (in linearform) diff [iff]:
   24.39 +  assumes "vectorspace V"
   24.40 +  shows "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> f (x - y) = f x - f y"
   24.41 +proof -
   24.42 +  interpret vectorspace V by fact
   24.43 +  assume x: "x \<in> V" and y: "y \<in> V"
   24.44 +  then have "x - y = x + - y" by (rule diff_eq1)
   24.45 +  also have "f \<dots> = f x + f (- y)" by (rule add) (simp_all add: x y)
   24.46 +  also have "f (- y) = - f y" using `vectorspace V` y by (rule neg)
   24.47 +  finally show ?thesis by simp
   24.48 +qed
   24.49 +
   24.50 +text {* Every linear form yields @{text 0} for the @{text 0} vector. *}
   24.51 +
   24.52 +lemma (in linearform) zero [iff]:
   24.53 +  assumes "vectorspace V"
   24.54 +  shows "f 0 = 0"
   24.55 +proof -
   24.56 +  interpret vectorspace V by fact
   24.57 +  have "f 0 = f (0 - 0)" by simp
   24.58 +  also have "\<dots> = f 0 - f 0" using `vectorspace V` by (rule diff) simp_all
   24.59 +  also have "\<dots> = 0" by simp
   24.60 +  finally show ?thesis .
   24.61 +qed
   24.62 +
   24.63 +end
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/src/HOL/Hahn_Banach/Normed_Space.thy	Wed Jun 24 21:46:54 2009 +0200
    25.3 @@ -0,0 +1,117 @@
    25.4 +(*  Title:      HOL/Hahn_Banach/Normed_Space.thy
    25.5 +    Author:     Gertrud Bauer, TU Munich
    25.6 +*)
    25.7 +
    25.8 +header {* Normed vector spaces *}
    25.9 +
   25.10 +theory Normed_Space
   25.11 +imports Subspace
   25.12 +begin
   25.13 +
   25.14 +subsection {* Quasinorms *}
   25.15 +
   25.16 +text {*
   25.17 +  A \emph{seminorm} @{text "\<parallel>\<cdot>\<parallel>"} is a function on a real vector space
   25.18 +  into the reals that has the following properties: it is positive
   25.19 +  definite, absolute homogenous and subadditive.
   25.20 +*}
   25.21 +
   25.22 +locale norm_syntax =
   25.23 +  fixes norm :: "'a \<Rightarrow> real"    ("\<parallel>_\<parallel>")
   25.24 +
   25.25 +locale seminorm = var_V + norm_syntax +
   25.26 +  constrains V :: "'a\<Colon>{minus, plus, zero, uminus} set"
   25.27 +  assumes ge_zero [iff?]: "x \<in> V \<Longrightarrow> 0 \<le> \<parallel>x\<parallel>"
   25.28 +    and abs_homogenous [iff?]: "x \<in> V \<Longrightarrow> \<parallel>a \<cdot> x\<parallel> = \<bar>a\<bar> * \<parallel>x\<parallel>"
   25.29 +    and subadditive [iff?]: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> \<parallel>x + y\<parallel> \<le> \<parallel>x\<parallel> + \<parallel>y\<parallel>"
   25.30 +
   25.31 +declare seminorm.intro [intro?]
   25.32 +
   25.33 +lemma (in seminorm) diff_subadditive:
   25.34 +  assumes "vectorspace V"
   25.35 +  shows "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> \<parallel>x - y\<parallel> \<le> \<parallel>x\<parallel> + \<parallel>y\<parallel>"
   25.36 +proof -
   25.37 +  interpret vectorspace V by fact
   25.38 +  assume x: "x \<in> V" and y: "y \<in> V"
   25.39 +  then have "x - y = x + - 1 \<cdot> y"
   25.40 +    by (simp add: diff_eq2 negate_eq2a)
   25.41 +  also from x y have "\<parallel>\<dots>\<parallel> \<le> \<parallel>x\<parallel> + \<parallel>- 1 \<cdot> y\<parallel>"
   25.42 +    by (simp add: subadditive)
   25.43 +  also from y have "\<parallel>- 1 \<cdot> y\<parallel> = \<bar>- 1\<bar> * \<parallel>y\<parallel>"
   25.44 +    by (rule abs_homogenous)
   25.45 +  also have "\<dots> = \<parallel>y\<parallel>" by simp
   25.46 +  finally show ?thesis .
   25.47 +qed
   25.48 +
   25.49 +lemma (in seminorm) minus:
   25.50 +  assumes "vectorspace V"
   25.51 +  shows "x \<in> V \<Longrightarrow> \<parallel>- x\<parallel> = \<parallel>x\<parallel>"
   25.52 +proof -
   25.53 +  interpret vectorspace V by fact
   25.54 +  assume x: "x \<in> V"
   25.55 +  then have "- x = - 1 \<cdot> x" by (simp only: negate_eq1)
   25.56 +  also from x have "\<parallel>\<dots>\<parallel> = \<bar>- 1\<bar> * \<parallel>x\<parallel>"
   25.57 +    by (rule abs_homogenous)
   25.58 +  also have "\<dots> = \<parallel>x\<parallel>" by simp
   25.59 +  finally show ?thesis .
   25.60 +qed
   25.61 +
   25.62 +
   25.63 +subsection {* Norms *}
   25.64 +
   25.65 +text {*
   25.66 +  A \emph{norm} @{text "\<parallel>\<cdot>\<parallel>"} is a seminorm that maps only the
   25.67 +  @{text 0} vector to @{text 0}.
   25.68 +*}
   25.69 +
   25.70 +locale norm = seminorm +
   25.71 +  assumes zero_iff [iff]: "x \<in> V \<Longrightarrow> (\<parallel>x\<parallel> = 0) = (x = 0)"
   25.72 +
   25.73 +
   25.74 +subsection {* Normed vector spaces *}
   25.75 +
   25.76 +text {*
   25.77 +  A vector space together with a norm is called a \emph{normed
   25.78 +  space}.
   25.79 +*}
   25.80 +
   25.81 +locale normed_vectorspace = vectorspace + norm
   25.82 +
   25.83 +declare normed_vectorspace.intro [intro?]
   25.84 +
   25.85 +lemma (in normed_vectorspace) gt_zero [intro?]:
   25.86 +  "x \<in> V \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> 0 < \<parallel>x\<parallel>"
   25.87 +proof -
   25.88 +  assume x: "x \<in> V" and neq: "x \<noteq> 0"
   25.89 +  from x have "0 \<le> \<parallel>x\<parallel>" ..
   25.90 +  also have [symmetric]: "\<dots> \<noteq> 0"
   25.91 +  proof
   25.92 +    assume "\<parallel>x\<parallel> = 0"
   25.93 +    with x have "x = 0" by simp
   25.94 +    with neq show False by contradiction
   25.95 +  qed
   25.96 +  finally show ?thesis .
   25.97 +qed
   25.98 +
   25.99 +text {*
  25.100 +  Any subspace of a normed vector space is again a normed vectorspace.
  25.101 +*}
  25.102 +
  25.103 +lemma subspace_normed_vs [intro?]:
  25.104 +  fixes F E norm
  25.105 +  assumes "subspace F E" "normed_vectorspace E norm"
  25.106 +  shows "normed_vectorspace F norm"
  25.107 +proof -
  25.108 +  interpret subspace F E by fact
  25.109 +  interpret normed_vectorspace E norm by fact
  25.110 +  show ?thesis
  25.111 +  proof
  25.112 +    show "vectorspace F" by (rule vectorspace) unfold_locales
  25.113 +  next
  25.114 +    have "Normed_Space.norm E norm" ..
  25.115 +    with subset show "Normed_Space.norm F norm"
  25.116 +      by (simp add: norm_def seminorm_def norm_axioms_def)
  25.117 +  qed
  25.118 +qed
  25.119 +
  25.120 +end
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/src/HOL/Hahn_Banach/README.html	Wed Jun 24 21:46:54 2009 +0200
    26.3 @@ -0,0 +1,38 @@
    26.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    26.5 +
    26.6 +<!-- $Id$ -->
    26.7 +
    26.8 +<HTML>
    26.9 +
   26.10 +<HEAD>
   26.11 +  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   26.12 +  <TITLE>HOL/Hahn_Banach/README</TITLE>
   26.13 +</HEAD>
   26.14 +
   26.15 +<BODY>
   26.16 +
   26.17 +<H3>The Hahn-Banach Theorem for Real Vector Spaces (Isabelle/Isar)</H3>
   26.18 +
   26.19 +Author: Gertrud Bauer, Technische Universit&auml;t M&uuml;nchen<P>
   26.20 +
   26.21 +This directory contains the proof of the Hahn-Banach theorem for real vectorspaces,
   26.22 +following H. Heuser, Funktionalanalysis, p. 228 -232.
   26.23 +The Hahn-Banach theorem is one of the fundamental theorems of functioal analysis.
   26.24 +It is a conclusion of Zorn's lemma.<P>
   26.25 +
   26.26 +Two different formaulations of the theorem are presented, one for general real vectorspaces
   26.27 +and its application to normed vectorspaces. <P>
   26.28 +
   26.29 +The theorem says, that every continous linearform, defined on arbitrary subspaces
   26.30 +(not only one-dimensional subspaces), can be extended to a continous linearform on
   26.31 +the whole vectorspace.
   26.32 +
   26.33 +
   26.34 +<HR>
   26.35 +
   26.36 +<ADDRESS>
   26.37 +<A NAME="bauerg@in.tum.de" HREF="mailto:bauerg@in.tum.de">bauerg@in.tum.de</A>
   26.38 +</ADDRESS>
   26.39 +
   26.40 +</BODY>
   26.41 +</HTML>
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/src/HOL/Hahn_Banach/ROOT.ML	Wed Jun 24 21:46:54 2009 +0200
    27.3 @@ -0,0 +1,7 @@
    27.4 +(*  Title:      HOL/Hahn_Banach/ROOT.ML
    27.5 +    Author:     Gertrud Bauer, TU Munich
    27.6 +
    27.7 +The Hahn-Banach theorem for real vector spaces (Isabelle/Isar).
    27.8 +*)
    27.9 +
   27.10 +use_thy "Hahn_Banach";
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/src/HOL/Hahn_Banach/Subspace.thy	Wed Jun 24 21:46:54 2009 +0200
    28.3 @@ -0,0 +1,513 @@
    28.4 +(*  Title:      HOL/Hahn_Banach/Subspace.thy
    28.5 +    Author:     Gertrud Bauer, TU Munich
    28.6 +*)
    28.7 +
    28.8 +header {* Subspaces *}
    28.9 +
   28.10 +theory Subspace
   28.11 +imports Vector_Space
   28.12 +begin
   28.13 +
   28.14 +subsection {* Definition *}
   28.15 +
   28.16 +text {*
   28.17 +  A non-empty subset @{text U} of a vector space @{text V} is a
   28.18 +  \emph{subspace} of @{text V}, iff @{text U} is closed under addition
   28.19 +  and scalar multiplication.
   28.20 +*}
   28.21 +
   28.22 +locale subspace =
   28.23 +  fixes U :: "'a\<Colon>{minus, plus, zero, uminus} set" and V
   28.24 +  assumes non_empty [iff, intro]: "U \<noteq> {}"
   28.25 +    and subset [iff]: "U \<subseteq> V"
   28.26 +    and add_closed [iff]: "x \<in> U \<Longrightarrow> y \<in> U \<Longrightarrow> x + y \<in> U"
   28.27 +    and mult_closed [iff]: "x \<in> U \<Longrightarrow> a \<cdot> x \<in> U"
   28.28 +
   28.29 +notation (symbols)
   28.30 +  subspace  (infix "\<unlhd>" 50)
   28.31 +
   28.32 +declare vectorspace.intro [intro?] subspace.intro [intro?]
   28.33 +
   28.34 +lemma subspace_subset [elim]: "U \<unlhd> V \<Longrightarrow> U \<subseteq> V"
   28.35 +  by (rule subspace.subset)
   28.36 +
   28.37 +lemma (in subspace) subsetD [iff]: "x \<in> U \<Longrightarrow> x \<in> V"
   28.38 +  using subset by blast
   28.39 +
   28.40 +lemma subspaceD [elim]: "U \<unlhd> V \<Longrightarrow> x \<in> U \<Longrightarrow> x \<in> V"
   28.41 +  by (rule subspace.subsetD)
   28.42 +
   28.43 +lemma rev_subspaceD [elim?]: "x \<in> U \<Longrightarrow> U \<unlhd> V \<Longrightarrow> x \<in> V"
   28.44 +  by (rule subspace.subsetD)
   28.45 +
   28.46 +lemma (in subspace) diff_closed [iff]:
   28.47 +  assumes "vectorspace V"
   28.48 +  assumes x: "x \<in> U" and y: "y \<in> U"
   28.49 +  shows "x - y \<in> U"
   28.50 +proof -
   28.51 +  interpret vectorspace V by fact
   28.52 +  from x y show ?thesis by (simp add: diff_eq1 negate_eq1)
   28.53 +qed
   28.54 +
   28.55 +text {*
   28.56 +  \medskip Similar as for linear spaces, the existence of the zero
   28.57 +  element in every subspace follows from the non-emptiness of the
   28.58 +  carrier set and by vector space laws.
   28.59 +*}
   28.60 +
   28.61 +lemma (in subspace) zero [intro]:
   28.62 +  assumes "vectorspace V"
   28.63 +  shows "0 \<in> U"
   28.64 +proof -
   28.65 +  interpret V: vectorspace V by fact
   28.66 +  have "U \<noteq> {}" by (rule non_empty)
   28.67 +  then obtain x where x: "x \<in> U" by blast
   28.68 +  then have "x \<in> V" .. then have "0 = x - x" by simp
   28.69 +  also from `vectorspace V` x x have "\<dots> \<in> U" by (rule diff_closed)
   28.70 +  finally show ?thesis .
   28.71 +qed
   28.72 +
   28.73 +lemma (in subspace) neg_closed [iff]:
   28.74 +  assumes "vectorspace V"
   28.75 +  assumes x: "x \<in> U"
   28.76 +  shows "- x \<in> U"
   28.77 +proof -
   28.78 +  interpret vectorspace V by fact
   28.79 +  from x show ?thesis by (simp add: negate_eq1)
   28.80 +qed
   28.81 +
   28.82 +text {* \medskip Further derived laws: every subspace is a vector space. *}
   28.83 +
   28.84 +lemma (in subspace) vectorspace [iff]:
   28.85 +  assumes "vectorspace V"
   28.86 +  shows "vectorspace U"
   28.87 +proof -
   28.88 +  interpret vectorspace V by fact
   28.89 +  show ?thesis
   28.90 +  proof
   28.91 +    show "U \<noteq> {}" ..
   28.92 +    fix x y z assume x: "x \<in> U" and y: "y \<in> U" and z: "z \<in> U"
   28.93 +    fix a b :: real
   28.94 +    from x y show "x + y \<in> U" by simp
   28.95 +    from x show "a \<cdot> x \<in> U" by simp
   28.96 +    from x y z show "(x + y) + z = x + (y + z)" by (simp add: add_ac)
   28.97 +    from x y show "x + y = y + x" by (simp add: add_ac)
   28.98 +    from x show "x - x = 0" by simp
   28.99 +    from x show "0 + x = x" by simp
  28.100 +    from x y show "a \<cdot> (x + y) = a \<cdot> x + a \<cdot> y" by (simp add: distrib)
  28.101 +    from x show "(a + b) \<cdot> x = a \<cdot> x + b \<cdot> x" by (simp add: distrib)
  28.102 +    from x show "(a * b) \<cdot> x = a \<cdot> b \<cdot> x" by (simp add: mult_assoc)
  28.103 +    from x show "1 \<cdot> x = x" by simp
  28.104 +    from x show "- x = - 1 \<cdot> x" by (simp add: negate_eq1)
  28.105 +    from x y show "x - y = x + - y" by (simp add: diff_eq1)
  28.106 +  qed
  28.107 +qed
  28.108 +
  28.109 +
  28.110 +text {* The subspace relation is reflexive. *}
  28.111 +
  28.112 +lemma (in vectorspace) subspace_refl [intro]: "V \<unlhd> V"
  28.113 +proof
  28.114 +  show "V \<noteq> {}" ..
  28.115 +  show "V \<subseteq> V" ..
  28.116 +  fix x y assume x: "x \<in> V" and y: "y \<in> V"
  28.117 +  fix a :: real
  28.118 +  from x y show "x + y \<in> V" by simp
  28.119 +  from x show "a \<cdot> x \<in> V" by simp
  28.120 +qed
  28.121 +
  28.122 +text {* The subspace relation is transitive. *}
  28.123 +
  28.124 +lemma (in vectorspace) subspace_trans [trans]:
  28.125 +  "U \<unlhd> V \<Longrightarrow> V \<unlhd> W \<Longrightarrow> U \<unlhd> W"
  28.126 +proof
  28.127 +  assume uv: "U \<unlhd> V" and vw: "V \<unlhd> W"
  28.128 +  from uv show "U \<noteq> {}" by (rule subspace.non_empty)
  28.129 +  show "U \<subseteq> W"
  28.130 +  proof -
  28.131 +    from uv have "U \<subseteq> V" by (rule subspace.subset)
  28.132 +    also from vw have "V \<subseteq> W" by (rule subspace.subset)
  28.133 +    finally show ?thesis .
  28.134 +  qed
  28.135 +  fix x y assume x: "x \<in> U" and y: "y \<in> U"
  28.136 +  from uv and x y show "x + y \<in> U" by (rule subspace.add_closed)
  28.137 +  from uv and x show "\<And>a. a \<cdot> x \<in> U" by (rule subspace.mult_closed)
  28.138 +qed
  28.139 +
  28.140 +
  28.141 +subsection {* Linear closure *}
  28.142 +
  28.143 +text {*
  28.144 +  The \emph{linear closure} of a vector @{text x} is the set of all
  28.145 +  scalar multiples of @{text x}.
  28.146 +*}
  28.147 +
  28.148 +definition
  28.149 +  lin :: "('a::{minus, plus, zero}) \<Rightarrow> 'a set" where
  28.150 +  "lin x = {a \<cdot> x | a. True}"
  28.151 +
  28.152 +lemma linI [intro]: "y = a \<cdot> x \<Longrightarrow> y \<in> lin x"
  28.153 +  unfolding lin_def by blast
  28.154 +
  28.155 +lemma linI' [iff]: "a \<cdot> x \<in> lin x"
  28.156 +  unfolding lin_def by blast
  28.157 +
  28.158 +lemma linE [elim]: "x \<in> lin v \<Longrightarrow> (\<And>a::real. x = a \<cdot> v \<Longrightarrow> C) \<Longrightarrow> C"
  28.159 +  unfolding lin_def by blast
  28.160 +
  28.161 +
  28.162 +text {* Every vector is contained in its linear closure. *}
  28.163 +
  28.164 +lemma (in vectorspace) x_lin_x [iff]: "x \<in> V \<Longrightarrow> x \<in> lin x"
  28.165 +proof -
  28.166 +  assume "x \<in> V"
  28.167 +  then have "x = 1 \<cdot> x" by simp
  28.168 +  also have "\<dots> \<in> lin x" ..
  28.169 +  finally show ?thesis .
  28.170 +qed
  28.171 +
  28.172 +lemma (in vectorspace) "0_lin_x" [iff]: "x \<in> V \<Longrightarrow> 0 \<in> lin x"
  28.173 +proof
  28.174 +  assume "x \<in> V"
  28.175 +  then show "0 = 0 \<cdot> x" by simp
  28.176 +qed
  28.177 +
  28.178 +text {* Any linear closure is a subspace. *}
  28.179 +
  28.180 +lemma (in vectorspace) lin_subspace [intro]:
  28.181 +  "x \<in> V \<Longrightarrow> lin x \<unlhd> V"
  28.182 +proof
  28.183 +  assume x: "x \<in> V"
  28.184 +  then show "lin x \<noteq> {}" by (auto simp add: x_lin_x)
  28.185 +  show "lin x \<subseteq> V"
  28.186 +  proof
  28.187 +    fix x' assume "x' \<in> lin x"
  28.188 +    then obtain a where "x' = a \<cdot> x" ..
  28.189 +    with x show "x' \<in> V" by simp
  28.190 +  qed
  28.191 +  fix x' x'' assume x': "x' \<in> lin x" and x'': "x'' \<in> lin x"
  28.192 +  show "x' + x'' \<in> lin x"
  28.193 +  proof -
  28.194 +    from x' obtain a' where "x' = a' \<cdot> x" ..
  28.195 +    moreover from x'' obtain a'' where "x'' = a'' \<cdot> x" ..
  28.196 +    ultimately have "x' + x'' = (a' + a'') \<cdot> x"
  28.197 +      using x by (simp add: distrib)
  28.198 +    also have "\<dots> \<in> lin x" ..
  28.199 +    finally show ?thesis .
  28.200 +  qed
  28.201 +  fix a :: real
  28.202 +  show "a \<cdot> x' \<in> lin x"
  28.203 +  proof -
  28.204 +    from x' obtain a' where "x' = a' \<cdot> x" ..
  28.205 +    with x have "a \<cdot> x' = (a * a') \<cdot> x" by (simp add: mult_assoc)
  28.206 +    also have "\<dots> \<in> lin x" ..
  28.207 +    finally show ?thesis .
  28.208 +  qed
  28.209 +qed
  28.210 +
  28.211 +
  28.212 +text {* Any linear closure is a vector space. *}
  28.213 +
  28.214 +lemma (in vectorspace) lin_vectorspace [intro]:
  28.215 +  assumes "x \<in> V"
  28.216 +  shows "vectorspace (lin x)"
  28.217 +proof -
  28.218 +  from `x \<in> V` have "subspace (lin x) V"
  28.219 +    by (rule lin_subspace)
  28.220 +  from this and vectorspace_axioms show ?thesis
  28.221 +    by (rule subspace.vectorspace)
  28.222 +qed
  28.223 +
  28.224 +
  28.225 +subsection {* Sum of two vectorspaces *}
  28.226 +
  28.227 +text {*
  28.228 +  The \emph{sum} of two vectorspaces @{text U} and @{text V} is the
  28.229 +  set of all sums of elements from @{text U} and @{text V}.
  28.230 +*}
  28.231 +
  28.232 +instantiation "fun" :: (type, type) plus
  28.233 +begin
  28.234 +
  28.235 +definition
  28.236 +  sum_def: "plus_fun U V = {u + v | u v. u \<in> U \<and> v \<in> V}"  (* FIXME not fully general!? *)
  28.237 +
  28.238 +instance ..
  28.239 +
  28.240 +end
  28.241 +
  28.242 +lemma sumE [elim]:
  28.243 +    "x \<in> U + V \<Longrightarrow> (\<And>u v. x = u + v \<Longrightarrow> u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> C) \<Longrightarrow> C"
  28.244 +  unfolding sum_def by blast
  28.245 +
  28.246 +lemma sumI [intro]:
  28.247 +    "u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> x = u + v \<Longrightarrow> x \<in> U + V"
  28.248 +  unfolding sum_def by blast
  28.249 +
  28.250 +lemma sumI' [intro]:
  28.251 +    "u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> u + v \<in> U + V"
  28.252 +  unfolding sum_def by blast
  28.253 +
  28.254 +text {* @{text U} is a subspace of @{text "U + V"}. *}
  28.255 +
  28.256 +lemma subspace_sum1 [iff]:
  28.257 +  assumes "vectorspace U" "vectorspace V"
  28.258 +  shows "U \<unlhd> U + V"
  28.259 +proof -
  28.260 +  interpret vectorspace U by fact
  28.261 +  interpret vectorspace V by fact
  28.262 +  show ?thesis
  28.263 +  proof
  28.264 +    show "U \<noteq> {}" ..
  28.265 +    show "U \<subseteq> U + V"
  28.266 +    proof
  28.267 +      fix x assume x: "x \<in> U"
  28.268 +      moreover have "0 \<in> V" ..
  28.269 +      ultimately have "x + 0 \<in> U + V" ..
  28.270 +      with x show "x \<in> U + V" by simp
  28.271 +    qed
  28.272 +    fix x y assume x: "x \<in> U" and "y \<in> U"
  28.273 +    then show "x + y \<in> U" by simp
  28.274 +    from x show "\<And>a. a \<cdot> x \<in> U" by simp
  28.275 +  qed
  28.276 +qed
  28.277 +
  28.278 +text {* The sum of two subspaces is again a subspace. *}
  28.279 +
  28.280 +lemma sum_subspace [intro?]:
  28.281 +  assumes "subspace U E" "vectorspace E" "subspace V E"
  28.282 +  shows "U + V \<unlhd> E"
  28.283 +proof -
  28.284 +  interpret subspace U E by fact
  28.285 +  interpret vectorspace E by fact
  28.286 +  interpret subspace V E by fact
  28.287 +  show ?thesis
  28.288 +  proof
  28.289 +    have "0 \<in> U + V"
  28.290 +    proof
  28.291 +      show "0 \<in> U" using `vectorspace E` ..
  28.292 +      show "0 \<in> V" using `vectorspace E` ..
  28.293 +      show "(0::'a) = 0 + 0" by simp
  28.294 +    qed
  28.295 +    then show "U + V \<noteq> {}" by blast
  28.296 +    show "U + V \<subseteq> E"
  28.297 +    proof
  28.298 +      fix x assume "x \<in> U + V"
  28.299 +      then obtain u v where "x = u + v" and
  28.300 +	"u \<in> U" and "v \<in> V" ..
  28.301 +      then show "x \<in> E" by simp
  28.302 +    qed
  28.303 +    fix x y assume x: "x \<in> U + V" and y: "y \<in> U + V"
  28.304 +    show "x + y \<in> U + V"
  28.305 +    proof -
  28.306 +      from x obtain ux vx where "x = ux + vx" and "ux \<in> U" and "vx \<in> V" ..
  28.307 +      moreover
  28.308 +      from y obtain uy vy where "y = uy + vy" and "uy \<in> U" and "vy \<in> V" ..
  28.309 +      ultimately
  28.310 +      have "ux + uy \<in> U"
  28.311 +	and "vx + vy \<in> V"
  28.312 +	and "x + y = (ux + uy) + (vx + vy)"
  28.313 +	using x y by (simp_all add: add_ac)
  28.314 +      then show ?thesis ..
  28.315 +    qed
  28.316 +    fix a show "a \<cdot> x \<in> U + V"
  28.317 +    proof -
  28.318 +      from x obtain u v where "x = u + v" and "u \<in> U" and "v \<in> V" ..
  28.319 +      then have "a \<cdot> u \<in> U" and "a \<cdot> v \<in> V"
  28.320 +	and "a \<cdot> x = (a \<cdot> u) + (a \<cdot> v)" by (simp_all add: distrib)
  28.321 +      then show ?thesis ..
  28.322 +    qed
  28.323 +  qed
  28.324 +qed
  28.325 +
  28.326 +text{* The sum of two subspaces is a vectorspace. *}
  28.327 +
  28.328 +lemma sum_vs [intro?]:
  28.329 +    "U \<unlhd> E \<Longrightarrow> V \<unlhd> E \<Longrightarrow> vectorspace E \<Longrightarrow> vectorspace (U + V)"
  28.330 +  by (rule subspace.vectorspace) (rule sum_subspace)
  28.331 +
  28.332 +
  28.333 +subsection {* Direct sums *}
  28.334 +
  28.335 +text {*
  28.336 +  The sum of @{text U} and @{text V} is called \emph{direct}, iff the
  28.337 +  zero element is the only common element of @{text U} and @{text
  28.338 +  V}. For every element @{text x} of the direct sum of @{text U} and
  28.339 +  @{text V} the decomposition in @{text "x = u + v"} with
  28.340 +  @{text "u \<in> U"} and @{text "v \<in> V"} is unique.
  28.341 +*}
  28.342 +
  28.343 +lemma decomp:
  28.344 +  assumes "vectorspace E" "subspace U E" "subspace V E"
  28.345 +  assumes direct: "U \<inter> V = {0}"
  28.346 +    and u1: "u1 \<in> U" and u2: "u2 \<in> U"
  28.347 +    and v1: "v1 \<in> V" and v2: "v2 \<in> V"
  28.348 +    and sum: "u1 + v1 = u2 + v2"
  28.349 +  shows "u1 = u2 \<and> v1 = v2"
  28.350 +proof -
  28.351 +  interpret vectorspace E by fact
  28.352 +  interpret subspace U E by fact
  28.353 +  interpret subspace V E by fact
  28.354 +  show ?thesis
  28.355 +  proof
  28.356 +    have U: "vectorspace U"  (* FIXME: use interpret *)
  28.357 +      using `subspace U E` `vectorspace E` by (rule subspace.vectorspace)
  28.358 +    have V: "vectorspace V"
  28.359 +      using `subspace V E` `vectorspace E` by (rule subspace.vectorspace)
  28.360 +    from u1 u2 v1 v2 and sum have eq: "u1 - u2 = v2 - v1"
  28.361 +      by (simp add: add_diff_swap)
  28.362 +    from u1 u2 have u: "u1 - u2 \<in> U"
  28.363 +      by (rule vectorspace.diff_closed [OF U])
  28.364 +    with eq have v': "v2 - v1 \<in> U" by (simp only:)
  28.365 +    from v2 v1 have v: "v2 - v1 \<in> V"
  28.366 +      by (rule vectorspace.diff_closed [OF V])
  28.367 +    with eq have u': " u1 - u2 \<in> V" by (simp only:)
  28.368 +    
  28.369 +    show "u1 = u2"
  28.370 +    proof (rule add_minus_eq)
  28.371 +      from u1 show "u1 \<in> E" ..
  28.372 +      from u2 show "u2 \<in> E" ..
  28.373 +      from u u' and direct show "u1 - u2 = 0" by blast
  28.374 +    qed
  28.375 +    show "v1 = v2"
  28.376 +    proof (rule add_minus_eq [symmetric])
  28.377 +      from v1 show "v1 \<in> E" ..
  28.378 +      from v2 show "v2 \<in> E" ..
  28.379 +      from v v' and direct show "v2 - v1 = 0" by blast
  28.380 +    qed
  28.381 +  qed
  28.382 +qed
  28.383 +
  28.384 +text {*
  28.385 +  An application of the previous lemma will be used in the proof of
  28.386 +  the Hahn-Banach Theorem (see page \pageref{decomp-H-use}): for any
  28.387 +  element @{text "y + a \<cdot> x\<^sub>0"} of the direct sum of a
  28.388 +  vectorspace @{text H} and the linear closure of @{text "x\<^sub>0"}
  28.389 +  the components @{text "y \<in> H"} and @{text a} are uniquely
  28.390 +  determined.
  28.391 +*}
  28.392 +
  28.393 +lemma decomp_H':
  28.394 +  assumes "vectorspace E" "subspace H E"
  28.395 +  assumes y1: "y1 \<in> H" and y2: "y2 \<in> H"
  28.396 +    and x': "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
  28.397 +    and eq: "y1 + a1 \<cdot> x' = y2 + a2 \<cdot> x'"
  28.398 +  shows "y1 = y2 \<and> a1 = a2"
  28.399 +proof -
  28.400 +  interpret vectorspace E by fact
  28.401 +  interpret subspace H E by fact
  28.402 +  show ?thesis
  28.403 +  proof
  28.404 +    have c: "y1 = y2 \<and> a1 \<cdot> x' = a2 \<cdot> x'"
  28.405 +    proof (rule decomp)
  28.406 +      show "a1 \<cdot> x' \<in> lin x'" ..
  28.407 +      show "a2 \<cdot> x' \<in> lin x'" ..
  28.408 +      show "H \<inter> lin x' = {0}"
  28.409 +      proof
  28.410 +	show "H \<inter> lin x' \<subseteq> {0}"
  28.411 +	proof
  28.412 +          fix x assume x: "x \<in> H \<inter> lin x'"
  28.413 +          then obtain a where xx': "x = a \<cdot> x'"
  28.414 +            by blast
  28.415 +          have "x = 0"
  28.416 +          proof cases
  28.417 +            assume "a = 0"
  28.418 +            with xx' and x' show ?thesis by simp
  28.419 +          next
  28.420 +            assume a: "a \<noteq> 0"
  28.421 +            from x have "x \<in> H" ..
  28.422 +            with xx' have "inverse a \<cdot> a \<cdot> x' \<in> H" by simp
  28.423 +            with a and x' have "x' \<in> H" by (simp add: mult_assoc2)
  28.424 +            with `x' \<notin> H` show ?thesis by contradiction
  28.425 +          qed
  28.426 +          then show "x \<in> {0}" ..
  28.427 +	qed
  28.428 +	show "{0} \<subseteq> H \<inter> lin x'"
  28.429 +	proof -
  28.430 +          have "0 \<in> H" using `vectorspace E` ..
  28.431 +          moreover have "0 \<in> lin x'" using `x' \<in> E` ..
  28.432 +          ultimately show ?thesis by blast
  28.433 +	qed
  28.434 +      qed
  28.435 +      show "lin x' \<unlhd> E" using `x' \<in> E` ..
  28.436 +    qed (rule `vectorspace E`, rule `subspace H E`, rule y1, rule y2, rule eq)
  28.437 +    then show "y1 = y2" ..
  28.438 +    from c have "a1 \<cdot> x' = a2 \<cdot> x'" ..
  28.439 +    with x' show "a1 = a2" by (simp add: mult_right_cancel)
  28.440 +  qed
  28.441 +qed
  28.442 +
  28.443 +text {*
  28.444 +  Since for any element @{text "y + a \<cdot> x'"} of the direct sum of a
  28.445 +  vectorspace @{text H} and the linear closure of @{text x'} the
  28.446 +  components @{text "y \<in> H"} and @{text a} are unique, it follows from
  28.447 +  @{text "y \<in> H"} that @{text "a = 0"}.
  28.448 +*}
  28.449 +
  28.450 +lemma decomp_H'_H:
  28.451 +  assumes "vectorspace E" "subspace H E"
  28.452 +  assumes t: "t \<in> H"
  28.453 +    and x': "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
  28.454 +  shows "(SOME (y, a). t = y + a \<cdot> x' \<and> y \<in> H) = (t, 0)"
  28.455 +proof -
  28.456 +  interpret vectorspace E by fact
  28.457 +  interpret subspace H E by fact
  28.458 +  show ?thesis
  28.459 +  proof (rule, simp_all only: split_paired_all split_conv)
  28.460 +    from t x' show "t = t + 0 \<cdot> x' \<and> t \<in> H" by simp
  28.461 +    fix y and a assume ya: "t = y + a \<cdot> x' \<and> y \<in> H"
  28.462 +    have "y = t \<and> a = 0"
  28.463 +    proof (rule decomp_H')
  28.464 +      from ya x' show "y + a \<cdot> x' = t + 0 \<cdot> x'" by simp
  28.465 +      from ya show "y \<in> H" ..
  28.466 +    qed (rule `vectorspace E`, rule `subspace H E`, rule t, (rule x')+)
  28.467 +    with t x' show "(y, a) = (y + a \<cdot> x', 0)" by simp
  28.468 +  qed
  28.469 +qed
  28.470 +
  28.471 +text {*
  28.472 +  The components @{text "y \<in> H"} and @{text a} in @{text "y + a \<cdot> x'"}
  28.473 +  are unique, so the function @{text h'} defined by
  28.474 +  @{text "h' (y + a \<cdot> x') = h y + a \<cdot> \<xi>"} is definite.
  28.475 +*}
  28.476 +
  28.477 +lemma h'_definite:
  28.478 +  fixes H
  28.479 +  assumes h'_def:
  28.480 +    "h' \<equiv> (\<lambda>x. let (y, a) = SOME (y, a). (x = y + a \<cdot> x' \<and> y \<in> H)
  28.481 +                in (h y) + a * xi)"
  28.482 +    and x: "x = y + a \<cdot> x'"
  28.483 +  assumes "vectorspace E" "subspace H E"
  28.484 +  assumes y: "y \<in> H"
  28.485 +    and x': "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
  28.486 +  shows "h' x = h y + a * xi"
  28.487 +proof -
  28.488 +  interpret vectorspace E by fact
  28.489 +  interpret subspace H E by fact
  28.490 +  from x y x' have "x \<in> H + lin x'" by auto
  28.491 +  have "\<exists>!p. (\<lambda>(y, a). x = y + a \<cdot> x' \<and> y \<in> H) p" (is "\<exists>!p. ?P p")
  28.492 +  proof (rule ex_ex1I)
  28.493 +    from x y show "\<exists>p. ?P p" by blast
  28.494 +    fix p q assume p: "?P p" and q: "?P q"
  28.495 +    show "p = q"
  28.496 +    proof -
  28.497 +      from p have xp: "x = fst p + snd p \<cdot> x' \<and> fst p \<in> H"
  28.498 +        by (cases p) simp
  28.499 +      from q have xq: "x = fst q + snd q \<cdot> x' \<and> fst q \<in> H"
  28.500 +        by (cases q) simp
  28.501 +      have "fst p = fst q \<and> snd p = snd q"
  28.502 +      proof (rule decomp_H')
  28.503 +        from xp show "fst p \<in> H" ..
  28.504 +        from xq show "fst q \<in> H" ..
  28.505 +        from xp and xq show "fst p + snd p \<cdot> x' = fst q + snd q \<cdot> x'"
  28.506 +          by simp
  28.507 +      qed (rule `vectorspace E`, rule `subspace H E`, (rule x')+)
  28.508 +      then show ?thesis by (cases p, cases q) simp
  28.509 +    qed
  28.510 +  qed
  28.511 +  then have eq: "(SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H) = (y, a)"
  28.512 +    by (rule some1_equality) (simp add: x y)
  28.513 +  with h'_def show "h' x = h y + a * xi" by (simp add: Let_def)
  28.514 +qed
  28.515 +
  28.516 +end
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/src/HOL/Hahn_Banach/Vector_Space.thy	Wed Jun 24 21:46:54 2009 +0200
    29.3 @@ -0,0 +1,418 @@
    29.4 +(*  Title:      HOL/Hahn_Banach/Vector_Space.thy
    29.5 +    Author:     Gertrud Bauer, TU Munich
    29.6 +*)
    29.7 +
    29.8 +header {* Vector spaces *}
    29.9 +
   29.10 +theory Vector_Space
   29.11 +imports Real Bounds Zorn
   29.12 +begin
   29.13 +
   29.14 +subsection {* Signature *}
   29.15 +
   29.16 +text {*
   29.17 +  For the definition of real vector spaces a type @{typ 'a} of the
   29.18 +  sort @{text "{plus, minus, zero}"} is considered, on which a real
   29.19 +  scalar multiplication @{text \<cdot>} is declared.
   29.20 +*}
   29.21 +
   29.22 +consts
   29.23 +  prod  :: "real \<Rightarrow> 'a::{plus, minus, zero} \<Rightarrow> 'a"     (infixr "'(*')" 70)
   29.24 +
   29.25 +notation (xsymbols)
   29.26 +  prod  (infixr "\<cdot>" 70)
   29.27 +notation (HTML output)
   29.28 +  prod  (infixr "\<cdot>" 70)
   29.29 +
   29.30 +
   29.31 +subsection {* Vector space laws *}
   29.32 +
   29.33 +text {*
   29.34 +  A \emph{vector space} is a non-empty set @{text V} of elements from
   29.35 +  @{typ 'a} with the following vector space laws: The set @{text V} is
   29.36 +  closed under addition and scalar multiplication, addition is
   29.37 +  associative and commutative; @{text "- x"} is the inverse of @{text
   29.38 +  x} w.~r.~t.~addition and @{text 0} is the neutral element of
   29.39 +  addition.  Addition and multiplication are distributive; scalar
   29.40 +  multiplication is associative and the real number @{text "1"} is
   29.41 +  the neutral element of scalar multiplication.
   29.42 +*}
   29.43 +
   29.44 +locale var_V = fixes V
   29.45 +
   29.46 +locale vectorspace = var_V +
   29.47 +  assumes non_empty [iff, intro?]: "V \<noteq> {}"
   29.48 +    and add_closed [iff]: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + y \<in> V"
   29.49 +    and mult_closed [iff]: "x \<in> V \<Longrightarrow> a \<cdot> x \<in> V"
   29.50 +    and add_assoc: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> (x + y) + z = x + (y + z)"
   29.51 +    and add_commute: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + y = y + x"
   29.52 +    and diff_self [simp]: "x \<in> V \<Longrightarrow> x - x = 0"
   29.53 +    and add_zero_left [simp]: "x \<in> V \<Longrightarrow> 0 + x = x"
   29.54 +    and add_mult_distrib1: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> a \<cdot> (x + y) = a \<cdot> x + a \<cdot> y"
   29.55 +    and add_mult_distrib2: "x \<in> V \<Longrightarrow> (a + b) \<cdot> x = a \<cdot> x + b \<cdot> x"
   29.56 +    and mult_assoc: "x \<in> V \<Longrightarrow> (a * b) \<cdot> x = a \<cdot> (b \<cdot> x)"
   29.57 +    and mult_1 [simp]: "x \<in> V \<Longrightarrow> 1 \<cdot> x = x"
   29.58 +    and negate_eq1: "x \<in> V \<Longrightarrow> - x = (- 1) \<cdot> x"
   29.59 +    and diff_eq1: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x - y = x + - y"
   29.60 +
   29.61 +lemma (in vectorspace) negate_eq2: "x \<in> V \<Longrightarrow> (- 1) \<cdot> x = - x"
   29.62 +  by (rule negate_eq1 [symmetric])
   29.63 +
   29.64 +lemma (in vectorspace) negate_eq2a: "x \<in> V \<Longrightarrow> -1 \<cdot> x = - x"
   29.65 +  by (simp add: negate_eq1)
   29.66 +
   29.67 +lemma (in vectorspace) diff_eq2: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + - y = x - y"
   29.68 +  by (rule diff_eq1 [symmetric])
   29.69 +
   29.70 +lemma (in vectorspace) diff_closed [iff]: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x - y \<in> V"
   29.71 +  by (simp add: diff_eq1 negate_eq1)
   29.72 +
   29.73 +lemma (in vectorspace) neg_closed [iff]: "x \<in> V \<Longrightarrow> - x \<in> V"
   29.74 +  by (simp add: negate_eq1)
   29.75 +
   29.76 +lemma (in vectorspace) add_left_commute:
   29.77 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> x + (y + z) = y + (x + z)"
   29.78 +proof -
   29.79 +  assume xyz: "x \<in> V"  "y \<in> V"  "z \<in> V"
   29.80 +  then have "x + (y + z) = (x + y) + z"
   29.81 +    by (simp only: add_assoc)
   29.82 +  also from xyz have "\<dots> = (y + x) + z" by (simp only: add_commute)
   29.83 +  also from xyz have "\<dots> = y + (x + z)" by (simp only: add_assoc)
   29.84 +  finally show ?thesis .
   29.85 +qed
   29.86 +
   29.87 +theorems (in vectorspace) add_ac =
   29.88 +  add_assoc add_commute add_left_commute
   29.89 +
   29.90 +
   29.91 +text {* The existence of the zero element of a vector space
   29.92 +  follows from the non-emptiness of carrier set. *}
   29.93 +
   29.94 +lemma (in vectorspace) zero [iff]: "0 \<in> V"
   29.95 +proof -
   29.96 +  from non_empty obtain x where x: "x \<in> V" by blast
   29.97 +  then have "0 = x - x" by (rule diff_self [symmetric])
   29.98 +  also from x x have "\<dots> \<in> V" by (rule diff_closed)
   29.99 +  finally show ?thesis .
  29.100 +qed
  29.101 +
  29.102 +lemma (in vectorspace) add_zero_right [simp]:
  29.103 +  "x \<in> V \<Longrightarrow>  x + 0 = x"
  29.104 +proof -
  29.105 +  assume x: "x \<in> V"
  29.106 +  from this and zero have "x + 0 = 0 + x" by (rule add_commute)
  29.107 +  also from x have "\<dots> = x" by (rule add_zero_left)
  29.108 +  finally show ?thesis .
  29.109 +qed
  29.110 +
  29.111 +lemma (in vectorspace) mult_assoc2:
  29.112 +    "x \<in> V \<Longrightarrow> a \<cdot> b \<cdot> x = (a * b) \<cdot> x"
  29.113 +  by (simp only: mult_assoc)
  29.114 +
  29.115 +lemma (in vectorspace) diff_mult_distrib1:
  29.116 +    "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> a \<cdot> (x - y) = a \<cdot> x - a \<cdot> y"
  29.117 +  by (simp add: diff_eq1 negate_eq1 add_mult_distrib1 mult_assoc2)
  29.118 +
  29.119 +lemma (in vectorspace) diff_mult_distrib2:
  29.120 +  "x \<in> V \<Longrightarrow> (a - b) \<cdot> x = a \<cdot> x - (b \<cdot> x)"
  29.121 +proof -
  29.122 +  assume x: "x \<in> V"
  29.123 +  have " (a - b) \<cdot> x = (a + - b) \<cdot> x"
  29.124 +    by (simp add: real_diff_def)
  29.125 +  also from x have "\<dots> = a \<cdot> x + (- b) \<cdot> x"
  29.126 +    by (rule add_mult_distrib2)
  29.127 +  also from x have "\<dots> = a \<cdot> x + - (b \<cdot> x)"
  29.128 +    by (simp add: negate_eq1 mult_assoc2)
  29.129 +  also from x have "\<dots> = a \<cdot> x - (b \<cdot> x)"
  29.130 +    by (simp add: diff_eq1)
  29.131 +  finally show ?thesis .
  29.132 +qed
  29.133 +
  29.134 +lemmas (in vectorspace) distrib =
  29.135 +  add_mult_distrib1 add_mult_distrib2
  29.136 +  diff_mult_distrib1 diff_mult_distrib2
  29.137 +
  29.138 +
  29.139 +text {* \medskip Further derived laws: *}
  29.140 +
  29.141 +lemma (in vectorspace) mult_zero_left [simp]:
  29.142 +  "x \<in> V \<Longrightarrow> 0 \<cdot> x = 0"
  29.143 +proof -
  29.144 +  assume x: "x \<in> V"
  29.145 +  have "0 \<cdot> x = (1 - 1) \<cdot> x" by simp
  29.146 +  also have "\<dots> = (1 + - 1) \<cdot> x" by simp
  29.147 +  also from x have "\<dots> =  1 \<cdot> x + (- 1) \<cdot> x"
  29.148 +    by (rule add_mult_distrib2)
  29.149 +  also from x have "\<dots> = x + (- 1) \<cdot> x" by simp
  29.150 +  also from x have "\<dots> = x + - x" by (simp add: negate_eq2a)
  29.151 +  also from x have "\<dots> = x - x" by (simp add: diff_eq2)
  29.152 +  also from x have "\<dots> = 0" by simp
  29.153 +  finally show ?thesis .
  29.154 +qed
  29.155 +
  29.156 +lemma (in vectorspace) mult_zero_right [simp]:
  29.157 +  "a \<cdot> 0 = (0::'a)"
  29.158 +proof -
  29.159 +  have "a \<cdot> 0 = a \<cdot> (0 - (0::'a))" by simp
  29.160 +  also have "\<dots> =  a \<cdot> 0 - a \<cdot> 0"
  29.161 +    by (rule diff_mult_distrib1) simp_all
  29.162 +  also have "\<dots> = 0" by simp
  29.163 +  finally show ?thesis .
  29.164 +qed
  29.165 +
  29.166 +lemma (in vectorspace) minus_mult_cancel [simp]:
  29.167 +    "x \<in> V \<Longrightarrow> (- a) \<cdot> - x = a \<cdot> x"
  29.168 +  by (simp add: negate_eq1 mult_assoc2)
  29.169 +
  29.170 +lemma (in vectorspace) add_minus_left_eq_diff:
  29.171 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> - x + y = y - x"
  29.172 +proof -
  29.173 +  assume xy: "x \<in> V"  "y \<in> V"
  29.174 +  then have "- x + y = y + - x" by (simp add: add_commute)
  29.175 +  also from xy have "\<dots> = y - x" by (simp add: diff_eq1)
  29.176 +  finally show ?thesis .
  29.177 +qed
  29.178 +
  29.179 +lemma (in vectorspace) add_minus [simp]:
  29.180 +    "x \<in> V \<Longrightarrow> x + - x = 0"
  29.181 +  by (simp add: diff_eq2)
  29.182 +
  29.183 +lemma (in vectorspace) add_minus_left [simp]:
  29.184 +    "x \<in> V \<Longrightarrow> - x + x = 0"
  29.185 +  by (simp add: diff_eq2 add_commute)
  29.186 +
  29.187 +lemma (in vectorspace) minus_minus [simp]:
  29.188 +    "x \<in> V \<Longrightarrow> - (- x) = x"
  29.189 +  by (simp add: negate_eq1 mult_assoc2)
  29.190 +
  29.191 +lemma (in vectorspace) minus_zero [simp]:
  29.192 +    "- (0::'a) = 0"
  29.193 +  by (simp add: negate_eq1)
  29.194 +
  29.195 +lemma (in vectorspace) minus_zero_iff [simp]:
  29.196 +  "x \<in> V \<Longrightarrow> (- x = 0) = (x = 0)"
  29.197 +proof
  29.198 +  assume x: "x \<in> V"
  29.199 +  {
  29.200 +    from x have "x = - (- x)" by (simp add: minus_minus)
  29.201 +    also assume "- x = 0"
  29.202 +    also have "- \<dots> = 0" by (rule minus_zero)
  29.203 +    finally show "x = 0" .
  29.204 +  next
  29.205 +    assume "x = 0"
  29.206 +    then show "- x = 0" by simp
  29.207 +  }
  29.208 +qed
  29.209 +
  29.210 +lemma (in vectorspace) add_minus_cancel [simp]:
  29.211 +    "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + (- x + y) = y"
  29.212 +  by (simp add: add_assoc [symmetric] del: add_commute)
  29.213 +
  29.214 +lemma (in vectorspace) minus_add_cancel [simp]:
  29.215 +    "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> - x + (x + y) = y"
  29.216 +  by (simp add: add_assoc [symmetric] del: add_commute)
  29.217 +
  29.218 +lemma (in vectorspace) minus_add_distrib [simp]:
  29.219 +    "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> - (x + y) = - x + - y"
  29.220 +  by (simp add: negate_eq1 add_mult_distrib1)
  29.221 +
  29.222 +lemma (in vectorspace) diff_zero [simp]:
  29.223 +    "x \<in> V \<Longrightarrow> x - 0 = x"
  29.224 +  by (simp add: diff_eq1)
  29.225 +
  29.226 +lemma (in vectorspace) diff_zero_right [simp]:
  29.227 +    "x \<in> V \<Longrightarrow> 0 - x = - x"
  29.228 +  by (simp add: diff_eq1)
  29.229 +
  29.230 +lemma (in vectorspace) add_left_cancel:
  29.231 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> (x + y = x + z) = (y = z)"
  29.232 +proof
  29.233 +  assume x: "x \<in> V" and y: "y \<in> V" and z: "z \<in> V"
  29.234 +  {
  29.235 +    from y have "y = 0 + y" by simp
  29.236 +    also from x y have "\<dots> = (- x + x) + y" by simp
  29.237 +    also from x y have "\<dots> = - x + (x + y)"
  29.238 +      by (simp add: add_assoc neg_closed)
  29.239 +    also assume "x + y = x + z"
  29.240 +    also from x z have "- x + (x + z) = - x + x + z"
  29.241 +      by (simp add: add_assoc [symmetric] neg_closed)
  29.242 +    also from x z have "\<dots> = z" by simp
  29.243 +    finally show "y = z" .
  29.244 +  next
  29.245 +    assume "y = z"
  29.246 +    then show "x + y = x + z" by (simp only:)
  29.247 +  }
  29.248 +qed
  29.249 +
  29.250 +lemma (in vectorspace) add_right_cancel:
  29.251 +    "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> (y + x = z + x) = (y = z)"
  29.252 +  by (simp only: add_commute add_left_cancel)
  29.253 +
  29.254 +lemma (in vectorspace) add_assoc_cong:
  29.255 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x' \<in> V \<Longrightarrow> y' \<in> V \<Longrightarrow> z \<in> V
  29.256 +    \<Longrightarrow> x + y = x' + y' \<Longrightarrow> x + (y + z) = x' + (y' + z)"
  29.257 +  by (simp only: add_assoc [symmetric])
  29.258 +
  29.259 +lemma (in vectorspace) mult_left_commute:
  29.260 +    "x \<in> V \<Longrightarrow> a \<cdot> b \<cdot> x = b \<cdot> a \<cdot> x"
  29.261 +  by (simp add: real_mult_commute mult_assoc2)
  29.262 +
  29.263 +lemma (in vectorspace) mult_zero_uniq:
  29.264 +  "x \<in> V \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> a \<cdot> x = 0 \<Longrightarrow> a = 0"
  29.265 +proof (rule classical)
  29.266 +  assume a: "a \<noteq> 0"
  29.267 +  assume x: "x \<in> V"  "x \<noteq> 0" and ax: "a \<cdot> x = 0"
  29.268 +  from x a have "x = (inverse a * a) \<cdot> x" by simp
  29.269 +  also from `x \<in> V` have "\<dots> = inverse a \<cdot> (a \<cdot> x)" by (rule mult_assoc)
  29.270 +  also from ax have "\<dots> = inverse a \<cdot> 0" by simp
  29.271 +  also have "\<dots> = 0" by simp
  29.272 +  finally have "x = 0" .
  29.273 +  with `x \<noteq> 0` show "a = 0" by contradiction
  29.274 +qed
  29.275 +
  29.276 +lemma (in vectorspace) mult_left_cancel:
  29.277 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> a \<noteq> 0 \<Longrightarrow> (a \<cdot> x = a \<cdot> y) = (x = y)"
  29.278 +proof
  29.279 +  assume x: "x \<in> V" and y: "y \<in> V" and a: "a \<noteq> 0"
  29.280 +  from x have "x = 1 \<cdot> x" by simp
  29.281 +  also from a have "\<dots> = (inverse a * a) \<cdot> x" by simp
  29.282 +  also from x have "\<dots> = inverse a \<cdot> (a \<cdot> x)"
  29.283 +    by (simp only: mult_assoc)
  29.284 +  also assume "a \<cdot> x = a \<cdot> y"
  29.285 +  also from a y have "inverse a \<cdot> \<dots> = y"
  29.286 +    by (simp add: mult_assoc2)
  29.287 +  finally show "x = y" .
  29.288 +next
  29.289 +  assume "x = y"
  29.290 +  then show "a \<cdot> x = a \<cdot> y" by (simp only:)
  29.291 +qed
  29.292 +
  29.293 +lemma (in vectorspace) mult_right_cancel:
  29.294 +  "x \<in> V \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> (a \<cdot> x = b \<cdot> x) = (a = b)"
  29.295 +proof
  29.296 +  assume x: "x \<in> V" and neq: "x \<noteq> 0"
  29.297 +  {
  29.298 +    from x have "(a - b) \<cdot> x = a \<cdot> x - b \<cdot> x"
  29.299 +      by (simp add: diff_mult_distrib2)
  29.300 +    also assume "a \<cdot> x = b \<cdot> x"
  29.301 +    with x have "a \<cdot> x - b \<cdot> x = 0" by simp
  29.302 +    finally have "(a - b) \<cdot> x = 0" .
  29.303 +    with x neq have "a - b = 0" by (rule mult_zero_uniq)
  29.304 +    then show "a = b" by simp
  29.305 +  next
  29.306 +    assume "a = b"
  29.307 +    then show "a \<cdot> x = b \<cdot> x" by (simp only:)
  29.308 +  }
  29.309 +qed
  29.310 +
  29.311 +lemma (in vectorspace) eq_diff_eq:
  29.312 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> (x = z - y) = (x + y = z)"
  29.313 +proof
  29.314 +  assume x: "x \<in> V" and y: "y \<in> V" and z: "z \<in> V"
  29.315 +  {
  29.316 +    assume "x = z - y"
  29.317 +    then have "x + y = z - y + y" by simp
  29.318 +    also from y z have "\<dots> = z + - y + y"
  29.319 +      by (simp add: diff_eq1)
  29.320 +    also have "\<dots> = z + (- y + y)"
  29.321 +      by (rule add_assoc) (simp_all add: y z)
  29.322 +    also from y z have "\<dots> = z + 0"
  29.323 +      by (simp only: add_minus_left)
  29.324 +    also from z have "\<dots> = z"
  29.325 +      by (simp only: add_zero_right)
  29.326 +    finally show "x + y = z" .
  29.327 +  next
  29.328 +    assume "x + y = z"
  29.329 +    then have "z - y = (x + y) - y" by simp
  29.330 +    also from x y have "\<dots> = x + y + - y"
  29.331 +      by (simp add: diff_eq1)
  29.332 +    also have "\<dots> = x + (y + - y)"
  29.333 +      by (rule add_assoc) (simp_all add: x y)
  29.334 +    also from x y have "\<dots> = x" by simp
  29.335 +    finally show "x = z - y" ..
  29.336 +  }
  29.337 +qed
  29.338 +
  29.339 +lemma (in vectorspace) add_minus_eq_minus:
  29.340 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + y = 0 \<Longrightarrow> x = - y"
  29.341 +proof -
  29.342 +  assume x: "x \<in> V" and y: "y \<in> V"
  29.343 +  from x y have "x = (- y + y) + x" by simp
  29.344 +  also from x y have "\<dots> = - y + (x + y)" by (simp add: add_ac)
  29.345 +  also assume "x + y = 0"
  29.346 +  also from y have "- y + 0 = - y" by simp
  29.347 +  finally show "x = - y" .
  29.348 +qed
  29.349 +
  29.350 +lemma (in vectorspace) add_minus_eq:
  29.351 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x - y = 0 \<Longrightarrow> x = y"
  29.352 +proof -
  29.353 +  assume x: "x \<in> V" and y: "y \<in> V"
  29.354 +  assume "x - y = 0"
  29.355 +  with x y have eq: "x + - y = 0" by (simp add: diff_eq1)
  29.356 +  with _ _ have "x = - (- y)"
  29.357 +    by (rule add_minus_eq_minus) (simp_all add: x y)
  29.358 +  with x y show "x = y" by simp
  29.359 +qed
  29.360 +
  29.361 +lemma (in vectorspace) add_diff_swap:
  29.362 +  "a \<in> V \<Longrightarrow> b \<in> V \<Longrightarrow> c \<in> V \<Longrightarrow> d \<in> V \<Longrightarrow> a + b = c + d
  29.363 +    \<Longrightarrow> a - c = d - b"
  29.364 +proof -
  29.365 +  assume vs: "a \<in> V"  "b \<in> V"  "c \<in> V"  "d \<in> V"
  29.366 +    and eq: "a + b = c + d"
  29.367 +  then have "- c + (a + b) = - c + (c + d)"
  29.368 +    by (simp add: add_left_cancel)
  29.369 +  also have "\<dots> = d" using `c \<in> V` `d \<in> V` by (rule minus_add_cancel)
  29.370 +  finally have eq: "- c + (a + b) = d" .
  29.371 +  from vs have "a - c = (- c + (a + b)) + - b"
  29.372 +    by (simp add: add_ac diff_eq1)
  29.373 +  also from vs eq have "\<dots>  = d + - b"
  29.374 +    by (simp add: add_right_cancel)
  29.375 +  also from vs have "\<dots> = d - b" by (simp add: diff_eq2)
  29.376 +  finally show "a - c = d - b" .
  29.377 +qed
  29.378 +
  29.379 +lemma (in vectorspace) vs_add_cancel_21:
  29.380 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> u \<in> V
  29.381 +    \<Longrightarrow> (x + (y + z) = y + u) = (x + z = u)"
  29.382 +proof
  29.383 +  assume vs: "x \<in> V"  "y \<in> V"  "z \<in> V"  "u \<in> V"
  29.384 +  {
  29.385 +    from vs have "x + z = - y + y + (x + z)" by simp
  29.386 +    also have "\<dots> = - y + (y + (x + z))"
  29.387 +      by (rule add_assoc) (simp_all add: vs)
  29.388 +    also from vs have "y + (x + z) = x + (y + z)"
  29.389 +      by (simp add: add_ac)
  29.390 +    also assume "x + (y + z) = y + u"
  29.391 +    also from vs have "- y + (y + u) = u" by simp
  29.392 +    finally show "x + z = u" .
  29.393 +  next
  29.394 +    assume "x + z = u"
  29.395 +    with vs show "x + (y + z) = y + u"
  29.396 +      by (simp only: add_left_commute [of x])
  29.397 +  }
  29.398 +qed
  29.399 +
  29.400 +lemma (in vectorspace) add_cancel_end:
  29.401 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> (x + (y + z) = y) = (x = - z)"
  29.402 +proof
  29.403 +  assume vs: "x \<in> V"  "y \<in> V"  "z \<in> V"
  29.404 +  {
  29.405 +    assume "x + (y + z) = y"
  29.406 +    with vs have "(x + z) + y = 0 + y"
  29.407 +      by (simp add: add_ac)
  29.408 +    with vs have "x + z = 0"
  29.409 +      by (simp only: add_right_cancel add_closed zero)
  29.410 +    with vs show "x = - z" by (simp add: add_minus_eq_minus)
  29.411 +  next
  29.412 +    assume eq: "x = - z"
  29.413 +    then have "x + (y + z) = - z + (y + z)" by simp
  29.414 +    also have "\<dots> = y + (- z + z)"
  29.415 +      by (rule add_left_commute) (simp_all add: vs)
  29.416 +    also from vs have "\<dots> = y"  by simp
  29.417 +    finally show "x + (y + z) = y" .
  29.418 +  }
  29.419 +qed
  29.420 +
  29.421 +end
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/src/HOL/Hahn_Banach/Zorn_Lemma.thy	Wed Jun 24 21:46:54 2009 +0200
    30.3 @@ -0,0 +1,57 @@
    30.4 +(*  Title:      HOL/Hahn_Banach/Zorn_Lemma.thy
    30.5 +    Author:     Gertrud Bauer, TU Munich
    30.6 +*)
    30.7 +
    30.8 +header {* Zorn's Lemma *}
    30.9 +
   30.10 +theory Zorn_Lemma
   30.11 +imports Zorn
   30.12 +begin
   30.13 +
   30.14 +text {*
   30.15 +  Zorn's Lemmas states: if every linear ordered subset of an ordered
   30.16 +  set @{text S} has an upper bound in @{text S}, then there exists a
   30.17 +  maximal element in @{text S}.  In our application, @{text S} is a
   30.18 +  set of sets ordered by set inclusion. Since the union of a chain of
   30.19 +  sets is an upper bound for all elements of the chain, the conditions
   30.20 +  of Zorn's lemma can be modified: if @{text S} is non-empty, it
   30.21 +  suffices to show that for every non-empty chain @{text c} in @{text
   30.22 +  S} the union of @{text c} also lies in @{text S}.
   30.23 +*}
   30.24 +
   30.25 +theorem Zorn's_Lemma:
   30.26 +  assumes r: "\<And>c. c \<in> chain S \<Longrightarrow> \<exists>x. x \<in> c \<Longrightarrow> \<Union>c \<in> S"
   30.27 +    and aS: "a \<in> S"
   30.28 +  shows "\<exists>y \<in> S. \<forall>z \<in> S. y \<subseteq> z \<longrightarrow> y = z"
   30.29 +proof (rule Zorn_Lemma2)
   30.30 +  show "\<forall>c \<in> chain S. \<exists>y \<in> S. \<forall>z \<in> c. z \<subseteq> y"
   30.31 +  proof
   30.32 +    fix c assume "c \<in> chain S"
   30.33 +    show "\<exists>y \<in> S. \<forall>z \<in> c. z \<subseteq> y"
   30.34 +    proof cases
   30.35 +
   30.36 +      txt {* If @{text c} is an empty chain, then every element in
   30.37 +	@{text S} is an upper bound of @{text c}. *}
   30.38 +
   30.39 +      assume "c = {}"
   30.40 +      with aS show ?thesis by fast
   30.41 +
   30.42 +      txt {* If @{text c} is non-empty, then @{text "\<Union>c"} is an upper
   30.43 +	bound of @{text c}, lying in @{text S}. *}
   30.44 +
   30.45 +    next
   30.46 +      assume "c \<noteq> {}"
   30.47 +      show ?thesis
   30.48 +      proof
   30.49 +        show "\<forall>z \<in> c. z \<subseteq> \<Union>c" by fast
   30.50 +        show "\<Union>c \<in> S"
   30.51 +        proof (rule r)
   30.52 +          from `c \<noteq> {}` show "\<exists>x. x \<in> c" by fast
   30.53 +	  show "c \<in> chain S" by fact
   30.54 +        qed
   30.55 +      qed
   30.56 +    qed
   30.57 +  qed
   30.58 +qed
   30.59 +
   30.60 +end
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/src/HOL/Hahn_Banach/document/root.bib	Wed Jun 24 21:46:54 2009 +0200
    31.3 @@ -0,0 +1,27 @@
    31.4 +
    31.5 +@Book{Heuser:1986,
    31.6 +  author = 	 {H. Heuser},
    31.7 +  title = 	 {Funktionalanalysis: Theorie und Anwendung},
    31.8 +  publisher = 	 {Teubner},
    31.9 +  year = 	 1986
   31.10 +}
   31.11 +
   31.12 +@InCollection{Narici:1996,
   31.13 +  author = 	 {L. Narici and E. Beckenstein},
   31.14 +  title = 	 {The {Hahn-Banach Theorem}: The Life and Times},
   31.15 +  booktitle = 	 {Topology Atlas},
   31.16 +  publisher =	 {York University, Toronto, Ontario, Canada},
   31.17 +  year =	 1996,
   31.18 +  note =	 {\url{http://at.yorku.ca/topology/preprint.htm} and
   31.19 +                  \url{http://at.yorku.ca/p/a/a/a/16.htm}}
   31.20 +}
   31.21 +
   31.22 +@Article{Nowak:1993,
   31.23 +  author =       {B. Nowak and A. Trybulec},
   31.24 +  title =	 {{Hahn-Banach} Theorem},
   31.25 +  journal =      {Journal of Formalized Mathematics},
   31.26 +  year =         {1993},
   31.27 +  volume =       {5},
   31.28 +  institution =  {University of Bialystok},
   31.29 +  note =         {\url{http://mizar.uwb.edu.pl/JFM/Vol5/hahnban.html}}
   31.30 +}
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/src/HOL/Hahn_Banach/document/root.tex	Wed Jun 24 21:46:54 2009 +0200
    32.3 @@ -0,0 +1,83 @@
    32.4 +\documentclass[10pt,a4paper,twoside]{article}
    32.5 +\usepackage{graphicx}
    32.6 +\usepackage{latexsym,theorem}
    32.7 +\usepackage{isabelle,isabellesym}
    32.8 +\usepackage{pdfsetup} %last one!
    32.9 +
   32.10 +\isabellestyle{it}
   32.11 +\urlstyle{rm}
   32.12 +
   32.13 +\newcommand{\isasymsup}{\isamath{\sup\,}}
   32.14 +\newcommand{\skp}{\smallskip}
   32.15 +
   32.16 +
   32.17 +\begin{document}
   32.18 +
   32.19 +\pagestyle{headings}
   32.20 +\pagenumbering{arabic}
   32.21 +
   32.22 +\title{The Hahn-Banach Theorem \\ for Real Vector Spaces}
   32.23 +\author{Gertrud Bauer \\ \url{http://www.in.tum.de/~bauerg/}}
   32.24 +\maketitle
   32.25 +
   32.26 +\begin{abstract}
   32.27 +  The Hahn-Banach Theorem is one of the most fundamental results in functional
   32.28 +  analysis. We present a fully formal proof of two versions of the theorem,
   32.29 +  one for general linear spaces and another for normed spaces.  This
   32.30 +  development is based on simply-typed classical set-theory, as provided by
   32.31 +  Isabelle/HOL.
   32.32 +\end{abstract}
   32.33 +
   32.34 +
   32.35 +\tableofcontents
   32.36 +\parindent 0pt \parskip 0.5ex
   32.37 +
   32.38 +\clearpage
   32.39 +\section{Preface}
   32.40 +
   32.41 +This is a fully formal proof of the Hahn-Banach Theorem. It closely follows
   32.42 +the informal presentation given in Heuser's textbook \cite[{\S} 36]{Heuser:1986}.
   32.43 +Another formal proof of the same theorem has been done in Mizar
   32.44 +\cite{Nowak:1993}.  A general overview of the relevance and history of the
   32.45 +Hahn-Banach Theorem is given by Narici and Beckenstein \cite{Narici:1996}.
   32.46 +
   32.47 +\medskip The document is structured as follows.  The first part contains
   32.48 +definitions of basic notions of linear algebra: vector spaces, subspaces,
   32.49 +normed spaces, continuous linear-forms, norm of functions and an order on
   32.50 +functions by domain extension.  The second part contains some lemmas about the
   32.51 +supremum (w.r.t.\ the function order) and extension of non-maximal functions.
   32.52 +With these preliminaries, the main proof of the theorem (in its two versions)
   32.53 +is conducted in the third part.  The dependencies of individual theories are
   32.54 +as follows.
   32.55 +
   32.56 +\begin{center}
   32.57 +  \includegraphics[scale=0.5]{session_graph}  
   32.58 +\end{center}
   32.59 +
   32.60 +\clearpage
   32.61 +\part {Basic Notions}
   32.62 +
   32.63 +\input{Bounds}
   32.64 +\input{Vector_Space}
   32.65 +\input{Subspace}
   32.66 +\input{Normed_Space}
   32.67 +\input{Linearform}
   32.68 +\input{Function_Order}
   32.69 +\input{Function_Norm}
   32.70 +\input{Zorn_Lemma}
   32.71 +
   32.72 +\clearpage
   32.73 +\part {Lemmas for the Proof}
   32.74 +
   32.75 +\input{Hahn_Banach_Sup_Lemmas}
   32.76 +\input{Hahn_Banach_Ext_Lemmas}
   32.77 +\input{Hahn_Banach_Lemmas}
   32.78 +
   32.79 +\clearpage
   32.80 +\part {The Main Proof}
   32.81 +
   32.82 +\input{Hahn_Banach}
   32.83 +\bibliographystyle{abbrv}
   32.84 +\bibliography{root}
   32.85 +
   32.86 +\end{document}
    33.1 --- a/src/HOL/IsaMakefile	Wed Jun 24 21:28:02 2009 +0200
    33.2 +++ b/src/HOL/IsaMakefile	Wed Jun 24 21:46:54 2009 +0200
    33.3 @@ -16,7 +16,7 @@
    33.4    HOL-Bali \
    33.5    HOL-Decision_Procs \
    33.6    HOL-Extraction \
    33.7 -  HOL-HahnBanach \
    33.8 +  HOL-Hahn_Banach \
    33.9    HOL-Hoare \
   33.10    HOL-HoareParallel \
   33.11    HOL-Import \
   33.12 @@ -360,21 +360,19 @@
   33.13  	@cd Library; $(ISABELLE_TOOL) usedir $(OUT)/HOL Library
   33.14  
   33.15  
   33.16 -## HOL-HahnBanach
   33.17 +## HOL-Hahn_Banach
   33.18  
   33.19 -HOL-HahnBanach: HOL $(LOG)/HOL-HahnBanach.gz
   33.20 +HOL-Hahn_Banach: HOL $(LOG)/HOL-Hahn_Banach.gz
   33.21  
   33.22 -$(LOG)/HOL-HahnBanach.gz: $(OUT)/HOL			\
   33.23 -  HahnBanach/Bounds.thy HahnBanach/FunctionNorm.thy		\
   33.24 -  HahnBanach/FunctionOrder.thy HahnBanach/HahnBanach.thy	\
   33.25 -  HahnBanach/HahnBanachExtLemmas.thy				\
   33.26 -  HahnBanach/HahnBanachSupLemmas.thy				\
   33.27 -  HahnBanach/Linearform.thy HahnBanach/NormedSpace.thy	\
   33.28 -  HahnBanach/README.html HahnBanach/ROOT.ML			\
   33.29 -  HahnBanach/Subspace.thy HahnBanach/VectorSpace.thy		\
   33.30 -  HahnBanach/ZornLemma.thy HahnBanach/document/root.bib	\
   33.31 -  HahnBanach/document/root.tex
   33.32 -	@$(ISABELLE_TOOL) usedir -g true $(OUT)/HOL HahnBanach
   33.33 +$(LOG)/HOL-Hahn_Banach.gz: $(OUT)/HOL Hahn_Banach/Bounds.thy		\
   33.34 +  Hahn_Banach/Function_Norm.thy Hahn_Banach/Function_Order.thy		\
   33.35 +  Hahn_Banach/Hahn_Banach.thy Hahn_Banach/Hahn_Banach_Ext_Lemmas.thy	\
   33.36 +  Hahn_Banach/Hahn_Banach_Sup_Lemmas.thy Hahn_Banach/Linearform.thy	\
   33.37 +  Hahn_Banach/Normed_Space.thy Hahn_Banach/README.html			\
   33.38 +  Hahn_Banach/ROOT.ML Hahn_Banach/Subspace.thy				\
   33.39 +  Hahn_Banach/Vector_Space.thy Hahn_Banach/Zorn_Lemma.thy		\
   33.40 +  Hahn_Banach/document/root.bib Hahn_Banach/document/root.tex
   33.41 +	@$(ISABELLE_TOOL) usedir -g true $(OUT)/HOL Hahn_Banach
   33.42  
   33.43  
   33.44  ## HOL-Subst
   33.45 @@ -1138,7 +1136,7 @@
   33.46  		$(LOG)/HOL-MicroJava.gz $(LOG)/HOL-NanoJava.gz		\
   33.47  		$(LOG)/HOL-Nominal-Examples.gz $(LOG)/HOL-IOA.gz	\
   33.48  		$(LOG)/HOL-Lattice $(LOG)/HOL-Matrix			\
   33.49 -		$(LOG)/HOL-HahnBanach.gz $(LOG)/HOL-SET-Protocol.gz	\
   33.50 +		$(LOG)/HOL-Hahn_Banach.gz $(LOG)/HOL-SET-Protocol.gz	\
   33.51  		$(LOG)/TLA-Inc.gz $(LOG)/TLA-Buffer.gz			\
   33.52  		$(LOG)/TLA-Memory.gz $(LOG)/HOL-Library.gz		\
   33.53  		$(LOG)/HOL-Unix.gz $(OUT)/HOL-Word $(LOG)/HOL-Word.gz	\
    34.1 --- a/src/HOL/README.html	Wed Jun 24 21:28:02 2009 +0200
    34.2 +++ b/src/HOL/README.html	Wed Jun 24 21:46:54 2009 +0200
    34.3 @@ -96,7 +96,7 @@
    34.4  <dt>Real
    34.5  <dd>the real numbers, part of Complex
    34.6  
    34.7 -<dt>Real/HahnBanach
    34.8 +<dt>Hahn_Banach
    34.9  <dd>the Hahn-Banach theorem for real vector spaces (in Isabelle/Isar)
   34.10  
   34.11  <dt>SET-Protocol