src/HOL/Library/FrechetDeriv.thy
author haftmann
Mon, 23 Mar 2009 08:14:24 +0100
changeset 30663 0b6aff7451b2
parent 30273 ecd6f0ca62ea
child 30729 461ee3e49ad3
permissions -rw-r--r--
Main is (Complex_Main) base entry point in library theories
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
     1
(*  Title       : FrechetDeriv.thy
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
     2
    Author      : Brian Huffman
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
     3
*)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
     4
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
     5
header {* Frechet Derivative *}
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
     6
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
     7
theory FrechetDeriv
30663
0b6aff7451b2 Main is (Complex_Main) base entry point in library theories
haftmann
parents: 30273
diff changeset
     8
imports Lim Complex_Main
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
     9
begin
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    10
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    11
definition
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    12
  fderiv ::
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    13
  "['a::real_normed_vector \<Rightarrow> 'b::real_normed_vector, 'a, 'a \<Rightarrow> 'b] \<Rightarrow> bool"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    14
    -- {* Frechet derivative: D is derivative of function f at x *}
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    15
          ("(FDERIV (_)/ (_)/ :> (_))" [1000, 1000, 60] 60) where
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    16
  "FDERIV f x :> D = (bounded_linear D \<and>
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    17
    (\<lambda>h. norm (f (x + h) - f x - D h) / norm h) -- 0 --> 0)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    18
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    19
lemma FDERIV_I:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    20
  "\<lbrakk>bounded_linear D; (\<lambda>h. norm (f (x + h) - f x - D h) / norm h) -- 0 --> 0\<rbrakk>
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    21
   \<Longrightarrow> FDERIV f x :> D"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    22
by (simp add: fderiv_def)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    23
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    24
lemma FDERIV_D:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    25
  "FDERIV f x :> D \<Longrightarrow> (\<lambda>h. norm (f (x + h) - f x - D h) / norm h) -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    26
by (simp add: fderiv_def)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    27
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    28
lemma FDERIV_bounded_linear: "FDERIV f x :> D \<Longrightarrow> bounded_linear D"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    29
by (simp add: fderiv_def)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    30
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    31
lemma bounded_linear_zero:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    32
  "bounded_linear (\<lambda>x::'a::real_normed_vector. 0::'b::real_normed_vector)"
28823
dcbef866c9e2 tuned unfold_locales invocation
haftmann
parents: 27611
diff changeset
    33
proof
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    34
  show "(0::'b) = 0 + 0" by simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    35
  fix r show "(0::'b) = scaleR r 0" by simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    36
  have "\<forall>x::'a. norm (0::'b) \<le> norm x * 0" by simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    37
  thus "\<exists>K. \<forall>x::'a. norm (0::'b) \<le> norm x * K" ..
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    38
qed
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    39
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    40
lemma FDERIV_const: "FDERIV (\<lambda>x. k) x :> (\<lambda>h. 0)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    41
by (simp add: fderiv_def bounded_linear_zero)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    42
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    43
lemma bounded_linear_ident:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    44
  "bounded_linear (\<lambda>x::'a::real_normed_vector. x)"
28823
dcbef866c9e2 tuned unfold_locales invocation
haftmann
parents: 27611
diff changeset
    45
proof
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    46
  fix x y :: 'a show "x + y = x + y" by simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    47
  fix r and x :: 'a show "scaleR r x = scaleR r x" by simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    48
  have "\<forall>x::'a. norm x \<le> norm x * 1" by simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    49
  thus "\<exists>K. \<forall>x::'a. norm x \<le> norm x * K" ..
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    50
qed
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    51
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    52
lemma FDERIV_ident: "FDERIV (\<lambda>x. x) x :> (\<lambda>h. h)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    53
by (simp add: fderiv_def bounded_linear_ident)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    54
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    55
subsection {* Addition *}
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    56
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    57
lemma add_diff_add:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    58
  fixes a b c d :: "'a::ab_group_add"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    59
  shows "(a + c) - (b + d) = (a - b) + (c - d)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    60
by simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    61
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    62
lemma bounded_linear_add:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
    63
  assumes "bounded_linear f"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
    64
  assumes "bounded_linear g"
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    65
  shows "bounded_linear (\<lambda>x. f x + g x)"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
    66
proof -
29233
ce6d35a0bed6 Ported HOL and HOL-Library to new locales.
ballarin
parents: 28952
diff changeset
    67
  interpret f: bounded_linear f by fact
ce6d35a0bed6 Ported HOL and HOL-Library to new locales.
ballarin
parents: 28952
diff changeset
    68
  interpret g: bounded_linear g by fact
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
    69
  show ?thesis apply (unfold_locales)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
    70
    apply (simp only: f.add g.add add_ac)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
    71
    apply (simp only: f.scaleR g.scaleR scaleR_right_distrib)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
    72
    apply (rule f.pos_bounded [THEN exE], rename_tac Kf)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
    73
    apply (rule g.pos_bounded [THEN exE], rename_tac Kg)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
    74
    apply (rule_tac x="Kf + Kg" in exI, safe)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
    75
    apply (subst right_distrib)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
    76
    apply (rule order_trans [OF norm_triangle_ineq])
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
    77
    apply (rule add_mono, erule spec, erule spec)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
    78
    done
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
    79
qed
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    80
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    81
lemma norm_ratio_ineq:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    82
  fixes x y :: "'a::real_normed_vector"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    83
  fixes h :: "'b::real_normed_vector"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    84
  shows "norm (x + y) / norm h \<le> norm x / norm h + norm y / norm h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    85
apply (rule ord_le_eq_trans)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    86
apply (rule divide_right_mono)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    87
apply (rule norm_triangle_ineq)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    88
apply (rule norm_ge_zero)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    89
apply (rule add_divide_distrib)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    90
done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    91
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    92
lemma FDERIV_add:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    93
  assumes f: "FDERIV f x :> F"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    94
  assumes g: "FDERIV g x :> G"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    95
  shows "FDERIV (\<lambda>x. f x + g x) x :> (\<lambda>h. F h + G h)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    96
proof (rule FDERIV_I)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    97
  show "bounded_linear (\<lambda>h. F h + G h)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    98
    apply (rule bounded_linear_add)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
    99
    apply (rule FDERIV_bounded_linear [OF f])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   100
    apply (rule FDERIV_bounded_linear [OF g])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   101
    done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   102
next
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   103
  have f': "(\<lambda>h. norm (f (x + h) - f x - F h) / norm h) -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   104
    using f by (rule FDERIV_D)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   105
  have g': "(\<lambda>h. norm (g (x + h) - g x - G h) / norm h) -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   106
    using g by (rule FDERIV_D)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   107
  from f' g'
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   108
  have "(\<lambda>h. norm (f (x + h) - f x - F h) / norm h
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   109
           + norm (g (x + h) - g x - G h) / norm h) -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   110
    by (rule LIM_add_zero)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   111
  thus "(\<lambda>h. norm (f (x + h) + g (x + h) - (f x + g x) - (F h + G h))
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   112
           / norm h) -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   113
    apply (rule real_LIM_sandwich_zero)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   114
     apply (simp add: divide_nonneg_pos)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   115
    apply (simp only: add_diff_add)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   116
    apply (rule norm_ratio_ineq)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   117
    done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   118
qed
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   119
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   120
subsection {* Subtraction *}
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   121
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   122
lemma bounded_linear_minus:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   123
  assumes "bounded_linear f"
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   124
  shows "bounded_linear (\<lambda>x. - f x)"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   125
proof -
29233
ce6d35a0bed6 Ported HOL and HOL-Library to new locales.
ballarin
parents: 28952
diff changeset
   126
  interpret f: bounded_linear f by fact
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   127
  show ?thesis apply (unfold_locales)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   128
    apply (simp add: f.add)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   129
    apply (simp add: f.scaleR)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   130
    apply (simp add: f.bounded)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   131
    done
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   132
qed
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   133
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   134
lemma FDERIV_minus:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   135
  "FDERIV f x :> F \<Longrightarrow> FDERIV (\<lambda>x. - f x) x :> (\<lambda>h. - F h)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   136
apply (rule FDERIV_I)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   137
apply (rule bounded_linear_minus)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   138
apply (erule FDERIV_bounded_linear)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   139
apply (simp only: fderiv_def minus_diff_minus norm_minus_cancel)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   140
done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   141
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   142
lemma FDERIV_diff:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   143
  "\<lbrakk>FDERIV f x :> F; FDERIV g x :> G\<rbrakk>
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   144
   \<Longrightarrow> FDERIV (\<lambda>x. f x - g x) x :> (\<lambda>h. F h - G h)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   145
by (simp only: diff_minus FDERIV_add FDERIV_minus)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   146
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   147
subsection {* Continuity *}
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   148
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   149
lemma FDERIV_isCont:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   150
  assumes f: "FDERIV f x :> F"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   151
  shows "isCont f x"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   152
proof -
29233
ce6d35a0bed6 Ported HOL and HOL-Library to new locales.
ballarin
parents: 28952
diff changeset
   153
  from f interpret F: bounded_linear "F" by (rule FDERIV_bounded_linear)
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   154
  have "(\<lambda>h. norm (f (x + h) - f x - F h) / norm h) -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   155
    by (rule FDERIV_D [OF f])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   156
  hence "(\<lambda>h. norm (f (x + h) - f x - F h) / norm h * norm h) -- 0 --> 0"
28866
30cd9d89a0fb reactivated some dead theories (based on hints by Mark Hillebrand);
wenzelm
parents: 28823
diff changeset
   157
    by (intro LIM_mult_zero LIM_norm_zero LIM_ident)
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   158
  hence "(\<lambda>h. norm (f (x + h) - f x - F h)) -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   159
    by (simp cong: LIM_cong)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   160
  hence "(\<lambda>h. f (x + h) - f x - F h) -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   161
    by (rule LIM_norm_zero_cancel)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   162
  hence "(\<lambda>h. f (x + h) - f x - F h + F h) -- 0 --> 0"
28866
30cd9d89a0fb reactivated some dead theories (based on hints by Mark Hillebrand);
wenzelm
parents: 28823
diff changeset
   163
    by (intro LIM_add_zero F.LIM_zero LIM_ident)
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   164
  hence "(\<lambda>h. f (x + h) - f x) -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   165
    by simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   166
  thus "isCont f x"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   167
    unfolding isCont_iff by (rule LIM_zero_cancel)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   168
qed
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   169
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   170
subsection {* Composition *}
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   171
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   172
lemma real_divide_cancel_lemma:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   173
  fixes a b c :: real
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   174
  shows "(b = 0 \<Longrightarrow> a = 0) \<Longrightarrow> (a / b) * (b / c) = a / c"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   175
by simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   176
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   177
lemma bounded_linear_compose:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   178
  assumes "bounded_linear f"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   179
  assumes "bounded_linear g"
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   180
  shows "bounded_linear (\<lambda>x. f (g x))"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   181
proof -
29233
ce6d35a0bed6 Ported HOL and HOL-Library to new locales.
ballarin
parents: 28952
diff changeset
   182
  interpret f: bounded_linear f by fact
ce6d35a0bed6 Ported HOL and HOL-Library to new locales.
ballarin
parents: 28952
diff changeset
   183
  interpret g: bounded_linear g by fact
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   184
  show ?thesis proof (unfold_locales)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   185
    fix x y show "f (g (x + y)) = f (g x) + f (g y)"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   186
      by (simp only: f.add g.add)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   187
  next
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   188
    fix r x show "f (g (scaleR r x)) = scaleR r (f (g x))"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   189
      by (simp only: f.scaleR g.scaleR)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   190
  next
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   191
    from f.pos_bounded
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   192
    obtain Kf where f: "\<And>x. norm (f x) \<le> norm x * Kf" and Kf: "0 < Kf" by fast
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   193
    from g.pos_bounded
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   194
    obtain Kg where g: "\<And>x. norm (g x) \<le> norm x * Kg" by fast
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   195
    show "\<exists>K. \<forall>x. norm (f (g x)) \<le> norm x * K"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   196
    proof (intro exI allI)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   197
      fix x
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   198
      have "norm (f (g x)) \<le> norm (g x) * Kf"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   199
	using f .
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   200
      also have "\<dots> \<le> (norm x * Kg) * Kf"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   201
	using g Kf [THEN order_less_imp_le] by (rule mult_right_mono)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   202
      also have "(norm x * Kg) * Kf = norm x * (Kg * Kf)"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   203
	by (rule mult_assoc)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   204
      finally show "norm (f (g x)) \<le> norm x * (Kg * Kf)" .
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23398
diff changeset
   205
    qed
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   206
  qed
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   207
qed
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   208
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   209
lemma FDERIV_compose:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   210
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   211
  fixes g :: "'b::real_normed_vector \<Rightarrow> 'c::real_normed_vector"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   212
  assumes f: "FDERIV f x :> F"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   213
  assumes g: "FDERIV g (f x) :> G"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   214
  shows "FDERIV (\<lambda>x. g (f x)) x :> (\<lambda>h. G (F h))"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   215
proof (rule FDERIV_I)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   216
  from FDERIV_bounded_linear [OF g] FDERIV_bounded_linear [OF f]
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   217
  show "bounded_linear (\<lambda>h. G (F h))"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   218
    by (rule bounded_linear_compose)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   219
next
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   220
  let ?Rf = "\<lambda>h. f (x + h) - f x - F h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   221
  let ?Rg = "\<lambda>k. g (f x + k) - g (f x) - G k"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   222
  let ?k = "\<lambda>h. f (x + h) - f x"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   223
  let ?Nf = "\<lambda>h. norm (?Rf h) / norm h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   224
  let ?Ng = "\<lambda>h. norm (?Rg (?k h)) / norm (?k h)"
29233
ce6d35a0bed6 Ported HOL and HOL-Library to new locales.
ballarin
parents: 28952
diff changeset
   225
  from f interpret F!: bounded_linear "F" by (rule FDERIV_bounded_linear)
ce6d35a0bed6 Ported HOL and HOL-Library to new locales.
ballarin
parents: 28952
diff changeset
   226
  from g interpret G!: bounded_linear "G" by (rule FDERIV_bounded_linear)
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   227
  from F.bounded obtain kF where kF: "\<And>x. norm (F x) \<le> norm x * kF" by fast
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   228
  from G.bounded obtain kG where kG: "\<And>x. norm (G x) \<le> norm x * kG" by fast
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   229
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   230
  let ?fun2 = "\<lambda>h. ?Nf h * kG + ?Ng h * (?Nf h + kF)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   231
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   232
  show "(\<lambda>h. norm (g (f (x + h)) - g (f x) - G (F h)) / norm h) -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   233
  proof (rule real_LIM_sandwich_zero)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   234
    have Nf: "?Nf -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   235
      using FDERIV_D [OF f] .
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   236
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   237
    have Ng1: "isCont (\<lambda>k. norm (?Rg k) / norm k) 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   238
      by (simp add: isCont_def FDERIV_D [OF g])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   239
    have Ng2: "?k -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   240
      apply (rule LIM_zero)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   241
      apply (fold isCont_iff)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   242
      apply (rule FDERIV_isCont [OF f])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   243
      done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   244
    have Ng: "?Ng -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   245
      using isCont_LIM_compose [OF Ng1 Ng2] by simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   246
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   247
    have "(\<lambda>h. ?Nf h * kG + ?Ng h * (?Nf h + kF))
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   248
           -- 0 --> 0 * kG + 0 * (0 + kF)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   249
      by (intro LIM_add LIM_mult LIM_const Nf Ng)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   250
    thus "(\<lambda>h. ?Nf h * kG + ?Ng h * (?Nf h + kF)) -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   251
      by simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   252
  next
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   253
    fix h::'a assume h: "h \<noteq> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   254
    thus "0 \<le> norm (g (f (x + h)) - g (f x) - G (F h)) / norm h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   255
      by (simp add: divide_nonneg_pos)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   256
  next
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   257
    fix h::'a assume h: "h \<noteq> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   258
    have "g (f (x + h)) - g (f x) - G (F h) = G (?Rf h) + ?Rg (?k h)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   259
      by (simp add: G.diff)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   260
    hence "norm (g (f (x + h)) - g (f x) - G (F h)) / norm h
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   261
           = norm (G (?Rf h) + ?Rg (?k h)) / norm h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   262
      by (rule arg_cong)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   263
    also have "\<dots> \<le> norm (G (?Rf h)) / norm h + norm (?Rg (?k h)) / norm h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   264
      by (rule norm_ratio_ineq)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   265
    also have "\<dots> \<le> ?Nf h * kG + ?Ng h * (?Nf h + kF)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   266
    proof (rule add_mono)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   267
      show "norm (G (?Rf h)) / norm h \<le> ?Nf h * kG"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   268
        apply (rule ord_le_eq_trans)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   269
        apply (rule divide_right_mono [OF kG norm_ge_zero])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   270
        apply simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   271
        done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   272
    next
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   273
      have "norm (?Rg (?k h)) / norm h = ?Ng h * (norm (?k h) / norm h)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   274
        apply (rule real_divide_cancel_lemma [symmetric])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   275
        apply (simp add: G.zero)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   276
        done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   277
      also have "\<dots> \<le> ?Ng h * (?Nf h + kF)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   278
      proof (rule mult_left_mono)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   279
        have "norm (?k h) / norm h = norm (?Rf h + F h) / norm h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   280
          by simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   281
        also have "\<dots> \<le> ?Nf h + norm (F h) / norm h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   282
          by (rule norm_ratio_ineq)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   283
        also have "\<dots> \<le> ?Nf h + kF"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   284
          apply (rule add_left_mono)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   285
          apply (subst pos_divide_le_eq, simp add: h)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   286
          apply (subst mult_commute)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   287
          apply (rule kF)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   288
          done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   289
        finally show "norm (?k h) / norm h \<le> ?Nf h + kF" .
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   290
      next
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   291
        show "0 \<le> ?Ng h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   292
        apply (case_tac "f (x + h) - f x = 0", simp)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   293
        apply (rule divide_nonneg_pos [OF norm_ge_zero])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   294
        apply simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   295
        done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   296
      qed
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   297
      finally show "norm (?Rg (?k h)) / norm h \<le> ?Ng h * (?Nf h + kF)" .
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   298
    qed
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   299
    finally show "norm (g (f (x + h)) - g (f x) - G (F h)) / norm h
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   300
        \<le> ?Nf h * kG + ?Ng h * (?Nf h + kF)" .
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   301
  qed
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   302
qed
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   303
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   304
subsection {* Product Rule *}
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   305
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   306
lemma (in bounded_bilinear) FDERIV_lemma:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   307
  "a' ** b' - a ** b - (a ** B + A ** b)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   308
   = a ** (b' - b - B) + (a' - a - A) ** b' + A ** (b' - b)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   309
by (simp add: diff_left diff_right)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   310
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   311
lemma (in bounded_bilinear) FDERIV:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   312
  fixes x :: "'d::real_normed_vector"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   313
  assumes f: "FDERIV f x :> F"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   314
  assumes g: "FDERIV g x :> G"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   315
  shows "FDERIV (\<lambda>x. f x ** g x) x :> (\<lambda>h. f x ** G h + F h ** g x)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   316
proof (rule FDERIV_I)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   317
  show "bounded_linear (\<lambda>h. f x ** G h + F h ** g x)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   318
    apply (rule bounded_linear_add)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   319
    apply (rule bounded_linear_compose [OF bounded_linear_right])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   320
    apply (rule FDERIV_bounded_linear [OF g])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   321
    apply (rule bounded_linear_compose [OF bounded_linear_left])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   322
    apply (rule FDERIV_bounded_linear [OF f])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   323
    done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   324
next
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   325
  from bounded_linear.bounded [OF FDERIV_bounded_linear [OF f]]
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   326
  obtain KF where norm_F: "\<And>x. norm (F x) \<le> norm x * KF" by fast
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   327
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   328
  from pos_bounded obtain K where K: "0 < K" and norm_prod:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   329
    "\<And>a b. norm (a ** b) \<le> norm a * norm b * K" by fast
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   330
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   331
  let ?Rf = "\<lambda>h. f (x + h) - f x - F h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   332
  let ?Rg = "\<lambda>h. g (x + h) - g x - G h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   333
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   334
  let ?fun1 = "\<lambda>h.
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   335
        norm (f x ** ?Rg h + ?Rf h ** g (x + h) + F h ** (g (x + h) - g x)) /
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   336
        norm h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   337
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   338
  let ?fun2 = "\<lambda>h.
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   339
        norm (f x) * (norm (?Rg h) / norm h) * K +
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   340
        norm (?Rf h) / norm h * norm (g (x + h)) * K +
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   341
        KF * norm (g (x + h) - g x) * K"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   342
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   343
  have "?fun1 -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   344
  proof (rule real_LIM_sandwich_zero)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   345
    from f g isCont_iff [THEN iffD1, OF FDERIV_isCont [OF g]]
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   346
    have "?fun2 -- 0 -->
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   347
          norm (f x) * 0 * K + 0 * norm (g x) * K + KF * norm (0::'b) * K"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   348
      by (intro LIM_add LIM_mult LIM_const LIM_norm LIM_zero FDERIV_D)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   349
    thus "?fun2 -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   350
      by simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   351
  next
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   352
    fix h::'d assume "h \<noteq> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   353
    thus "0 \<le> ?fun1 h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   354
      by (simp add: divide_nonneg_pos)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   355
  next
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   356
    fix h::'d assume "h \<noteq> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   357
    have "?fun1 h \<le> (norm (f x) * norm (?Rg h) * K +
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   358
         norm (?Rf h) * norm (g (x + h)) * K +
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   359
         norm h * KF * norm (g (x + h) - g x) * K) / norm h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   360
      by (intro
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   361
        divide_right_mono mult_mono'
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   362
        order_trans [OF norm_triangle_ineq add_mono]
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   363
        order_trans [OF norm_prod mult_right_mono]
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   364
        mult_nonneg_nonneg order_refl norm_ge_zero norm_F
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   365
        K [THEN order_less_imp_le]
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   366
      )
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   367
    also have "\<dots> = ?fun2 h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   368
      by (simp add: add_divide_distrib)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   369
    finally show "?fun1 h \<le> ?fun2 h" .
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   370
  qed
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   371
  thus "(\<lambda>h.
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   372
    norm (f (x + h) ** g (x + h) - f x ** g x - (f x ** G h + F h ** g x))
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   373
    / norm h) -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   374
    by (simp only: FDERIV_lemma)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   375
qed
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   376
29233
ce6d35a0bed6 Ported HOL and HOL-Library to new locales.
ballarin
parents: 28952
diff changeset
   377
lemmas FDERIV_mult = mult.FDERIV
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   378
29233
ce6d35a0bed6 Ported HOL and HOL-Library to new locales.
ballarin
parents: 28952
diff changeset
   379
lemmas FDERIV_scaleR = scaleR.FDERIV
28866
30cd9d89a0fb reactivated some dead theories (based on hints by Mark Hillebrand);
wenzelm
parents: 28823
diff changeset
   380
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   381
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   382
subsection {* Powers *}
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   383
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   384
lemma FDERIV_power_Suc:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   385
  fixes x :: "'a::{real_normed_algebra,recpower,comm_ring_1}"
28866
30cd9d89a0fb reactivated some dead theories (based on hints by Mark Hillebrand);
wenzelm
parents: 28823
diff changeset
   386
  shows "FDERIV (\<lambda>x. x ^ Suc n) x :> (\<lambda>h. (1 + of_nat n) * x ^ n * h)"
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   387
 apply (induct n)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   388
  apply (simp add: power_Suc FDERIV_ident)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   389
 apply (drule FDERIV_mult [OF FDERIV_ident])
28866
30cd9d89a0fb reactivated some dead theories (based on hints by Mark Hillebrand);
wenzelm
parents: 28823
diff changeset
   390
 apply (simp only: of_nat_Suc left_distrib mult_1_left)
30cd9d89a0fb reactivated some dead theories (based on hints by Mark Hillebrand);
wenzelm
parents: 28823
diff changeset
   391
 apply (simp only: power_Suc right_distrib add_ac mult_ac)
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   392
done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   393
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   394
lemma FDERIV_power:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   395
  fixes x :: "'a::{real_normed_algebra,recpower,comm_ring_1}"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   396
  shows "FDERIV (\<lambda>x. x ^ n) x :> (\<lambda>h. of_nat n * x ^ (n - 1) * h)"
28866
30cd9d89a0fb reactivated some dead theories (based on hints by Mark Hillebrand);
wenzelm
parents: 28823
diff changeset
   397
  apply (cases n)
30cd9d89a0fb reactivated some dead theories (based on hints by Mark Hillebrand);
wenzelm
parents: 28823
diff changeset
   398
   apply (simp add: FDERIV_const)
30273
ecd6f0ca62ea declare power_Suc [simp]; remove redundant type-specific versions of power_Suc
huffman
parents: 29986
diff changeset
   399
  apply (simp add: FDERIV_power_Suc del: power_Suc)
28866
30cd9d89a0fb reactivated some dead theories (based on hints by Mark Hillebrand);
wenzelm
parents: 28823
diff changeset
   400
  done
30cd9d89a0fb reactivated some dead theories (based on hints by Mark Hillebrand);
wenzelm
parents: 28823
diff changeset
   401
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   402
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   403
subsection {* Inverse *}
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   404
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   405
lemma inverse_diff_inverse:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   406
  "\<lbrakk>(a::'a::division_ring) \<noteq> 0; b \<noteq> 0\<rbrakk>
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   407
   \<Longrightarrow> inverse a - inverse b = - (inverse a * (a - b) * inverse b)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   408
by (simp add: right_diff_distrib left_diff_distrib mult_assoc)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   409
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   410
lemmas bounded_linear_mult_const =
29233
ce6d35a0bed6 Ported HOL and HOL-Library to new locales.
ballarin
parents: 28952
diff changeset
   411
  mult.bounded_linear_left [THEN bounded_linear_compose]
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   412
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   413
lemmas bounded_linear_const_mult =
29233
ce6d35a0bed6 Ported HOL and HOL-Library to new locales.
ballarin
parents: 28952
diff changeset
   414
  mult.bounded_linear_right [THEN bounded_linear_compose]
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   415
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   416
lemma FDERIV_inverse:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   417
  fixes x :: "'a::real_normed_div_algebra"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   418
  assumes x: "x \<noteq> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   419
  shows "FDERIV inverse x :> (\<lambda>h. - (inverse x * h * inverse x))"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   420
        (is "FDERIV ?inv _ :> _")
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   421
proof (rule FDERIV_I)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   422
  show "bounded_linear (\<lambda>h. - (?inv x * h * ?inv x))"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   423
    apply (rule bounded_linear_minus)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   424
    apply (rule bounded_linear_mult_const)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   425
    apply (rule bounded_linear_const_mult)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   426
    apply (rule bounded_linear_ident)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   427
    done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   428
next
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   429
  show "(\<lambda>h. norm (?inv (x + h) - ?inv x - - (?inv x * h * ?inv x)) / norm h)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   430
        -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   431
  proof (rule LIM_equal2)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   432
    show "0 < norm x" using x by simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   433
  next
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   434
    fix h::'a
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   435
    assume 1: "h \<noteq> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   436
    assume "norm (h - 0) < norm x"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   437
    hence "h \<noteq> -x" by clarsimp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   438
    hence 2: "x + h \<noteq> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   439
      apply (rule contrapos_nn)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   440
      apply (rule sym)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   441
      apply (erule equals_zero_I)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   442
      done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   443
    show "norm (?inv (x + h) - ?inv x - - (?inv x * h * ?inv x)) / norm h
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   444
          = norm ((?inv (x + h) - ?inv x) * h * ?inv x) / norm h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   445
      apply (subst inverse_diff_inverse [OF 2 x])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   446
      apply (subst minus_diff_minus)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   447
      apply (subst norm_minus_cancel)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   448
      apply (simp add: left_diff_distrib)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   449
      done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   450
  next
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   451
    show "(\<lambda>h. norm ((?inv (x + h) - ?inv x) * h * ?inv x) / norm h)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   452
          -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   453
    proof (rule real_LIM_sandwich_zero)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   454
      show "(\<lambda>h. norm (?inv (x + h) - ?inv x) * norm (?inv x))
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   455
            -- 0 --> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   456
        apply (rule LIM_mult_left_zero)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   457
        apply (rule LIM_norm_zero)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   458
        apply (rule LIM_zero)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   459
        apply (rule LIM_offset_zero)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   460
        apply (rule LIM_inverse)
28866
30cd9d89a0fb reactivated some dead theories (based on hints by Mark Hillebrand);
wenzelm
parents: 28823
diff changeset
   461
        apply (rule LIM_ident)
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   462
        apply (rule x)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   463
        done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   464
    next
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   465
      fix h::'a assume h: "h \<noteq> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   466
      show "0 \<le> norm ((?inv (x + h) - ?inv x) * h * ?inv x) / norm h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   467
        apply (rule divide_nonneg_pos)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   468
        apply (rule norm_ge_zero)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   469
        apply (simp add: h)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   470
        done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   471
    next
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   472
      fix h::'a assume h: "h \<noteq> 0"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   473
      have "norm ((?inv (x + h) - ?inv x) * h * ?inv x) / norm h
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   474
            \<le> norm (?inv (x + h) - ?inv x) * norm h * norm (?inv x) / norm h"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   475
        apply (rule divide_right_mono [OF _ norm_ge_zero])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   476
        apply (rule order_trans [OF norm_mult_ineq])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   477
        apply (rule mult_right_mono [OF _ norm_ge_zero])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   478
        apply (rule norm_mult_ineq)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   479
        done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   480
      also have "\<dots> = norm (?inv (x + h) - ?inv x) * norm (?inv x)"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   481
        by simp
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   482
      finally show "norm ((?inv (x + h) - ?inv x) * h * ?inv x) / norm h
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   483
            \<le> norm (?inv (x + h) - ?inv x) * norm (?inv x)" .   
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   484
    qed
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   485
  qed
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   486
qed
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   487
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   488
subsection {* Alternate definition *}
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   489
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   490
lemma field_fderiv_def:
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   491
  fixes x :: "'a::real_normed_field" shows
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   492
  "FDERIV f x :> (\<lambda>h. h * D) = (\<lambda>h. (f (x + h) - f x) / h) -- 0 --> D"
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   493
 apply (unfold fderiv_def)
29233
ce6d35a0bed6 Ported HOL and HOL-Library to new locales.
ballarin
parents: 28952
diff changeset
   494
 apply (simp add: mult.bounded_linear_left)
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   495
 apply (simp cong: LIM_cong add: nonzero_norm_divide [symmetric])
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   496
 apply (subst diff_divide_distrib)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   497
 apply (subst times_divide_eq_left [symmetric])
23398
0b5a400c7595 made divide_self a simp rule
nipkow
parents: 22720
diff changeset
   498
 apply (simp cong: LIM_cong)
21776
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   499
 apply (simp add: LIM_norm_zero_iff LIM_zero_iff)
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   500
done
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   501
e65109e168f3 theory of Frechet derivatives
huffman
parents:
diff changeset
   502
end