updated to use locales (still some rough edges);
authorwenzelm
Thu Aug 22 20:49:43 2002 +0200 (2002-08-22)
changeset 13515a6a7025fd7e8
parent 13514 cc3bbaf1b8d3
child 13516 13a6103b9ac4
updated to use locales (still some rough edges);
src/HOL/Real/HahnBanach/Aux.thy
src/HOL/Real/HahnBanach/Bounds.thy
src/HOL/Real/HahnBanach/FunctionNorm.thy
src/HOL/Real/HahnBanach/FunctionOrder.thy
src/HOL/Real/HahnBanach/HahnBanach.thy
src/HOL/Real/HahnBanach/HahnBanachExtLemmas.thy
src/HOL/Real/HahnBanach/HahnBanachSupLemmas.thy
src/HOL/Real/HahnBanach/Linearform.thy
src/HOL/Real/HahnBanach/NormedSpace.thy
src/HOL/Real/HahnBanach/Subspace.thy
src/HOL/Real/HahnBanach/VectorSpace.thy
src/HOL/Real/HahnBanach/ZornLemma.thy
     1.1 --- a/src/HOL/Real/HahnBanach/Aux.thy	Thu Aug 22 12:28:41 2002 +0200
     1.2 +++ b/src/HOL/Real/HahnBanach/Aux.thy	Thu Aug 22 20:49:43 2002 +0200
     1.3 @@ -3,25 +3,15 @@
     1.4      Author:     Gertrud Bauer, TU Munich
     1.5  *)
     1.6  
     1.7 -header {* Auxiliary theorems *}
     1.8 +header {* Auxiliary theorems *}  (* FIXME clean *)
     1.9  
    1.10 -theory Aux = Real + Zorn:
    1.11 +theory Aux = Real + Bounds + Zorn:
    1.12  
    1.13  text {* Some existing theorems are declared as extra introduction
    1.14  or elimination rules, respectively. *}
    1.15  
    1.16 -lemmas [intro?] = isLub_isUb
    1.17 -lemmas [intro?] = chainD
    1.18 -lemmas chainE2 = chainD2 [elim_format, standard]
    1.19 -
    1.20 -
    1.21 -text {* \medskip Lemmas about sets. *}
    1.22 -
    1.23 -lemma Int_singletonD: "A \<inter> B = {v} \<Longrightarrow> x \<in> A \<Longrightarrow> x \<in> B \<Longrightarrow> x = v"
    1.24 -  by (fast elim: equalityE)
    1.25 -
    1.26 -lemma set_less_imp_diff_not_empty: "H < E \<Longrightarrow> \<exists>x0 \<in> E. x0 \<notin> H"
    1.27 -  by (auto simp add: psubset_eq)
    1.28 +lemmas [dest?] = chainD
    1.29 +lemmas chainE2 [elim?] = chainD2 [elim_format, standard]
    1.30  
    1.31  
    1.32  text{* \medskip Some lemmas about orders. *}
     2.1 --- a/src/HOL/Real/HahnBanach/Bounds.thy	Thu Aug 22 12:28:41 2002 +0200
     2.2 +++ b/src/HOL/Real/HahnBanach/Bounds.thy	Thu Aug 22 20:49:43 2002 +0200
     2.3 @@ -7,47 +7,71 @@
     2.4  
     2.5  theory Bounds = Main + Real:
     2.6  
     2.7 -text {*
     2.8 -  A supremum\footnote{The definition of the supremum is based on one
     2.9 -  in \url{http://isabelle.in.tum.de/library/HOL/HOL-Real/Lubs.html}}
    2.10 -  of an ordered set @{text B} w.~r.~t. @{text A} is defined as a least
    2.11 -  upper bound of @{text B}, which lies in @{text A}.
    2.12 -*}
    2.13 -   
    2.14 -text {*
    2.15 -  If a supremum exists, then @{text "Sup A B"} is equal to the
    2.16 -  supremum. *}
    2.17 +locale lub =
    2.18 +  fixes A and x
    2.19 +  assumes least [intro?]: "(\<And>a. a \<in> A \<Longrightarrow> a \<le> b) \<Longrightarrow> x \<le> b"
    2.20 +    and upper [intro?]: "a \<in> A \<Longrightarrow> a \<le> x"
    2.21 +
    2.22 +lemmas [elim?] = lub.least lub.upper
    2.23 +
    2.24 +syntax (xsymbols)
    2.25 +  the_lub :: "'a::order set \<Rightarrow> 'a"    ("\<Squnion>_" [90] 90)
    2.26  
    2.27  constdefs
    2.28 -  is_Sup :: "('a::order) set \<Rightarrow> 'a set \<Rightarrow> 'a \<Rightarrow> bool"
    2.29 -  "is_Sup A B x \<equiv> isLub A B x"
    2.30 -
    2.31 -  Sup :: "('a::order) set \<Rightarrow> 'a set \<Rightarrow> 'a"
    2.32 -  "Sup A B \<equiv> Eps (is_Sup A B)"
    2.33 +  the_lub :: "'a::order set \<Rightarrow> 'a"
    2.34 +  "\<Squnion>A \<equiv> The (lub A)"
    2.35  
    2.36 -text {*
    2.37 -  The supremum of @{text B} is less than any upper bound of
    2.38 -  @{text B}. *}
    2.39 -
    2.40 -lemma sup_le_ub: "isUb A B y \<Longrightarrow> is_Sup A B s \<Longrightarrow> s \<le> y"
    2.41 -  by (unfold is_Sup_def, rule isLub_le_isUb)
    2.42 -
    2.43 -text {* The supremum @{text B} is an upper bound for @{text B}. *}
    2.44 +lemma the_lub_equality [elim?]:
    2.45 +  includes lub
    2.46 +  shows "\<Squnion>A = (x::'a::order)"
    2.47 +proof (unfold the_lub_def)
    2.48 +  from lub_axioms show "The (lub A) = x"
    2.49 +  proof
    2.50 +    fix x' assume lub': "lub A x'"
    2.51 +    show "x' = x"
    2.52 +    proof (rule order_antisym)
    2.53 +      from lub' show "x' \<le> x"
    2.54 +      proof
    2.55 +        fix a assume "a \<in> A"
    2.56 +        then show "a \<le> x" ..
    2.57 +      qed
    2.58 +      show "x \<le> x'"
    2.59 +      proof
    2.60 +        fix a assume "a \<in> A"
    2.61 +        with lub' show "a \<le> x'" ..
    2.62 +      qed
    2.63 +    qed
    2.64 +  qed
    2.65 +qed
    2.66  
    2.67 -lemma sup_ub: "y \<in> B \<Longrightarrow> is_Sup A B s \<Longrightarrow> y \<le> s"
    2.68 -  by (unfold is_Sup_def, rule isLubD2)
    2.69 -
    2.70 -text {*
    2.71 -  The supremum of a non-empty set @{text B} is greater than a lower
    2.72 -  bound of @{text B}. *}
    2.73 +lemma the_lubI_ex:
    2.74 +  assumes ex: "\<exists>x. lub A x"
    2.75 +  shows "lub A (\<Squnion>A)"
    2.76 +proof -
    2.77 +  from ex obtain x where x: "lub A x" ..
    2.78 +  also from x have [symmetric]: "\<Squnion>A = x" ..
    2.79 +  finally show ?thesis .
    2.80 +qed
    2.81  
    2.82 -lemma sup_ub1: 
    2.83 -  "\<forall>y \<in> B. a \<le> y \<Longrightarrow> is_Sup A B s \<Longrightarrow> x \<in> B \<Longrightarrow> a \<le> s"
    2.84 -proof - 
    2.85 -  assume "\<forall>y \<in> B. a \<le> y"  "is_Sup A B s"  "x \<in> B"
    2.86 -  have "a \<le> x" by (rule bspec)
    2.87 -  also have "x \<le> s" by (rule sup_ub)
    2.88 -  finally show "a \<le> s" .
    2.89 +lemma lub_compat: "lub A x = isLub UNIV A x"
    2.90 +proof -
    2.91 +  have "isUb UNIV A = (\<lambda>x. A *<= x \<and> x \<in> UNIV)"
    2.92 +    by (rule ext) (simp only: isUb_def)
    2.93 +  then show ?thesis
    2.94 +    by (simp only: lub_def isLub_def leastP_def setge_def setle_def) blast
    2.95  qed
    2.96 -  
    2.97 +
    2.98 +lemma real_complete:
    2.99 +  fixes A :: "real set"
   2.100 +  assumes nonempty: "\<exists>a. a \<in> A"
   2.101 +    and ex_upper: "\<exists>y. \<forall>a \<in> A. a \<le> y"
   2.102 +  shows "\<exists>x. lub A x"
   2.103 +proof -
   2.104 +  from ex_upper have "\<exists>y. isUb UNIV A y"
   2.105 +    by (unfold isUb_def setle_def) blast
   2.106 +  with nonempty have "\<exists>x. isLub UNIV A x"
   2.107 +    by (rule reals_complete)
   2.108 +  then show ?thesis by (simp only: lub_compat)
   2.109 +qed
   2.110 +
   2.111  end
     3.1 --- a/src/HOL/Real/HahnBanach/FunctionNorm.thy	Thu Aug 22 12:28:41 2002 +0200
     3.2 +++ b/src/HOL/Real/HahnBanach/FunctionNorm.thy	Thu Aug 22 20:49:43 2002 +0200
     3.3 @@ -11,7 +11,7 @@
     3.4  
     3.5  text {*
     3.6    A linear form @{text f} on a normed vector space @{text "(V, \<parallel>\<cdot>\<parallel>)"}
     3.7 -  is \emph{continuous}, iff it is bounded, i.~e.
     3.8 +  is \emph{continuous}, iff it is bounded, i.e.
     3.9    \begin{center}
    3.10    @{text "\<exists>c \<in> R. \<forall>x \<in> V. \<bar>f x\<bar> \<le> c \<cdot> \<parallel>x\<parallel>"}
    3.11    \end{center}
    3.12 @@ -20,28 +20,21 @@
    3.13    linear forms:
    3.14  *}
    3.15  
    3.16 -constdefs
    3.17 -  is_continuous ::
    3.18 -  "'a::{plus, minus, zero} set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> bool"
    3.19 -  "is_continuous V norm f \<equiv>
    3.20 -    is_linearform V f \<and> (\<exists>c. \<forall>x \<in> V. \<bar>f x\<bar> \<le> c * norm x)"
    3.21 +locale continuous = var V + norm_syntax + linearform +
    3.22 +  assumes bounded: "\<exists>c. \<forall>x \<in> V. \<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>"
    3.23  
    3.24  lemma continuousI [intro]:
    3.25 -  "is_linearform V f \<Longrightarrow> (\<And>x. x \<in> V \<Longrightarrow> \<bar>f x\<bar> \<le> c * norm x)
    3.26 -  \<Longrightarrow> is_continuous V norm f"
    3.27 -  by (unfold is_continuous_def) blast
    3.28 -
    3.29 -lemma continuous_linearform [intro?]:
    3.30 -  "is_continuous V norm f \<Longrightarrow> is_linearform V f"
    3.31 -  by (unfold is_continuous_def) blast
    3.32 -
    3.33 -lemma continuous_bounded [intro?]:
    3.34 -  "is_continuous V norm f
    3.35 -  \<Longrightarrow> \<exists>c. \<forall>x \<in> V. \<bar>f x\<bar> \<le> c * norm x"
    3.36 -  by (unfold is_continuous_def) blast
    3.37 +  includes norm_syntax + linearform
    3.38 +  assumes r: "\<And>x. x \<in> V \<Longrightarrow> \<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>"
    3.39 +  shows "continuous V norm f"
    3.40 +proof
    3.41 +  show "linearform V f" .
    3.42 +  from r have "\<exists>c. \<forall>x\<in>V. \<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>" by blast
    3.43 +  then show "continuous_axioms V norm f" ..
    3.44 +qed
    3.45  
    3.46  
    3.47 -subsection{* The norm of a linear form *}
    3.48 +subsection {* The norm of a linear form *}
    3.49  
    3.50  text {*
    3.51    The least real number @{text c} for which holds
    3.52 @@ -62,174 +55,133 @@
    3.53    element in this set. This element must be @{text "{} \<ge> 0"} so that
    3.54    @{text function_norm} has the norm properties. Furthermore
    3.55    it does not have to change the norm in all other cases, so it must
    3.56 -  be @{text 0}, as all other elements of are @{text "{} \<ge> 0"}.
    3.57 +  be @{text 0}, as all other elements are @{text "{} \<ge> 0"}.
    3.58  
    3.59 -  Thus we define the set @{text B} the supremum is taken from as
    3.60 +  Thus we define the set @{text B} where the supremum is taken from as
    3.61 +  follows:
    3.62    \begin{center}
    3.63    @{text "{0} \<union> {\<bar>f x\<bar> / \<parallel>x\<parallel>. x \<noteq> 0 \<and> x \<in> F}"}
    3.64    \end{center}
    3.65 -*}
    3.66  
    3.67 -constdefs
    3.68 -  B :: "'a set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> ('a::{plus, minus, zero} \<Rightarrow> real) \<Rightarrow> real set"
    3.69 -  "B V norm f \<equiv>
    3.70 -  {0} \<union> {\<bar>f x\<bar> * inverse (norm x) | x. x \<noteq> 0 \<and> x \<in> V}"
    3.71 -
    3.72 -text {*
    3.73 -  @{text n} is the function norm of @{text f}, iff @{text n} is the
    3.74 -  supremum of @{text B}.
    3.75 +  @{text function_norm} is equal to the supremum of @{text B}, if the
    3.76 +  supremum exists (otherwise it is undefined).
    3.77  *}
    3.78  
    3.79 -constdefs
    3.80 -  is_function_norm ::
    3.81 -  "('a::{minus,plus,zero} \<Rightarrow> real) \<Rightarrow> 'a set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> real \<Rightarrow> bool"
    3.82 -  "is_function_norm f V norm fn \<equiv> is_Sup UNIV (B V norm f) fn"
    3.83 -
    3.84 -text {*
    3.85 -  @{text function_norm} is equal to the supremum of @{text B}, if the
    3.86 -  supremum exists. Otherwise it is undefined.
    3.87 -*}
    3.88 +locale function_norm = norm_syntax +
    3.89 +  fixes B
    3.90 +  defines "B V f \<equiv> {0} \<union> {\<bar>f x\<bar> / \<parallel>x\<parallel> | x. x \<noteq> 0 \<and> x \<in> V}"
    3.91 +  fixes function_norm ("\<parallel>_\<parallel>\<hyphen>_" [0, 1000] 999)
    3.92 +  defines "\<parallel>f\<parallel>\<hyphen>V \<equiv> \<Squnion>(B V f)"
    3.93  
    3.94 -constdefs
    3.95 -  function_norm :: "('a::{minus,plus,zero} \<Rightarrow> real) \<Rightarrow> 'a set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> real"
    3.96 -  "function_norm f V norm \<equiv> Sup UNIV (B V norm f)"
    3.97 +lemma (in function_norm) B_not_empty [intro]: "0 \<in> B V f"
    3.98 +  by (unfold B_def) simp
    3.99  
   3.100 -syntax
   3.101 -  function_norm :: "('a \<Rightarrow> real) \<Rightarrow> 'a set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> real"  ("\<parallel>_\<parallel>_,_")
   3.102 -
   3.103 -lemma B_not_empty: "0 \<in> B V norm f"
   3.104 -  by (unfold B_def) blast
   3.105 +locale (open) functional_vectorspace =
   3.106 +    normed_vectorspace + function_norm +
   3.107 +  fixes cont
   3.108 +  defines "cont f \<equiv> continuous V norm f"
   3.109  
   3.110  text {*
   3.111    The following lemma states that every continuous linear form on a
   3.112    normed space @{text "(V, \<parallel>\<cdot>\<parallel>)"} has a function norm.
   3.113  *}
   3.114  
   3.115 -lemma ex_fnorm [intro?]:
   3.116 -  "is_normed_vectorspace V norm \<Longrightarrow> is_continuous V norm f
   3.117 -     \<Longrightarrow> is_function_norm f V norm \<parallel>f\<parallel>V,norm"
   3.118 -proof (unfold function_norm_def is_function_norm_def
   3.119 -  is_continuous_def Sup_def, elim conjE, rule someI2_ex)
   3.120 -  assume "is_normed_vectorspace V norm"
   3.121 -  assume "is_linearform V f"
   3.122 -  and e: "\<exists>c. \<forall>x \<in> V. \<bar>f x\<bar> \<le> c * norm x"
   3.123 -
   3.124 +lemma (in functional_vectorspace) function_norm_works:
   3.125 +  includes continuous
   3.126 +  shows "lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)"
   3.127 +proof -
   3.128    txt {* The existence of the supremum is shown using the
   3.129 -  completeness of the reals. Completeness means, that
   3.130 -  every non-empty bounded set of reals has a
   3.131 -  supremum. *}
   3.132 -  show  "\<exists>a. is_Sup UNIV (B V norm f) a"
   3.133 -  proof (unfold is_Sup_def, rule reals_complete)
   3.134 -
   3.135 +    completeness of the reals. Completeness means, that every
   3.136 +    non-empty bounded set of reals has a supremum. *}
   3.137 +  have "\<exists>a. lub (B V f) a"
   3.138 +  proof (rule real_complete)
   3.139      txt {* First we have to show that @{text B} is non-empty: *}
   3.140 -
   3.141 -    show "\<exists>X. X \<in> B V norm f"
   3.142 -    proof
   3.143 -      show "0 \<in> (B V norm f)" by (unfold B_def) blast
   3.144 -    qed
   3.145 +    have "0 \<in> B V f" ..
   3.146 +    thus "\<exists>x. x \<in> B V f" ..
   3.147  
   3.148      txt {* Then we have to show that @{text B} is bounded: *}
   3.149 -
   3.150 -    from e show "\<exists>Y. isUb UNIV (B V norm f) Y"
   3.151 -    proof
   3.152 -
   3.153 +    show "\<exists>c. \<forall>y \<in> B V f. y \<le> c"
   3.154 +    proof -
   3.155        txt {* We know that @{text f} is bounded by some value @{text c}. *}
   3.156 -
   3.157 -      fix c assume a: "\<forall>x \<in> V. \<bar>f x\<bar> \<le> c * norm x"
   3.158 -      def b \<equiv> "max c 0"
   3.159 +      from bounded obtain c where c: "\<forall>x \<in> V. \<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>" ..
   3.160  
   3.161 -      show "?thesis"
   3.162 -      proof (intro exI isUbI setleI ballI, unfold B_def,
   3.163 -        elim UnE CollectE exE conjE singletonE)
   3.164 -
   3.165 -        txt {* To proof the thesis, we have to show that there is some
   3.166 -        constant @{text b}, such that @{text "y \<le> b"} for all
   3.167 -        @{text "y \<in> B"}. Due to the definition of @{text B} there are
   3.168 -        two cases for @{text "y \<in> B"}.  If @{text "y = 0"} then
   3.169 -        @{text "y \<le> max c 0"}: *}
   3.170 -
   3.171 -        fix y assume "y = (0::real)"
   3.172 -        show "y \<le> b" by (simp! add: le_maxI2)
   3.173 -
   3.174 -        txt {* The second case is @{text "y = \<bar>f x\<bar> / \<parallel>x\<parallel>"} for some
   3.175 -        @{text "x \<in> V"} with @{text "x \<noteq> 0"}. *}
   3.176 +      txt {* To prove the thesis, we have to show that there is some
   3.177 +        @{text b}, such that @{text "y \<le> b"} for all @{text "y \<in>
   3.178 +        B"}. Due to the definition of @{text B} there are two cases. *}
   3.179  
   3.180 -      next
   3.181 -        fix x y
   3.182 -        assume "x \<in> V"  "x \<noteq> 0"
   3.183 -
   3.184 -        txt {* The thesis follows by a short calculation using the
   3.185 -        fact that @{text f} is bounded. *}
   3.186 +      def b \<equiv> "max c 0"
   3.187 +      have "\<forall>y \<in> B V f. y \<le> b"
   3.188 +      proof
   3.189 +        fix y assume y: "y \<in> B V f"
   3.190 +        show "y \<le> b"
   3.191 +        proof cases
   3.192 +          assume "y = 0"
   3.193 +          thus ?thesis by (unfold b_def) arith
   3.194 +        next
   3.195 +          txt {* The second case is @{text "y = \<bar>f x\<bar> / \<parallel>x\<parallel>"} for some
   3.196 +            @{text "x \<in> V"} with @{text "x \<noteq> 0"}. *}
   3.197 +          assume "y \<noteq> 0"
   3.198 +          with y obtain x where y_rep: "y = \<bar>f x\<bar> * inverse \<parallel>x\<parallel>"
   3.199 +              and x: "x \<in> V" and neq: "x \<noteq> 0"
   3.200 +            by (auto simp add: B_def real_divide_def)
   3.201 +          from x neq have gt: "0 < \<parallel>x\<parallel>" ..
   3.202  
   3.203 -        assume "y = \<bar>f x\<bar> * inverse (norm x)"
   3.204 -        also have "... \<le> c * norm x * inverse (norm x)"
   3.205 -        proof (rule real_mult_le_le_mono2)
   3.206 -          show "0 \<le> inverse (norm x)"
   3.207 -            by (rule order_less_imp_le, rule real_inverse_gt_0,
   3.208 -                rule normed_vs_norm_gt_zero)
   3.209 -          from a show "\<bar>f x\<bar> \<le> c * norm x" ..
   3.210 +          txt {* The thesis follows by a short calculation using the
   3.211 +            fact that @{text f} is bounded. *}
   3.212 +
   3.213 +          note y_rep
   3.214 +          also have "\<bar>f x\<bar> * inverse \<parallel>x\<parallel> \<le> (c * \<parallel>x\<parallel>) * inverse \<parallel>x\<parallel>"
   3.215 +          proof (rule real_mult_le_le_mono2)
   3.216 +            from c show "\<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>" ..
   3.217 +            from gt have "0 < inverse \<parallel>x\<parallel>" by (rule real_inverse_gt_0)
   3.218 +            thus "0 \<le> inverse \<parallel>x\<parallel>" by (rule order_less_imp_le)
   3.219 +          qed
   3.220 +          also have "\<dots> = c * (\<parallel>x\<parallel> * inverse \<parallel>x\<parallel>)"
   3.221 +            by (rule real_mult_assoc)
   3.222 +          also
   3.223 +          from gt have "\<parallel>x\<parallel> \<noteq> 0" by simp
   3.224 +          hence "\<parallel>x\<parallel> * inverse \<parallel>x\<parallel> = 1" by (simp add: real_mult_inv_right1)
   3.225 +          also have "c * 1 \<le> b" by (simp add: b_def le_maxI1)
   3.226 +          finally show "y \<le> b" .
   3.227          qed
   3.228 -        also have "... = c * (norm x * inverse (norm x))"
   3.229 -          by (rule real_mult_assoc)
   3.230 -        also have "(norm x * inverse (norm x)) = (1::real)"
   3.231 -        proof (rule real_mult_inv_right1)
   3.232 -          show nz: "norm x \<noteq> 0"
   3.233 -            by (rule not_sym, rule lt_imp_not_eq,
   3.234 -              rule normed_vs_norm_gt_zero)
   3.235 -        qed
   3.236 -        also have "c * ... \<le> b " by (simp! add: le_maxI1)
   3.237 -        finally show "y \<le> b" .
   3.238 -      qed simp
   3.239 +      qed
   3.240 +      thus ?thesis ..
   3.241      qed
   3.242    qed
   3.243 +  then show ?thesis
   3.244 +    by (unfold function_norm_def) (rule the_lubI_ex)
   3.245 +qed
   3.246 +
   3.247 +lemma (in functional_vectorspace) function_norm_ub [intro?]:
   3.248 +  includes continuous
   3.249 +  assumes b: "b \<in> B V f"
   3.250 +  shows "b \<le> \<parallel>f\<parallel>\<hyphen>V"
   3.251 +proof -
   3.252 +  have "lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)" by (rule function_norm_works)
   3.253 +  from this and b show ?thesis ..
   3.254 +qed
   3.255 +
   3.256 +lemma (in functional_vectorspace) function_norm_least [intro?]:
   3.257 +  includes continuous
   3.258 +  assumes b: "\<And>b. b \<in> B V f \<Longrightarrow> b \<le> y"
   3.259 +  shows "\<parallel>f\<parallel>\<hyphen>V \<le> y"
   3.260 +proof -
   3.261 +  have "lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)" by (rule function_norm_works)
   3.262 +  from this and b show ?thesis ..
   3.263  qed
   3.264  
   3.265  text {* The norm of a continuous function is always @{text "\<ge> 0"}. *}
   3.266  
   3.267 -lemma fnorm_ge_zero [intro?]:
   3.268 -  "is_continuous V norm f \<Longrightarrow> is_normed_vectorspace V norm
   3.269 -   \<Longrightarrow> 0 \<le> \<parallel>f\<parallel>V,norm"
   3.270 +lemma (in functional_vectorspace) function_norm_ge_zero [iff]:
   3.271 +  includes continuous
   3.272 +  shows "0 \<le> \<parallel>f\<parallel>\<hyphen>V"
   3.273  proof -
   3.274 -  assume c: "is_continuous V norm f"
   3.275 -     and n: "is_normed_vectorspace V norm"
   3.276 -
   3.277    txt {* The function norm is defined as the supremum of @{text B}.
   3.278 -  So it is @{text "\<ge> 0"} if all elements in @{text B} are
   3.279 -  @{text "\<ge> 0"}, provided the supremum exists and @{text B} is not
   3.280 -  empty. *}
   3.281 -
   3.282 -  show ?thesis
   3.283 -  proof (unfold function_norm_def, rule sup_ub1)
   3.284 -    show "\<forall>x \<in> (B V norm f). 0 \<le> x"
   3.285 -    proof (intro ballI, unfold B_def,
   3.286 -           elim UnE singletonE CollectE exE conjE)
   3.287 -      fix x r
   3.288 -      assume "x \<in> V"  "x \<noteq> 0"
   3.289 -        and r: "r = \<bar>f x\<bar> * inverse (norm x)"
   3.290 -
   3.291 -      have ge: "0 \<le> \<bar>f x\<bar>" by (simp! only: abs_ge_zero)
   3.292 -      have "0 \<le> inverse (norm x)"
   3.293 -        by (rule order_less_imp_le, rule real_inverse_gt_0, rule)(***
   3.294 -        proof (rule order_less_imp_le);
   3.295 -          show "0 < inverse (norm x)";
   3.296 -          proof (rule real_inverse_gt_zero);
   3.297 -            show "0 < norm x"; ..;
   3.298 -          qed;
   3.299 -        qed; ***)
   3.300 -      with ge show "0 \<le> r"
   3.301 -       by (simp only: r, rule real_le_mult_order1a)
   3.302 -    qed (simp!)
   3.303 -
   3.304 -    txt {* Since @{text f} is continuous the function norm exists: *}
   3.305 -
   3.306 -    have "is_function_norm f V norm \<parallel>f\<parallel>V,norm" ..
   3.307 -    thus "is_Sup UNIV (B V norm f) (Sup UNIV (B V norm f))"
   3.308 -      by (unfold is_function_norm_def function_norm_def)
   3.309 -
   3.310 -    txt {* @{text B} is non-empty by construction: *}
   3.311 -
   3.312 -    show "0 \<in> B V norm f" by (rule B_not_empty)
   3.313 -  qed
   3.314 +    So it is @{text "\<ge> 0"} if all elements in @{text B} are @{text "\<ge>
   3.315 +    0"}, provided the supremum exists and @{text B} is not empty. *}
   3.316 +  have "lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)" by (rule function_norm_works)
   3.317 +  moreover have "0 \<in> B V f" ..
   3.318 +  ultimately show ?thesis ..
   3.319  qed
   3.320  
   3.321  text {*
   3.322 @@ -239,141 +191,79 @@
   3.323    \end{center}
   3.324  *}
   3.325  
   3.326 -lemma norm_fx_le_norm_f_norm_x:
   3.327 -  "is_continuous V norm f \<Longrightarrow> is_normed_vectorspace V norm \<Longrightarrow> x \<in> V
   3.328 -    \<Longrightarrow> \<bar>f x\<bar> \<le> \<parallel>f\<parallel>V,norm * norm x"
   3.329 -proof -
   3.330 -  assume "is_normed_vectorspace V norm"  "x \<in> V"
   3.331 -  and c: "is_continuous V norm f"
   3.332 -  have v: "is_vectorspace V" ..
   3.333 -
   3.334 - txt{* The proof is by case analysis on @{text x}. *}
   3.335 -
   3.336 -  show ?thesis
   3.337 -  proof cases
   3.338 -
   3.339 -    txt {* For the case @{text "x = 0"} the thesis follows from the
   3.340 -    linearity of @{text f}: for every linear function holds
   3.341 -    @{text "f 0 = 0"}. *}
   3.342 -
   3.343 -    assume "x = 0"
   3.344 -    have "\<bar>f x\<bar> = \<bar>f 0\<bar>" by (simp!)
   3.345 -    also from v continuous_linearform have "f 0 = 0" ..
   3.346 -    also note abs_zero
   3.347 -    also have "0 \<le> \<parallel>f\<parallel>V,norm * norm x"
   3.348 -    proof (rule real_le_mult_order1a)
   3.349 -      show "0 \<le> \<parallel>f\<parallel>V,norm" ..
   3.350 -      show "0 \<le> norm x" ..
   3.351 +lemma (in functional_vectorspace) function_norm_le_cong:
   3.352 +  includes continuous + vectorspace_linearform
   3.353 +  assumes x: "x \<in> V"
   3.354 +  shows "\<bar>f x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>V * \<parallel>x\<parallel>"
   3.355 +proof cases
   3.356 +  assume "x = 0"
   3.357 +  then have "\<bar>f x\<bar> = \<bar>f 0\<bar>" by simp
   3.358 +  also have "f 0 = 0" ..
   3.359 +  also have "\<bar>\<dots>\<bar> = 0" by simp
   3.360 +  also have "\<dots> \<le> \<parallel>f\<parallel>\<hyphen>V * \<parallel>x\<parallel>"
   3.361 +  proof (rule real_le_mult_order1a)
   3.362 +    show "0 \<le> \<parallel>f\<parallel>\<hyphen>V" ..
   3.363 +    show "0 \<le> norm x" ..
   3.364 +  qed
   3.365 +  finally show "\<bar>f x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>V * \<parallel>x\<parallel>" .
   3.366 +next
   3.367 +  assume "x \<noteq> 0"
   3.368 +  with x have neq: "\<parallel>x\<parallel> \<noteq> 0" by simp
   3.369 +  then have "\<bar>f x\<bar> = (\<bar>f x\<bar> * inverse \<parallel>x\<parallel>) * \<parallel>x\<parallel>" by simp
   3.370 +  also have "\<dots> \<le>  \<parallel>f\<parallel>\<hyphen>V * \<parallel>x\<parallel>"
   3.371 +  proof (rule real_mult_le_le_mono2)
   3.372 +    from x show "0 \<le> \<parallel>x\<parallel>" ..
   3.373 +    show "\<bar>f x\<bar> * inverse \<parallel>x\<parallel> \<le> \<parallel>f\<parallel>\<hyphen>V"
   3.374 +    proof
   3.375 +      from x and neq show "\<bar>f x\<bar> * inverse \<parallel>x\<parallel> \<in> B V f"
   3.376 +        by (auto simp add: B_def real_divide_def)
   3.377      qed
   3.378 -    finally
   3.379 -    show "\<bar>f x\<bar> \<le> \<parallel>f\<parallel>V,norm * norm x" .
   3.380 -
   3.381 -  next
   3.382 -    assume "x \<noteq> 0"
   3.383 -    have n: "0 < norm x" ..
   3.384 -    hence nz: "norm x \<noteq> 0"
   3.385 -      by (simp only: lt_imp_not_eq)
   3.386 -
   3.387 -    txt {* For the case @{text "x \<noteq> 0"} we derive the following fact
   3.388 -    from the definition of the function norm:*}
   3.389 -
   3.390 -    have l: "\<bar>f x\<bar> * inverse (norm x) \<le> \<parallel>f\<parallel>V,norm"
   3.391 -    proof (unfold function_norm_def, rule sup_ub)
   3.392 -      from ex_fnorm [OF _ c]
   3.393 -      show "is_Sup UNIV (B V norm f) (Sup UNIV (B V norm f))"
   3.394 -         by (simp! add: is_function_norm_def function_norm_def)
   3.395 -      show "\<bar>f x\<bar> * inverse (norm x) \<in> B V norm f"
   3.396 -        by (unfold B_def, intro UnI2 CollectI exI [of _ x]
   3.397 -            conjI, simp)
   3.398 -    qed
   3.399 -
   3.400 -    txt {* The thesis now follows by a short calculation: *}
   3.401 -
   3.402 -    have "\<bar>f x\<bar> = \<bar>f x\<bar> * 1" by (simp!)
   3.403 -    also from nz have "1 = inverse (norm x) * norm x"
   3.404 -      by (simp add: real_mult_inv_left1)
   3.405 -    also have "\<bar>f x\<bar> * ... = \<bar>f x\<bar> * inverse (norm x) * norm x"
   3.406 -      by (simp! add: real_mult_assoc)
   3.407 -    also from n l have "... \<le> \<parallel>f\<parallel>V,norm * norm x"
   3.408 -      by (simp add: real_mult_le_le_mono2)
   3.409 -    finally show "\<bar>f x\<bar> \<le> \<parallel>f\<parallel>V,norm * norm x" .
   3.410    qed
   3.411 +  finally show ?thesis .
   3.412  qed
   3.413  
   3.414  text {*
   3.415    \medskip The function norm is the least positive real number for
   3.416    which the following inequation holds:
   3.417    \begin{center}
   3.418 -  @{text "\<bar>f x\<bar> \<le> c \<cdot> \<parallel>x\<parallel>"}
   3.419 +    @{text "\<bar>f x\<bar> \<le> c \<cdot> \<parallel>x\<parallel>"}
   3.420    \end{center}
   3.421  *}
   3.422  
   3.423 -lemma fnorm_le_ub:
   3.424 -  "is_continuous V norm f \<Longrightarrow> is_normed_vectorspace V norm \<Longrightarrow>
   3.425 -     \<forall>x \<in> V. \<bar>f x\<bar> \<le> c * norm x \<Longrightarrow> 0 \<le> c
   3.426 -  \<Longrightarrow> \<parallel>f\<parallel>V,norm \<le> c"
   3.427 -proof (unfold function_norm_def)
   3.428 -  assume "is_normed_vectorspace V norm"
   3.429 -  assume c: "is_continuous V norm f"
   3.430 -  assume fb: "\<forall>x \<in> V. \<bar>f x\<bar> \<le> c * norm x"
   3.431 -    and "0 \<le> c"
   3.432 -
   3.433 -  txt {* Suppose the inequation holds for some @{text "c \<ge> 0"}.  If
   3.434 -  @{text c} is an upper bound of @{text B}, then @{text c} is greater
   3.435 -  than the function norm since the function norm is the least upper
   3.436 -  bound.  *}
   3.437 -
   3.438 -  show "Sup UNIV (B V norm f) \<le> c"
   3.439 -  proof (rule sup_le_ub)
   3.440 -    from ex_fnorm [OF _ c]
   3.441 -    show "is_Sup UNIV (B V norm f) (Sup UNIV (B V norm f))"
   3.442 -      by (simp! add: is_function_norm_def function_norm_def)
   3.443 -
   3.444 -    txt {* @{text c} is an upper bound of @{text B}, i.e. every
   3.445 -    @{text "y \<in> B"} is less than @{text c}. *}
   3.446 -
   3.447 -    show "isUb UNIV (B V norm f) c"
   3.448 -    proof (intro isUbI setleI ballI)
   3.449 -      fix y assume "y \<in> B V norm f"
   3.450 -      thus le: "y \<le> c"
   3.451 -      proof (unfold B_def, elim UnE CollectE exE conjE singletonE)
   3.452 -
   3.453 -       txt {* The first case for @{text "y \<in> B"} is @{text "y = 0"}. *}
   3.454 -
   3.455 -        assume "y = 0"
   3.456 -        show "y \<le> c" by (blast!)
   3.457 -
   3.458 -        txt{* The second case is @{text "y = \<bar>f x\<bar> / \<parallel>x\<parallel>"} for some
   3.459 -        @{text "x \<in> V"} with @{text "x \<noteq> 0"}. *}
   3.460 -
   3.461 -      next
   3.462 -        fix x
   3.463 -        assume "x \<in> V"  "x \<noteq> 0"
   3.464 -
   3.465 -        have lz: "0 < norm x"
   3.466 -          by (simp! add: normed_vs_norm_gt_zero)
   3.467 -
   3.468 -        have nz: "norm x \<noteq> 0"
   3.469 -        proof (rule not_sym)
   3.470 -          from lz show "0 \<noteq> norm x"
   3.471 -            by (simp! add: order_less_imp_not_eq)
   3.472 -        qed
   3.473 -
   3.474 -        from lz have "0 < inverse (norm x)"
   3.475 -          by (simp! add: real_inverse_gt_0)
   3.476 -        hence inverse_gez: "0 \<le> inverse (norm x)"
   3.477 -          by (rule order_less_imp_le)
   3.478 -
   3.479 -        assume "y = \<bar>f x\<bar> * inverse (norm x)"
   3.480 -        also from inverse_gez have "... \<le> c * norm x * inverse (norm x)"
   3.481 -          proof (rule real_mult_le_le_mono2)
   3.482 -            show "\<bar>f x\<bar> \<le> c * norm x" by (rule bspec)
   3.483 -          qed
   3.484 -        also have "... \<le> c" by (simp add: nz real_mult_assoc)
   3.485 -        finally show ?thesis .
   3.486 -      qed
   3.487 -    qed blast
   3.488 +lemma (in functional_vectorspace) function_norm_least [intro?]:
   3.489 +  includes continuous
   3.490 +  assumes ineq: "\<forall>x \<in> V. \<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>" and ge: "0 \<le> c"
   3.491 +  shows "\<parallel>f\<parallel>\<hyphen>V \<le> c"
   3.492 +proof (rule function_norm_least)
   3.493 +  fix b assume b: "b \<in> B V f"
   3.494 +  show "b \<le> c"
   3.495 +  proof cases
   3.496 +    assume "b = 0"
   3.497 +    with ge show ?thesis by simp
   3.498 +  next
   3.499 +    assume "b \<noteq> 0"
   3.500 +    with b obtain x where b_rep: "b = \<bar>f x\<bar> * inverse \<parallel>x\<parallel>"
   3.501 +        and x_neq: "x \<noteq> 0" and x: "x \<in> V"
   3.502 +      by (auto simp add: B_def real_divide_def)
   3.503 +    note b_rep
   3.504 +    also have "\<bar>f x\<bar> * inverse \<parallel>x\<parallel> \<le> (c * \<parallel>x\<parallel>) * inverse \<parallel>x\<parallel>"
   3.505 +    proof (rule real_mult_le_le_mono2)
   3.506 +      have "0 < \<parallel>x\<parallel>" ..
   3.507 +      then show "0 \<le> inverse \<parallel>x\<parallel>" by simp
   3.508 +      from ineq and x show "\<bar>f x\<bar> \<le> c * \<parallel>x\<parallel>" ..
   3.509 +    qed
   3.510 +    also have "\<dots> = c"
   3.511 +    proof -
   3.512 +      from x_neq and x have "\<parallel>x\<parallel> \<noteq> 0" by simp
   3.513 +      then show ?thesis by simp
   3.514 +    qed
   3.515 +    finally show ?thesis .
   3.516    qed
   3.517  qed
   3.518  
   3.519 +lemmas [iff?] =
   3.520 +  functional_vectorspace.function_norm_ge_zero
   3.521 +  functional_vectorspace.function_norm_le_cong
   3.522 +  functional_vectorspace.function_norm_least
   3.523 +
   3.524  end
     4.1 --- a/src/HOL/Real/HahnBanach/FunctionOrder.thy	Thu Aug 22 12:28:41 2002 +0200
     4.2 +++ b/src/HOL/Real/HahnBanach/FunctionOrder.thy	Thu Aug 22 20:49:43 2002 +0200
     4.3 @@ -20,79 +20,78 @@
     4.4    graph.
     4.5  *}
     4.6  
     4.7 -types 'a graph = "('a * real) set"
     4.8 +types 'a graph = "('a \<times> real) set"
     4.9  
    4.10  constdefs
    4.11 -  graph :: "'a set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> 'a graph "
    4.12 +  graph :: "'a set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> 'a graph"
    4.13    "graph F f \<equiv> {(x, f x) | x. x \<in> F}"
    4.14  
    4.15 -lemma graphI [intro?]: "x \<in> F \<Longrightarrow> (x, f x) \<in> graph F f"
    4.16 +lemma graphI [intro]: "x \<in> F \<Longrightarrow> (x, f x) \<in> graph F f"
    4.17    by (unfold graph_def) blast
    4.18  
    4.19 -lemma graphI2 [intro?]: "x \<in> F \<Longrightarrow> \<exists>t\<in> (graph F f). t = (x, f x)"
    4.20 +lemma graphI2 [intro?]: "x \<in> F \<Longrightarrow> \<exists>t \<in> graph F f. t = (x, f x)"
    4.21    by (unfold graph_def) blast
    4.22  
    4.23 -lemma graphD1 [intro?]: "(x, y) \<in> graph F f \<Longrightarrow> x \<in> F"
    4.24 -  by (unfold graph_def) blast
    4.25 -
    4.26 -lemma graphD2 [intro?]: "(x, y) \<in> graph H h \<Longrightarrow> y = h x"
    4.27 +lemma graphE [elim?]:
    4.28 +    "(x, y) \<in> graph F f \<Longrightarrow> (x \<in> F \<Longrightarrow> y = f x \<Longrightarrow> C) \<Longrightarrow> C"
    4.29    by (unfold graph_def) blast
    4.30  
    4.31  
    4.32  subsection {* Functions ordered by domain extension *}
    4.33  
    4.34 -text {* A function @{text h'} is an extension of @{text h}, iff the
    4.35 -  graph of @{text h} is a subset of the graph of @{text h'}. *}
    4.36 +text {*
    4.37 +  A function @{text h'} is an extension of @{text h}, iff the graph of
    4.38 +  @{text h} is a subset of the graph of @{text h'}.
    4.39 +*}
    4.40  
    4.41  lemma graph_extI:
    4.42    "(\<And>x. x \<in> H \<Longrightarrow> h x = h' x) \<Longrightarrow> H \<subseteq> H'
    4.43 -  \<Longrightarrow> graph H h \<subseteq> graph H' h'"
    4.44 +    \<Longrightarrow> graph H h \<subseteq> graph H' h'"
    4.45    by (unfold graph_def) blast
    4.46  
    4.47 -lemma graph_extD1 [intro?]:
    4.48 +lemma graph_extD1 [dest?]:
    4.49    "graph H h \<subseteq> graph H' h' \<Longrightarrow> x \<in> H \<Longrightarrow> h x = h' x"
    4.50    by (unfold graph_def) blast
    4.51  
    4.52 -lemma graph_extD2 [intro?]:
    4.53 +lemma graph_extD2 [dest?]:
    4.54    "graph H h \<subseteq> graph H' h' \<Longrightarrow> H \<subseteq> H'"
    4.55    by (unfold graph_def) blast
    4.56  
    4.57 +
    4.58  subsection {* Domain and function of a graph *}
    4.59  
    4.60  text {*
    4.61 -  The inverse functions to @{text graph} are @{text domain} and
    4.62 -  @{text funct}.
    4.63 +  The inverse functions to @{text graph} are @{text domain} and @{text
    4.64 +  funct}.
    4.65  *}
    4.66  
    4.67  constdefs
    4.68 -  domain :: "'a graph \<Rightarrow> 'a set"
    4.69 +  "domain" :: "'a graph \<Rightarrow> 'a set"
    4.70    "domain g \<equiv> {x. \<exists>y. (x, y) \<in> g}"
    4.71  
    4.72    funct :: "'a graph \<Rightarrow> ('a \<Rightarrow> real)"
    4.73    "funct g \<equiv> \<lambda>x. (SOME y. (x, y) \<in> g)"
    4.74  
    4.75 -
    4.76  text {*
    4.77    The following lemma states that @{text g} is the graph of a function
    4.78    if the relation induced by @{text g} is unique.
    4.79  *}
    4.80  
    4.81  lemma graph_domain_funct:
    4.82 -  "(\<And>x y z. (x, y) \<in> g \<Longrightarrow> (x, z) \<in> g \<Longrightarrow> z = y)
    4.83 -  \<Longrightarrow> graph (domain g) (funct g) = g"
    4.84 -proof (unfold domain_def funct_def graph_def, auto)
    4.85 +  assumes uniq: "\<And>x y z. (x, y) \<in> g \<Longrightarrow> (x, z) \<in> g \<Longrightarrow> z = y"
    4.86 +  shows "graph (domain g) (funct g) = g"
    4.87 +proof (unfold domain_def funct_def graph_def, auto)  (* FIXME !? *)
    4.88    fix a b assume "(a, b) \<in> g"
    4.89    show "(a, SOME y. (a, y) \<in> g) \<in> g" by (rule someI2)
    4.90    show "\<exists>y. (a, y) \<in> g" ..
    4.91 -  assume uniq: "\<And>x y z. (x, y) \<in> g \<Longrightarrow> (x, z) \<in> g \<Longrightarrow> z = y"
    4.92    show "b = (SOME y. (a, y) \<in> g)"
    4.93    proof (rule some_equality [symmetric])
    4.94 -    fix y assume "(a, y) \<in> g" show "y = b" by (rule uniq)
    4.95 +    fix y assume "(a, y) \<in> g"
    4.96 +    show "y = b" by (rule uniq)
    4.97    qed
    4.98  qed
    4.99  
   4.100  
   4.101 -
   4.102  subsection {* Norm-preserving extensions of a function *}
   4.103  
   4.104  text {*
   4.105 @@ -105,39 +104,35 @@
   4.106  constdefs
   4.107    norm_pres_extensions ::
   4.108      "'a::{plus, minus, zero} set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> 'a set \<Rightarrow> ('a \<Rightarrow> real)
   4.109 -    \<Rightarrow> 'a graph set"
   4.110 +      \<Rightarrow> 'a graph set"
   4.111      "norm_pres_extensions E p F f
   4.112 -    \<equiv> {g. \<exists>H h. graph H h = g
   4.113 -                \<and> is_linearform H h
   4.114 -                \<and> is_subspace H E
   4.115 -                \<and> is_subspace F H
   4.116 -                \<and> graph F f \<subseteq> graph H h
   4.117 -                \<and> (\<forall>x \<in> H. h x \<le> p x)}"
   4.118 +      \<equiv> {g. \<exists>H h. g = graph H h
   4.119 +          \<and> linearform H h
   4.120 +          \<and> H \<unlhd> E
   4.121 +          \<and> F \<unlhd> H
   4.122 +          \<and> graph F f \<subseteq> graph H h
   4.123 +          \<and> (\<forall>x \<in> H. h x \<le> p x)}"
   4.124  
   4.125 -lemma norm_pres_extension_D:
   4.126 +lemma norm_pres_extensionE [elim]:
   4.127    "g \<in> norm_pres_extensions E p F f
   4.128 -  \<Longrightarrow> \<exists>H h. graph H h = g
   4.129 -            \<and> is_linearform H h
   4.130 -            \<and> is_subspace H E
   4.131 -            \<and> is_subspace F H
   4.132 -            \<and> graph F f \<subseteq> graph H h
   4.133 -            \<and> (\<forall>x \<in> H. h x \<le> p x)"
   4.134 +  \<Longrightarrow> (\<And>H h. g = graph H h \<Longrightarrow> linearform H h
   4.135 +        \<Longrightarrow> H \<unlhd> E \<Longrightarrow> F \<unlhd> H \<Longrightarrow> graph F f \<subseteq> graph H h
   4.136 +        \<Longrightarrow> \<forall>x \<in> H. h x \<le> p x \<Longrightarrow> C) \<Longrightarrow> C"
   4.137    by (unfold norm_pres_extensions_def) blast
   4.138  
   4.139  lemma norm_pres_extensionI2 [intro]:
   4.140 -  "is_linearform H h \<Longrightarrow> is_subspace H E \<Longrightarrow> is_subspace F H \<Longrightarrow>
   4.141 -  graph F f \<subseteq> graph H h \<Longrightarrow> \<forall>x \<in> H. h x \<le> p x
   4.142 -  \<Longrightarrow> (graph H h \<in> norm_pres_extensions E p F f)"
   4.143 - by (unfold norm_pres_extensions_def) blast
   4.144 +  "linearform H h \<Longrightarrow> H \<unlhd> E \<Longrightarrow> F \<unlhd> H
   4.145 +    \<Longrightarrow> graph F f \<subseteq> graph H h \<Longrightarrow> \<forall>x \<in> H. h x \<le> p x
   4.146 +    \<Longrightarrow> graph H h \<in> norm_pres_extensions E p F f"
   4.147 +  by (unfold norm_pres_extensions_def) blast
   4.148  
   4.149 -lemma norm_pres_extensionI [intro]:
   4.150 -  "\<exists>H h. graph H h = g
   4.151 -         \<and> is_linearform H h
   4.152 -         \<and> is_subspace H E
   4.153 -         \<and> is_subspace F H
   4.154 -         \<and> graph F f \<subseteq> graph H h
   4.155 -         \<and> (\<forall>x \<in> H. h x \<le> p x)
   4.156 -  \<Longrightarrow> g \<in> norm_pres_extensions E p F f"
   4.157 +lemma norm_pres_extensionI:  (* FIXME ? *)
   4.158 +  "\<exists>H h. g = graph H h
   4.159 +    \<and> linearform H h
   4.160 +    \<and> H \<unlhd> E
   4.161 +    \<and> F \<unlhd> H
   4.162 +    \<and> graph F f \<subseteq> graph H h
   4.163 +    \<and> (\<forall>x \<in> H. h x \<le> p x) \<Longrightarrow> g \<in> norm_pres_extensions E p F f"
   4.164    by (unfold norm_pres_extensions_def) blast
   4.165  
   4.166  end
     5.1 --- a/src/HOL/Real/HahnBanach/HahnBanach.thy	Thu Aug 22 12:28:41 2002 +0200
     5.2 +++ b/src/HOL/Real/HahnBanach/HahnBanach.thy	Thu Aug 22 20:49:43 2002 +0200
     5.3 @@ -49,251 +49,235 @@
     5.4    \item Thus @{text g} can not be maximal. Contradiction!
     5.5  
     5.6    \end{itemize}
     5.7 -
     5.8    \end{enumerate}
     5.9  *}
    5.10  
    5.11  theorem HahnBanach:
    5.12 -  "is_vectorspace E \<Longrightarrow> is_subspace F E \<Longrightarrow> is_seminorm E p
    5.13 -  \<Longrightarrow> is_linearform F f \<Longrightarrow> \<forall>x \<in> F. f x \<le> p x
    5.14 -  \<Longrightarrow> \<exists>h. is_linearform E h \<and> (\<forall>x \<in> F. h x = f x) \<and> (\<forall>x \<in> E. h x \<le> p x)"
    5.15 +  includes vectorspace E + subvectorspace F E +
    5.16 +    seminorm_vectorspace E p + linearform F f
    5.17 +  assumes fp: "\<forall>x \<in> F. f x \<le> p x"
    5.18 +  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)"
    5.19      -- {* Let @{text E} be a vector space, @{text F} a subspace of @{text E}, @{text p} a seminorm on @{text E}, *}
    5.20      -- {* and @{text f} a linear form on @{text F} such that @{text f} is bounded by @{text p}, *}
    5.21      -- {* then @{text f} can be extended to a linear form @{text h} on @{text E} in a norm-preserving way. \skp *}
    5.22  proof -
    5.23 -  assume "is_vectorspace E"  "is_subspace F E"  "is_seminorm E p"
    5.24 -   and "is_linearform F f"  "\<forall>x \<in> F. f x \<le> p x"
    5.25 -  -- {* Assume the context of the theorem. \skp *}
    5.26    def M \<equiv> "norm_pres_extensions E p F f"
    5.27 -  -- {* Define @{text M} as the set of all norm-preserving extensions of @{text F}. \skp *}
    5.28 +  hence M: "M = \<dots>" by (simp only:)
    5.29 +  have F: "vectorspace F" ..
    5.30    {
    5.31 -    fix c assume "c \<in> chain M"  "\<exists>x. x \<in> c"
    5.32 +    fix c assume cM: "c \<in> chain M" and ex: "\<exists>x. x \<in> c"
    5.33      have "\<Union>c \<in> M"
    5.34 -    -- {* Show that every non-empty chain @{text c} of @{text M} has an upper bound in @{text M}: *}
    5.35 -    -- {* @{text "\<Union>c"} is greater than any element of the chain @{text c}, so it suffices to show @{text "\<Union>c \<in> M"}. *}
    5.36 +      -- {* Show that every non-empty chain @{text c} of @{text M} has an upper bound in @{text M}: *}
    5.37 +      -- {* @{text "\<Union>c"} is greater than any element of the chain @{text c}, so it suffices to show @{text "\<Union>c \<in> M"}. *}
    5.38      proof (unfold M_def, rule norm_pres_extensionI)
    5.39 -      show "\<exists>H h. graph H h = \<Union>c
    5.40 -              \<and> is_linearform H h
    5.41 -              \<and> is_subspace H E
    5.42 -              \<and> is_subspace F H
    5.43 -              \<and> graph F f \<subseteq> graph H h
    5.44 -              \<and> (\<forall>x \<in> H. h x \<le> p x)"
    5.45 -      proof (intro exI conjI)
    5.46 -        let ?H = "domain (\<Union>c)"
    5.47 -        let ?h = "funct (\<Union>c)"
    5.48 +      let ?H = "domain (\<Union>c)"
    5.49 +      let ?h = "funct (\<Union>c)"
    5.50  
    5.51 -        show a: "graph ?H ?h = \<Union>c"
    5.52 -        proof (rule graph_domain_funct)
    5.53 -          fix x y z assume "(x, y) \<in> \<Union>c"  "(x, z) \<in> \<Union>c"
    5.54 -          show "z = y" by (rule sup_definite)
    5.55 -        qed
    5.56 -        show "is_linearform ?H ?h"
    5.57 -          by (simp! add: sup_lf a)
    5.58 -        show "is_subspace ?H E"
    5.59 -          by (rule sup_subE, rule a) (simp!)+
    5.60 -        show "is_subspace F ?H"
    5.61 -          by (rule sup_supF, rule a) (simp!)+
    5.62 -        show "graph F f \<subseteq> graph ?H ?h"
    5.63 -          by (rule sup_ext, rule a) (simp!)+
    5.64 -        show "\<forall>x \<in> ?H. ?h x \<le> p x"
    5.65 -          by (rule sup_norm_pres, rule a) (simp!)+
    5.66 +      have a: "graph ?H ?h = \<Union>c"
    5.67 +      proof (rule graph_domain_funct)
    5.68 +        fix x y z assume "(x, y) \<in> \<Union>c" and "(x, z) \<in> \<Union>c"
    5.69 +        with M_def cM show "z = y" by (rule sup_definite)
    5.70        qed
    5.71 +      moreover from M cM a have "linearform ?H ?h"
    5.72 +        by (rule sup_lf)
    5.73 +      moreover from a M cM ex have "?H \<unlhd> E"
    5.74 +        by (rule sup_subE)
    5.75 +      moreover from a M cM ex have "F \<unlhd> ?H"
    5.76 +        by (rule sup_supF)
    5.77 +      moreover from a M cM ex have "graph F f \<subseteq> graph ?H ?h"
    5.78 +        by (rule sup_ext)
    5.79 +      moreover from a M cM have "\<forall>x \<in> ?H. ?h x \<le> p x"
    5.80 +        by (rule sup_norm_pres)
    5.81 +      ultimately show "\<exists>H h. \<Union>c = graph H h
    5.82 +          \<and> linearform H h
    5.83 +          \<and> H \<unlhd> E
    5.84 +          \<and> F \<unlhd> H
    5.85 +          \<and> graph F f \<subseteq> graph H h
    5.86 +          \<and> (\<forall>x \<in> H. h x \<le> p x)" by blast
    5.87      qed
    5.88 -
    5.89    }
    5.90    hence "\<exists>g \<in> M. \<forall>x \<in> M. g \<subseteq> x \<longrightarrow> g = x"
    5.91    -- {* With Zorn's Lemma we can conclude that there is a maximal element in @{text M}. \skp *}
    5.92    proof (rule Zorn's_Lemma)
    5.93 -    -- {* We show that @{text M} is non-empty: *}
    5.94 -    have "graph F f \<in> norm_pres_extensions E p F f"
    5.95 -    proof (rule norm_pres_extensionI2)
    5.96 -      have "is_vectorspace F" ..
    5.97 -      thus "is_subspace F F" ..
    5.98 -    qed (blast!)+
    5.99 -    thus "graph F f \<in> M" by (simp!)
   5.100 +      -- {* We show that @{text M} is non-empty: *}
   5.101 +    show "graph F f \<in> M"
   5.102 +    proof (unfold M_def, rule norm_pres_extensionI2)
   5.103 +      show "linearform F f" .
   5.104 +      show "F \<unlhd> E" .
   5.105 +      from F show "F \<unlhd> F" by (rule vectorspace.subspace_refl)
   5.106 +      show "graph F f \<subseteq> graph F f" ..
   5.107 +      show "\<forall>x\<in>F. f x \<le> p x" .
   5.108 +    qed
   5.109    qed
   5.110 -  thus ?thesis
   5.111 -  proof
   5.112 -    fix g assume "g \<in> M"  "\<forall>x \<in> M. g \<subseteq> x \<longrightarrow> g = x"
   5.113 -    -- {* We consider such a maximal element @{text "g \<in> M"}. \skp *}
   5.114 -    obtain H h where "graph H h = g"  "is_linearform H h"
   5.115 -      "is_subspace H E"  "is_subspace F H"  "graph F f \<subseteq> graph H h"
   5.116 -      "\<forall>x \<in> H. h x \<le> p x"
   5.117 +  then obtain g where gM: "g \<in> M" and "\<forall>x \<in> M. g \<subseteq> x \<longrightarrow> g = x"
   5.118 +    by blast
   5.119 +  from gM [unfolded M_def] obtain H h where
   5.120 +      g_rep: "g = graph H h"
   5.121 +    and linearform: "linearform H h"
   5.122 +    and HE: "H \<unlhd> E" and FH: "F \<unlhd> H"
   5.123 +    and graphs: "graph F f \<subseteq> graph H h"
   5.124 +    and hp: "\<forall>x \<in> H. h x \<le> p x" ..
   5.125        -- {* @{text g} is a norm-preserving extension of @{text f}, in other words: *}
   5.126        -- {* @{text g} is the graph of some linear form @{text h} defined on a subspace @{text H} of @{text E}, *}
   5.127        -- {* and @{text h} is an extension of @{text f} that is again bounded by @{text p}. \skp *}
   5.128 -    proof -
   5.129 -      have "\<exists>H h. graph H h = g \<and> is_linearform H h
   5.130 -        \<and> is_subspace H E \<and> is_subspace F H
   5.131 -        \<and> graph F f \<subseteq> graph H h
   5.132 -        \<and> (\<forall>x \<in> H. h x \<le> p x)"
   5.133 -        by (simp! add: norm_pres_extension_D)
   5.134 -      with that show ?thesis by blast
   5.135 -    qed
   5.136 -    have h: "is_vectorspace H" ..
   5.137 -    have "H = E"
   5.138 +  from HE have H: "vectorspace H"
   5.139 +    by (rule subvectorspace.vectorspace)
   5.140 +
   5.141 +  have HE_eq: "H = E"
   5.142      -- {* We show that @{text h} is defined on whole @{text E} by classical contradiction. \skp *}
   5.143 -    proof (rule classical)
   5.144 -      assume "H \<noteq> E"
   5.145 +  proof (rule classical)
   5.146 +    assume neq: "H \<noteq> E"
   5.147        -- {* Assume @{text h} is not defined on whole @{text E}. Then show that @{text h} can be extended *}
   5.148        -- {* in a norm-preserving way to a function @{text h'} with the graph @{text g'}. \skp *}
   5.149 -      have "\<exists>g' \<in> M. g \<subseteq> g' \<and> g \<noteq> g'"
   5.150 -      proof -
   5.151 -        obtain x' where "x' \<in> E"  "x' \<notin> H"
   5.152 -        -- {* Pick @{text "x' \<in> E - H"}. \skp *}
   5.153 -        proof -
   5.154 -          have "\<exists>x' \<in> E. x' \<notin> H"
   5.155 -          proof (rule set_less_imp_diff_not_empty)
   5.156 -            have "H \<subseteq> E" ..
   5.157 -            thus "H \<subset> E" ..
   5.158 -          qed
   5.159 -          with that show ?thesis by blast
   5.160 +    have "\<exists>g' \<in> M. g \<subseteq> g' \<and> g \<noteq> g'"
   5.161 +    proof -
   5.162 +      from HE have "H \<subseteq> E" ..
   5.163 +      with neq obtain x' where x'E: "x' \<in> E" and "x' \<notin> H" by blast
   5.164 +      obtain x': "x' \<noteq> 0"
   5.165 +      proof
   5.166 +        show "x' \<noteq> 0"
   5.167 +        proof
   5.168 +          assume "x' = 0"
   5.169 +          with H have "x' \<in> H" by (simp only: vectorspace.zero)
   5.170 +          then show False by contradiction
   5.171          qed
   5.172 -        have x': "x' \<noteq> 0"
   5.173 -        proof (rule classical)
   5.174 -          presume "x' = 0"
   5.175 -          with h have "x' \<in> H" by simp
   5.176 -          thus ?thesis by contradiction
   5.177 -        qed blast
   5.178 -        def H' \<equiv> "H + lin x'"
   5.179 +      qed
   5.180 +
   5.181 +      def H' \<equiv> "H + lin x'"
   5.182          -- {* Define @{text H'} as the direct sum of @{text H} and the linear closure of @{text x'}. \skp *}
   5.183 -        obtain xi where "\<forall>y \<in> H. - p (y + x') - h y \<le> xi
   5.184 -                          \<and> xi \<le> p (y + x') - h y"
   5.185 +      have HH': "H \<unlhd> H'"
   5.186 +      proof (unfold H'_def)
   5.187 +        have "vectorspace (lin x')" ..
   5.188 +        with H show "H \<unlhd> H + lin x'" ..
   5.189 +      qed
   5.190 +
   5.191 +      obtain xi where
   5.192 +        "\<forall>y \<in> H. - p (y + x') - h y \<le> xi
   5.193 +          \<and> xi \<le> p (y + x') - h y"
   5.194          -- {* Pick a real number @{text \<xi>} that fulfills certain inequations; this will *}
   5.195          -- {* be used to establish that @{text h'} is a norm-preserving extension of @{text h}.
   5.196             \label{ex-xi-use}\skp *}
   5.197 +      proof -
   5.198 +        from H have "\<exists>xi. \<forall>y \<in> H. - p (y + x') - h y \<le> xi
   5.199 +            \<and> xi \<le> p (y + x') - h y"
   5.200 +        proof (rule ex_xi)
   5.201 +          fix u v assume u: "u \<in> H" and v: "v \<in> H"
   5.202 +          with HE have uE: "u \<in> E" and vE: "v \<in> E" by auto
   5.203 +          from H u v linearform have "h v - h u = h (v - u)"
   5.204 +            by (simp add: vectorspace_linearform.diff)
   5.205 +          also from hp and H u v have "\<dots> \<le> p (v - u)"
   5.206 +            by (simp only: vectorspace.diff_closed)
   5.207 +          also from x'E uE vE have "v - u = x' + - x' + v + - u"
   5.208 +            by (simp add: diff_eq1)
   5.209 +          also from x'E uE vE have "\<dots> = v + x' + - (u + x')"
   5.210 +            by (simp add: add_ac)
   5.211 +          also from x'E uE vE have "\<dots> = (v + x') - (u + x')"
   5.212 +            by (simp add: diff_eq1)
   5.213 +          also from x'E uE vE have "p \<dots> \<le> p (v + x') + p (u + x')"
   5.214 +            by (simp add: diff_subadditive)
   5.215 +          finally have "h v - h u \<le> p (v + x') + p (u + x')" .
   5.216 +          then show "- p (u + x') - h u \<le> p (v + x') - h v"
   5.217 +            by simp
   5.218 +        qed
   5.219 +        then show ?thesis ..
   5.220 +      qed
   5.221 +
   5.222 +      def h' \<equiv> "\<lambda>x. let (y, a) =
   5.223 +          SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H in h y + a * xi"
   5.224 +        -- {* Define the extension @{text h'} of @{text h} to @{text H'} using @{text \<xi>}. \skp *}
   5.225 +
   5.226 +      have "g \<subseteq> graph H' h' \<and> g \<noteq> graph H' h'"
   5.227 +        -- {* @{text h'} is an extension of @{text h} \dots \skp *}
   5.228 +      proof
   5.229 +        show "g \<subseteq> graph H' h'"
   5.230          proof -
   5.231 -          from h have "\<exists>xi. \<forall>y \<in> H. - p (y + x') - h y \<le> xi
   5.232 -                          \<and> xi \<le> p (y + x') - h y"
   5.233 -          proof (rule ex_xi)
   5.234 -            fix u v assume "u \<in> H"  "v \<in> H"
   5.235 -            from h have "h v - h u = h (v - u)"
   5.236 -              by (simp! add: linearform_diff)
   5.237 -            also have "... \<le> p (v - u)"
   5.238 -              by (simp!)
   5.239 -            also have "v - u = x' + - x' + v + - u"
   5.240 -              by (simp! add: diff_eq1)
   5.241 -            also have "... = v + x' + - (u + x')"
   5.242 -              by (simp!)
   5.243 -            also have "... = (v + x') - (u + x')"
   5.244 -              by (simp! add: diff_eq1)
   5.245 -            also have "p ... \<le> p (v + x') + p (u + x')"
   5.246 -              by (rule seminorm_diff_subadditive) (simp_all!)
   5.247 -            finally have "h v - h u \<le> p (v + x') + p (u + x')" .
   5.248 -
   5.249 -            thus "- p (u + x') - h u \<le> p (v + x') - h v"
   5.250 -              by (rule real_diff_ineq_swap)
   5.251 +          have  "graph H h \<subseteq> graph H' h'"
   5.252 +          proof (rule graph_extI)
   5.253 +            fix t assume t: "t \<in> H"
   5.254 +            have "(SOME (y, a). t = y + a \<cdot> x' \<and> y \<in> H) = (t, 0)"
   5.255 +              by (rule decomp_H'_H)
   5.256 +            with h'_def show "h t = h' t" by (simp add: Let_def)
   5.257 +          next
   5.258 +            from HH' show "H \<subseteq> H'" ..
   5.259            qed
   5.260 -          thus ?thesis ..
   5.261 +          with g_rep show ?thesis by (simp only:)
   5.262          qed
   5.263  
   5.264 -        def h' \<equiv> "\<lambda>x. let (y, a) = SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H
   5.265 -                       in h y + a * xi"
   5.266 -        -- {* Define the extension @{text h'} of @{text h} to @{text H'} using @{text \<xi>}. \skp *}
   5.267 -        show ?thesis
   5.268 -        proof
   5.269 -          show "g \<subseteq> graph H' h' \<and> g \<noteq> graph H' h'"
   5.270 -          -- {* Show that @{text h'} is an extension of @{text h} \dots \skp *}
   5.271 +        show "g \<noteq> graph H' h'"
   5.272 +        proof -
   5.273 +          have "graph H h \<noteq> graph H' h'"
   5.274            proof
   5.275 -            show "g \<subseteq> graph H' h'"
   5.276 -            proof -
   5.277 -              have  "graph H h \<subseteq> graph H' h'"
   5.278 -              proof (rule graph_extI)
   5.279 -                fix t assume "t \<in> H"
   5.280 -                have "(SOME (y, a). t = y + a \<cdot> x' \<and> y \<in> H)
   5.281 -                     = (t, 0)"
   5.282 -                  by (rule decomp_H'_H) (assumption+, rule x')
   5.283 -                thus "h t = h' t" by (simp! add: Let_def)
   5.284 -              next
   5.285 -                show "H \<subseteq> H'"
   5.286 -                proof (rule subspace_subset)
   5.287 -                  show "is_subspace H H'"
   5.288 -                  proof (unfold H'_def, rule subspace_vs_sum1)
   5.289 -                    show "is_vectorspace H" ..
   5.290 -                    show "is_vectorspace (lin x')" ..
   5.291 -                  qed
   5.292 -                qed
   5.293 -              qed
   5.294 -              thus ?thesis by (simp!)
   5.295 +            assume eq: "graph H h = graph H' h'"
   5.296 +            have "x' \<in> H'"
   5.297 +            proof (unfold H'_def, rule)
   5.298 +              from H show "0 \<in> H" by (rule vectorspace.zero)
   5.299 +              from x'E show "x' \<in> lin x'" by (rule x_lin_x)
   5.300 +              from x'E show "x' = 0 + x'" by simp
   5.301              qed
   5.302 -            show "g \<noteq> graph H' h'"
   5.303 -            proof -
   5.304 -              have "graph H h \<noteq> graph H' h'"
   5.305 -              proof
   5.306 -                assume e: "graph H h = graph H' h'"
   5.307 -                have "x' \<in> H'"
   5.308 -                proof (unfold H'_def, rule vs_sumI)
   5.309 -                  show "x' = 0 + x'" by (simp!)
   5.310 -                  from h show "0 \<in> H" ..
   5.311 -                  show "x' \<in> lin x'" by (rule x_lin_x)
   5.312 -                qed
   5.313 -                hence "(x', h' x') \<in> graph H' h'" ..
   5.314 -                with e have "(x', h' x') \<in> graph H h" by simp
   5.315 -                hence "x' \<in> H" ..
   5.316 -                thus False by contradiction
   5.317 -              qed
   5.318 -              thus ?thesis by (simp!)
   5.319 -            qed
   5.320 +            hence "(x', h' x') \<in> graph H' h'" ..
   5.321 +            with eq have "(x', h' x') \<in> graph H h" by (simp only:)
   5.322 +            hence "x' \<in> H" ..
   5.323 +            thus False by contradiction
   5.324            qed
   5.325 -          show "graph H' h' \<in> M"
   5.326 -          -- {* and @{text h'} is norm-preserving. \skp *}
   5.327 -          proof -
   5.328 -            have "graph H' h' \<in> norm_pres_extensions E p F f"
   5.329 -            proof (rule norm_pres_extensionI2)
   5.330 -              show "is_linearform H' h'"
   5.331 -                by (rule h'_lf) (simp! add: x')+
   5.332 -              show "is_subspace H' E"
   5.333 -                by (unfold H'_def)
   5.334 -                  (rule vs_sum_subspace [OF _ lin_subspace])
   5.335 -              have "is_subspace F H" .
   5.336 -              also from h lin_vs
   5.337 -              have [folded H'_def]: "is_subspace H (H + lin x')" ..
   5.338 -              finally (subspace_trans [OF _ h])
   5.339 -              show f_h': "is_subspace F H'" .
   5.340 -
   5.341 -              show "graph F f \<subseteq> graph H' h'"
   5.342 -              proof (rule graph_extI)
   5.343 -                fix x assume "x \<in> F"
   5.344 -                have "f x = h x" ..
   5.345 -                also have " ... = h x + 0 * xi" by simp
   5.346 -                also
   5.347 -                have "... = (let (y, a) = (x, 0) in h y + a * xi)"
   5.348 -                  by (simp add: Let_def)
   5.349 -                also have
   5.350 -                  "(x, 0) = (SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H)"
   5.351 -                  by (rule decomp_H'_H [symmetric]) (simp! add: x')+
   5.352 -                also have
   5.353 -                  "(let (y, a) = (SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H)
   5.354 -                    in h y + a * xi) = h' x" by (simp!)
   5.355 -                finally show "f x = h' x" .
   5.356 -              next
   5.357 -                from f_h' show "F \<subseteq> H'" ..
   5.358 -              qed
   5.359 -
   5.360 -              show "\<forall>x \<in> H'. h' x \<le> p x"
   5.361 -                by (rule h'_norm_pres) (assumption+, rule x')
   5.362 -            qed
   5.363 -            thus "graph H' h' \<in> M" by (simp!)
   5.364 -          qed
   5.365 +          with g_rep show ?thesis by simp
   5.366          qed
   5.367        qed
   5.368 -      hence "\<not> (\<forall>x \<in> M. g \<subseteq> x \<longrightarrow> g = x)" by simp
   5.369 -        -- {* So the graph @{text g} of @{text h} cannot be maximal. Contradiction! \skp *}
   5.370 -      thus "H = E" by contradiction
   5.371 +      moreover have "graph H' h' \<in> M"
   5.372 +        -- {* and @{text h'} is norm-preserving. \skp *}
   5.373 +      proof (unfold M_def)
   5.374 +        show "graph H' h' \<in> norm_pres_extensions E p F f"
   5.375 +        proof (rule norm_pres_extensionI2)
   5.376 +          show "linearform H' h'" by (rule h'_lf)
   5.377 +          show "H' \<unlhd> E"
   5.378 +          proof (unfold H'_def, rule)
   5.379 +            show "H \<unlhd> E" .
   5.380 +            show "vectorspace E" .
   5.381 +            from x'E show "lin x' \<unlhd> E" ..
   5.382 +          qed
   5.383 +          have "F \<unlhd> H" .
   5.384 +          from H this HH' show FH': "F \<unlhd> H'"
   5.385 +            by (rule vectorspace.subspace_trans)
   5.386 +          show "graph F f \<subseteq> graph H' h'"
   5.387 +          proof (rule graph_extI)
   5.388 +            fix x assume x: "x \<in> F"
   5.389 +            with graphs have "f x = h x" ..
   5.390 +            also have "\<dots> = h x + 0 * xi" by simp
   5.391 +            also have "\<dots> = (let (y, a) = (x, 0) in h y + a * xi)"
   5.392 +              by (simp add: Let_def)
   5.393 +            also have "(x, 0) =
   5.394 +                (SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H)"
   5.395 +            proof (rule decomp_H'_H [symmetric])
   5.396 +              from FH x show "x \<in> H" ..
   5.397 +              from x' show "x' \<noteq> 0" .
   5.398 +            qed
   5.399 +            also have
   5.400 +              "(let (y, a) = (SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H)
   5.401 +              in h y + a * xi) = h' x" by (simp only: h'_def)
   5.402 +            finally show "f x = h' x" .
   5.403 +          next
   5.404 +            from FH' show "F \<subseteq> H'" ..
   5.405 +          qed
   5.406 +          show "\<forall>x \<in> H'. h' x \<le> p x" by (rule h'_norm_pres)
   5.407 +        qed
   5.408 +      qed
   5.409 +      ultimately show ?thesis ..
   5.410      qed
   5.411 -    thus "\<exists>h. is_linearform E h \<and> (\<forall>x \<in> F. h x = f x)
   5.412 -      \<and> (\<forall>x \<in> E. h x \<le> p x)"
   5.413 -    proof (intro exI conjI)
   5.414 -      assume eq: "H = E"
   5.415 -      from eq show "is_linearform E h" by (simp!)
   5.416 -      show "\<forall>x \<in> F. h x = f x"
   5.417 -      proof
   5.418 -        fix x assume "x \<in> F" have "f x = h x " ..
   5.419 -        thus "h x = f x" ..
   5.420 -      qed
   5.421 -      from eq show "\<forall>x \<in> E. h x \<le> p x" by (blast!)
   5.422 -    qed
   5.423 +    hence "\<not> (\<forall>x \<in> M. g \<subseteq> x \<longrightarrow> g = x)" by simp
   5.424 +      -- {* So the graph @{text g} of @{text h} cannot be maximal. Contradiction! \skp *}
   5.425 +    then show "H = E" by contradiction
   5.426    qed
   5.427 +
   5.428 +  from HE_eq and linearform have "linearform E h"
   5.429 +    by (simp only:)
   5.430 +  moreover have "\<forall>x \<in> F. h x = f x"
   5.431 +  proof
   5.432 +    fix x assume "x \<in> F"
   5.433 +    with graphs have "f x = h x" ..
   5.434 +    then show "h x = f x" ..
   5.435 +  qed
   5.436 +  moreover from HE_eq and hp have "\<forall>x \<in> E. h x \<le> p x"
   5.437 +    by (simp only:)
   5.438 +  ultimately show ?thesis by blast
   5.439  qed
   5.440  
   5.441  
   5.442 @@ -314,26 +298,28 @@
   5.443  *}
   5.444  
   5.445  theorem abs_HahnBanach:
   5.446 -  "is_vectorspace E \<Longrightarrow> is_subspace F E \<Longrightarrow> is_linearform F f
   5.447 -  \<Longrightarrow> is_seminorm E p \<Longrightarrow> \<forall>x \<in> F. \<bar>f x\<bar> \<le> p x
   5.448 -  \<Longrightarrow> \<exists>g. is_linearform E g \<and> (\<forall>x \<in> F. g x = f x)
   5.449 +  includes vectorspace E + subvectorspace F E +
   5.450 +    linearform F f + seminorm_vectorspace E p
   5.451 +  assumes fp: "\<forall>x \<in> F. \<bar>f x\<bar> \<le> p x"
   5.452 +  shows "\<exists>g. linearform E g
   5.453 +    \<and> (\<forall>x \<in> F. g x = f x)
   5.454      \<and> (\<forall>x \<in> E. \<bar>g x\<bar> \<le> p x)"
   5.455  proof -
   5.456 -assume "is_vectorspace E"  "is_subspace F E"  "is_seminorm E p"
   5.457 -"is_linearform F f"  "\<forall>x \<in> F. \<bar>f x\<bar> \<le> p x"
   5.458 -have "\<forall>x \<in> F. f x \<le> p x"  by (rule abs_ineq_iff [THEN iffD1])
   5.459 -hence "\<exists>g. is_linearform E g \<and> (\<forall>x \<in> F. g x = f x)
   5.460 -          \<and> (\<forall>x \<in> E. g x \<le> p x)"
   5.461 -by (simp! only: HahnBanach)
   5.462 -thus ?thesis
   5.463 -proof (elim exE conjE)
   5.464 -fix g assume "is_linearform E g"  "\<forall>x \<in> F. g x = f x"
   5.465 -              "\<forall>x \<in> E. g x \<le> p x"
   5.466 -hence "\<forall>x \<in> E. \<bar>g x\<bar> \<le> p x"
   5.467 -  by (simp! add: abs_ineq_iff [OF subspace_refl])
   5.468 -thus ?thesis by (intro exI conjI)
   5.469 +  have "\<exists>g. linearform E g \<and> (\<forall>x \<in> F. g x = f x)
   5.470 +    \<and> (\<forall>x \<in> E. g x \<le> p x)"
   5.471 +  proof (rule HahnBanach)
   5.472 +    show "\<forall>x \<in> F. f x \<le> p x"
   5.473 +      by (rule abs_ineq_iff [THEN iffD1])
   5.474 +  qed
   5.475 +  then obtain g where * : "linearform E g"  "\<forall>x \<in> F. g x = f x"
   5.476 +      and "\<forall>x \<in> E. g x \<le> p x" by blast
   5.477 +  have "\<forall>x \<in> E. \<bar>g x\<bar> \<le> p x"
   5.478 +  proof (rule abs_ineq_iff [THEN iffD2])
   5.479 +    show "E \<unlhd> E" ..
   5.480 +  qed
   5.481 +  with * show ?thesis by blast
   5.482  qed
   5.483 -qed
   5.484 +
   5.485  
   5.486  subsection {* The Hahn-Banach Theorem for normed spaces *}
   5.487  
   5.488 @@ -344,126 +330,108 @@
   5.489  *}
   5.490  
   5.491  theorem norm_HahnBanach:
   5.492 -  "is_normed_vectorspace E norm \<Longrightarrow> is_subspace F E
   5.493 -  \<Longrightarrow> is_linearform F f \<Longrightarrow> is_continuous F norm f
   5.494 -  \<Longrightarrow> \<exists>g. is_linearform E g
   5.495 -     \<and> is_continuous E norm g
   5.496 +  includes functional_vectorspace E + subvectorspace F E +
   5.497 +    linearform F f + continuous F norm f
   5.498 +  shows "\<exists>g. linearform E g
   5.499 +     \<and> continuous E norm g
   5.500       \<and> (\<forall>x \<in> F. g x = f x)
   5.501 -     \<and> \<parallel>g\<parallel>E,norm = \<parallel>f\<parallel>F,norm"
   5.502 -proof -
   5.503 -assume e_norm: "is_normed_vectorspace E norm"
   5.504 -assume f: "is_subspace F E"  "is_linearform F f"
   5.505 -assume f_cont: "is_continuous F norm f"
   5.506 -have e: "is_vectorspace E" ..
   5.507 -hence f_norm: "is_normed_vectorspace F norm" ..
   5.508 -
   5.509 -txt{*
   5.510 -  We define a function @{text p} on @{text E} as follows:
   5.511 -  @{text "p x = \<parallel>f\<parallel> \<cdot> \<parallel>x\<parallel>"}
   5.512 -*}
   5.513 -
   5.514 -def p \<equiv> "\<lambda>x. \<parallel>f\<parallel>F,norm * norm x"
   5.515 -
   5.516 -txt {* @{text p} is a seminorm on @{text E}: *}
   5.517 -
   5.518 -have q: "is_seminorm E p"
   5.519 -proof
   5.520 -fix x y a assume "x \<in> E"  "y \<in> E"
   5.521 -
   5.522 -txt {* @{text p} is positive definite: *}
   5.523 -
   5.524 -show "0 \<le> p x"
   5.525 -proof (unfold p_def, rule real_le_mult_order1a)
   5.526 -  from f_cont f_norm show "0 \<le> \<parallel>f\<parallel>F,norm" ..
   5.527 -  show "0 \<le> norm x" ..
   5.528 -qed
   5.529 -
   5.530 -txt {* @{text p} is absolutely homogenous: *}
   5.531 -
   5.532 -show "p (a \<cdot> x) = \<bar>a\<bar> * p x"
   5.533 -proof -
   5.534 -  have "p (a \<cdot> x) = \<parallel>f\<parallel>F,norm * norm (a \<cdot> x)"
   5.535 -    by (simp!)
   5.536 -  also have "norm (a \<cdot> x) = \<bar>a\<bar> * norm x"
   5.537 -    by (rule normed_vs_norm_abs_homogenous)
   5.538 -  also have "\<parallel>f\<parallel>F,norm * (\<bar>a\<bar> * norm x )
   5.539 -    = \<bar>a\<bar> * (\<parallel>f\<parallel>F,norm * norm x)"
   5.540 -    by (simp! only: real_mult_left_commute)
   5.541 -  also have "... = \<bar>a\<bar> * p x" by (simp!)
   5.542 -  finally show ?thesis .
   5.543 -qed
   5.544 -
   5.545 -txt {* Furthermore, @{text p} is subadditive: *}
   5.546 -
   5.547 -show "p (x + y) \<le> p x + p y"
   5.548 +     \<and> \<parallel>g\<parallel>\<hyphen>E = \<parallel>f\<parallel>\<hyphen>F"
   5.549  proof -
   5.550 -  have "p (x + y) = \<parallel>f\<parallel>F,norm * norm (x + y)"
   5.551 -    by (simp!)
   5.552 -  also
   5.553 -  have "... \<le> \<parallel>f\<parallel>F,norm * (norm x + norm y)"
   5.554 -  proof (rule real_mult_le_le_mono1a)
   5.555 -    from f_cont f_norm show "0 \<le> \<parallel>f\<parallel>F,norm" ..
   5.556 -    show "norm (x + y) \<le> norm x + norm y" ..
   5.557 -  qed
   5.558 -  also have "... = \<parallel>f\<parallel>F,norm * norm x
   5.559 -                    + \<parallel>f\<parallel>F,norm * norm y"
   5.560 -    by (simp! only: real_add_mult_distrib2)
   5.561 -  finally show ?thesis by (simp!)
   5.562 -qed
   5.563 -qed
   5.564 +  have E: "vectorspace E" .
   5.565 +  have E_norm: "normed_vectorspace E norm" ..
   5.566 +  have FE: "F \<unlhd> E" .
   5.567 +  have F: "vectorspace F" ..
   5.568 +  have linearform: "linearform F f" .
   5.569 +  have F_norm: "normed_vectorspace F norm" ..
   5.570 +
   5.571 +  txt {* We define a function @{text p} on @{text E} as follows:
   5.572 +    @{text "p x = \<parallel>f\<parallel> \<cdot> \<parallel>x\<parallel>"} *}
   5.573 +  def p \<equiv> "\<lambda>x. \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>"
   5.574 +
   5.575 +  txt {* @{text p} is a seminorm on @{text E}: *}
   5.576 +  have q: "seminorm E p"
   5.577 +  proof
   5.578 +    fix x y a assume x: "x \<in> E" and y: "y \<in> E"
   5.579  
   5.580 -txt {* @{text f} is bounded by @{text p}. *}
   5.581 +    txt {* @{text p} is positive definite: *}
   5.582 +    show "0 \<le> p x"
   5.583 +    proof (unfold p_def, rule real_le_mult_order1a)
   5.584 +      show "0 \<le> \<parallel>f\<parallel>\<hyphen>F"
   5.585 +        apply (unfold function_norm_def B_def)
   5.586 +        using normed_vectorspace.axioms [OF F_norm] ..
   5.587 +      from x show "0 \<le> \<parallel>x\<parallel>" ..
   5.588 +    qed
   5.589 +
   5.590 +    txt {* @{text p} is absolutely homogenous: *}
   5.591  
   5.592 -have "\<forall>x \<in> F. \<bar>f x\<bar> \<le> p x"
   5.593 -proof
   5.594 -fix x assume "x \<in> F"
   5.595 - from f_norm show "\<bar>f x\<bar> \<le> p x"
   5.596 -   by (simp! add: norm_fx_le_norm_f_norm_x)
   5.597 -qed
   5.598 +    show "p (a \<cdot> x) = \<bar>a\<bar> * p x"
   5.599 +    proof -
   5.600 +      have "p (a \<cdot> x) = \<parallel>f\<parallel>\<hyphen>F * \<parallel>a \<cdot> x\<parallel>"
   5.601 +        by (simp only: p_def)
   5.602 +      also from x have "\<parallel>a \<cdot> x\<parallel> = \<bar>a\<bar> * \<parallel>x\<parallel>"
   5.603 +        by (rule abs_homogenous)
   5.604 +      also have "\<parallel>f\<parallel>\<hyphen>F * (\<bar>a\<bar> * \<parallel>x\<parallel>) = \<bar>a\<bar> * (\<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>)"
   5.605 +        by simp
   5.606 +      also have "\<dots> = \<bar>a\<bar> * p x"
   5.607 +        by (simp only: p_def)
   5.608 +      finally show ?thesis .
   5.609 +    qed
   5.610 +
   5.611 +    txt {* Furthermore, @{text p} is subadditive: *}
   5.612  
   5.613 -txt {*
   5.614 -  Using the fact that @{text p} is a seminorm and @{text f} is bounded
   5.615 -  by @{text p} we can apply the Hahn-Banach Theorem for real vector
   5.616 -  spaces. So @{text f} can be extended in a norm-preserving way to
   5.617 -  some function @{text g} on the whole vector space @{text E}.
   5.618 -*}
   5.619 +    show "p (x + y) \<le> p x + p y"
   5.620 +    proof -
   5.621 +      have "p (x + y) = \<parallel>f\<parallel>\<hyphen>F * \<parallel>x + y\<parallel>"
   5.622 +        by (simp only: p_def)
   5.623 +      also have "\<dots> \<le> \<parallel>f\<parallel>\<hyphen>F * (\<parallel>x\<parallel> + \<parallel>y\<parallel>)"
   5.624 +      proof (rule real_mult_le_le_mono1a)
   5.625 +        show "0 \<le> \<parallel>f\<parallel>\<hyphen>F"
   5.626 +          apply (unfold function_norm_def B_def)
   5.627 +          using normed_vectorspace.axioms [OF F_norm] ..  (* FIXME *)
   5.628 +        from x y show "\<parallel>x + y\<parallel> \<le> \<parallel>x\<parallel> + \<parallel>y\<parallel>" ..
   5.629 +      qed
   5.630 +      also have "\<dots> = \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel> + \<parallel>f\<parallel>\<hyphen>F * \<parallel>y\<parallel>"
   5.631 +        by (simp only: real_add_mult_distrib2)
   5.632 +      also have "\<dots> = p x + p y"
   5.633 +        by (simp only: p_def)
   5.634 +      finally show ?thesis .
   5.635 +    qed
   5.636 +  qed
   5.637  
   5.638 -with e f q
   5.639 -have "\<exists>g. is_linearform E g \<and> (\<forall>x \<in> F. g x = f x)
   5.640 -        \<and> (\<forall>x \<in> E. \<bar>g x\<bar> \<le> p x)"
   5.641 -by (simp! add: abs_HahnBanach)
   5.642 +  txt {* @{text f} is bounded by @{text p}. *}
   5.643  
   5.644 -thus ?thesis
   5.645 -proof (elim exE conjE)
   5.646 -fix g
   5.647 -assume "is_linearform E g" and a: "\<forall>x \<in> F. g x = f x"
   5.648 -   and b: "\<forall>x \<in> E. \<bar>g x\<bar> \<le> p x"
   5.649 +  have "\<forall>x \<in> F. \<bar>f x\<bar> \<le> p x"
   5.650 +  proof
   5.651 +    fix x assume "x \<in> F"
   5.652 +    show "\<bar>f x\<bar> \<le> p x"
   5.653 +      apply (unfold p_def function_norm_def B_def)
   5.654 +      using normed_vectorspace.axioms [OF F_norm] .. (* FIXME *)
   5.655 +  qed
   5.656  
   5.657 -show "\<exists>g. is_linearform E g
   5.658 -        \<and> is_continuous E norm g
   5.659 -        \<and> (\<forall>x \<in> F. g x = f x)
   5.660 -        \<and> \<parallel>g\<parallel>E,norm = \<parallel>f\<parallel>F,norm"
   5.661 -proof (intro exI conjI)
   5.662 +  txt {* Using the fact that @{text p} is a seminorm and @{text f} is bounded
   5.663 +    by @{text p} we can apply the Hahn-Banach Theorem for real vector
   5.664 +    spaces. So @{text f} can be extended in a norm-preserving way to
   5.665 +    some function @{text g} on the whole vector space @{text E}. *}
   5.666  
   5.667 -txt {*
   5.668 -  We furthermore have to show that @{text g} is also continuous:
   5.669 -*}
   5.670 +  with E FE linearform q obtain g where
   5.671 +        linearformE: "linearform E g"
   5.672 +      and a: "\<forall>x \<in> F. g x = f x"
   5.673 +      and b: "\<forall>x \<in> E. \<bar>g x\<bar> \<le> p x"
   5.674 +    by (rule abs_HahnBanach [elim_format]) rules
   5.675  
   5.676 -  show g_cont: "is_continuous E norm g"
   5.677 +  txt {* We furthermore have to show that @{text g} is also continuous: *}
   5.678 +
   5.679 +  have g_cont: "continuous E norm g" using linearformE
   5.680    proof
   5.681      fix x assume "x \<in> E"
   5.682 -    with b show "\<bar>g x\<bar> \<le> \<parallel>f\<parallel>F,norm * norm x"
   5.683 -      by (simp add: p_def)
   5.684 +    with b show "\<bar>g x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>"
   5.685 +      by (simp only: p_def)
   5.686    qed
   5.687  
   5.688 -  txt {*
   5.689 -    To complete the proof, we show that
   5.690 -    @{text "\<parallel>g\<parallel> = \<parallel>f\<parallel>"}. \label{order_antisym} *}
   5.691 +  txt {* To complete the proof, we show that @{text "\<parallel>g\<parallel> = \<parallel>f\<parallel>"}. *}
   5.692  
   5.693 -  show "\<parallel>g\<parallel>E,norm = \<parallel>f\<parallel>F,norm"
   5.694 -    (is "?L = ?R")
   5.695 +  have "\<parallel>g\<parallel>\<hyphen>E = \<parallel>f\<parallel>\<hyphen>F"
   5.696    proof (rule order_antisym)
   5.697 -
   5.698      txt {*
   5.699        First we show @{text "\<parallel>g\<parallel> \<le> \<parallel>f\<parallel>"}.  The function norm @{text
   5.700        "\<parallel>g\<parallel>"} is defined as the smallest @{text "c \<in> \<real>"} such that
   5.701 @@ -480,40 +448,51 @@
   5.702        \end{center}
   5.703      *}
   5.704  
   5.705 -    have "\<forall>x \<in> E. \<bar>g x\<bar> \<le> \<parallel>f\<parallel>F,norm * norm x"
   5.706 +    have "\<forall>x \<in> E. \<bar>g x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>"
   5.707      proof
   5.708        fix x assume "x \<in> E"
   5.709 -      show "\<bar>g x\<bar> \<le> \<parallel>f\<parallel>F,norm * norm x"
   5.710 -        by (simp!)
   5.711 -    qed
   5.712 -
   5.713 -    with g_cont e_norm show "?L \<le> ?R"
   5.714 -    proof (rule fnorm_le_ub)
   5.715 -      from f_cont f_norm show "0 \<le> \<parallel>f\<parallel>F,norm" ..
   5.716 +      with b show "\<bar>g x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>"
   5.717 +        by (simp only: p_def)
   5.718      qed
   5.719 -
   5.720 -    txt{* The other direction is achieved by a similar
   5.721 -    argument. *}
   5.722 +    show "\<parallel>g\<parallel>\<hyphen>E \<le> \<parallel>f\<parallel>\<hyphen>F"
   5.723 +      apply (unfold function_norm_def B_def)
   5.724 +      apply rule
   5.725 +      apply (rule normed_vectorspace.axioms [OF E_norm])+
   5.726 +      apply (rule continuous.axioms [OF g_cont])+
   5.727 +      apply (rule b [unfolded p_def function_norm_def B_def])
   5.728 +      using normed_vectorspace.axioms [OF F_norm] ..  (* FIXME *)
   5.729  
   5.730 -    have "\<forall>x \<in> F. \<bar>f x\<bar> \<le> \<parallel>g\<parallel>E,norm * norm x"
   5.731 +    txt {* The other direction is achieved by a similar argument. *}
   5.732 +
   5.733 +    have ** : "\<forall>x \<in> F. \<bar>f x\<bar> \<le> \<parallel>g\<parallel>\<hyphen>E * \<parallel>x\<parallel>"
   5.734      proof
   5.735 -      fix x assume "x \<in> F"
   5.736 +      fix x assume x: "x \<in> F"
   5.737        from a have "g x = f x" ..
   5.738 -      hence "\<bar>f x\<bar> = \<bar>g x\<bar>" by simp
   5.739 -      also from g_cont
   5.740 -      have "... \<le> \<parallel>g\<parallel>E,norm * norm x"
   5.741 -      proof (rule norm_fx_le_norm_f_norm_x)
   5.742 -        show "x \<in> E" ..
   5.743 +      hence "\<bar>f x\<bar> = \<bar>g x\<bar>" by (simp only:)
   5.744 +      also have "\<dots> \<le> \<parallel>g\<parallel>\<hyphen>E * \<parallel>x\<parallel>"
   5.745 +        apply (unfold function_norm_def B_def)
   5.746 +        apply rule
   5.747 +        apply (rule normed_vectorspace.axioms [OF E_norm])+
   5.748 +        apply (rule continuous.axioms [OF g_cont])+
   5.749 +      proof -
   5.750 +        from FE x show "x \<in> E" ..
   5.751        qed
   5.752 -      finally show "\<bar>f x\<bar> \<le> \<parallel>g\<parallel>E,norm * norm x" .
   5.753 +      finally show "\<bar>f x\<bar> \<le> \<parallel>g\<parallel>\<hyphen>E * \<parallel>x\<parallel>" .
   5.754      qed
   5.755 -    thus "?R \<le> ?L"
   5.756 -    proof (rule fnorm_le_ub [OF f_cont f_norm])
   5.757 -      from g_cont show "0 \<le> \<parallel>g\<parallel>E,norm" ..
   5.758 -    qed
   5.759 +    show "\<parallel>f\<parallel>\<hyphen>F \<le> \<parallel>g\<parallel>\<hyphen>E"
   5.760 +      apply (unfold function_norm_def B_def)
   5.761 +      apply rule
   5.762 +      apply (rule normed_vectorspace.axioms [OF F_norm])+
   5.763 +      apply assumption+
   5.764 +      apply (rule ** [unfolded function_norm_def B_def])
   5.765 +      apply rule
   5.766 +      apply assumption+
   5.767 +      apply (rule continuous.axioms [OF g_cont])+
   5.768 +      done  (* FIXME *)
   5.769    qed
   5.770 -qed
   5.771 -qed
   5.772 +
   5.773 +  with linearformE a g_cont show ?thesis
   5.774 +    by blast
   5.775  qed
   5.776  
   5.777  end
     6.1 --- a/src/HOL/Real/HahnBanach/HahnBanachExtLemmas.thy	Thu Aug 22 12:28:41 2002 +0200
     6.2 +++ b/src/HOL/Real/HahnBanach/HahnBanachExtLemmas.thy	Thu Aug 22 20:49:43 2002 +0200
     6.3 @@ -17,17 +17,15 @@
     6.4    an element in @{text "E - H"}.  @{text H} is extended to the direct
     6.5    sum @{text "H' = H + lin x\<^sub>0"}, so for any @{text "x \<in> H'"}
     6.6    the decomposition of @{text "x = y + a \<cdot> x"} with @{text "y \<in> H"} is
     6.7 -  unique. @{text h'} is defined on @{text H'} by
     6.8 -  @{text "h' x = h y + a \<cdot> \<xi>"} for a certain @{text \<xi>}.
     6.9 +  unique. @{text h'} is defined on @{text H'} by @{text "h' x = h y +
    6.10 +  a \<cdot> \<xi>"} for a certain @{text \<xi>}.
    6.11  
    6.12    Subsequently we show some properties of this extension @{text h'} of
    6.13    @{text h}.
    6.14 -*}
    6.15  
    6.16 -text {*
    6.17 -  This lemma will be used to show the existence of a linear extension
    6.18 -  of @{text f} (see page \pageref{ex-xi-use}). It is a consequence of
    6.19 -  the completeness of @{text \<real>}. To show
    6.20 +  \medskip This lemma will be used to show the existence of a linear
    6.21 +  extension of @{text f} (see page \pageref{ex-xi-use}). It is a
    6.22 +  consequence of the completeness of @{text \<real>}. To show
    6.23    \begin{center}
    6.24    \begin{tabular}{l}
    6.25    @{text "\<exists>\<xi>. \<forall>y \<in> F. a y \<le> \<xi> \<and> \<xi> \<le> b y"}
    6.26 @@ -42,307 +40,227 @@
    6.27  *}
    6.28  
    6.29  lemma ex_xi:
    6.30 -  "is_vectorspace F \<Longrightarrow> (\<And>u v. u \<in> F \<Longrightarrow> v \<in> F \<Longrightarrow> a u \<le> b v)
    6.31 -  \<Longrightarrow> \<exists>xi::real. \<forall>y \<in> F. a y \<le> xi \<and> xi \<le> b y"
    6.32 +  includes vectorspace F
    6.33 +  assumes r: "\<And>u v. u \<in> F \<Longrightarrow> v \<in> F \<Longrightarrow> a u \<le> b v"
    6.34 +  shows "\<exists>xi::real. \<forall>y \<in> F. a y \<le> xi \<and> xi \<le> b y"
    6.35  proof -
    6.36 -  assume vs: "is_vectorspace F"
    6.37 -  assume r: "(\<And>u v. u \<in> F \<Longrightarrow> v \<in> F \<Longrightarrow> a u \<le> (b v::real))"
    6.38 -
    6.39    txt {* From the completeness of the reals follows:
    6.40 -  The set @{text "S = {a u. u \<in> F}"} has a supremum, if
    6.41 -  it is non-empty and has an upper bound. *}
    6.42 -
    6.43 -  let ?S = "{a u :: real | u. u \<in> F}"
    6.44 -
    6.45 -  have "\<exists>xi. isLub UNIV ?S xi"
    6.46 -  proof (rule reals_complete)
    6.47 -
    6.48 -    txt {* The set @{text S} is non-empty, since @{text "a 0 \<in> S"}: *}
    6.49 -
    6.50 -    from vs have "a 0 \<in> ?S" by blast
    6.51 -    thus "\<exists>X. X \<in> ?S" ..
    6.52 -
    6.53 -    txt {* @{text "b 0"} is an upper bound of @{text S}: *}
    6.54 -
    6.55 -    show "\<exists>Y. isUb UNIV ?S Y"
    6.56 -    proof
    6.57 -      show "isUb UNIV ?S (b 0)"
    6.58 -      proof (intro isUbI setleI ballI)
    6.59 -        show "b 0 \<in> UNIV" ..
    6.60 -      next
    6.61 -
    6.62 -        txt {* Every element @{text "y \<in> S"} is less than @{text "b 0"}: *}
    6.63 +    The set @{text "S = {a u. u \<in> F}"} has a supremum, if it is
    6.64 +    non-empty and has an upper bound. *}
    6.65  
    6.66 -        fix y assume y: "y \<in> ?S"
    6.67 -        from y have "\<exists>u \<in> F. y = a u" by fast
    6.68 -        thus "y \<le> b 0"
    6.69 -        proof
    6.70 -          fix u assume "u \<in> F"
    6.71 -          assume "y = a u"
    6.72 -          also have "a u \<le> b 0" by (rule r) (simp!)+
    6.73 -          finally show ?thesis .
    6.74 -        qed
    6.75 -      qed
    6.76 +  let ?S = "{a u | u. u \<in> F}"
    6.77 +  have "\<exists>xi. lub ?S xi"
    6.78 +  proof (rule real_complete)
    6.79 +    have "a 0 \<in> ?S" by blast
    6.80 +    then show "\<exists>X. X \<in> ?S" ..
    6.81 +    have "\<forall>y \<in> ?S. y \<le> b 0"
    6.82 +    proof
    6.83 +      fix y assume y: "y \<in> ?S"
    6.84 +      then obtain u where u: "u \<in> F" and y: "y = a u" by blast
    6.85 +      from u and zero have "a u \<le> b 0" by (rule r)
    6.86 +      with y show "y \<le> b 0" by (simp only:)
    6.87      qed
    6.88 +    then show "\<exists>u. \<forall>y \<in> ?S. y \<le> u" ..
    6.89    qed
    6.90 -
    6.91 -  thus "\<exists>xi. \<forall>y \<in> F. a y \<le> xi \<and> xi \<le> b y"
    6.92 -  proof (elim exE)
    6.93 -    fix xi assume "isLub UNIV ?S xi"
    6.94 -    show ?thesis
    6.95 -    proof (intro exI conjI ballI)
    6.96 -
    6.97 -      txt {* For all @{text "y \<in> F"} holds @{text "a y \<le> \<xi>"}: *}
    6.98 -
    6.99 -      fix y assume y: "y \<in> F"
   6.100 -      show "a y \<le> xi"
   6.101 -      proof (rule isUbD)
   6.102 -        show "isUb UNIV ?S xi" ..
   6.103 -      qed (blast!)
   6.104 -    next
   6.105 -
   6.106 -      txt {* For all @{text "y \<in> F"} holds @{text "\<xi> \<le> b y"}: *}
   6.107 -
   6.108 -      fix y assume "y \<in> F"
   6.109 -      show "xi \<le> b y"
   6.110 -      proof (intro isLub_le_isUb isUbI setleI)
   6.111 -        show "b y \<in> UNIV" ..
   6.112 -        show "\<forall>ya \<in> ?S. ya \<le> b y"
   6.113 -        proof
   6.114 -          fix au assume au: "au \<in> ?S "
   6.115 -          hence "\<exists>u \<in> F. au = a u" by fast
   6.116 -          thus "au \<le> b y"
   6.117 -          proof
   6.118 -            fix u assume "u \<in> F" assume "au = a u"
   6.119 -            also have "... \<le> b y" by (rule r)
   6.120 -            finally show ?thesis .
   6.121 -          qed
   6.122 -        qed
   6.123 -      qed
   6.124 +  then obtain xi where xi: "lub ?S xi" ..
   6.125 +  {
   6.126 +    fix y assume "y \<in> F"
   6.127 +    then have "a y \<in> ?S" by blast
   6.128 +    with xi have "a y \<le> xi" by (rule lub.upper)
   6.129 +  } moreover {
   6.130 +    fix y assume y: "y \<in> F"
   6.131 +    from xi have "xi \<le> b y"
   6.132 +    proof (rule lub.least)
   6.133 +      fix au assume "au \<in> ?S"
   6.134 +      then obtain u where u: "u \<in> F" and au: "au = a u" by blast
   6.135 +      from u y have "a u \<le> b y" by (rule r)
   6.136 +      with au show "au \<le> b y" by (simp only:)
   6.137      qed
   6.138 -  qed
   6.139 +  } ultimately show "\<exists>xi. \<forall>y \<in> F. a y \<le> xi \<and> xi \<le> b y" by blast
   6.140  qed
   6.141  
   6.142  text {*
   6.143 -  \medskip The function @{text h'} is defined as a
   6.144 -  @{text "h' x = h y + a \<cdot> \<xi>"} where @{text "x = y + a \<cdot> \<xi>"} is a
   6.145 -  linear extension of @{text h} to @{text H'}. *}
   6.146 +  \medskip The function @{text h'} is defined as a @{text "h' x = h y
   6.147 +  + a \<cdot> \<xi>"} where @{text "x = y + a \<cdot> \<xi>"} is a linear extension of
   6.148 +  @{text h} to @{text H'}.
   6.149 +*}
   6.150  
   6.151  lemma h'_lf:
   6.152 -  "h' \<equiv> \<lambda>x. let (y, a) = SOME (y, a). x = y + a \<cdot> x0 \<and> y \<in> H in h y + a * xi
   6.153 -  \<Longrightarrow> H' \<equiv> H + lin x0 \<Longrightarrow> is_subspace H E \<Longrightarrow> is_linearform H h \<Longrightarrow> x0 \<notin> H
   6.154 -  \<Longrightarrow> x0 \<in> E \<Longrightarrow> x0 \<noteq> 0 \<Longrightarrow> is_vectorspace E
   6.155 -  \<Longrightarrow> is_linearform H' h'"
   6.156 -proof -
   6.157 -  assume h'_def:
   6.158 -    "h' \<equiv> (\<lambda>x. let (y, a) = SOME (y, a). x = y + a \<cdot> x0 \<and> y \<in> H
   6.159 -               in h y + a * xi)"
   6.160 +  includes var H + var h + var E
   6.161 +  assumes h'_def: "h' \<equiv> \<lambda>x. let (y, a) =
   6.162 +      SOME (y, a). x = y + a \<cdot> x0 \<and> y \<in> H in h y + a * xi"
   6.163      and H'_def: "H' \<equiv> H + lin x0"
   6.164 -    and vs: "is_subspace H E"  "is_linearform H h"  "x0 \<notin> H"
   6.165 -      "x0 \<noteq> 0"  "x0 \<in> E"  "is_vectorspace E"
   6.166 -
   6.167 -  have h': "is_vectorspace H'"
   6.168 -  proof (unfold H'_def, rule vs_sum_vs)
   6.169 -    show "is_subspace (lin x0) E" ..
   6.170 +    and HE: "H \<unlhd> E"
   6.171 +  includes linearform H h
   6.172 +  assumes x0: "x0 \<notin> H"  "x0 \<in> E"  "x0 \<noteq> 0"
   6.173 +  includes vectorspace E
   6.174 +  shows "linearform H' h'"
   6.175 +proof
   6.176 +  have H': "vectorspace H'"
   6.177 +  proof (unfold H'_def)
   6.178 +    have "x0 \<in> E" .
   6.179 +    then have "lin x0 \<unlhd> E" ..
   6.180 +    with HE show "vectorspace (H + lin x0)" ..
   6.181    qed
   6.182 -
   6.183 -  show ?thesis
   6.184 -  proof
   6.185 +  {
   6.186      fix x1 x2 assume x1: "x1 \<in> H'" and x2: "x2 \<in> H'"
   6.187 -
   6.188 -    txt {* We now have to show that @{text h'} is additive, i.~e.\
   6.189 -      @{text "h' (x\<^sub>1 + x\<^sub>2) = h' x\<^sub>1 + h' x\<^sub>2"} for
   6.190 -      @{text "x\<^sub>1, x\<^sub>2 \<in> H"}. *}
   6.191 +    show "h' (x1 + x2) = h' x1 + h' x2"
   6.192 +    proof -
   6.193 +      from H' x1 x2 have "x1 + x2 \<in> H'"
   6.194 +        by (rule vectorspace.add_closed)
   6.195 +      with x1 x2 obtain y y1 y2 a a1 a2 where
   6.196 +            x1x2: "x1 + x2 = y + a \<cdot> x0" and y: "y \<in> H"
   6.197 +          and x1_rep: "x1 = y1 + a1 \<cdot> x0" and y1: "y1 \<in> H"
   6.198 +          and x2_rep: "x2 = y2 + a2 \<cdot> x0" and y2: "y2 \<in> H"
   6.199 +        by (unfold H'_def sum_def lin_def) blast
   6.200  
   6.201 -    have x1x2: "x1 + x2 \<in> H'"
   6.202 -      by (rule vs_add_closed, rule h')
   6.203 -    from x1
   6.204 -    have ex_x1: "\<exists>y1 a1. x1 = y1 + a1 \<cdot> x0  \<and> y1 \<in> H"
   6.205 -      by (unfold H'_def vs_sum_def lin_def) fast
   6.206 -    from x2
   6.207 -    have ex_x2: "\<exists>y2 a2. x2 = y2 + a2 \<cdot> x0 \<and> y2 \<in> H"
   6.208 -      by (unfold H'_def vs_sum_def lin_def) fast
   6.209 -    from x1x2
   6.210 -    have ex_x1x2: "\<exists>y a. x1 + x2 = y + a \<cdot> x0 \<and> y \<in> H"
   6.211 -      by (unfold H'_def vs_sum_def lin_def) fast
   6.212 -
   6.213 -    from ex_x1 ex_x2 ex_x1x2
   6.214 -    show "h' (x1 + x2) = h' x1 + h' x2"
   6.215 -    proof (elim exE conjE)
   6.216 -      fix y1 y2 y a1 a2 a
   6.217 -      assume y1: "x1 = y1 + a1 \<cdot> x0"     and y1': "y1 \<in> H"
   6.218 -         and y2: "x2 = y2 + a2 \<cdot> x0"     and y2': "y2 \<in> H"
   6.219 -         and y: "x1 + x2 = y + a \<cdot> x0"   and y':  "y  \<in> H"
   6.220 -      txt {* \label{decomp-H-use}*}
   6.221 -      have ya: "y1 + y2 = y \<and> a1 + a2 = a"
   6.222 -      proof (rule decomp_H')
   6.223 -        show "y1 + y2 + (a1 + a2) \<cdot> x0 = y + a \<cdot> x0"
   6.224 -          by (simp! add: vs_add_mult_distrib2 [of E])
   6.225 -        show "y1 + y2 \<in> H" ..
   6.226 +      have ya: "y1 + y2 = y \<and> a1 + a2 = a" using _ HE _ y x0
   6.227 +      proof (rule decomp_H') txt_raw {* \label{decomp-H-use} *}
   6.228 +        from HE y1 y2 show "y1 + y2 \<in> H"
   6.229 +          by (rule subspace.add_closed)
   6.230 +        from x0 and HE y y1 y2
   6.231 +        have "x0 \<in> E"  "y \<in> E"  "y1 \<in> E"  "y2 \<in> E" by auto
   6.232 +        with x1_rep x2_rep have "(y1 + y2) + (a1 + a2) \<cdot> x0 = x1 + x2"
   6.233 +          by (simp add: add_ac add_mult_distrib2)
   6.234 +        also note x1x2
   6.235 +        finally show "(y1 + y2) + (a1 + a2) \<cdot> x0 = y + a \<cdot> x0" .
   6.236        qed
   6.237  
   6.238 +      from h'_def x1x2 _ HE y x0
   6.239        have "h' (x1 + x2) = h y + a * xi"
   6.240          by (rule h'_definite)
   6.241 -      also have "... = h (y1 + y2) + (a1 + a2) * xi"
   6.242 -        by (simp add: ya)
   6.243 -      also from vs y1' y2'
   6.244 -      have "... = h y1 + h y2 + a1 * xi + a2 * xi"
   6.245 -        by (simp add: linearform_add [of H]
   6.246 -                      real_add_mult_distrib)
   6.247 -      also have "... = (h y1 + a1 * xi) + (h y2 + a2 * xi)"
   6.248 +      also have "\<dots> = h (y1 + y2) + (a1 + a2) * xi"
   6.249 +        by (simp only: ya)
   6.250 +      also from y1 y2 have "h (y1 + y2) = h y1 + h y2"
   6.251          by simp
   6.252 -      also have "h y1 + a1 * xi = h' x1"
   6.253 +      also have "\<dots> + (a1 + a2) * xi = (h y1 + a1 * xi) + (h y2 + a2 * xi)"
   6.254 +        by (simp add: real_add_mult_distrib)
   6.255 +      also from h'_def x1_rep _ HE y1 x0
   6.256 +      have "h y1 + a1 * xi = h' x1"
   6.257          by (rule h'_definite [symmetric])
   6.258 -      also have "h y2 + a2 * xi = h' x2"
   6.259 +      also from h'_def x2_rep _ HE y2 x0
   6.260 +      have "h y2 + a2 * xi = h' x2"
   6.261          by (rule h'_definite [symmetric])
   6.262        finally show ?thesis .
   6.263      qed
   6.264 -
   6.265 -    txt {* We further have to show that @{text h'} is multiplicative,
   6.266 -    i.~e.\ @{text "h' (c \<cdot> x\<^sub>1) = c \<cdot> h' x\<^sub>1"} for @{text "x \<in> H"}
   6.267 -    and @{text "c \<in> \<real>"}. *}
   6.268 -
   6.269    next
   6.270 -    fix c x1 assume x1: "x1 \<in> H'"
   6.271 -    have ax1: "c \<cdot> x1 \<in> H'"
   6.272 -      by (rule vs_mult_closed, rule h')
   6.273 -    from x1
   6.274 -    have ex_x: "\<And>x. x\<in> H' \<Longrightarrow> \<exists>y a. x = y + a \<cdot> x0 \<and> y \<in> H"
   6.275 -      by (unfold H'_def vs_sum_def lin_def) fast
   6.276 +    fix x1 c assume x1: "x1 \<in> H'"
   6.277 +    show "h' (c \<cdot> x1) = c * (h' x1)"
   6.278 +    proof -
   6.279 +      from H' x1 have ax1: "c \<cdot> x1 \<in> H'"
   6.280 +        by (rule vectorspace.mult_closed)
   6.281 +      with x1 obtain y a y1 a1 where
   6.282 +            cx1_rep: "c \<cdot> x1 = y + a \<cdot> x0" and y: "y \<in> H"
   6.283 +          and x1_rep: "x1 = y1 + a1 \<cdot> x0" and y1: "y1 \<in> H"
   6.284 +        by (unfold H'_def sum_def lin_def) blast
   6.285  
   6.286 -    from x1 have ex_x1: "\<exists>y1 a1. x1 = y1 + a1 \<cdot> x0 \<and> y1 \<in> H"
   6.287 -      by (unfold H'_def vs_sum_def lin_def) fast
   6.288 -    with ex_x [of "c \<cdot> x1", OF ax1]
   6.289 -    show "h' (c \<cdot> x1) = c * (h' x1)"
   6.290 -    proof (elim exE conjE)
   6.291 -      fix y1 y a1 a
   6.292 -      assume y1: "x1 = y1 + a1 \<cdot> x0"     and y1': "y1 \<in> H"
   6.293 -        and y: "c \<cdot> x1 = y  + a \<cdot> x0"    and y': "y \<in> H"
   6.294 -
   6.295 -      have ya: "c \<cdot> y1 = y \<and> c * a1 = a"
   6.296 +      have ya: "c \<cdot> y1 = y \<and> c * a1 = a" using _ HE _ y x0
   6.297        proof (rule decomp_H')
   6.298 -        show "c \<cdot> y1 + (c * a1) \<cdot> x0 = y + a \<cdot> x0"
   6.299 -          by (simp! add: vs_add_mult_distrib1)
   6.300 -        show "c \<cdot> y1 \<in> H" ..
   6.301 +        from HE y1 show "c \<cdot> y1 \<in> H"
   6.302 +          by (rule subspace.mult_closed)
   6.303 +        from x0 and HE y y1
   6.304 +        have "x0 \<in> E"  "y \<in> E"  "y1 \<in> E" by auto
   6.305 +        with x1_rep have "c \<cdot> y1 + (c * a1) \<cdot> x0 = c \<cdot> x1"
   6.306 +          by (simp add: mult_assoc add_mult_distrib1)
   6.307 +        also note cx1_rep
   6.308 +        finally show "c \<cdot> y1 + (c * a1) \<cdot> x0 = y + a \<cdot> x0" .
   6.309        qed
   6.310  
   6.311 -      have "h' (c \<cdot> x1) = h y + a * xi"
   6.312 +      from h'_def cx1_rep _ HE y x0 have "h' (c \<cdot> x1) = h y + a * xi"
   6.313          by (rule h'_definite)
   6.314 -      also have "... = h (c \<cdot> y1) + (c * a1) * xi"
   6.315 -        by (simp add: ya)
   6.316 -      also from vs y1' have "... = c * h y1 + c * a1 * xi"
   6.317 -        by (simp add: linearform_mult [of H])
   6.318 -      also from vs y1' have "... = c * (h y1 + a1 * xi)"
   6.319 -        by (simp add: real_add_mult_distrib2 real_mult_assoc)
   6.320 -      also have "h y1 + a1 * xi = h' x1"
   6.321 +      also have "\<dots> = h (c \<cdot> y1) + (c * a1) * xi"
   6.322 +        by (simp only: ya)
   6.323 +      also from y1 have "h (c \<cdot> y1) = c * h y1"
   6.324 +        by simp
   6.325 +      also have "\<dots> + (c * a1) * xi = c * (h y1 + a1 * xi)"
   6.326 +        by (simp only: real_add_mult_distrib2)
   6.327 +      also from h'_def x1_rep _ HE y1 x0 have "h y1 + a1 * xi = h' x1"
   6.328          by (rule h'_definite [symmetric])
   6.329        finally show ?thesis .
   6.330      qed
   6.331 -  qed
   6.332 +  }
   6.333  qed
   6.334  
   6.335  text {* \medskip The linear extension @{text h'} of @{text h}
   6.336 -is bounded by the seminorm @{text p}. *}
   6.337 +  is bounded by the seminorm @{text p}. *}
   6.338  
   6.339  lemma h'_norm_pres:
   6.340 -  "h' \<equiv> \<lambda>x. let (y, a) = SOME (y, a). x = y + a \<cdot> x0 \<and> y \<in> H in h y + a * xi
   6.341 -  \<Longrightarrow> H' \<equiv> H + lin x0 \<Longrightarrow> x0 \<notin> H \<Longrightarrow> x0 \<in> E \<Longrightarrow> x0 \<noteq> 0 \<Longrightarrow> is_vectorspace E
   6.342 -  \<Longrightarrow> is_subspace H E \<Longrightarrow> is_seminorm E p \<Longrightarrow> is_linearform H h
   6.343 -  \<Longrightarrow> \<forall>y \<in> H. h y \<le> p y
   6.344 -  \<Longrightarrow> \<forall>y \<in> H. - p (y + x0) - h y \<le> xi \<and> xi \<le> p (y + x0) - h y
   6.345 -  \<Longrightarrow> \<forall>x \<in> H'. h' x \<le> p x"
   6.346 -proof
   6.347 -  assume h'_def:
   6.348 -    "h' \<equiv> (\<lambda>x. let (y, a) = SOME (y, a). x = y + a \<cdot> x0 \<and> y \<in> H
   6.349 -               in (h y) + a * xi)"
   6.350 +  includes var H + var h + var E
   6.351 +  assumes h'_def: "h' \<equiv> \<lambda>x. let (y, a) =
   6.352 +      SOME (y, a). x = y + a \<cdot> x0 \<and> y \<in> H in h y + a * xi"
   6.353      and H'_def: "H' \<equiv> H + lin x0"
   6.354 -    and vs: "x0 \<notin> H"  "x0 \<in> E"  "x0 \<noteq> 0"  "is_vectorspace E"
   6.355 -            "is_subspace H E"  "is_seminorm E p"  "is_linearform H h"
   6.356 -    and a: "\<forall>y \<in> H. h y \<le> p y"
   6.357 -  presume a1: "\<forall>ya \<in> H. - p (ya + x0) - h ya \<le> xi"
   6.358 -  presume a2: "\<forall>ya \<in> H. xi \<le> p (ya + x0) - h ya"
   6.359 -  fix x assume "x \<in> H'"
   6.360 -  have ex_x:
   6.361 -    "\<And>x. x \<in> H' \<Longrightarrow> \<exists>y a. x = y + a \<cdot> x0 \<and> y \<in> H"
   6.362 -    by (unfold H'_def vs_sum_def lin_def) fast
   6.363 -  have "\<exists>y a. x = y + a \<cdot> x0 \<and> y \<in> H"
   6.364 -    by (rule ex_x)
   6.365 -  thus "h' x \<le> p x"
   6.366 -  proof (elim exE conjE)
   6.367 -    fix y a assume x: "x = y + a \<cdot> x0" and y: "y \<in> H"
   6.368 -    have "h' x = h y + a * xi"
   6.369 +    and x0: "x0 \<notin> H"  "x0 \<in> E"  "x0 \<noteq> 0"
   6.370 +  includes vectorspace E + subvectorspace H E +
   6.371 +    seminorm E p + linearform H h
   6.372 +  assumes a: "\<forall>y \<in> H. h y \<le> p y"
   6.373 +    and a': "\<forall>y \<in> H. - p (y + x0) - h y \<le> xi \<and> xi \<le> p (y + x0) - h y"
   6.374 +  shows "\<forall>x \<in> H'. h' x \<le> p x"
   6.375 +proof
   6.376 +  fix x assume x': "x \<in> H'"
   6.377 +  show "h' x \<le> p x"
   6.378 +  proof -
   6.379 +    from a' have a1: "\<forall>ya \<in> H. - p (ya + x0) - h ya \<le> xi"
   6.380 +      and a2: "\<forall>ya \<in> H. xi \<le> p (ya + x0) - h ya" by auto
   6.381 +    from x' obtain y a where
   6.382 +        x_rep: "x = y + a \<cdot> x0" and y: "y \<in> H"
   6.383 +      by (unfold H'_def sum_def lin_def) blast
   6.384 +    from y have y': "y \<in> E" ..
   6.385 +    from y have ay: "inverse a \<cdot> y \<in> H" by simp
   6.386 +
   6.387 +    from h'_def x_rep _ _ y x0 have "h' x = h y + a * xi"
   6.388        by (rule h'_definite)
   6.389 -
   6.390 -    txt {* Now we show @{text "h y + a \<cdot> \<xi> \<le> p (y + a \<cdot> x\<^sub>0)"}
   6.391 -    by case analysis on @{text a}. *}
   6.392 -
   6.393 -    also have "... \<le> p (y + a \<cdot> x0)"
   6.394 +    also have "\<dots> \<le> p (y + a \<cdot> x0)"
   6.395      proof (rule linorder_cases)
   6.396 -
   6.397        assume z: "a = 0"
   6.398 -      with vs y a show ?thesis by simp
   6.399 -
   6.400 -    txt {* In the case @{text "a < 0"}, we use @{text "a\<^sub>1"}
   6.401 -    with @{text ya} taken as @{text "y / a"}: *}
   6.402 -
   6.403 +      then have "h y + a * xi = h y" by simp
   6.404 +      also from a y have "\<dots> \<le> p y" ..
   6.405 +      also from x0 y' z have "p y = p (y + a \<cdot> x0)" by simp
   6.406 +      finally show ?thesis .
   6.407      next
   6.408 +      txt {* In the case @{text "a < 0"}, we use @{text "a\<^sub>1"}
   6.409 +        with @{text ya} taken as @{text "y / a"}: *}
   6.410        assume lz: "a < 0" hence nz: "a \<noteq> 0" by simp
   6.411 -      from a1
   6.412 -      have "- p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y) \<le> xi"
   6.413 -        by (rule bspec) (simp!)
   6.414 -
   6.415 -      txt {* The thesis for this case now follows by a short
   6.416 -      calculation. *}
   6.417 -      hence "a * xi \<le> a * (- p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y))"
   6.418 -        by (rule real_mult_less_le_anti [OF lz])
   6.419 -      also
   6.420 -      have "... = - a * (p (inverse a \<cdot> y + x0)) - a * (h (inverse a \<cdot> y))"
   6.421 +      from a1 ay
   6.422 +      have "- p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y) \<le> xi" ..
   6.423 +      with lz have "a * xi \<le>
   6.424 +          a * (- p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y))"
   6.425 +        by (rule real_mult_less_le_anti)
   6.426 +      also have "\<dots> =
   6.427 +          - a * (p (inverse a \<cdot> y + x0)) - a * (h (inverse a \<cdot> y))"
   6.428          by (rule real_mult_diff_distrib)
   6.429 -      also from lz vs y
   6.430 -      have "- a * (p (inverse a \<cdot> y + x0)) = p (a \<cdot> (inverse a \<cdot> y + x0))"
   6.431 -        by (simp add: seminorm_abs_homogenous abs_minus_eqI2)
   6.432 -      also from nz vs y have "... = p (y + a \<cdot> x0)"
   6.433 -        by (simp add: vs_add_mult_distrib1)
   6.434 -      also from nz vs y have "a * (h (inverse a \<cdot> y)) =  h y"
   6.435 -        by (simp add: linearform_mult [symmetric])
   6.436 +      also from lz x0 y' have "- a * (p (inverse a \<cdot> y + x0)) =
   6.437 +          p (a \<cdot> (inverse a \<cdot> y + x0))"
   6.438 +        by (simp add: abs_homogenous abs_minus_eqI2)
   6.439 +      also from nz x0 y' have "\<dots> = p (y + a \<cdot> x0)"
   6.440 +        by (simp add: add_mult_distrib1 mult_assoc [symmetric])
   6.441 +      also from nz y have "a * (h (inverse a \<cdot> y)) =  h y"
   6.442 +        by simp
   6.443        finally have "a * xi \<le> p (y + a \<cdot> x0) - h y" .
   6.444 -
   6.445 -      hence "h y + a * xi \<le> h y + p (y + a \<cdot> x0) - h y"
   6.446 -        by (simp add: real_add_left_cancel_le)
   6.447 -      thus ?thesis by simp
   6.448 -
   6.449 +      then show ?thesis by simp
   6.450 +    next
   6.451        txt {* In the case @{text "a > 0"}, we use @{text "a\<^sub>2"}
   6.452          with @{text ya} taken as @{text "y / a"}: *}
   6.453 -
   6.454 -    next
   6.455        assume gz: "0 < a" hence nz: "a \<noteq> 0" by simp
   6.456 -      from a2 have "xi \<le> p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y)"
   6.457 -        by (rule bspec) (simp!)
   6.458 -
   6.459 -      txt {* The thesis for this case follows by a short
   6.460 -      calculation: *}
   6.461 -
   6.462 -      with gz
   6.463 -      have "a * xi \<le> a * (p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y))"
   6.464 +      from a2 ay
   6.465 +      have "xi \<le> p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y)" ..
   6.466 +      with gz have "a * xi \<le>
   6.467 +          a * (p (inverse a \<cdot> y + x0) - h (inverse a \<cdot> y))"
   6.468          by (rule real_mult_less_le_mono)
   6.469        also have "... = a * p (inverse a \<cdot> y + x0) - a * h (inverse a \<cdot> y)"
   6.470          by (rule real_mult_diff_distrib2)
   6.471 -      also from gz vs y
   6.472 +      also from gz x0 y'
   6.473        have "a * p (inverse a \<cdot> y + x0) = p (a \<cdot> (inverse a \<cdot> y + x0))"
   6.474 -        by (simp add: seminorm_abs_homogenous abs_eqI2)
   6.475 -      also from nz vs y have "... = p (y + a \<cdot> x0)"
   6.476 -        by (simp add: vs_add_mult_distrib1)
   6.477 -      also from nz vs y have "a * h (inverse a \<cdot> y) = h y"
   6.478 -        by (simp add: linearform_mult [symmetric])
   6.479 +        by (simp add: abs_homogenous abs_eqI2)
   6.480 +      also from nz x0 y' have "\<dots> = p (y + a \<cdot> x0)"
   6.481 +        by (simp add: add_mult_distrib1 mult_assoc [symmetric])
   6.482 +      also from nz y have "a * h (inverse a \<cdot> y) = h y"
   6.483 +        by simp
   6.484        finally have "a * xi \<le> p (y + a \<cdot> x0) - h y" .
   6.485 -
   6.486 -      hence "h y + a * xi \<le> h y + (p (y + a \<cdot> x0) - h y)"
   6.487 -        by (simp add: real_add_left_cancel_le)
   6.488 -      thus ?thesis by simp
   6.489 +      then show ?thesis by simp
   6.490      qed
   6.491 -    also from x have "... = p x" by simp
   6.492 +    also from x_rep have "\<dots> = p x" by (simp only:)
   6.493      finally show ?thesis .
   6.494    qed
   6.495 -qed blast+
   6.496 +qed
   6.497  
   6.498  end
     7.1 --- a/src/HOL/Real/HahnBanach/HahnBanachSupLemmas.thy	Thu Aug 22 12:28:41 2002 +0200
     7.2 +++ b/src/HOL/Real/HahnBanach/HahnBanachSupLemmas.thy	Thu Aug 22 20:49:43 2002 +0200
     7.3 @@ -13,62 +13,43 @@
     7.4    presumed.  Let @{text E} be a real vector space with a seminorm
     7.5    @{text p} on @{text E}.  @{text F} is a subspace of @{text E} and
     7.6    @{text f} a linear form on @{text F}. We consider a chain @{text c}
     7.7 -  of norm-preserving extensions of @{text f}, such that
     7.8 -  @{text "\<Union>c = graph H h"}.  We will show some properties about the
     7.9 -  limit function @{text h}, i.e.\ the supremum of the chain @{text c}.
    7.10 -*}
    7.11 +  of norm-preserving extensions of @{text f}, such that @{text "\<Union>c =
    7.12 +  graph H h"}.  We will show some properties about the limit function
    7.13 +  @{text h}, i.e.\ the supremum of the chain @{text c}.
    7.14  
    7.15 -text {*
    7.16 -  Let @{text c} be a chain of norm-preserving extensions of the
    7.17 -  function @{text f} and let @{text "graph H h"} be the supremum of
    7.18 -  @{text c}.  Every element in @{text H} is member of one of the
    7.19 +  \medskip Let @{text c} be a chain of norm-preserving extensions of
    7.20 +  the function @{text f} and let @{text "graph H h"} be the supremum
    7.21 +  of @{text c}.  Every element in @{text H} is member of one of the
    7.22    elements of the chain.
    7.23  *}
    7.24  
    7.25  lemma some_H'h't:
    7.26 -  "M = norm_pres_extensions E p F f \<Longrightarrow> c \<in> chain M \<Longrightarrow>
    7.27 -  graph H h = \<Union>c \<Longrightarrow> x \<in> H
    7.28 -   \<Longrightarrow> \<exists>H' h'. graph H' h' \<in> c \<and> (x, h x) \<in> graph H' h'
    7.29 -       \<and> is_linearform H' h' \<and> is_subspace H' E
    7.30 -       \<and> is_subspace F H' \<and> graph F f \<subseteq> graph H' h'
    7.31 -       \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
    7.32 +  assumes M: "M = norm_pres_extensions E p F f"
    7.33 +    and cM: "c \<in> chain M"
    7.34 +    and u: "graph H h = \<Union>c"
    7.35 +    and x: "x \<in> H"
    7.36 +  shows "\<exists>H' h'. graph H' h' \<in> c
    7.37 +    \<and> (x, h x) \<in> graph H' h'
    7.38 +    \<and> linearform H' h' \<and> H' \<unlhd> E
    7.39 +    \<and> F \<unlhd> H' \<and> graph F f \<subseteq> graph H' h'
    7.40 +    \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
    7.41  proof -
    7.42 -  assume m: "M = norm_pres_extensions E p F f" and "c \<in> chain M"
    7.43 -     and u: "graph H h = \<Union>c"  "x \<in> H"
    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 -  have h: "(x, h x) \<in> graph H h" ..
    7.49 -  with u have "(x, h x) \<in> \<Union>c" by simp
    7.50 -  hence ex1: "\<exists>g \<in> c. (x, h x) \<in> g"
    7.51 -    by (simp only: Union_iff)
    7.52 -  thus ?thesis
    7.53 -  proof (elim bexE)
    7.54 -    fix g assume g: "g \<in> c"  "(x, h x) \<in> g"
    7.55 -    have "c \<subseteq> M" by (rule chainD2)
    7.56 -    hence "g \<in> M" ..
    7.57 -    hence "g \<in> norm_pres_extensions E p F f" by (simp only: m)
    7.58 -    hence "\<exists>H' h'. graph H' h' = g
    7.59 -                  \<and> is_linearform H' h'
    7.60 -                  \<and> is_subspace H' E
    7.61 -                  \<and> is_subspace F H'
    7.62 -                  \<and> graph F f \<subseteq> graph H' h'
    7.63 -                  \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
    7.64 -      by (rule norm_pres_extension_D)
    7.65 -    thus ?thesis
    7.66 -    proof (elim exE conjE)
    7.67 -      fix H' h'
    7.68 -      assume "graph H' h' = g"  "is_linearform H' h'"
    7.69 -        "is_subspace H' E"  "is_subspace F H'"
    7.70 -        "graph F f \<subseteq> graph H' h'"  "\<forall>x \<in> H'. h' x \<le> p x"
    7.71 -      show ?thesis
    7.72 -      proof (intro exI conjI)
    7.73 -        show "graph H' h' \<in> c" by (simp!)
    7.74 -        show "(x, h x) \<in> graph H' h'" by (simp!)
    7.75 -      qed
    7.76 -    qed
    7.77 -  qed
    7.78 +  from cM have "c \<subseteq> M" ..
    7.79 +  with gc have "g \<in> M" ..
    7.80 +  also from M have "\<dots> = norm_pres_extensions E p F f" .
    7.81 +  finally obtain H' and h' where g: "g = graph H' h'"
    7.82 +    and * : "linearform H' h'"  "H' \<unlhd> E"  "F \<unlhd> H'"
    7.83 +      "graph F f \<subseteq> graph H' h'"  "\<forall>x \<in> H'. h' x \<le> p x" ..
    7.84 +
    7.85 +  from gc and g have "graph H' h' \<in> c" by (simp only:)
    7.86 +  moreover from gh and g have "(x, h x) \<in> graph H' h'" by (simp only:)
    7.87 +  ultimately show ?thesis using * by blast
    7.88  qed
    7.89  
    7.90 -
    7.91  text {*
    7.92    \medskip Let @{text c} be a chain of norm-preserving extensions of
    7.93    the function @{text f} and let @{text "graph H h"} be the supremum
    7.94 @@ -78,35 +59,26 @@
    7.95  *}
    7.96  
    7.97  lemma some_H'h':
    7.98 -  "M = norm_pres_extensions E p F f \<Longrightarrow> c \<in> chain M \<Longrightarrow>
    7.99 -  graph H h = \<Union>c \<Longrightarrow> x \<in> H
   7.100 -  \<Longrightarrow> \<exists>H' h'. x \<in> H' \<and> graph H' h' \<subseteq> graph H h
   7.101 -      \<and> is_linearform H' h' \<and> is_subspace H' E \<and> is_subspace F H'
   7.102 -      \<and> graph F f \<subseteq> graph H' h' \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
   7.103 +  assumes M: "M = norm_pres_extensions E p F f"
   7.104 +    and cM: "c \<in> chain M"
   7.105 +    and u: "graph H h = \<Union>c"
   7.106 +    and x: "x \<in> H"
   7.107 +  shows "\<exists>H' h'. x \<in> H' \<and> graph H' h' \<subseteq> graph H h
   7.108 +    \<and> linearform H' h' \<and> H' \<unlhd> E \<and> F \<unlhd> H'
   7.109 +    \<and> graph F f \<subseteq> graph H' h' \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
   7.110  proof -
   7.111 -  assume "M = norm_pres_extensions E p F f" and cM: "c \<in> chain M"
   7.112 -     and u: "graph H h = \<Union>c"  "x \<in> H"
   7.113 -
   7.114 -  have "\<exists>H' h'. graph H' h' \<in> c \<and> (x, h x) \<in> graph H' h'
   7.115 -       \<and> is_linearform H' h' \<and> is_subspace H' E
   7.116 -       \<and> is_subspace F H' \<and> graph F f \<subseteq> graph H' h'
   7.117 -       \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
   7.118 -    by (rule some_H'h't)
   7.119 -  thus ?thesis
   7.120 -  proof (elim exE conjE)
   7.121 -    fix H' h' assume "(x, h x) \<in> graph H' h'"  "graph H' h' \<in> c"
   7.122 -      "is_linearform H' h'"  "is_subspace H' E"  "is_subspace F H'"
   7.123 +  from M cM u x obtain H' h' where
   7.124 +      x_hx: "(x, h x) \<in> graph H' h'"
   7.125 +    and c: "graph H' h' \<in> c"
   7.126 +    and * : "linearform H' h'"  "H' \<unlhd> E"  "F \<unlhd> H'"
   7.127        "graph F f \<subseteq> graph H' h'"  "\<forall>x \<in> H'. h' x \<le> p x"
   7.128 -    show ?thesis
   7.129 -    proof (intro exI conjI)
   7.130 -      show "x \<in> H'" by (rule graphD1)
   7.131 -      from cM u show "graph H' h' \<subseteq> graph H h"
   7.132 -        by (simp! only: chain_ball_Union_upper)
   7.133 -    qed
   7.134 -  qed
   7.135 +    by (rule some_H'h't [elim_format]) blast
   7.136 +  from x_hx have "x \<in> H'" ..
   7.137 +  moreover from cM u c have "graph H' h' \<subseteq> graph H h"
   7.138 +    by (simp only: chain_ball_Union_upper)
   7.139 +  ultimately show ?thesis using * by blast
   7.140  qed
   7.141  
   7.142 -
   7.143  text {*
   7.144    \medskip Any two elements @{text x} and @{text y} in the domain
   7.145    @{text H} of the supremum function @{text h} are both in the domain
   7.146 @@ -115,136 +87,116 @@
   7.147  *}
   7.148  
   7.149  lemma some_H'h'2:
   7.150 -  "M = norm_pres_extensions E p F f \<Longrightarrow> c \<in> chain M \<Longrightarrow>
   7.151 -  graph H h = \<Union>c \<Longrightarrow> x \<in> H \<Longrightarrow> y \<in> H
   7.152 -  \<Longrightarrow> \<exists>H' h'. x \<in> H' \<and> y \<in> H' \<and> graph H' h' \<subseteq> graph H h
   7.153 -      \<and> is_linearform H' h' \<and> is_subspace H' E \<and> is_subspace F H'
   7.154 -      \<and> graph F f \<subseteq> graph H' h' \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
   7.155 +  assumes M: "M = norm_pres_extensions E p F f"
   7.156 +    and cM: "c \<in> chain M"
   7.157 +    and u: "graph H h = \<Union>c"
   7.158 +    and x: "x \<in> H"
   7.159 +    and y: "y \<in> H"
   7.160 +  shows "\<exists>H' h'. x \<in> H' \<and> y \<in> H'
   7.161 +    \<and> graph H' h' \<subseteq> graph H h
   7.162 +    \<and> linearform H' h' \<and> H' \<unlhd> E \<and> F \<unlhd> H'
   7.163 +    \<and> graph F f \<subseteq> graph H' h' \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
   7.164  proof -
   7.165 -  assume "M = norm_pres_extensions E p F f"  "c \<in> chain M"
   7.166 -         "graph H h = \<Union>c"  "x \<in> H"  "y \<in> H"
   7.167 -
   7.168 -  txt {*
   7.169 -    @{text x} is in the domain @{text H'} of some function @{text h'},
   7.170 -    such that @{text h} extends @{text h'}. *}
   7.171 -
   7.172 -  have e1: "\<exists>H' h'. graph H' h' \<in> c \<and> (x, h x) \<in> graph H' h'
   7.173 -       \<and> is_linearform H' h' \<and> is_subspace H' E
   7.174 -       \<and> is_subspace F H' \<and> graph F f \<subseteq> graph H' h'
   7.175 -       \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
   7.176 -    by (rule some_H'h't)
   7.177 -
   7.178    txt {* @{text y} is in the domain @{text H''} of some function @{text h''},
   7.179    such that @{text h} extends @{text h''}. *}
   7.180  
   7.181 -  have e2: "\<exists>H'' h''. graph H'' h'' \<in> c \<and> (y, h y) \<in> graph H'' h''
   7.182 -       \<and> is_linearform H'' h'' \<and> is_subspace H'' E
   7.183 -       \<and> is_subspace F H'' \<and> graph F f \<subseteq> graph H'' h''
   7.184 -       \<and> (\<forall>x \<in> H''. h'' x \<le> p x)"
   7.185 -    by (rule some_H'h't)
   7.186 +  from M cM u and y obtain H' h' where
   7.187 +      y_hy: "(y, h y) \<in> graph H' h'"
   7.188 +    and c': "graph H' h' \<in> c"
   7.189 +    and * :
   7.190 +      "linearform H' h'"  "H' \<unlhd> E"  "F \<unlhd> H'"
   7.191 +      "graph F f \<subseteq> graph H' h'"  "\<forall>x \<in> H'. h' x \<le> p x"
   7.192 +    by (rule some_H'h't [elim_format]) blast
   7.193 +
   7.194 +  txt {* @{text x} is in the domain @{text H'} of some function @{text h'},
   7.195 +    such that @{text h} extends @{text h'}. *}
   7.196  
   7.197 -  from e1 e2 show ?thesis
   7.198 -  proof (elim exE conjE)
   7.199 -    fix H' h' assume "(y, h y) \<in> graph H' h'"  "graph H' h' \<in> c"
   7.200 -      "is_linearform H' h'"  "is_subspace H' E"  "is_subspace F H'"
   7.201 -      "graph F f \<subseteq> graph H' h'"  "\<forall>x \<in> H'. h' x \<le> p x"
   7.202 +  from M cM u and x obtain H'' h'' where
   7.203 +      x_hx: "(x, h x) \<in> graph H'' h''"
   7.204 +    and c'': "graph H'' h'' \<in> c"
   7.205 +    and ** :
   7.206 +      "linearform H'' h''"  "H'' \<unlhd> E"  "F \<unlhd> H''"
   7.207 +      "graph F f \<subseteq> graph H'' h''"  "\<forall>x \<in> H''. h'' x \<le> p x"
   7.208 +    by (rule some_H'h't [elim_format]) blast
   7.209  
   7.210 -    fix H'' h'' assume "(x, h x) \<in> graph H'' h''"  "graph H'' h'' \<in> c"
   7.211 -      "is_linearform H'' h''"  "is_subspace H'' E"  "is_subspace F H''"
   7.212 -      "graph F f \<subseteq> graph H'' h''"  "\<forall>x \<in> H''. h'' x \<le> p x"
   7.213 -
   7.214 -   txt {* Since both @{text h'} and @{text h''} are elements of the chain,
   7.215 -   @{text h''} is an extension of @{text h'} or vice versa. Thus both
   7.216 -   @{text x} and @{text y} are contained in the greater one. \label{cases1}*}
   7.217 +  txt {* Since both @{text h'} and @{text h''} are elements of the chain,
   7.218 +    @{text h''} is an extension of @{text h'} or vice versa. Thus both
   7.219 +    @{text x} and @{text y} are contained in the greater
   7.220 +    one. \label{cases1}*}
   7.221  
   7.222 -    have "graph H'' h'' \<subseteq> graph H' h' \<or> graph H' h' \<subseteq> graph H'' h''"
   7.223 -      (is "?case1 \<or> ?case2")
   7.224 -      by (rule chainD)
   7.225 -    thus ?thesis
   7.226 -    proof
   7.227 -      assume ?case1
   7.228 -      show ?thesis
   7.229 -      proof (intro exI conjI)
   7.230 -        have "(x, h x) \<in> graph H'' h''" .
   7.231 -        also have "... \<subseteq> graph H' h'" .
   7.232 -        finally have xh:"(x, h x) \<in> graph H' h'" .
   7.233 -        thus x: "x \<in> H'" ..
   7.234 -        show y: "y \<in> H'" ..
   7.235 -        show "graph H' h' \<subseteq> graph H h"
   7.236 -          by (simp! only: chain_ball_Union_upper)
   7.237 -      qed
   7.238 -    next
   7.239 -      assume ?case2
   7.240 -      show ?thesis
   7.241 -      proof (intro exI conjI)
   7.242 -        show x: "x \<in> H''" ..
   7.243 -        have "(y, h y) \<in> graph H' h'" by (simp!)
   7.244 -        also have "... \<subseteq> graph H'' h''" .
   7.245 -        finally have yh: "(y, h y) \<in> graph H'' h''" .
   7.246 -        thus y: "y \<in> H''" ..
   7.247 -        show "graph H'' h'' \<subseteq> graph H h"
   7.248 -          by (simp! only: chain_ball_Union_upper)
   7.249 -      qed
   7.250 -    qed
   7.251 +  from cM have "graph H'' h'' \<subseteq> graph H' h' \<or> graph H' h' \<subseteq> graph H'' h''"
   7.252 +    (is "?case1 \<or> ?case2") ..
   7.253 +  then show ?thesis
   7.254 +  proof
   7.255 +    assume ?case1
   7.256 +    have "(x, h x) \<in> graph H'' h''" .
   7.257 +    also have "... \<subseteq> graph H' h'" .
   7.258 +    finally have xh:"(x, h x) \<in> graph H' h'" .
   7.259 +    then have "x \<in> H'" ..
   7.260 +    moreover from y_hy have "y \<in> H'" ..
   7.261 +    moreover from cM u and c' have "graph H' h' \<subseteq> graph H h"
   7.262 +      by (simp only: chain_ball_Union_upper)
   7.263 +    ultimately show ?thesis using * by blast
   7.264 +  next
   7.265 +    assume ?case2
   7.266 +    from x_hx have "x \<in> H''" ..
   7.267 +    moreover {
   7.268 +      from y_hy have "(y, h y) \<in> graph H' h'" .
   7.269 +      also have "\<dots> \<subseteq> graph H'' h''" .
   7.270 +      finally have "(y, h y) \<in> graph H'' h''" .
   7.271 +    } then have "y \<in> H''" ..
   7.272 +    moreover from cM u and c'' have "graph H'' h'' \<subseteq> graph H h"
   7.273 +      by (simp only: chain_ball_Union_upper)
   7.274 +    ultimately show ?thesis using ** by blast
   7.275    qed
   7.276  qed
   7.277  
   7.278 -
   7.279 -
   7.280  text {*
   7.281    \medskip The relation induced by the graph of the supremum of a
   7.282 -  chain @{text c} is definite, i.~e.~t is the graph of a function. *}
   7.283 +  chain @{text c} is definite, i.~e.~t is the graph of a function.
   7.284 +*}
   7.285  
   7.286  lemma sup_definite:
   7.287 -  "M \<equiv> norm_pres_extensions E p F f \<Longrightarrow> c \<in> chain M \<Longrightarrow>
   7.288 -  (x, y) \<in> \<Union>c \<Longrightarrow> (x, z) \<in> \<Union>c \<Longrightarrow> z = y"
   7.289 +  assumes M_def: "M \<equiv> norm_pres_extensions E p F f"
   7.290 +    and cM: "c \<in> chain M"
   7.291 +    and xy: "(x, y) \<in> \<Union>c"
   7.292 +    and xz: "(x, z) \<in> \<Union>c"
   7.293 +  shows "z = y"
   7.294  proof -
   7.295 -  assume "c \<in> chain M"  "M \<equiv> norm_pres_extensions E p F f"
   7.296 -    "(x, y) \<in> \<Union>c"  "(x, z) \<in> \<Union>c"
   7.297 -  thus ?thesis
   7.298 -  proof (elim UnionE chainE2)
   7.299 +  from cM have c: "c \<subseteq> M" ..
   7.300 +  from xy obtain G1 where xy': "(x, y) \<in> G1" and G1: "G1 \<in> c" ..
   7.301 +  from xz obtain G2 where xz': "(x, z) \<in> G2" and G2: "G2 \<in> c" ..
   7.302  
   7.303 -    txt {* Since both @{text "(x, y) \<in> \<Union>c"} and @{text "(x, z) \<in> \<Union>c"}
   7.304 -    they are members of some graphs @{text "G\<^sub>1"} and @{text
   7.305 -    "G\<^sub>2"}, resp., such that both @{text "G\<^sub>1"} and @{text
   7.306 -    "G\<^sub>2"} are members of @{text c}.*}
   7.307 +  from G1 c have "G1 \<in> M" ..
   7.308 +  then obtain H1 h1 where G1_rep: "G1 = graph H1 h1"
   7.309 +    by (unfold M_def) blast
   7.310  
   7.311 -    fix G1 G2 assume
   7.312 -      "(x, y) \<in> G1"  "G1 \<in> c"  "(x, z) \<in> G2"  "G2 \<in> c"  "c \<subseteq> M"
   7.313 +  from G2 c have "G2 \<in> M" ..
   7.314 +  then obtain H2 h2 where G2_rep: "G2 = graph H2 h2"
   7.315 +    by (unfold M_def) blast
   7.316  
   7.317 -    have "G1 \<in> M" ..
   7.318 -    hence e1: "\<exists>H1 h1. graph H1 h1 = G1"
   7.319 -      by (blast! dest: norm_pres_extension_D)
   7.320 -    have "G2 \<in> M" ..
   7.321 -    hence e2: "\<exists>H2 h2. graph H2 h2 = G2"
   7.322 -      by (blast! dest: norm_pres_extension_D)
   7.323 -    from e1 e2 show ?thesis
   7.324 -    proof (elim exE)
   7.325 -      fix H1 h1 H2 h2
   7.326 -      assume "graph H1 h1 = G1"  "graph H2 h2 = G2"
   7.327 -
   7.328 -      txt {* @{text "G\<^sub>1"} is contained in @{text "G\<^sub>2"}
   7.329 -      or vice versa, since both @{text "G\<^sub>1"} and @{text
   7.330 -      "G\<^sub>2"} are members of @{text c}. \label{cases2}*}
   7.331 +  txt {* @{text "G\<^sub>1"} is contained in @{text "G\<^sub>2"}
   7.332 +    or vice versa, since both @{text "G\<^sub>1"} and @{text
   7.333 +    "G\<^sub>2"} are members of @{text c}. \label{cases2}*}
   7.334  
   7.335 -      have "G1 \<subseteq> G2 \<or> G2 \<subseteq> G1" (is "?case1 \<or> ?case2") ..
   7.336 -      thus ?thesis
   7.337 -      proof
   7.338 -        assume ?case1
   7.339 -        have "(x, y) \<in> graph H2 h2" by (blast!)
   7.340 -        hence "y = h2 x" ..
   7.341 -        also have "(x, z) \<in> graph H2 h2" by (simp!)
   7.342 -        hence "z = h2 x" ..
   7.343 -        finally show ?thesis .
   7.344 -      next
   7.345 -        assume ?case2
   7.346 -        have "(x, y) \<in> graph H1 h1" by (simp!)
   7.347 -        hence "y = h1 x" ..
   7.348 -        also have "(x, z) \<in> graph H1 h1" by (blast!)
   7.349 -        hence "z = h1 x" ..
   7.350 -        finally show ?thesis .
   7.351 -      qed
   7.352 -    qed
   7.353 +  from cM G1 G2 have "G1 \<subseteq> G2 \<or> G2 \<subseteq> G1" (is "?case1 \<or> ?case2") ..
   7.354 +  then show ?thesis
   7.355 +  proof
   7.356 +    assume ?case1
   7.357 +    with xy' G2_rep have "(x, y) \<in> graph H2 h2" by blast
   7.358 +    hence "y = h2 x" ..
   7.359 +    also
   7.360 +    from xz' G2_rep have "(x, z) \<in> graph H2 h2" by (simp only:)
   7.361 +    hence "z = h2 x" ..
   7.362 +    finally show ?thesis .
   7.363 +  next
   7.364 +    assume ?case2
   7.365 +    with xz' G1_rep have "(x, z) \<in> graph H1 h1" by blast
   7.366 +    hence "z = h1 x" ..
   7.367 +    also
   7.368 +    from xy' G1_rep have "(x, y) \<in> graph H1 h1" by (simp only:)
   7.369 +    hence "y = h1 x" ..
   7.370 +    finally show ?thesis ..
   7.371    qed
   7.372  qed
   7.373  
   7.374 @@ -258,58 +210,48 @@
   7.375  *}
   7.376  
   7.377  lemma sup_lf:
   7.378 -  "M = norm_pres_extensions E p F f \<Longrightarrow> c \<in> chain M \<Longrightarrow>
   7.379 -  graph H h = \<Union>c \<Longrightarrow> is_linearform H h"
   7.380 -proof -
   7.381 -  assume "M = norm_pres_extensions E p F f"  "c \<in> chain M"
   7.382 -         "graph H h = \<Union>c"
   7.383 -
   7.384 -  show "is_linearform H h"
   7.385 -  proof
   7.386 -    fix x y assume "x \<in> H"  "y \<in> H"
   7.387 -    have "\<exists>H' h'. x \<in> H' \<and> y \<in> H' \<and> graph H' h' \<subseteq> graph H h
   7.388 -            \<and> is_linearform H' h' \<and> is_subspace H' E
   7.389 -            \<and> is_subspace F H' \<and> graph F f \<subseteq> graph H' h'
   7.390 -            \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
   7.391 -      by (rule some_H'h'2)
   7.392 -
   7.393 -    txt {* We have to show that @{text h} is additive. *}
   7.394 +  assumes M: "M = norm_pres_extensions E p F f"
   7.395 +    and cM: "c \<in> chain M"
   7.396 +    and u: "graph H h = \<Union>c"
   7.397 +  shows "linearform H h"
   7.398 +proof
   7.399 +  fix x y assume x: "x \<in> H" and y: "y \<in> H"
   7.400 +  with M cM u obtain H' h' where
   7.401 +        x': "x \<in> H'" and y': "y \<in> H'"
   7.402 +      and b: "graph H' h' \<subseteq> graph H h"
   7.403 +      and linearform: "linearform H' h'"
   7.404 +      and subspace: "H' \<unlhd> E"
   7.405 +    by (rule some_H'h'2 [elim_format]) blast
   7.406  
   7.407 -    thus "h (x + y) = h x + h y"
   7.408 -    proof (elim exE conjE)
   7.409 -      fix H' h' assume "x \<in> H'"  "y \<in> H'"
   7.410 -        and b: "graph H' h' \<subseteq> graph H h"
   7.411 -        and "is_linearform H' h'"  "is_subspace H' E"
   7.412 -      have "h' (x + y) = h' x + h' y"
   7.413 -        by (rule linearform_add)
   7.414 -      also have "h' x = h x" ..
   7.415 -      also have "h' y = h y" ..
   7.416 -      also have "x + y \<in> H'" ..
   7.417 -      with b have "h' (x + y) = h (x + y)" ..
   7.418 -      finally show ?thesis .
   7.419 -    qed
   7.420 -  next
   7.421 -    fix a x assume "x \<in> H"
   7.422 -    have "\<exists>H' h'. x \<in> H' \<and> graph H' h' \<subseteq> graph H h
   7.423 -            \<and> is_linearform H' h' \<and> is_subspace H' E
   7.424 -            \<and> is_subspace F H' \<and> graph F f \<subseteq> graph H' h'
   7.425 -            \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
   7.426 -      by (rule some_H'h')
   7.427 +  show "h (x + y) = h x + h y"
   7.428 +  proof -
   7.429 +    from linearform x' y' have "h' (x + y) = h' x + h' y"
   7.430 +      by (rule linearform.add)
   7.431 +    also from b x' have "h' x = h x" ..
   7.432 +    also from b y' have "h' y = h y" ..
   7.433 +    also from subspace x' y' have "x + y \<in> H'"
   7.434 +      by (rule subspace.add_closed)
   7.435 +    with b have "h' (x + y) = h (x + y)" ..
   7.436 +    finally show ?thesis .
   7.437 +  qed
   7.438 +next
   7.439 +  fix x a assume x: "x \<in> H"
   7.440 +  with M cM u obtain H' h' where
   7.441 +        x': "x \<in> H'"
   7.442 +      and b: "graph H' h' \<subseteq> graph H h"
   7.443 +      and linearform: "linearform H' h'"
   7.444 +      and subspace: "H' \<unlhd> E"
   7.445 +    by (rule some_H'h' [elim_format]) blast
   7.446  
   7.447 -    txt{* We have to show that @{text h} is multiplicative. *}
   7.448 -
   7.449 -    thus "h (a \<cdot> x) = a * h x"
   7.450 -    proof (elim exE conjE)
   7.451 -      fix H' h' assume "x \<in> H'"
   7.452 -        and b: "graph H' h' \<subseteq> graph H h"
   7.453 -        and "is_linearform H' h'"  "is_subspace H' E"
   7.454 -      have "h' (a \<cdot> x) = a * h' x"
   7.455 -        by (rule linearform_mult)
   7.456 -      also have "h' x = h x" ..
   7.457 -      also have "a \<cdot> x \<in> H'" ..
   7.458 -      with b have "h' (a \<cdot> x) = h (a \<cdot> x)" ..
   7.459 -      finally show ?thesis .
   7.460 -    qed
   7.461 +  show "h (a \<cdot> x) = a * h x"
   7.462 +  proof -
   7.463 +    from linearform x' have "h' (a \<cdot> x) = a * h' x"
   7.464 +      by (rule linearform.mult)
   7.465 +    also from b x' have "h' x = h x" ..
   7.466 +    also from subspace x' have "a \<cdot> x \<in> H'"
   7.467 +      by (rule subspace.mult_closed)
   7.468 +    with b have "h' (a \<cdot> x) = h (a \<cdot> x)" ..
   7.469 +    finally show ?thesis .
   7.470    qed
   7.471  qed
   7.472  
   7.473 @@ -321,37 +263,22 @@
   7.474  *}
   7.475  
   7.476  lemma sup_ext:
   7.477 -  "graph H h = \<Union>c \<Longrightarrow> M = norm_pres_extensions E p F f \<Longrightarrow>
   7.478 -  c \<in> chain M \<Longrightarrow> \<exists>x. x \<in> c \<Longrightarrow> graph F f \<subseteq> graph H h"
   7.479 +  assumes graph: "graph H h = \<Union>c"
   7.480 +    and M: "M = norm_pres_extensions E p F f"
   7.481 +    and cM: "c \<in> chain M"
   7.482 +    and ex: "\<exists>x. x \<in> c"
   7.483 +  shows "graph F f \<subseteq> graph H h"
   7.484  proof -
   7.485 -  assume "M = norm_pres_extensions E p F f"  "c \<in> chain M"
   7.486 -         "graph H h = \<Union>c"
   7.487 -  assume "\<exists>x. x \<in> c"
   7.488 -  thus ?thesis
   7.489 -  proof
   7.490 -    fix x assume "x \<in> c"
   7.491 -    have "c \<subseteq> M" by (rule chainD2)
   7.492 -    hence "x \<in> M" ..
   7.493 -    hence "x \<in> norm_pres_extensions E p F f" by (simp!)
   7.494 -
   7.495 -    hence "\<exists>G g. graph G g = x
   7.496 -             \<and> is_linearform G g
   7.497 -             \<and> is_subspace G E
   7.498 -             \<and> is_subspace F G
   7.499 -             \<and> graph F f \<subseteq> graph G g
   7.500 -             \<and> (\<forall>x \<in> G. g x \<le> p x)"
   7.501 -      by (simp! add: norm_pres_extension_D)
   7.502 -
   7.503 -    thus ?thesis
   7.504 -    proof (elim exE conjE)
   7.505 -      fix G g assume "graph F f \<subseteq> graph G g"
   7.506 -      also assume "graph G g = x"
   7.507 -      also have "... \<in> c" .
   7.508 -      hence "x \<subseteq> \<Union>c" by fast
   7.509 -      also have [symmetric]: "graph H h = \<Union>c" .
   7.510 -      finally show ?thesis .
   7.511 -    qed
   7.512 -  qed
   7.513 +  from ex obtain x where xc: "x \<in> c" ..
   7.514 +  from cM have "c \<subseteq> M" ..
   7.515 +  with xc have "x \<in> M" ..
   7.516 +  with M have "x \<in> norm_pres_extensions E p F f"
   7.517 +    by (simp only:)
   7.518 +  then obtain G g where "x = graph G g" and "graph F f \<subseteq> graph G g" ..
   7.519 +  then have "graph F f \<subseteq> x" by (simp only:)
   7.520 +  also from xc have "\<dots> \<subseteq> \<Union>c" by blast
   7.521 +  also from graph have "\<dots> = graph H h" ..
   7.522 +  finally show ?thesis .
   7.523  qed
   7.524  
   7.525  text {*
   7.526 @@ -362,32 +289,21 @@
   7.527  *}
   7.528  
   7.529  lemma sup_supF:
   7.530 -  "graph H h = \<Union>c \<Longrightarrow> M = norm_pres_extensions E p F f \<Longrightarrow>
   7.531 -  c \<in> chain M \<Longrightarrow> \<exists>x. x \<in> c \<Longrightarrow> is_subspace F E \<Longrightarrow> is_vectorspace E
   7.532 -  \<Longrightarrow> is_subspace F H"
   7.533 -proof -
   7.534 -  assume "M = norm_pres_extensions E p F f"  "c \<in> chain M"  "\<exists>x. x \<in> c"
   7.535 -    "graph H h = \<Union>c"  "is_subspace F E"  "is_vectorspace E"
   7.536 -
   7.537 -  show ?thesis
   7.538 -  proof
   7.539 -    show "0 \<in> F" ..
   7.540 -    show "F \<subseteq> H"
   7.541 -    proof (rule graph_extD2)
   7.542 -      show "graph F f \<subseteq> graph H h"
   7.543 -        by (rule sup_ext)
   7.544 -    qed
   7.545 -    show "\<forall>x \<in> F. \<forall>y \<in> F. x + y \<in> F"
   7.546 -    proof (intro ballI)
   7.547 -      fix x y assume "x \<in> F"  "y \<in> F"
   7.548 -      show "x + y \<in> F" by (simp!)
   7.549 -    qed
   7.550 -    show "\<forall>x \<in> F. \<forall>a. a \<cdot> x \<in> F"
   7.551 -    proof (intro ballI allI)
   7.552 -      fix x a assume "x\<in>F"
   7.553 -      show "a \<cdot> x \<in> F" by (simp!)
   7.554 -    qed
   7.555 -  qed
   7.556 +  assumes graph: "graph H h = \<Union>c"
   7.557 +    and M: "M = norm_pres_extensions E p F f"
   7.558 +    and cM: "c \<in> chain M"
   7.559 +    and ex: "\<exists>x. x \<in> c"
   7.560 +    and FE: "F \<unlhd> E"
   7.561 +  shows "F \<unlhd> H"
   7.562 +proof
   7.563 +  from FE show "F \<noteq> {}" by (rule subspace.non_empty)
   7.564 +  from graph M cM ex have "graph F f \<subseteq> graph H h" by (rule sup_ext)
   7.565 +  then show "F \<subseteq> H" ..
   7.566 +  fix x y assume "x \<in> F" and "y \<in> F"
   7.567 +  with FE show "x + y \<in> F" by (rule subspace.add_closed)
   7.568 +next
   7.569 +  fix x a assume "x \<in> F"
   7.570 +  with FE show "a \<cdot> x \<in> F" by (rule subspace.mult_closed)
   7.571  qed
   7.572  
   7.573  text {*
   7.574 @@ -396,81 +312,53 @@
   7.575  *}
   7.576  
   7.577  lemma sup_subE:
   7.578 -  "graph H h = \<Union>c \<Longrightarrow> M = norm_pres_extensions E p F f \<Longrightarrow>
   7.579 -  c \<in> chain M \<Longrightarrow> \<exists>x. x \<in> c \<Longrightarrow> is_subspace F E \<Longrightarrow> is_vectorspace E
   7.580 -  \<Longrightarrow> is_subspace H E"
   7.581 -proof -
   7.582 -  assume "M = norm_pres_extensions E p F f"  "c \<in> chain M"  "\<exists>x. x \<in> c"
   7.583 -    "graph H h = \<Union>c"  "is_subspace F E"  "is_vectorspace E"
   7.584 -  show ?thesis
   7.585 +  assumes graph: "graph H h = \<Union>c"
   7.586 +    and M: "M = norm_pres_extensions E p F f"
   7.587 +    and cM: "c \<in> chain M"
   7.588 +    and ex: "\<exists>x. x \<in> c"
   7.589 +    and FE: "F \<unlhd> E"
   7.590 +    and E: "vectorspace E"
   7.591 +  shows "H \<unlhd> E"
   7.592 +proof
   7.593 +  show "H \<noteq> {}"
   7.594 +  proof -
   7.595 +    from FE E have "0 \<in> F" by (rule subvectorspace.zero)
   7.596 +    also from graph M cM ex FE have "F \<unlhd> H" by (rule sup_supF)
   7.597 +    then have "F \<subseteq> H" ..
   7.598 +    finally show ?thesis by blast
   7.599 +  qed
   7.600 +  show "H \<subseteq> E"
   7.601    proof
   7.602 -
   7.603 -    txt {* The @{text 0} element is in @{text H}, as @{text F} is a
   7.604 -    subset of @{text H}: *}
   7.605 -
   7.606 -    have "0 \<in> F" ..
   7.607 -    also have "is_subspace F H" by (rule sup_supF)
   7.608 -    hence "F \<subseteq> H" ..
   7.609 -    finally show "0 \<in> H" .
   7.610 -
   7.611 -    txt {* @{text H} is a subset of @{text E}: *}
   7.612 -
   7.613 -    show "H \<subseteq> E"
   7.614 -    proof
   7.615 -      fix x assume "x \<in> H"
   7.616 -      have "\<exists>H' h'. x \<in> H' \<and> graph H' h' \<subseteq> graph H h
   7.617 -              \<and> is_linearform H' h' \<and> is_subspace H' E
   7.618 -              \<and> is_subspace F H' \<and> graph F f \<subseteq> graph H' h'
   7.619 -              \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
   7.620 -        by (rule some_H'h')
   7.621 -      thus "x \<in> E"
   7.622 -      proof (elim exE conjE)
   7.623 -        fix H' h' assume "x \<in> H'"  "is_subspace H' E"
   7.624 -        have "H' \<subseteq> E" ..
   7.625 -        thus "x \<in> E" ..
   7.626 -      qed
   7.627 -    qed
   7.628 -
   7.629 -    txt {* @{text H} is closed under addition: *}
   7.630 -
   7.631 -    show "\<forall>x \<in> H. \<forall>y \<in> H. x + y \<in> H"
   7.632 -    proof (intro ballI)
   7.633 -      fix x y assume "x \<in> H"  "y \<in> H"
   7.634 -      have "\<exists>H' h'. x \<in> H' \<and> y \<in> H' \<and> graph H' h' \<subseteq> graph H h
   7.635 -              \<and> is_linearform H' h' \<and> is_subspace H' E
   7.636 -              \<and> is_subspace F H' \<and> graph F f \<subseteq> graph H' h'
   7.637 -              \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
   7.638 -        by (rule some_H'h'2)
   7.639 -      thus "x + y \<in> H"
   7.640 -      proof (elim exE conjE)
   7.641 -        fix H' h'
   7.642 -        assume "x \<in> H'"  "y \<in> H'"  "is_subspace H' E"
   7.643 -          "graph H' h' \<subseteq> graph H h"
   7.644 -        have "x + y \<in> H'" ..
   7.645 -        also have "H' \<subseteq> H" ..
   7.646 -        finally show ?thesis .
   7.647 -      qed
   7.648 -    qed
   7.649 -
   7.650 -    txt {* @{text H} is closed under scalar multiplication: *}
   7.651 -
   7.652 -    show "\<forall>x \<in> H. \<forall>a. a \<cdot> x \<in> H"
   7.653 -    proof (intro ballI allI)
   7.654 -      fix x a assume "x \<in> H"
   7.655 -      have "\<exists>H' h'. x \<in> H' \<and> graph H' h' \<subseteq> graph H h
   7.656 -              \<and> is_linearform H' h' \<and> is_subspace H' E
   7.657 -              \<and> is_subspace F H' \<and> graph F f \<subseteq> graph H' h'
   7.658 -              \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
   7.659 -        by (rule some_H'h')
   7.660 -      thus "a \<cdot> x \<in> H"
   7.661 -      proof (elim exE conjE)
   7.662 -        fix H' h'
   7.663 -        assume "x \<in> H'"  "is_subspace H' E"  "graph H' h' \<subseteq> graph H h"
   7.664 -        have "a \<cdot> x \<in> H'" ..
   7.665 -        also have "H' \<subseteq> H" ..
   7.666 -        finally show ?thesis .
   7.667 -      qed
   7.668 -    qed
   7.669 +    fix x assume "x \<in> H"
   7.670 +    with M cM graph
   7.671 +    obtain H' h' where x: "x \<in> H'" and H'E: "H' \<unlhd> E"
   7.672 +      by (rule some_H'h' [elim_format]) blast
   7.673 +    from H'E have "H' \<subseteq> E" ..
   7.674 +    with x show "x \<in> E" ..
   7.675 +  qed
   7.676 +  fix x y assume x: "x \<in> H" and y: "y \<in> H"
   7.677 +  show "x + y \<in> H"
   7.678 +  proof -
   7.679 +    from M cM graph x y obtain H' h' where
   7.680 +          x': "x \<in> H'" and y': "y \<in> H'" and H'E: "H' \<unlhd> E"
   7.681 +        and graphs: "graph H' h' \<subseteq> graph H h"
   7.682 +      by (rule some_H'h'2 [elim_format]) blast
   7.683 +    from H'E x' y' have "x + y \<in> H'"
   7.684 +      by (rule subspace.add_closed)
   7.685 +    also from graphs have "H' \<subseteq> H" ..
   7.686 +    finally show ?thesis .
   7.687 +  qed
   7.688 +next
   7.689 +  fix x a assume x: "x \<in> H"
   7.690 +  show "a \<cdot> x \<in> H"
   7.691 +  proof -
   7.692 +    from M cM graph x
   7.693 +    obtain H' h' where x': "x \<in> H'" and H'E: "H' \<unlhd> E"
   7.694 +        and graphs: "graph H' h' \<subseteq> graph H h"
   7.695 +      by (rule some_H'h' [elim_format]) blast
   7.696 +    from H'E x' have "a \<cdot> x \<in> H'" by (rule subspace.mult_closed)
   7.697 +    also from graphs have "H' \<subseteq> H" ..
   7.698 +    finally show ?thesis .
   7.699    qed
   7.700  qed
   7.701  
   7.702 @@ -480,28 +368,21 @@
   7.703  *}
   7.704  
   7.705  lemma sup_norm_pres:
   7.706 -  "graph H h = \<Union>c \<Longrightarrow> M = norm_pres_extensions E p F f \<Longrightarrow>
   7.707 -  c \<in> chain M \<Longrightarrow> \<forall>x \<in> H. h x \<le> p x"
   7.708 +  assumes graph: "graph H h = \<Union>c"
   7.709 +    and M: "M = norm_pres_extensions E p F f"
   7.710 +    and cM: "c \<in> chain M"
   7.711 +  shows "\<forall>x \<in> H. h x \<le> p x"
   7.712  proof
   7.713 -  assume "M = norm_pres_extensions E p F f"  "c \<in> chain M"
   7.714 -         "graph H h = \<Union>c"
   7.715    fix x assume "x \<in> H"
   7.716 -  have "\<exists>H' h'. x \<in> H' \<and> graph H' h' \<subseteq> graph H h
   7.717 -          \<and> is_linearform H' h' \<and> is_subspace H' E \<and> is_subspace F H'
   7.718 -          \<and> graph F f \<subseteq> graph H' h' \<and> (\<forall>x \<in> H'. h' x \<le> p x)"
   7.719 -    by (rule some_H'h')
   7.720 -  thus "h x \<le> p x"
   7.721 -  proof (elim exE conjE)
   7.722 -    fix H' h'
   7.723 -    assume "x \<in> H'"  "graph H' h' \<subseteq> graph H h"
   7.724 +  with M cM graph obtain H' h' where x': "x \<in> H'"
   7.725 +      and graphs: "graph H' h' \<subseteq> graph H h"
   7.726        and a: "\<forall>x \<in> H'. h' x \<le> p x"
   7.727 -    have [symmetric]: "h' x = h x" ..
   7.728 -    also from a have "h' x \<le> p x " ..
   7.729 -    finally show ?thesis .
   7.730 -  qed
   7.731 +    by (rule some_H'h' [elim_format]) blast
   7.732 +  from graphs x' have [symmetric]: "h' x = h x" ..
   7.733 +  also from a x' have "h' x \<le> p x " ..
   7.734 +  finally show "h x \<le> p x" .
   7.735  qed
   7.736  
   7.737 -
   7.738  text {*
   7.739    \medskip The following lemma is a property of linear forms on real
   7.740    vector spaces. It will be used for the lemma @{text abs_HahnBanach}
   7.741 @@ -516,45 +397,41 @@
   7.742  *}
   7.743  
   7.744  lemma abs_ineq_iff:
   7.745 -  "is_subspace H E \<Longrightarrow> is_vectorspace E \<Longrightarrow> is_seminorm E p \<Longrightarrow>
   7.746 -  is_linearform H h
   7.747 -  \<Longrightarrow> (\<forall>x \<in> H. \<bar>h x\<bar> \<le> p x) = (\<forall>x \<in> H. h x \<le> p x)"
   7.748 -  (concl is "?L = ?R")
   7.749 -proof -
   7.750 -  assume "is_subspace H E"  "is_vectorspace E"  "is_seminorm E p"
   7.751 -         "is_linearform H h"
   7.752 -  have h: "is_vectorspace H" ..
   7.753 -  show ?thesis
   7.754 -  proof
   7.755 +  includes subvectorspace H E + seminorm E p + linearform H h
   7.756 +  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.757 +proof
   7.758 +  have h: "vectorspace H" by (rule vectorspace)
   7.759 +  {
   7.760      assume l: ?L
   7.761      show ?R
   7.762      proof
   7.763        fix x assume x: "x \<in> H"
   7.764 -      have "h x \<le> \<bar>h x\<bar>" by (rule abs_ge_self)
   7.765 -      also from l have "... \<le> p x" ..
   7.766 +      have "h x \<le> \<bar>h x\<bar>" by arith
   7.767 +      also from l x have "\<dots> \<le> p x" ..
   7.768        finally show "h x \<le> p x" .
   7.769      qed
   7.770    next
   7.771      assume r: ?R
   7.772      show ?L
   7.773      proof
   7.774 -      fix x assume "x \<in> H"
   7.775 +      fix x assume x: "x \<in> H"
   7.776        show "\<And>a b :: real. - a \<le> b \<Longrightarrow> b \<le> a \<Longrightarrow> \<bar>b\<bar> \<le> a"
   7.777          by arith
   7.778        show "- p x \<le> h x"
   7.779        proof (rule real_minus_le)
   7.780 -        from h have "- h x = h (- x)"
   7.781 -          by (rule linearform_neg [symmetric])
   7.782 -        also from r have "... \<le> p (- x)" by (simp!)
   7.783 -        also have "... = p x"
   7.784 -        proof (rule seminorm_minus)
   7.785 +        have "linearform H h" .
   7.786 +        from h this x have "- h x = h (- x)"
   7.787 +          by (rule vectorspace_linearform.neg [symmetric])
   7.788 +        also from r x have "\<dots> \<le> p (- x)" by simp
   7.789 +        also have "\<dots> = p x"
   7.790 +        proof (rule seminorm_vectorspace.minus)
   7.791            show "x \<in> E" ..
   7.792          qed
   7.793          finally show "- h x \<le> p x" .
   7.794        qed
   7.795 -      from r show "h x \<le> p x" ..
   7.796 +      from r x show "h x \<le> p x" ..
   7.797      qed
   7.798 -  qed
   7.799 +  }
   7.800  qed
   7.801  
   7.802  end
     8.1 --- a/src/HOL/Real/HahnBanach/Linearform.thy	Thu Aug 22 12:28:41 2002 +0200
     8.2 +++ b/src/HOL/Real/HahnBanach/Linearform.thy	Thu Aug 22 20:49:43 2002 +0200
     8.3 @@ -12,60 +12,43 @@
     8.4    that is additive and multiplicative.
     8.5  *}
     8.6  
     8.7 -constdefs
     8.8 -  is_linearform :: "'a::{plus, minus, zero} set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> bool"
     8.9 -  "is_linearform V f \<equiv>
    8.10 -      (\<forall>x \<in> V. \<forall>y \<in> V. f (x + y) = f x + f y) \<and>
    8.11 -      (\<forall>x \<in> V. \<forall>a. f (a \<cdot> x) = a * (f x))"
    8.12 +locale linearform = var V + var f +
    8.13 +  assumes add [iff]: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> f (x + y) = f x + f y"
    8.14 +    and mult [iff]: "x \<in> V \<Longrightarrow> f (a \<cdot> x) = a * f x"
    8.15  
    8.16 -lemma is_linearformI [intro]:
    8.17 -  "(\<And>x y. x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> f (x + y) = f x + f y) \<Longrightarrow>
    8.18 -    (\<And>x c. x \<in> V \<Longrightarrow> f (c \<cdot> x) = c * f x)
    8.19 - \<Longrightarrow> is_linearform V f"
    8.20 - by (unfold is_linearform_def) blast
    8.21 +locale (open) vectorspace_linearform =
    8.22 +  vectorspace + linearform
    8.23  
    8.24 -lemma linearform_add [intro?]:
    8.25 -  "is_linearform V f \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> f (x + y) = f x + f y"
    8.26 -  by (unfold is_linearform_def) blast
    8.27 -
    8.28 -lemma linearform_mult [intro?]:
    8.29 -  "is_linearform V f \<Longrightarrow> x \<in> V \<Longrightarrow>  f (a \<cdot> x) = a * (f x)"
    8.30 -  by (unfold is_linearform_def) blast
    8.31 -
    8.32 -lemma linearform_neg [intro?]:
    8.33 -  "is_vectorspace V \<Longrightarrow> is_linearform V f \<Longrightarrow> x \<in> V
    8.34 -  \<Longrightarrow> f (- x) = - f x"
    8.35 +lemma (in vectorspace_linearform) neg [iff]:
    8.36 +  "x \<in> V \<Longrightarrow> f (- x) = - f x"
    8.37  proof -
    8.38 -  assume "is_linearform V f"  "is_vectorspace V"  "x \<in> V"
    8.39 -  have "f (- x) = f ((- 1) \<cdot> x)" by (simp! add: negate_eq1)
    8.40 -  also have "... = (- 1) * (f x)" by (rule linearform_mult)
    8.41 -  also have "... = - (f x)" by (simp!)
    8.42 +  assume x: "x \<in> V"
    8.43 +  hence "f (- x) = f ((- 1) \<cdot> x)" by (simp add: negate_eq1)
    8.44 +  also from x have "... = (- 1) * (f x)" by (rule mult)
    8.45 +  also from x have "... = - (f x)" by simp
    8.46    finally show ?thesis .
    8.47  qed
    8.48  
    8.49 -lemma linearform_diff [intro?]:
    8.50 -  "is_vectorspace V \<Longrightarrow> is_linearform V f \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V
    8.51 -  \<Longrightarrow> f (x - y) = f x - f y"
    8.52 +lemma (in vectorspace_linearform) diff [iff]:
    8.53 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> f (x - y) = f x - f y"
    8.54  proof -
    8.55 -  assume "is_vectorspace V"  "is_linearform V f"  "x \<in> V"  "y \<in> V"
    8.56 -  have "f (x - y) = f (x + - y)" by (simp! only: diff_eq1)
    8.57 -  also have "... = f x + f (- y)"
    8.58 -    by (rule linearform_add) (simp!)+
    8.59 -  also have "f (- y) = - f y" by (rule linearform_neg)
    8.60 -  finally show "f (x - y) = f x - f y" by (simp!)
    8.61 +  assume x: "x \<in> V" and y: "y \<in> V"
    8.62 +  hence "x - y = x + - y" by (rule diff_eq1)
    8.63 +  also have "f ... = f x + f (- y)"
    8.64 +    by (rule add) (simp_all add: x y)
    8.65 +  also from y have "f (- y) = - f y" by (rule neg)
    8.66 +  finally show ?thesis by simp
    8.67  qed
    8.68  
    8.69  text {* Every linear form yields @{text 0} for the @{text 0} vector. *}
    8.70  
    8.71 -lemma linearform_zero [intro?, simp]:
    8.72 -  "is_vectorspace V \<Longrightarrow> is_linearform V f \<Longrightarrow> f 0 = 0"
    8.73 +lemma (in vectorspace_linearform) linearform_zero [iff]:
    8.74 +  "f 0 = 0"
    8.75  proof -
    8.76 -  assume "is_vectorspace V"  "is_linearform V f"
    8.77 -  have "f 0 = f (0 - 0)" by (simp!)
    8.78 -  also have "... = f 0 - f 0"
    8.79 -    by (rule linearform_diff) (simp!)+
    8.80 -  also have "... = 0" by simp
    8.81 -  finally show "f 0 = 0" .
    8.82 +  have "f 0 = f (0 - 0)" by simp
    8.83 +  also have "\<dots> = f 0 - f 0" by (rule diff) simp_all
    8.84 +  also have "\<dots> = 0" by simp
    8.85 +  finally show ?thesis .
    8.86  qed
    8.87  
    8.88  end
     9.1 --- a/src/HOL/Real/HahnBanach/NormedSpace.thy	Thu Aug 22 12:28:41 2002 +0200
     9.2 +++ b/src/HOL/Real/HahnBanach/NormedSpace.thy	Thu Aug 22 20:49:43 2002 +0200
     9.3 @@ -15,59 +15,40 @@
     9.4    definite, absolute homogenous and subadditive.
     9.5  *}
     9.6  
     9.7 -constdefs
     9.8 -  is_seminorm :: "'a::{plus, minus, zero} set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> bool"
     9.9 -  "is_seminorm V norm \<equiv> \<forall>x \<in> V. \<forall>y \<in> V. \<forall>a.
    9.10 -        0 \<le> norm x
    9.11 -      \<and> norm (a \<cdot> x) = \<bar>a\<bar> * norm x
    9.12 -      \<and> norm (x + y) \<le> norm x + norm y"
    9.13 +locale norm_syntax =
    9.14 +  fixes norm :: "'a \<Rightarrow> real"    ("\<parallel>_\<parallel>")
    9.15  
    9.16 -lemma is_seminormI [intro]:
    9.17 -  "(\<And>x y a. x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> 0 \<le> norm x) \<Longrightarrow>
    9.18 -  (\<And>x a. x \<in> V \<Longrightarrow> norm (a \<cdot> x) = \<bar>a\<bar> * norm x) \<Longrightarrow>
    9.19 -  (\<And>x y. x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> norm (x + y) \<le> norm x + norm y)
    9.20 -  \<Longrightarrow> is_seminorm V norm"
    9.21 -  by (unfold is_seminorm_def) auto
    9.22 +locale seminorm = var V + norm_syntax +
    9.23 +  assumes ge_zero [iff?]: "x \<in> V \<Longrightarrow> 0 \<le> \<parallel>x\<parallel>"
    9.24 +    and abs_homogenous [iff?]: "x \<in> V \<Longrightarrow> \<parallel>a \<cdot> x\<parallel> = \<bar>a\<bar> * \<parallel>x\<parallel>"
    9.25 +    and subadditive [iff?]: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> \<parallel>x + y\<parallel> \<le> \<parallel>x\<parallel> + \<parallel>y\<parallel>"
    9.26  
    9.27 -lemma seminorm_ge_zero [intro?]:
    9.28 -  "is_seminorm V norm \<Longrightarrow> x \<in> V \<Longrightarrow> 0 \<le> norm x"
    9.29 -  by (unfold is_seminorm_def) blast
    9.30 +locale (open) seminorm_vectorspace =
    9.31 +  seminorm + vectorspace
    9.32  
    9.33 -lemma seminorm_abs_homogenous:
    9.34 -  "is_seminorm V norm \<Longrightarrow> x \<in> V
    9.35 -  \<Longrightarrow> norm (a \<cdot> x) = \<bar>a\<bar> * norm x"
    9.36 -  by (unfold is_seminorm_def) blast
    9.37 -
    9.38 -lemma seminorm_subadditive:
    9.39 -  "is_seminorm V norm \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V
    9.40 -  \<Longrightarrow> norm (x + y) \<le> norm x + norm y"
    9.41 -  by (unfold is_seminorm_def) blast
    9.42 -
    9.43 -lemma seminorm_diff_subadditive:
    9.44 -  "is_seminorm V norm \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> is_vectorspace V
    9.45 -  \<Longrightarrow> norm (x - y) \<le> norm x + norm y"
    9.46 +lemma (in seminorm_vectorspace) diff_subadditive:
    9.47 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> \<parallel>x - y\<parallel> \<le> \<parallel>x\<parallel> + \<parallel>y\<parallel>"
    9.48  proof -
    9.49 -  assume "is_seminorm V norm"  "x \<in> V"  "y \<in> V"  "is_vectorspace V"
    9.50 -  have "norm (x - y) = norm (x + - 1 \<cdot> y)"
    9.51 -    by (simp! add: diff_eq2 negate_eq2a)
    9.52 -  also have "... \<le> norm x + norm  (- 1 \<cdot> y)"
    9.53 -    by (simp! add: seminorm_subadditive)
    9.54 -  also have "norm (- 1 \<cdot> y) = \<bar>- 1\<bar> * norm y"
    9.55 -    by (rule seminorm_abs_homogenous)
    9.56 -  also have "\<bar>- 1\<bar> = (1::real)" by (rule abs_minus_one)
    9.57 -  finally show "norm (x - y) \<le> norm x + norm y" by simp
    9.58 +  assume x: "x \<in> V" and y: "y \<in> V"
    9.59 +  hence "x - y = x + - 1 \<cdot> y"
    9.60 +    by (simp add: diff_eq2 negate_eq2a)
    9.61 +  also from x y have "\<parallel>\<dots>\<parallel> \<le> \<parallel>x\<parallel> + \<parallel>- 1 \<cdot> y\<parallel>"
    9.62 +    by (simp add: subadditive)
    9.63 +  also from y have "\<parallel>- 1 \<cdot> y\<parallel> = \<bar>- 1\<bar> * \<parallel>y\<parallel>"
    9.64 +    by (rule abs_homogenous)
    9.65 +  also have "\<dots> = \<parallel>y\<parallel>" by simp
    9.66 +  finally show ?thesis .
    9.67  qed
    9.68  
    9.69 -lemma seminorm_minus:
    9.70 -  "is_seminorm V norm \<Longrightarrow> x \<in> V \<Longrightarrow> is_vectorspace V
    9.71 -  \<Longrightarrow> norm (- x) = norm x"
    9.72 +lemma (in seminorm_vectorspace) minus:
    9.73 +  "x \<in> V \<Longrightarrow> \<parallel>- x\<parallel> = \<parallel>x\<parallel>"
    9.74  proof -
    9.75 -  assume "is_seminorm V norm"  "x \<in> V"  "is_vectorspace V"
    9.76 -  have "norm (- x) = norm (- 1 \<cdot> x)" by (simp! only: negate_eq1)
    9.77 -  also have "... = \<bar>- 1\<bar> * norm x"
    9.78 -    by (rule seminorm_abs_homogenous)
    9.79 -  also have "\<bar>- 1\<bar> = (1::real)" by (rule abs_minus_one)
    9.80 -  finally show "norm (- x) = norm x" by simp
    9.81 +  assume x: "x \<in> V"
    9.82 +  hence "- x = - 1 \<cdot> x" by (simp only: negate_eq1)
    9.83 +  also from x have "\<parallel>\<dots>\<parallel> = \<bar>- 1\<bar> * \<parallel>x\<parallel>"
    9.84 +    by (rule abs_homogenous)
    9.85 +  also have "\<dots> = \<parallel>x\<parallel>" by simp
    9.86 +  finally show ?thesis .
    9.87  qed
    9.88  
    9.89  
    9.90 @@ -78,110 +59,46 @@
    9.91    @{text 0} vector to @{text 0}.
    9.92  *}
    9.93  
    9.94 -constdefs
    9.95 -  is_norm :: "'a::{plus, minus, zero} set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> bool"
    9.96 -  "is_norm V norm \<equiv> \<forall>x \<in> V. is_seminorm V norm
    9.97 -      \<and> (norm x = 0) = (x = 0)"
    9.98 -
    9.99 -lemma is_normI [intro]:
   9.100 -  "\<forall>x \<in> V.  is_seminorm V norm  \<and> (norm x = 0) = (x = 0)
   9.101 -  \<Longrightarrow> is_norm V norm" by (simp only: is_norm_def)
   9.102 -
   9.103 -lemma norm_is_seminorm [intro?]:
   9.104 -  "is_norm V norm \<Longrightarrow> x \<in> V \<Longrightarrow> is_seminorm V norm"
   9.105 -  by (unfold is_norm_def) blast
   9.106 -
   9.107 -lemma norm_zero_iff:
   9.108 -  "is_norm V norm \<Longrightarrow> x \<in> V \<Longrightarrow> (norm x = 0) = (x = 0)"
   9.109 -  by (unfold is_norm_def) blast
   9.110 -
   9.111 -lemma norm_ge_zero [intro?]:
   9.112 -  "is_norm V norm \<Longrightarrow> x \<in> V \<Longrightarrow> 0 \<le> norm x"
   9.113 -  by (unfold is_norm_def is_seminorm_def) blast
   9.114 +locale norm = seminorm +
   9.115 +  assumes zero_iff [iff]: "x \<in> V \<Longrightarrow> (\<parallel>x\<parallel> = 0) = (x = 0)"
   9.116  
   9.117  
   9.118  subsection {* Normed vector spaces *}
   9.119  
   9.120 -text{* A vector space together with a norm is called
   9.121 -a \emph{normed space}. *}
   9.122 -
   9.123 -constdefs
   9.124 -  is_normed_vectorspace ::
   9.125 -  "'a::{plus, minus, zero} set \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> bool"
   9.126 -  "is_normed_vectorspace V norm \<equiv>
   9.127 -      is_vectorspace V \<and> is_norm V norm"
   9.128 +text {*
   9.129 +  A vector space together with a norm is called a \emph{normed
   9.130 +  space}.
   9.131 +*}
   9.132  
   9.133 -lemma normed_vsI [intro]:
   9.134 -  "is_vectorspace V \<Longrightarrow> is_norm V norm
   9.135 -  \<Longrightarrow> is_normed_vectorspace V norm"
   9.136 -  by (unfold is_normed_vectorspace_def) blast
   9.137 -
   9.138 -lemma normed_vs_vs [intro?]:
   9.139 -  "is_normed_vectorspace V norm \<Longrightarrow> is_vectorspace V"
   9.140 -  by (unfold is_normed_vectorspace_def) blast
   9.141 +locale normed_vectorspace = vectorspace + seminorm_vectorspace + norm
   9.142  
   9.143 -lemma normed_vs_norm [intro?]:
   9.144 -  "is_normed_vectorspace V norm \<Longrightarrow> is_norm V norm"
   9.145 -  by (unfold is_normed_vectorspace_def) blast
   9.146 -
   9.147 -lemma normed_vs_norm_ge_zero [intro?]:
   9.148 -  "is_normed_vectorspace V norm \<Longrightarrow> x \<in> V \<Longrightarrow> 0 \<le> norm x"
   9.149 -  by (unfold is_normed_vectorspace_def) (fast elim: norm_ge_zero)
   9.150 -
   9.151 -lemma normed_vs_norm_gt_zero [intro?]:
   9.152 -  "is_normed_vectorspace V norm \<Longrightarrow> x \<in> V \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> 0 < norm x"
   9.153 -proof (unfold is_normed_vectorspace_def, elim conjE)
   9.154 -  assume "x \<in> V"  "x \<noteq> 0"  "is_vectorspace V"  "is_norm V norm"
   9.155 -  have "0 \<le> norm x" ..
   9.156 -  also have "0 \<noteq> norm x"
   9.157 +lemma (in normed_vectorspace) gt_zero [intro?]:
   9.158 +  "x \<in> V \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> 0 < \<parallel>x\<parallel>"
   9.159 +proof -
   9.160 +  assume x: "x \<in> V" and neq: "x \<noteq> 0"
   9.161 +  from x have "0 \<le> \<parallel>x\<parallel>" ..
   9.162 +  also have [symmetric]: "\<dots> \<noteq> 0"
   9.163    proof
   9.164 -    presume "norm x = 0"
   9.165 -    also have "?this = (x = 0)" by (rule norm_zero_iff)
   9.166 -    finally have "x = 0" .
   9.167 -    thus "False" by contradiction
   9.168 -  qed (rule sym)
   9.169 -  finally show "0 < norm x" .
   9.170 +    assume "\<parallel>x\<parallel> = 0"
   9.171 +    with x have "x = 0" by simp
   9.172 +    with neq show False by contradiction
   9.173 +  qed
   9.174 +  finally show ?thesis .
   9.175  qed
   9.176  
   9.177 -lemma normed_vs_norm_abs_homogenous [intro?]:
   9.178 -  "is_normed_vectorspace V norm \<Longrightarrow> x \<in> V
   9.179 -  \<Longrightarrow> norm (a \<cdot> x) = \<bar>a\<bar> * norm x"
   9.180 -  by (rule seminorm_abs_homogenous, rule norm_is_seminorm,
   9.181 -      rule normed_vs_norm)
   9.182 -
   9.183 -lemma normed_vs_norm_subadditive [intro?]:
   9.184 -  "is_normed_vectorspace V norm \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V
   9.185 -  \<Longrightarrow> norm (x + y) \<le> norm x + norm y"
   9.186 -  by (rule seminorm_subadditive, rule norm_is_seminorm,
   9.187 -     rule normed_vs_norm)
   9.188 -
   9.189 -text{* Any subspace of a normed vector space is again a
   9.190 -normed vectorspace.*}
   9.191 +text {*
   9.192 +  Any subspace of a normed vector space is again a normed vectorspace.
   9.193 +*}
   9.194  
   9.195  lemma subspace_normed_vs [intro?]:
   9.196 -  "is_vectorspace E \<Longrightarrow> is_subspace F E \<Longrightarrow>
   9.197 -  is_normed_vectorspace E norm \<Longrightarrow> is_normed_vectorspace F norm"
   9.198 -proof (rule normed_vsI)
   9.199 -  assume "is_subspace F E"  "is_vectorspace E"
   9.200 -         "is_normed_vectorspace E norm"
   9.201 -  show "is_vectorspace F" ..
   9.202 -  show "is_norm F norm"
   9.203 -  proof (intro is_normI ballI conjI)
   9.204 -    show "is_seminorm F norm"
   9.205 -    proof
   9.206 -      fix x y a presume "x \<in> E"
   9.207 -      show "0 \<le> norm x" ..
   9.208 -      show "norm (a \<cdot> x) = \<bar>a\<bar> * norm x" ..
   9.209 -      presume "y \<in> E"
   9.210 -      show "norm (x + y) \<le> norm x + norm y" ..
   9.211 -    qed (simp!)+
   9.212 -
   9.213 -    fix x assume "x \<in> F"
   9.214 -    show "(norm x = 0) = (x = 0)"
   9.215 -    proof (rule norm_zero_iff)
   9.216 -      show "is_norm E norm" ..
   9.217 -    qed (simp!)
   9.218 -  qed
   9.219 +  includes subvectorspace F E + normed_vectorspace E
   9.220 +  shows "normed_vectorspace F norm"
   9.221 +proof
   9.222 +  show "vectorspace F" by (rule vectorspace)
   9.223 +  have "seminorm E norm" . with subset show "seminorm F norm"
   9.224 +    by (simp add: seminorm_def)
   9.225 +  have "norm_axioms E norm" . with subset show "norm_axioms F norm"
   9.226 +    by (simp add: norm_axioms_def)
   9.227  qed
   9.228  
   9.229  end
    10.1 --- a/src/HOL/Real/HahnBanach/Subspace.thy	Thu Aug 22 12:28:41 2002 +0200
    10.2 +++ b/src/HOL/Real/HahnBanach/Subspace.thy	Thu Aug 22 20:49:43 2002 +0200
    10.3 @@ -16,122 +16,109 @@
    10.4    and scalar multiplication.
    10.5  *}
    10.6  
    10.7 -constdefs
    10.8 -  is_subspace ::  "'a::{plus, minus, zero} set \<Rightarrow> 'a set \<Rightarrow> bool"
    10.9 -  "is_subspace U V \<equiv> U \<noteq> {} \<and> U \<subseteq> V
   10.10 -     \<and> (\<forall>x \<in> U. \<forall>y \<in> U. \<forall>a. x + y \<in> U \<and> a \<cdot> x \<in> U)"
   10.11 +locale subspace = var U + var V +
   10.12 +  assumes non_empty [iff, intro]: "U \<noteq> {}"
   10.13 +    and subset [iff]: "U \<subseteq> V"
   10.14 +    and add_closed [iff]: "x \<in> U \<Longrightarrow> y \<in> U \<Longrightarrow> x + y \<in> U"
   10.15 +    and mult_closed [iff]: "x \<in> U \<Longrightarrow> a \<cdot> x \<in> U"
   10.16  
   10.17 -lemma subspaceI [intro]:
   10.18 -  "0 \<in> U \<Longrightarrow> U \<subseteq> V \<Longrightarrow> \<forall>x \<in> U. \<forall>y \<in> U. (x + y \<in> U) \<Longrightarrow>
   10.19 -  \<forall>x \<in> U. \<forall>a. a \<cdot> x \<in> U
   10.20 -  \<Longrightarrow> is_subspace U V"
   10.21 -proof (unfold is_subspace_def, intro conjI)
   10.22 -  assume "0 \<in> U" thus "U \<noteq> {}" by fast
   10.23 -qed (simp+)
   10.24 +syntax (symbols)
   10.25 +  subspace :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool"    (infix "\<unlhd>" 50)
   10.26  
   10.27 -lemma subspace_not_empty [intro?]: "is_subspace U V \<Longrightarrow> U \<noteq> {}"
   10.28 -  by (unfold is_subspace_def) blast
   10.29 +lemma subspace_subset [elim]: "U \<unlhd> V \<Longrightarrow> U \<subseteq> V"
   10.30 +  by (rule subspace.subset)
   10.31  
   10.32 -lemma subspace_subset [intro?]: "is_subspace U V \<Longrightarrow> U \<subseteq> V"
   10.33 -  by (unfold is_subspace_def) blast
   10.34 +lemma (in subspace) subsetD [iff]: "x \<in> U \<Longrightarrow> x \<in> V"
   10.35 +  using subset by blast
   10.36  
   10.37 -lemma subspace_subsetD [simp, intro?]:
   10.38 -  "is_subspace U V \<Longrightarrow> x \<in> U \<Longrightarrow> x \<in> V"
   10.39 -  by (unfold is_subspace_def) blast
   10.40 +lemma subspaceD [elim]: "U \<unlhd> V \<Longrightarrow> x \<in> U \<Longrightarrow> x \<in> V"
   10.41 +  by (rule subspace.subsetD)
   10.42  
   10.43 -lemma subspace_add_closed [simp, intro?]:
   10.44 -  "is_subspace U V \<Longrightarrow> x \<in> U \<Longrightarrow> y \<in> U \<Longrightarrow> x + y \<in> U"
   10.45 -  by (unfold is_subspace_def) blast
   10.46 +lemma rev_subspaceD [elim?]: "x \<in> U \<Longrightarrow> U \<unlhd> V \<Longrightarrow> x \<in> V"
   10.47 +  by (rule subspace.subsetD)
   10.48 +
   10.49  
   10.50 -lemma subspace_mult_closed [simp, intro?]:
   10.51 -  "is_subspace U V \<Longrightarrow> x \<in> U \<Longrightarrow> a \<cdot> x \<in> U"
   10.52 -  by (unfold is_subspace_def) blast
   10.53 +locale (open) subvectorspace =
   10.54 +  subspace + vectorspace
   10.55  
   10.56 -lemma subspace_diff_closed [simp, intro?]:
   10.57 -  "is_subspace U V \<Longrightarrow> is_vectorspace V \<Longrightarrow> x \<in> U \<Longrightarrow> y \<in> U
   10.58 -  \<Longrightarrow> x - y \<in> U"
   10.59 +lemma (in subvectorspace) diff_closed [iff]:
   10.60 +    "x \<in> U \<Longrightarrow> y \<in> U \<Longrightarrow> x - y \<in> U"
   10.61    by (simp add: diff_eq1 negate_eq1)
   10.62  
   10.63 -text {* Similar as for linear spaces, the existence of the
   10.64 -zero element in every subspace follows from the non-emptiness
   10.65 -of the carrier set and by vector space laws.*}
   10.66  
   10.67 -lemma zero_in_subspace [intro?]:
   10.68 -  "is_subspace U V \<Longrightarrow> is_vectorspace V \<Longrightarrow> 0 \<in> U"
   10.69 +text {*
   10.70 +  \medskip Similar as for linear spaces, the existence of the zero
   10.71 +  element in every subspace follows from the non-emptiness of the
   10.72 +  carrier set and by vector space laws.
   10.73 +*}
   10.74 +
   10.75 +lemma (in subvectorspace) zero [intro]: "0 \<in> U"
   10.76  proof -
   10.77 -  assume "is_subspace U V" and v: "is_vectorspace V"
   10.78 -  have "U \<noteq> {}" ..
   10.79 -  hence "\<exists>x. x \<in> U" by blast
   10.80 -  thus ?thesis
   10.81 -  proof
   10.82 -    fix x assume u: "x \<in> U"
   10.83 -    hence "x \<in> V" by (simp!)
   10.84 -    with v have "0 = x - x" by (simp!)
   10.85 -    also have "... \<in> U" by (rule subspace_diff_closed)
   10.86 -    finally show ?thesis .
   10.87 -  qed
   10.88 +  have "U \<noteq> {}" by (rule U_V.non_empty)
   10.89 +  then obtain x where x: "x \<in> U" by blast
   10.90 +  hence "x \<in> V" .. hence "0 = x - x" by simp
   10.91 +  also have "... \<in> U" by (rule U_V.diff_closed)
   10.92 +  finally show ?thesis .
   10.93  qed
   10.94  
   10.95 -lemma subspace_neg_closed [simp, intro?]:
   10.96 -  "is_subspace U V \<Longrightarrow> is_vectorspace V \<Longrightarrow> x \<in> U \<Longrightarrow> - x \<in> U"
   10.97 +lemma (in subvectorspace) neg_closed [iff]: "x \<in> U \<Longrightarrow> - x \<in> U"
   10.98    by (simp add: negate_eq1)
   10.99  
  10.100 +
  10.101  text {* \medskip Further derived laws: every subspace is a vector space. *}
  10.102  
  10.103 -lemma subspace_vs [intro?]:
  10.104 -  "is_subspace U V \<Longrightarrow> is_vectorspace V \<Longrightarrow> is_vectorspace U"
  10.105 -proof -
  10.106 -  assume "is_subspace U V"  "is_vectorspace V"
  10.107 -  show ?thesis
  10.108 -  proof
  10.109 -    show "0 \<in> U" ..
  10.110 -    show "\<forall>x \<in> U. \<forall>a. a \<cdot> x \<in> U" by (simp!)
  10.111 -    show "\<forall>x \<in> U. \<forall>y \<in> U. x + y \<in> U" by (simp!)
  10.112 -    show "\<forall>x \<in> U. - x = - 1 \<cdot> x" by (simp! add: negate_eq1)
  10.113 -    show "\<forall>x \<in> U. \<forall>y \<in> U. x - y =  x + - y"
  10.114 -      by (simp! add: diff_eq1)
  10.115 -  qed (simp! add: vs_add_mult_distrib1 vs_add_mult_distrib2)+
  10.116 +lemma (in subvectorspace) vectorspace [iff]:
  10.117 +  "vectorspace U"
  10.118 +proof
  10.119 +  show "U \<noteq> {}" ..
  10.120 +  fix x y z assume x: "x \<in> U" and y: "y \<in> U" and z: "z \<in> U"
  10.121 +  fix a b :: real
  10.122 +  from x y show "x + y \<in> U" by simp
  10.123 +  from x show "a \<cdot> x \<in> U" by simp
  10.124 +  from x y z show "(x + y) + z = x + (y + z)" by (simp add: add_ac)
  10.125 +  from x y show "x + y = y + x" by (simp add: add_ac)
  10.126 +  from x show "x - x = 0" by simp
  10.127 +  from x show "0 + x = x" by simp
  10.128 +  from x y show "a \<cdot> (x + y) = a \<cdot> x + a \<cdot> y" by (simp add: distrib)
  10.129 +  from x show "(a + b) \<cdot> x = a \<cdot> x + b \<cdot> x" by (simp add: distrib)
  10.130 +  from x show "(a * b) \<cdot> x = a \<cdot> b \<cdot> x" by (simp add: mult_assoc)
  10.131 +  from x show "1 \<cdot> x = x" by simp
  10.132 +  from x show "- x = - 1 \<cdot> x" by (simp add: negate_eq1)
  10.133 +  from x y show "x - y = x + - y" by (simp add: diff_eq1)
  10.134  qed
  10.135  
  10.136 +
  10.137  text {* The subspace relation is reflexive. *}
  10.138  
  10.139 -lemma subspace_refl [intro]: "is_vectorspace V \<Longrightarrow> is_subspace V V"
  10.140 +lemma (in vectorspace) subspace_refl [intro]: "V \<unlhd> V"
  10.141  proof
  10.142 -  assume "is_vectorspace V"
  10.143 -  show "0 \<in> V" ..
  10.144 +  show "V \<noteq> {}" ..
  10.145    show "V \<subseteq> V" ..
  10.146 -  show "\<forall>x \<in> V. \<forall>y \<in> V. x + y \<in> V" by (simp!)
  10.147 -  show "\<forall>x \<in> V. \<forall>a. a \<cdot> x \<in> V" by (simp!)
  10.148 +  fix x y assume x: "x \<in> V" and y: "y \<in> V"
  10.149 +  fix a :: real
  10.150 +  from x y show "x + y \<in> V" by simp
  10.151 +  from x show "a \<cdot> x \<in> V" by simp
  10.152  qed
  10.153  
  10.154  text {* The subspace relation is transitive. *}
  10.155  
  10.156 -lemma subspace_trans:
  10.157 -  "is_subspace U V \<Longrightarrow> is_vectorspace V \<Longrightarrow> is_subspace V W
  10.158 -  \<Longrightarrow> is_subspace U W"
  10.159 +lemma (in vectorspace) subspace_trans [trans]:
  10.160 +  "U \<unlhd> V \<Longrightarrow> V \<unlhd> W \<Longrightarrow> U \<unlhd> W"
  10.161  proof
  10.162 -  assume "is_subspace U V"  "is_subspace V W"  "is_vectorspace V"
  10.163 -  show "0 \<in> U" ..
  10.164 -
  10.165 -  have "U \<subseteq> V" ..
  10.166 -  also have "V \<subseteq> W" ..
  10.167 -  finally show "U \<subseteq> W" .
  10.168 -
  10.169 -  show "\<forall>x \<in> U. \<forall>y \<in> U. x + y \<in> U"
  10.170 -  proof (intro ballI)
  10.171 -    fix x y assume "x \<in> U"  "y \<in> U"
  10.172 -    show "x + y \<in> U" by (simp!)
  10.173 +  assume uv: "U \<unlhd> V" and vw: "V \<unlhd> W"
  10.174 +  from uv show "U \<noteq> {}" by (rule subspace.non_empty)
  10.175 +  show "U \<subseteq> W"
  10.176 +  proof -
  10.177 +    from uv have "U \<subseteq> V" by (rule subspace.subset)
  10.178 +    also from vw have "V \<subseteq> W" by (rule subspace.subset)
  10.179 +    finally show ?thesis .
  10.180    qed
  10.181 -
  10.182 -  show "\<forall>x \<in> U. \<forall>a. a \<cdot> x \<in> U"
  10.183 -  proof (intro ballI allI)
  10.184 -    fix x a assume "x \<in> U"
  10.185 -    show "a \<cdot> x \<in> U" by (simp!)
  10.186 -  qed
  10.187 +  fix x y assume x: "x \<in> U" and y: "y \<in> U"
  10.188 +  from uv and x y show "x + y \<in> U" by (rule subspace.add_closed)
  10.189 +  from uv and x show "\<And>a. a \<cdot> x \<in> U" by (rule subspace.mult_closed)
  10.190  qed
  10.191  
  10.192  
  10.193 -
  10.194  subsection {* Linear closure *}
  10.195  
  10.196  text {*
  10.197 @@ -140,73 +127,75 @@
  10.198  *}
  10.199  
  10.200  constdefs
  10.201 -  lin :: "('a::{minus,plus,zero}) \<Rightarrow> 'a set"
  10.202 +  lin :: "('a::{minus, plus, zero}) \<Rightarrow> 'a set"
  10.203    "lin x \<equiv> {a \<cdot> x | a. True}"
  10.204  
  10.205 -lemma linD: "(x \<in> lin v) = (\<exists>a::real. x = a \<cdot> v)"
  10.206 -  by (unfold lin_def) fast
  10.207 +lemma linI [intro]: "y = a \<cdot> x \<Longrightarrow> y \<in> lin x"
  10.208 +  by (unfold lin_def) blast
  10.209  
  10.210 -lemma linI [intro?]: "a \<cdot> x0 \<in> lin x0"
  10.211 -  by (unfold lin_def) fast
  10.212 +lemma linI' [iff]: "a \<cdot> x \<in> lin x"
  10.213 +  by (unfold lin_def) blast
  10.214 +
  10.215 +lemma linE [elim]:
  10.216 +    "x \<in> lin v \<Longrightarrow> (\<And>a::real. x = a \<cdot> v \<Longrightarrow> C) \<Longrightarrow> C"
  10.217 +  by (unfold lin_def) blast
  10.218 +
  10.219  
  10.220  text {* Every vector is contained in its linear closure. *}
  10.221  
  10.222 -lemma x_lin_x: "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> x \<in> lin x"
  10.223 -proof (unfold lin_def, intro CollectI exI conjI)
  10.224 -  assume "is_vectorspace V"  "x \<in> V"
  10.225 -  show "x = 1 \<cdot> x" by (simp!)
  10.226 -qed simp
  10.227 +lemma (in vectorspace) x_lin_x [iff]: "x \<in> V \<Longrightarrow> x \<in> lin x"
  10.228 +proof -
  10.229 +  assume "x \<in> V"
  10.230 +  hence "x = 1 \<cdot> x" by simp
  10.231 +  also have "\<dots> \<in> lin x" ..
  10.232 +  finally show ?thesis .
  10.233 +qed
  10.234 +
  10.235 +lemma (in vectorspace) "0_lin_x" [iff]: "x \<in> V \<Longrightarrow> 0 \<in> lin x"
  10.236 +proof
  10.237 +  assume "x \<in> V"
  10.238 +  thus "0 = 0 \<cdot> x" by simp
  10.239 +qed
  10.240  
  10.241  text {* Any linear closure is a subspace. *}
  10.242  
  10.243 -lemma lin_subspace [intro?]:
  10.244 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> is_subspace (lin x) V"
  10.245 +lemma (in vectorspace) lin_subspace [intro]:
  10.246 +  "x \<in> V \<Longrightarrow> lin x \<unlhd> V"
  10.247  proof
  10.248 -  assume "is_vectorspace V"  "x \<in> V"
  10.249 -  show "0 \<in> lin x"
  10.250 -  proof (unfold lin_def, intro CollectI exI conjI)
  10.251 -    show "0 = (0::real) \<cdot> x" by (simp!)
  10.252 -  qed simp
  10.253 -
  10.254 +  assume x: "x \<in> V"
  10.255 +  thus "lin x \<noteq> {}" by (auto simp add: x_lin_x)
  10.256    show "lin x \<subseteq> V"
  10.257 -  proof (unfold lin_def, intro subsetI, elim CollectE exE conjE)
  10.258 -    fix xa a assume "xa = a \<cdot> x"
  10.259 -    show "xa \<in> V" by (simp!)
  10.260 +  proof
  10.261 +    fix x' assume "x' \<in> lin x"
  10.262 +    then obtain a where "x' = a \<cdot> x" ..
  10.263 +    with x show "x' \<in> V" by simp
  10.264    qed
  10.265 -
  10.266 -  show "\<forall>x1 \<in> lin x. \<forall>x2 \<in> lin x. x1 + x2 \<in> lin x"
  10.267 -  proof (intro ballI)
  10.268 -    fix x1 x2 assume "x1 \<in> lin x"  "x2 \<in> lin x"
  10.269 -    thus "x1 + x2 \<in> lin x"
  10.270 -    proof (unfold lin_def, elim CollectE exE conjE,
  10.271 -      intro CollectI exI conjI)
  10.272 -      fix a1 a2 assume "x1 = a1 \<cdot> x"  "x2 = a2 \<cdot> x"
  10.273 -      show "x1 + x2 = (a1 + a2) \<cdot> x"
  10.274 -        by (simp! add: vs_add_mult_distrib2)
  10.275 -    qed simp
  10.276 +  fix x' x'' assume x': "x' \<in> lin x" and x'': "x'' \<in> lin x"
  10.277 +  show "x' + x'' \<in> lin x"
  10.278 +  proof -
  10.279 +    from x' obtain a' where "x' = a' \<cdot> x" ..
  10.280 +    moreover from x'' obtain a'' where "x'' = a'' \<cdot> x" ..
  10.281 +    ultimately have "x' + x'' = (a' + a'') \<cdot> x"
  10.282 +      using x by (simp add: distrib)
  10.283 +    also have "\<dots> \<in> lin x" ..
  10.284 +    finally show ?thesis .
  10.285    qed
  10.286 -
  10.287 -  show "\<forall>xa \<in> lin x. \<forall>a. a \<cdot> xa \<in> lin x"
  10.288 -  proof (intro ballI allI)
  10.289 -    fix x1 a assume "x1 \<in> lin x"
  10.290 -    thus "a \<cdot> x1 \<in> lin x"
  10.291 -    proof (unfold lin_def, elim CollectE exE conjE,
  10.292 -      intro CollectI exI conjI)
  10.293 -      fix a1 assume "x1 = a1 \<cdot> x"
  10.294 -      show "a \<cdot> x1 = (a * a1) \<cdot> x" by (simp!)
  10.295 -    qed simp
  10.296 +  fix a :: real
  10.297 +  show "a \<cdot> x' \<in> lin x"
  10.298 +  proof -
  10.299 +    from x' obtain a' where "x' = a' \<cdot> x" ..
  10.300 +    with x have "a \<cdot> x' = (a * a') \<cdot> x" by (simp add: mult_assoc)
  10.301 +    also have "\<dots> \<in> lin x" ..
  10.302 +    finally show ?thesis .
  10.303    qed
  10.304  qed
  10.305  
  10.306 +
  10.307  text {* Any linear closure is a vector space. *}
  10.308  
  10.309 -lemma lin_vs [intro?]:
  10.310 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> is_vectorspace (lin x)"
  10.311 -proof (rule subspace_vs)
  10.312 -  assume "is_vectorspace V"  "x \<in> V"
  10.313 -  show "is_subspace (lin x) V" ..
  10.314 -qed
  10.315 -
  10.316 +lemma (in vectorspace) lin_vectorspace [intro]:
  10.317 +    "x \<in> V \<Longrightarrow> vectorspace (lin x)"
  10.318 +  by (rule subvectorspace.vectorspace) (rule lin_subspace)
  10.319  
  10.320  
  10.321  subsection {* Sum of two vectorspaces *}
  10.322 @@ -219,101 +208,92 @@
  10.323  instance set :: (plus) plus ..
  10.324  
  10.325  defs (overloaded)
  10.326 -  vs_sum_def: "U + V \<equiv> {u + v | u v. u \<in> U \<and> v \<in> V}"
  10.327 +  sum_def: "U + V \<equiv> {u + v | u v. u \<in> U \<and> v \<in> V}"
  10.328  
  10.329 -lemma vs_sumD:
  10.330 -  "(x \<in> U + V) = (\<exists>u \<in> U. \<exists>v \<in> V. x = u + v)"
  10.331 -    by (unfold vs_sum_def) fast
  10.332 +lemma sumE [elim]:
  10.333 +    "x \<in> U + V \<Longrightarrow> (\<And>u v. x = u + v \<Longrightarrow> u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> C) \<Longrightarrow> C"
  10.334 +  by (unfold sum_def) blast
  10.335  
  10.336 -lemmas vs_sumE = vs_sumD [THEN iffD1, elim_format, standard]
  10.337 +lemma sumI [intro]:
  10.338 +    "u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> x = u + v \<Longrightarrow> x \<in> U + V"
  10.339 +  by (unfold sum_def) blast
  10.340  
  10.341 -lemma vs_sumI [intro?]:
  10.342 -  "x \<in> U \<Longrightarrow> y \<in> V \<Longrightarrow> t = x + y \<Longrightarrow> t \<in> U + V"
  10.343 -  by (unfold vs_sum_def) fast
  10.344 +lemma sumI' [intro]:
  10.345 +    "u \<in> U \<Longrightarrow> v \<in> V \<Longrightarrow> u + v \<in> U + V"
  10.346 +  by (unfold sum_def) blast
  10.347  
  10.348  text {* @{text U} is a subspace of @{text "U + V"}. *}
  10.349  
  10.350 -lemma subspace_vs_sum1 [intro?]:
  10.351 -  "is_vectorspace U \<Longrightarrow> is_vectorspace V
  10.352 -  \<Longrightarrow> is_subspace U (U + V)"
  10.353 +lemma subspace_sum1 [iff]:
  10.354 +  includes vectorspace U + vectorspace V
  10.355 +  shows "U \<unlhd> U + V"
  10.356  proof
  10.357 -  assume "is_vectorspace U"  "is_vectorspace V"
  10.358 -  show "0 \<in> U" ..
  10.359 +  show "U \<noteq> {}" ..
  10.360    show "U \<subseteq> U + V"
  10.361 -  proof (intro subsetI vs_sumI)
  10.362 -  fix x assume "x \<in> U"
  10.363 -    show "x = x + 0" by (simp!)
  10.364 -    show "0 \<in> V" by (simp!)
  10.365 +  proof
  10.366 +    fix x assume x: "x \<in> U"
  10.367 +    moreover have "0 \<in> V" ..
  10.368 +    ultimately have "x + 0 \<in> U + V" ..
  10.369 +    with x show "x \<in> U + V" by simp
  10.370    qed
  10.371 -  show "\<forall>x \<in> U. \<forall>y \<in> U. x + y \<in> U"
  10.372 -  proof (intro ballI)
  10.373 -    fix x y assume "x \<in> U"  "y \<in> U" show "x + y \<in> U" by (simp!)
  10.374 -  qed
  10.375 -  show "\<forall>x \<in> U. \<forall>a. a \<cdot> x \<in> U"
  10.376 -  proof (intro ballI allI)
  10.377 -    fix x a assume "x \<in> U" show "a \<cdot> x \<in> U" by (simp!)
  10.378 -  qed
  10.379 +  fix x y assume x: "x \<in> U" and "y \<in> U"
  10.380 +  thus "x + y \<in> U" by simp
  10.381 +  from x show "\<And>a. a \<cdot> x \<in> U" by simp
  10.382  qed
  10.383  
  10.384 -text{* The sum of two subspaces is again a subspace.*}
  10.385 +text {* The sum of two subspaces is again a subspace. *}
  10.386  
  10.387 -lemma vs_sum_subspace [intro?]:
  10.388 -  "is_subspace U E \<Longrightarrow> is_subspace V E \<Longrightarrow> is_vectorspace E
  10.389 -  \<Longrightarrow> is_subspace (U + V) E"
  10.390 +lemma sum_subspace [intro?]:
  10.391 +  includes subvectorspace U E + subvectorspace V E
  10.392 +  shows "U + V \<unlhd> E"
  10.393  proof
  10.394 -  assume "is_subspace U E"  "is_subspace V E"  "is_vectorspace E"
  10.395 -  show "0 \<in> U + V"
  10.396 -  proof (intro vs_sumI)
  10.397 +  have "0 \<in> U + V"
  10.398 +  proof
  10.399      show "0 \<in> U" ..
  10.400      show "0 \<in> V" ..
  10.401 -    show "(0::'a) = 0 + 0" by (simp!)
  10.402 +    show "(0::'a) = 0 + 0" by simp
  10.403    qed
  10.404 -
  10.405 +  thus "U + V \<noteq> {}" by blast
  10.406    show "U + V \<subseteq> E"
  10.407 -  proof (intro subsetI, elim vs_sumE bexE)
  10.408 -    fix x u v assume "u \<in> U"  "v \<in> V"  "x = u + v"
  10.409 -    show "x \<in> E" by (simp!)
  10.410 +  proof
  10.411 +    fix x assume "x \<in> U + V"
  10.412 +    then obtain u v where x: "x = u + v" and
  10.413 +      u: "u \<in> U" and v: "v \<in> V" ..
  10.414 +    have "U \<unlhd> E" . with u have "u \<in> E" ..
  10.415 +    moreover have "V \<unlhd> E" . with v have "v \<in> E" ..
  10.416 +    ultimately show "x \<in> E" using x by simp
  10.417    qed
  10.418 -
  10.419 -  show "\<forall>x \<in> U + V. \<forall>y \<in> U + V. x + y \<in> U + V"
  10.420 -  proof (intro ballI)
  10.421 -    fix x y assume "x \<in> U + V"  "y \<in> U + V"
  10.422 -    thus "x + y \<in> U + V"
  10.423 -    proof (elim vs_sumE bexE, intro vs_sumI)
  10.424 -      fix ux vx uy vy
  10.425 -      assume "ux \<in> U"  "vx \<in> V"  "x = ux + vx"
  10.426 -        and "uy \<in> U"  "vy \<in> V"  "y = uy + vy"
  10.427 -      show "x + y = (ux + uy) + (vx + vy)" by (simp!)
  10.428 -    qed (simp_all!)
  10.429 +  fix x y assume x: "x \<in> U + V" and y: "y \<in> U + V"
  10.430 +  show "x + y \<in> U + V"
  10.431 +  proof -
  10.432 +    from x obtain ux vx where "x = ux + vx" and "ux \<in> U" and "vx \<in> V" ..
  10.433 +    moreover
  10.434 +    from y obtain uy vy where "y = uy + vy" and "uy \<in> U" and "vy \<in> V" ..
  10.435 +    ultimately
  10.436 +    have "ux + uy \<in> U"
  10.437 +      and "vx + vy \<in> V"
  10.438 +      and "x + y = (ux + uy) + (vx + vy)"
  10.439 +      using x y by (simp_all add: add_ac)
  10.440 +    thus ?thesis ..
  10.441    qed
  10.442 -
  10.443 -  show "\<forall>x \<in> U + V. \<forall>a. a \<cdot> x \<in> U + V"
  10.444 -  proof (intro ballI allI)
  10.445 -    fix x a assume "x \<in> U + V"
  10.446 -    thus "a \<cdot> x \<in> U + V"
  10.447 -    proof (elim vs_sumE bexE, intro vs_sumI)
  10.448 -      fix a x u v assume "u \<in> U"  "v \<in> V"  "x = u + v"
  10.449 -      show "a \<cdot> x = (a \<cdot> u) + (a \<cdot> v)"
  10.450 -        by (simp! add: vs_add_mult_distrib1)
  10.451 -    qed (simp_all!)
  10.452 +  fix a show "a \<cdot> x \<in> U + V"
  10.453 +  proof -
  10.454 +    from x obtain u v where "x = u + v" and "u \<in> U" and "v \<in> V" ..
  10.455 +    hence "a \<cdot> u \<in> U" and "a \<cdot> v \<in> V"
  10.456 +      and "a \<cdot> x = (a \<cdot> u) + (a \<cdot> v)" by (simp_all add: distrib)
  10.457 +    thus ?thesis ..
  10.458    qed
  10.459  qed
  10.460  
  10.461  text{* The sum of two subspaces is a vectorspace. *}
  10.462  
  10.463 -lemma vs_sum_vs [intro?]:
  10.464 -  "is_subspace U E \<Longrightarrow> is_subspace V E \<Longrightarrow> is_vectorspace E
  10.465 -  \<Longrightarrow> is_vectorspace (U + V)"
  10.466 -proof (rule subspace_vs)
  10.467 -  assume "is_subspace U E"  "is_subspace V E"  "is_vectorspace E"
  10.468 -  show "is_subspace (U + V) E" ..
  10.469 -qed
  10.470 -
  10.471 +lemma sum_vs [intro?]:
  10.472 +    "U \<unlhd> E \<Longrightarrow> V \<unlhd> E \<Longrightarrow> vectorspace E \<Longrightarrow> vectorspace (U + V)"
  10.473 +  by (rule subvectorspace.vectorspace) (rule sum_subspace)
  10.474  
  10.475  
  10.476  subsection {* Direct sums *}
  10.477  
  10.478 -
  10.479  text {*
  10.480    The sum of @{text U} and @{text V} is called \emph{direct}, iff the
  10.481    zero element is the only common element of @{text U} and @{text
  10.482 @@ -323,31 +303,35 @@
  10.483  *}
  10.484  
  10.485  lemma decomp:
  10.486 -  "is_vectorspace E \<Longrightarrow> is_subspace U E \<Longrightarrow> is_subspace V E \<Longrightarrow>
  10.487 -  U \<inter> V = {0} \<Longrightarrow> u1 \<in> U \<Longrightarrow> u2 \<in> U \<Longrightarrow> v1 \<in> V \<Longrightarrow> v2 \<in> V \<Longrightarrow>
  10.488 -  u1 + v1 = u2 + v2 \<Longrightarrow> u1 = u2 \<and> v1 = v2"
  10.489 +  includes vectorspace E + subspace U E + subspace V E
  10.490 +  assumes direct: "U \<inter> V = {0}"
  10.491 +    and u1: "u1 \<in> U" and u2: "u2 \<in> U"
  10.492 +    and v1: "v1 \<in> V" and v2: "v2 \<in> V"
  10.493 +    and sum: "u1 + v1 = u2 + v2"
  10.494 +  shows "u1 = u2 \<and> v1 = v2"
  10.495  proof
  10.496 -  assume "is_vectorspace E"  "is_subspace U E"  "is_subspace V E"
  10.497 -    "U \<inter> V = {0}"  "u1 \<in> U"  "u2 \<in> U"  "v1 \<in> V"  "v2 \<in> V"
  10.498 -    "u1 + v1 = u2 + v2"
  10.499 -  have eq: "u1 - u2 = v2 - v1" by (simp! add: vs_add_diff_swap)
  10.500 -  have u: "u1 - u2 \<in> U" by (simp!)
  10.501 -  with eq have v': "v2 - v1 \<in> U" by simp
  10.502 -  have v: "v2 - v1 \<in> V" by (simp!)
  10.503 -  with eq have u': "u1 - u2 \<in> V" by simp
  10.504 +  have U: "vectorspace U" by (rule subvectorspace.vectorspace)
  10.505 +  have V: "vectorspace V" by (rule subvectorspace.vectorspace)
  10.506 +  from u1 u2 v1 v2 and sum have eq: "u1 - u2 = v2 - v1"
  10.507 +    by (simp add: add_diff_swap)
  10.508 +  from u1 u2 have u: "u1 - u2 \<in> U"
  10.509 +    by (rule vectorspace.diff_closed [OF U])
  10.510 +  with eq have v': "v2 - v1 \<in> U" by (simp only:)
  10.511 +  from v2 v1 have v: "v2 - v1 \<in> V"
  10.512 +    by (rule vectorspace.diff_closed [OF V])
  10.513 +  with eq have u': " u1 - u2 \<in> V" by (simp only:)
  10.514  
  10.515    show "u1 = u2"
  10.516 -  proof (rule vs_add_minus_eq)
  10.517 -    show "u1 - u2 = 0" by (rule Int_singletonD [OF _ u u'])
  10.518 +  proof (rule add_minus_eq)
  10.519      show "u1 \<in> E" ..
  10.520      show "u2 \<in> E" ..
  10.521 +    from u u' and direct show "u1 - u2 = 0" by blast
  10.522    qed
  10.523 -
  10.524    show "v1 = v2"
  10.525 -  proof (rule vs_add_minus_eq [symmetric])
  10.526 -    show "v2 - v1 = 0" by (rule Int_singletonD [OF _ v' v])
  10.527 +  proof (rule add_minus_eq [symmetric])
  10.528      show "v1 \<in> E" ..
  10.529      show "v2 \<in> E" ..
  10.530 +    from v v' and direct show "v2 - v1 = 0" by blast
  10.531    qed
  10.532  qed
  10.533  
  10.534 @@ -361,58 +345,48 @@
  10.535  *}
  10.536  
  10.537  lemma decomp_H':
  10.538 -  "is_vectorspace E \<Longrightarrow> is_subspace H E \<Longrightarrow> y1 \<in> H \<Longrightarrow> y2 \<in> H \<Longrightarrow>
  10.539 -  x' \<notin> H \<Longrightarrow> x' \<in> E \<Longrightarrow> x' \<noteq> 0 \<Longrightarrow> y1 + a1 \<cdot> x' = y2 + a2 \<cdot> x'
  10.540 -  \<Longrightarrow> y1 = y2 \<and> a1 = a2"
  10.541 +  includes vectorspace E + subvectorspace H E
  10.542 +  assumes y1: "y1 \<in> H" and y2: "y2 \<in> H"
  10.543 +    and x': "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
  10.544 +    and eq: "y1 + a1 \<cdot> x' = y2 + a2 \<cdot> x'"
  10.545 +  shows "y1 = y2 \<and> a1 = a2"
  10.546  proof
  10.547 -  assume "is_vectorspace E" and h: "is_subspace H E"
  10.548 -     and "y1 \<in> H"  "y2 \<in> H"  "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
  10.549 -         "y1 + a1 \<cdot> x' = y2 + a2 \<cdot> x'"
  10.550 -
  10.551    have c: "y1 = y2 \<and> a1 \<cdot> x' = a2 \<cdot> x'"
  10.552    proof (rule decomp)
  10.553      show "a1 \<cdot> x' \<in> lin x'" ..
  10.554      show "a2 \<cdot> x' \<in> lin x'" ..
  10.555 -    show "H \<inter> (lin x') = {0}"
  10.556 +    show "H \<inter> lin x' = {0}"
  10.557      proof
  10.558        show "H \<inter> lin x' \<subseteq> {0}"
  10.559 -      proof (intro subsetI, elim IntE, rule singleton_iff [THEN iffD2])
  10.560 -        fix x assume "x \<in> H"  "x \<in> lin x'"
  10.561 -        thus "x = 0"
  10.562 -        proof (unfold lin_def, elim CollectE exE conjE)
  10.563 -          fix a assume "x = a \<cdot> x'"
  10.564 -          show ?thesis
  10.565 -          proof cases
  10.566 -            assume "a = (0::real)" show ?thesis by (simp!)
  10.567 -          next
  10.568 -            assume "a \<noteq> (0::real)"
  10.569 -            from h have "inverse a \<cdot> a \<cdot> x' \<in> H"
  10.570 -              by (rule subspace_mult_closed) (simp!)
  10.571 -            also have "inverse a \<cdot> a \<cdot> x' = x'" by (simp!)
  10.572 -            finally have "x' \<in> H" .
  10.573 -            thus ?thesis by contradiction
  10.574 -          qed
  10.575 -       qed
  10.576 +      proof
  10.577 +        fix x assume x: "x \<in> H \<inter> lin x'"
  10.578 +        then obtain a where xx': "x = a \<cdot> x'"
  10.579 +          by blast
  10.580 +        have "x = 0"
  10.581 +        proof cases
  10.582 +          assume "a = 0"
  10.583 +          with xx' and x' show ?thesis by simp
  10.584 +        next
  10.585 +          assume a: "a \<noteq> 0"
  10.586 +          from x have "x \<in> H" ..
  10.587 +          with xx' have "inverse a \<cdot> a \<cdot> x' \<in> H" by simp
  10.588 +          with a and x' have "x' \<in> H" by (simp add: mult_assoc2)
  10.589 +          thus ?thesis by contradiction
  10.590 +        qed
  10.591 +        thus "x \<in> {0}" ..
  10.592        qed
  10.593        show "{0} \<subseteq> H \<inter> lin x'"
  10.594        proof -
  10.595 -        have "0 \<in> H \<inter> lin x'"
  10.596 -        proof (rule IntI)
  10.597 -          show "0 \<in> H" ..
  10.598 -          from lin_vs show "0 \<in> lin x'" ..
  10.599 -        qed
  10.600 -        thus ?thesis by simp
  10.601 +        have "0 \<in> H" ..
  10.602 +        moreover have "0 \<in> lin x'" ..
  10.603 +        ultimately show ?thesis by blast
  10.604        qed
  10.605      qed
  10.606 -    show "is_subspace (lin x') E" ..
  10.607 +    show "lin x' \<unlhd> E" ..
  10.608    qed
  10.609 -
  10.610 -  from c show "y1 = y2" by simp
  10.611 -
  10.612 -  show  "a1 = a2"
  10.613 -  proof (rule vs_mult_right_cancel [THEN iffD1])
  10.614 -    from c show "a1 \<cdot> x' = a2 \<cdot> x'" by simp
  10.615 -  qed
  10.616 +  thus "y1 = y2" ..
  10.617 +  from c have "a1 \<cdot> x' = a2 \<cdot> x'" ..
  10.618 +  with x' show "a1 = a2" by (simp add: mult_right_cancel)
  10.619  qed
  10.620  
  10.621  text {*
  10.622 @@ -423,18 +397,20 @@
  10.623  *}
  10.624  
  10.625  lemma decomp_H'_H:
  10.626 -  "is_vectorspace E \<Longrightarrow> is_subspace H E \<Longrightarrow> t \<in> H \<Longrightarrow> x' \<notin> H \<Longrightarrow> x' \<in> E
  10.627 -  \<Longrightarrow> x' \<noteq> 0
  10.628 -  \<Longrightarrow> (SOME (y, a). t = y + a \<cdot> x' \<and> y \<in> H) = (t, (0::real))"
  10.629 -proof (rule, unfold split_tupled_all)
  10.630 -  assume "is_vectorspace E"  "is_subspace H E"  "t \<in> H"  "x' \<notin> H"  "x' \<in> E"
  10.631 -    "x' \<noteq> 0"
  10.632 -  have h: "is_vectorspace H" ..
  10.633 -  fix y a presume t1: "t = y + a \<cdot> x'" and "y \<in> H"
  10.634 -  have "y = t \<and> a = (0::real)"
  10.635 -    by (rule decomp_H') (auto!)
  10.636 -  thus "(y, a) = (t, (0::real))" by (simp!)
  10.637 -qed (simp_all!)
  10.638 +  includes vectorspace E + subvectorspace H E
  10.639 +  assumes t: "t \<in> H"
  10.640 +    and x': "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
  10.641 +  shows "(SOME (y, a). t = y + a \<cdot> x' \<and> y \<in> H) = (t, 0)"
  10.642 +proof (rule, simp_all only: split_paired_all split_conv)
  10.643 +  from t x' show "t = t + 0 \<cdot> x' \<and> t \<in> H" by simp
  10.644 +  fix y and a assume ya: "t = y + a \<cdot> x' \<and> y \<in> H"
  10.645 +  have "y = t \<and> a = 0"
  10.646 +  proof (rule decomp_H')
  10.647 +    from ya x' show "y + a \<cdot> x' = t + 0 \<cdot> x'" by simp
  10.648 +    from ya show "y \<in> H" ..
  10.649 +  qed
  10.650 +  with t x' show "(y, a) = (y + a \<cdot> x', 0)" by simp
  10.651 +qed
  10.652  
  10.653  text {*
  10.654    The components @{text "y \<in> H"} and @{text a} in @{text "y + a \<cdot> x'"}
  10.655 @@ -443,42 +419,41 @@
  10.656  *}
  10.657  
  10.658  lemma h'_definite:
  10.659 -  "h' \<equiv> (\<lambda>x. let (y, a) = SOME (y, a). (x = y + a \<cdot> x' \<and> y \<in> H)
  10.660 -                in (h y) + a * xi) \<Longrightarrow>
  10.661 -  x = y + a \<cdot> x' \<Longrightarrow> is_vectorspace E \<Longrightarrow> is_subspace H E \<Longrightarrow>
  10.662 -  y \<in> H \<Longrightarrow> x' \<notin> H \<Longrightarrow> x' \<in> E \<Longrightarrow> x' \<noteq> 0
  10.663 -  \<Longrightarrow> h' x = h y + a * xi"
  10.664 +  includes var H
  10.665 +  assumes h'_def:
  10.666 +    "h' \<equiv> (\<lambda>x. let (y, a) = SOME (y, a). (x = y + a \<cdot> x' \<and> y \<in> H)
  10.667 +                in (h y) + a * xi)"
  10.668 +    and x: "x = y + a \<cdot> x'"
  10.669 +  includes vectorspace E + subvectorspace H E
  10.670 +  assumes y: "y \<in> H"
  10.671 +    and x': "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
  10.672 +  shows "h' x = h y + a * xi"
  10.673  proof -
  10.674 -  assume
  10.675 -    "h' \<equiv> (\<lambda>x. let (y, a) = SOME (y, a). (x = y + a \<cdot> x' \<and> y \<in> H)
  10.676 -               in (h y) + a * xi)"
  10.677 -    "x = y + a \<cdot> x'"  "is_vectorspace E"  "is_subspace H E"
  10.678 -    "y \<in> H"  "x' \<notin> H"  "x' \<in> E"  "x' \<noteq> 0"
  10.679 -  hence "x \<in> H + (lin x')"
  10.680 -    by (auto simp add: vs_sum_def lin_def)
  10.681 -  have "\<exists>! xa. ((\<lambda>(y, a). x = y + a \<cdot> x' \<and> y \<in> H) xa)"
  10.682 +  from x y x' have "x \<in> H + lin x'" by auto
  10.683 +  have "\<exists>!p. (\<lambda>(y, a). x = y + a \<cdot> x' \<and> y \<in> H) p" (is "\<exists>!p. ?P p")
  10.684    proof
  10.685 -    show "\<exists>xa. ((\<lambda>(y, a). x = y + a \<cdot> x' \<and> y \<in> H) xa)"
  10.686 -      by (blast!)
  10.687 -  next
  10.688 -    fix xa ya
  10.689 -    assume "(\<lambda>(y,a). x = y + a \<cdot> x' \<and> y \<in> H) xa"
  10.690 -           "(\<lambda>(y,a). x = y + a \<cdot> x' \<and> y \<in> H) ya"
  10.691 -    show "xa = ya"
  10.692 +    from x y show "\<exists>p. ?P p" by blast
  10.693 +    fix p q assume p: "?P p" and q: "?P q"
  10.694 +    show "p = q"
  10.695      proof -
  10.696 -      show "fst xa = fst ya \<and> snd xa = snd ya \<Longrightarrow> xa = ya"
  10.697 -        by (simp add: Pair_fst_snd_eq)
  10.698 -      have x: "x = fst xa + snd xa \<cdot> x' \<and> fst xa \<in> H"
  10.699 -        by (auto!)
  10.700 -      have y: "x = fst ya + snd ya \<cdot> x' \<and> fst ya \<in> H"
  10.701 -        by (auto!)
  10.702 -      from x y show "fst xa = fst ya \<and> snd xa = snd ya"
  10.703 -        by (elim conjE) (rule decomp_H', (simp!)+)
  10.704 +      from p have xp: "x = fst p + snd p \<cdot> x' \<and> fst p \<in> H"
  10.705 +        by (cases p) simp
  10.706 +      from q have xq: "x = fst q + snd q \<cdot> x' \<and> fst q \<in> H"
  10.707 +        by (cases q) simp
  10.708 +      have "fst p = fst q \<and> snd p = snd q"
  10.709 +      proof (rule decomp_H')
  10.710 +        from xp show "fst p \<in> H" ..
  10.711 +        from xq show "fst q \<in> H" ..
  10.712 +        from xp and xq show "fst p + snd p \<cdot> x' = fst q + snd q \<cdot> x'"
  10.713 +          by simp
  10.714 +        apply_end assumption+
  10.715 +      qed
  10.716 +      thus ?thesis by (cases p, cases q) simp
  10.717      qed
  10.718    qed
  10.719    hence eq: "(SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H) = (y, a)"
  10.720 -    by (rule some1_equality) (blast!)
  10.721 -  thus "h' x = h y + a * xi" by (simp! add: Let_def)
  10.722 +    by (rule some1_equality) (simp add: x y)
  10.723 +  with h'_def show "h' x = h y + a * xi" by (simp add: Let_def)
  10.724  qed
  10.725  
  10.726  end
    11.1 --- a/src/HOL/Real/HahnBanach/VectorSpace.thy	Thu Aug 22 12:28:41 2002 +0200
    11.2 +++ b/src/HOL/Real/HahnBanach/VectorSpace.thy	Thu Aug 22 20:49:43 2002 +0200
    11.3 @@ -5,7 +5,7 @@
    11.4  
    11.5  header {* Vector spaces *}
    11.6  
    11.7 -theory VectorSpace = Bounds + Aux:
    11.8 +theory VectorSpace = Aux:
    11.9  
   11.10  subsection {* Signature *}
   11.11  
   11.12 @@ -35,459 +35,379 @@
   11.13    the neutral element of scalar multiplication.
   11.14  *}
   11.15  
   11.16 -constdefs
   11.17 -  is_vectorspace :: "('a::{plus, minus, zero}) set \<Rightarrow> bool"
   11.18 -  "is_vectorspace V \<equiv> V \<noteq> {}
   11.19 -   \<and> (\<forall>x \<in> V. \<forall>y \<in> V. \<forall>z \<in> V. \<forall>a b.
   11.20 -        x + y \<in> V
   11.21 -      \<and> a \<cdot> x \<in> V
   11.22 -      \<and> (x + y) + z = x + (y + z)
   11.23 -      \<and> x + y = y + x
   11.24 -      \<and> x - x = 0
   11.25 -      \<and> 0 + x = x
   11.26 -      \<and> a \<cdot> (x + y) = a \<cdot> x + a \<cdot> y
   11.27 -      \<and> (a + b) \<cdot> x = a \<cdot> x + b \<cdot> x
   11.28 -      \<and> (a * b) \<cdot> x = a \<cdot> b \<cdot> x
   11.29 -      \<and> 1 \<cdot> x = x
   11.30 -      \<and> - x = (- 1) \<cdot> x
   11.31 -      \<and> x - y = x + - y)"
   11.32 -
   11.33 -
   11.34 -text {* \medskip The corresponding introduction rule is:*}
   11.35 -
   11.36 -lemma vsI [intro]:
   11.37 -  "0 \<in> V \<Longrightarrow>
   11.38 -  \<forall>x \<in> V. \<forall>y \<in> V. x + y \<in> V \<Longrightarrow>
   11.39 -  \<forall>x \<in> V. \<forall>a. a \<cdot> x \<in> V \<Longrightarrow>
   11.40 -  \<forall>x \<in> V. \<forall>y \<in> V. \<forall>z \<in> V. (x + y) + z = x + (y + z) \<Longrightarrow>
   11.41 -  \<forall>x \<in> V. \<forall>y \<in> V. x + y = y + x \<Longrightarrow>
   11.42 -  \<forall>x \<in> V. x - x = 0 \<Longrightarrow>
   11.43 -  \<forall>x \<in> V. 0 + x = x \<Longrightarrow>
   11.44 -  \<forall>x \<in> V. \<forall>y \<in> V. \<forall>a. a \<cdot> (x + y) = a \<cdot> x + a \<cdot> y \<Longrightarrow>
   11.45 -  \<forall>x \<in> V. \<forall>a b. (a + b) \<cdot> x = a \<cdot> x + b \<cdot> x \<Longrightarrow>
   11.46 -  \<forall>x \<in> V. \<forall>a b. (a * b) \<cdot> x = a \<cdot> b \<cdot> x \<Longrightarrow>
   11.47 -  \<forall>x \<in> V. 1 \<cdot> x = x \<Longrightarrow>
   11.48 -  \<forall>x \<in> V. - x = (- 1) \<cdot> x \<Longrightarrow>
   11.49 -  \<forall>x \<in> V. \<forall>y \<in> V. x - y = x + - y \<Longrightarrow> is_vectorspace V"
   11.50 -  by (unfold is_vectorspace_def) auto
   11.51 +locale vectorspace = var V +
   11.52 +  assumes non_empty [iff, intro?]: "V \<noteq> {}"
   11.53 +    and add_closed [iff]: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + y \<in> V"
   11.54 +    and mult_closed [iff]: "x \<in> V \<Longrightarrow> a \<cdot> x \<in> V"
   11.55 +    and add_assoc: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> (x + y) + z = x + (y + z)"
   11.56 +    and add_commute: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + y = y + x"
   11.57 +    and diff_self [simp]: "x \<in> V \<Longrightarrow> x - x = 0"
   11.58 +    and add_zero_left [simp]: "x \<in> V \<Longrightarrow> 0 + x = x"
   11.59 +    and add_mult_distrib1: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> a \<cdot> (x + y) = a \<cdot> x + a \<cdot> y"
   11.60 +    and add_mult_distrib2: "x \<in> V \<Longrightarrow> (a + b) \<cdot> x = a \<cdot> x + b \<cdot> x"
   11.61 +    and mult_assoc: "x \<in> V \<Longrightarrow> (a * b) \<cdot> x = a \<cdot> (b \<cdot> x)"
   11.62 +    and mult_1 [simp]: "x \<in> V \<Longrightarrow> 1 \<cdot> x = x"
   11.63 +    and negate_eq1: "x \<in> V \<Longrightarrow> - x = (- 1) \<cdot> x"
   11.64 +    and diff_eq1: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x - y = x + - y"
   11.65  
   11.66 -text {* \medskip The corresponding destruction rules are: *}
   11.67 -
   11.68 -lemma negate_eq1:
   11.69 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> - x = (- 1) \<cdot> x"
   11.70 -  by (unfold is_vectorspace_def) simp
   11.71 -
   11.72 -lemma diff_eq1:
   11.73 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x - y = x + - y"
   11.74 -  by (unfold is_vectorspace_def) simp
   11.75 -
   11.76 -lemma negate_eq2:
   11.77 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> (- 1) \<cdot> x = - x"
   11.78 -  by (unfold is_vectorspace_def) simp
   11.79 -
   11.80 -lemma negate_eq2a:
   11.81 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> -1 \<cdot> x = - x"
   11.82 -  by (unfold is_vectorspace_def) simp
   11.83 +lemma (in vectorspace) negate_eq2: "x \<in> V \<Longrightarrow> (- 1) \<cdot> x = - x"
   11.84 +  by (rule negate_eq1 [symmetric])
   11.85  
   11.86 -lemma diff_eq2:
   11.87 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + - y = x - y"
   11.88 -  by (unfold is_vectorspace_def) simp
   11.89 -
   11.90 -lemma vs_not_empty [intro?]: "is_vectorspace V \<Longrightarrow> (V \<noteq> {})"
   11.91 -  by (unfold is_vectorspace_def) simp
   11.92 +lemma (in vectorspace) negate_eq2a: "x \<in> V \<Longrightarrow> -1 \<cdot> x = - x"
   11.93 +  by (simp add: negate_eq1)
   11.94  
   11.95 -lemma vs_add_closed [simp, intro?]:
   11.96 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + y \<in> V"
   11.97 -  by (unfold is_vectorspace_def) simp
   11.98 +lemma (in vectorspace) diff_eq2: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + - y = x - y"
   11.99 +  by (rule diff_eq1 [symmetric])
  11.100  
  11.101 -lemma vs_mult_closed [simp, intro?]:
  11.102 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> a \<cdot> x \<in> V"
  11.103 -  by (unfold is_vectorspace_def) simp
  11.104 -
  11.105 -lemma vs_diff_closed [simp, intro?]:
  11.106 - "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x - y \<in> V"
  11.107 +lemma (in vectorspace) diff_closed [iff]: "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x - y \<in> V"
  11.108    by (simp add: diff_eq1 negate_eq1)
  11.109  
  11.110 -lemma vs_neg_closed  [simp, intro?]:
  11.111 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> - x \<in> V"
  11.112 +lemma (in vectorspace) neg_closed [iff]: "x \<in> V \<Longrightarrow> - x \<in> V"
  11.113    by (simp add: negate_eq1)
  11.114  
  11.115 -lemma vs_add_assoc [simp]:
  11.116 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V
  11.117 -   \<Longrightarrow> (x + y) + z = x + (y + z)"
  11.118 -  by (unfold is_vectorspace_def) blast
  11.119 -
  11.120 -lemma vs_add_commute [simp]:
  11.121 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> y + x = x + y"
  11.122 -  by (unfold is_vectorspace_def) blast
  11.123 -
  11.124 -lemma vs_add_left_commute [simp]:
  11.125 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V
  11.126 -  \<Longrightarrow> x + (y + z) = y + (x + z)"
  11.127 +lemma (in vectorspace) add_left_commute:
  11.128 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> x + (y + z) = y + (x + z)"
  11.129  proof -
  11.130 -  assume "is_vectorspace V"  "x \<in> V"  "y \<in> V"  "z \<in> V"
  11.131 +  assume xyz: "x \<in> V"  "y \<in> V"  "z \<in> V"
  11.132    hence "x + (y + z) = (x + y) + z"
  11.133 -    by (simp only: vs_add_assoc)
  11.134 -  also have "... = (y + x) + z" by (simp! only: vs_add_commute)
  11.135 -  also have "... = y + (x + z)" by (simp! only: vs_add_assoc)
  11.136 +    by (simp only: add_assoc)
  11.137 +  also from xyz have "... = (y + x) + z" by (simp only: add_commute)
  11.138 +  also from xyz have "... = y + (x + z)" by (simp only: add_assoc)
  11.139    finally show ?thesis .
  11.140  qed
  11.141  
  11.142 -theorems vs_add_ac = vs_add_assoc vs_add_commute vs_add_left_commute
  11.143 +theorems (in vectorspace) add_ac =
  11.144 +  add_assoc add_commute add_left_commute
  11.145  
  11.146 -lemma vs_diff_self [simp]:
  11.147 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> x - x = 0"
  11.148 -  by (unfold is_vectorspace_def) simp
  11.149  
  11.150  text {* The existence of the zero element of a vector space
  11.151 -follows from the non-emptiness of carrier set. *}
  11.152 +  follows from the non-emptiness of carrier set. *}
  11.153  
  11.154 -lemma zero_in_vs [simp, intro]: "is_vectorspace V \<Longrightarrow> 0 \<in> V"
  11.155 +lemma (in vectorspace) zero [iff]: "0 \<in> V"
  11.156  proof -
  11.157 -  assume "is_vectorspace V"
  11.158 -  have "V \<noteq> {}" ..
  11.159 -  then obtain x where "x \<in> V" by blast
  11.160 -  have "0 = x - x" by (simp!)
  11.161 -  also have "... \<in> V" by (simp! only: vs_diff_closed)
  11.162 +  from non_empty obtain x where x: "x \<in> V" by blast
  11.163 +  then have "0 = x - x" by (rule diff_self [symmetric])
  11.164 +  also from x have "... \<in> V" by (rule diff_closed)
  11.165    finally show ?thesis .
  11.166  qed
  11.167  
  11.168 -lemma vs_add_zero_left [simp]:
  11.169 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow>  0 + x = x"
  11.170 -  by (unfold is_vectorspace_def) simp
  11.171 -
  11.172 -lemma vs_add_zero_right [simp]:
  11.173 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow>  x + 0 = x"
  11.174 +lemma (in vectorspace) add_zero_right [simp]:
  11.175 +  "x \<in> V \<Longrightarrow>  x + 0 = x"
  11.176  proof -
  11.177 -  assume "is_vectorspace V"  "x \<in> V"
  11.178 -  hence "x + 0 = 0 + x" by simp
  11.179 -  also have "... = x" by (simp!)
  11.180 +  assume x: "x \<in> V"
  11.181 +  from this and zero have "x + 0 = 0 + x" by (rule add_commute)
  11.182 +  also from x have "... = x" by (rule add_zero_left)
  11.183    finally show ?thesis .
  11.184  qed
  11.185  
  11.186 -lemma vs_add_mult_distrib1:
  11.187 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V
  11.188 -  \<Longrightarrow> a \<cdot> (x + y) = a \<cdot> x + a \<cdot> y"
  11.189 -  by (unfold is_vectorspace_def) simp
  11.190 +lemma (in vectorspace) mult_assoc2:
  11.191 +    "x \<in> V \<Longrightarrow> a \<cdot> b \<cdot> x = (a * b) \<cdot> x"
  11.192 +  by (simp only: mult_assoc)
  11.193  
  11.194 -lemma vs_add_mult_distrib2:
  11.195 -  "is_vectorspace V \<Longrightarrow> x \<in> V
  11.196 -  \<Longrightarrow> (a + b) \<cdot> x = a \<cdot> x + b \<cdot> x"
  11.197 -  by (unfold is_vectorspace_def) simp
  11.198 -
  11.199 -lemma vs_mult_assoc:
  11.200 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> (a * b) \<cdot> x = a \<cdot> (b \<cdot> x)"
  11.201 -  by (unfold is_vectorspace_def) simp
  11.202 -
  11.203 -lemma vs_mult_assoc2 [simp]:
  11.204 - "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> a \<cdot> b \<cdot> x = (a * b) \<cdot> x"
  11.205 -  by (simp only: vs_mult_assoc)
  11.206 +lemma (in vectorspace) diff_mult_distrib1:
  11.207 +    "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> a \<cdot> (x - y) = a \<cdot> x - a \<cdot> y"
  11.208 +  by (simp add: diff_eq1 negate_eq1 add_mult_distrib1 mult_assoc2)
  11.209  
  11.210 -lemma vs_mult_1 [simp]:
  11.211 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> 1 \<cdot> x = x"
  11.212 -  by (unfold is_vectorspace_def) simp
  11.213 -
  11.214 -lemma vs_diff_mult_distrib1:
  11.215 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V
  11.216 -  \<Longrightarrow> a \<cdot> (x - y) = a \<cdot> x - a \<cdot> y"
  11.217 -  by (simp add: diff_eq1 negate_eq1 vs_add_mult_distrib1)
  11.218 -
  11.219 -lemma vs_diff_mult_distrib2:
  11.220 -  "is_vectorspace V \<Longrightarrow> x \<in> V
  11.221 -  \<Longrightarrow> (a - b) \<cdot> x = a \<cdot> x - (b \<cdot> x)"
  11.222 +lemma (in vectorspace) diff_mult_distrib2:
  11.223 +  "x \<in> V \<Longrightarrow> (a - b) \<cdot> x = a \<cdot> x - (b \<cdot> x)"
  11.224  proof -
  11.225 -  assume "is_vectorspace V"  "x \<in> V"
  11.226 +  assume x: "x \<in> V"
  11.227    have " (a - b) \<cdot> x = (a + - b) \<cdot> x"
  11.228 -    by (unfold real_diff_def, simp)
  11.229 +    by (simp add: real_diff_def)
  11.230    also have "... = a \<cdot> x + (- b) \<cdot> x"
  11.231 -    by (rule vs_add_mult_distrib2)
  11.232 -  also have "... = a \<cdot> x + - (b \<cdot> x)"
  11.233 -    by (simp! add: negate_eq1)
  11.234 -  also have "... = a \<cdot> x - (b \<cdot> x)"
  11.235 -    by (simp! add: diff_eq1)
  11.236 +    by (rule add_mult_distrib2)
  11.237 +  also from x have "... = a \<cdot> x + - (b \<cdot> x)"
  11.238 +    by (simp add: negate_eq1 mult_assoc2)
  11.239 +  also from x have "... = a \<cdot> x - (b \<cdot> x)"
  11.240 +    by (simp add: diff_eq1)
  11.241    finally show ?thesis .
  11.242  qed
  11.243  
  11.244 +lemmas (in vectorspace) distrib =
  11.245 +  add_mult_distrib1 add_mult_distrib2
  11.246 +  diff_mult_distrib1 diff_mult_distrib2
  11.247 +
  11.248  
  11.249  text {* \medskip Further derived laws: *}
  11.250  
  11.251 -lemma vs_mult_zero_left [simp]:
  11.252 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> 0 \<cdot> x = 0"
  11.253 +lemma (in vectorspace) mult_zero_left [simp]:
  11.254 +  "x \<in> V \<Longrightarrow> 0 \<cdot> x = 0"
  11.255  proof -
  11.256 -  assume "is_vectorspace V"  "x \<in> V"
  11.257 -  have  "0 \<cdot> x = (1 - 1) \<cdot> x" by simp
  11.258 +  assume x: "x \<in> V"
  11.259 +  have "0 \<cdot> x = (1 - 1) \<cdot> x" by simp
  11.260    also have "... = (1 + - 1) \<cdot> x" by simp
  11.261    also have "... =  1 \<cdot> x + (- 1) \<cdot> x"
  11.262 -    by (rule vs_add_mult_distrib2)
  11.263 -  also have "... = x + (- 1) \<cdot> x" by (simp!)
  11.264 -  also have "... = x + - x" by (simp! add: negate_eq2a)
  11.265 -  also have "... = x - x" by (simp! add: diff_eq2)
  11.266 -  also have "... = 0" by (simp!)
  11.267 +    by (rule add_mult_distrib2)
  11.268 +  also from x have "... = x + (- 1) \<cdot> x" by simp
  11.269 +  also from x have "... = x + - x" by (simp add: negate_eq2a)
  11.270 +  also from x have "... = x - x" by (simp add: diff_eq2)
  11.271 +  also from x have "... = 0" by simp
  11.272    finally show ?thesis .
  11.273  qed
  11.274  
  11.275 -lemma vs_mult_zero_right [simp]:
  11.276 -  "is_vectorspace (V:: 'a::{plus, minus, zero} set)
  11.277 -  \<Longrightarrow> a \<cdot> 0 = (0::'a)"
  11.278 +lemma (in vectorspace) mult_zero_right [simp]:
  11.279 +  "a \<cdot> 0 = (0::'a)"
  11.280  proof -
  11.281 -  assume "is_vectorspace V"
  11.282 -  have "a \<cdot> 0 = a \<cdot> (0 - (0::'a))" by (simp!)
  11.283 +  have "a \<cdot> 0 = a \<cdot> (0 - (0::'a))" by simp
  11.284    also have "... =  a \<cdot> 0 - a \<cdot> 0"
  11.285 -     by (rule vs_diff_mult_distrib1) (simp!)+
  11.286 -  also have "... = 0" by (simp!)
  11.287 +    by (rule diff_mult_distrib1) simp_all
  11.288 +  also have "... = 0" by simp
  11.289    finally show ?thesis .
  11.290  qed
  11.291  
  11.292 -lemma vs_minus_mult_cancel [simp]:
  11.293 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> (- a) \<cdot> - x = a \<cdot> x"
  11.294 -  by (simp add: negate_eq1)
  11.295 +lemma (in vectorspace) minus_mult_cancel [simp]:
  11.296 +    "x \<in> V \<Longrightarrow> (- a) \<cdot> - x = a \<cdot> x"
  11.297 +  by (simp add: negate_eq1 mult_assoc2)
  11.298  
  11.299 -lemma vs_add_minus_left_eq_diff:
  11.300 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> - x + y = y - x"
  11.301 +lemma (in vectorspace) add_minus_left_eq_diff:
  11.302 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> - x + y = y - x"
  11.303  proof -
  11.304 -  assume "is_vectorspace V"  "x \<in> V"  "y \<in> V"
  11.305 -  hence "- x + y = y + - x"
  11.306 -    by (simp add: vs_add_commute)
  11.307 -  also have "... = y - x" by (simp! add: diff_eq1)
  11.308 +  assume xy: "x \<in> V"  "y \<in> V"
  11.309 +  hence "- x + y = y + - x" by (simp add: add_commute)
  11.310 +  also from xy have "... = y - x" by (simp add: diff_eq1)
  11.311    finally show ?thesis .
  11.312  qed
  11.313  
  11.314 -lemma vs_add_minus [simp]:
  11.315 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> x + - x = 0"
  11.316 -  by (simp! add: diff_eq2)
  11.317 +lemma (in vectorspace) add_minus [simp]:
  11.318 +    "x \<in> V \<Longrightarrow> x + - x = 0"
  11.319 +  by (simp add: diff_eq2)
  11.320  
  11.321 -lemma vs_add_minus_left [simp]:
  11.322 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> - x + x = 0"
  11.323 -  by (simp! add: diff_eq2)
  11.324 +lemma (in vectorspace) add_minus_left [simp]:
  11.325 +    "x \<in> V \<Longrightarrow> - x + x = 0"
  11.326 +  by (simp add: diff_eq2 add_commute)
  11.327  
  11.328 -lemma vs_minus_minus [simp]:
  11.329 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> - (- x) = x"
  11.330 +lemma (in vectorspace) minus_minus [simp]:
  11.331 +    "x \<in> V \<Longrightarrow> - (- x) = x"
  11.332 +  by (simp add: negate_eq1 mult_assoc2)
  11.333 +
  11.334 +lemma (in vectorspace) minus_zero [simp]:
  11.335 +    "- (0::'a) = 0"
  11.336    by (simp add: negate_eq1)
  11.337  
  11.338 -lemma vs_minus_zero [simp]:
  11.339 -  "is_vectorspace (V::'a::{plus, minus, zero} set) \<Longrightarrow> - (0::'a) = 0"
  11.340 -  by (simp add: negate_eq1)
  11.341 -
  11.342 -lemma vs_minus_zero_iff [simp]:
  11.343 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> (- x = 0) = (x = 0)"
  11.344 -  (concl is "?L = ?R")
  11.345 -proof -
  11.346 -  assume "is_vectorspace V"  "x \<in> V"
  11.347 -  show "?L = ?R"
  11.348 -  proof
  11.349 -    have "x = - (- x)" by (simp! add: vs_minus_minus)
  11.350 -    also assume ?L
  11.351 -    also have "- ... = 0" by (rule vs_minus_zero)
  11.352 -    finally show ?R .
  11.353 -  qed (simp!)
  11.354 +lemma (in vectorspace) minus_zero_iff [simp]:
  11.355 +  "x \<in> V \<Longrightarrow> (- x = 0) = (x = 0)"
  11.356 +proof
  11.357 +  assume x: "x \<in> V"
  11.358 +  {
  11.359 +    from x have "x = - (- x)" by (simp add: minus_minus)
  11.360 +    also assume "- x = 0"
  11.361 +    also have "- ... = 0" by (rule minus_zero)
  11.362 +    finally show "x = 0" .
  11.363 +  next
  11.364 +    assume "x = 0"
  11.365 +    then show "- x = 0" by simp
  11.366 +  }
  11.367  qed
  11.368  
  11.369 -lemma vs_add_minus_cancel [simp]:
  11.370 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + (- x + y) = y"
  11.371 -  by (simp add: vs_add_assoc [symmetric] del: vs_add_commute)
  11.372 +lemma (in vectorspace) add_minus_cancel [simp]:
  11.373 +    "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + (- x + y) = y"
  11.374 +  by (simp add: add_assoc [symmetric] del: add_commute)
  11.375  
  11.376 -lemma vs_minus_add_cancel [simp]:
  11.377 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> - x + (x + y) = y"
  11.378 -  by (simp add: vs_add_assoc [symmetric] del: vs_add_commute)
  11.379 +lemma (in vectorspace) minus_add_cancel [simp]:
  11.380 +    "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> - x + (x + y) = y"
  11.381 +  by (simp add: add_assoc [symmetric] del: add_commute)
  11.382  
  11.383 -lemma vs_minus_add_distrib [simp]:
  11.384 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V
  11.385 -  \<Longrightarrow> - (x + y) = - x + - y"
  11.386 -  by (simp add: negate_eq1 vs_add_mult_distrib1)
  11.387 +lemma (in vectorspace) minus_add_distrib [simp]:
  11.388 +    "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> - (x + y) = - x + - y"
  11.389 +  by (simp add: negate_eq1 add_mult_distrib1)
  11.390  
  11.391 -lemma vs_diff_zero [simp]:
  11.392 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> x - 0 = x"
  11.393 +lemma (in vectorspace) diff_zero [simp]:
  11.394 +    "x \<in> V \<Longrightarrow> x - 0 = x"
  11.395 +  by (simp add: diff_eq1)
  11.396 +
  11.397 +lemma (in vectorspace) diff_zero_right [simp]:
  11.398 +    "x \<in> V \<Longrightarrow> 0 - x = - x"
  11.399    by (simp add: diff_eq1)
  11.400  
  11.401 -lemma vs_diff_zero_right [simp]:
  11.402 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> 0 - x = - x"
  11.403 -  by (simp add:diff_eq1)
  11.404 -
  11.405 -lemma vs_add_left_cancel:
  11.406 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V
  11.407 -   \<Longrightarrow> (x + y = x + z) = (y = z)"
  11.408 -  (concl is "?L = ?R")
  11.409 +lemma (in vectorspace) add_left_cancel:
  11.410 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> (x + y = x + z) = (y = z)"
  11.411  proof
  11.412 -  assume "is_vectorspace V"  "x \<in> V"  "y \<in> V"  "z \<in> V"
  11.413 -  have "y = 0 + y" by (simp!)
  11.414 -  also have "... = - x + x + y" by (simp!)
  11.415 -  also have "... = - x + (x + y)"
  11.416 -    by (simp! only: vs_add_assoc vs_neg_closed)
  11.417 -  also assume "x + y = x + z"
  11.418 -  also have "- x + (x + z) = - x + x + z"
  11.419 -    by (simp! only: vs_add_assoc [symmetric] vs_neg_closed)
  11.420 -  also have "... = z" by (simp!)
  11.421 -  finally show ?R .
  11.422 -qed blast
  11.423 +  assume x: "x \<in> V" and y: "y \<in> V" and z: "z \<in> V"
  11.424 +  {
  11.425 +    from y have "y = 0 + y" by simp
  11.426 +    also from x y have "... = (- x + x) + y" by simp
  11.427 +    also from x y have "... = - x + (x + y)"
  11.428 +      by (simp add: add_assoc neg_closed)
  11.429 +    also assume "x + y = x + z"
  11.430 +    also from x z have "- x + (x + z) = - x + x + z"
  11.431 +      by (simp add: add_assoc [symmetric] neg_closed)
  11.432 +    also from x z have "... = z" by simp
  11.433 +    finally show "y = z" .
  11.434 +  next
  11.435 +    assume "y = z"
  11.436 +    then show "x + y = x + z" by (simp only:)
  11.437 +  }
  11.438 +qed
  11.439  
  11.440 -lemma vs_add_right_cancel:
  11.441 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V
  11.442 -  \<Longrightarrow> (y + x = z + x) = (y = z)"
  11.443 -  by (simp only: vs_add_commute vs_add_left_cancel)
  11.444 +lemma (in vectorspace) add_right_cancel:
  11.445 +    "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> (y + x = z + x) = (y = z)"
  11.446 +  by (simp only: add_commute add_left_cancel)
  11.447  
  11.448 -lemma vs_add_assoc_cong:
  11.449 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x' \<in> V \<Longrightarrow> y' \<in> V \<Longrightarrow> z \<in> V
  11.450 -  \<Longrightarrow> x + y = x' + y' \<Longrightarrow> x + (y + z) = x' + (y' + z)"
  11.451 -  by (simp only: vs_add_assoc [symmetric])
  11.452 +lemma (in vectorspace) add_assoc_cong:
  11.453 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x' \<in> V \<Longrightarrow> y' \<in> V \<Longrightarrow> z \<in> V
  11.454 +    \<Longrightarrow> x + y = x' + y' \<Longrightarrow> x + (y + z) = x' + (y' + z)"
  11.455 +  by (simp only: add_assoc [symmetric])
  11.456  
  11.457 -lemma vs_mult_left_commute:
  11.458 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V
  11.459 -  \<Longrightarrow> x \<cdot> y \<cdot> z = y \<cdot> x \<cdot> z"
  11.460 -  by (simp add: real_mult_commute)
  11.461 +lemma (in vectorspace) mult_left_commute:
  11.462 +    "x \<in> V \<Longrightarrow> a \<cdot> b \<cdot> x = b \<cdot> a \<cdot> x"
  11.463 +  by (simp add: real_mult_commute mult_assoc2)
  11.464  
  11.465 -lemma vs_mult_zero_uniq:
  11.466 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> a \<cdot> x = 0 \<Longrightarrow> a = 0"
  11.467 +lemma (in vectorspace) mult_zero_uniq:
  11.468 +  "x \<in> V \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> a \<cdot> x = 0 \<Longrightarrow> a = 0"
  11.469  proof (rule classical)
  11.470 -  assume "is_vectorspace V"  "x \<in> V"  "a \<cdot> x = 0"  "x \<noteq> 0"
  11.471 -  assume "a \<noteq> 0"
  11.472 -  have "x = (inverse a * a) \<cdot> x" by (simp!)
  11.473 -  also have "... = inverse a \<cdot> (a \<cdot> x)" by (rule vs_mult_assoc)
  11.474 -  also have "... = inverse a \<cdot> 0" by (simp!)
  11.475 -  also have "... = 0" by (simp!)
  11.476 +  assume a: "a \<noteq> 0"
  11.477 +  assume x: "x \<in> V"  "x \<noteq> 0" and ax: "a \<cdot> x = 0"
  11.478 +  from x a have "x = (inverse a * a) \<cdot> x" by simp
  11.479 +  also have "... = inverse a \<cdot> (a \<cdot> x)" by (rule mult_assoc)
  11.480 +  also from ax have "... = inverse a \<cdot> 0" by simp
  11.481 +  also have "... = 0" by simp
  11.482    finally have "x = 0" .
  11.483    thus "a = 0" by contradiction
  11.484  qed
  11.485  
  11.486 -lemma vs_mult_left_cancel:
  11.487 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> a \<noteq> 0 \<Longrightarrow>
  11.488 -  (a \<cdot> x = a \<cdot> y) = (x = y)"
  11.489 -  (concl is "?L = ?R")
  11.490 +lemma (in vectorspace) mult_left_cancel:
  11.491 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> a \<noteq> 0 \<Longrightarrow> (a \<cdot> x = a \<cdot> y) = (x = y)"
  11.492  proof
  11.493 -  assume "is_vectorspace V"  "x \<in> V"  "y \<in> V"  "a \<noteq> 0"
  11.494 -  have "x = 1 \<cdot> x" by (simp!)
  11.495 -  also have "... = (inverse a * a) \<cdot> x" by (simp!)
  11.496 -  also have "... = inverse a \<cdot> (a \<cdot> x)"
  11.497 -    by (simp! only: vs_mult_assoc)
  11.498 -  also assume ?L
  11.499 -  also have "inverse a \<cdot> ... = y" by (simp!)
  11.500 -  finally show ?R .
  11.501 -qed simp
  11.502 +  assume x: "x \<in> V" and y: "y \<in> V" and a: "a \<noteq> 0"
  11.503 +  from x have "x = 1 \<cdot> x" by simp
  11.504 +  also from a have "... = (inverse a * a) \<cdot> x" by simp
  11.505 +  also from x have "... = inverse a \<cdot> (a \<cdot> x)"
  11.506 +    by (simp only: mult_assoc)
  11.507 +  also assume "a \<cdot> x = a \<cdot> y"
  11.508 +  also from a y have "inverse a \<cdot> ... = y"
  11.509 +    by (simp add: mult_assoc2)
  11.510 +  finally show "x = y" .
  11.511 +next
  11.512 +  assume "x = y"
  11.513 +  then show "a \<cdot> x = a \<cdot> y" by (simp only:)
  11.514 +qed
  11.515  
  11.516 -lemma vs_mult_right_cancel: (*** forward ***)
  11.517 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> x \<noteq> 0
  11.518 -  \<Longrightarrow> (a \<cdot> x = b \<cdot> x) = (a = b)" (concl is "?L = ?R")
  11.519 +lemma (in vectorspace) mult_right_cancel:
  11.520 +  "x \<in> V \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> (a \<cdot> x = b \<cdot> x) = (a = b)"
  11.521  proof
  11.522 -  assume v: "is_vectorspace V"  "x \<in> V"  "x \<noteq> 0"
  11.523 -  have "(a - b) \<cdot> x = a \<cdot> x - b \<cdot> x"
  11.524 -    by (simp! add: vs_diff_mult_distrib2)
  11.525 -  also assume ?L hence "a \<cdot> x - b \<cdot> x = 0" by (simp!)
  11.526 -  finally have "(a - b) \<cdot> x = 0" .
  11.527 -  from v this have "a - b = 0" by (rule vs_mult_zero_uniq)
  11.528 -  thus "a = b" by simp
  11.529 -qed simp
  11.530 +  assume x: "x \<in> V" and neq: "x \<noteq> 0"
  11.531 +  {
  11.532 +    from x have "(a - b) \<cdot> x = a \<cdot> x - b \<cdot> x"
  11.533 +      by (simp add: diff_mult_distrib2)
  11.534 +    also assume "a \<cdot> x = b \<cdot> x"
  11.535 +    with x have "a \<cdot> x - b \<cdot> x = 0" by simp
  11.536 +    finally have "(a - b) \<cdot> x = 0" .
  11.537 +    with x neq have "a - b = 0" by (rule mult_zero_uniq)
  11.538 +    thus "a = b" by simp
  11.539 +  next
  11.540 +    assume "a = b"
  11.541 +    then show "a \<cdot> x = b \<cdot> x" by (simp only:)
  11.542 +  }
  11.543 +qed
  11.544  
  11.545 -lemma vs_eq_diff_eq:
  11.546 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow>
  11.547 -  (x = z - y) = (x + y = z)"
  11.548 -  (concl is "?L = ?R" )
  11.549 -proof -
  11.550 -  assume vs: "is_vectorspace V"  "x \<in> V"  "y \<in> V"  "z \<in> V"
  11.551 -  show "?L = ?R"
  11.552 -  proof
  11.553 -    assume ?L
  11.554 +lemma (in vectorspace) eq_diff_eq:
  11.555 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> (x = z - y) = (x + y = z)"
  11.556 +proof
  11.557 +  assume x: "x \<in> V" and y: "y \<in> V" and z: "z \<in> V"
  11.558 +  {
  11.559 +    assume "x = z - y"
  11.560      hence "x + y = z - y + y" by simp
  11.561 -    also have "... = z + - y + y" by (simp! add: diff_eq1)
  11.562 +    also from y z have "... = z + - y + y"
  11.563 +      by (simp add: diff_eq1)
  11.564      also have "... = z + (- y + y)"
  11.565 -      by (rule vs_add_assoc) (simp!)+
  11.566 -    also from vs have "... = z + 0"
  11.567 -      by (simp only: vs_add_minus_left)
  11.568 -    also from vs have "... = z" by (simp only: vs_add_zero_right)
  11.569 -    finally show ?R .
  11.570 +      by (rule add_assoc) (simp_all add: y z)
  11.571 +    also from y z have "... = z + 0"
  11.572 +      by (simp only: add_minus_left)
  11.573 +    also from z have "... = z"
  11.574 +      by (simp only: add_zero_right)
  11.575 +    finally show "x + y = z" .
  11.576    next
  11.577 -    assume ?R
  11.578 +    assume "x + y = z"
  11.579      hence "z - y = (x + y) - y" by simp
  11.580 -    also from vs have "... = x + y + - y"
  11.581 +    also from x y have "... = x + y + - y"
  11.582        by (simp add: diff_eq1)
  11.583      also have "... = x + (y + - y)"
  11.584 -      by (rule vs_add_assoc) (simp!)+
  11.585 -    also have "... = x" by (simp!)
  11.586 -    finally show ?L by (rule sym)
  11.587 -  qed
  11.588 +      by (rule add_assoc) (simp_all add: x y)
  11.589 +    also from x y have "... = x" by simp
  11.590 +    finally show "x = z - y" ..
  11.591 +  }
  11.592  qed
  11.593  
  11.594 -lemma vs_add_minus_eq_minus:
  11.595 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + y = 0 \<Longrightarrow> x = - y"
  11.596 +lemma (in vectorspace) add_minus_eq_minus:
  11.597 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x + y = 0 \<Longrightarrow> x = - y"
  11.598  proof -
  11.599 -  assume "is_vectorspace V"  "x \<in> V"  "y \<in> V"
  11.600 -  have "x = (- y + y) + x" by (simp!)
  11.601 -  also have "... = - y + (x + y)" by (simp!)
  11.602 +  assume x: "x \<in> V" and y: "y \<in> V"
  11.603 +  from x y have "x = (- y + y) + x" by simp
  11.604 +  also from x y have "... = - y + (x + y)" by (simp add: add_ac)
  11.605    also assume "x + y = 0"
  11.606 -  also have "- y + 0 = - y" by (simp!)
  11.607 +  also from y have "- y + 0 = - y" by simp
  11.608    finally show "x = - y" .
  11.609  qed
  11.610  
  11.611 -lemma vs_add_minus_eq:
  11.612 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x - y = 0 \<Longrightarrow> x = y"
  11.613 +lemma (in vectorspace) add_minus_eq:
  11.614 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> x - y = 0 \<Longrightarrow> x = y"
  11.615  proof -
  11.616 -  assume "is_vectorspace V"  "x \<in> V"  "y \<in> V"  "x - y = 0"
  11.617 +  assume x: "x \<in> V" and y: "y \<in> V"
  11.618    assume "x - y = 0"
  11.619 -  hence e: "x + - y = 0" by (simp! add: diff_eq1)
  11.620 -  with _ _ _ have "x = - (- y)"
  11.621 -    by (rule vs_add_minus_eq_minus) (simp!)+
  11.622 -  thus "x = y" by (simp!)
  11.623 +  with x y have eq: "x + - y = 0" by (simp add: diff_eq1)
  11.624 +  with _ _ have "x = - (- y)"
  11.625 +    by (rule add_minus_eq_minus) (simp_all add: x y)
  11.626 +  with x y show "x = y" by simp
  11.627  qed
  11.628  
  11.629 -lemma vs_add_diff_swap:
  11.630 -  "is_vectorspace V \<Longrightarrow> a \<in> V \<Longrightarrow> b \<in> V \<Longrightarrow> c \<in> V \<Longrightarrow> d \<in> V \<Longrightarrow> a + b = c + d
  11.631 -  \<Longrightarrow> a - c = d - b"
  11.632 +lemma (in vectorspace) add_diff_swap:
  11.633 +  "a \<in> V \<Longrightarrow> b \<in> V \<Longrightarrow> c \<in> V \<Longrightarrow> d \<in> V \<Longrightarrow> a + b = c + d
  11.634 +    \<Longrightarrow> a - c = d - b"
  11.635  proof -
  11.636 -  assume vs: "is_vectorspace V"  "a \<in> V"  "b \<in> V"  "c \<in> V"  "d \<in> V"
  11.637 +  assume vs: "a \<in> V"  "b \<in> V"  "c \<in> V"  "d \<in> V"
  11.638      and eq: "a + b = c + d"
  11.639 -  have "- c + (a + b) = - c + (c + d)"
  11.640 -    by (simp! add: vs_add_left_cancel)
  11.641 -  also have "... = d" by (rule vs_minus_add_cancel)
  11.642 +  then have "- c + (a + b) = - c + (c + d)"
  11.643 +    by (simp add: add_left_cancel)
  11.644 +  also have "... = d" by (rule minus_add_cancel)
  11.645    finally have eq: "- c + (a + b) = d" .
  11.646    from vs have "a - c = (- c + (a + b)) + - b"
  11.647 -    by (simp add: vs_add_ac diff_eq1)
  11.648 -  also from eq have "...  = d + - b"
  11.649 -    by (simp! add: vs_add_right_cancel)
  11.650 -  also have "... = d - b" by (simp! add: diff_eq2)
  11.651 +    by (simp add: add_ac diff_eq1)
  11.652 +  also from vs eq have "...  = d + - b"
  11.653 +    by (simp add: add_right_cancel)
  11.654 +  also from vs have "... = d - b" by (simp add: diff_eq2)
  11.655    finally show "a - c = d - b" .
  11.656  qed
  11.657  
  11.658 -lemma vs_add_cancel_21:
  11.659 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> u \<in> V
  11.660 -  \<Longrightarrow> (x + (y + z) = y + u) = ((x + z) = u)"
  11.661 -  (concl is "?L = ?R")
  11.662 -proof -
  11.663 -  assume "is_vectorspace V"  "x \<in> V"  "y \<in> V"  "z \<in> V"  "u \<in> V"
  11.664 -  show "?L = ?R"
  11.665 -  proof
  11.666 -    have "x + z = - y + y + (x + z)" by (simp!)
  11.667 +lemma (in vectorspace) vs_add_cancel_21:
  11.668 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> u \<in> V
  11.669 +    \<Longrightarrow> (x + (y + z) = y + u) = (x + z = u)"
  11.670 +proof
  11.671 +  assume vs: "x \<in> V"  "y \<in> V"  "z \<in> V"  "u \<in> V"
  11.672 +  {
  11.673 +    from vs have "x + z = - y + y + (x + z)" by simp
  11.674      also have "... = - y + (y + (x + z))"
  11.675 -      by (rule vs_add_assoc) (simp!)+
  11.676 -    also have "y + (x + z) = x + (y + z)" by (simp!)
  11.677 -    also assume ?L
  11.678 -    also have "- y + (y + u) = u" by (simp!)
  11.679 -    finally show ?R .
  11.680 -  qed (simp! only: vs_add_left_commute [of V x])
  11.681 +      by (rule add_assoc) (simp_all add: vs)
  11.682 +    also from vs have "y + (x + z) = x + (y + z)"
  11.683 +      by (simp add: add_ac)
  11.684 +    also assume "x + (y + z) = y + u"
  11.685 +    also from vs have "- y + (y + u) = u" by simp
  11.686 +    finally show "x + z = u" .
  11.687 +  next
  11.688 +    assume "x + z = u"
  11.689 +    with vs show "x + (y + z) = y + u"
  11.690 +      by (simp only: add_left_commute [of x])
  11.691 +  }
  11.692  qed
  11.693  
  11.694 -lemma vs_add_cancel_end:
  11.695 -  "is_vectorspace V \<Longrightarrow> x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V
  11.696 -  \<Longrightarrow> (x + (y + z) = y) = (x = - z)"
  11.697 -  (concl is "?L = ?R" )
  11.698 -proof -
  11.699 -  assume "is_vectorspace V"  "x \<in> V"  "y \<in> V"  "z \<in> V"
  11.700 -  show "?L = ?R"
  11.701 -  proof
  11.702 -    assume l: ?L
  11.703 -    have "x + z = 0"
  11.704 -    proof (rule vs_add_left_cancel [THEN iffD1])
  11.705 -      have "y + (x + z) = x + (y + z)" by (simp!)
  11.706 -      also note l
  11.707 -      also have "y = y + 0" by (simp!)
  11.708 -      finally show "y + (x + z) = y + 0" .
  11.709 -    qed (simp!)+
  11.710 -    thus "x = - z" by (simp! add: vs_add_minus_eq_minus)
  11.711 +lemma (in vectorspace) add_cancel_end:
  11.712 +  "x \<in> V \<Longrightarrow> y \<in> V \<Longrightarrow> z \<in> V \<Longrightarrow> (x + (y + z) = y) = (x = - z)"
  11.713 +proof
  11.714 +  assume vs: "x \<in> V"  "y \<in> V"  "z \<in> V"
  11.715 +  {
  11.716 +    assume "x + (y + z) = y"
  11.717 +    with vs have "(x + z) + y = 0 + y"
  11.718 +      by (simp add: add_ac)
  11.719 +    with vs have "x + z = 0"
  11.720 +      by (simp only: add_right_cancel add_closed zero)
  11.721 +    with vs show "x = - z" by (simp add: add_minus_eq_minus)
  11.722    next
  11.723 -    assume r: ?R
  11.724 +    assume eq: "x = - z"
  11.725      hence "x + (y + z) = - z + (y + z)" by simp
  11.726      also have "... = y + (- z + z)"
  11.727 -      by (simp! only: vs_add_left_commute)
  11.728 -    also have "... = y"  by (simp!)
  11.729 -    finally show ?L .
  11.730 -  qed
  11.731 +      by (rule add_left_commute) (simp_all add: vs)
  11.732 +    also from vs have "... = y"  by simp
  11.733 +    finally show "x + (y + z) = y" .
  11.734 +  }
  11.735  qed
  11.736  
  11.737  end
    12.1 --- a/src/HOL/Real/HahnBanach/ZornLemma.thy	Thu Aug 22 12:28:41 2002 +0200
    12.2 +++ b/src/HOL/Real/HahnBanach/ZornLemma.thy	Thu Aug 22 20:49:43 2002 +0200
    12.3 @@ -19,23 +19,22 @@
    12.4  *}
    12.5  
    12.6  theorem Zorn's_Lemma:
    12.7 -  "(\<And>c. c \<in> chain S \<Longrightarrow> \<exists>x. x \<in> c \<Longrightarrow> \<Union>c \<in> S) \<Longrightarrow> a \<in> S
    12.8 -  \<Longrightarrow> \<exists>y \<in> S. \<forall>z \<in> S. y \<subseteq> z \<longrightarrow> y = z"
    12.9 +  assumes r: "\<And>c. c \<in> chain S \<Longrightarrow> \<exists>x. x \<in> c \<Longrightarrow> \<Union>c \<in> S"
   12.10 +    and aS: "a \<in> S"
   12.11 +  shows "\<exists>y \<in> S. \<forall>z \<in> S. y \<subseteq> z \<longrightarrow> y = z"
   12.12  proof (rule Zorn_Lemma2)
   12.13    txt_raw {* \footnote{See
   12.14    \url{http://isabelle.in.tum.de/library/HOL/HOL-Real/Zorn.html}} \isanewline *}
   12.15 -  assume r: "\<And>c. c \<in> chain S \<Longrightarrow> \<exists>x. x \<in> c \<Longrightarrow> \<Union>c \<in> S"
   12.16 -  assume aS: "a \<in> S"
   12.17    show "\<forall>c \<in> chain S. \<exists>y \<in> S. \<forall>z \<in> c. z \<subseteq> y"
   12.18    proof
   12.19      fix c assume "c \<in> chain S"
   12.20      show "\<exists>y \<in> S. \<forall>z \<in> c. z \<subseteq> y"
   12.21      proof cases
   12.22 - 
   12.23 +
   12.24        txt {* If @{text c} is an empty chain, then every element in
   12.25        @{text S} is an upper bound of @{text c}. *}
   12.26  
   12.27 -      assume "c = {}" 
   12.28 +      assume "c = {}"
   12.29        with aS show ?thesis by fast
   12.30  
   12.31        txt {* If @{text c} is non-empty, then @{text "\<Union>c"} is an upper
   12.32 @@ -43,12 +42,12 @@
   12.33  
   12.34      next
   12.35        assume c: "c \<noteq> {}"
   12.36 -      show ?thesis 
   12.37 -      proof 
   12.38 +      show ?thesis
   12.39 +      proof
   12.40          show "\<forall>z \<in> c. z \<subseteq> \<Union>c" by fast
   12.41 -        show "\<Union>c \<in> S" 
   12.42 +        show "\<Union>c \<in> S"
   12.43          proof (rule r)
   12.44 -          from c show "\<exists>x. x \<in> c" by fast  
   12.45 +          from c show "\<exists>x. x \<in> c" by fast
   12.46          qed
   12.47        qed
   12.48      qed