src/HOL/Analysis/Bounded_Linear_Function.thy
author nipkow
Sat Dec 29 15:43:53 2018 +0100 (6 months ago)
changeset 69529 4ab9657b3257
parent 69260 0a9688695a1b
child 69597 ff784d5a5bfb
permissions -rw-r--r--
capitalize proper names in lemma names
hoelzl@63627
     1
(*  Title:      HOL/Analysis/Bounded_Linear_Function.thy
immler@61915
     2
    Author:     Fabian Immler, TU M√ľnchen
immler@61915
     3
*)
immler@61915
     4
wenzelm@61975
     5
section \<open>Bounded Linear Function\<close>
immler@61915
     6
immler@61915
     7
theory Bounded_Linear_Function
immler@61915
     8
imports
immler@61915
     9
  Topology_Euclidean_Space
immler@61915
    10
  Operator_Norm
immler@67685
    11
  Uniform_Limit
immler@61915
    12
begin
immler@61915
    13
immler@67685
    14
lemma onorm_componentwise:
immler@67685
    15
  assumes "bounded_linear f"
immler@67685
    16
  shows "onorm f \<le> (\<Sum>i\<in>Basis. norm (f i))"
immler@67685
    17
proof -
immler@67685
    18
  {
immler@67685
    19
    fix i::'a
immler@67685
    20
    assume "i \<in> Basis"
immler@67685
    21
    hence "onorm (\<lambda>x. (x \<bullet> i) *\<^sub>R f i) \<le> onorm (\<lambda>x. (x \<bullet> i)) * norm (f i)"
immler@67685
    22
      by (auto intro!: onorm_scaleR_left_lemma bounded_linear_inner_left)
immler@67685
    23
    also have "\<dots> \<le>  norm i * norm (f i)"
immler@67685
    24
      by (rule mult_right_mono)
immler@67685
    25
        (auto simp: ac_simps Cauchy_Schwarz_ineq2 intro!: onorm_le)
immler@67685
    26
    finally have "onorm (\<lambda>x. (x \<bullet> i) *\<^sub>R f i) \<le> norm (f i)" using \<open>i \<in> Basis\<close>
immler@67685
    27
      by simp
immler@67685
    28
  } hence "onorm (\<lambda>x. \<Sum>i\<in>Basis. (x \<bullet> i) *\<^sub>R f i) \<le> (\<Sum>i\<in>Basis. norm (f i))"
immler@67685
    29
    by (auto intro!: order_trans[OF onorm_sum_le] bounded_linear_scaleR_const
immler@67685
    30
      sum_mono bounded_linear_inner_left)
immler@67685
    31
  also have "(\<lambda>x. \<Sum>i\<in>Basis. (x \<bullet> i) *\<^sub>R f i) = (\<lambda>x. f (\<Sum>i\<in>Basis. (x \<bullet> i) *\<^sub>R i))"
immler@67685
    32
    by (simp add: linear_sum bounded_linear.linear assms linear_simps)
immler@67685
    33
  also have "\<dots> = f"
immler@67685
    34
    by (simp add: euclidean_representation)
immler@67685
    35
  finally show ?thesis .
immler@67685
    36
qed
immler@67685
    37
immler@67685
    38
lemmas onorm_componentwise_le = order_trans[OF onorm_componentwise]
immler@67685
    39
immler@68838
    40
subsection%unimportant \<open>Intro rules for @{term bounded_linear}\<close>
immler@61915
    41
immler@61915
    42
named_theorems bounded_linear_intros
immler@61915
    43
immler@61915
    44
lemma onorm_inner_left:
immler@61915
    45
  assumes "bounded_linear r"
immler@61915
    46
  shows "onorm (\<lambda>x. r x \<bullet> f) \<le> onorm r * norm f"
immler@61915
    47
proof (rule onorm_bound)
immler@61915
    48
  fix x
immler@61915
    49
  have "norm (r x \<bullet> f) \<le> norm (r x) * norm f"
immler@61915
    50
    by (simp add: Cauchy_Schwarz_ineq2)
immler@61915
    51
  also have "\<dots> \<le> onorm r * norm x * norm f"
immler@61915
    52
    by (intro mult_right_mono onorm assms norm_ge_zero)
immler@61915
    53
  finally show "norm (r x \<bullet> f) \<le> onorm r * norm f * norm x"
immler@61915
    54
    by (simp add: ac_simps)
immler@61915
    55
qed (intro mult_nonneg_nonneg norm_ge_zero onorm_pos_le assms)
immler@61915
    56
immler@61915
    57
lemma onorm_inner_right:
immler@61915
    58
  assumes "bounded_linear r"
immler@61915
    59
  shows "onorm (\<lambda>x. f \<bullet> r x) \<le> norm f * onorm r"
immler@61915
    60
  apply (subst inner_commute)
immler@61915
    61
  apply (rule onorm_inner_left[OF assms, THEN order_trans])
immler@61915
    62
  apply simp
immler@61915
    63
  done
immler@61915
    64
immler@61915
    65
lemmas [bounded_linear_intros] =
immler@61915
    66
  bounded_linear_zero
immler@61915
    67
  bounded_linear_add
immler@61915
    68
  bounded_linear_const_mult
immler@61915
    69
  bounded_linear_mult_const
immler@61915
    70
  bounded_linear_scaleR_const
immler@61915
    71
  bounded_linear_const_scaleR
immler@61915
    72
  bounded_linear_ident
nipkow@64267
    73
  bounded_linear_sum
immler@61915
    74
  bounded_linear_Pair
immler@61915
    75
  bounded_linear_sub
immler@61915
    76
  bounded_linear_fst_comp
immler@61915
    77
  bounded_linear_snd_comp
immler@61915
    78
  bounded_linear_inner_left_comp
immler@61915
    79
  bounded_linear_inner_right_comp
immler@61915
    80
immler@61915
    81
immler@68838
    82
subsection%unimportant \<open>declaration of derivative/continuous/tendsto introduction rules for bounded linear functions\<close>
immler@61915
    83
immler@61915
    84
attribute_setup bounded_linear =
immler@61915
    85
  \<open>Scan.succeed (Thm.declaration_attribute (fn thm =>
immler@61915
    86
    fold (fn (r, s) => Named_Theorems.add_thm s (thm RS r))
immler@61915
    87
      [
wenzelm@62311
    88
        (@{thm bounded_linear.has_derivative}, @{named_theorems derivative_intros}),
wenzelm@62311
    89
        (@{thm bounded_linear.tendsto}, @{named_theorems tendsto_intros}),
wenzelm@62311
    90
        (@{thm bounded_linear.continuous}, @{named_theorems continuous_intros}),
wenzelm@62311
    91
        (@{thm bounded_linear.continuous_on}, @{named_theorems continuous_intros}),
wenzelm@62311
    92
        (@{thm bounded_linear.uniformly_continuous_on}, @{named_theorems continuous_intros}),
wenzelm@62311
    93
        (@{thm bounded_linear_compose}, @{named_theorems bounded_linear_intros})
immler@61915
    94
      ]))\<close>
immler@61915
    95
immler@61915
    96
attribute_setup bounded_bilinear =
immler@61915
    97
  \<open>Scan.succeed (Thm.declaration_attribute (fn thm =>
immler@61915
    98
    fold (fn (r, s) => Named_Theorems.add_thm s (thm RS r))
immler@61915
    99
      [
wenzelm@62311
   100
        (@{thm bounded_bilinear.FDERIV}, @{named_theorems derivative_intros}),
wenzelm@62311
   101
        (@{thm bounded_bilinear.tendsto}, @{named_theorems tendsto_intros}),
wenzelm@62311
   102
        (@{thm bounded_bilinear.continuous}, @{named_theorems continuous_intros}),
wenzelm@62311
   103
        (@{thm bounded_bilinear.continuous_on}, @{named_theorems continuous_intros}),
immler@61915
   104
        (@{thm bounded_linear_compose[OF bounded_bilinear.bounded_linear_left]},
wenzelm@62311
   105
          @{named_theorems bounded_linear_intros}),
immler@61915
   106
        (@{thm bounded_linear_compose[OF bounded_bilinear.bounded_linear_right]},
wenzelm@62311
   107
          @{named_theorems bounded_linear_intros}),
immler@61915
   108
        (@{thm bounded_linear.uniformly_continuous_on[OF bounded_bilinear.bounded_linear_left]},
wenzelm@62311
   109
          @{named_theorems continuous_intros}),
immler@61915
   110
        (@{thm bounded_linear.uniformly_continuous_on[OF bounded_bilinear.bounded_linear_right]},
wenzelm@62311
   111
          @{named_theorems continuous_intros})
immler@61915
   112
      ]))\<close>
immler@61915
   113
immler@61915
   114
immler@68838
   115
subsection \<open>Type of bounded linear functions\<close>
immler@61915
   116
immler@68838
   117
typedef%important (overloaded) ('a, 'b) blinfun ("(_ \<Rightarrow>\<^sub>L /_)" [22, 21] 21) =
immler@61915
   118
  "{f::'a::real_normed_vector\<Rightarrow>'b::real_normed_vector. bounded_linear f}"
immler@61915
   119
  morphisms blinfun_apply Blinfun
immler@61915
   120
  by (blast intro: bounded_linear_intros)
immler@61915
   121
immler@61915
   122
declare [[coercion
immler@61915
   123
    "blinfun_apply :: ('a::real_normed_vector \<Rightarrow>\<^sub>L'b::real_normed_vector) \<Rightarrow> 'a \<Rightarrow> 'b"]]
immler@61915
   124
immler@61915
   125
lemma bounded_linear_blinfun_apply[bounded_linear_intros]:
immler@61915
   126
  "bounded_linear g \<Longrightarrow> bounded_linear (\<lambda>x. blinfun_apply f (g x))"
immler@61915
   127
  by (metis blinfun_apply mem_Collect_eq bounded_linear_compose)
immler@61915
   128
immler@61915
   129
setup_lifting type_definition_blinfun
immler@61915
   130
immler@61915
   131
lemma blinfun_eqI: "(\<And>i. blinfun_apply x i = blinfun_apply y i) \<Longrightarrow> x = y"
immler@61915
   132
  by transfer auto
immler@61915
   133
immler@61915
   134
lemma bounded_linear_Blinfun_apply: "bounded_linear f \<Longrightarrow> blinfun_apply (Blinfun f) = f"
immler@61915
   135
  by (auto simp: Blinfun_inverse)
immler@61915
   136
immler@61915
   137
immler@68838
   138
subsection \<open>Type class instantiations\<close>
immler@61915
   139
immler@61915
   140
instantiation blinfun :: (real_normed_vector, real_normed_vector) real_normed_vector
immler@61915
   141
begin
immler@61915
   142
immler@68838
   143
lift_definition%important norm_blinfun :: "'a \<Rightarrow>\<^sub>L 'b \<Rightarrow> real" is onorm .
immler@61915
   144
immler@61915
   145
lift_definition minus_blinfun :: "'a \<Rightarrow>\<^sub>L 'b \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b"
immler@61915
   146
  is "\<lambda>f g x. f x - g x"
immler@61915
   147
  by (rule bounded_linear_sub)
immler@61915
   148
immler@61915
   149
definition dist_blinfun :: "'a \<Rightarrow>\<^sub>L 'b \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b \<Rightarrow> real"
immler@61915
   150
  where "dist_blinfun a b = norm (a - b)"
immler@61915
   151
hoelzl@62101
   152
definition [code del]:
haftmann@69260
   153
  "(uniformity :: (('a \<Rightarrow>\<^sub>L 'b) \<times> ('a \<Rightarrow>\<^sub>L 'b)) filter) = (INF e\<in>{0 <..}. principal {(x, y). dist x y < e})"
hoelzl@62101
   154
immler@61915
   155
definition open_blinfun :: "('a \<Rightarrow>\<^sub>L 'b) set \<Rightarrow> bool"
hoelzl@62101
   156
  where [code del]: "open_blinfun S = (\<forall>x\<in>S. \<forall>\<^sub>F (x', y) in uniformity. x' = x \<longrightarrow> y \<in> S)"
immler@61915
   157
immler@61915
   158
lift_definition uminus_blinfun :: "'a \<Rightarrow>\<^sub>L 'b \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b" is "\<lambda>f x. - f x"
immler@61915
   159
  by (rule bounded_linear_minus)
immler@61915
   160
immler@68838
   161
lift_definition%important zero_blinfun :: "'a \<Rightarrow>\<^sub>L 'b" is "\<lambda>x. 0"
immler@61915
   162
  by (rule bounded_linear_zero)
immler@61915
   163
immler@68838
   164
lift_definition%important plus_blinfun :: "'a \<Rightarrow>\<^sub>L 'b \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b"
immler@61915
   165
  is "\<lambda>f g x. f x + g x"
immler@61915
   166
  by (metis bounded_linear_add)
immler@61915
   167
immler@68838
   168
lift_definition%important scaleR_blinfun::"real \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b" is "\<lambda>r f x. r *\<^sub>R f x"
immler@61915
   169
  by (metis bounded_linear_compose bounded_linear_scaleR_right)
immler@61915
   170
immler@61915
   171
definition sgn_blinfun :: "'a \<Rightarrow>\<^sub>L 'b \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b"
immler@61915
   172
  where "sgn_blinfun x = scaleR (inverse (norm x)) x"
immler@61915
   173
immler@61915
   174
instance
immler@61915
   175
  apply standard
hoelzl@62101
   176
  unfolding dist_blinfun_def open_blinfun_def sgn_blinfun_def uniformity_blinfun_def
hoelzl@62101
   177
  apply (rule refl | (transfer, force simp: onorm_triangle onorm_scaleR onorm_eq_0 algebra_simps))+
immler@61915
   178
  done
immler@61915
   179
immler@61915
   180
end
immler@61915
   181
hoelzl@62102
   182
declare uniformity_Abort[where 'a="('a :: real_normed_vector) \<Rightarrow>\<^sub>L ('b :: real_normed_vector)", code]
hoelzl@62102
   183
immler@61915
   184
lemma norm_blinfun_eqI:
immler@61915
   185
  assumes "n \<le> norm (blinfun_apply f x) / norm x"
immler@61915
   186
  assumes "\<And>x. norm (blinfun_apply f x) \<le> n * norm x"
immler@61915
   187
  assumes "0 \<le> n"
immler@61915
   188
  shows "norm f = n"
immler@61915
   189
  by (auto simp: norm_blinfun_def
immler@61915
   190
    intro!: antisym onorm_bound assms order_trans[OF _ le_onorm]
immler@61915
   191
    bounded_linear_intros)
immler@61915
   192
immler@61915
   193
lemma norm_blinfun: "norm (blinfun_apply f x) \<le> norm f * norm x"
immler@61915
   194
  by transfer (rule onorm)
immler@61915
   195
immler@61915
   196
lemma norm_blinfun_bound: "0 \<le> b \<Longrightarrow> (\<And>x. norm (blinfun_apply f x) \<le> b * norm x) \<Longrightarrow> norm f \<le> b"
immler@61915
   197
  by transfer (rule onorm_bound)
immler@61915
   198
immler@61915
   199
lemma bounded_bilinear_blinfun_apply[bounded_bilinear]: "bounded_bilinear blinfun_apply"
immler@61915
   200
proof
immler@61915
   201
  fix f g::"'a \<Rightarrow>\<^sub>L 'b" and a b::'a and r::real
immler@61915
   202
  show "(f + g) a = f a + g a" "(r *\<^sub>R f) a = r *\<^sub>R f a"
immler@61915
   203
    by (transfer, simp)+
immler@61915
   204
  interpret bounded_linear f for f::"'a \<Rightarrow>\<^sub>L 'b"
immler@61915
   205
    by (auto intro!: bounded_linear_intros)
immler@61915
   206
  show "f (a + b) = f a + f b" "f (r *\<^sub>R a) = r *\<^sub>R f a"
immler@61915
   207
    by (simp_all add: add scaleR)
immler@61915
   208
  show "\<exists>K. \<forall>a b. norm (blinfun_apply a b) \<le> norm a * norm b * K"
immler@61915
   209
    by (auto intro!: exI[where x=1] norm_blinfun)
immler@61915
   210
qed
immler@61915
   211
immler@61915
   212
interpretation blinfun: bounded_bilinear blinfun_apply
immler@61915
   213
  by (rule bounded_bilinear_blinfun_apply)
immler@61915
   214
immler@61915
   215
lemmas bounded_linear_apply_blinfun[intro, simp] = blinfun.bounded_linear_left
immler@61915
   216
immler@61915
   217
immler@61915
   218
context bounded_bilinear
immler@61915
   219
begin
immler@61915
   220
immler@61915
   221
named_theorems bilinear_simps
immler@61915
   222
immler@61915
   223
lemmas [bilinear_simps] =
immler@61915
   224
  add_left
immler@61915
   225
  add_right
immler@61915
   226
  diff_left
immler@61915
   227
  diff_right
immler@61915
   228
  minus_left
immler@61915
   229
  minus_right
immler@61915
   230
  scaleR_left
immler@61915
   231
  scaleR_right
immler@61915
   232
  zero_left
immler@61915
   233
  zero_right
nipkow@64267
   234
  sum_left
nipkow@64267
   235
  sum_right
immler@61915
   236
immler@61915
   237
end
immler@61915
   238
immler@61915
   239
immler@66933
   240
instance blinfun :: (real_normed_vector, banach) banach
immler@61915
   241
proof
immler@61915
   242
  fix X::"nat \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b"
immler@61915
   243
  assume "Cauchy X"
immler@61915
   244
  {
immler@61915
   245
    fix x::'a
immler@61915
   246
    {
immler@61915
   247
      fix x::'a
immler@61915
   248
      assume "norm x \<le> 1"
immler@61915
   249
      have "Cauchy (\<lambda>n. X n x)"
immler@61915
   250
      proof (rule CauchyI)
immler@61915
   251
        fix e::real
immler@61915
   252
        assume "0 < e"
wenzelm@61975
   253
        from CauchyD[OF \<open>Cauchy X\<close> \<open>0 < e\<close>] obtain M
immler@61915
   254
          where M: "\<And>m n. m \<ge> M \<Longrightarrow> n \<ge> M \<Longrightarrow> norm (X m - X n) < e"
immler@61915
   255
          by auto
immler@61915
   256
        show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m x - X n x) < e"
immler@61915
   257
        proof (safe intro!: exI[where x=M])
immler@61915
   258
          fix m n
immler@61915
   259
          assume le: "M \<le> m" "M \<le> n"
immler@61915
   260
          have "norm (X m x - X n x) = norm ((X m - X n) x)"
immler@61915
   261
            by (simp add: blinfun.bilinear_simps)
immler@61915
   262
          also have "\<dots> \<le> norm (X m - X n) * norm x"
immler@61915
   263
             by (rule norm_blinfun)
immler@61915
   264
          also have "\<dots> \<le> norm (X m - X n) * 1"
wenzelm@61975
   265
            using \<open>norm x \<le> 1\<close> norm_ge_zero by (rule mult_left_mono)
immler@61915
   266
          also have "\<dots> = norm (X m - X n)" by simp
immler@61915
   267
          also have "\<dots> < e" using le by fact
immler@61915
   268
          finally show "norm (X m x - X n x) < e" .
immler@61915
   269
        qed
immler@61915
   270
      qed
immler@61915
   271
      hence "convergent (\<lambda>n. X n x)"
immler@61915
   272
        by (metis Cauchy_convergent_iff)
immler@61915
   273
    } note convergent_norm1 = this
wenzelm@63040
   274
    define y where "y = x /\<^sub>R norm x"
immler@61915
   275
    have y: "norm y \<le> 1" and xy: "x = norm x *\<^sub>R y"
immler@61915
   276
      by (simp_all add: y_def inverse_eq_divide)
immler@61915
   277
    have "convergent (\<lambda>n. norm x *\<^sub>R X n y)"
immler@61915
   278
      by (intro bounded_bilinear.convergent[OF bounded_bilinear_scaleR] convergent_const
immler@61915
   279
        convergent_norm1 y)
immler@61915
   280
    also have "(\<lambda>n. norm x *\<^sub>R X n y) = (\<lambda>n. X n x)"
immler@61915
   281
      by (subst xy) (simp add: blinfun.bilinear_simps)
immler@61915
   282
    finally have "convergent (\<lambda>n. X n x)" .
immler@61915
   283
  }
wenzelm@61969
   284
  then obtain v where v: "\<And>x. (\<lambda>n. X n x) \<longlonglongrightarrow> v x"
immler@61915
   285
    unfolding convergent_def
immler@61915
   286
    by metis
immler@61915
   287
immler@61915
   288
  have "Cauchy (\<lambda>n. norm (X n))"
immler@61915
   289
  proof (rule CauchyI)
immler@61915
   290
    fix e::real
immler@61915
   291
    assume "e > 0"
wenzelm@61975
   292
    from CauchyD[OF \<open>Cauchy X\<close> \<open>0 < e\<close>] obtain M
immler@61915
   293
      where M: "\<And>m n. m \<ge> M \<Longrightarrow> n \<ge> M \<Longrightarrow> norm (X m - X n) < e"
immler@61915
   294
      by auto
immler@61915
   295
    show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (norm (X m) - norm (X n)) < e"
immler@61915
   296
    proof (safe intro!: exI[where x=M])
immler@61915
   297
      fix m n assume mn: "m \<ge> M" "n \<ge> M"
immler@61915
   298
      have "norm (norm (X m) - norm (X n)) \<le> norm (X m - X n)"
immler@61915
   299
        by (metis norm_triangle_ineq3 real_norm_def)
immler@61915
   300
      also have "\<dots> < e" using mn by fact
immler@61915
   301
      finally show "norm (norm (X m) - norm (X n)) < e" .
immler@61915
   302
    qed
immler@61915
   303
  qed
wenzelm@61969
   304
  then obtain K where K: "(\<lambda>n. norm (X n)) \<longlonglongrightarrow> K"
immler@61915
   305
    unfolding Cauchy_convergent_iff convergent_def
immler@61915
   306
    by metis
immler@61915
   307
immler@61915
   308
  have "bounded_linear v"
immler@61915
   309
  proof
immler@61915
   310
    fix x y and r::real
immler@61915
   311
    from tendsto_add[OF v[of x] v [of y]] v[of "x + y", unfolded blinfun.bilinear_simps]
immler@61915
   312
      tendsto_scaleR[OF tendsto_const[of r] v[of x]] v[of "r *\<^sub>R x", unfolded blinfun.bilinear_simps]
immler@61915
   313
    show "v (x + y) = v x + v y" "v (r *\<^sub>R x) = r *\<^sub>R v x"
immler@61915
   314
      by (metis (poly_guards_query) LIMSEQ_unique)+
immler@61915
   315
    show "\<exists>K. \<forall>x. norm (v x) \<le> norm x * K"
immler@61915
   316
    proof (safe intro!: exI[where x=K])
immler@61915
   317
      fix x
immler@61915
   318
      have "norm (v x) \<le> K * norm x"
immler@61915
   319
        by (rule tendsto_le[OF _ tendsto_mult[OF K tendsto_const] tendsto_norm[OF v]])
immler@61915
   320
          (auto simp: norm_blinfun)
immler@61915
   321
      thus "norm (v x) \<le> norm x * K"
immler@61915
   322
        by (simp add: ac_simps)
immler@61915
   323
    qed
immler@61915
   324
  qed
wenzelm@61969
   325
  hence Bv: "\<And>x. (\<lambda>n. X n x) \<longlonglongrightarrow> Blinfun v x"
immler@61915
   326
    by (auto simp: bounded_linear_Blinfun_apply v)
immler@61915
   327
wenzelm@61969
   328
  have "X \<longlonglongrightarrow> Blinfun v"
immler@61915
   329
  proof (rule LIMSEQ_I)
immler@61915
   330
    fix r::real assume "r > 0"
wenzelm@63040
   331
    define r' where "r' = r / 2"
wenzelm@61975
   332
    have "0 < r'" "r' < r" using \<open>r > 0\<close> by (simp_all add: r'_def)
wenzelm@61975
   333
    from CauchyD[OF \<open>Cauchy X\<close> \<open>r' > 0\<close>]
immler@61915
   334
    obtain M where M: "\<And>m n. m \<ge> M \<Longrightarrow> n \<ge> M \<Longrightarrow> norm (X m - X n) < r'"
immler@61915
   335
      by metis
immler@61915
   336
    show "\<exists>no. \<forall>n\<ge>no. norm (X n - Blinfun v) < r"
immler@61915
   337
    proof (safe intro!: exI[where x=M])
immler@61915
   338
      fix n assume n: "M \<le> n"
immler@61915
   339
      have "norm (X n - Blinfun v) \<le> r'"
immler@61915
   340
      proof (rule norm_blinfun_bound)
immler@61915
   341
        fix x
immler@61915
   342
        have "eventually (\<lambda>m. m \<ge> M) sequentially"
immler@61915
   343
          by (metis eventually_ge_at_top)
immler@61915
   344
        hence ev_le: "eventually (\<lambda>m. norm (X n x - X m x) \<le> r' * norm x) sequentially"
immler@61915
   345
        proof eventually_elim
immler@61915
   346
          case (elim m)
immler@61915
   347
          have "norm (X n x - X m x) = norm ((X n - X m) x)"
immler@61915
   348
            by (simp add: blinfun.bilinear_simps)
immler@61915
   349
          also have "\<dots> \<le> norm ((X n - X m)) * norm x"
immler@61915
   350
            by (rule norm_blinfun)
immler@61915
   351
          also have "\<dots> \<le> r' * norm x"
immler@61915
   352
            using M[OF n elim] by (simp add: mult_right_mono)
immler@61915
   353
          finally show ?case .
immler@61915
   354
        qed
wenzelm@61969
   355
        have tendsto_v: "(\<lambda>m. norm (X n x - X m x)) \<longlonglongrightarrow> norm (X n x - Blinfun v x)"
immler@61915
   356
          by (auto intro!: tendsto_intros Bv)
immler@61915
   357
        show "norm ((X n - Blinfun v) x) \<le> r' * norm x"
lp15@63952
   358
          by (auto intro!: tendsto_upperbound tendsto_v ev_le simp: blinfun.bilinear_simps)
wenzelm@61975
   359
      qed (simp add: \<open>0 < r'\<close> less_imp_le)
immler@61915
   360
      thus "norm (X n - Blinfun v) < r"
wenzelm@61975
   361
        by (metis \<open>r' < r\<close> le_less_trans)
immler@61915
   362
    qed
immler@61915
   363
  qed
immler@61915
   364
  thus "convergent X"
immler@61915
   365
    by (rule convergentI)
immler@61915
   366
qed
immler@61915
   367
immler@68838
   368
subsection%unimportant \<open>On Euclidean Space\<close>
immler@61915
   369
nipkow@64267
   370
lemma Zfun_sum:
immler@61915
   371
  assumes "finite s"
immler@61915
   372
  assumes f: "\<And>i. i \<in> s \<Longrightarrow> Zfun (f i) F"
nipkow@64267
   373
  shows "Zfun (\<lambda>x. sum (\<lambda>i. f i x) s) F"
immler@61915
   374
  using assms by induct (auto intro!: Zfun_zero Zfun_add)
immler@61915
   375
immler@61915
   376
lemma norm_blinfun_euclidean_le:
immler@61915
   377
  fixes a::"'a::euclidean_space \<Rightarrow>\<^sub>L 'b::real_normed_vector"
nipkow@64267
   378
  shows "norm a \<le> sum (\<lambda>x. norm (a x)) Basis"
immler@61915
   379
  apply (rule norm_blinfun_bound)
nipkow@64267
   380
   apply (simp add: sum_nonneg)
immler@61915
   381
  apply (subst euclidean_representation[symmetric, where 'a='a])
nipkow@64267
   382
  apply (simp only: blinfun.bilinear_simps sum_distrib_right)
nipkow@64267
   383
  apply (rule order.trans[OF norm_sum sum_mono])
immler@61915
   384
  apply (simp add: abs_mult mult_right_mono ac_simps Basis_le_norm)
immler@61915
   385
  done
immler@61915
   386
immler@61915
   387
lemma tendsto_componentwise1:
immler@61915
   388
  fixes a::"'a::euclidean_space \<Rightarrow>\<^sub>L 'b::real_normed_vector"
immler@61915
   389
    and b::"'c \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b"
wenzelm@61973
   390
  assumes "(\<And>j. j \<in> Basis \<Longrightarrow> ((\<lambda>n. b n j) \<longlongrightarrow> a j) F)"
wenzelm@61973
   391
  shows "(b \<longlongrightarrow> a) F"
immler@61915
   392
proof -
immler@61915
   393
  have "\<And>j. j \<in> Basis \<Longrightarrow> Zfun (\<lambda>x. norm (b x j - a j)) F"
immler@61915
   394
    using assms unfolding tendsto_Zfun_iff Zfun_norm_iff .
immler@61915
   395
  hence "Zfun (\<lambda>x. \<Sum>j\<in>Basis. norm (b x j - a j)) F"
nipkow@64267
   396
    by (auto intro!: Zfun_sum)
immler@61915
   397
  thus ?thesis
immler@61915
   398
    unfolding tendsto_Zfun_iff
immler@61915
   399
    by (rule Zfun_le)
immler@61915
   400
      (auto intro!: order_trans[OF norm_blinfun_euclidean_le] simp: blinfun.bilinear_simps)
immler@61915
   401
qed
immler@61915
   402
immler@61915
   403
lift_definition
immler@61915
   404
  blinfun_of_matrix::"('b::euclidean_space \<Rightarrow> 'a::euclidean_space \<Rightarrow> real) \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b"
immler@61915
   405
  is "\<lambda>a x. \<Sum>i\<in>Basis. \<Sum>j\<in>Basis. ((x \<bullet> j) * a i j) *\<^sub>R i"
immler@61915
   406
  by (intro bounded_linear_intros)
immler@61915
   407
immler@61915
   408
lemma blinfun_of_matrix_works:
immler@61915
   409
  fixes f::"'a::euclidean_space \<Rightarrow>\<^sub>L 'b::euclidean_space"
immler@61915
   410
  shows "blinfun_of_matrix (\<lambda>i j. (f j) \<bullet> i) = f"
immler@61915
   411
proof (transfer, rule,  rule euclidean_eqI)
immler@61915
   412
  fix f::"'a \<Rightarrow> 'b" and x::'a and b::'b assume "bounded_linear f" and b: "b \<in> Basis"
immler@61915
   413
  then interpret bounded_linear f by simp
immler@61915
   414
  have "(\<Sum>j\<in>Basis. \<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> j)) *\<^sub>R j) \<bullet> b
immler@61915
   415
    = (\<Sum>j\<in>Basis. if j = b then (\<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> j))) else 0)"
immler@61915
   416
    using b
haftmann@66804
   417
    by (simp add: inner_sum_left inner_Basis if_distrib cong: if_cong) (simp add: sum.swap)
immler@61915
   418
  also have "\<dots> = (\<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> b)))"
nipkow@64267
   419
    using b by (simp add: sum.delta)
immler@61915
   420
  also have "\<dots> = f x \<bullet> b"
lp15@63938
   421
    by (metis (mono_tags, lifting) Linear_Algebra.linear_componentwise linear_axioms)
immler@61915
   422
  finally show "(\<Sum>j\<in>Basis. \<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> j)) *\<^sub>R j) \<bullet> b = f x \<bullet> b" .
immler@61915
   423
qed
immler@61915
   424
immler@61915
   425
lemma blinfun_of_matrix_apply:
immler@61915
   426
  "blinfun_of_matrix a x = (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. ((x \<bullet> j) * a i j) *\<^sub>R i)"
immler@61915
   427
  by transfer simp
immler@61915
   428
immler@61915
   429
lemma blinfun_of_matrix_minus: "blinfun_of_matrix x - blinfun_of_matrix y = blinfun_of_matrix (x - y)"
nipkow@64267
   430
  by transfer (auto simp: algebra_simps sum_subtractf)
immler@61915
   431
immler@61915
   432
lemma norm_blinfun_of_matrix:
wenzelm@61945
   433
  "norm (blinfun_of_matrix a) \<le> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. \<bar>a i j\<bar>)"
immler@61915
   434
  apply (rule norm_blinfun_bound)
nipkow@64267
   435
   apply (simp add: sum_nonneg)
nipkow@64267
   436
  apply (simp only: blinfun_of_matrix_apply sum_distrib_right)
nipkow@64267
   437
  apply (rule order_trans[OF norm_sum sum_mono])
nipkow@64267
   438
  apply (rule order_trans[OF norm_sum sum_mono])
immler@61915
   439
  apply (simp add: abs_mult mult_right_mono ac_simps Basis_le_norm)
immler@61915
   440
  done
immler@61915
   441
immler@61915
   442
lemma tendsto_blinfun_of_matrix:
wenzelm@61973
   443
  assumes "\<And>i j. i \<in> Basis \<Longrightarrow> j \<in> Basis \<Longrightarrow> ((\<lambda>n. b n i j) \<longlongrightarrow> a i j) F"
wenzelm@61973
   444
  shows "((\<lambda>n. blinfun_of_matrix (b n)) \<longlongrightarrow> blinfun_of_matrix a) F"
immler@61915
   445
proof -
immler@61915
   446
  have "\<And>i j. i \<in> Basis \<Longrightarrow> j \<in> Basis \<Longrightarrow> Zfun (\<lambda>x. norm (b x i j - a i j)) F"
immler@61915
   447
    using assms unfolding tendsto_Zfun_iff Zfun_norm_iff .
wenzelm@61945
   448
  hence "Zfun (\<lambda>x. (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. \<bar>b x i j - a i j\<bar>)) F"
nipkow@64267
   449
    by (auto intro!: Zfun_sum)
immler@61915
   450
  thus ?thesis
immler@61915
   451
    unfolding tendsto_Zfun_iff blinfun_of_matrix_minus
immler@61915
   452
    by (rule Zfun_le) (auto intro!: order_trans[OF norm_blinfun_of_matrix])
immler@61915
   453
qed
immler@61915
   454
immler@61915
   455
lemma tendsto_componentwise:
immler@61915
   456
  fixes a::"'a::euclidean_space \<Rightarrow>\<^sub>L 'b::euclidean_space"
immler@61915
   457
    and b::"'c \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b"
wenzelm@61973
   458
  shows "(\<And>i j. i \<in> Basis \<Longrightarrow> j \<in> Basis \<Longrightarrow> ((\<lambda>n. b n j \<bullet> i) \<longlongrightarrow> a j \<bullet> i) F) \<Longrightarrow> (b \<longlongrightarrow> a) F"
immler@61915
   459
  apply (subst blinfun_of_matrix_works[of a, symmetric])
immler@61915
   460
  apply (subst blinfun_of_matrix_works[of "b x" for x, symmetric, abs_def])
immler@61915
   461
  by (rule tendsto_blinfun_of_matrix)
immler@61915
   462
immler@61915
   463
lemma
immler@61915
   464
  continuous_blinfun_componentwiseI:
immler@61915
   465
  fixes f:: "'b::t2_space \<Rightarrow> 'a::euclidean_space \<Rightarrow>\<^sub>L 'c::euclidean_space"
immler@61915
   466
  assumes "\<And>i j. i \<in> Basis \<Longrightarrow> j \<in> Basis \<Longrightarrow> continuous F (\<lambda>x. (f x) j \<bullet> i)"
immler@61915
   467
  shows "continuous F f"
immler@61915
   468
  using assms by (auto simp: continuous_def intro!: tendsto_componentwise)
immler@61915
   469
immler@61915
   470
lemma
immler@61915
   471
  continuous_blinfun_componentwiseI1:
immler@61915
   472
  fixes f:: "'b::t2_space \<Rightarrow> 'a::euclidean_space \<Rightarrow>\<^sub>L 'c::real_normed_vector"
immler@61915
   473
  assumes "\<And>i. i \<in> Basis \<Longrightarrow> continuous F (\<lambda>x. f x i)"
immler@61915
   474
  shows "continuous F f"
immler@61915
   475
  using assms by (auto simp: continuous_def intro!: tendsto_componentwise1)
immler@61915
   476
immler@67685
   477
lemma
immler@67685
   478
  continuous_on_blinfun_componentwise:
immler@67685
   479
  fixes f:: "'d::t2_space \<Rightarrow> 'e::euclidean_space \<Rightarrow>\<^sub>L 'f::real_normed_vector"
immler@67685
   480
  assumes "\<And>i. i \<in> Basis \<Longrightarrow> continuous_on s (\<lambda>x. f x i)"
immler@67685
   481
  shows "continuous_on s f"
immler@67685
   482
  using assms
immler@67685
   483
  by (auto intro!: continuous_at_imp_continuous_on intro!: tendsto_componentwise1
immler@67685
   484
    simp: continuous_on_eq_continuous_within continuous_def)
immler@67685
   485
immler@61915
   486
lemma bounded_linear_blinfun_matrix: "bounded_linear (\<lambda>x. (x::_\<Rightarrow>\<^sub>L _) j \<bullet> i)"
immler@61915
   487
  by (auto intro!: bounded_linearI' bounded_linear_intros)
immler@61915
   488
immler@61915
   489
lemma continuous_blinfun_matrix:
immler@61915
   490
  fixes f:: "'b::t2_space \<Rightarrow> 'a::real_normed_vector \<Rightarrow>\<^sub>L 'c::real_inner"
immler@61915
   491
  assumes "continuous F f"
immler@61915
   492
  shows "continuous F (\<lambda>x. (f x) j \<bullet> i)"
immler@61915
   493
  by (rule bounded_linear.continuous[OF bounded_linear_blinfun_matrix assms])
immler@61915
   494
immler@61915
   495
lemma continuous_on_blinfun_matrix:
immler@61915
   496
  fixes f::"'a::t2_space \<Rightarrow> 'b::real_normed_vector \<Rightarrow>\<^sub>L 'c::real_inner"
immler@61915
   497
  assumes "continuous_on S f"
immler@61915
   498
  shows "continuous_on S (\<lambda>x. (f x) j \<bullet> i)"
immler@61915
   499
  using assms
immler@61915
   500
  by (auto simp: continuous_on_eq_continuous_within continuous_blinfun_matrix)
immler@61915
   501
immler@62963
   502
lemma continuous_on_blinfun_of_matrix[continuous_intros]:
immler@62963
   503
  assumes "\<And>i j. i \<in> Basis \<Longrightarrow> j \<in> Basis \<Longrightarrow> continuous_on S (\<lambda>s. g s i j)"
immler@62963
   504
  shows "continuous_on S (\<lambda>s. blinfun_of_matrix (g s))"
immler@62963
   505
  using assms
immler@62963
   506
  by (auto simp: continuous_on intro!: tendsto_blinfun_of_matrix)
immler@62963
   507
immler@61915
   508
lemma mult_if_delta:
immler@61915
   509
  "(if P then (1::'a::comm_semiring_1) else 0) * q = (if P then q else 0)"
immler@61915
   510
  by auto
immler@61915
   511
immler@61915
   512
lemma compact_blinfun_lemma:
immler@61915
   513
  fixes f :: "nat \<Rightarrow> 'a::euclidean_space \<Rightarrow>\<^sub>L 'b::euclidean_space"
immler@61915
   514
  assumes "bounded (range f)"
eberlm@66447
   515
  shows "\<forall>d\<subseteq>Basis. \<exists>l::'a \<Rightarrow>\<^sub>L 'b. \<exists> r::nat\<Rightarrow>nat.
eberlm@66447
   516
    strict_mono r \<and> (\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) i) (l i) < e) sequentially)"
immler@62127
   517
  by (rule compact_lemma_general[where unproj = "\<lambda>e. blinfun_of_matrix (\<lambda>i j. e j \<bullet> i)"])
immler@62127
   518
   (auto intro!: euclidean_eqI[where 'a='b] bounded_linear_image assms
nipkow@64267
   519
    simp: blinfun_of_matrix_works blinfun_of_matrix_apply inner_Basis mult_if_delta sum.delta'
nipkow@64267
   520
      scaleR_sum_left[symmetric])
immler@61915
   521
immler@61915
   522
lemma blinfun_euclidean_eqI: "(\<And>i. i \<in> Basis \<Longrightarrow> blinfun_apply x i = blinfun_apply y i) \<Longrightarrow> x = y"
immler@61915
   523
  apply (auto intro!: blinfun_eqI)
immler@61915
   524
  apply (subst (2) euclidean_representation[symmetric, where 'a='a])
immler@61915
   525
  apply (subst (1) euclidean_representation[symmetric, where 'a='a])
immler@61915
   526
  apply (simp add: blinfun.bilinear_simps)
immler@61915
   527
  done
immler@61915
   528
immler@62951
   529
lemma Blinfun_eq_matrix: "bounded_linear f \<Longrightarrow> Blinfun f = blinfun_of_matrix (\<lambda>i j. f j \<bullet> i)"
immler@62951
   530
  by (intro blinfun_euclidean_eqI)
immler@62951
   531
     (auto simp: blinfun_of_matrix_apply bounded_linear_Blinfun_apply inner_Basis if_distrib
immler@68072
   532
      if_distribR sum.delta' euclidean_representation
immler@62951
   533
      cong: if_cong)
immler@62951
   534
wenzelm@67226
   535
text \<open>TODO: generalize (via \<open>compact_cball\<close>)?\<close>
immler@61915
   536
instance blinfun :: (euclidean_space, euclidean_space) heine_borel
immler@61915
   537
proof
immler@61915
   538
  fix f :: "nat \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b"
immler@61915
   539
  assume f: "bounded (range f)"
eberlm@66447
   540
  then obtain l::"'a \<Rightarrow>\<^sub>L 'b" and r where r: "strict_mono r"
immler@61915
   541
    and l: "\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>Basis. dist (f (r n) i) (l i) < e) sequentially"
immler@61915
   542
    using compact_blinfun_lemma [OF f] by blast
immler@61915
   543
  {
immler@61915
   544
    fix e::real
immler@61915
   545
    let ?d = "real_of_nat DIM('a) * real_of_nat DIM('b)"
immler@61915
   546
    assume "e > 0"
immler@61915
   547
    hence "e / ?d > 0" by (simp add: DIM_positive)
immler@61915
   548
    with l have "eventually (\<lambda>n. \<forall>i\<in>Basis. dist (f (r n) i) (l i) < e / ?d) sequentially"
immler@61915
   549
      by simp
immler@61915
   550
    moreover
immler@61915
   551
    {
immler@61915
   552
      fix n
immler@61915
   553
      assume n: "\<forall>i\<in>Basis. dist (f (r n) i) (l i) < e / ?d"
immler@61915
   554
      have "norm (f (r n) - l) = norm (blinfun_of_matrix (\<lambda>i j. (f (r n) - l) j \<bullet> i))"
immler@61915
   555
        unfolding blinfun_of_matrix_works ..
immler@61915
   556
      also note norm_blinfun_of_matrix
immler@61915
   557
      also have "(\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. \<bar>(f (r n) - l) j \<bullet> i\<bar>) <
immler@61915
   558
        (\<Sum>i\<in>(Basis::'b set). e / real_of_nat DIM('b))"
nipkow@64267
   559
      proof (rule sum_strict_mono)
immler@61915
   560
        fix i::'b assume i: "i \<in> Basis"
immler@61915
   561
        have "(\<Sum>j::'a\<in>Basis. \<bar>(f (r n) - l) j \<bullet> i\<bar>) < (\<Sum>j::'a\<in>Basis. e / ?d)"
nipkow@64267
   562
        proof (rule sum_strict_mono)
immler@61915
   563
          fix j::'a assume j: "j \<in> Basis"
immler@61915
   564
          have "\<bar>(f (r n) - l) j \<bullet> i\<bar> \<le> norm ((f (r n) - l) j)"
immler@61915
   565
            by (simp add: Basis_le_norm i)
immler@61915
   566
          also have "\<dots> < e / ?d"
immler@61915
   567
            using n i j by (auto simp: dist_norm blinfun.bilinear_simps)
immler@61915
   568
          finally show "\<bar>(f (r n) - l) j \<bullet> i\<bar> < e / ?d" by simp
immler@61915
   569
        qed simp_all
immler@61915
   570
        also have "\<dots> \<le> e / real_of_nat DIM('b)"
immler@61915
   571
          by simp
immler@61915
   572
        finally show "(\<Sum>j\<in>Basis. \<bar>(f (r n) - l) j \<bullet> i\<bar>) < e / real_of_nat DIM('b)"
immler@61915
   573
          by simp
immler@61915
   574
      qed simp_all
immler@61915
   575
      also have "\<dots> \<le> e" by simp
immler@61915
   576
      finally have "dist (f (r n)) l < e"
immler@61915
   577
        by (auto simp: dist_norm)
immler@61915
   578
    }
immler@61915
   579
    ultimately have "eventually (\<lambda>n. dist (f (r n)) l < e) sequentially"
immler@61915
   580
      using eventually_elim2 by force
immler@61915
   581
  }
wenzelm@61973
   582
  then have *: "((f \<circ> r) \<longlongrightarrow> l) sequentially"
immler@61915
   583
    unfolding o_def tendsto_iff by simp
eberlm@66447
   584
  with r show "\<exists>l r. strict_mono r \<and> ((f \<circ> r) \<longlongrightarrow> l) sequentially"
immler@61915
   585
    by auto
immler@61915
   586
qed
immler@61915
   587
immler@61915
   588
immler@68838
   589
subsection%unimportant \<open>concrete bounded linear functions\<close>
immler@61915
   590
immler@61916
   591
lemma transfer_bounded_bilinear_bounded_linearI:
immler@61916
   592
  assumes "g = (\<lambda>i x. (blinfun_apply (f i) x))"
immler@61916
   593
  shows "bounded_bilinear g = bounded_linear f"
immler@61916
   594
proof
immler@61916
   595
  assume "bounded_bilinear g"
immler@61916
   596
  then interpret bounded_bilinear f by (simp add: assms)
immler@61916
   597
  show "bounded_linear f"
immler@61916
   598
  proof (unfold_locales, safe intro!: blinfun_eqI)
immler@61916
   599
    fix i
immler@61916
   600
    show "f (x + y) i = (f x + f y) i" "f (r *\<^sub>R x) i = (r *\<^sub>R f x) i" for r x y
immler@61916
   601
      by (auto intro!: blinfun_eqI simp: blinfun.bilinear_simps)
immler@61916
   602
    from _ nonneg_bounded show "\<exists>K. \<forall>x. norm (f x) \<le> norm x * K"
immler@61916
   603
      by (rule ex_reg) (auto intro!: onorm_bound simp: norm_blinfun.rep_eq ac_simps)
immler@61916
   604
  qed
immler@61916
   605
qed (auto simp: assms intro!: blinfun.comp)
immler@61916
   606
immler@61916
   607
lemma transfer_bounded_bilinear_bounded_linear[transfer_rule]:
nipkow@67399
   608
  "(rel_fun (rel_fun (=) (pcr_blinfun (=) (=))) (=)) bounded_bilinear bounded_linear"
immler@61916
   609
  by (auto simp: pcr_blinfun_def cr_blinfun_def rel_fun_def OO_def
immler@61916
   610
    intro!: transfer_bounded_bilinear_bounded_linearI)
immler@61915
   611
immler@61915
   612
context bounded_bilinear
immler@61915
   613
begin
immler@61915
   614
immler@61915
   615
lift_definition prod_left::"'b \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'c" is "(\<lambda>b a. prod a b)"
immler@61915
   616
  by (rule bounded_linear_left)
immler@61915
   617
declare prod_left.rep_eq[simp]
immler@61915
   618
immler@61915
   619
lemma bounded_linear_prod_left[bounded_linear]: "bounded_linear prod_left"
immler@61916
   620
  by transfer (rule flip)
immler@61915
   621
immler@61915
   622
lift_definition prod_right::"'a \<Rightarrow> 'b \<Rightarrow>\<^sub>L 'c" is "(\<lambda>a b. prod a b)"
immler@61915
   623
  by (rule bounded_linear_right)
immler@61915
   624
declare prod_right.rep_eq[simp]
immler@61915
   625
immler@61915
   626
lemma bounded_linear_prod_right[bounded_linear]: "bounded_linear prod_right"
immler@61916
   627
  by transfer (rule bounded_bilinear_axioms)
immler@61915
   628
immler@61915
   629
end
immler@61915
   630
immler@61915
   631
lift_definition id_blinfun::"'a::real_normed_vector \<Rightarrow>\<^sub>L 'a" is "\<lambda>x. x"
immler@61915
   632
  by (rule bounded_linear_ident)
immler@61915
   633
immler@61915
   634
lemmas blinfun_apply_id_blinfun[simp] = id_blinfun.rep_eq
immler@61915
   635
immler@61915
   636
lemma norm_blinfun_id[simp]:
immler@61915
   637
  "norm (id_blinfun::'a::{real_normed_vector, perfect_space} \<Rightarrow>\<^sub>L 'a) = 1"
immler@61915
   638
  by transfer (auto simp: onorm_id)
immler@61915
   639
immler@61915
   640
lemma norm_blinfun_id_le:
immler@61915
   641
  "norm (id_blinfun::'a::real_normed_vector \<Rightarrow>\<^sub>L 'a) \<le> 1"
immler@61915
   642
  by transfer (auto simp: onorm_id_le)
immler@61915
   643
immler@61915
   644
immler@61915
   645
lift_definition fst_blinfun::"('a::real_normed_vector \<times> 'b::real_normed_vector) \<Rightarrow>\<^sub>L 'a" is fst
immler@61915
   646
  by (rule bounded_linear_fst)
immler@61915
   647
immler@61915
   648
lemma blinfun_apply_fst_blinfun[simp]: "blinfun_apply fst_blinfun = fst"
immler@61915
   649
  by transfer (rule refl)
immler@61915
   650
immler@61915
   651
immler@61915
   652
lift_definition snd_blinfun::"('a::real_normed_vector \<times> 'b::real_normed_vector) \<Rightarrow>\<^sub>L 'b" is snd
immler@61915
   653
  by (rule bounded_linear_snd)
immler@61915
   654
immler@61915
   655
lemma blinfun_apply_snd_blinfun[simp]: "blinfun_apply snd_blinfun = snd"
immler@61915
   656
  by transfer (rule refl)
immler@61915
   657
immler@61915
   658
immler@61915
   659
lift_definition blinfun_compose::
immler@61915
   660
  "'a::real_normed_vector \<Rightarrow>\<^sub>L 'b::real_normed_vector \<Rightarrow>
immler@61915
   661
    'c::real_normed_vector \<Rightarrow>\<^sub>L 'a \<Rightarrow>
nipkow@67399
   662
    'c \<Rightarrow>\<^sub>L 'b" (infixl "o\<^sub>L" 55) is "(o)"
immler@61915
   663
  parametric comp_transfer
immler@61915
   664
  unfolding o_def
immler@61915
   665
  by (rule bounded_linear_compose)
immler@61915
   666
immler@61915
   667
lemma blinfun_apply_blinfun_compose[simp]: "(a o\<^sub>L b) c = a (b c)"
immler@61915
   668
  by (simp add: blinfun_compose.rep_eq)
immler@61915
   669
immler@61915
   670
lemma norm_blinfun_compose:
immler@61915
   671
  "norm (f o\<^sub>L g) \<le> norm f * norm g"
immler@61915
   672
  by transfer (rule onorm_compose)
immler@61915
   673
nipkow@67399
   674
lemma bounded_bilinear_blinfun_compose[bounded_bilinear]: "bounded_bilinear (o\<^sub>L)"
immler@61915
   675
  by unfold_locales
immler@61915
   676
    (auto intro!: blinfun_eqI exI[where x=1] simp: blinfun.bilinear_simps norm_blinfun_compose)
immler@61915
   677
immler@62951
   678
lemma blinfun_compose_zero[simp]:
immler@62951
   679
  "blinfun_compose 0 = (\<lambda>_. 0)"
immler@62951
   680
  "blinfun_compose x 0 = 0"
immler@62951
   681
  by (auto simp: blinfun.bilinear_simps intro!: blinfun_eqI)
immler@62951
   682
immler@61915
   683
nipkow@67399
   684
lift_definition blinfun_inner_right::"'a::real_inner \<Rightarrow> 'a \<Rightarrow>\<^sub>L real" is "(\<bullet>)"
immler@61915
   685
  by (rule bounded_linear_inner_right)
immler@61915
   686
declare blinfun_inner_right.rep_eq[simp]
immler@61915
   687
immler@61915
   688
lemma bounded_linear_blinfun_inner_right[bounded_linear]: "bounded_linear blinfun_inner_right"
immler@61916
   689
  by transfer (rule bounded_bilinear_inner)
immler@61915
   690
immler@61915
   691
immler@61915
   692
lift_definition blinfun_inner_left::"'a::real_inner \<Rightarrow> 'a \<Rightarrow>\<^sub>L real" is "\<lambda>x y. y \<bullet> x"
immler@61915
   693
  by (rule bounded_linear_inner_left)
immler@61915
   694
declare blinfun_inner_left.rep_eq[simp]
immler@61915
   695
immler@61915
   696
lemma bounded_linear_blinfun_inner_left[bounded_linear]: "bounded_linear blinfun_inner_left"
immler@61916
   697
  by transfer (rule bounded_bilinear.flip[OF bounded_bilinear_inner])
immler@61915
   698
immler@61915
   699
nipkow@69064
   700
lift_definition blinfun_scaleR_right::"real \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'a::real_normed_vector" is "(*\<^sub>R)"
immler@61915
   701
  by (rule bounded_linear_scaleR_right)
immler@61915
   702
declare blinfun_scaleR_right.rep_eq[simp]
immler@61915
   703
immler@61915
   704
lemma bounded_linear_blinfun_scaleR_right[bounded_linear]: "bounded_linear blinfun_scaleR_right"
immler@61916
   705
  by transfer (rule bounded_bilinear_scaleR)
immler@61915
   706
immler@61915
   707
immler@61915
   708
lift_definition blinfun_scaleR_left::"'a::real_normed_vector \<Rightarrow> real \<Rightarrow>\<^sub>L 'a" is "\<lambda>x y. y *\<^sub>R x"
immler@61915
   709
  by (rule bounded_linear_scaleR_left)
immler@61915
   710
lemmas [simp] = blinfun_scaleR_left.rep_eq
immler@61915
   711
immler@61915
   712
lemma bounded_linear_blinfun_scaleR_left[bounded_linear]: "bounded_linear blinfun_scaleR_left"
immler@61916
   713
  by transfer (rule bounded_bilinear.flip[OF bounded_bilinear_scaleR])
immler@61915
   714
immler@61915
   715
nipkow@69064
   716
lift_definition blinfun_mult_right::"'a \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'a::real_normed_algebra" is "(*)"
immler@61915
   717
  by (rule bounded_linear_mult_right)
immler@61915
   718
declare blinfun_mult_right.rep_eq[simp]
immler@61915
   719
immler@61915
   720
lemma bounded_linear_blinfun_mult_right[bounded_linear]: "bounded_linear blinfun_mult_right"
immler@61916
   721
  by transfer (rule bounded_bilinear_mult)
immler@61915
   722
immler@61915
   723
immler@61915
   724
lift_definition blinfun_mult_left::"'a::real_normed_algebra \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'a" is "\<lambda>x y. y * x"
immler@61915
   725
  by (rule bounded_linear_mult_left)
immler@61915
   726
lemmas [simp] = blinfun_mult_left.rep_eq
immler@61915
   727
immler@61915
   728
lemma bounded_linear_blinfun_mult_left[bounded_linear]: "bounded_linear blinfun_mult_left"
immler@61916
   729
  by transfer (rule bounded_bilinear.flip[OF bounded_bilinear_mult])
immler@61915
   730
immler@67685
   731
lemmas bounded_linear_function_uniform_limit_intros[uniform_limit_intros] =
immler@67685
   732
  bounded_linear.uniform_limit[OF bounded_linear_apply_blinfun]
immler@67685
   733
  bounded_linear.uniform_limit[OF bounded_linear_blinfun_apply]
immler@67685
   734
  bounded_linear.uniform_limit[OF bounded_linear_blinfun_matrix]
immler@67685
   735
immler@61915
   736
end