src/HOL/Hahn_Banach/Hahn_Banach.thy
author wenzelm
Sat Nov 04 15:24:40 2017 +0100 (20 months ago)
changeset 67003 49850a679c2c
parent 65166 f8aafbf2b02e
permissions -rw-r--r--
more robust sorted_entries;
wenzelm@31795
     1
(*  Title:      HOL/Hahn_Banach/Hahn_Banach.thy
bauerg@9374
     2
    Author:     Gertrud Bauer, TU Munich
bauerg@9374
     3
*)
bauerg@9374
     4
wenzelm@58889
     5
section \<open>The Hahn-Banach Theorem\<close>
bauerg@9374
     6
wenzelm@31795
     7
theory Hahn_Banach
wenzelm@31795
     8
imports Hahn_Banach_Lemmas
wenzelm@27612
     9
begin
bauerg@9374
    10
wenzelm@58744
    11
text \<open>
wenzelm@61540
    12
  We present the proof of two different versions of the Hahn-Banach Theorem,
wenzelm@61540
    13
  closely following @{cite \<open>\S36\<close> "Heuser:1986"}.
wenzelm@58744
    14
\<close>
bauerg@9374
    15
wenzelm@61540
    16
wenzelm@58744
    17
subsection \<open>The Hahn-Banach Theorem for vector spaces\<close>
bauerg@9374
    18
wenzelm@61486
    19
paragraph \<open>Hahn-Banach Theorem.\<close>
wenzelm@58744
    20
text \<open>
wenzelm@61879
    21
  Let \<open>F\<close> be a subspace of a real vector space \<open>E\<close>, let \<open>p\<close> be a semi-norm on
wenzelm@61879
    22
  \<open>E\<close>, and \<open>f\<close> be a linear form defined on \<open>F\<close> such that \<open>f\<close> is bounded by
wenzelm@61879
    23
  \<open>p\<close>, i.e. \<open>\<forall>x \<in> F. f x \<le> p x\<close>. Then \<open>f\<close> can be extended to a linear form \<open>h\<close>
wenzelm@61879
    24
  on \<open>E\<close> such that \<open>h\<close> is norm-preserving, i.e. \<open>h\<close> is also bounded by \<open>p\<close>.
wenzelm@61543
    25
\<close>
wenzelm@10687
    26
wenzelm@61486
    27
paragraph \<open>Proof Sketch.\<close>
wenzelm@61486
    28
text \<open>
wenzelm@61879
    29
  \<^enum> Define \<open>M\<close> as the set of norm-preserving extensions of \<open>f\<close> to subspaces of
wenzelm@61879
    30
  \<open>E\<close>. The linear forms in \<open>M\<close> are ordered by domain extension.
bauerg@9374
    31
wenzelm@61540
    32
  \<^enum> We show that every non-empty chain in \<open>M\<close> has an upper bound in \<open>M\<close>.
wenzelm@10687
    33
wenzelm@61879
    34
  \<^enum> With Zorn's Lemma we conclude that there is a maximal function \<open>g\<close> in \<open>M\<close>.
wenzelm@10687
    35
wenzelm@61540
    36
  \<^enum> The domain \<open>H\<close> of \<open>g\<close> is the whole space \<open>E\<close>, as shown by classical
wenzelm@61540
    37
  contradiction:
wenzelm@10687
    38
wenzelm@61879
    39
    \<^item> Assuming \<open>g\<close> is not defined on whole \<open>E\<close>, it can still be extended in a
wenzelm@61879
    40
    norm-preserving way to a super-space \<open>H'\<close> of \<open>H\<close>.
wenzelm@10687
    41
wenzelm@61539
    42
    \<^item> Thus \<open>g\<close> can not be maximal. Contradiction!
wenzelm@58744
    43
\<close>
bauerg@9374
    44
wenzelm@31795
    45
theorem Hahn_Banach:
ballarin@27611
    46
  assumes E: "vectorspace E" and "subspace F E"
ballarin@27611
    47
    and "seminorm E p" and "linearform F f"
wenzelm@13515
    48
  assumes fp: "\<forall>x \<in> F. f x \<le> p x"
wenzelm@13515
    49
  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)"
wenzelm@61583
    50
    \<comment> \<open>Let \<open>E\<close> be a vector space, \<open>F\<close> a subspace of \<open>E\<close>, \<open>p\<close> a seminorm on \<open>E\<close>,\<close>
wenzelm@61583
    51
    \<comment> \<open>and \<open>f\<close> a linear form on \<open>F\<close> such that \<open>f\<close> is bounded by \<open>p\<close>,\<close>
wenzelm@61583
    52
    \<comment> \<open>then \<open>f\<close> can be extended to a linear form \<open>h\<close> on \<open>E\<close> in a norm-preserving way. \<^smallskip>\<close>
wenzelm@9035
    53
proof -
ballarin@29234
    54
  interpret vectorspace E by fact
ballarin@29234
    55
  interpret subspace F E by fact
ballarin@29234
    56
  interpret seminorm E p by fact
ballarin@29234
    57
  interpret linearform F f by fact
wenzelm@63040
    58
  define M where "M = norm_pres_extensions E p F f"
wenzelm@27612
    59
  then have M: "M = \<dots>" by (simp only:)
ballarin@27611
    60
  from E have F: "vectorspace F" ..
wenzelm@58744
    61
  note FE = \<open>F \<unlhd> E\<close>
wenzelm@9035
    62
  {
popescua@52183
    63
    fix c assume cM: "c \<in> chains M" and ex: "\<exists>x. x \<in> c"
wenzelm@9503
    64
    have "\<Union>c \<in> M"
wenzelm@61583
    65
      \<comment> \<open>Show that every non-empty chain \<open>c\<close> of \<open>M\<close> has an upper bound in \<open>M\<close>:\<close>
wenzelm@61583
    66
      \<comment> \<open>\<open>\<Union>c\<close> is greater than any element of the chain \<open>c\<close>, so it suffices to show \<open>\<Union>c \<in> M\<close>.\<close>
wenzelm@27612
    67
      unfolding M_def
wenzelm@27612
    68
    proof (rule norm_pres_extensionI)
wenzelm@13515
    69
      let ?H = "domain (\<Union>c)"
wenzelm@13515
    70
      let ?h = "funct (\<Union>c)"
bauerg@8084
    71
wenzelm@13515
    72
      have a: "graph ?H ?h = \<Union>c"
wenzelm@13515
    73
      proof (rule graph_domain_funct)
wenzelm@13515
    74
        fix x y z assume "(x, y) \<in> \<Union>c" and "(x, z) \<in> \<Union>c"
wenzelm@13515
    75
        with M_def cM show "z = y" by (rule sup_definite)
wenzelm@9035
    76
      qed
wenzelm@13515
    77
      moreover from M cM a have "linearform ?H ?h"
wenzelm@13515
    78
        by (rule sup_lf)
wenzelm@23378
    79
      moreover from a M cM ex FE E have "?H \<unlhd> E"
wenzelm@13515
    80
        by (rule sup_subE)
wenzelm@23378
    81
      moreover from a M cM ex FE have "F \<unlhd> ?H"
wenzelm@13515
    82
        by (rule sup_supF)
wenzelm@13515
    83
      moreover from a M cM ex have "graph F f \<subseteq> graph ?H ?h"
wenzelm@13515
    84
        by (rule sup_ext)
wenzelm@13515
    85
      moreover from a M cM have "\<forall>x \<in> ?H. ?h x \<le> p x"
wenzelm@13515
    86
        by (rule sup_norm_pres)
wenzelm@13515
    87
      ultimately show "\<exists>H h. \<Union>c = graph H h
wenzelm@13515
    88
          \<and> linearform H h
wenzelm@13515
    89
          \<and> H \<unlhd> E
wenzelm@13515
    90
          \<and> F \<unlhd> H
wenzelm@13515
    91
          \<and> graph F f \<subseteq> graph H h
wenzelm@13515
    92
          \<and> (\<forall>x \<in> H. h x \<le> p x)" by blast
wenzelm@9035
    93
    qed
wenzelm@9035
    94
  }
popescua@52183
    95
  then have "\<exists>g \<in> M. \<forall>x \<in> M. g \<subseteq> x \<longrightarrow> x = g"
wenzelm@61583
    96
  \<comment> \<open>With Zorn's Lemma we can conclude that there is a maximal element in \<open>M\<close>. \<^smallskip>\<close>
wenzelm@9035
    97
  proof (rule Zorn's_Lemma)
wenzelm@61583
    98
      \<comment> \<open>We show that \<open>M\<close> is non-empty:\<close>
wenzelm@13515
    99
    show "graph F f \<in> M"
wenzelm@27612
   100
      unfolding M_def
wenzelm@27612
   101
    proof (rule norm_pres_extensionI2)
wenzelm@23378
   102
      show "linearform F f" by fact
wenzelm@23378
   103
      show "F \<unlhd> E" by fact
wenzelm@13515
   104
      from F show "F \<unlhd> F" by (rule vectorspace.subspace_refl)
wenzelm@13515
   105
      show "graph F f \<subseteq> graph F f" ..
wenzelm@23378
   106
      show "\<forall>x\<in>F. f x \<le> p x" by fact
wenzelm@13515
   107
    qed
wenzelm@9035
   108
  qed
wenzelm@23378
   109
  then obtain g where gM: "g \<in> M" and gx: "\<forall>x \<in> M. g \<subseteq> x \<longrightarrow> g = x"
wenzelm@13515
   110
    by blast
wenzelm@27612
   111
  from gM obtain H h where
wenzelm@13515
   112
      g_rep: "g = graph H h"
wenzelm@13515
   113
    and linearform: "linearform H h"
wenzelm@13515
   114
    and HE: "H \<unlhd> E" and FH: "F \<unlhd> H"
wenzelm@13515
   115
    and graphs: "graph F f \<subseteq> graph H h"
wenzelm@27612
   116
    and hp: "\<forall>x \<in> H. h x \<le> p x" unfolding M_def ..
wenzelm@61583
   117
      \<comment> \<open>\<open>g\<close> is a norm-preserving extension of \<open>f\<close>, in other words:\<close>
wenzelm@61583
   118
      \<comment> \<open>\<open>g\<close> is the graph of some linear form \<open>h\<close> defined on a subspace \<open>H\<close> of \<open>E\<close>,\<close>
wenzelm@61583
   119
      \<comment> \<open>and \<open>h\<close> is an extension of \<open>f\<close> that is again bounded by \<open>p\<close>. \<^smallskip>\<close>
wenzelm@23378
   120
  from HE E have H: "vectorspace H"
wenzelm@13547
   121
    by (rule subspace.vectorspace)
wenzelm@13515
   122
wenzelm@13515
   123
  have HE_eq: "H = E"
wenzelm@61583
   124
    \<comment> \<open>We show that \<open>h\<close> is defined on whole \<open>E\<close> by classical contradiction. \<^smallskip>\<close>
wenzelm@13515
   125
  proof (rule classical)
wenzelm@13515
   126
    assume neq: "H \<noteq> E"
wenzelm@61583
   127
      \<comment> \<open>Assume \<open>h\<close> is not defined on whole \<open>E\<close>. Then show that \<open>h\<close> can be extended\<close>
wenzelm@61583
   128
      \<comment> \<open>in a norm-preserving way to a function \<open>h'\<close> with the graph \<open>g'\<close>. \<^smallskip>\<close>
wenzelm@13515
   129
    have "\<exists>g' \<in> M. g \<subseteq> g' \<and> g \<noteq> g'"
wenzelm@13515
   130
    proof -
wenzelm@13515
   131
      from HE have "H \<subseteq> E" ..
wenzelm@13515
   132
      with neq obtain x' where x'E: "x' \<in> E" and "x' \<notin> H" by blast
wenzelm@13515
   133
      obtain x': "x' \<noteq> 0"
wenzelm@13515
   134
      proof
wenzelm@13515
   135
        show "x' \<noteq> 0"
wenzelm@13515
   136
        proof
wenzelm@13515
   137
          assume "x' = 0"
wenzelm@13515
   138
          with H have "x' \<in> H" by (simp only: vectorspace.zero)
wenzelm@58744
   139
          with \<open>x' \<notin> H\<close> show False by contradiction
wenzelm@9475
   140
        qed
wenzelm@13515
   141
      qed
wenzelm@13515
   142
wenzelm@63040
   143
      define H' where "H' = H + lin x'"
wenzelm@61583
   144
        \<comment> \<open>Define \<open>H'\<close> as the direct sum of \<open>H\<close> and the linear closure of \<open>x'\<close>. \<^smallskip>\<close>
wenzelm@13515
   145
      have HH': "H \<unlhd> H'"
wenzelm@13515
   146
      proof (unfold H'_def)
wenzelm@23378
   147
        from x'E have "vectorspace (lin x')" ..
krauss@47445
   148
        with H show "H \<unlhd> H + lin x'" ..
wenzelm@13515
   149
      qed
wenzelm@13515
   150
wenzelm@13515
   151
      obtain xi where
wenzelm@23378
   152
        xi: "\<forall>y \<in> H. - p (y + x') - h y \<le> xi
wenzelm@13515
   153
          \<and> xi \<le> p (y + x') - h y"
wenzelm@61583
   154
        \<comment> \<open>Pick a real number \<open>\<xi>\<close> that fulfills certain inequality; this will\<close>
wenzelm@61583
   155
        \<comment> \<open>be used to establish that \<open>h'\<close> is a norm-preserving extension of \<open>h\<close>.
wenzelm@61486
   156
           \label{ex-xi-use}\<^smallskip>\<close>
wenzelm@13515
   157
      proof -
wenzelm@13515
   158
        from H have "\<exists>xi. \<forall>y \<in> H. - p (y + x') - h y \<le> xi
wenzelm@13515
   159
            \<and> xi \<le> p (y + x') - h y"
wenzelm@13515
   160
        proof (rule ex_xi)
wenzelm@13515
   161
          fix u v assume u: "u \<in> H" and v: "v \<in> H"
wenzelm@13515
   162
          with HE have uE: "u \<in> E" and vE: "v \<in> E" by auto
wenzelm@13515
   163
          from H u v linearform have "h v - h u = h (v - u)"
wenzelm@13547
   164
            by (simp add: linearform.diff)
wenzelm@13515
   165
          also from hp and H u v have "\<dots> \<le> p (v - u)"
wenzelm@13515
   166
            by (simp only: vectorspace.diff_closed)
wenzelm@13515
   167
          also from x'E uE vE have "v - u = x' + - x' + v + - u"
wenzelm@13515
   168
            by (simp add: diff_eq1)
wenzelm@13515
   169
          also from x'E uE vE have "\<dots> = v + x' + - (u + x')"
wenzelm@13515
   170
            by (simp add: add_ac)
wenzelm@13515
   171
          also from x'E uE vE have "\<dots> = (v + x') - (u + x')"
wenzelm@13515
   172
            by (simp add: diff_eq1)
wenzelm@13547
   173
          also from x'E uE vE E have "p \<dots> \<le> p (v + x') + p (u + x')"
wenzelm@13515
   174
            by (simp add: diff_subadditive)
wenzelm@13515
   175
          finally have "h v - h u \<le> p (v + x') + p (u + x')" .
wenzelm@13547
   176
          then show "- p (u + x') - h u \<le> p (v + x') - h v" by simp
wenzelm@13515
   177
        qed
wenzelm@23378
   178
        then show thesis by (blast intro: that)
wenzelm@13515
   179
      qed
wenzelm@13515
   180
wenzelm@63040
   181
      define h' where "h' x = (let (y, a) =
wenzelm@63040
   182
          SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H in h y + a * xi)" for x
wenzelm@61583
   183
        \<comment> \<open>Define the extension \<open>h'\<close> of \<open>h\<close> to \<open>H'\<close> using \<open>\<xi>\<close>. \<^smallskip>\<close>
wenzelm@13515
   184
wenzelm@13515
   185
      have "g \<subseteq> graph H' h' \<and> g \<noteq> graph H' h'"
wenzelm@61583
   186
        \<comment> \<open>\<open>h'\<close> is an extension of \<open>h\<close> \dots \<^smallskip>\<close>
wenzelm@13515
   187
      proof
wenzelm@13515
   188
        show "g \<subseteq> graph H' h'"
wenzelm@9475
   189
        proof -
wenzelm@61800
   190
          have "graph H h \<subseteq> graph H' h'"
wenzelm@13515
   191
          proof (rule graph_extI)
wenzelm@13515
   192
            fix t assume t: "t \<in> H"
wenzelm@23378
   193
            from E HE t have "(SOME (y, a). t = y + a \<cdot> x' \<and> y \<in> H) = (t, 0)"
wenzelm@58744
   194
              using \<open>x' \<notin> H\<close> \<open>x' \<in> E\<close> \<open>x' \<noteq> 0\<close> by (rule decomp_H'_H)
wenzelm@13515
   195
            with h'_def show "h t = h' t" by (simp add: Let_def)
wenzelm@13515
   196
          next
wenzelm@13515
   197
            from HH' show "H \<subseteq> H'" ..
wenzelm@9475
   198
          qed
wenzelm@13515
   199
          with g_rep show ?thesis by (simp only:)
wenzelm@9475
   200
        qed
wenzelm@9475
   201
wenzelm@13515
   202
        show "g \<noteq> graph H' h'"
wenzelm@13515
   203
        proof -
wenzelm@13515
   204
          have "graph H h \<noteq> graph H' h'"
wenzelm@9475
   205
          proof
wenzelm@13515
   206
            assume eq: "graph H h = graph H' h'"
wenzelm@13515
   207
            have "x' \<in> H'"
wenzelm@32960
   208
              unfolding H'_def
wenzelm@27612
   209
            proof
wenzelm@13515
   210
              from H show "0 \<in> H" by (rule vectorspace.zero)
wenzelm@13515
   211
              from x'E show "x' \<in> lin x'" by (rule x_lin_x)
wenzelm@13515
   212
              from x'E show "x' = 0 + x'" by simp
bauerg@9261
   213
            qed
wenzelm@27612
   214
            then have "(x', h' x') \<in> graph H' h'" ..
wenzelm@13515
   215
            with eq have "(x', h' x') \<in> graph H h" by (simp only:)
wenzelm@27612
   216
            then have "x' \<in> H" ..
wenzelm@58744
   217
            with \<open>x' \<notin> H\<close> show False by contradiction
wenzelm@9035
   218
          qed
wenzelm@13515
   219
          with g_rep show ?thesis by simp
wenzelm@9035
   220
        qed
bauerg@9256
   221
      qed
wenzelm@13515
   222
      moreover have "graph H' h' \<in> M"
wenzelm@61583
   223
        \<comment> \<open>and \<open>h'\<close> is norm-preserving. \<^smallskip>\<close>
wenzelm@13515
   224
      proof (unfold M_def)
wenzelm@13515
   225
        show "graph H' h' \<in> norm_pres_extensions E p F f"
wenzelm@13515
   226
        proof (rule norm_pres_extensionI2)
wenzelm@23378
   227
          show "linearform H' h'"
wenzelm@58744
   228
            using h'_def H'_def HE linearform \<open>x' \<notin> H\<close> \<open>x' \<in> E\<close> \<open>x' \<noteq> 0\<close> E
wenzelm@32960
   229
            by (rule h'_lf)
wenzelm@13515
   230
          show "H' \<unlhd> E"
wenzelm@32960
   231
          unfolding H'_def
wenzelm@23378
   232
          proof
wenzelm@23378
   233
            show "H \<unlhd> E" by fact
wenzelm@23378
   234
            show "vectorspace E" by fact
wenzelm@13515
   235
            from x'E show "lin x' \<unlhd> E" ..
wenzelm@13515
   236
          qed
wenzelm@58744
   237
          from H \<open>F \<unlhd> H\<close> HH' show FH': "F \<unlhd> H'"
wenzelm@13515
   238
            by (rule vectorspace.subspace_trans)
wenzelm@13515
   239
          show "graph F f \<subseteq> graph H' h'"
wenzelm@13515
   240
          proof (rule graph_extI)
wenzelm@13515
   241
            fix x assume x: "x \<in> F"
wenzelm@13515
   242
            with graphs have "f x = h x" ..
wenzelm@13515
   243
            also have "\<dots> = h x + 0 * xi" by simp
wenzelm@13515
   244
            also have "\<dots> = (let (y, a) = (x, 0) in h y + a * xi)"
wenzelm@13515
   245
              by (simp add: Let_def)
wenzelm@13515
   246
            also have "(x, 0) =
wenzelm@13515
   247
                (SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H)"
wenzelm@32960
   248
              using E HE
wenzelm@13515
   249
            proof (rule decomp_H'_H [symmetric])
wenzelm@13515
   250
              from FH x show "x \<in> H" ..
wenzelm@13515
   251
              from x' show "x' \<noteq> 0" .
wenzelm@32960
   252
              show "x' \<notin> H" by fact
wenzelm@32960
   253
              show "x' \<in> E" by fact
wenzelm@13515
   254
            qed
wenzelm@13515
   255
            also have
wenzelm@13515
   256
              "(let (y, a) = (SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H)
wenzelm@13515
   257
              in h y + a * xi) = h' x" by (simp only: h'_def)
wenzelm@13515
   258
            finally show "f x = h' x" .
wenzelm@13515
   259
          next
wenzelm@13515
   260
            from FH' show "F \<subseteq> H'" ..
wenzelm@13515
   261
          qed
wenzelm@23378
   262
          show "\<forall>x \<in> H'. h' x \<le> p x"
wenzelm@58744
   263
            using h'_def H'_def \<open>x' \<notin> H\<close> \<open>x' \<in> E\<close> \<open>x' \<noteq> 0\<close> E HE
wenzelm@58744
   264
              \<open>seminorm E p\<close> linearform and hp xi
wenzelm@32960
   265
            by (rule h'_norm_pres)
wenzelm@13515
   266
        qed
wenzelm@13515
   267
      qed
wenzelm@13515
   268
      ultimately show ?thesis ..
wenzelm@9475
   269
    qed
wenzelm@27612
   270
    then have "\<not> (\<forall>x \<in> M. g \<subseteq> x \<longrightarrow> g = x)" by simp
wenzelm@61583
   271
      \<comment> \<open>So the graph \<open>g\<close> of \<open>h\<close> cannot be maximal. Contradiction! \<^smallskip>\<close>
wenzelm@23378
   272
    with gx show "H = E" by contradiction
wenzelm@9035
   273
  qed
wenzelm@13515
   274
wenzelm@13515
   275
  from HE_eq and linearform have "linearform E h"
wenzelm@13515
   276
    by (simp only:)
wenzelm@13515
   277
  moreover have "\<forall>x \<in> F. h x = f x"
wenzelm@13515
   278
  proof
wenzelm@13515
   279
    fix x assume "x \<in> F"
wenzelm@13515
   280
    with graphs have "f x = h x" ..
wenzelm@13515
   281
    then show "h x = f x" ..
wenzelm@13515
   282
  qed
wenzelm@13515
   283
  moreover from HE_eq and hp have "\<forall>x \<in> E. h x \<le> p x"
wenzelm@13515
   284
    by (simp only:)
wenzelm@13515
   285
  ultimately show ?thesis by blast
wenzelm@9475
   286
qed
bauerg@9374
   287
bauerg@9374
   288
wenzelm@59197
   289
subsection \<open>Alternative formulation\<close>
bauerg@9374
   290
wenzelm@58744
   291
text \<open>
wenzelm@10687
   292
  The following alternative formulation of the Hahn-Banach
wenzelm@61879
   293
  Theorem\label{abs-Hahn-Banach} uses the fact that for a real linear form \<open>f\<close>
wenzelm@61879
   294
  and a seminorm \<open>p\<close> the following inequality are equivalent:\footnote{This
wenzelm@61879
   295
  was shown in lemma @{thm [source] abs_ineq_iff} (see page
wenzelm@61879
   296
  \pageref{abs-ineq-iff}).}
wenzelm@10687
   297
  \begin{center}
wenzelm@10687
   298
  \begin{tabular}{lll}
wenzelm@61879
   299
  \<open>\<forall>x \<in> H. \<bar>h x\<bar> \<le> p x\<close> & and & \<open>\<forall>x \<in> H. h x \<le> p x\<close> \\
wenzelm@10687
   300
  \end{tabular}
wenzelm@10687
   301
  \end{center}
wenzelm@58744
   302
\<close>
bauerg@9374
   303
wenzelm@31795
   304
theorem abs_Hahn_Banach:
ballarin@27611
   305
  assumes E: "vectorspace E" and FE: "subspace F E"
ballarin@27611
   306
    and lf: "linearform F f" and sn: "seminorm E p"
wenzelm@13515
   307
  assumes fp: "\<forall>x \<in> F. \<bar>f x\<bar> \<le> p x"
wenzelm@13515
   308
  shows "\<exists>g. linearform E g
wenzelm@13515
   309
    \<and> (\<forall>x \<in> F. g x = f x)
wenzelm@10687
   310
    \<and> (\<forall>x \<in> E. \<bar>g x\<bar> \<le> p x)"
bauerg@9374
   311
proof -
ballarin@29234
   312
  interpret vectorspace E by fact
ballarin@29234
   313
  interpret subspace F E by fact
ballarin@29234
   314
  interpret linearform F f by fact
ballarin@29234
   315
  interpret seminorm E p by fact
wenzelm@27612
   316
  have "\<exists>g. linearform E g \<and> (\<forall>x \<in> F. g x = f x) \<and> (\<forall>x \<in> E. g x \<le> p x)"
wenzelm@27612
   317
    using E FE sn lf
wenzelm@31795
   318
  proof (rule Hahn_Banach)
wenzelm@13515
   319
    show "\<forall>x \<in> F. f x \<le> p x"
wenzelm@23378
   320
      using FE E sn lf and fp by (rule abs_ineq_iff [THEN iffD1])
wenzelm@13515
   321
  qed
wenzelm@23378
   322
  then obtain g where lg: "linearform E g" and *: "\<forall>x \<in> F. g x = f x"
wenzelm@23378
   323
      and **: "\<forall>x \<in> E. g x \<le> p x" by blast
wenzelm@13515
   324
  have "\<forall>x \<in> E. \<bar>g x\<bar> \<le> p x"
wenzelm@27612
   325
    using _ E sn lg **
wenzelm@13515
   326
  proof (rule abs_ineq_iff [THEN iffD2])
wenzelm@13515
   327
    show "E \<unlhd> E" ..
wenzelm@13515
   328
  qed
wenzelm@23378
   329
  with lg * show ?thesis by blast
wenzelm@9475
   330
qed
wenzelm@13515
   331
bauerg@9374
   332
wenzelm@58744
   333
subsection \<open>The Hahn-Banach Theorem for normed spaces\<close>
bauerg@9374
   334
wenzelm@58744
   335
text \<open>
wenzelm@61879
   336
  Every continuous linear form \<open>f\<close> on a subspace \<open>F\<close> of a norm space \<open>E\<close>, can
wenzelm@61879
   337
  be extended to a continuous linear form \<open>g\<close> on \<open>E\<close> such that \<open>\<parallel>f\<parallel> = \<parallel>g\<parallel>\<close>.
wenzelm@58744
   338
\<close>
bauerg@9374
   339
wenzelm@31795
   340
theorem norm_Hahn_Banach:
ballarin@27611
   341
  fixes V and norm ("\<parallel>_\<parallel>")
ballarin@27611
   342
  fixes B defines "\<And>V f. B V f \<equiv> {0} \<union> {\<bar>f x\<bar> / \<parallel>x\<parallel> | x. x \<noteq> 0 \<and> x \<in> V}"
ballarin@27611
   343
  fixes fn_norm ("\<parallel>_\<parallel>\<hyphen>_" [0, 1000] 999)
ballarin@27611
   344
  defines "\<And>V f. \<parallel>f\<parallel>\<hyphen>V \<equiv> \<Squnion>(B V f)"
ballarin@27611
   345
  assumes E_norm: "normed_vectorspace E norm" and FE: "subspace F E"
wenzelm@46867
   346
    and linearform: "linearform F f" and "continuous F f norm"
wenzelm@13515
   347
  shows "\<exists>g. linearform E g
wenzelm@46867
   348
     \<and> continuous E g norm
wenzelm@10687
   349
     \<and> (\<forall>x \<in> F. g x = f x)
wenzelm@13515
   350
     \<and> \<parallel>g\<parallel>\<hyphen>E = \<parallel>f\<parallel>\<hyphen>F"
wenzelm@9475
   351
proof -
ballarin@29234
   352
  interpret normed_vectorspace E norm by fact
ballarin@29234
   353
  interpret normed_vectorspace_with_fn_norm E norm B fn_norm
ballarin@27611
   354
    by (auto simp: B_def fn_norm_def) intro_locales
ballarin@29234
   355
  interpret subspace F E by fact
ballarin@29234
   356
  interpret linearform F f by fact
wenzelm@46867
   357
  interpret continuous F f norm by fact
haftmann@28823
   358
  have E: "vectorspace E" by intro_locales
haftmann@28823
   359
  have F: "vectorspace F" by rule intro_locales
ballarin@14214
   360
  have F_norm: "normed_vectorspace F norm"
wenzelm@23378
   361
    using FE E_norm by (rule subspace_normed_vs)
wenzelm@13547
   362
  have ge_zero: "0 \<le> \<parallel>f\<parallel>\<hyphen>F"
ballarin@27611
   363
    by (rule normed_vectorspace_with_fn_norm.fn_norm_ge_zero
ballarin@27611
   364
      [OF normed_vectorspace_with_fn_norm.intro,
wenzelm@58744
   365
       OF F_norm \<open>continuous F f norm\<close> , folded B_def fn_norm_def])
wenzelm@61539
   366
  txt \<open>We define a function \<open>p\<close> on \<open>E\<close> as follows:
wenzelm@61539
   367
    \<open>p x = \<parallel>f\<parallel> \<cdot> \<parallel>x\<parallel>\<close>\<close>
wenzelm@63040
   368
  define p where "p x = \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>" for x
wenzelm@13515
   369
wenzelm@61539
   370
  txt \<open>\<open>p\<close> is a seminorm on \<open>E\<close>:\<close>
wenzelm@13515
   371
  have q: "seminorm E p"
wenzelm@13515
   372
  proof
wenzelm@13515
   373
    fix x y a assume x: "x \<in> E" and y: "y \<in> E"
wenzelm@27612
   374
    
wenzelm@61539
   375
    txt \<open>\<open>p\<close> is positive definite:\<close>
wenzelm@27612
   376
    have "0 \<le> \<parallel>f\<parallel>\<hyphen>F" by (rule ge_zero)
wenzelm@27612
   377
    moreover from x have "0 \<le> \<parallel>x\<parallel>" ..
bauerg@14710
   378
    ultimately show "0 \<le> p x"  
bauerg@14710
   379
      by (simp add: p_def zero_le_mult_iff)
wenzelm@13515
   380
wenzelm@61539
   381
    txt \<open>\<open>p\<close> is absolutely homogeneous:\<close>
wenzelm@9475
   382
wenzelm@13515
   383
    show "p (a \<cdot> x) = \<bar>a\<bar> * p x"
wenzelm@13515
   384
    proof -
wenzelm@13547
   385
      have "p (a \<cdot> x) = \<parallel>f\<parallel>\<hyphen>F * \<parallel>a \<cdot> x\<parallel>" by (simp only: p_def)
wenzelm@13547
   386
      also from x have "\<parallel>a \<cdot> x\<parallel> = \<bar>a\<bar> * \<parallel>x\<parallel>" by (rule abs_homogenous)
wenzelm@13547
   387
      also have "\<parallel>f\<parallel>\<hyphen>F * (\<bar>a\<bar> * \<parallel>x\<parallel>) = \<bar>a\<bar> * (\<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>)" by simp
wenzelm@13547
   388
      also have "\<dots> = \<bar>a\<bar> * p x" by (simp only: p_def)
wenzelm@13515
   389
      finally show ?thesis .
wenzelm@13515
   390
    qed
wenzelm@13515
   391
wenzelm@61539
   392
    txt \<open>Furthermore, \<open>p\<close> is subadditive:\<close>
wenzelm@9475
   393
wenzelm@13515
   394
    show "p (x + y) \<le> p x + p y"
wenzelm@13515
   395
    proof -
wenzelm@13547
   396
      have "p (x + y) = \<parallel>f\<parallel>\<hyphen>F * \<parallel>x + y\<parallel>" by (simp only: p_def)
bauerg@14710
   397
      also have a: "0 \<le> \<parallel>f\<parallel>\<hyphen>F" by (rule ge_zero)
bauerg@14710
   398
      from x y have "\<parallel>x + y\<parallel> \<le> \<parallel>x\<parallel> + \<parallel>y\<parallel>" ..
bauerg@14710
   399
      with a have " \<parallel>f\<parallel>\<hyphen>F * \<parallel>x + y\<parallel> \<le> \<parallel>f\<parallel>\<hyphen>F * (\<parallel>x\<parallel> + \<parallel>y\<parallel>)"
bauerg@14710
   400
        by (simp add: mult_left_mono)
webertj@49962
   401
      also have "\<dots> = \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel> + \<parallel>f\<parallel>\<hyphen>F * \<parallel>y\<parallel>" by (simp only: distrib_left)
wenzelm@13547
   402
      also have "\<dots> = p x + p y" by (simp only: p_def)
wenzelm@13515
   403
      finally show ?thesis .
wenzelm@13515
   404
    qed
wenzelm@13515
   405
  qed
wenzelm@9475
   406
wenzelm@61539
   407
  txt \<open>\<open>f\<close> is bounded by \<open>p\<close>.\<close>
bauerg@9374
   408
wenzelm@13515
   409
  have "\<forall>x \<in> F. \<bar>f x\<bar> \<le> p x"
wenzelm@13515
   410
  proof
wenzelm@13515
   411
    fix x assume "x \<in> F"
wenzelm@58744
   412
    with \<open>continuous F f norm\<close> and linearform
wenzelm@13515
   413
    show "\<bar>f x\<bar> \<le> p x"
wenzelm@27612
   414
      unfolding p_def by (rule normed_vectorspace_with_fn_norm.fn_norm_le_cong
ballarin@27611
   415
        [OF normed_vectorspace_with_fn_norm.intro,
ballarin@27611
   416
         OF F_norm, folded B_def fn_norm_def])
wenzelm@13515
   417
  qed
wenzelm@9475
   418
wenzelm@61879
   419
  txt \<open>Using the fact that \<open>p\<close> is a seminorm and \<open>f\<close> is bounded by \<open>p\<close> we can
wenzelm@61879
   420
    apply the Hahn-Banach Theorem for real vector spaces. So \<open>f\<close> can be
wenzelm@61879
   421
    extended in a norm-preserving way to some function \<open>g\<close> on the whole vector
wenzelm@61879
   422
    space \<open>E\<close>.\<close>
wenzelm@9475
   423
wenzelm@13515
   424
  with E FE linearform q obtain g where
wenzelm@27612
   425
      linearformE: "linearform E g"
wenzelm@27612
   426
    and a: "\<forall>x \<in> F. g x = f x"
wenzelm@27612
   427
    and b: "\<forall>x \<in> E. \<bar>g x\<bar> \<le> p x"
wenzelm@31795
   428
    by (rule abs_Hahn_Banach [elim_format]) iprover
wenzelm@9475
   429
wenzelm@61539
   430
  txt \<open>We furthermore have to show that \<open>g\<close> is also continuous:\<close>
wenzelm@13515
   431
wenzelm@46867
   432
  have g_cont: "continuous E g norm" using linearformE
wenzelm@9475
   433
  proof
wenzelm@9503
   434
    fix x assume "x \<in> E"
wenzelm@13515
   435
    with b show "\<bar>g x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>"
wenzelm@13515
   436
      by (simp only: p_def)
wenzelm@10687
   437
  qed
bauerg@9374
   438
wenzelm@61539
   439
  txt \<open>To complete the proof, we show that \<open>\<parallel>g\<parallel> = \<parallel>f\<parallel>\<close>.\<close>
wenzelm@9475
   440
wenzelm@13515
   441
  have "\<parallel>g\<parallel>\<hyphen>E = \<parallel>f\<parallel>\<hyphen>F"
wenzelm@9475
   442
  proof (rule order_antisym)
wenzelm@58744
   443
    txt \<open>
wenzelm@61540
   444
      First we show \<open>\<parallel>g\<parallel> \<le> \<parallel>f\<parallel>\<close>. The function norm \<open>\<parallel>g\<parallel>\<close> is defined as the
wenzelm@61540
   445
      smallest \<open>c \<in> \<real>\<close> such that
wenzelm@10687
   446
      \begin{center}
wenzelm@10687
   447
      \begin{tabular}{l}
wenzelm@61539
   448
      \<open>\<forall>x \<in> E. \<bar>g x\<bar> \<le> c \<cdot> \<parallel>x\<parallel>\<close>
wenzelm@10687
   449
      \end{tabular}
wenzelm@10687
   450
      \end{center}
wenzelm@61540
   451
      \<^noindent> Furthermore holds
wenzelm@10687
   452
      \begin{center}
wenzelm@10687
   453
      \begin{tabular}{l}
wenzelm@61539
   454
      \<open>\<forall>x \<in> E. \<bar>g x\<bar> \<le> \<parallel>f\<parallel> \<cdot> \<parallel>x\<parallel>\<close>
wenzelm@10687
   455
      \end{tabular}
wenzelm@10687
   456
      \end{center}
wenzelm@61540
   457
    \<close>
wenzelm@10687
   458
wenzelm@50918
   459
    from g_cont _ ge_zero
wenzelm@50918
   460
    show "\<parallel>g\<parallel>\<hyphen>E \<le> \<parallel>f\<parallel>\<hyphen>F"
wenzelm@9475
   461
    proof
wenzelm@10687
   462
      fix x assume "x \<in> E"
wenzelm@13515
   463
      with b show "\<bar>g x\<bar> \<le> \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>"
wenzelm@13515
   464
        by (simp only: p_def)
bauerg@9374
   465
    qed
bauerg@9374
   466
wenzelm@58744
   467
    txt \<open>The other direction is achieved by a similar argument.\<close>
wenzelm@13515
   468
wenzelm@13547
   469
    show "\<parallel>f\<parallel>\<hyphen>F \<le> \<parallel>g\<parallel>\<hyphen>E"
ballarin@27611
   470
    proof (rule normed_vectorspace_with_fn_norm.fn_norm_least
wenzelm@32960
   471
        [OF normed_vectorspace_with_fn_norm.intro,
wenzelm@32960
   472
         OF F_norm, folded B_def fn_norm_def])
wenzelm@50918
   473
      fix x assume x: "x \<in> F"
wenzelm@50918
   474
      show "\<bar>f x\<bar> \<le> \<parallel>g\<parallel>\<hyphen>E * \<parallel>x\<parallel>"
wenzelm@50918
   475
      proof -
wenzelm@32960
   476
        from a x have "g x = f x" ..
wenzelm@32960
   477
        then have "\<bar>f x\<bar> = \<bar>g x\<bar>" by (simp only:)
wenzelm@65166
   478
        also from g_cont have "\<dots> \<le> \<parallel>g\<parallel>\<hyphen>E * \<parallel>x\<parallel>"
wenzelm@32960
   479
        proof (rule fn_norm_le_cong [OF _ linearformE, folded B_def fn_norm_def])
wenzelm@32960
   480
          from FE x show "x \<in> E" ..
wenzelm@32960
   481
        qed
wenzelm@50918
   482
        finally show ?thesis .
bauerg@9374
   483
      qed
wenzelm@50918
   484
    next
wenzelm@13547
   485
      show "0 \<le> \<parallel>g\<parallel>\<hyphen>E"
wenzelm@65166
   486
        using g_cont by (rule fn_norm_ge_zero [of g, folded B_def fn_norm_def])
wenzelm@46867
   487
      show "continuous F f norm" by fact
wenzelm@10687
   488
    qed
bauerg@9374
   489
  qed
wenzelm@13547
   490
  with linearformE a g_cont show ?thesis by blast
wenzelm@9475
   491
qed
bauerg@9374
   492
wenzelm@9475
   493
end