src/HOL/Analysis/Derivative.thy
author paulson <lp15@cam.ac.uk>
Thu, 19 Sep 2019 13:59:29 +0100
changeset 70725 e19c18b4a0dd
parent 70641 0e2a065d6f31
child 70737 e4825ec20468
permissions -rw-r--r--
Four new results from Smooth_Manifolds/Analysis_More
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
63627
6ddb43c6b711 rename HOL-Multivariate_Analysis to HOL-Analysis.
hoelzl
parents: 63469
diff changeset
     1
(*  Title:      HOL/Analysis/Derivative.thy
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
     2
    Author:     John Harrison
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
     3
    Author:     Robert Himmelmann, TU Muenchen (translation from HOL Light); tidied by LCP
36350
bc7982c54e37 dropped group_simps, ring_simps, field_eq_simps
haftmann
parents: 36334
diff changeset
     4
*)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
     5
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
     6
section \<open>Derivative\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
     7
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
     8
theory Derivative
70620
f95193669ad7 removed Brouwer_Fixpoint from imports of Derivative
immler
parents: 70614
diff changeset
     9
  imports
70641
0e2a065d6f31 Theory Derivative no longer depends on Path_Connected
paulson <lp15@cam.ac.uk>
parents: 70620
diff changeset
    10
    Starlike
70620
f95193669ad7 removed Brouwer_Fixpoint from imports of Derivative
immler
parents: 70614
diff changeset
    11
    Operator_Norm
f95193669ad7 removed Brouwer_Fixpoint from imports of Derivative
immler
parents: 70614
diff changeset
    12
    Uniform_Limit
f95193669ad7 removed Brouwer_Fixpoint from imports of Derivative
immler
parents: 70614
diff changeset
    13
    Bounded_Linear_Function
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    14
begin
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    15
63938
f6ce08859d4c More mainly topological results
paulson <lp15@cam.ac.uk>
parents: 63918
diff changeset
    16
declare bounded_linear_inner_left [intro]
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61907
diff changeset
    17
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
    18
declare has_derivative_bounded_linear[dest]
44137
ac5cb4c86448 simplify some proofs
huffman
parents: 44125
diff changeset
    19
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
    20
subsection \<open>Derivatives\<close>
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    21
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    22
lemma has_derivative_add_const:
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    23
  "(f has_derivative f') net \<Longrightarrow> ((\<lambda>x. f x + c) has_derivative f') net"
56381
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
    24
  by (intro derivative_eq_intros) auto
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    25
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    26
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70065
diff changeset
    27
subsection\<^marker>\<open>tag unimportant\<close> \<open>Derivative with composed bilinear function\<close>
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    28
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
    29
text \<open>More explicit epsilon-delta forms.\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    30
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
    31
proposition has_derivative_within':
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    32
  "(f has_derivative f')(at x within s) \<longleftrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    33
    bounded_linear f' \<and>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    34
    (\<forall>e>0. \<exists>d>0. \<forall>x'\<in>s. 0 < norm (x' - x) \<and> norm (x' - x) < d \<longrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    35
      norm (f x' - f x - f'(x' - x)) / norm (x' - x) < e)"
36587
534418d8d494 remove redundant lemma vector_dist_norm
huffman
parents: 36581
diff changeset
    36
  unfolding has_derivative_within Lim_within dist_norm
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    37
  by (simp add: diff_diff_eq)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    38
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    39
lemma has_derivative_at':
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
    40
  "(f has_derivative f') (at x) 
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
    41
   \<longleftrightarrow> bounded_linear f' \<and>
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
    42
       (\<forall>e>0. \<exists>d>0. \<forall>x'. 0 < norm (x' - x) \<and> norm (x' - x) < d \<longrightarrow>
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
    43
        norm (f x' - f x - f'(x' - x)) / norm (x' - x) < e)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
    44
  using has_derivative_within' [of f f' x UNIV] by simp
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    45
70614
6a2c982363e9 moved lemmas
nipkow
parents: 70532
diff changeset
    46
lemma has_derivative_componentwise_within:
6a2c982363e9 moved lemmas
nipkow
parents: 70532
diff changeset
    47
   "(f has_derivative f') (at a within S) \<longleftrightarrow>
6a2c982363e9 moved lemmas
nipkow
parents: 70532
diff changeset
    48
    (\<forall>i \<in> Basis. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>x. f' x \<bullet> i)) (at a within S))"
6a2c982363e9 moved lemmas
nipkow
parents: 70532
diff changeset
    49
  apply (simp add: has_derivative_within)
6a2c982363e9 moved lemmas
nipkow
parents: 70532
diff changeset
    50
  apply (subst tendsto_componentwise_iff)
6a2c982363e9 moved lemmas
nipkow
parents: 70532
diff changeset
    51
  apply (simp add: bounded_linear_componentwise_iff [symmetric] ball_conj_distrib)
6a2c982363e9 moved lemmas
nipkow
parents: 70532
diff changeset
    52
  apply (simp add: algebra_simps)
6a2c982363e9 moved lemmas
nipkow
parents: 70532
diff changeset
    53
  done
6a2c982363e9 moved lemmas
nipkow
parents: 70532
diff changeset
    54
67979
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
    55
lemma has_derivative_at_withinI:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    56
  "(f has_derivative f') (at x) \<Longrightarrow> (f has_derivative f') (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    57
  unfolding has_derivative_within' has_derivative_at'
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    58
  by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    59
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    60
lemma has_derivative_within_open:
68095
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
    61
  "a \<in> S \<Longrightarrow> open S \<Longrightarrow>
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
    62
    (f has_derivative f') (at a within S) \<longleftrightarrow> (f has_derivative f') (at a)"
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    63
  by (simp only: at_within_interior interior_open)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    64
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
    65
lemma has_derivative_right:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    66
  fixes f :: "real \<Rightarrow> real"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    67
    and y :: "real"
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 69020
diff changeset
    68
  shows "(f has_derivative ((*) y)) (at x within ({x <..} \<inter> I)) \<longleftrightarrow>
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
    69
         ((\<lambda>t. (f x - f t) / (x - t)) \<longlongrightarrow> y) (at x within ({x <..} \<inter> I))"
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
    70
proof -
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
    71
  have "((\<lambda>t. (f t - (f x + y * (t - x))) / \<bar>t - x\<bar>) \<longlongrightarrow> 0) (at x within ({x<..} \<inter> I)) \<longleftrightarrow>
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
    72
    ((\<lambda>t. (f t - f x) / (t - x) - y) \<longlongrightarrow> 0) (at x within ({x<..} \<inter> I))"
44282
f0de18b62d63 remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents: 44140
diff changeset
    73
    by (intro Lim_cong_within) (auto simp add: diff_divide_distrib add_divide_distrib)
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
    74
  also have "\<dots> \<longleftrightarrow> ((\<lambda>t. (f t - f x) / (t - x)) \<longlongrightarrow> y) (at x within ({x<..} \<inter> I))"
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
    75
    by (simp add: Lim_null[symmetric])
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
    76
  also have "\<dots> \<longleftrightarrow> ((\<lambda>t. (f x - f t) / (x - t)) \<longlongrightarrow> y) (at x within ({x<..} \<inter> I))"
44140
2c10c35dd4be remove several redundant and unused theorems about derivatives
huffman
parents: 44137
diff changeset
    77
    by (intro Lim_cong_within) (simp_all add: field_simps)
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
    78
  finally show ?thesis
44282
f0de18b62d63 remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents: 44140
diff changeset
    79
    by (simp add: bounded_linear_mult_right has_derivative_within)
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
    80
qed
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
    81
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
    82
subsubsection \<open>Caratheodory characterization\<close>
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
    83
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
    84
lemma DERIV_caratheodory_within:
68095
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
    85
  "(f has_field_derivative l) (at x within S) \<longleftrightarrow>
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
    86
   (\<exists>g. (\<forall>z. f z - f x = g z * (z - x)) \<and> continuous (at x within S) g \<and> g x = l)"
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
    87
      (is "?lhs = ?rhs")
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
    88
proof
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
    89
  assume ?lhs
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
    90
  show ?rhs
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
    91
  proof (intro exI conjI)
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
    92
    let ?g = "(%z. if z = x then l else (f z - f x) / (z-x))"
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
    93
    show "\<forall>z. f z - f x = ?g z * (z-x)" by simp
68095
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
    94
    show "continuous (at x within S) ?g" using \<open>?lhs\<close>
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
    95
      by (auto simp add: continuous_within has_field_derivative_iff cong: Lim_cong_within)
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
    96
    show "?g x = l" by simp
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
    97
  qed
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
    98
next
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
    99
  assume ?rhs
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   100
  then obtain g where
68095
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
   101
    "(\<forall>z. f z - f x = g z * (z-x))" and "continuous (at x within S) g" and "g x = l" by blast
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   102
  thus ?lhs
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   103
    by (auto simp add: continuous_within has_field_derivative_iff cong: Lim_cong_within)
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   104
qed
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   105
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   106
subsection \<open>Differentiability\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   107
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70065
diff changeset
   108
definition\<^marker>\<open>tag important\<close>
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   109
  differentiable_on :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a set \<Rightarrow> bool"
56182
528fae0816ea update syntax of has_*derivative to infix 50; fixed proofs
hoelzl
parents: 56181
diff changeset
   110
    (infix "differentiable'_on" 50)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   111
  where "f differentiable_on s \<longleftrightarrow> (\<forall>x\<in>s. f differentiable (at x within s))"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   112
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   113
lemma differentiableI: "(f has_derivative f') net \<Longrightarrow> f differentiable net"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   114
  unfolding differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   115
  by auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   116
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62408
diff changeset
   117
lemma differentiable_onD: "\<lbrakk>f differentiable_on S; x \<in> S\<rbrakk> \<Longrightarrow> f differentiable (at x within S)"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62408
diff changeset
   118
  using differentiable_on_def by blast
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62408
diff changeset
   119
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   120
lemma differentiable_at_withinI: "f differentiable (at x) \<Longrightarrow> f differentiable (at x within s)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   121
  unfolding differentiable_def
67979
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
   122
  using has_derivative_at_withinI
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   123
  by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   124
61104
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
   125
lemma differentiable_at_imp_differentiable_on:
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
   126
  "(\<And>x. x \<in> s \<Longrightarrow> f differentiable at x) \<Longrightarrow> f differentiable_on s"
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
   127
  by (metis differentiable_at_withinI differentiable_on_def)
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
   128
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70065
diff changeset
   129
corollary\<^marker>\<open>tag unimportant\<close> differentiable_iff_scaleR:
61104
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
   130
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
   131
  shows "f differentiable F \<longleftrightarrow> (\<exists>d. (f has_derivative (\<lambda>x. x *\<^sub>R d)) F)"
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
   132
  by (auto simp: differentiable_def dest: has_derivative_linear linear_imp_scaleR)
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
   133
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   134
lemma differentiable_on_eq_differentiable_at:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   135
  "open s \<Longrightarrow> f differentiable_on s \<longleftrightarrow> (\<forall>x\<in>s. f differentiable at x)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   136
  unfolding differentiable_on_def
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51478
diff changeset
   137
  by (metis at_within_interior interior_open)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   138
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   139
lemma differentiable_transform_within:
62087
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 61975
diff changeset
   140
  assumes "f differentiable (at x within s)"
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 61975
diff changeset
   141
    and "0 < d"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   142
    and "x \<in> s"
62087
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 61975
diff changeset
   143
    and "\<And>x'. \<lbrakk>x'\<in>s; dist x' x < d\<rbrakk> \<Longrightarrow> f x' = g x'"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   144
  shows "g differentiable (at x within s)"
62087
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 61975
diff changeset
   145
   using assms has_derivative_transform_within unfolding differentiable_def
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 61975
diff changeset
   146
   by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   147
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   148
lemma differentiable_on_ident [simp, derivative_intros]: "(\<lambda>x. x) differentiable_on S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   149
  by (simp add: differentiable_at_imp_differentiable_on)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   150
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   151
lemma differentiable_on_id [simp, derivative_intros]: "id differentiable_on S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   152
  by (simp add: id_def)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   153
63955
51a3d38d2281 more new material
paulson <lp15@cam.ac.uk>
parents: 63952
diff changeset
   154
lemma differentiable_on_const [simp, derivative_intros]: "(\<lambda>z. c) differentiable_on S"
51a3d38d2281 more new material
paulson <lp15@cam.ac.uk>
parents: 63952
diff changeset
   155
  by (simp add: differentiable_on_def)
51a3d38d2281 more new material
paulson <lp15@cam.ac.uk>
parents: 63952
diff changeset
   156
51a3d38d2281 more new material
paulson <lp15@cam.ac.uk>
parents: 63952
diff changeset
   157
lemma differentiable_on_mult [simp, derivative_intros]:
51a3d38d2281 more new material
paulson <lp15@cam.ac.uk>
parents: 63952
diff changeset
   158
  fixes f :: "'M::real_normed_vector \<Rightarrow> 'a::real_normed_algebra"
51a3d38d2281 more new material
paulson <lp15@cam.ac.uk>
parents: 63952
diff changeset
   159
  shows "\<lbrakk>f differentiable_on S; g differentiable_on S\<rbrakk> \<Longrightarrow> (\<lambda>z. f z * g z) differentiable_on S"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   160
  unfolding differentiable_on_def differentiable_def
63955
51a3d38d2281 more new material
paulson <lp15@cam.ac.uk>
parents: 63952
diff changeset
   161
  using differentiable_def differentiable_mult by blast
51a3d38d2281 more new material
paulson <lp15@cam.ac.uk>
parents: 63952
diff changeset
   162
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   163
lemma differentiable_on_compose:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   164
   "\<lbrakk>g differentiable_on S; f differentiable_on (g ` S)\<rbrakk> \<Longrightarrow> (\<lambda>x. f (g x)) differentiable_on S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   165
by (simp add: differentiable_in_compose differentiable_on_def)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   166
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   167
lemma bounded_linear_imp_differentiable_on: "bounded_linear f \<Longrightarrow> f differentiable_on S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   168
  by (simp add: differentiable_on_def bounded_linear_imp_differentiable)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   169
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   170
lemma linear_imp_differentiable_on:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   171
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   172
  shows "linear f \<Longrightarrow> f differentiable_on S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   173
by (simp add: differentiable_on_def linear_imp_differentiable)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   174
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   175
lemma differentiable_on_minus [simp, derivative_intros]:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   176
   "f differentiable_on S \<Longrightarrow> (\<lambda>z. -(f z)) differentiable_on S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   177
by (simp add: differentiable_on_def)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   178
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   179
lemma differentiable_on_add [simp, derivative_intros]:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   180
   "\<lbrakk>f differentiable_on S; g differentiable_on S\<rbrakk> \<Longrightarrow> (\<lambda>z. f z + g z) differentiable_on S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   181
by (simp add: differentiable_on_def)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   182
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   183
lemma differentiable_on_diff [simp, derivative_intros]:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   184
   "\<lbrakk>f differentiable_on S; g differentiable_on S\<rbrakk> \<Longrightarrow> (\<lambda>z. f z - g z) differentiable_on S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   185
by (simp add: differentiable_on_def)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   186
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   187
lemma differentiable_on_inverse [simp, derivative_intros]:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   188
  fixes f :: "'a :: real_normed_vector \<Rightarrow> 'b :: real_normed_field"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   189
  shows "f differentiable_on S \<Longrightarrow> (\<And>x. x \<in> S \<Longrightarrow> f x \<noteq> 0) \<Longrightarrow> (\<lambda>x. inverse (f x)) differentiable_on S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   190
by (simp add: differentiable_on_def)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   191
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   192
lemma differentiable_on_scaleR [derivative_intros, simp]:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   193
   "\<lbrakk>f differentiable_on S; g differentiable_on S\<rbrakk> \<Longrightarrow> (\<lambda>x. f x *\<^sub>R g x) differentiable_on S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   194
  unfolding differentiable_on_def
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   195
  by (blast intro: differentiable_scaleR)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   196
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   197
lemma has_derivative_sqnorm_at [derivative_intros, simp]:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   198
  "((\<lambda>x. (norm x)\<^sup>2) has_derivative (\<lambda>x. 2 *\<^sub>R (a \<bullet> x))) (at a)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   199
  using bounded_bilinear.FDERIV  [of "(\<bullet>)" id id a _ id id]
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   200
  by (auto simp: inner_commute dot_square_norm bounded_bilinear_inner)
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   201
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   202
lemma differentiable_sqnorm_at [derivative_intros, simp]:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   203
  fixes a :: "'a :: {real_normed_vector,real_inner}"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   204
  shows "(\<lambda>x. (norm x)\<^sup>2) differentiable (at a)"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   205
by (force simp add: differentiable_def intro: has_derivative_sqnorm_at)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   206
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   207
lemma differentiable_on_sqnorm [derivative_intros, simp]:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   208
  fixes S :: "'a :: {real_normed_vector,real_inner} set"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   209
  shows "(\<lambda>x. (norm x)\<^sup>2) differentiable_on S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   210
by (simp add: differentiable_at_imp_differentiable_on)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   211
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   212
lemma differentiable_norm_at [derivative_intros, simp]:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   213
  fixes a :: "'a :: {real_normed_vector,real_inner}"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   214
  shows "a \<noteq> 0 \<Longrightarrow> norm differentiable (at a)"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   215
using differentiableI has_derivative_norm by blast
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   216
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   217
lemma differentiable_on_norm [derivative_intros, simp]:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   218
  fixes S :: "'a :: {real_normed_vector,real_inner} set"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   219
  shows "0 \<notin> S \<Longrightarrow> norm differentiable_on S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   220
by (metis differentiable_at_imp_differentiable_on differentiable_norm_at)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   221
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   222
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   223
subsection \<open>Frechet derivative and Jacobian matrix\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   224
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   225
definition "frechet_derivative f net = (SOME f'. (f has_derivative f') net)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   226
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
   227
proposition frechet_derivative_works:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   228
  "f differentiable net \<longleftrightarrow> (f has_derivative (frechet_derivative f net)) net"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   229
  unfolding frechet_derivative_def differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   230
  unfolding some_eq_ex[of "\<lambda> f' . (f has_derivative f') net"] ..
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   231
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   232
lemma linear_frechet_derivative: "f differentiable net \<Longrightarrow> linear (frechet_derivative f net)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   233
  unfolding frechet_derivative_works has_derivative_def
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
   234
  by (auto intro: bounded_linear.linear)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   235
70725
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   236
lemma frechet_derivative_const [simp]: "frechet_derivative (\<lambda>x. c) (at a) = (\<lambda>x. 0)"
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   237
  using differentiable_const frechet_derivative_works has_derivative_const has_derivative_unique by blast
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   238
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   239
lemma frechet_derivative_id [simp]: "frechet_derivative id (at a) = id"
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   240
  using differentiable_def frechet_derivative_works has_derivative_id has_derivative_unique by blast
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   241
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   242
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   243
subsection \<open>Differentiability implies continuity\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   244
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
   245
proposition differentiable_imp_continuous_within:
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   246
  "f differentiable (at x within s) \<Longrightarrow> continuous (at x within s) f"
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   247
  by (auto simp: differentiable_def intro: has_derivative_continuous)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   248
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   249
lemma differentiable_imp_continuous_on:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   250
  "f differentiable_on s \<Longrightarrow> continuous_on s f"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   251
  unfolding differentiable_on_def continuous_on_eq_continuous_within
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   252
  using differentiable_imp_continuous_within by blast
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   253
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   254
lemma differentiable_on_subset:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   255
  "f differentiable_on t \<Longrightarrow> s \<subseteq> t \<Longrightarrow> f differentiable_on s"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   256
  unfolding differentiable_on_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   257
  using differentiable_within_subset
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   258
  by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   259
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   260
lemma differentiable_on_empty: "f differentiable_on {}"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   261
  unfolding differentiable_on_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   262
  by auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   263
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   264
lemma has_derivative_continuous_on:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   265
  "(\<And>x. x \<in> s \<Longrightarrow> (f has_derivative f' x) (at x within s)) \<Longrightarrow> continuous_on s f"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   266
  by (auto intro!: differentiable_imp_continuous_on differentiableI simp: differentiable_on_def)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   267
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   268
text \<open>Results about neighborhoods filter.\<close>
56151
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   269
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   270
lemma eventually_nhds_metric_le:
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   271
  "eventually P (nhds a) = (\<exists>d>0. \<forall>x. dist x a \<le> d \<longrightarrow> P x)"
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   272
  unfolding eventually_nhds_metric by (safe, rule_tac x="d / 2" in exI, auto)
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   273
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   274
lemma le_nhds: "F \<le> nhds a \<longleftrightarrow> (\<forall>S. open S \<and> a \<in> S \<longrightarrow> eventually (\<lambda>x. x \<in> S) F)"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
   275
  unfolding le_filter_def eventually_nhds by (fast elim: eventually_mono)
56151
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   276
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   277
lemma le_nhds_metric: "F \<le> nhds a \<longleftrightarrow> (\<forall>e>0. eventually (\<lambda>x. dist x a < e) F)"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
   278
  unfolding le_filter_def eventually_nhds_metric by (fast elim: eventually_mono)
56151
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   279
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   280
lemma le_nhds_metric_le: "F \<le> nhds a \<longleftrightarrow> (\<forall>e>0. eventually (\<lambda>x. dist x a \<le> e) F)"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
   281
  unfolding le_filter_def eventually_nhds_metric_le by (fast elim: eventually_mono)
56151
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   282
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   283
text \<open>Several results are easier using a "multiplied-out" variant.
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   284
(I got this idea from Dieudonne's proof of the chain rule).\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   285
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   286
lemma has_derivative_within_alt:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   287
  "(f has_derivative f') (at x within s) \<longleftrightarrow> bounded_linear f' \<and>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   288
    (\<forall>e>0. \<exists>d>0. \<forall>y\<in>s. norm(y - x) < d \<longrightarrow> norm (f y - f x - f' (y - x)) \<le> e * norm (y - x))"
56151
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   289
  unfolding has_derivative_within filterlim_def le_nhds_metric_le eventually_filtermap
59815
cce82e360c2f explicit commutative additive inverse operation;
haftmann
parents: 59558
diff changeset
   290
    eventually_at dist_norm diff_diff_eq
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
   291
  by (force simp add: linear_0 bounded_linear.linear pos_divide_le_eq)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   292
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
   293
lemma has_derivative_within_alt2:
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
   294
  "(f has_derivative f') (at x within s) \<longleftrightarrow> bounded_linear f' \<and>
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
   295
    (\<forall>e>0. eventually (\<lambda>y. norm (f y - f x - f' (y - x)) \<le> e * norm (y - x)) (at x within s))"
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
   296
  unfolding has_derivative_within filterlim_def le_nhds_metric_le eventually_filtermap
59815
cce82e360c2f explicit commutative additive inverse operation;
haftmann
parents: 59558
diff changeset
   297
    eventually_at dist_norm diff_diff_eq
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
   298
  by (force simp add: linear_0 bounded_linear.linear pos_divide_le_eq)
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
   299
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   300
lemma has_derivative_at_alt:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   301
  "(f has_derivative f') (at x) \<longleftrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   302
    bounded_linear f' \<and>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   303
    (\<forall>e>0. \<exists>d>0. \<forall>y. norm(y - x) < d \<longrightarrow> norm (f y - f x - f'(y - x)) \<le> e * norm (y - x))"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   304
  using has_derivative_within_alt[where s=UNIV]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   305
  by simp
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   306
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   307
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   308
subsection \<open>The chain rule\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   309
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
   310
proposition diff_chain_within[derivative_intros]:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   311
  assumes "(f has_derivative f') (at x within s)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   312
    and "(g has_derivative g') (at (f x) within (f ` s))"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   313
  shows "((g \<circ> f) has_derivative (g' \<circ> f'))(at x within s)"
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   314
  using has_derivative_in_compose[OF assms]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   315
  by (simp add: comp_def)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   316
56381
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
   317
lemma diff_chain_at[derivative_intros]:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   318
  "(f has_derivative f') (at x) \<Longrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   319
    (g has_derivative g') (at (f x)) \<Longrightarrow> ((g \<circ> f) has_derivative (g' \<circ> f')) (at x)"
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   320
  using has_derivative_compose[of f f' x UNIV g g']
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   321
  by (simp add: comp_def)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   322
68095
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
   323
lemma has_vector_derivative_within_open:
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
   324
  "a \<in> S \<Longrightarrow> open S \<Longrightarrow>
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
   325
    (f has_vector_derivative f') (at a within S) \<longleftrightarrow> (f has_vector_derivative f') (at a)"
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
   326
  by (simp only: at_within_interior interior_open)
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
   327
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
   328
lemma field_vector_diff_chain_within:
68095
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
   329
 assumes Df: "(f has_vector_derivative f') (at x within S)"
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
   330
     and Dg: "(g has_field_derivative g') (at (f x) within f ` S)"
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
   331
 shows "((g \<circ> f) has_vector_derivative (f' * g')) (at x within S)"
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
   332
using diff_chain_within[OF Df[unfolded has_vector_derivative_def]
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
   333
                       Dg [unfolded has_field_derivative_def]]
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
   334
 by (auto simp: o_def mult.commute has_vector_derivative_def)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
   335
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
   336
lemma vector_derivative_diff_chain_within:
68095
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
   337
  assumes Df: "(f has_vector_derivative f') (at x within S)"
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
   338
     and Dg: "(g has_derivative g') (at (f x) within f`S)"
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
   339
  shows "((g \<circ> f) has_vector_derivative (g' f')) (at x within S)"
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
   340
using diff_chain_within[OF Df[unfolded has_vector_derivative_def] Dg]
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
   341
  linear.scaleR[OF has_derivative_linear[OF Dg]]
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
   342
  unfolding has_vector_derivative_def o_def
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
   343
  by (auto simp: o_def mult.commute has_vector_derivative_def)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
   344
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   345
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70065
diff changeset
   346
subsection\<^marker>\<open>tag unimportant\<close> \<open>Composition rules stated just for differentiability\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   347
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   348
lemma differentiable_chain_at:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   349
  "f differentiable (at x) \<Longrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   350
    g differentiable (at (f x)) \<Longrightarrow> (g \<circ> f) differentiable (at x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   351
  unfolding differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   352
  by (meson diff_chain_at)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   353
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   354
lemma differentiable_chain_within:
68095
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
   355
  "f differentiable (at x within S) \<Longrightarrow>
4fa3e63ecc7e starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
   356
    g differentiable (at(f x) within (f ` S)) \<Longrightarrow> (g \<circ> f) differentiable (at x within S)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   357
  unfolding differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   358
  by (meson diff_chain_within)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   359
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   360
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   361
subsection \<open>Uniqueness of derivative\<close>
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   362
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
   363
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70065
diff changeset
   364
text\<^marker>\<open>tag important\<close> \<open>
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   365
 The general result is a bit messy because we need approachability of the
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   366
 limit point from any direction. But OK for nontrivial intervals etc.
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   367
\<close>
51363
d4d00c804645 changed has_derivative_intros into a named theorems collection
hoelzl
parents: 50939
diff changeset
   368
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
   369
proposition frechet_derivative_unique_within:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   370
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   371
  assumes 1: "(f has_derivative f') (at x within S)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   372
    and 2: "(f has_derivative f'') (at x within S)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   373
    and S: "\<And>i e. \<lbrakk>i\<in>Basis; e>0\<rbrakk> \<Longrightarrow> \<exists>d. 0 < \<bar>d\<bar> \<and> \<bar>d\<bar> < e \<and> (x + d *\<^sub>R i) \<in> S"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   374
  shows "f' = f''"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   375
proof -
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   376
  note as = assms(1,2)[unfolded has_derivative_def]
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   377
  then interpret f': bounded_linear f' by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   378
  from as interpret f'': bounded_linear f'' by auto
68058
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   379
  have "x islimpt S" unfolding islimpt_approachable
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   380
  proof (intro allI impI)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   381
    fix e :: real
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   382
    assume "e > 0"
68058
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   383
    obtain d where "0 < \<bar>d\<bar>" and "\<bar>d\<bar> < e" and "x + d *\<^sub>R (SOME i. i \<in> Basis) \<in> S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   384
      using assms(3) SOME_Basis \<open>e>0\<close> by blast
68058
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   385
    then show "\<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   386
      by (rule_tac x="x + d *\<^sub>R (SOME i. i \<in> Basis)" in bexI) (auto simp: dist_norm SOME_Basis nonzero_Basis)  qed
68058
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   387
  then have *: "netlimit (at x within S) = x"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   388
    by (simp add: Lim_ident_at trivial_limit_within)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   389
  show ?thesis
68058
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   390
  proof (rule linear_eq_stdbasis)
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   391
    show "linear f'" "linear f''"
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   392
      unfolding linear_conv_bounded_linear using as by auto
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   393
  next
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   394
    fix i :: 'a
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   395
    assume i: "i \<in> Basis"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62949
diff changeset
   396
    define e where "e = norm (f' i - f'' i)"
68058
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   397
    show "f' i = f'' i"
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   398
    proof (rule ccontr)
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   399
      assume "f' i \<noteq> f'' i"
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   400
      then have "e > 0"
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   401
        unfolding e_def by auto
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   402
      obtain d where d:
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   403
        "0 < d"
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   404
        "(\<And>y. y\<in>S \<longrightarrow> 0 < dist y x \<and> dist y x < d \<longrightarrow>
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   405
          dist ((f y - f x - f' (y - x)) /\<^sub>R norm (y - x) -
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   406
              (f y - f x - f'' (y - x)) /\<^sub>R norm (y - x)) (0 - 0) < e)"
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   407
        using tendsto_diff [OF as(1,2)[THEN conjunct2]]
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   408
        unfolding * Lim_within
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   409
        using \<open>e>0\<close> by blast
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   410
      obtain c where c: "0 < \<bar>c\<bar>" "\<bar>c\<bar> < d \<and> x + c *\<^sub>R i \<in> S"
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   411
        using assms(3) i d(1) by blast
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   412
      have *: "norm (- ((1 / \<bar>c\<bar>) *\<^sub>R f' (c *\<^sub>R i)) + (1 / \<bar>c\<bar>) *\<^sub>R f'' (c *\<^sub>R i)) =
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61915
diff changeset
   413
        norm ((1 / \<bar>c\<bar>) *\<^sub>R (- (f' (c *\<^sub>R i)) + f'' (c *\<^sub>R i)))"
68058
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   414
        unfolding scaleR_right_distrib by auto
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   415
      also have "\<dots> = norm ((1 / \<bar>c\<bar>) *\<^sub>R (c *\<^sub>R (- (f' i) + f'' i)))"
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   416
        unfolding f'.scaleR f''.scaleR
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   417
        unfolding scaleR_right_distrib scaleR_minus_right
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   418
        by auto
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   419
      also have "\<dots> = e"
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   420
        unfolding e_def
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   421
        using c(1)
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   422
        using norm_minus_cancel[of "f' i - f'' i"]
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   423
        by auto
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   424
      finally show False
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   425
        using c
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   426
        using d(2)[of "x + c *\<^sub>R i"]
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   427
        unfolding dist_norm
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   428
        unfolding f'.scaleR f''.scaleR f'.add f''.add f'.diff f''.diff
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   429
          scaleR_scaleR scaleR_right_diff_distrib scaleR_right_distrib
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   430
        using i
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   431
        by (auto simp: inverse_eq_divide)
69715dfdc286 more general tidying up
paulson <lp15@cam.ac.uk>
parents: 68055
diff changeset
   432
    qed
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   433
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   434
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   435
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
   436
proposition frechet_derivative_unique_within_closed_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   437
  fixes f::"'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   438
  assumes ab: "\<And>i. i\<in>Basis \<Longrightarrow> a\<bullet>i < b\<bullet>i"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   439
    and x: "x \<in> cbox a b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   440
    and "(f has_derivative f' ) (at x within cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   441
    and "(f has_derivative f'') (at x within cbox a b)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   442
  shows "f' = f''"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   443
proof (rule frechet_derivative_unique_within)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   444
  fix e :: real
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   445
  fix i :: 'a
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   446
  assume "e > 0" and i: "i \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   447
  then show "\<exists>d. 0 < \<bar>d\<bar> \<and> \<bar>d\<bar> < e \<and> x + d *\<^sub>R i \<in> cbox a b"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   448
  proof (cases "x\<bullet>i = a\<bullet>i")
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   449
    case True
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   450
    with ab[of i] \<open>e>0\<close> x i show ?thesis
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   451
      by (rule_tac x="(min (b\<bullet>i - a\<bullet>i) e) / 2" in exI)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   452
         (auto simp add: mem_box field_simps inner_simps inner_Basis)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   453
  next
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   454
    case False
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   455
    moreover have "a \<bullet> i < x \<bullet> i"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   456
      using False i mem_box(2) x by force
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   457
    moreover {
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   458
      have "a \<bullet> i * 2 + min (x \<bullet> i - a \<bullet> i) e \<le> a\<bullet>i *2 + x\<bullet>i - a\<bullet>i"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   459
        by auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   460
      also have "\<dots> = a\<bullet>i + x\<bullet>i"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   461
        by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   462
      also have "\<dots> \<le> 2 * (x\<bullet>i)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   463
        using \<open>a \<bullet> i < x \<bullet> i\<close> by auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   464
      finally have "a \<bullet> i * 2 + min (x \<bullet> i - a \<bullet> i) e \<le> x \<bullet> i * 2"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   465
        by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   466
    }
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   467
    moreover have "min (x \<bullet> i - a \<bullet> i) e \<ge> 0"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   468
      by (simp add: \<open>0 < e\<close> \<open>a \<bullet> i < x \<bullet> i\<close> less_eq_real_def)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   469
    then have "x \<bullet> i * 2 \<le> b \<bullet> i * 2 + min (x \<bullet> i - a \<bullet> i) e"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   470
      using i mem_box(2) x by force
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   471
    ultimately show ?thesis
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   472
    using ab[of i] \<open>e>0\<close> x i 
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   473
      by (rule_tac x="- (min (x\<bullet>i - a\<bullet>i) e) / 2" in exI)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   474
         (auto simp add: mem_box field_simps inner_simps inner_Basis)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   475
  qed
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   476
qed (use assms in auto)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   477
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   478
lemma frechet_derivative_unique_within_open_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   479
  fixes f::"'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   480
  assumes x: "x \<in> box a b"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   481
    and f: "(f has_derivative f' ) (at x within box a b)" "(f has_derivative f'') (at x within box a b)"
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   482
  shows "f' = f''"
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   483
proof -
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   484
  have "at x within box a b = at x"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   485
    by (metis x at_within_interior interior_open open_box)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   486
  with f show "f' = f''"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   487
    by (simp add: has_derivative_unique)
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   488
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   489
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   490
lemma frechet_derivative_at:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   491
  "(f has_derivative f') (at x) \<Longrightarrow> f' = frechet_derivative f (at x)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   492
  using differentiable_def frechet_derivative_works has_derivative_unique by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   493
70725
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   494
lemma frechet_derivative_compose:
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   495
  "frechet_derivative (f o g) (at x) = frechet_derivative (f) (at (g x)) o frechet_derivative g (at x)"
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   496
  if "g differentiable at x" "f differentiable at (g x)"
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   497
  by (metis diff_chain_at frechet_derivative_at frechet_derivative_works that)
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   498
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   499
lemma frechet_derivative_within_cbox:
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   500
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   501
  assumes "\<And>i. i\<in>Basis \<Longrightarrow> a\<bullet>i < b\<bullet>i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   502
    and "x \<in> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   503
    and "(f has_derivative f') (at x within cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   504
  shows "frechet_derivative f (at x within cbox a b) = f'"
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   505
  using assms
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   506
  by (metis Derivative.differentiableI frechet_derivative_unique_within_closed_interval frechet_derivative_works)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   507
70725
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   508
lemma frechet_derivative_transform_within_open:
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   509
  "frechet_derivative f (at x) = frechet_derivative g (at x)"
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   510
  if "f differentiable at x" "open X" "x \<in> X" "\<And>x. x \<in> X \<Longrightarrow> f x = g x"
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   511
  by (meson frechet_derivative_at frechet_derivative_works has_derivative_transform_within_open that)
e19c18b4a0dd Four new results from Smooth_Manifolds/Analysis_More
paulson <lp15@cam.ac.uk>
parents: 70641
diff changeset
   512
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   513
69631
6c3e6038e74c tuned headers
nipkow
parents: 69597
diff changeset
   514
subsection \<open>Derivatives of local minima and maxima are zero\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   515
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   516
lemma has_derivative_local_min:
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   517
  fixes f :: "'a::real_normed_vector \<Rightarrow> real"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   518
  assumes deriv: "(f has_derivative f') (at x)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   519
  assumes min: "eventually (\<lambda>y. f x \<le> f y) (at x)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   520
  shows "f' = (\<lambda>h. 0)"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   521
proof
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   522
  fix h :: 'a
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   523
  interpret f': bounded_linear f'
56182
528fae0816ea update syntax of has_*derivative to infix 50; fixed proofs
hoelzl
parents: 56181
diff changeset
   524
    using deriv by (rule has_derivative_bounded_linear)
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   525
  show "f' h = 0"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   526
  proof (cases "h = 0")
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   527
    case False
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   528
    from min obtain d where d1: "0 < d" and d2: "\<forall>y\<in>ball x d. f x \<le> f y"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   529
      unfolding eventually_at by (force simp: dist_commute)
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   530
    have "FDERIV (\<lambda>r. x + r *\<^sub>R h) 0 :> (\<lambda>r. r *\<^sub>R h)"
56381
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
   531
      by (intro derivative_eq_intros) auto
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   532
    then have "FDERIV (\<lambda>r. f (x + r *\<^sub>R h)) 0 :> (\<lambda>k. f' (k *\<^sub>R h))"
56182
528fae0816ea update syntax of has_*derivative to infix 50; fixed proofs
hoelzl
parents: 56181
diff changeset
   533
      by (rule has_derivative_compose, simp add: deriv)
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   534
    then have "DERIV (\<lambda>r. f (x + r *\<^sub>R h)) 0 :> f' h"
56182
528fae0816ea update syntax of has_*derivative to infix 50; fixed proofs
hoelzl
parents: 56181
diff changeset
   535
      unfolding has_field_derivative_def by (simp add: f'.scaleR mult_commute_abs)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   536
    moreover have "0 < d / norm h" using d1 and \<open>h \<noteq> 0\<close> by simp
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   537
    moreover have "\<forall>y. \<bar>0 - y\<bar> < d / norm h \<longrightarrow> f (x + 0 *\<^sub>R h) \<le> f (x + y *\<^sub>R h)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   538
      using \<open>h \<noteq> 0\<close> by (auto simp add: d2 dist_norm pos_less_divide_eq)
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   539
    ultimately show "f' h = 0"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   540
      by (rule DERIV_local_min)
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   541
  qed simp
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   542
qed
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   543
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   544
lemma has_derivative_local_max:
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   545
  fixes f :: "'a::real_normed_vector \<Rightarrow> real"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   546
  assumes "(f has_derivative f') (at x)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   547
  assumes "eventually (\<lambda>y. f y \<le> f x) (at x)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   548
  shows "f' = (\<lambda>h. 0)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   549
  using has_derivative_local_min [of "\<lambda>x. - f x" "\<lambda>h. - f' h" "x"]
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   550
  using assms unfolding fun_eq_iff by simp
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   551
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   552
lemma differential_zero_maxmin:
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   553
  fixes f::"'a::real_normed_vector \<Rightarrow> real"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   554
  assumes "x \<in> S"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   555
    and "open S"
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   556
    and deriv: "(f has_derivative f') (at x)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   557
    and mono: "(\<forall>y\<in>S. f y \<le> f x) \<or> (\<forall>y\<in>S. f x \<le> f y)"
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   558
  shows "f' = (\<lambda>v. 0)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   559
  using mono
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   560
proof
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   561
  assume "\<forall>y\<in>S. f y \<le> f x"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   562
  with \<open>x \<in> S\<close> and \<open>open S\<close> have "eventually (\<lambda>y. f y \<le> f x) (at x)"
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   563
    unfolding eventually_at_topological by auto
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   564
  with deriv show ?thesis
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   565
    by (rule has_derivative_local_max)
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   566
next
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   567
  assume "\<forall>y\<in>S. f x \<le> f y"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   568
  with \<open>x \<in> S\<close> and \<open>open S\<close> have "eventually (\<lambda>y. f x \<le> f y) (at x)"
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   569
    unfolding eventually_at_topological by auto
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   570
  with deriv show ?thesis
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   571
    by (rule has_derivative_local_min)
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   572
qed
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   573
69020
4f94e262976d elimination of near duplication involving Rolle's theorem and the MVT
paulson <lp15@cam.ac.uk>
parents: 68838
diff changeset
   574
lemma differential_zero_maxmin_component:
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   575
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   576
  assumes k: "k \<in> Basis"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   577
    and ball: "0 < e" "(\<forall>y \<in> ball x e. (f y)\<bullet>k \<le> (f x)\<bullet>k) \<or> (\<forall>y\<in>ball x e. (f x)\<bullet>k \<le> (f y)\<bullet>k)"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   578
    and diff: "f differentiable (at x)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   579
  shows "(\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)" (is "?D k = 0")
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   580
proof -
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   581
  let ?f' = "frechet_derivative f (at x)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   582
  have "x \<in> ball x e" using \<open>0 < e\<close> by simp
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   583
  moreover have "open (ball x e)" by simp
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   584
  moreover have "((\<lambda>x. f x \<bullet> k) has_derivative (\<lambda>h. ?f' h \<bullet> k)) (at x)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   585
    using bounded_linear_inner_left diff[unfolded frechet_derivative_works]
56182
528fae0816ea update syntax of has_*derivative to infix 50; fixed proofs
hoelzl
parents: 56181
diff changeset
   586
    by (rule bounded_linear.has_derivative)
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   587
  ultimately have "(\<lambda>h. frechet_derivative f (at x) h \<bullet> k) = (\<lambda>v. 0)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   588
    using ball(2) by (rule differential_zero_maxmin)
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   589
  then show ?thesis
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   590
    unfolding fun_eq_iff by simp
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   591
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   592
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   593
subsection \<open>One-dimensional mean value theorem\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   594
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   595
lemma mvt_simple:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   596
  fixes f :: "real \<Rightarrow> real"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   597
  assumes "a < b"
68241
39a311f50344 correcting the statements of the MVTs
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
   598
    and derf: "\<And>x. \<lbrakk>a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> (f has_derivative f' x) (at x within {a..b})"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   599
  shows "\<exists>x\<in>{a<..<b}. f b - f a = f' x (b - a)"
56264
2a091015a896 tuned proofs
huffman
parents: 56261
diff changeset
   600
proof (rule mvt)
2a091015a896 tuned proofs
huffman
parents: 56261
diff changeset
   601
  have "f differentiable_on {a..b}"
68241
39a311f50344 correcting the statements of the MVTs
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
   602
    using derf unfolding differentiable_on_def differentiable_def by force
56264
2a091015a896 tuned proofs
huffman
parents: 56261
diff changeset
   603
  then show "continuous_on {a..b} f"
2a091015a896 tuned proofs
huffman
parents: 56261
diff changeset
   604
    by (rule differentiable_imp_continuous_on)
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   605
  show "(f has_derivative f' x) (at x)" if "a < x" "x < b" for x
68241
39a311f50344 correcting the statements of the MVTs
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
   606
    by (metis at_within_Icc_at derf leI order.asym that)
69020
4f94e262976d elimination of near duplication involving Rolle's theorem and the MVT
paulson <lp15@cam.ac.uk>
parents: 68838
diff changeset
   607
qed (use assms in auto)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   608
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   609
lemma mvt_very_simple:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   610
  fixes f :: "real \<Rightarrow> real"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   611
  assumes "a \<le> b"
68241
39a311f50344 correcting the statements of the MVTs
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
   612
    and derf: "\<And>x. \<lbrakk>a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> (f has_derivative f' x) (at x within {a..b})"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   613
  shows "\<exists>x\<in>{a..b}. f b - f a = f' x (b - a)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   614
proof (cases "a = b")
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   615
  interpret bounded_linear "f' b"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   616
    using assms(2) assms(1) by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   617
  case True
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   618
  then show ?thesis
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   619
    by force
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   620
next
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   621
  case False
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   622
  then show ?thesis
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   623
    using mvt_simple[OF _ derf]
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   624
    by (metis \<open>a \<le> b\<close> atLeastAtMost_iff dual_order.order_iff_strict greaterThanLessThan_iff)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   625
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   626
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   627
text \<open>A nice generalization (see Havin's proof of 5.19 from Rudin's book).\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   628
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   629
lemma mvt_general:
56223
7696903b9e61 generalize theory of operator norms to work with class real_normed_vector
huffman
parents: 56217
diff changeset
   630
  fixes f :: "real \<Rightarrow> 'a::real_inner"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   631
  assumes "a < b"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   632
    and contf: "continuous_on {a..b} f"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   633
    and derf: "\<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> (f has_derivative f' x) (at x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   634
  shows "\<exists>x\<in>{a<..<b}. norm (f b - f a) \<le> norm (f' x (b - a))"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   635
proof -
56264
2a091015a896 tuned proofs
huffman
parents: 56261
diff changeset
   636
  have "\<exists>x\<in>{a<..<b}. (f b - f a) \<bullet> f b - (f b - f a) \<bullet> f a = (f b - f a) \<bullet> f' x (b - a)"
69020
4f94e262976d elimination of near duplication involving Rolle's theorem and the MVT
paulson <lp15@cam.ac.uk>
parents: 68838
diff changeset
   637
    apply (rule mvt [OF \<open>a < b\<close>, where f = "\<lambda>x. (f b - f a) \<bullet> f x"])
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   638
    apply (intro continuous_intros contf)
69020
4f94e262976d elimination of near duplication involving Rolle's theorem and the MVT
paulson <lp15@cam.ac.uk>
parents: 68838
diff changeset
   639
    using derf apply (auto intro: has_derivative_inner_right)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   640
    done
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   641
  then obtain x where x: "x \<in> {a<..<b}"
56264
2a091015a896 tuned proofs
huffman
parents: 56261
diff changeset
   642
    "(f b - f a) \<bullet> f b - (f b - f a) \<bullet> f a = (f b - f a) \<bullet> f' x (b - a)" ..
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   643
  show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   644
  proof (cases "f a = f b")
36844
5f9385ecc1a7 Removed usage of normalizating locales.
hoelzl
parents: 36725
diff changeset
   645
    case False
53077
a1b3784f8129 more symbols;
wenzelm
parents: 51733
diff changeset
   646
    have "norm (f b - f a) * norm (f b - f a) = (norm (f b - f a))\<^sup>2"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   647
      by (simp add: power2_eq_square)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   648
    also have "\<dots> = (f b - f a) \<bullet> (f b - f a)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   649
      unfolding power2_norm_eq_inner ..
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   650
    also have "\<dots> = (f b - f a) \<bullet> f' x (b - a)"
56264
2a091015a896 tuned proofs
huffman
parents: 56261
diff changeset
   651
      using x(2) by (simp only: inner_diff_right)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   652
    also have "\<dots> \<le> norm (f b - f a) * norm (f' x (b - a))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   653
      by (rule norm_cauchy_schwarz)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   654
    finally show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   655
      using False x(1)
56217
dc429a5b13c4 Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents: 56196
diff changeset
   656
      by (auto simp add: mult_left_cancel)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   657
  next
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   658
    case True
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   659
    then show ?thesis
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   660
      using \<open>a < b\<close> by (rule_tac x="(a + b) /2" in bexI) auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   661
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   662
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   663
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   664
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   665
subsection \<open>More general bound theorems\<close>
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   666
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   667
proposition differentiable_bound_general:
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   668
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   669
  assumes "a < b"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   670
    and f_cont: "continuous_on {a..b} f"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   671
    and phi_cont: "continuous_on {a..b} \<phi>"
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   672
    and f': "\<And>x. a < x \<Longrightarrow> x < b \<Longrightarrow> (f has_vector_derivative f' x) (at x)"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   673
    and phi': "\<And>x. a < x \<Longrightarrow> x < b \<Longrightarrow> (\<phi> has_vector_derivative \<phi>' x) (at x)"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   674
    and bnd: "\<And>x. a < x \<Longrightarrow> x < b \<Longrightarrow> norm (f' x) \<le> \<phi>' x"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   675
  shows "norm (f b - f a) \<le> \<phi> b - \<phi> a"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   676
proof -
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   677
  {
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   678
    fix x assume x: "a < x" "x < b"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   679
    have "0 \<le> norm (f' x)" by simp
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   680
    also have "\<dots> \<le> \<phi>' x" using x by (auto intro!: bnd)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   681
    finally have "0 \<le> \<phi>' x" .
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   682
  } note phi'_nonneg = this
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   683
  note f_tendsto = assms(2)[simplified continuous_on_def, rule_format]
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   684
  note phi_tendsto = assms(3)[simplified continuous_on_def, rule_format]
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   685
  {
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   686
    fix e::real assume "e > 0"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62949
diff changeset
   687
    define e2 where "e2 = e / 2"
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62949
diff changeset
   688
    with \<open>e > 0\<close> have "e2 > 0" by simp
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   689
    let ?le = "\<lambda>x1. norm (f x1 - f a) \<le> \<phi> x1 - \<phi> a + e * (x1 - a) + e"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62949
diff changeset
   690
    define A where "A = {x2. a \<le> x2 \<and> x2 \<le> b \<and> (\<forall>x1\<in>{a ..< x2}. ?le x1)}"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   691
    have A_subset: "A \<subseteq> {a..b}" by (auto simp: A_def)
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   692
    {
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   693
      fix x2
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   694
      assume a: "a \<le> x2" "x2 \<le> b" and le: "\<forall>x1\<in>{a..<x2}. ?le x1"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   695
      have "?le x2" using \<open>e > 0\<close>
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   696
      proof cases
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   697
        assume "x2 \<noteq> a" with a have "a < x2" by simp
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   698
        have "at x2 within {a <..<x2}\<noteq> bot"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   699
          using \<open>a < x2\<close>
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   700
          by (auto simp: trivial_limit_within islimpt_in_closure)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   701
        moreover
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   702
        have "((\<lambda>x1. (\<phi> x1 - \<phi> a) + e * (x1 - a) + e) \<longlongrightarrow> (\<phi> x2 - \<phi> a) + e * (x2 - a) + e) (at x2 within {a <..<x2})"
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   703
          "((\<lambda>x1. norm (f x1 - f a)) \<longlongrightarrow> norm (f x2 - f a)) (at x2 within {a <..<x2})"
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   704
          using a
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   705
          by (auto intro!: tendsto_eq_intros f_tendsto phi_tendsto
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   706
            intro: tendsto_within_subset[where S="{a..b}"])
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   707
        moreover
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   708
        have "eventually (\<lambda>x. x > a) (at x2 within {a <..<x2})"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   709
          by (auto simp: eventually_at_filter)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   710
        hence "eventually ?le (at x2 within {a <..<x2})"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   711
          unfolding eventually_at_filter
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   712
          by eventually_elim (insert le, auto)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   713
        ultimately
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   714
        show ?thesis
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   715
          by (rule tendsto_le)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   716
      qed simp
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   717
    } note le_cont = this
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   718
    have "a \<in> A"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   719
      using assms by (auto simp: A_def)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   720
    hence [simp]: "A \<noteq> {}" by auto
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   721
    have A_ivl: "\<And>x1 x2. x2 \<in> A \<Longrightarrow> x1 \<in> {a ..x2} \<Longrightarrow> x1 \<in> A"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   722
      by (simp add: A_def)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   723
    have [simp]: "bdd_above A" by (auto simp: A_def)
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62949
diff changeset
   724
    define y where "y = Sup A"
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   725
    have "y \<le> b"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   726
      unfolding y_def
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   727
      by (simp add: cSup_le_iff) (simp add: A_def)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   728
     have leI: "\<And>x x1. a \<le> x1 \<Longrightarrow> x \<in> A \<Longrightarrow> x1 < x \<Longrightarrow> ?le x1"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   729
       by (auto simp: A_def intro!: le_cont)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   730
    have y_all_le: "\<forall>x1\<in>{a..<y}. ?le x1"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   731
      by (auto simp: y_def less_cSup_iff leI)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   732
    have "a \<le> y"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   733
      by (metis \<open>a \<in> A\<close> \<open>bdd_above A\<close> cSup_upper y_def)
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   734
    have "y \<in> A"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   735
      using y_all_le \<open>a \<le> y\<close> \<open>y \<le> b\<close>
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   736
      by (auto simp: A_def)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   737
    hence "A = {a .. y}"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   738
      using A_subset by (auto simp: subset_iff y_def cSup_upper intro: A_ivl)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   739
    from le_cont[OF \<open>a \<le> y\<close> \<open>y \<le> b\<close> y_all_le] have le_y: "?le y" .
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   740
    have "y = b"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   741
    proof (cases "a = y")
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   742
      case True
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   743
      with \<open>a < b\<close> have "y < b" by simp
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   744
      with \<open>a = y\<close> f_cont phi_cont \<open>e2 > 0\<close>
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   745
      have 1: "\<forall>\<^sub>F x in at y within {y..b}. dist (f x) (f y) < e2"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   746
       and 2: "\<forall>\<^sub>F x in at y within {y..b}. dist (\<phi> x) (\<phi> y) < e2"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   747
        by (auto simp: continuous_on_def tendsto_iff)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   748
      have 3: "eventually (\<lambda>x. y < x) (at y within {y..b})"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   749
        by (auto simp: eventually_at_filter)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   750
      have 4: "eventually (\<lambda>x::real. x < b) (at y within {y..b})"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   751
        using _ \<open>y < b\<close>
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   752
        by (rule order_tendstoD) (auto intro!: tendsto_eq_intros)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   753
      from 1 2 3 4
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   754
      have eventually_le: "eventually (\<lambda>x. ?le x) (at y within {y .. b})"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   755
      proof eventually_elim
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   756
        case (elim x1)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   757
        have "norm (f x1 - f a) = norm (f x1 - f y)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   758
          by (simp add: \<open>a = y\<close>)
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   759
        also have "norm (f x1 - f y) \<le> e2"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   760
          using elim \<open>a = y\<close> by (auto simp : dist_norm intro!:  less_imp_le)
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   761
        also have "\<dots> \<le> e2 + (\<phi> x1 - \<phi> a + e2 + e * (x1 - a))"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   762
          using \<open>0 < e\<close> elim
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   763
          by (intro add_increasing2[OF add_nonneg_nonneg order.refl])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   764
            (auto simp: \<open>a = y\<close> dist_norm intro!: mult_nonneg_nonneg)
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   765
        also have "\<dots> = \<phi> x1 - \<phi> a + e * (x1 - a) + e"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   766
          by (simp add: e2_def)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   767
        finally show "?le x1" .
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   768
      qed
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   769
      from this[unfolded eventually_at_topological] \<open>?le y\<close>
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   770
      obtain S where S: "open S" "y \<in> S" "\<And>x. x\<in>S \<Longrightarrow> x \<in> {y..b} \<Longrightarrow> ?le x"
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   771
        by metis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   772
      from \<open>open S\<close> obtain d where d: "\<And>x. dist x y < d \<Longrightarrow> x \<in> S" "d > 0"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62087
diff changeset
   773
        by (force simp: dist_commute open_dist ball_def dest!: bspec[OF _ \<open>y \<in> S\<close>])
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62949
diff changeset
   774
      define d' where "d' = min b (y + (d/2))"
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   775
      have "d' \<in> A"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   776
        unfolding A_def
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   777
      proof safe
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   778
        show "a \<le> d'" using \<open>a = y\<close> \<open>0 < d\<close> \<open>y < b\<close> by (simp add: d'_def)
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   779
        show "d' \<le> b" by (simp add: d'_def)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   780
        fix x1
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   781
        assume "x1 \<in> {a..<d'}"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   782
        hence "x1 \<in> S" "x1 \<in> {y..b}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   783
          by (auto simp: \<open>a = y\<close> d'_def dist_real_def intro!: d )
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   784
        thus "?le x1"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   785
          by (rule S)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   786
      qed
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   787
      hence "d' \<le> y"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   788
        unfolding y_def
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   789
        by (rule cSup_upper) simp
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   790
      then show "y = b" using \<open>d > 0\<close> \<open>y < b\<close>
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   791
        by (simp add: d'_def)
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   792
    next
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   793
      case False
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   794
      with \<open>a \<le> y\<close> have "a < y" by simp
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   795
      show "y = b"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   796
      proof (rule ccontr)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   797
        assume "y \<noteq> b"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   798
        hence "y < b" using \<open>y \<le> b\<close> by simp
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   799
        let ?F = "at y within {y..<b}"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   800
        from f' phi'
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   801
        have "(f has_vector_derivative f' y) ?F"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   802
          and "(\<phi> has_vector_derivative \<phi>' y) ?F"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   803
          using \<open>a < y\<close> \<open>y < b\<close>
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   804
          by (auto simp add: at_within_open[of _ "{a<..<b}"] has_vector_derivative_def
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   805
            intro!: has_derivative_subset[where s="{a<..<b}" and t="{y..<b}"])
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   806
        hence "\<forall>\<^sub>F x1 in ?F. norm (f x1 - f y - (x1 - y) *\<^sub>R f' y) \<le> e2 * \<bar>x1 - y\<bar>"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   807
            "\<forall>\<^sub>F x1 in ?F. norm (\<phi> x1 - \<phi> y - (x1 - y) *\<^sub>R \<phi>' y) \<le> e2 * \<bar>x1 - y\<bar>"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   808
          using \<open>e2 > 0\<close>
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   809
          by (auto simp: has_derivative_within_alt2 has_vector_derivative_def)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   810
        moreover
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   811
        have "\<forall>\<^sub>F x1 in ?F. y \<le> x1" "\<forall>\<^sub>F x1 in ?F. x1 < b"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   812
          by (auto simp: eventually_at_filter)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   813
        ultimately
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   814
        have "\<forall>\<^sub>F x1 in ?F. norm (f x1 - f y) \<le> (\<phi> x1 - \<phi> y) + e * \<bar>x1 - y\<bar>"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   815
          (is "\<forall>\<^sub>F x1 in ?F. ?le' x1")
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   816
        proof eventually_elim
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   817
          case (elim x1)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   818
          from norm_triangle_ineq2[THEN order_trans, OF elim(1)]
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   819
          have "norm (f x1 - f y) \<le> norm (f' y) * \<bar>x1 - y\<bar> + e2 * \<bar>x1 - y\<bar>"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   820
            by (simp add: ac_simps)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   821
          also have "norm (f' y) \<le> \<phi>' y" using bnd \<open>a < y\<close> \<open>y < b\<close> by simp
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   822
          also have "\<phi>' y * \<bar>x1 - y\<bar> \<le> \<phi> x1 - \<phi> y + e2 * \<bar>x1 - y\<bar>"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   823
            using elim by (simp add: ac_simps)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   824
          finally
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   825
          have "norm (f x1 - f y) \<le> \<phi> x1 - \<phi> y + e2 * \<bar>x1 - y\<bar> + e2 * \<bar>x1 - y\<bar>"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   826
            by (auto simp: mult_right_mono)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   827
          thus ?case by (simp add: e2_def)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   828
        qed
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   829
        moreover have "?le' y" by simp
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   830
        ultimately obtain S
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   831
        where S: "open S" "y \<in> S" "\<And>x. x\<in>S \<Longrightarrow> x \<in> {y..<b} \<Longrightarrow> ?le' x"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   832
          unfolding eventually_at_topological
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   833
          by metis
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   834
        from \<open>open S\<close> obtain d where d: "\<And>x. dist x y < d \<Longrightarrow> x \<in> S" "d > 0"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   835
          by (force simp: dist_commute open_dist ball_def dest!: bspec[OF _ \<open>y \<in> S\<close>])
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   836
        define d' where "d' = min ((y + b)/2) (y + (d/2))"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   837
        have "d' \<in> A"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   838
          unfolding A_def
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   839
        proof safe
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   840
          show "a \<le> d'" using \<open>a < y\<close> \<open>0 < d\<close> \<open>y < b\<close> by (simp add: d'_def)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   841
          show "d' \<le> b" using \<open>y < b\<close> by (simp add: d'_def min_def)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   842
          fix x1
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   843
          assume x1: "x1 \<in> {a..<d'}"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   844
          show "?le x1"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   845
          proof (cases "x1 < y")
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   846
            case True
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   847
            then show ?thesis
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   848
              using \<open>y \<in> A\<close> local.leI x1 by auto
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   849
          next
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   850
            case False
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   851
            hence x1': "x1 \<in> S" "x1 \<in> {y..<b}" using x1
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   852
              by (auto simp: d'_def dist_real_def intro!: d)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   853
            have "norm (f x1 - f a) \<le> norm (f x1 - f y) + norm (f y - f a)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   854
              by (rule order_trans[OF _ norm_triangle_ineq]) simp
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   855
            also note S(3)[OF x1']
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   856
            also note le_y
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   857
            finally show "?le x1"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   858
              using False by (auto simp: algebra_simps)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   859
          qed
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   860
        qed
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   861
        hence "d' \<le> y"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   862
          unfolding y_def by (rule cSup_upper) simp
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   863
        thus False using \<open>d > 0\<close> \<open>y < b\<close>
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   864
          by (simp add: d'_def min_def split: if_split_asm)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   865
      qed
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   866
    qed
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   867
    with le_y have "norm (f b - f a) \<le> \<phi> b - \<phi> a + e * (b - a + 1)"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   868
      by (simp add: algebra_simps)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   869
  } note * = this
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   870
  show ?thesis
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   871
  proof (rule field_le_epsilon)
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   872
    fix e::real assume "e > 0"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   873
    then show "norm (f b - f a) \<le> \<phi> b - \<phi> a + e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   874
      using *[of "e / (b - a + 1)"] \<open>a < b\<close> by simp
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   875
  qed
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   876
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   877
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   878
lemma differentiable_bound:
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   879
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   880
  assumes "convex S"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   881
    and derf: "\<And>x. x\<in>S \<Longrightarrow> (f has_derivative f' x) (at x within S)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   882
    and B: "\<And>x. x \<in> S \<Longrightarrow> onorm (f' x) \<le> B"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   883
    and x: "x \<in> S"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   884
    and y: "y \<in> S"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   885
  shows "norm (f x - f y) \<le> B * norm (x - y)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   886
proof -
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   887
  let ?p = "\<lambda>u. x + u *\<^sub>R (y - x)"
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   888
  let ?\<phi> = "\<lambda>h. h * B * norm (x - y)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   889
  have *: "x + u *\<^sub>R (y - x) \<in> S" if "u \<in> {0..1}" for u
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   890
  proof -
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   891
    have "u *\<^sub>R y = u *\<^sub>R (y - x) + u *\<^sub>R x"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   892
      by (simp add: scale_right_diff_distrib)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   893
    then show "x + u *\<^sub>R (y - x) \<in> S"
70346
408e15cbd2a6 tuned proofs
haftmann
parents: 70136
diff changeset
   894
      using that \<open>convex S\<close> x y by (simp add: convex_alt)
408e15cbd2a6 tuned proofs
haftmann
parents: 70136
diff changeset
   895
        (metis pth_b(2) pth_c(1) scaleR_collapse)
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   896
  qed
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   897
  have "\<And>z. z \<in> (\<lambda>u. x + u *\<^sub>R (y - x)) ` {0..1} \<Longrightarrow>
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   898
          (f has_derivative f' z) (at z within (\<lambda>u. x + u *\<^sub>R (y - x)) ` {0..1})"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   899
    by (auto intro: * has_derivative_within_subset [OF derf])
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   900
  then have "continuous_on (?p ` {0..1}) f"
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   901
    unfolding continuous_on_eq_continuous_within
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   902
    by (meson has_derivative_continuous)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   903
  with * have 1: "continuous_on {0 .. 1} (f \<circ> ?p)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   904
    by (intro continuous_intros)+
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   905
  {
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   906
    fix u::real assume u: "u \<in>{0 <..< 1}"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   907
    let ?u = "?p u"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   908
    interpret linear "(f' ?u)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   909
      using u by (auto intro!: has_derivative_linear derf *)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   910
    have "(f \<circ> ?p has_derivative (f' ?u) \<circ> (\<lambda>u. 0 + u *\<^sub>R (y - x))) (at u within box 0 1)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   911
      by (intro derivative_intros has_derivative_within_subset [OF derf]) (use u * in auto)
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   912
    hence "((f \<circ> ?p) has_vector_derivative f' ?u (y - x)) (at u)"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   913
      by (simp add: has_derivative_within_open[OF u open_greaterThanLessThan]
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   914
        scaleR has_vector_derivative_def o_def)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   915
  } note 2 = this
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   916
  have 3: "continuous_on {0..1} ?\<phi>"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   917
    by (rule continuous_intros)+
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   918
  have 4: "(?\<phi> has_vector_derivative B * norm (x - y)) (at u)" for u
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   919
    by (auto simp: has_vector_derivative_def intro!: derivative_eq_intros)
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   920
  {
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   921
    fix u::real assume u: "u \<in>{0 <..< 1}"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   922
    let ?u = "?p u"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   923
    interpret bounded_linear "(f' ?u)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   924
      using u by (auto intro!: has_derivative_bounded_linear derf *)
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   925
    have "norm (f' ?u (y - x)) \<le> onorm (f' ?u) * norm (y - x)"
67682
00c436488398 tuned proofs -- prefer explicit names for facts from 'interpret';
wenzelm
parents: 67399
diff changeset
   926
      by (rule onorm) (rule bounded_linear)
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   927
    also have "onorm (f' ?u) \<le> B"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   928
      using u by (auto intro!: assms(3)[rule_format] *)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   929
    finally have "norm ((f' ?u) (y - x)) \<le> B * norm (x - y)"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   930
      by (simp add: mult_right_mono norm_minus_commute)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   931
  } note 5 = this
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   932
  have "norm (f x - f y) = norm ((f \<circ> (\<lambda>u. x + u *\<^sub>R (y - x))) 1 - (f \<circ> (\<lambda>u. x + u *\<^sub>R (y - x))) 0)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   933
    by (auto simp add: norm_minus_commute)
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   934
  also
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   935
  from differentiable_bound_general[OF zero_less_one 1, OF 3 2 4 5]
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   936
  have "norm ((f \<circ> ?p) 1 - (f \<circ> ?p) 0) \<le> B * norm (x - y)"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   937
    by simp
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   938
  finally show ?thesis .
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   939
qed
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   940
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   941
lemma
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   942
  differentiable_bound_segment:
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   943
  fixes f::"'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   944
  assumes "\<And>t. t \<in> {0..1} \<Longrightarrow> x0 + t *\<^sub>R a \<in> G"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   945
  assumes f': "\<And>x. x \<in> G \<Longrightarrow> (f has_derivative f' x) (at x within G)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   946
  assumes B: "\<And>x. x \<in> {0..1} \<Longrightarrow> onorm (f' (x0 + x *\<^sub>R a)) \<le> B"
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   947
  shows "norm (f (x0 + a) - f x0) \<le> norm a * B"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   948
proof -
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   949
  let ?G = "(\<lambda>x. x0 + x *\<^sub>R a) ` {0..1}"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66394
diff changeset
   950
  have "?G = (+) x0 ` (\<lambda>x. x *\<^sub>R a) ` {0..1}" by auto
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   951
  also have "convex \<dots>"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   952
    by (intro convex_translation convex_scaled convex_real_interval)
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   953
  finally have "convex ?G" .
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   954
  moreover have "?G \<subseteq> G" "x0 \<in> ?G" "x0 + a \<in> ?G" using assms by (auto intro: image_eqI[where x=1])
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   955
  ultimately show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   956
    using has_derivative_subset[OF f' \<open>?G \<subseteq> G\<close>] B
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   957
      differentiable_bound[of "(\<lambda>x. x0 + x *\<^sub>R a) ` {0..1}" f f' B "x0 + a" x0]
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   958
    by (force simp: ac_simps)
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   959
qed
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   960
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   961
lemma differentiable_bound_linearization:
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   962
  fixes f::"'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   963
  assumes S: "\<And>t. t \<in> {0..1} \<Longrightarrow> a + t *\<^sub>R (b - a) \<in> S"
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   964
  assumes f'[derivative_intros]: "\<And>x. x \<in> S \<Longrightarrow> (f has_derivative f' x) (at x within S)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   965
  assumes B: "\<And>x. x \<in> S \<Longrightarrow> onorm (f' x - f' x0) \<le> B"
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   966
  assumes "x0 \<in> S"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   967
  shows "norm (f b - f a - f' x0 (b - a)) \<le> norm (b - a) * B"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   968
proof -
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62949
diff changeset
   969
  define g where [abs_def]: "g x = f x - f' x0 x" for x
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   970
  have g: "\<And>x. x \<in> S \<Longrightarrow> (g has_derivative (\<lambda>i. f' x i - f' x0 i)) (at x within S)"
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   971
    unfolding g_def using assms
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   972
    by (auto intro!: derivative_eq_intros
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   973
      bounded_linear.has_derivative[OF has_derivative_bounded_linear, OF f'])
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   974
  from B have "\<forall>x\<in>{0..1}. onorm (\<lambda>i. f' (a + x *\<^sub>R (b - a)) i - f' x0 i) \<le> B"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   975
    using assms by (auto simp: fun_diff_def)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   976
  with differentiable_bound_segment[OF S g] \<open>x0 \<in> S\<close>
60178
f620c70f9e9b generalized differentiable_bound; some further variations of differentiable_bound
immler
parents: 60177
diff changeset
   977
  show ?thesis
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
   978
    by (simp add: g_def field_simps linear_diff[OF has_derivative_linear[OF f']])
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   979
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   980
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   981
lemma vector_differentiable_bound_linearization:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   982
  fixes f::"real \<Rightarrow> 'b::real_normed_vector"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   983
  assumes f': "\<And>x. x \<in> S \<Longrightarrow> (f has_vector_derivative f' x) (at x within S)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   984
  assumes "closed_segment a b \<subseteq> S"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
   985
  assumes B: "\<And>x. x \<in> S \<Longrightarrow> norm (f' x - f' x0) \<le> B"
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   986
  assumes "x0 \<in> S"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   987
  shows "norm (f b - f a - (b - a) *\<^sub>R f' x0) \<le> norm (b - a) * B"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   988
  using assms
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   989
  by (intro differentiable_bound_linearization[of a b S f "\<lambda>x h. h *\<^sub>R f' x" x0 B])
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   990
    (force simp: closed_segment_real_eq has_vector_derivative_def
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   991
      scaleR_diff_right[symmetric] mult.commute[of B]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   992
      intro!: onorm_le mult_left_mono)+
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   993
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
   994
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
   995
text \<open>In particular.\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   996
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   997
lemma has_derivative_zero_constant:
60179
d87c8c2d4938 generalized class constraints
immler
parents: 60178
diff changeset
   998
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   999
  assumes "convex s"
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1000
    and "\<And>x. x \<in> s \<Longrightarrow> (f has_derivative (\<lambda>h. 0)) (at x within s)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1001
  shows "\<exists>c. \<forall>x\<in>s. f x = c"
56332
289dd9166d04 tuned proofs
hoelzl
parents: 56320
diff changeset
  1002
proof -
289dd9166d04 tuned proofs
hoelzl
parents: 56320
diff changeset
  1003
  { fix x y assume "x \<in> s" "y \<in> s"
289dd9166d04 tuned proofs
hoelzl
parents: 56320
diff changeset
  1004
    then have "norm (f x - f y) \<le> 0 * norm (x - y)"
289dd9166d04 tuned proofs
hoelzl
parents: 56320
diff changeset
  1005
      using assms by (intro differentiable_bound[of s]) (auto simp: onorm_zero)
289dd9166d04 tuned proofs
hoelzl
parents: 56320
diff changeset
  1006
    then have "f x = f y"
289dd9166d04 tuned proofs
hoelzl
parents: 56320
diff changeset
  1007
      by simp }
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1008
  then show ?thesis
56332
289dd9166d04 tuned proofs
hoelzl
parents: 56320
diff changeset
  1009
    by metis
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1010
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1011
61524
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61520
diff changeset
  1012
lemma has_field_derivative_zero_constant:
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61520
diff changeset
  1013
  assumes "convex s" "\<And>x. x \<in> s \<Longrightarrow> (f has_field_derivative 0) (at x within s)"
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61520
diff changeset
  1014
  shows   "\<exists>c. \<forall>x\<in>s. f (x) = (c :: 'a :: real_normed_field)"
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61520
diff changeset
  1015
proof (rule has_derivative_zero_constant)
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 69020
diff changeset
  1016
  have A: "(*) 0 = (\<lambda>_. 0 :: 'a)" by (intro ext) simp
61524
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61520
diff changeset
  1017
  fix x assume "x \<in> s" thus "(f has_derivative (\<lambda>h. 0)) (at x within s)"
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61520
diff changeset
  1018
    using assms(2)[of x] by (simp add: has_field_derivative_def A)
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61520
diff changeset
  1019
qed fact
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61520
diff changeset
  1020
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1021
lemma
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1022
  has_vector_derivative_zero_constant:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1023
  assumes "convex s"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1024
  assumes "\<And>x. x \<in> s \<Longrightarrow> (f has_vector_derivative 0) (at x within s)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1025
  obtains c where "\<And>x. x \<in> s \<Longrightarrow> f x = c"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1026
  using has_derivative_zero_constant[of s f] assms
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1027
  by (auto simp: has_vector_derivative_def)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1028
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1029
lemma has_derivative_zero_unique:
60179
d87c8c2d4938 generalized class constraints
immler
parents: 60178
diff changeset
  1030
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1031
  assumes "convex s"
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1032
    and "\<And>x. x \<in> s \<Longrightarrow> (f has_derivative (\<lambda>h. 0)) (at x within s)"
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1033
    and "x \<in> s" "y \<in> s"
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1034
  shows "f x = f y"
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1035
  using has_derivative_zero_constant[OF assms(1,2)] assms(3-) by force
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1036
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1037
lemma has_derivative_zero_unique_connected:
60179
d87c8c2d4938 generalized class constraints
immler
parents: 60178
diff changeset
  1038
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1039
  assumes "open s" "connected s"
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1040
  assumes f: "\<And>x. x \<in> s \<Longrightarrow> (f has_derivative (\<lambda>x. 0)) (at x)"
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1041
  assumes "x \<in> s" "y \<in> s"
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1042
  shows "f x = f y"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1043
proof (rule connected_local_const[where f=f, OF \<open>connected s\<close> \<open>x\<in>s\<close> \<open>y\<in>s\<close>])
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1044
  show "\<forall>a\<in>s. eventually (\<lambda>b. f a = f b) (at a within s)"
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1045
  proof
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1046
    fix a assume "a \<in> s"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1047
    with \<open>open s\<close> obtain e where "0 < e" "ball a e \<subseteq> s"
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1048
      by (rule openE)
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1049
    then have "\<exists>c. \<forall>x\<in>ball a e. f x = c"
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1050
      by (intro has_derivative_zero_constant)
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1051
         (auto simp: at_within_open[OF _ open_ball] f convex_ball)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1052
    with \<open>0<e\<close> have "\<forall>x\<in>ball a e. f a = f x"
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1053
      by auto
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1054
    then show "eventually (\<lambda>b. f a = f b) (at a within s)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1055
      using \<open>0<e\<close> unfolding eventually_at_topological
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1056
      by (intro exI[of _ "ball a e"]) auto
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1057
  qed
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1058
qed
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1059
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1060
subsection \<open>Differentiability of inverse function (most basic form)\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1061
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1062
lemma has_derivative_inverse_basic:
56226
29fd6bd9228e generalize some theorems
huffman
parents: 56223
diff changeset
  1063
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1064
  assumes derf: "(f has_derivative f') (at (g y))"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1065
    and ling': "bounded_linear g'"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1066
    and "g' \<circ> f' = id"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1067
    and contg: "continuous (at y) g"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1068
    and "open T"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1069
    and "y \<in> T"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1070
    and fg: "\<And>z. z \<in> T \<Longrightarrow> f (g z) = z"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1071
  shows "(g has_derivative g') (at y)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1072
proof -
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1073
  interpret f': bounded_linear f'
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1074
    using assms unfolding has_derivative_def by auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1075
  interpret g': bounded_linear g'
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1076
    using assms by auto
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1077
  obtain C where C: "0 < C" "\<And>x. norm (g' x) \<le> norm x * C"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1078
    using bounded_linear.pos_bounded[OF assms(2)] by blast
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1079
  have lem1: "\<forall>e>0. \<exists>d>0. \<forall>z.
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1080
    norm (z - y) < d \<longrightarrow> norm (g z - g y - g'(z - y)) \<le> e * norm (g z - g y)"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1081
  proof (intro allI impI)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61104
diff changeset
  1082
    fix e :: real
8020249565fb tuned proofs;
wenzelm
parents: 61104
diff changeset
  1083
    assume "e > 0"
8020249565fb tuned proofs;
wenzelm
parents: 61104
diff changeset
  1084
    with C(1) have *: "e / C > 0" by auto
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1085
    obtain d0 where  "0 < d0" and d0:
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1086
        "\<And>u. norm (u - g y) < d0 \<Longrightarrow> norm (f u - f (g y) - f' (u - g y)) \<le> e / C * norm (u - g y)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1087
      using derf * unfolding has_derivative_at_alt by blast
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1088
    obtain d1 where "0 < d1" and d1: "\<And>x. \<lbrakk>0 < dist x y; dist x y < d1\<rbrakk> \<Longrightarrow> dist (g x) (g y) < d0"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1089
      using contg \<open>0 < d0\<close> unfolding continuous_at Lim_at by blast
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1090
    obtain d2 where "0 < d2" and d2: "\<And>u. dist u y < d2 \<Longrightarrow> u \<in> T"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1091
      using \<open>open T\<close> \<open>y \<in> T\<close> unfolding open_dist by blast
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1092
    obtain d where d: "0 < d" "d < d1" "d < d2"
68527
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68241
diff changeset
  1093
      using field_lbound_gt_zero[OF \<open>0 < d1\<close> \<open>0 < d2\<close>] by blast
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1094
    show "\<exists>d>0. \<forall>z. norm (z - y) < d \<longrightarrow> norm (g z - g y - g' (z - y)) \<le> e * norm (g z - g y)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1095
    proof (intro exI allI impI conjI)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1096
      fix z
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1097
      assume as: "norm (z - y) < d"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1098
      then have "z \<in> T"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1099
        using d2 d unfolding dist_norm by auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1100
      have "norm (g z - g y - g' (z - y)) \<le> norm (g' (f (g z) - y - f' (g z - g y)))"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1101
        unfolding g'.diff f'.diff
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1102
        unfolding assms(3)[unfolded o_def id_def, THEN fun_cong] fg[OF \<open>z\<in>T\<close>]
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1103
        by (simp add: norm_minus_commute)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1104
      also have "\<dots> \<le> norm (f (g z) - y - f' (g z - g y)) * C"
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1105
        by (rule C(2))
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1106
      also have "\<dots> \<le> (e / C) * norm (g z - g y) * C"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1107
      proof -
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1108
        have "norm (g z - g y) < d0"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1109
          by (metis as cancel_comm_monoid_add_class.diff_cancel d(2) \<open>0 < d0\<close> d1 diff_gt_0_iff_gt diff_strict_mono dist_norm dist_self zero_less_dist_iff)
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1110
        then show ?thesis
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1111
          by (metis C(1) \<open>y \<in> T\<close> d0 fg real_mult_le_cancel_iff1)
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1112
      qed
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1113
      also have "\<dots> \<le> e * norm (g z - g y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1114
        using C by (auto simp add: field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1115
      finally show "norm (g z - g y - g' (z - y)) \<le> e * norm (g z - g y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1116
        by simp
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1117
    qed (use d in auto)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1118
  qed
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1119
  have *: "(0::real) < 1 / 2"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1120
    by auto
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1121
  obtain d where "0 < d" and d:
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1122
      "\<And>z. norm (z - y) < d \<Longrightarrow> norm (g z - g y - g' (z - y)) \<le> 1/2 * norm (g z - g y)"
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1123
    using lem1 * by blast
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62949
diff changeset
  1124
  define B where "B = C * 2"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1125
  have "B > 0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1126
    unfolding B_def using C by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61104
diff changeset
  1127
  have lem2: "norm (g z - g y) \<le> B * norm (z - y)" if z: "norm(z - y) < d" for z
8020249565fb tuned proofs;
wenzelm
parents: 61104
diff changeset
  1128
  proof -
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1129
    have "norm (g z - g y) \<le> norm(g' (z - y)) + norm ((g z - g y) - g'(z - y))"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1130
      by (rule norm_triangle_sub)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1131
    also have "\<dots> \<le> norm (g' (z - y)) + 1 / 2 * norm (g z - g y)"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1132
      by (rule add_left_mono) (use d z in auto)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1133
    also have "\<dots> \<le> norm (z - y) * C + 1 / 2 * norm (g z - g y)"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1134
      by (rule add_right_mono) (use C in auto)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61104
diff changeset
  1135
    finally show "norm (g z - g y) \<le> B * norm (z - y)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1136
      unfolding B_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1137
      by (auto simp add: field_simps)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1138
  qed
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1139
  show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1140
    unfolding has_derivative_at_alt
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1141
  proof (intro conjI assms allI impI)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61104
diff changeset
  1142
    fix e :: real
8020249565fb tuned proofs;
wenzelm
parents: 61104
diff changeset
  1143
    assume "e > 0"
8020249565fb tuned proofs;
wenzelm
parents: 61104
diff changeset
  1144
    then have *: "e / B > 0" by (metis \<open>B > 0\<close> divide_pos_pos)
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1145
    obtain d' where "0 < d'" and d':
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1146
        "\<And>z. norm (z - y) < d' \<Longrightarrow> norm (g z - g y - g' (z - y)) \<le> e / B * norm (g z - g y)"
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1147
      using lem1 * by blast
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1148
    obtain k where k: "0 < k" "k < d" "k < d'"
68527
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68241
diff changeset
  1149
      using field_lbound_gt_zero[OF \<open>0 < d\<close> \<open>0 < d'\<close>] by blast
61165
8020249565fb tuned proofs;
wenzelm
parents: 61104
diff changeset
  1150
    show "\<exists>d>0. \<forall>ya. norm (ya - y) < d \<longrightarrow> norm (g ya - g y - g' (ya - y)) \<le> e * norm (ya - y)"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1151
    proof (intro exI allI impI conjI)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1152
      fix z
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1153
      assume as: "norm (z - y) < k"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1154
      then have "norm (g z - g y - g' (z - y)) \<le> e / B * norm(g z - g y)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1155
        using d' k by auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1156
      also have "\<dots> \<le> e * norm (z - y)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1157
        unfolding times_divide_eq_left pos_divide_le_eq[OF \<open>B>0\<close>]
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1158
        using lem2[of z] k as \<open>e > 0\<close>
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1159
        by (auto simp add: field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1160
      finally show "norm (g z - g y - g' (z - y)) \<le> e * norm (z - y)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1161
        by simp
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1162
    qed (use k in auto)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1163
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1164
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1165
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1166
text \<open>Simply rewrite that based on the domain point x.\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1167
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1168
lemma has_derivative_inverse_basic_x:
56226
29fd6bd9228e generalize some theorems
huffman
parents: 56223
diff changeset
  1169
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1170
  assumes "(f has_derivative f') (at x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1171
    and "bounded_linear g'"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1172
    and "g' \<circ> f' = id"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1173
    and "continuous (at (f x)) g"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1174
    and "g (f x) = x"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1175
    and "open T"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1176
    and "f x \<in> T"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1177
    and "\<And>y. y \<in> T \<Longrightarrow> f (g y) = y"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1178
  shows "(g has_derivative g') (at (f x))"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1179
  by (rule has_derivative_inverse_basic) (use assms in auto)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1180
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1181
text \<open>This is the version in Dieudonne', assuming continuity of f and g.\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1182
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1183
lemma has_derivative_inverse_dieudonne:
56226
29fd6bd9228e generalize some theorems
huffman
parents: 56223
diff changeset
  1184
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1185
  assumes "open S"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1186
    and "open (f ` S)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1187
    and "continuous_on S f"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1188
    and "continuous_on (f ` S) g"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1189
    and "\<And>x. x \<in> S \<Longrightarrow> g (f x) = x"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1190
    and "x \<in> S"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1191
    and "(f has_derivative f') (at x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1192
    and "bounded_linear g'"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1193
    and "g' \<circ> f' = id"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1194
  shows "(g has_derivative g') (at (f x))"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1195
  apply (rule has_derivative_inverse_basic_x[OF assms(7-9) _ _ assms(2)])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1196
  using assms(3-6)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1197
  unfolding continuous_on_eq_continuous_at[OF assms(1)] continuous_on_eq_continuous_at[OF assms(2)]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1198
  apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1199
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1200
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1201
text \<open>Here's the simplest way of not assuming much about g.\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1202
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  1203
proposition has_derivative_inverse:
56226
29fd6bd9228e generalize some theorems
huffman
parents: 56223
diff changeset
  1204
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1205
  assumes "compact S"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1206
    and "x \<in> S"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1207
    and fx: "f x \<in> interior (f ` S)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1208
    and "continuous_on S f"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1209
    and gf: "\<And>y. y \<in> S \<Longrightarrow> g (f y) = y"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1210
    and "(f has_derivative f') (at x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1211
    and "bounded_linear g'"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1212
    and "g' \<circ> f' = id"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1213
  shows "(g has_derivative g') (at (f x))"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1214
proof -
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1215
  have *: "\<And>y. y \<in> interior (f ` S) \<Longrightarrow> f (g y) = y"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1216
    by (metis gf image_iff interior_subset subsetCE)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1217
  show ?thesis
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1218
    apply (rule has_derivative_inverse_basic_x[OF assms(6-8), where T = "interior (f ` S)"])
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1219
    apply (rule continuous_on_interior[OF _ fx])
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1220
    apply (rule continuous_on_inv)
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1221
    apply (simp_all add: assms *)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1222
    done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1223
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1224
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1225
70381
b151d1f00204 More results about measure and integration theory
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  1226
text \<open>Invertible derivative continuous at a point implies local
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1227
injectivity. It's only for this we need continuity of the derivative,
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1228
except of course if we want the fact that the inverse derivative is
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1229
also continuous. So if we know for some other reason that the inverse
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1230
function exists, it's OK.\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1231
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62207
diff changeset
  1232
proposition has_derivative_locally_injective:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1233
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1234
  assumes "a \<in> S"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1235
      and "open S"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1236
      and bling: "bounded_linear g'"
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62207
diff changeset
  1237
      and "g' \<circ> f' a = id"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1238
      and derf: "\<And>x. x \<in> S \<Longrightarrow> (f has_derivative f' x) (at x)"
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62207
diff changeset
  1239
      and "\<And>e. e > 0 \<Longrightarrow> \<exists>d>0. \<forall>x. dist a x < d \<longrightarrow> onorm (\<lambda>v. f' x v - f' a v) < e"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1240
  obtains r where "r > 0" "ball a r \<subseteq> S" "inj_on f (ball a r)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1241
proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1242
  interpret bounded_linear g'
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1243
    using assms by auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1244
  note f'g' = assms(4)[unfolded id_def o_def,THEN cong]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1245
  have "g' (f' a (\<Sum>Basis)) = (\<Sum>Basis)" "(\<Sum>Basis) \<noteq> (0::'n)"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1246
    using f'g' by auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1247
  then have *: "0 < onorm g'"
56223
7696903b9e61 generalize theory of operator norms to work with class real_normed_vector
huffman
parents: 56217
diff changeset
  1248
    unfolding onorm_pos_lt[OF assms(3)]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1249
    by fastforce
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62949
diff changeset
  1250
  define k where "k = 1 / onorm g' / 2"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1251
  have *: "k > 0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1252
    unfolding k_def using * by auto
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1253
  obtain d1 where d1:
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1254
      "0 < d1"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1255
      "\<And>x. dist a x < d1 \<Longrightarrow> onorm (\<lambda>v. f' x v - f' a v) < k"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1256
    using assms(6) * by blast
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1257
  from \<open>open S\<close> obtain d2 where "d2 > 0" "ball a d2 \<subseteq> S"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1258
    using \<open>a\<in>S\<close> ..
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1259
  obtain d2 where d2: "0 < d2" "ball a d2 \<subseteq> S"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1260
    using \<open>0 < d2\<close> \<open>ball a d2 \<subseteq> S\<close> by blast
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1261
  obtain d where d: "0 < d" "d < d1" "d < d2"
68527
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68241
diff changeset
  1262
    using field_lbound_gt_zero[OF d1(1) d2(1)] by blast
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1263
  show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1264
  proof
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62207
diff changeset
  1265
    show "0 < d" by (fact d)
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1266
    show "ball a d \<subseteq> S"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1267
      using \<open>d < d2\<close> \<open>ball a d2 \<subseteq> S\<close> by auto
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62207
diff changeset
  1268
    show "inj_on f (ball a d)"
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62207
diff changeset
  1269
    unfolding inj_on_def
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1270
    proof (intro strip)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1271
      fix x y
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1272
      assume as: "x \<in> ball a d" "y \<in> ball a d" "f x = f y"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62949
diff changeset
  1273
      define ph where [abs_def]: "ph w = w - g' (f w - f x)" for w
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1274
      have ph':"ph = g' \<circ> (\<lambda>w. f' a w - (f w - f x))"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1275
        unfolding ph_def o_def  by (simp add: diff f'g')
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1276
      have "norm (ph x - ph y) \<le> (1 / 2) * norm (x - y)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1277
      proof (rule differentiable_bound[OF convex_ball _ _ as(1-2)])
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1278
        fix u
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1279
        assume u: "u \<in> ball a d"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1280
        then have "u \<in> S"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1281
          using d d2 by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1282
        have *: "(\<lambda>v. v - g' (f' u v)) = g' \<circ> (\<lambda>w. f' a w - f' u w)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1283
          unfolding o_def and diff
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1284
          using f'g' by auto
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1285
        have blin: "bounded_linear (f' a)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1286
          using \<open>a \<in> S\<close> derf by blast
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1287
        show "(ph has_derivative (\<lambda>v. v - g' (f' u v))) (at u within ball a d)"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1288
          unfolding ph' * comp_def
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1289
          by (rule \<open>u \<in> S\<close> derivative_eq_intros has_derivative_at_withinI [OF derf] bounded_linear.has_derivative [OF blin]  bounded_linear.has_derivative [OF bling] |simp)+
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1290
        have **: "bounded_linear (\<lambda>x. f' u x - f' a x)" "bounded_linear (\<lambda>x. f' a x - f' u x)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1291
          using \<open>u \<in> S\<close> blin bounded_linear_sub derf by auto
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1292
        then have "onorm (\<lambda>v. v - g' (f' u v)) \<le> onorm g' * onorm (\<lambda>w. f' a w - f' u w)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1293
          by (simp add: "*" bounded_linear_axioms onorm_compose)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1294
        also have "\<dots> \<le> onorm g' * k"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1295
          apply (rule mult_left_mono)
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1296
          using d1(2)[of u]
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1297
          using onorm_neg[where f="\<lambda>x. f' u x - f' a x"] d u onorm_pos_le[OF bling] apply (auto simp: algebra_simps)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1298
          done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1299
        also have "\<dots> \<le> 1 / 2"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1300
          unfolding k_def by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1301
        finally show "onorm (\<lambda>v. v - g' (f' u v)) \<le> 1 / 2" .
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1302
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1303
      moreover have "norm (ph y - ph x) = norm (y - x)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1304
        by (simp add: as(3) ph_def)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1305
      ultimately show "x = y"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1306
        unfolding norm_minus_commute by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1307
    qed
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62207
diff changeset
  1308
  qed
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1309
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1310
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1311
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1312
subsection \<open>Uniformly convergent sequence of derivatives\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1313
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1314
lemma has_derivative_sequence_lipschitz_lemma:
60179
d87c8c2d4938 generalized class constraints
immler
parents: 60178
diff changeset
  1315
  fixes f :: "nat \<Rightarrow> 'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1316
  assumes "convex S"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1317
    and derf: "\<And>n x. x \<in> S \<Longrightarrow> ((f n) has_derivative (f' n x)) (at x within S)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1318
    and nle: "\<And>n x h. \<lbrakk>n\<ge>N; x \<in> S\<rbrakk> \<Longrightarrow> norm (f' n x h - g' x h) \<le> e * norm h"
56271
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1319
    and "0 \<le> e"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1320
  shows "\<forall>m\<ge>N. \<forall>n\<ge>N. \<forall>x\<in>S. \<forall>y\<in>S. norm ((f m x - f n x) - (f m y - f n y)) \<le> 2 * e * norm (x - y)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1321
proof clarify
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1322
  fix m n x y
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1323
  assume as: "N \<le> m" "N \<le> n" "x \<in> S" "y \<in> S"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1324
  show "norm ((f m x - f n x) - (f m y - f n y)) \<le> 2 * e * norm (x - y)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1325
  proof (rule differentiable_bound[where f'="\<lambda>x h. f' m x h - f' n x h", OF \<open>convex S\<close> _ _ as(3-4)])
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1326
    fix x
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1327
    assume "x \<in> S"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1328
    show "((\<lambda>a. f m a - f n a) has_derivative (\<lambda>h. f' m x h - f' n x h)) (at x within S)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1329
      by (rule derivative_intros derf \<open>x\<in>S\<close>)+
56271
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1330
    show "onorm (\<lambda>h. f' m x h - f' n x h) \<le> 2 * e"
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1331
    proof (rule onorm_bound)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1332
      fix h
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1333
      have "norm (f' m x h - f' n x h) \<le> norm (f' m x h - g' x h) + norm (f' n x h - g' x h)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1334
        using norm_triangle_ineq[of "f' m x h - g' x h" "- f' n x h + g' x h"]
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1335
        by (auto simp add: algebra_simps norm_minus_commute)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1336
      also have "\<dots> \<le> e * norm h + e * norm h"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1337
        using nle[OF \<open>N \<le> m\<close> \<open>x \<in> S\<close>, of h] nle[OF \<open>N \<le> n\<close> \<open>x \<in> S\<close>, of h]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1338
        by (auto simp add: field_simps)
56271
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1339
      finally show "norm (f' m x h - f' n x h) \<le> 2 * e * norm h"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1340
        by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1341
    qed (simp add: \<open>0 \<le> e\<close>)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1342
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1343
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1344
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1345
lemma has_derivative_sequence_Lipschitz:
60179
d87c8c2d4938 generalized class constraints
immler
parents: 60178
diff changeset
  1346
  fixes f :: "nat \<Rightarrow> 'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1347
  assumes "convex S"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1348
    and "\<And>n x. x \<in> S \<Longrightarrow> ((f n) has_derivative (f' n x)) (at x within S)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1349
    and nle: "\<And>e. e > 0 \<Longrightarrow> \<forall>\<^sub>F n in sequentially. \<forall>x\<in>S. \<forall>h. norm (f' n x h - g' x h) \<le> e * norm h"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1350
    and "e > 0"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1351
  shows "\<exists>N. \<forall>m\<ge>N. \<forall>n\<ge>N. \<forall>x\<in>S. \<forall>y\<in>S.
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1352
    norm ((f m x - f n x) - (f m y - f n y)) \<le> e * norm (x - y)"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1353
proof -
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1354
  have *: "2 * (e/2) = e"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1355
    using \<open>e > 0\<close> by auto
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1356
  obtain N where "\<forall>n\<ge>N. \<forall>x\<in>S. \<forall>h. norm (f' n x h - g' x h) \<le> (e/2) * norm h"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1357
    using nle \<open>e > 0\<close>
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1358
    unfolding eventually_sequentially
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1359
    by (metis less_divide_eq_numeral1(1) mult_zero_left)
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1360
  then show "\<exists>N. \<forall>m\<ge>N. \<forall>n\<ge>N. \<forall>x\<in>S. \<forall>y\<in>S. norm (f m x - f n x - (f m y - f n y)) \<le> e * norm (x - y)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1361
    apply (rule_tac x=N in exI)
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1362
    apply (rule has_derivative_sequence_lipschitz_lemma[where e="e/2", unfolded *])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1363
    using assms \<open>e > 0\<close>
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1364
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1365
    done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1366
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1367
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  1368
proposition has_derivative_sequence:
60179
d87c8c2d4938 generalized class constraints
immler
parents: 60178
diff changeset
  1369
  fixes f :: "nat \<Rightarrow> 'a::real_normed_vector \<Rightarrow> 'b::banach"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1370
  assumes "convex S"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1371
    and derf: "\<And>n x. x \<in> S \<Longrightarrow> ((f n) has_derivative (f' n x)) (at x within S)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1372
    and nle: "\<And>e. e > 0 \<Longrightarrow> \<forall>\<^sub>F n in sequentially. \<forall>x\<in>S. \<forall>h. norm (f' n x h - g' x h) \<le> e * norm h"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1373
    and "x0 \<in> S"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1374
    and lim: "((\<lambda>n. f n x0) \<longlongrightarrow> l) sequentially"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1375
  shows "\<exists>g. \<forall>x\<in>S. (\<lambda>n. f n x) \<longlonglongrightarrow> g x \<and> (g has_derivative g'(x)) (at x within S)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1376
proof -
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1377
  have lem1: "\<And>e. e > 0 \<Longrightarrow> \<exists>N. \<forall>m\<ge>N. \<forall>n\<ge>N. \<forall>x\<in>S. \<forall>y\<in>S.
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1378
      norm ((f m x - f n x) - (f m y - f n y)) \<le> e * norm (x - y)"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1379
    using assms(1,2,3) by (rule has_derivative_sequence_Lipschitz)
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1380
  have "\<exists>g. \<forall>x\<in>S. ((\<lambda>n. f n x) \<longlongrightarrow> g x) sequentially"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1381
  proof (intro ballI bchoice)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1382
    fix x
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1383
    assume "x \<in> S"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1384
    show "\<exists>y. (\<lambda>n. f n x) \<longlonglongrightarrow> y"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1385
    unfolding convergent_eq_Cauchy
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1386
    proof (cases "x = x0")
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1387
      case True
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1388
      then show "Cauchy (\<lambda>n. f n x)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1389
        using LIMSEQ_imp_Cauchy[OF lim] by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1390
    next
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1391
      case False
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1392
      show "Cauchy (\<lambda>n. f n x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1393
        unfolding Cauchy_def
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1394
      proof (intro allI impI)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1395
        fix e :: real
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1396
        assume "e > 0"
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56445
diff changeset
  1397
        hence *: "e / 2 > 0" "e / 2 / norm (x - x0) > 0" using False by auto
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1398
        obtain M where M: "\<forall>m\<ge>M. \<forall>n\<ge>M. dist (f m x0) (f n x0) < e / 2"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1399
          using LIMSEQ_imp_Cauchy[OF lim] * unfolding Cauchy_def by blast
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1400
        obtain N where N:
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1401
          "\<forall>m\<ge>N. \<forall>n\<ge>N.
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1402
            \<forall>u\<in>S. \<forall>y\<in>S. norm (f m u - f n u - (f m y - f n y)) \<le>
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1403
              e / 2 / norm (x - x0) * norm (u - y)"
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1404
        using lem1 *(2) by blast
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1405
        show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (f m x) (f n x) < e"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1406
        proof (intro exI allI impI)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1407
          fix m n
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1408
          assume as: "max M N \<le>m" "max M N\<le>n"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1409
          have "dist (f m x) (f n x) \<le> norm (f m x0 - f n x0) + norm (f m x - f n x - (f m x0 - f n x0))"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1410
            unfolding dist_norm
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1411
            by (rule norm_triangle_sub)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1412
          also have "\<dots> \<le> norm (f m x0 - f n x0) + e / 2"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1413
            using N \<open>x\<in>S\<close> \<open>x0\<in>S\<close> as False by fastforce
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1414
          also have "\<dots> < e / 2 + e / 2"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1415
            by (rule add_strict_right_mono) (use as M in \<open>auto simp: dist_norm\<close>)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1416
          finally show "dist (f m x) (f n x) < e"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1417
            by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1418
        qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1419
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1420
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1421
  qed
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1422
  then obtain g where g: "\<forall>x\<in>S. (\<lambda>n. f n x) \<longlonglongrightarrow> g x" ..
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1423
  have lem2: "\<exists>N. \<forall>n\<ge>N. \<forall>x\<in>S. \<forall>y\<in>S. norm ((f n x - f n y) - (g x - g y)) \<le> e * norm (x - y)" if "e > 0" for e
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1424
  proof -
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1425
    obtain N where
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1426
      N: "\<forall>m\<ge>N. \<forall>n\<ge>N. \<forall>x\<in>S. \<forall>y\<in>S. norm (f m x - f n x - (f m y - f n y)) \<le> e * norm (x - y)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1427
      using lem1 \<open>e > 0\<close> by blast
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1428
    show "\<exists>N. \<forall>n\<ge>N. \<forall>x\<in>S. \<forall>y\<in>S. norm (f n x - f n y - (g x - g y)) \<le> e * norm (x - y)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1429
    proof (intro exI ballI allI impI)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1430
      fix n x y
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1431
      assume as: "N \<le> n" "x \<in> S" "y \<in> S"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  1432
      have "((\<lambda>m. norm (f n x - f n y - (f m x - f m y))) \<longlongrightarrow> norm (f n x - f n y - (g x - g y))) sequentially"
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1433
        by (intro tendsto_intros g[rule_format] as)
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1434
      moreover have "eventually (\<lambda>m. norm (f n x - f n y - (f m x - f m y)) \<le> e * norm (x - y)) sequentially"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1435
        unfolding eventually_sequentially
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1436
      proof (intro exI allI impI)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1437
        fix m
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1438
        assume "N \<le> m"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1439
        then show "norm (f n x - f n y - (f m x - f m y)) \<le> e * norm (x - y)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1440
          using N as by (auto simp add: algebra_simps)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1441
      qed
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1442
      ultimately show "norm (f n x - f n y - (g x - g y)) \<le> e * norm (x - y)"
63952
354808e9f44b new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents: 63938
diff changeset
  1443
        by (simp add: tendsto_upperbound)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1444
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1445
  qed
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1446
  have "\<forall>x\<in>S. ((\<lambda>n. f n x) \<longlongrightarrow> g x) sequentially \<and> (g has_derivative g' x) (at x within S)"
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1447
    unfolding has_derivative_within_alt2
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1448
  proof (intro ballI conjI allI impI)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1449
    fix x
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1450
    assume "x \<in> S"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1451
    then show "(\<lambda>n. f n x) \<longlonglongrightarrow> g x"
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1452
      by (simp add: g)
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1453
    have tog': "(\<lambda>n. f' n x u) \<longlonglongrightarrow> g' x u" for u
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1454
      unfolding filterlim_def le_nhds_metric_le eventually_filtermap dist_norm
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1455
    proof (intro allI impI)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1456
      fix e :: real
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1457
      assume "e > 0"
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1458
      show "eventually (\<lambda>n. norm (f' n x u - g' x u) \<le> e) sequentially"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1459
      proof (cases "u = 0")
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1460
        case True
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1461
        have "eventually (\<lambda>n. norm (f' n x u - g' x u) \<le> e * norm u) sequentially"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1462
          using nle \<open>0 < e\<close> \<open>x \<in> S\<close> by (fast elim: eventually_mono)
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1463
        then show ?thesis
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1464
          using \<open>u = 0\<close> \<open>0 < e\<close> by (auto elim: eventually_mono)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1465
      next
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1466
        case False
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1467
        with \<open>0 < e\<close> have "0 < e / norm u" by simp
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1468
        then have "eventually (\<lambda>n. norm (f' n x u - g' x u) \<le> e / norm u * norm u) sequentially"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1469
          using nle \<open>x \<in> S\<close> by (fast elim: eventually_mono)
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1470
        then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1471
          using \<open>u \<noteq> 0\<close> by simp
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1472
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1473
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1474
    show "bounded_linear (g' x)"
56271
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1475
    proof
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1476
      fix x' y z :: 'a
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1477
      fix c :: real
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1478
      note lin = assms(2)[rule_format,OF \<open>x\<in>S\<close>,THEN has_derivative_bounded_linear]
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1479
      show "g' x (c *\<^sub>R x') = c *\<^sub>R g' x x'"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1480
        apply (rule tendsto_unique[OF trivial_limit_sequentially tog'])
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1481
        unfolding lin[THEN bounded_linear.linear, THEN linear_cmul]
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1482
        apply (intro tendsto_intros tog')
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1483
        done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1484
      show "g' x (y + z) = g' x y + g' x z"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1485
        apply (rule tendsto_unique[OF trivial_limit_sequentially tog'])
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56332
diff changeset
  1486
        unfolding lin[THEN bounded_linear.linear, THEN linear_add]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1487
        apply (rule tendsto_add)
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1488
        apply (rule tog')+
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1489
        done
56271
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1490
      obtain N where N: "\<forall>h. norm (f' N x h - g' x h) \<le> 1 * norm h"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1491
        using nle \<open>x \<in> S\<close> unfolding eventually_sequentially by (fast intro: zero_less_one)
56271
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1492
      have "bounded_linear (f' N x)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1493
        using derf \<open>x \<in> S\<close> by fast
56271
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1494
      from bounded_linear.bounded [OF this]
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1495
      obtain K where K: "\<forall>h. norm (f' N x h) \<le> norm h * K" ..
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1496
      {
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1497
        fix h
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1498
        have "norm (g' x h) = norm (f' N x h - (f' N x h - g' x h))"
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1499
          by simp
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1500
        also have "\<dots> \<le> norm (f' N x h) + norm (f' N x h - g' x h)"
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1501
          by (rule norm_triangle_ineq4)
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1502
        also have "\<dots> \<le> norm h * K + 1 * norm h"
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1503
          using N K by (fast intro: add_mono)
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1504
        finally have "norm (g' x h) \<le> norm h * (K + 1)"
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1505
          by (simp add: ring_distribs)
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1506
      }
61b1e3d88e91 generalized theorems about derivatives of limits of sequences of funtions
huffman
parents: 56264
diff changeset
  1507
      then show "\<exists>K. \<forall>h. norm (g' x h) \<le> norm h * K" by fast
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1508
    qed
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1509
    show "eventually (\<lambda>y. norm (g y - g x - g' x (y - x)) \<le> e * norm (y - x)) (at x within S)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1510
      if "e > 0" for e
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1511
    proof -
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1512
      have *: "e / 3 > 0"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1513
        using that by auto
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1514
      obtain N1 where N1: "\<forall>n\<ge>N1. \<forall>x\<in>S. \<forall>h. norm (f' n x h - g' x h) \<le> e / 3 * norm h"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1515
        using nle * unfolding eventually_sequentially by blast
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1516
      obtain N2 where
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1517
          N2[rule_format]: "\<forall>n\<ge>N2. \<forall>x\<in>S. \<forall>y\<in>S. norm (f n x - f n y - (g x - g y)) \<le> e / 3 * norm (x - y)"
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1518
        using lem2 * by blast
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1519
      let ?N = "max N1 N2"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1520
      have "eventually (\<lambda>y. norm (f ?N y - f ?N x - f' ?N x (y - x)) \<le> e / 3 * norm (y - x)) (at x within S)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1521
        using derf[unfolded has_derivative_within_alt2] and \<open>x \<in> S\<close> and * by fast
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1522
      moreover have "eventually (\<lambda>y. y \<in> S) (at x within S)"
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1523
        unfolding eventually_at by (fast intro: zero_less_one)
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1524
      ultimately show "\<forall>\<^sub>F y in at x within S. norm (g y - g x - g' x (y - x)) \<le> e * norm (y - x)"
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1525
      proof (rule eventually_elim2)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1526
        fix y
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1527
        assume "y \<in> S"
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1528
        assume "norm (f ?N y - f ?N x - f' ?N x (y - x)) \<le> e / 3 * norm (y - x)"
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1529
        moreover have "norm (g y - g x - (f ?N y - f ?N x)) \<le> e / 3 * norm (y - x)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1530
          using N2[OF _ \<open>y \<in> S\<close> \<open>x \<in> S\<close>]
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1531
          by (simp add: norm_minus_commute)
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1532
        ultimately have "norm (g y - g x - f' ?N x (y - x)) \<le> 2 * e / 3 * norm (y - x)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1533
          using norm_triangle_le[of "g y - g x - (f ?N y - f ?N x)" "f ?N y - f ?N x - f' ?N x (y - x)" "2 * e / 3 * norm (y - x)"]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1534
          by (auto simp add: algebra_simps)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1535
        moreover
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1536
        have " norm (f' ?N x (y - x) - g' x (y - x)) \<le> e / 3 * norm (y - x)"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1537
          using N1 \<open>x \<in> S\<close> by auto
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1538
        ultimately show "norm (g y - g x - g' x (y - x)) \<le> e * norm (y - x)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1539
          using norm_triangle_le[of "g y - g x - f' (max N1 N2) x (y - x)" "f' (max N1 N2) x (y - x) - g' x (y - x)"]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1540
          by (auto simp add: algebra_simps)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1541
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1542
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1543
  qed
56320
e84c12d4a886 tuned proofs
huffman
parents: 56271
diff changeset
  1544
  then show ?thesis by fast
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1545
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1546
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1547
text \<open>Can choose to line up antiderivatives if we want.\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1548
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1549
lemma has_antiderivative_sequence:
60179
d87c8c2d4938 generalized class constraints
immler
parents: 60178
diff changeset
  1550
  fixes f :: "nat \<Rightarrow> 'a::real_normed_vector \<Rightarrow> 'b::banach"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1551
  assumes "convex S"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1552
    and der: "\<And>n x. x \<in> S \<Longrightarrow> ((f n) has_derivative (f' n x)) (at x within S)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1553
    and no: "\<And>e. e > 0 \<Longrightarrow> \<forall>\<^sub>F n in sequentially.
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1554
       \<forall>x\<in>S. \<forall>h. norm (f' n x h - g' x h) \<le> e * norm h"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1555
  shows "\<exists>g. \<forall>x\<in>S. (g has_derivative g' x) (at x within S)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1556
proof (cases "S = {}")
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1557
  case False
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1558
  then obtain a where "a \<in> S"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1559
    by auto
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1560
  have *: "\<And>P Q. \<exists>g. \<forall>x\<in>S. P g x \<and> Q g x \<Longrightarrow> \<exists>g. \<forall>x\<in>S. Q g x"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1561
    by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1562
  show ?thesis
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1563
    apply (rule *)
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1564
    apply (rule has_derivative_sequence [OF \<open>convex S\<close> _ no, of "\<lambda>n x. f n x + (f 0 a - f n a)"])
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1565
       apply (metis assms(2) has_derivative_add_const)
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1566
    using \<open>a \<in> S\<close> 
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1567
      apply auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1568
    done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1569
qed auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1570
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1571
lemma has_antiderivative_limit:
60179
d87c8c2d4938 generalized class constraints
immler
parents: 60178
diff changeset
  1572
  fixes g' :: "'a::real_normed_vector \<Rightarrow> 'a \<Rightarrow> 'b::banach"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1573
  assumes "convex S"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1574
    and "\<And>e. e>0 \<Longrightarrow> \<exists>f f'. \<forall>x\<in>S.
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1575
           (f has_derivative (f' x)) (at x within S) \<and> (\<forall>h. norm (f' x h - g' x h) \<le> e * norm h)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1576
  shows "\<exists>g. \<forall>x\<in>S. (g has_derivative g' x) (at x within S)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1577
proof -
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1578
  have *: "\<forall>n. \<exists>f f'. \<forall>x\<in>S.
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1579
    (f has_derivative (f' x)) (at x within S) \<and>
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1580
    (\<forall>h. norm(f' x h - g' x h) \<le> inverse (real (Suc n)) * norm h)"
61649
268d88ec9087 Tweaks for "real": Removal of [iff] status for some lemmas, adding [simp] for others. Plus fixes.
paulson <lp15@cam.ac.uk>
parents: 61560
diff changeset
  1581
    by (simp add: assms(2))
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1582
  obtain f where
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1583
    *: "\<And>x. \<exists>f'. \<forall>xa\<in>S. (f x has_derivative f' xa) (at xa within S) \<and>
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1584
        (\<forall>h. norm (f' xa h - g' xa h) \<le> inverse (real (Suc x)) * norm h)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1585
    using * by metis
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1586
  obtain f' where
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1587
    f': "\<And>x. \<forall>z\<in>S. (f x has_derivative f' x z) (at z within S) \<and>
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1588
            (\<forall>h. norm (f' x z h - g' z h) \<le> inverse (real (Suc x)) * norm h)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1589
    using * by metis
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1590
  show ?thesis
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1591
  proof (rule has_antiderivative_sequence[OF \<open>convex S\<close>, of f f'])
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1592
    fix e :: real
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1593
    assume "e > 0"
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1594
    obtain N where N: "inverse (real (Suc N)) < e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1595
      using reals_Archimedean[OF \<open>e>0\<close>] ..
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1596
    show "\<forall>\<^sub>F n in sequentially. \<forall>x\<in>S.  \<forall>h. norm (f' n x h - g' x h) \<le> e * norm h"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1597
        unfolding eventually_sequentially
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1598
    proof (intro exI allI ballI impI)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61104
diff changeset
  1599
      fix n x h
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1600
      assume n: "N \<le> n" and x: "x \<in> S"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1601
      have *: "inverse (real (Suc n)) \<le> e"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1602
        apply (rule order_trans[OF _ N[THEN less_imp_le]])
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1603
        using n apply (auto simp add: field_simps)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1604
        done
61165
8020249565fb tuned proofs;
wenzelm
parents: 61104
diff changeset
  1605
      show "norm (f' n x h - g' x h) \<le> e * norm h"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1606
        by (meson "*" mult_right_mono norm_ge_zero order.trans x f')
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1607
    qed
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1608
  qed (use f' in auto)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1609
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1610
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1611
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1612
subsection \<open>Differentiation of a series\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1613
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  1614
proposition has_derivative_series:
60179
d87c8c2d4938 generalized class constraints
immler
parents: 60178
diff changeset
  1615
  fixes f :: "nat \<Rightarrow> 'a::real_normed_vector \<Rightarrow> 'b::banach"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1616
  assumes "convex S"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1617
    and "\<And>n x. x \<in> S \<Longrightarrow> ((f n) has_derivative (f' n x)) (at x within S)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1618
    and "\<And>e. e>0 \<Longrightarrow> \<forall>\<^sub>F n in sequentially. \<forall>x\<in>S. \<forall>h. norm (sum (\<lambda>i. f' i x h) {..<n} - g' x h) \<le> e * norm h"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1619
    and "x \<in> S"
56183
f998bdd40763 remove sums_seq, it is not used
hoelzl
parents: 56182
diff changeset
  1620
    and "(\<lambda>n. f n x) sums l"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1621
  shows "\<exists>g. \<forall>x\<in>S. (\<lambda>n. f n x) sums (g x) \<and> (g has_derivative g' x) (at x within S)"
56183
f998bdd40763 remove sums_seq, it is not used
hoelzl
parents: 56182
diff changeset
  1622
  unfolding sums_def
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1623
  apply (rule has_derivative_sequence[OF assms(1) _ assms(3)])
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64240
diff changeset
  1624
  apply (metis assms(2) has_derivative_sum)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1625
  using assms(4-5)
56183
f998bdd40763 remove sums_seq, it is not used
hoelzl
parents: 56182
diff changeset
  1626
  unfolding sums_def
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1627
  apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1628
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1629
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1630
lemma has_field_derivative_series:
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1631
  fixes f :: "nat \<Rightarrow> ('a :: {real_normed_field,banach}) \<Rightarrow> 'a"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1632
  assumes "convex S"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1633
  assumes "\<And>n x. x \<in> S \<Longrightarrow> (f n has_field_derivative f' n x) (at x within S)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1634
  assumes "uniform_limit S (\<lambda>n x. \<Sum>i<n. f' i x) g' sequentially"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1635
  assumes "x0 \<in> S" "summable (\<lambda>n. f n x0)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1636
  shows   "\<exists>g. \<forall>x\<in>S. (\<lambda>n. f n x) sums g x \<and> (g has_field_derivative g' x) (at x within S)"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1637
unfolding has_field_derivative_def
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1638
proof (rule has_derivative_series)
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1639
  show "\<forall>\<^sub>F n in sequentially.
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1640
       \<forall>x\<in>S. \<forall>h. norm ((\<Sum>i<n. f' i x * h) - g' x * h) \<le> e * norm h" if "e > 0" for e
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1641
    unfolding eventually_sequentially
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1642
  proof -
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1643
    from that assms(3) obtain N where N: "\<And>n x. n \<ge> N \<Longrightarrow> x \<in> S \<Longrightarrow> norm ((\<Sum>i<n. f' i x) - g' x) < e"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1644
      unfolding uniform_limit_iff eventually_at_top_linorder dist_norm by blast
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1645
    {
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1646
      fix n :: nat and x h :: 'a assume nx: "n \<ge> N" "x \<in> S"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1647
      have "norm ((\<Sum>i<n. f' i x * h) - g' x * h) = norm ((\<Sum>i<n. f' i x) - g' x) * norm h"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64240
diff changeset
  1648
        by (simp add: norm_mult [symmetric] ring_distribs sum_distrib_right)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1649
      also from N[OF nx] have "norm ((\<Sum>i<n. f' i x) - g' x) \<le> e" by simp
61649
268d88ec9087 Tweaks for "real": Removal of [iff] status for some lemmas, adding [simp] for others. Plus fixes.
paulson <lp15@cam.ac.uk>
parents: 61560
diff changeset
  1650
      hence "norm ((\<Sum>i<n. f' i x) - g' x) * norm h \<le> e * norm h"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1651
        by (intro mult_right_mono) simp_all
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1652
      finally have "norm ((\<Sum>i<n. f' i x * h) - g' x * h) \<le> e * norm h" .
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1653
    }
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1654
    thus "\<exists>N. \<forall>n\<ge>N. \<forall>x\<in>S. \<forall>h. norm ((\<Sum>i<n. f' i x * h) - g' x * h) \<le> e * norm h" by blast
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1655
  qed
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1656
qed (use assms in \<open>auto simp: has_field_derivative_def\<close>)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1657
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1658
lemma has_field_derivative_series':
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1659
  fixes f :: "nat \<Rightarrow> ('a :: {real_normed_field,banach}) \<Rightarrow> 'a"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1660
  assumes "convex S"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1661
  assumes "\<And>n x. x \<in> S \<Longrightarrow> (f n has_field_derivative f' n x) (at x within S)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1662
  assumes "uniformly_convergent_on S (\<lambda>n x. \<Sum>i<n. f' i x)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1663
  assumes "x0 \<in> S" "summable (\<lambda>n. f n x0)" "x \<in> interior S"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1664
  shows   "summable (\<lambda>n. f n x)" "((\<lambda>x. \<Sum>n. f n x) has_field_derivative (\<Sum>n. f' n x)) (at x)"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1665
proof -
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1666
  from \<open>x \<in> interior S\<close> have "x \<in> S" using interior_subset by blast
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62949
diff changeset
  1667
  define g' where [abs_def]: "g' x = (\<Sum>i. f' i x)" for x
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1668
  from assms(3) have "uniform_limit S (\<lambda>n x. \<Sum>i<n. f' i x) g' sequentially"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1669
    by (simp add: uniformly_convergent_uniform_limit_iff suminf_eq_lim g'_def)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1670
  from has_field_derivative_series[OF assms(1,2) this assms(4,5)] obtain g where g:
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1671
    "\<And>x. x \<in> S \<Longrightarrow> (\<lambda>n. f n x) sums g x"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1672
    "\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative g' x) (at x within S)" by blast
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1673
  from g(1)[OF \<open>x \<in> S\<close>] show "summable (\<lambda>n. f n x)" by (simp add: sums_iff)
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1674
  from g(2)[OF \<open>x \<in> S\<close>] \<open>x \<in> interior S\<close> have "(g has_field_derivative g' x) (at x)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1675
    by (simp add: at_within_interior[of x S])
61649
268d88ec9087 Tweaks for "real": Removal of [iff] status for some lemmas, adding [simp] for others. Plus fixes.
paulson <lp15@cam.ac.uk>
parents: 61560
diff changeset
  1676
  also have "(g has_field_derivative g' x) (at x) \<longleftrightarrow>
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1677
                ((\<lambda>x. \<Sum>n. f n x) has_field_derivative g' x) (at x)"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1678
    using eventually_nhds_in_nhd[OF \<open>x \<in> interior S\<close>] interior_subset[of S] g(1)
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
  1679
    by (intro DERIV_cong_ev) (auto elim!: eventually_mono simp: sums_iff)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1680
  finally show "((\<lambda>x. \<Sum>n. f n x) has_field_derivative g' x) (at x)" .
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1681
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1682
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1683
lemma differentiable_series:
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1684
  fixes f :: "nat \<Rightarrow> ('a :: {real_normed_field,banach}) \<Rightarrow> 'a"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1685
  assumes "convex S" "open S"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1686
  assumes "\<And>n x. x \<in> S \<Longrightarrow> (f n has_field_derivative f' n x) (at x)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1687
  assumes "uniformly_convergent_on S (\<lambda>n x. \<Sum>i<n. f' i x)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1688
  assumes "x0 \<in> S" "summable (\<lambda>n. f n x0)" and x: "x \<in> S"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1689
  shows   "summable (\<lambda>n. f n x)" and "(\<lambda>x. \<Sum>n. f n x) differentiable (at x)"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1690
proof -
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1691
  from assms(4) obtain g' where A: "uniform_limit S (\<lambda>n x. \<Sum>i<n. f' i x) g' sequentially"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1692
    unfolding uniformly_convergent_on_def by blast
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1693
  from x and \<open>open S\<close> have S: "at x within S = at x" by (rule at_within_open)
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1694
  have "\<exists>g. \<forall>x\<in>S. (\<lambda>n. f n x) sums g x \<and> (g has_field_derivative g' x) (at x within S)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1695
    by (intro has_field_derivative_series[of S f f' g' x0] assms A has_field_derivative_at_within)
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1696
  then obtain g where g: "\<And>x. x \<in> S \<Longrightarrow> (\<lambda>n. f n x) sums g x"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1697
    "\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative g' x) (at x within S)" by blast
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1698
  from g[OF x] show "summable (\<lambda>n. f n x)" by (auto simp: summable_def)
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 69020
diff changeset
  1699
  from g(2)[OF x] have g': "(g has_derivative (*) (g' x)) (at x)"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1700
    by (simp add: has_field_derivative_def S)
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 69020
diff changeset
  1701
  have "((\<lambda>x. \<Sum>n. f n x) has_derivative (*) (g' x)) (at x)"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1702
    by (rule has_derivative_transform_within_open[OF g' \<open>open S\<close> x])
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1703
       (insert g, auto simp: sums_iff)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1704
  thus "(\<lambda>x. \<Sum>n. f n x) differentiable (at x)" unfolding differentiable_def
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1705
    by (auto simp: summable_def differentiable_def has_field_derivative_def)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1706
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1707
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1708
lemma differentiable_series':
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1709
  fixes f :: "nat \<Rightarrow> ('a :: {real_normed_field,banach}) \<Rightarrow> 'a"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1710
  assumes "convex S" "open S"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1711
  assumes "\<And>n x. x \<in> S \<Longrightarrow> (f n has_field_derivative f' n x) (at x)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1712
  assumes "uniformly_convergent_on S (\<lambda>n x. \<Sum>i<n. f' i x)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1713
  assumes "x0 \<in> S" "summable (\<lambda>n. f n x0)"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1714
  shows   "(\<lambda>x. \<Sum>n. f n x) differentiable (at x0)"
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1715
  using differentiable_series[OF assms, of x0] \<open>x0 \<in> S\<close> by blast+
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1716
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  1717
subsection \<open>Derivative as a vector\<close>
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  1718
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69553
diff changeset
  1719
text \<open>Considering derivative \<^typ>\<open>real \<Rightarrow> 'b::real_normed_vector\<close> as a vector.\<close>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1720
56381
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  1721
definition "vector_derivative f net = (SOME f'. (f has_vector_derivative f') net)"
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  1722
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1723
lemma vector_derivative_unique_within:
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1724
  assumes not_bot: "at x within S \<noteq> bot"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1725
    and f': "(f has_vector_derivative f') (at x within S)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1726
    and f'': "(f has_vector_derivative f'') (at x within S)"
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1727
  shows "f' = f''"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1728
proof -
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1729
  have "(\<lambda>x. x *\<^sub>R f') = (\<lambda>x. x *\<^sub>R f'')"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1730
  proof (rule frechet_derivative_unique_within, simp_all)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1731
    show "\<exists>d. d \<noteq> 0 \<and> \<bar>d\<bar> < e \<and> x + d \<in> S" if "0 < e"  for e
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1732
    proof -
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1733
      from that
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1734
      obtain x' where "x' \<in> S" "x' \<noteq> x" "\<bar>x' - x\<bar> < e"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1735
        using islimpt_approachable_real[of x S] not_bot
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1736
        by (auto simp add: trivial_limit_within)
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1737
      then show ?thesis
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1738
        using eq_iff_diff_eq_0 by fastforce
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1739
    qed
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1740
  qed (use f' f'' in \<open>auto simp: has_vector_derivative_def\<close>)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1741
  then show ?thesis
61649
268d88ec9087 Tweaks for "real": Removal of [iff] status for some lemmas, adding [simp] for others. Plus fixes.
paulson <lp15@cam.ac.uk>
parents: 61560
diff changeset
  1742
    unfolding fun_eq_iff by (metis scaleR_one)
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1743
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1744
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1745
lemma vector_derivative_unique_at:
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1746
  "(f has_vector_derivative f') (at x) \<Longrightarrow> (f has_vector_derivative f'') (at x) \<Longrightarrow> f' = f''"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1747
  by (rule vector_derivative_unique_within) auto
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1748
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1749
lemma differentiableI_vector: "(f has_vector_derivative y) F \<Longrightarrow> f differentiable F"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1750
  by (auto simp: differentiable_def has_vector_derivative_def)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1751
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  1752
proposition vector_derivative_works:
56381
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  1753
  "f differentiable net \<longleftrightarrow> (f has_vector_derivative (vector_derivative f net)) net"
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  1754
    (is "?l = ?r")
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  1755
proof
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  1756
  assume ?l
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  1757
  obtain f' where f': "(f has_derivative f') net"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60179
diff changeset
  1758
    using \<open>?l\<close> unfolding differentiable_def ..
56381
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  1759
  then interpret bounded_linear f'
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  1760
    by auto
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  1761
  show ?r
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  1762
    unfolding vector_derivative_def has_vector_derivative_def
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  1763
    by (rule someI[of _ "f' 1"]) (simp add: scaleR[symmetric] f')
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  1764
qed (auto simp: vector_derivative_def has_vector_derivative_def differentiable_def)
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  1765
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1766
lemma vector_derivative_within:
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1767
  assumes not_bot: "at x within S \<noteq> bot" and y: "(f has_vector_derivative y) (at x within S)"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1768
  shows "vector_derivative f (at x within S) = y"
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1769
  using y
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1770
  by (intro vector_derivative_unique_within[OF not_bot vector_derivative_works[THEN iffD1] y])
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1771
     (auto simp: differentiable_def has_vector_derivative_def)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1772
61520
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1773
lemma frechet_derivative_eq_vector_derivative:
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1774
  assumes "f differentiable (at x)"
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1775
    shows  "(frechet_derivative f (at x)) = (\<lambda>r. r *\<^sub>R vector_derivative f (at x))"
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1776
using assms
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1777
by (auto simp: differentiable_iff_scaleR vector_derivative_def has_vector_derivative_def
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1778
         intro: someI frechet_derivative_at [symmetric])
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1779
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1780
lemma has_real_derivative:
61649
268d88ec9087 Tweaks for "real": Removal of [iff] status for some lemmas, adding [simp] for others. Plus fixes.
paulson <lp15@cam.ac.uk>
parents: 61560
diff changeset
  1781
  fixes f :: "real \<Rightarrow> real"
61520
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1782
  assumes "(f has_derivative f') F"
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1783
  obtains c where "(f has_real_derivative c) F"
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1784
proof -
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1785
  obtain c where "f' = (\<lambda>x. x * c)"
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1786
    by (metis assms has_derivative_bounded_linear real_bounded_linear)
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1787
  then show ?thesis
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1788
    by (metis assms that has_field_derivative_def mult_commute_abs)
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1789
qed
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1790
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1791
lemma has_real_derivative_iff:
61649
268d88ec9087 Tweaks for "real": Removal of [iff] status for some lemmas, adding [simp] for others. Plus fixes.
paulson <lp15@cam.ac.uk>
parents: 61560
diff changeset
  1792
  fixes f :: "real \<Rightarrow> real"
61520
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1793
  shows "(\<exists>c. (f has_real_derivative c) F) = (\<exists>D. (f has_derivative D) F)"
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1794
  by (metis has_field_derivative_def has_real_derivative)
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  1795
64008
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63955
diff changeset
  1796
lemma has_vector_derivative_cong_ev:
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1797
  assumes *: "eventually (\<lambda>x. x \<in> S \<longrightarrow> f x = g x) (nhds x)" "f x = g x"
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1798
  shows "(f has_vector_derivative f') (at x within S) = (g has_vector_derivative f') (at x within S)"
64008
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63955
diff changeset
  1799
  unfolding has_vector_derivative_def has_derivative_def
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63955
diff changeset
  1800
  using *
68055
2cab37094fc4 more defer/prefer
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  1801
  apply (cases "at x within S \<noteq> bot")
64008
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63955
diff changeset
  1802
  apply (intro refl conj_cong filterlim_cong)
70065
cc89a395b5a3 Free_Abelian_Groups finally working; fixed some duplicates; cleaned up some proofs
paulson <lp15@cam.ac.uk>
parents: 69712
diff changeset
  1803
  apply (auto simp: Lim_ident_at eventually_at_filter elim: eventually_mono)
64008
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63955
diff changeset
  1804
  done
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63955
diff changeset
  1805
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1806
lemma islimpt_closure_open:
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1807
  fixes s :: "'a::perfect_space set"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1808
  assumes "open s" and t: "t = closure s" "x \<in> t"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1809
  shows "x islimpt t"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1810
proof cases
61649
268d88ec9087 Tweaks for "real": Removal of [iff] status for some lemmas, adding [simp] for others. Plus fixes.
paulson <lp15@cam.ac.uk>
parents: 61560
diff changeset
  1811
  assume "x \<in> s"
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1812
  { fix T assume "x \<in> T" "open T"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1813
    then have "open (s \<inter> T)"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1814
      using \<open>open s\<close> by auto
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1815
    then have "s \<inter> T \<noteq> {x}"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1816
      using not_open_singleton[of x] by auto
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1817
    with \<open>x \<in> T\<close> \<open>x \<in> s\<close> have "\<exists>y\<in>t. y \<in> T \<and> y \<noteq> x"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1818
      using closure_subset[of s] by (auto simp: t) }
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1819
  then show ?thesis
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1820
    by (auto intro!: islimptI)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1821
next
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1822
  assume "x \<notin> s" with t show ?thesis
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1823
    unfolding t closure_def by (auto intro: islimpt_subset)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1824
qed
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1825
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1826
lemma vector_derivative_unique_within_closed_interval:
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1827
  assumes ab: "a < b" "x \<in> cbox a b"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1828
  assumes D: "(f has_vector_derivative f') (at x within cbox a b)" "(f has_vector_derivative f'') (at x within cbox a b)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1829
  shows "f' = f''"
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1830
  using ab
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1831
  by (intro vector_derivative_unique_within[OF _ D])
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1832
     (auto simp: trivial_limit_within intro!: islimpt_closure_open[where s="{a <..< b}"])
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1833
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1834
lemma vector_derivative_at:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1835
  "(f has_vector_derivative f') (at x) \<Longrightarrow> vector_derivative f (at x) = f'"
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1836
  by (intro vector_derivative_within at_neq_bot)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1837
61104
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1838
lemma has_vector_derivative_id_at [simp]: "vector_derivative (\<lambda>x. x) (at a) = 1"
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1839
  by (simp add: vector_derivative_at)
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1840
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1841
lemma vector_derivative_minus_at [simp]:
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1842
  "f differentiable at a
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1843
   \<Longrightarrow> vector_derivative (\<lambda>x. - f x) (at a) = - vector_derivative f (at a)"
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1844
  by (simp add: vector_derivative_at has_vector_derivative_minus vector_derivative_works [symmetric])
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1845
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1846
lemma vector_derivative_add_at [simp]:
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1847
  "\<lbrakk>f differentiable at a; g differentiable at a\<rbrakk>
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1848
   \<Longrightarrow> vector_derivative (\<lambda>x. f x + g x) (at a) = vector_derivative f (at a) + vector_derivative g (at a)"
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1849
  by (simp add: vector_derivative_at has_vector_derivative_add vector_derivative_works [symmetric])
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1850
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1851
lemma vector_derivative_diff_at [simp]:
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1852
  "\<lbrakk>f differentiable at a; g differentiable at a\<rbrakk>
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1853
   \<Longrightarrow> vector_derivative (\<lambda>x. f x - g x) (at a) = vector_derivative f (at a) - vector_derivative g (at a)"
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1854
  by (simp add: vector_derivative_at has_vector_derivative_diff vector_derivative_works [symmetric])
3c2d4636cebc new lemmas about vector_derivative, complex numbers, paths, etc.
paulson
parents: 61076
diff changeset
  1855
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1856
lemma vector_derivative_mult_at [simp]:
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1857
  fixes f g :: "real \<Rightarrow> 'a :: real_normed_algebra"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1858
  shows  "\<lbrakk>f differentiable at a; g differentiable at a\<rbrakk>
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1859
   \<Longrightarrow> vector_derivative (\<lambda>x. f x * g x) (at a) = f a * vector_derivative g (at a) + vector_derivative f (at a) * g a"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1860
  by (simp add: vector_derivative_at has_vector_derivative_mult vector_derivative_works [symmetric])
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1861
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1862
lemma vector_derivative_scaleR_at [simp]:
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1863
    "\<lbrakk>f differentiable at a; g differentiable at a\<rbrakk>
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1864
   \<Longrightarrow> vector_derivative (\<lambda>x. f x *\<^sub>R g x) (at a) = f a *\<^sub>R vector_derivative g (at a) + vector_derivative f (at a) *\<^sub>R g a"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1865
apply (rule vector_derivative_at)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1866
apply (rule has_vector_derivative_scaleR)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1867
apply (auto simp: vector_derivative_works has_vector_derivative_def has_field_derivative_def mult_commute_abs)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1868
done
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1869
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1870
lemma vector_derivative_within_cbox:
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1871
  assumes ab: "a < b" "x \<in> cbox a b"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1872
  assumes f: "(f has_vector_derivative f') (at x within cbox a b)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
  1873
  shows "vector_derivative f (at x within cbox a b) = f'"
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1874
  by (intro vector_derivative_unique_within_closed_interval[OF ab _ f]
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1875
            vector_derivative_works[THEN iffD1] differentiableI_vector)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1876
     fact
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1877
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1878
lemma vector_derivative_within_closed_interval:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1879
  fixes f::"real \<Rightarrow> 'a::euclidean_space"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1880
  assumes "a < b" and "x \<in> {a..b}"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1881
  assumes "(f has_vector_derivative f') (at x within {a..b})"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1882
  shows "vector_derivative f (at x within {a..b}) = f'"
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1883
  using assms vector_derivative_within_cbox
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1884
  by fastforce
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1885
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1886
lemma has_vector_derivative_within_subset:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1887
  "(f has_vector_derivative f') (at x within S) \<Longrightarrow> T \<subseteq> S \<Longrightarrow> (f has_vector_derivative f') (at x within T)"
56381
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  1888
  by (auto simp: has_vector_derivative_def intro: has_derivative_within_subset)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1889
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1890
lemma has_vector_derivative_at_within:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1891
  "(f has_vector_derivative f') (at x) \<Longrightarrow> (f has_vector_derivative f') (at x within S)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1892
  unfolding has_vector_derivative_def
67979
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  1893
  by (rule has_derivative_at_withinI)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1894
61880
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61824
diff changeset
  1895
lemma has_vector_derivative_weaken:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1896
  fixes x D and f g S T
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1897
  assumes f: "(f has_vector_derivative D) (at x within T)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1898
    and "x \<in> S" "S \<subseteq> T"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1899
    and "\<And>x. x \<in> S \<Longrightarrow> f x = g x"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1900
  shows "(g has_vector_derivative D) (at x within S)"
61880
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61824
diff changeset
  1901
proof -
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1902
  have "(f has_vector_derivative D) (at x within S) \<longleftrightarrow> (g has_vector_derivative D) (at x within S)"
61880
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61824
diff changeset
  1903
    unfolding has_vector_derivative_def has_derivative_iff_norm
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61824
diff changeset
  1904
    using assms by (intro conj_cong Lim_cong_within refl) auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61824
diff changeset
  1905
  then show ?thesis
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1906
    using has_vector_derivative_within_subset[OF f \<open>S \<subseteq> T\<close>] by simp
61880
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61824
diff changeset
  1907
qed
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61824
diff changeset
  1908
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1909
lemma has_vector_derivative_transform_within:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1910
  assumes "(f has_vector_derivative f') (at x within S)"
62087
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 61975
diff changeset
  1911
    and "0 < d"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1912
    and "x \<in> S"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1913
    and "\<And>x'. \<lbrakk>x'\<in>S; dist x' x < d\<rbrakk> \<Longrightarrow> f x' = g x'"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1914
    shows "(g has_vector_derivative f') (at x within S)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1915
  using assms
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1916
  unfolding has_vector_derivative_def
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1917
  by (rule has_derivative_transform_within)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1918
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1919
lemma has_vector_derivative_transform_within_open:
62087
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 61975
diff changeset
  1920
  assumes "(f has_vector_derivative f') (at x)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1921
    and "open S"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1922
    and "x \<in> S"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1923
    and "\<And>y. y\<in>S \<Longrightarrow> f y = g y"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1924
  shows "(g has_vector_derivative f') (at x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1925
  using assms
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1926
  unfolding has_vector_derivative_def
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1927
  by (rule has_derivative_transform_within_open)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1928
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1929
lemma has_vector_derivative_transform:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1930
  assumes "x \<in> S" "\<And>x. x \<in> S \<Longrightarrow> g x = f x"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1931
  assumes f': "(f has_vector_derivative f') (at x within S)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1932
  shows "(g has_vector_derivative f') (at x within S)"
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1933
  using assms
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1934
  unfolding has_vector_derivative_def
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1935
  by (rule has_derivative_transform)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1936
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1937
lemma vector_diff_chain_at:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1938
  assumes "(f has_vector_derivative f') (at x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1939
    and "(g has_vector_derivative g') (at (f x))"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1940
  shows "((g \<circ> f) has_vector_derivative (f' *\<^sub>R g')) (at x)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1941
  using assms has_vector_derivative_at_within has_vector_derivative_def vector_derivative_diff_chain_within by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1942
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1943
lemma vector_diff_chain_within:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1944
  assumes "(f has_vector_derivative f') (at x within s)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1945
    and "(g has_vector_derivative g') (at (f x) within f ` s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1946
  shows "((g \<circ> f) has_vector_derivative (f' *\<^sub>R g')) (at x within s)"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1947
  using assms has_vector_derivative_def vector_derivative_diff_chain_within by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1948
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60589
diff changeset
  1949
lemma vector_derivative_const_at [simp]: "vector_derivative (\<lambda>x. c) (at a) = 0"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60589
diff changeset
  1950
  by (simp add: vector_derivative_at)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60589
diff changeset
  1951
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  1952
lemma vector_derivative_at_within_ivl:
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  1953
  "(f has_vector_derivative f') (at x) \<Longrightarrow>
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  1954
    a \<le> x \<Longrightarrow> x \<le> b \<Longrightarrow> a<b \<Longrightarrow> vector_derivative f (at x within {a..b}) = f'"
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  1955
  using has_vector_derivative_at_within vector_derivative_within_cbox by fastforce
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  1956
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1957
lemma vector_derivative_chain_at:
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1958
  assumes "f differentiable at x" "(g differentiable at (f x))"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1959
  shows "vector_derivative (g \<circ> f) (at x) =
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1960
         vector_derivative f (at x) *\<^sub>R vector_derivative g (at (f x))"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1961
by (metis vector_diff_chain_at vector_derivative_at vector_derivative_works assms)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61165
diff changeset
  1962
62408
86f27b264d3d Conformal_mappings: a big development in complex analysis (+ some lemmas)
paulson <lp15@cam.ac.uk>
parents: 62393
diff changeset
  1963
lemma field_vector_diff_chain_at:  (*thanks to Wenda Li*)
86f27b264d3d Conformal_mappings: a big development in complex analysis (+ some lemmas)
paulson <lp15@cam.ac.uk>
parents: 62393
diff changeset
  1964
 assumes Df: "(f has_vector_derivative f') (at x)"
86f27b264d3d Conformal_mappings: a big development in complex analysis (+ some lemmas)
paulson <lp15@cam.ac.uk>
parents: 62393
diff changeset
  1965
     and Dg: "(g has_field_derivative g') (at (f x))"
86f27b264d3d Conformal_mappings: a big development in complex analysis (+ some lemmas)
paulson <lp15@cam.ac.uk>
parents: 62393
diff changeset
  1966
 shows "((g \<circ> f) has_vector_derivative (f' * g')) (at x)"
86f27b264d3d Conformal_mappings: a big development in complex analysis (+ some lemmas)
paulson <lp15@cam.ac.uk>
parents: 62393
diff changeset
  1967
using diff_chain_at[OF Df[unfolded has_vector_derivative_def]
86f27b264d3d Conformal_mappings: a big development in complex analysis (+ some lemmas)
paulson <lp15@cam.ac.uk>
parents: 62393
diff changeset
  1968
                       Dg [unfolded has_field_derivative_def]]
86f27b264d3d Conformal_mappings: a big development in complex analysis (+ some lemmas)
paulson <lp15@cam.ac.uk>
parents: 62393
diff changeset
  1969
 by (auto simp: o_def mult.commute has_vector_derivative_def)
86f27b264d3d Conformal_mappings: a big development in complex analysis (+ some lemmas)
paulson <lp15@cam.ac.uk>
parents: 62393
diff changeset
  1970
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1971
lemma vector_derivative_chain_within: 
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1972
  assumes "at x within S \<noteq> bot" "f differentiable (at x within S)" 
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1973
    "(g has_derivative g') (at (f x) within f ` S)" 
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1974
  shows "vector_derivative (g \<circ> f) (at x within S) =
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1975
        g' (vector_derivative f (at x within S)) "
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1976
  apply (rule vector_derivative_within [OF \<open>at x within S \<noteq> bot\<close>])
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1977
  apply (rule vector_derivative_diff_chain_within)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1978
  using assms(2-3) vector_derivative_works
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1979
  by auto
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1980
69553
2c2e2b3e19b7 tuned header
nipkow
parents: 69529
diff changeset
  1981
subsection \<open>Field differentiability\<close>
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1982
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70065
diff changeset
  1983
definition\<^marker>\<open>tag important\<close> field_differentiable :: "['a \<Rightarrow> 'a::real_normed_field, 'a filter] \<Rightarrow> bool"
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1984
           (infixr "(field'_differentiable)" 50)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1985
  where "f field_differentiable F \<equiv> \<exists>f'. (f has_field_derivative f') F"
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1986
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1987
lemma field_differentiable_imp_differentiable:
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1988
  "f field_differentiable F \<Longrightarrow> f differentiable F"
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1989
  unfolding field_differentiable_def differentiable_def 
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1990
  using has_field_derivative_imp_has_derivative by auto
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1991
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1992
lemma field_differentiable_imp_continuous_at:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1993
    "f field_differentiable (at x within S) \<Longrightarrow> continuous (at x within S) f"
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1994
  by (metis DERIV_continuous field_differentiable_def)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1995
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1996
lemma field_differentiable_within_subset:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  1997
    "\<lbrakk>f field_differentiable (at x within S); T \<subseteq> S\<rbrakk> \<Longrightarrow> f field_differentiable (at x within T)"
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1998
  by (metis DERIV_subset field_differentiable_def)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  1999
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2000
lemma field_differentiable_at_within:
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2001
    "\<lbrakk>f field_differentiable (at x)\<rbrakk>
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2002
     \<Longrightarrow> f field_differentiable (at x within S)"
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2003
  unfolding field_differentiable_def
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2004
  by (metis DERIV_subset top_greatest)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2005
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 69020
diff changeset
  2006
lemma field_differentiable_linear [simp,derivative_intros]: "((*) c) field_differentiable F"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2007
  unfolding field_differentiable_def has_field_derivative_def mult_commute_abs
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2008
  by (force intro: has_derivative_mult_right)
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2009
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2010
lemma field_differentiable_const [simp,derivative_intros]: "(\<lambda>z. c) field_differentiable F"
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2011
  unfolding field_differentiable_def has_field_derivative_def
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2012
  using DERIV_const has_field_derivative_imp_has_derivative by blast
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2013
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2014
lemma field_differentiable_ident [simp,derivative_intros]: "(\<lambda>z. z) field_differentiable F"
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2015
  unfolding field_differentiable_def has_field_derivative_def
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2016
  using DERIV_ident has_field_derivative_def by blast
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2017
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2018
lemma field_differentiable_id [simp,derivative_intros]: "id field_differentiable F"
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2019
  unfolding id_def by (rule field_differentiable_ident)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2020
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2021
lemma field_differentiable_minus [derivative_intros]:
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2022
  "f field_differentiable F \<Longrightarrow> (\<lambda>z. - (f z)) field_differentiable F"
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2023
  unfolding field_differentiable_def
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2024
  by (metis field_differentiable_minus)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2025
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2026
lemma field_differentiable_add [derivative_intros]:
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2027
  assumes "f field_differentiable F" "g field_differentiable F"
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2028
    shows "(\<lambda>z. f z + g z) field_differentiable F"
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2029
  using assms unfolding field_differentiable_def
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2030
  by (metis field_differentiable_add)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2031
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2032
lemma field_differentiable_add_const [simp,derivative_intros]:
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66394
diff changeset
  2033
     "(+) c field_differentiable F"
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2034
  by (simp add: field_differentiable_add)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2035
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2036
lemma field_differentiable_sum [derivative_intros]:
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2037
  "(\<And>i. i \<in> I \<Longrightarrow> (f i) field_differentiable F) \<Longrightarrow> (\<lambda>z. \<Sum>i\<in>I. f i z) field_differentiable F"
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2038
  by (induct I rule: infinite_finite_induct)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2039
     (auto intro: field_differentiable_add field_differentiable_const)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2040
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2041
lemma field_differentiable_diff [derivative_intros]:
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2042
  assumes "f field_differentiable F" "g field_differentiable F"
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2043
    shows "(\<lambda>z. f z - g z) field_differentiable F"
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2044
  using assms unfolding field_differentiable_def
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2045
  by (metis field_differentiable_diff)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2046
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2047
lemma field_differentiable_inverse [derivative_intros]:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2048
  assumes "f field_differentiable (at a within S)" "f a \<noteq> 0"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2049
  shows "(\<lambda>z. inverse (f z)) field_differentiable (at a within S)"
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2050
  using assms unfolding field_differentiable_def
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2051
  by (metis DERIV_inverse_fun)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2052
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2053
lemma field_differentiable_mult [derivative_intros]:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2054
  assumes "f field_differentiable (at a within S)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2055
          "g field_differentiable (at a within S)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2056
    shows "(\<lambda>z. f z * g z) field_differentiable (at a within S)"
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2057
  using assms unfolding field_differentiable_def
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2058
  by (metis DERIV_mult [of f _ a S g])
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2059
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2060
lemma field_differentiable_divide [derivative_intros]:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2061
  assumes "f field_differentiable (at a within S)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2062
          "g field_differentiable (at a within S)"
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2063
          "g a \<noteq> 0"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2064
    shows "(\<lambda>z. f z / g z) field_differentiable (at a within S)"
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2065
  using assms unfolding field_differentiable_def
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2066
  by (metis DERIV_divide [of f _ a S g])
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2067
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2068
lemma field_differentiable_power [derivative_intros]:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2069
  assumes "f field_differentiable (at a within S)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2070
    shows "(\<lambda>z. f z ^ n) field_differentiable (at a within S)"
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2071
  using assms unfolding field_differentiable_def
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2072
  by (metis DERIV_power)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2073
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2074
lemma field_differentiable_transform_within:
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2075
  "0 < d \<Longrightarrow>
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2076
        x \<in> S \<Longrightarrow>
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2077
        (\<And>x'. x' \<in> S \<Longrightarrow> dist x' x < d \<Longrightarrow> f x' = g x') \<Longrightarrow>
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2078
        f field_differentiable (at x within S)
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2079
        \<Longrightarrow> g field_differentiable (at x within S)"
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2080
  unfolding field_differentiable_def has_field_derivative_def
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2081
  by (blast intro: has_derivative_transform_within)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2082
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2083
lemma field_differentiable_compose_within:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2084
  assumes "f field_differentiable (at a within S)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2085
          "g field_differentiable (at (f a) within f`S)"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2086
    shows "(g o f) field_differentiable (at a within S)"
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2087
  using assms unfolding field_differentiable_def
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2088
  by (metis DERIV_image_chain)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2089
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2090
lemma field_differentiable_compose:
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2091
  "f field_differentiable at z \<Longrightarrow> g field_differentiable at (f z)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2092
          \<Longrightarrow> (g o f) field_differentiable at z"
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2093
by (metis field_differentiable_at_within field_differentiable_compose_within)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2094
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2095
lemma field_differentiable_within_open:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2096
     "\<lbrakk>a \<in> S; open S\<rbrakk> \<Longrightarrow> f field_differentiable at a within S \<longleftrightarrow>
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2097
                          f field_differentiable at a"
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2098
  unfolding field_differentiable_def
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2099
  by (metis at_within_open)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  2100
62949
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2101
lemma exp_scaleR_has_vector_derivative_right:
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2102
  "((\<lambda>t. exp (t *\<^sub>R A)) has_vector_derivative exp (t *\<^sub>R A) * A) (at t within T)"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2103
  unfolding has_vector_derivative_def
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2104
proof (rule has_derivativeI)
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2105
  let ?F = "at t within (T \<inter> {t - 1 <..< t + 1})"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2106
  have *: "at t within T = ?F"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2107
    by (rule at_within_nhd[where S="{t - 1 <..< t + 1}"]) auto
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2108
  let ?e = "\<lambda>i x. (inverse (1 + real i) * inverse (fact i) * (x - t) ^ i) *\<^sub>R (A * A ^ i)"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2109
  have "\<forall>\<^sub>F n in sequentially.
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2110
      \<forall>x\<in>T \<inter> {t - 1<..<t + 1}. norm (?e n x) \<le> norm (A ^ (n + 1) /\<^sub>R fact (n + 1))"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2111
    by (auto simp: divide_simps power_abs intro!: mult_left_le_one_le power_le_one eventuallyI)
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2112
  then have "uniform_limit (T \<inter> {t - 1<..<t + 1}) (\<lambda>n x. \<Sum>i<n. ?e i x) (\<lambda>x. \<Sum>i. ?e i x) sequentially"
69529
4ab9657b3257 capitalize proper names in lemma names
nipkow
parents: 69064
diff changeset
  2113
    by (rule Weierstrass_m_test_ev) (intro summable_ignore_initial_segment summable_norm_exp)
62949
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2114
  moreover
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2115
  have "\<forall>\<^sub>F x in sequentially. x > 0"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2116
    by (metis eventually_gt_at_top)
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2117
  then have
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2118
    "\<forall>\<^sub>F n in sequentially. ((\<lambda>x. \<Sum>i<n. ?e i x) \<longlongrightarrow> A) ?F"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2119
    by eventually_elim
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2120
      (auto intro!: tendsto_eq_intros
69529
4ab9657b3257 capitalize proper names in lemma names
nipkow
parents: 69064
diff changeset
  2121
        simp: power_0_left if_distrib if_distribR
62949
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2122
        cong: if_cong)
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2123
  ultimately
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2124
  have [tendsto_intros]: "((\<lambda>x. \<Sum>i. ?e i x) \<longlongrightarrow> A) ?F"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2125
    by (auto intro!: swap_uniform_limit[where f="\<lambda>n x. \<Sum>i < n. ?e i x" and F = sequentially])
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2126
  have [tendsto_intros]: "((\<lambda>x. if x = t then 0 else 1) \<longlongrightarrow> 1) ?F"
70365
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 70346
diff changeset
  2127
    by (rule tendsto_eventually) (simp add: eventually_at_filter)
62949
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2128
  have "((\<lambda>y. ((y - t) / abs (y - t)) *\<^sub>R ((\<Sum>n. ?e n y) - A)) \<longlongrightarrow> 0) (at t within T)"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2129
    unfolding *
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2130
    by (rule tendsto_norm_zero_cancel) (auto intro!: tendsto_eq_intros)
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2131
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2132
  moreover have "\<forall>\<^sub>F x in at t within T. x \<noteq> t"
62949
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2133
    by (simp add: eventually_at_filter)
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2134
  then have "\<forall>\<^sub>F x in at t within T. ((x - t) / \<bar>x - t\<bar>) *\<^sub>R ((\<Sum>n. ?e n x) - A) =
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2135
    (exp ((x - t) *\<^sub>R A) - 1 - (x - t) *\<^sub>R A) /\<^sub>R norm (x - t)"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2136
  proof eventually_elim
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2137
    case (elim x)
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2138
    have "(exp ((x - t) *\<^sub>R A) - 1 - (x - t) *\<^sub>R A) /\<^sub>R norm (x - t) =
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2139
      ((\<Sum>n. (x - t) *\<^sub>R ?e n x) - (x - t) *\<^sub>R A) /\<^sub>R norm (x - t)"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2140
      unfolding exp_first_term
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2141
      by (simp add: ac_simps)
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2142
    also
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2143
    have "summable (\<lambda>n. ?e n x)"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2144
    proof -
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2145
      from elim have "?e n x = (((x - t) *\<^sub>R A) ^ (n + 1)) /\<^sub>R fact (n + 1) /\<^sub>R (x - t)" for n
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2146
        by simp
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2147
      then show ?thesis
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2148
        by (auto simp only:
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2149
          intro!: summable_scaleR_right summable_ignore_initial_segment summable_exp_generic)
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2150
    qed
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2151
    then have "(\<Sum>n. (x - t) *\<^sub>R ?e n x) = (x - t) *\<^sub>R (\<Sum>n. ?e n x)"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2152
      by (rule suminf_scaleR_right[symmetric])
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2153
    also have "(\<dots> - (x - t) *\<^sub>R A) /\<^sub>R norm (x - t) = (x - t) *\<^sub>R ((\<Sum>n. ?e n x) - A) /\<^sub>R norm (x - t)"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2154
      by (simp add: algebra_simps)
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2155
    finally show ?case
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2156
      by (simp add: divide_simps)
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2157
  qed
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2158
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2159
  ultimately have "((\<lambda>y. (exp ((y - t) *\<^sub>R A) - 1 - (y - t) *\<^sub>R A) /\<^sub>R norm (y - t)) \<longlongrightarrow> 0) (at t within T)"
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70381
diff changeset
  2160
    by (rule Lim_transform_eventually)
62949
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2161
  from tendsto_mult_right_zero[OF this, where c="exp (t *\<^sub>R A)"]
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2162
  show "((\<lambda>y. (exp (y *\<^sub>R A) - exp (t *\<^sub>R A) - (y - t) *\<^sub>R (exp (t *\<^sub>R A) * A)) /\<^sub>R norm (y - t)) \<longlongrightarrow> 0)
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2163
      (at t within T)"
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70381
diff changeset
  2164
    by (rule Lim_transform_eventually)
62949
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2165
      (auto simp: algebra_simps divide_simps exp_add_commuting[symmetric])
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2166
qed (rule bounded_linear_scaleR_left)
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2167
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2168
lemma exp_times_scaleR_commute: "exp (t *\<^sub>R A) * A = A * exp (t *\<^sub>R A)"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2169
  using exp_times_arg_commute[symmetric, of "t *\<^sub>R A"]
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2170
  by (auto simp: algebra_simps)
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2171
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2172
lemma exp_scaleR_has_vector_derivative_left: "((\<lambda>t. exp (t *\<^sub>R A)) has_vector_derivative A * exp (t *\<^sub>R A)) (at t)"
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2173
  using exp_scaleR_has_vector_derivative_right[of A t]
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2174
  by (simp add: exp_times_scaleR_commute)
f36a54da47a4 added derivative of scaling in exponential function
immler
parents: 62533
diff changeset
  2175
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2176
subsection \<open>Field derivative\<close>
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2177
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70065
diff changeset
  2178
definition\<^marker>\<open>tag important\<close> deriv :: "('a \<Rightarrow> 'a::real_normed_field) \<Rightarrow> 'a \<Rightarrow> 'a" where
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2179
  "deriv f x \<equiv> SOME D. DERIV f x :> D"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2180
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2181
lemma DERIV_imp_deriv: "DERIV f x :> f' \<Longrightarrow> deriv f x = f'"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2182
  unfolding deriv_def by (metis some_equality DERIV_unique)
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2183
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2184
lemma DERIV_deriv_iff_has_field_derivative:
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2185
  "DERIV f x :> deriv f x \<longleftrightarrow> (\<exists>f'. (f has_field_derivative f') (at x))"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2186
  by (auto simp: has_field_derivative_def DERIV_imp_deriv)
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2187
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2188
lemma DERIV_deriv_iff_real_differentiable:
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2189
  fixes x :: real
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2190
  shows "DERIV f x :> deriv f x \<longleftrightarrow> f differentiable at x"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2191
  unfolding differentiable_def by (metis DERIV_imp_deriv has_real_derivative_iff)
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2192
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2193
lemma deriv_cong_ev:
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2194
  assumes "eventually (\<lambda>x. f x = g x) (nhds x)" "x = y"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2195
  shows   "deriv f x = deriv g y"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2196
proof -
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2197
  have "(\<lambda>D. (f has_field_derivative D) (at x)) = (\<lambda>D. (g has_field_derivative D) (at y))"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2198
    by (intro ext DERIV_cong_ev refl assms)
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2199
  thus ?thesis by (simp add: deriv_def assms)
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2200
qed
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2201
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2202
lemma higher_deriv_cong_ev:
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2203
  assumes "eventually (\<lambda>x. f x = g x) (nhds x)" "x = y"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2204
  shows   "(deriv ^^ n) f x = (deriv ^^ n) g y"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2205
proof -
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2206
  from assms(1) have "eventually (\<lambda>x. (deriv ^^ n) f x = (deriv ^^ n) g x) (nhds x)"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2207
  proof (induction n arbitrary: f g)
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2208
    case (Suc n)
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2209
    from Suc.prems have "eventually (\<lambda>y. eventually (\<lambda>z. f z = g z) (nhds y)) (nhds x)"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2210
      by (simp add: eventually_eventually)
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2211
    hence "eventually (\<lambda>x. deriv f x = deriv g x) (nhds x)"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2212
      by eventually_elim (rule deriv_cong_ev, simp_all)
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2213
    thus ?case by (auto intro!: deriv_cong_ev Suc simp: funpow_Suc_right simp del: funpow.simps)
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2214
  qed auto
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2215
  from eventually_nhds_x_imp_x[OF this] assms(2) show ?thesis by simp
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2216
qed
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2217
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2218
lemma real_derivative_chain:
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2219
  fixes x :: real
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2220
  shows "f differentiable at x \<Longrightarrow> g differentiable at (f x)
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2221
    \<Longrightarrow> deriv (g o f) x = deriv g (f x) * deriv f x"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2222
  by (metis DERIV_deriv_iff_real_differentiable DERIV_chain DERIV_imp_deriv)
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2223
lemma field_derivative_eq_vector_derivative:
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2224
   "(deriv f x) = vector_derivative f (at x)"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2225
by (simp add: mult.commute deriv_def vector_derivative_def has_vector_derivative_def has_field_derivative_def)
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2226
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2227
proposition field_differentiable_derivI:
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2228
    "f field_differentiable (at x) \<Longrightarrow> (f has_field_derivative deriv f x) (at x)"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2229
by (simp add: field_differentiable_def DERIV_deriv_iff_has_field_derivative)
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2230
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2231
lemma vector_derivative_chain_at_general:
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2232
  assumes "f differentiable at x" "g field_differentiable at (f x)"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2233
  shows "vector_derivative (g \<circ> f) (at x) = vector_derivative f (at x) * deriv g (f x)"
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2234
  apply (rule vector_derivative_at [OF field_vector_diff_chain_at])
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2235
  using assms vector_derivative_works by (auto simp: field_differentiable_derivI)
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2236
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2237
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2238
subsection \<open>Relation between convexity and derivative\<close>
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2239
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2240
(* TODO: Generalise to real vector spaces? *)
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2241
proposition convex_on_imp_above_tangent:
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2242
  assumes convex: "convex_on A f" and connected: "connected A"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2243
  assumes c: "c \<in> interior A" and x : "x \<in> A"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2244
  assumes deriv: "(f has_field_derivative f') (at c within A)"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2245
  shows   "f x - f c \<ge> f' * (x - c)"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2246
proof (cases x c rule: linorder_cases)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2247
  assume xc: "x > c"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2248
  let ?A' = "interior A \<inter> {c<..}"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2249
  from c have "c \<in> interior A \<inter> closure {c<..}" by auto
63128
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63079
diff changeset
  2250
  also have "\<dots> \<subseteq> closure (interior A \<inter> {c<..})" by (intro open_Int_closure_subset) auto
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2251
  finally have "at c within ?A' \<noteq> bot" by (subst at_within_eq_bot_iff) auto
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2252
  moreover from deriv have "((\<lambda>y. (f y - f c) / (y - c)) \<longlongrightarrow> f') (at c within ?A')"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2253
    unfolding has_field_derivative_iff using interior_subset[of A] by (blast intro: tendsto_mono at_le)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2254
  moreover from eventually_at_right_real[OF xc]
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2255
    have "eventually (\<lambda>y. (f y - f c) / (y - c) \<le> (f x - f c) / (x - c)) (at_right c)"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2256
  proof eventually_elim
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2257
    fix y assume y: "y \<in> {c<..<x}"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2258
    with convex connected x c have "f y \<le> (f x - f c) / (x - c) * (y - c) + f c"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2259
      using interior_subset[of A]
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2260
      by (intro convex_onD_Icc' convex_on_subset[OF convex] connected_contains_Icc) auto
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2261
    hence "f y - f c \<le> (f x - f c) / (x - c) * (y - c)" by simp
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2262
    thus "(f y - f c) / (y - c) \<le> (f x - f c) / (x - c)" using y xc by (simp add: divide_simps)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2263
  qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2264
  hence "eventually (\<lambda>y. (f y - f c) / (y - c) \<le> (f x - f c) / (x - c)) (at c within ?A')"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2265
    by (blast intro: filter_leD at_le)
63952
354808e9f44b new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents: 63938
diff changeset
  2266
  ultimately have "f' \<le> (f x - f c) / (x - c)" by (simp add: tendsto_upperbound)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2267
  thus ?thesis using xc by (simp add: field_simps)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2268
next
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2269
  assume xc: "x < c"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2270
  let ?A' = "interior A \<inter> {..<c}"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2271
  from c have "c \<in> interior A \<inter> closure {..<c}" by auto
63128
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63079
diff changeset
  2272
  also have "\<dots> \<subseteq> closure (interior A \<inter> {..<c})" by (intro open_Int_closure_subset) auto
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2273
  finally have "at c within ?A' \<noteq> bot" by (subst at_within_eq_bot_iff) auto
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2274
  moreover from deriv have "((\<lambda>y. (f y - f c) / (y - c)) \<longlongrightarrow> f') (at c within ?A')"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2275
    unfolding has_field_derivative_iff using interior_subset[of A] by (blast intro: tendsto_mono at_le)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2276
  moreover from eventually_at_left_real[OF xc]
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2277
    have "eventually (\<lambda>y. (f y - f c) / (y - c) \<ge> (f x - f c) / (x - c)) (at_left c)"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2278
  proof eventually_elim
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2279
    fix y assume y: "y \<in> {x<..<c}"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2280
    with convex connected x c have "f y \<le> (f x - f c) / (c - x) * (c - y) + f c"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2281
      using interior_subset[of A]
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2282
      by (intro convex_onD_Icc'' convex_on_subset[OF convex] connected_contains_Icc) auto
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2283
    hence "f y - f c \<le> (f x - f c) * ((c - y) / (c - x))" by simp
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2284
    also have "(c - y) / (c - x) = (y - c) / (x - c)" using y xc by (simp add: field_simps)
61649
268d88ec9087 Tweaks for "real": Removal of [iff] status for some lemmas, adding [simp] for others. Plus fixes.
paulson <lp15@cam.ac.uk>
parents: 61560
diff changeset
  2285
    finally show "(f y - f c) / (y - c) \<ge> (f x - f c) / (x - c)" using y xc
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2286
      by (simp add: divide_simps)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2287
  qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2288
  hence "eventually (\<lambda>y. (f y - f c) / (y - c) \<ge> (f x - f c) / (x - c)) (at c within ?A')"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2289
    by (blast intro: filter_leD at_le)
63952
354808e9f44b new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents: 63938
diff changeset
  2290
  ultimately have "f' \<ge> (f x - f c) / (x - c)" by (simp add: tendsto_lowerbound)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2291
  thus ?thesis using xc by (simp add: field_simps)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2292
qed simp_all
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2293
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2294
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2295
subsection \<open>Partial derivatives\<close>
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2296
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2297
lemma eventually_at_Pair_within_TimesI1:
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2298
  fixes x::"'a::metric_space"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2299
  assumes "\<forall>\<^sub>F x' in at x within X. P x'"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2300
  assumes "P x"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2301
  shows "\<forall>\<^sub>F (x', y') in at (x, y) within X \<times> Y. P x'"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2302
proof -
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2303
  from assms[unfolded eventually_at_topological]
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2304
  obtain S where S: "open S" "x \<in> S" "\<And>x'. x' \<in> X \<Longrightarrow> x' \<in> S \<Longrightarrow> P x'"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2305
    by metis
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2306
  show "\<forall>\<^sub>F (x', y') in at (x, y) within X \<times> Y. P x'"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2307
    unfolding eventually_at_topological
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2308
    by (auto intro!: exI[where x="S \<times> UNIV"] S open_Times)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2309
qed
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2310
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2311
lemma eventually_at_Pair_within_TimesI2:
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2312
  fixes x::"'a::metric_space"
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2313
  assumes "\<forall>\<^sub>F y' in at y within Y. P y'" "P y"
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2314
  shows "\<forall>\<^sub>F (x', y') in at (x, y) within X \<times> Y. P y'"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2315
proof -
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2316
  from assms[unfolded eventually_at_topological]
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2317
  obtain S where S: "open S" "y \<in> S" "\<And>y'. y' \<in> Y \<Longrightarrow> y' \<in> S \<Longrightarrow> P y'"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2318
    by metis
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2319
  show "\<forall>\<^sub>F (x', y') in at (x, y) within X \<times> Y. P y'"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2320
    unfolding eventually_at_topological
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2321
    by (auto intro!: exI[where x="UNIV \<times> S"] S open_Times)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2322
qed
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2323
68838
5e013478bced tagged some theories
immler
parents: 68527
diff changeset
  2324
proposition has_derivative_partialsI:
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2325
  fixes f::"'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector \<Rightarrow> 'c::real_normed_vector"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2326
  assumes fx: "((\<lambda>x. f x y) has_derivative fx) (at x within X)"
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2327
  assumes fy: "\<And>x y. x \<in> X \<Longrightarrow> y \<in> Y \<Longrightarrow> ((\<lambda>y. f x y) has_derivative blinfun_apply (fy x y)) (at y within Y)"
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2328
  assumes fy_cont[unfolded continuous_within]: "continuous (at (x, y) within X \<times> Y) (\<lambda>(x, y). fy x y)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2329
  assumes "y \<in> Y" "convex Y"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2330
  shows "((\<lambda>(x, y). f x y) has_derivative (\<lambda>(tx, ty). fx tx + fy x y ty)) (at (x, y) within X \<times> Y)"
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2331
proof (safe intro!: has_derivativeI tendstoI, goal_cases)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2332
  case (2 e')
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2333
  interpret fx: bounded_linear "fx" using fx by (rule has_derivative_bounded_linear)
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62949
diff changeset
  2334
  define e where "e = e' / 9"
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2335
  have "e > 0" using \<open>e' > 0\<close> by (simp add: e_def)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2336
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2337
  from fy_cont[THEN tendstoD, OF \<open>e > 0\<close>]
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2338
  have "\<forall>\<^sub>F (x', y') in at (x, y) within X \<times> Y. dist (fy x' y') (fy x y) < e"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2339
    by (auto simp: split_beta')
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2340
  from this[unfolded eventually_at] obtain d' where
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2341
    "d' > 0"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2342
    "\<And>x' y'. x' \<in> X \<Longrightarrow> y' \<in> Y \<Longrightarrow> (x', y') \<noteq> (x, y) \<Longrightarrow> dist (x', y') (x, y) < d' \<Longrightarrow>
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2343
      dist (fy x' y') (fy x y) < e"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2344
    by auto
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2345
  then
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2346
  have d': "x' \<in> X \<Longrightarrow> y' \<in> Y \<Longrightarrow> dist (x', y') (x, y) < d' \<Longrightarrow> dist (fy x' y') (fy x y) < e"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2347
    for x' y'
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2348
    using \<open>0 < e\<close>
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2349
    by (cases "(x', y') = (x, y)") auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62949
diff changeset
  2350
  define d where "d = d' / sqrt 2"
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2351
  have "d > 0" using \<open>0 < d'\<close> by (simp add: d_def)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2352
  have d: "x' \<in> X \<Longrightarrow> y' \<in> Y \<Longrightarrow> dist x' x < d \<Longrightarrow> dist y' y < d \<Longrightarrow> dist (fy x' y') (fy x y) < e"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2353
    for x' y'
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2354
    by (auto simp: dist_prod_def d_def intro!: d' real_sqrt_sum_squares_less)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2355
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2356
  let ?S = "ball y d \<inter> Y"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2357
  have "convex ?S"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2358
    by (auto intro!: convex_Int \<open>convex Y\<close>)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2359
  {
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2360
    fix x'::'a and y'::'b
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2361
    assume x': "x' \<in> X" and y': "y' \<in> Y"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2362
    assume dx': "dist x' x < d" and dy': "dist y' y < d"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2363
    have "norm (fy x' y' - fy x' y) \<le> dist (fy x' y') (fy x y) + dist (fy x' y) (fy x y)"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2364
      by norm
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2365
    also have "dist (fy x' y') (fy x y) < e"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2366
      by (rule d; fact)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2367
    also have "dist (fy x' y) (fy x y) < e"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2368
      by (auto intro!: d simp: dist_prod_def x' \<open>d > 0\<close> \<open>y \<in> Y\<close> dx')
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2369
    finally
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2370
    have "norm (fy x' y' - fy x' y) < e + e"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2371
      by arith
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2372
    then have "onorm (blinfun_apply (fy x' y') - blinfun_apply (fy x' y)) < e + e"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2373
      by (auto simp: norm_blinfun.rep_eq blinfun.diff_left[abs_def] fun_diff_def)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2374
  } note onorm = this
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2375
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2376
  have ev_mem: "\<forall>\<^sub>F (x', y') in at (x, y) within X \<times> Y. (x', y') \<in> X \<times> Y"
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2377
    using \<open>y \<in> Y\<close>
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2378
    by (auto simp: eventually_at intro!: zero_less_one)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2379
  moreover
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2380
  have ev_dist: "\<forall>\<^sub>F xy in at (x, y) within X \<times> Y. dist xy (x, y) < d" if "d > 0" for d
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2381
    using eventually_at_ball[OF that]
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2382
    by (rule eventually_elim2) (auto simp: dist_commute mem_ball intro!: eventually_True)
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2383
  note ev_dist[OF \<open>0 < d\<close>]
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2384
  ultimately
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2385
  have "\<forall>\<^sub>F (x', y') in at (x, y) within X \<times> Y.
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2386
    norm (f x' y' - f x' y - (fy x' y) (y' - y)) \<le> norm (y' - y) * (e + e)"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2387
  proof (eventually_elim, safe)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2388
    fix x' y'
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2389
    assume "x' \<in> X" and y': "y' \<in> Y"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2390
    assume dist: "dist (x', y') (x, y) < d"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2391
    then have dx: "dist x' x < d" and dy: "dist y' y < d"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2392
      unfolding dist_prod_def fst_conv snd_conv atomize_conj
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2393
      by (metis le_less_trans real_sqrt_sum_squares_ge1 real_sqrt_sum_squares_ge2)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2394
    {
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2395
      fix t::real
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2396
      assume "t \<in> {0 .. 1}"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2397
      then have "y + t *\<^sub>R (y' - y) \<in> closed_segment y y'"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2398
        by (auto simp: closed_segment_def algebra_simps intro!: exI[where x=t])
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2399
      also
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2400
      have "\<dots> \<subseteq> ball y d \<inter> Y"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2401
        using \<open>y \<in> Y\<close> \<open>0 < d\<close> dy y'
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2402
        by (intro \<open>convex ?S\<close>[unfolded convex_contains_segment, rule_format, of y y'])
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2403
          (auto simp: dist_commute)
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2404
      finally have "y + t *\<^sub>R (y' - y) \<in> ?S" .
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2405
    } note seg = this
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2406
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2407
    have "\<And>x. x \<in> ball y d \<inter> Y \<Longrightarrow> onorm (blinfun_apply (fy x' x) - blinfun_apply (fy x' y)) \<le> e + e"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2408
      by (safe intro!: onorm less_imp_le \<open>x' \<in> X\<close> dx) (auto simp: dist_commute \<open>0 < d\<close> \<open>y \<in> Y\<close>)
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2409
    with seg has_derivative_within_subset[OF assms(2)[OF \<open>x' \<in> X\<close>]]
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2410
    show "norm (f x' y' - f x' y - (fy x' y) (y' - y)) \<le> norm (y' - y) * (e + e)"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2411
      by (rule differentiable_bound_linearization[where S="?S"])
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2412
        (auto intro!: \<open>0 < d\<close> \<open>y \<in> Y\<close>)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2413
  qed
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2414
  moreover
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2415
  let ?le = "\<lambda>x'. norm (f x' y - f x y - (fx) (x' - x)) \<le> norm (x' - x) * e"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2416
  from fx[unfolded has_derivative_within, THEN conjunct2, THEN tendstoD, OF \<open>0 < e\<close>]
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2417
  have "\<forall>\<^sub>F x' in at x within X. ?le x'"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2418
    by eventually_elim
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2419
       (auto simp: dist_norm divide_simps blinfun.bilinear_simps field_simps split: if_split_asm)
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2420
  then have "\<forall>\<^sub>F (x', y') in at (x, y) within X \<times> Y. ?le x'"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2421
    by (rule eventually_at_Pair_within_TimesI1)
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2422
       (simp add: blinfun.bilinear_simps)
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2423
  moreover have "\<forall>\<^sub>F (x', y') in at (x, y) within X \<times> Y. norm ((x', y') - (x, y)) \<noteq> 0"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2424
    unfolding norm_eq_zero right_minus_eq
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2425
    by (auto simp: eventually_at intro!: zero_less_one)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2426
  moreover
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2427
  from fy_cont[THEN tendstoD, OF \<open>0 < e\<close>]
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2428
  have "\<forall>\<^sub>F x' in at x within X. norm (fy x' y - fy x y) < e"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2429
    unfolding eventually_at
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2430
    using \<open>y \<in> Y\<close>
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2431
    by (auto simp: dist_prod_def dist_norm)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2432
  then have "\<forall>\<^sub>F (x', y') in at (x, y) within X \<times> Y. norm (fy x' y - fy x y) < e"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2433
    by (rule eventually_at_Pair_within_TimesI1)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2434
       (simp add: blinfun.bilinear_simps \<open>0 < e\<close>)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2435
  ultimately
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2436
  have "\<forall>\<^sub>F (x', y') in at (x, y) within X \<times> Y.
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2437
            norm ((f x' y' - f x y - (fx (x' - x) + fy x y (y' - y))) /\<^sub>R
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2438
              norm ((x', y') - (x, y)))
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2439
            < e'"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2440
    apply eventually_elim
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2441
  proof safe
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2442
    fix x' y'
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2443
    have "norm (f x' y' - f x y - (fx (x' - x) + fy x y (y' - y))) \<le>
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2444
        norm (f x' y' - f x' y - fy x' y (y' - y)) +
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2445
        norm (fy x y (y' - y) - fy x' y (y' - y)) +
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2446
        norm (f x' y - f x y - fx (x' - x))"
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2447
      by norm
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2448
    also
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2449
    assume nz: "norm ((x', y') - (x, y)) \<noteq> 0"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2450
      and nfy: "norm (fy x' y - fy x y) < e"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2451
    assume "norm (f x' y' - f x' y - blinfun_apply (fy x' y) (y' - y)) \<le> norm (y' - y) * (e + e)"
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2452
    also assume "norm (f x' y - f x y - (fx) (x' - x)) \<le> norm (x' - x) * e"
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2453
    also
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2454
    have "norm ((fy x y) (y' - y) - (fy x' y) (y' - y)) \<le> norm ((fy x y) - (fy x' y)) * norm (y' - y)"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2455
      by (auto simp: blinfun.bilinear_simps[symmetric] intro!: norm_blinfun)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2456
    also have "\<dots> \<le> (e + e) * norm (y' - y)"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2457
      using \<open>e > 0\<close> nfy
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2458
      by (auto simp: norm_minus_commute intro!: mult_right_mono)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2459
    also have "norm (x' - x) * e \<le> norm (x' - x) * (e + e)"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2460
      using \<open>0 < e\<close> by simp
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2461
    also have "norm (y' - y) * (e + e) + (e + e) * norm (y' - y) + norm (x' - x) * (e + e) \<le>
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2462
        (norm (y' - y) + norm (x' - x)) * (4 * e)"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2463
      using \<open>e > 0\<close>
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2464
      by (simp add: algebra_simps)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2465
    also have "\<dots> \<le> 2 * norm ((x', y') - (x, y)) * (4 * e)"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2466
      using \<open>0 < e\<close> real_sqrt_sum_squares_ge1[of "norm (x' - x)" "norm (y' - y)"]
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2467
        real_sqrt_sum_squares_ge2[of "norm (y' - y)" "norm (x' - x)"]
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2468
      by (auto intro!: mult_right_mono simp: norm_prod_def
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2469
        simp del: real_sqrt_sum_squares_ge1 real_sqrt_sum_squares_ge2)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2470
    also have "\<dots> \<le> norm ((x', y') - (x, y)) * (8 * e)"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2471
      by simp
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2472
    also have "\<dots> < norm ((x', y') - (x, y)) * e'"
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2473
      using \<open>0 < e'\<close> nz
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2474
      by (auto simp: e_def)
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2475
    finally show "norm ((f x' y' - f x y - (fx (x' - x) + fy x y (y' - y))) /\<^sub>R norm ((x', y') - (x, y))) < e'"
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2476
      by (auto simp: divide_simps dist_norm mult.commute)
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2477
  qed
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2478
  then show ?case
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2479
    by eventually_elim (auto simp: dist_norm field_simps)
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2480
next
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2481
  from has_derivative_bounded_linear[OF fx]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2482
  obtain fxb where "fx = blinfun_apply fxb"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2483
    by (metis bounded_linear_Blinfun_apply)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2484
  then show "bounded_linear (\<lambda>(tx, ty). fx tx + blinfun_apply (fy x y) ty)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2485
    by (auto intro!: bounded_linear_intros simp: split_beta')
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2486
qed
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2487
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2488
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70065
diff changeset
  2489
subsection\<^marker>\<open>tag unimportant\<close> \<open>Differentiable case distinction\<close>
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2490
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2491
lemma has_derivative_within_If_eq:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2492
  "((\<lambda>x. if P x then f x else g x) has_derivative f') (at x within S) =
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2493
    (bounded_linear f' \<and>
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2494
     ((\<lambda>y.(if P y then (f y - ((if P x then f x else g x) + f' (y - x)))/\<^sub>R norm (y - x)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2495
           else (g y - ((if P x then f x else g x) + f' (y - x)))/\<^sub>R norm (y - x)))
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2496
      \<longlongrightarrow> 0) (at x within S))"
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2497
  (is "_ = (_ \<and> (?if \<longlongrightarrow> 0) _)")
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2498
proof -
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2499
  have "(\<lambda>y. (1 / norm (y - x)) *\<^sub>R
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2500
           ((if P y then f y else g y) -
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2501
            ((if P x then f x else g x) + f' (y - x)))) = ?if"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2502
    by (auto simp: inverse_eq_divide)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2503
  thus ?thesis by (auto simp: has_derivative_within)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2504
qed
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2505
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2506
lemma has_derivative_If_within_closures:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2507
  assumes f': "x \<in> S \<union> (closure S \<inter> closure T) \<Longrightarrow>
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2508
    (f has_derivative f' x) (at x within S \<union> (closure S \<inter> closure T))"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2509
  assumes g': "x \<in> T \<union> (closure S \<inter> closure T) \<Longrightarrow>
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2510
    (g has_derivative g' x) (at x within T \<union> (closure S \<inter> closure T))"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2511
  assumes connect: "x \<in> closure S \<Longrightarrow> x \<in> closure T \<Longrightarrow> f x = g x"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2512
  assumes connect': "x \<in> closure S \<Longrightarrow> x \<in> closure T \<Longrightarrow> f' x = g' x"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2513
  assumes x_in: "x \<in> S \<union> T"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2514
  shows "((\<lambda>x. if x \<in> S then f x else g x) has_derivative
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2515
      (if x \<in> S then f' x else g' x)) (at x within (S \<union> T))"
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2516
proof -
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2517
  from f' x_in interpret f': bounded_linear "if x \<in> S then f' x else (\<lambda>x. 0)"
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2518
    by (auto simp add: has_derivative_within)
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2519
  from g' interpret g': bounded_linear "if x \<in> T then g' x else (\<lambda>x. 0)"
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2520
    by (auto simp add: has_derivative_within)
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2521
  have bl: "bounded_linear (if x \<in> S then f' x else g' x)"
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2522
    using f'.scaleR f'.bounded f'.add g'.scaleR g'.bounded g'.add x_in
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2523
    by (unfold_locales; force)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2524
  show ?thesis
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2525
    using f' g' closure_subset[of T] closure_subset[of S]
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2526
    unfolding has_derivative_within_If_eq
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2527
    by (intro conjI bl tendsto_If_within_closures x_in)
69712
dc85b5b3a532 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 69631
diff changeset
  2528
      (auto simp: has_derivative_within inverse_eq_divide connect connect' subsetD)
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2529
qed
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2530
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2531
lemma has_vector_derivative_If_within_closures:
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2532
  assumes x_in: "x \<in> S \<union> T"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2533
  assumes "u = S \<union> T"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2534
  assumes f': "x \<in> S \<union> (closure S \<inter> closure T) \<Longrightarrow>
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2535
    (f has_vector_derivative f' x) (at x within S \<union> (closure S \<inter> closure T))"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2536
  assumes g': "x \<in> T \<union> (closure S \<inter> closure T) \<Longrightarrow>
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2537
    (g has_vector_derivative g' x) (at x within T \<union> (closure S \<inter> closure T))"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2538
  assumes connect: "x \<in> closure S \<Longrightarrow> x \<in> closure T \<Longrightarrow> f x = g x"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2539
  assumes connect': "x \<in> closure S \<Longrightarrow> x \<in> closure T \<Longrightarrow> f' x = g' x"
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2540
  shows "((\<lambda>x. if x \<in> S then f x else g x) has_vector_derivative
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68095
diff changeset
  2541
    (if x \<in> S then f' x else g' x)) (at x within u)"
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2542
  unfolding has_vector_derivative_def assms
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2543
  using x_in
68241
39a311f50344 correcting the statements of the MVTs
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  2544
  apply (intro has_derivative_If_within_closures[where ?f' = "\<lambda>x a. a *\<^sub>R f' x" and ?g' = "\<lambda>x a. a *\<^sub>R g' x",
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2545
        THEN has_derivative_eq_rhs])
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2546
  subgoal by (rule f'[unfolded has_vector_derivative_def]; assumption)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2547
  subgoal by (rule g'[unfolded has_vector_derivative_def]; assumption)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67682
diff changeset
  2548
  by (auto simp: assms)
62207
45eee631ea4f added lemma
immler
parents: 62101
diff changeset
  2549
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2550
end