src/HOL/Multivariate_Analysis/Derivative.thy
author huffman
Thu, 20 Mar 2014 15:13:55 -0700
changeset 56227 67a5f004583d
parent 56226 29fd6bd9228e
child 56261 918432e3fcfa
permissions -rw-r--r--
generalize more theorems
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
     1
(*  Title:      HOL/Multivariate_Analysis/Derivative.thy
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
     2
    Author:     John Harrison
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
     3
    Author:     Robert Himmelmann, TU Muenchen (translation from HOL Light)
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
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
     6
header {* Multivariate calculus in Euclidean space *}
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
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
     9
imports Brouwer_Fixpoint Operator_Norm
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    10
begin
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    11
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    12
lemma bounded_linear_imp_linear: (* TODO: move elsewhere *)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    13
  assumes "bounded_linear f"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    14
  shows "linear f"
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
    15
proof -
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    16
  interpret f: bounded_linear f
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    17
    using assms .
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    18
  show ?thesis
53600
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53374
diff changeset
    19
    by (simp add: f.add f.scaleR linear_iff)
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
    20
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    21
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
    22
lemma netlimit_at_vector: (* TODO: move *)
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    23
  fixes a :: "'a::real_normed_vector"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    24
  shows "netlimit (at a) = a"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    25
proof (cases "\<exists>x. x \<noteq> a")
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    26
  case True then obtain x where x: "x \<noteq> a" ..
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    27
  have "\<not> trivial_limit (at a)"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    28
    unfolding trivial_limit_def eventually_at dist_norm
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    29
    apply clarsimp
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    30
    apply (rule_tac x="a + scaleR (d / 2) (sgn (x - a))" in exI)
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    31
    apply (simp add: norm_sgn sgn_zero_iff x)
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    32
    done
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    33
  then show ?thesis
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
    34
    by (rule netlimit_within [of a UNIV])
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    35
qed simp
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    36
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
    37
(* Because I do not want to type this all the time *)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    38
lemmas linear_linear = linear_conv_bounded_linear[symmetric]
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
    39
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    40
lemma derivative_linear[dest]: "(f has_derivative f') net \<Longrightarrow> bounded_linear f'"
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
    41
  unfolding has_derivative_def by auto
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
    42
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    43
lemma derivative_is_linear: "(f has_derivative f') net \<Longrightarrow> linear f'"
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
    44
  by (rule derivative_linear [THEN bounded_linear_imp_linear])
44137
ac5cb4c86448 simplify some proofs
huffman
parents: 44125
diff changeset
    45
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
    46
subsection {* Derivatives *}
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
    47
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
    48
subsubsection {* Combining theorems. *}
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
    49
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
    50
lemmas has_derivative_id = has_derivative_ident
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
    51
lemmas has_derivative_const = has_derivative_const
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
    52
lemmas has_derivative_neg = has_derivative_minus
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
    53
lemmas has_derivative_add = has_derivative_add
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
    54
lemmas has_derivative_sub = has_derivative_diff
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
    55
lemmas has_derivative_setsum = has_derivative_setsum
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
    56
lemmas scaleR_right_has_derivative = has_derivative_scaleR_right
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
    57
lemmas scaleR_left_has_derivative = has_derivative_scaleR_left
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
    58
lemmas inner_right_has_derivative = has_derivative_inner_right
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
    59
lemmas inner_left_has_derivative = has_derivative_inner_left
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
    60
lemmas mult_right_has_derivative = has_derivative_mult_right
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
    61
lemmas mult_left_has_derivative = has_derivative_mult_left
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
    62
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
    63
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
    64
  "(f has_derivative f') net \<Longrightarrow> ((\<lambda>x. f x + c) has_derivative f') net"
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
    65
  by (intro has_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
    66
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    67
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
    68
subsection {* Derivative with composed bilinear function. *}
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
    69
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
    70
lemma has_derivative_bilinear_within:
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
    71
  assumes "(f has_derivative f') (at x within s)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    72
    and "(g has_derivative g') (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    73
    and "bounded_bilinear h"
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
    74
  shows "((\<lambda>x. h (f x) (g x)) has_derivative (\<lambda>d. h (f x) (g' d) + h (f' d) (g x))) (at x within s)"
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
    75
  using bounded_bilinear.FDERIV[OF assms(3,1,2)] .
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
    76
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
    77
lemma has_derivative_bilinear_at:
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
    78
  assumes "(f has_derivative f') (at x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    79
    and "(g has_derivative g') (at x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    80
    and "bounded_bilinear h"
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
    81
  shows "((\<lambda>x. h (f x) (g x)) has_derivative (\<lambda>d. h (f x) (g' d) + h (f' d) (g x))) (at x)"
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
    82
  using has_derivative_bilinear_within[of f f' x UNIV g g' h] assms 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
    83
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
    84
text {* These are the only cases we'll care about, probably. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    85
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    86
lemma has_derivative_within: "(f has_derivative f') (at x within s) \<longleftrightarrow>
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    87
    bounded_linear f' \<and> ((\<lambda>y. (1 / norm(y - x)) *\<^sub>R (f y - (f x + f' (y - x)))) ---> 0) (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    88
  unfolding has_derivative_def Lim
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    89
  by (auto simp add: netlimit_within inverse_eq_divide field_simps)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    90
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    91
lemma has_derivative_at: "(f has_derivative f') (at x) \<longleftrightarrow>
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    92
    bounded_linear f' \<and> ((\<lambda>y. (1 / (norm(y - x))) *\<^sub>R (f y - (f x + f' (y - x)))) ---> 0) (at x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    93
  using has_derivative_within [of f f' x UNIV]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    94
  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
    95
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
    96
text {* More explicit epsilon-delta forms. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    97
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    98
lemma has_derivative_within':
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
    99
  "(f has_derivative f')(at x within s) \<longleftrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   100
    bounded_linear f' \<and>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   101
    (\<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
   102
      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
   103
  unfolding has_derivative_within Lim_within dist_norm
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   104
  unfolding diff_0_right
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   105
  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
   106
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   107
lemma has_derivative_at':
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   108
  "(f has_derivative f') (at x) \<longleftrightarrow> bounded_linear f' \<and>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   109
    (\<forall>e>0. \<exists>d>0. \<forall>x'. 0 < norm (x' - x) \<and> norm (x' - x) < d \<longrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   110
      norm (f x' - f x - f'(x' - x)) / norm (x' - x) < e)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   111
  using has_derivative_within' [of f f' x UNIV]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   112
  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
   113
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   114
lemma has_derivative_at_within:
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   115
  "(f has_derivative f') (at x) \<Longrightarrow> (f has_derivative f') (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   116
  unfolding has_derivative_within' has_derivative_at'
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   117
  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
   118
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   119
lemma has_derivative_within_open:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   120
  "a \<in> s \<Longrightarrow> open s \<Longrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   121
    (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
   122
  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
   123
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   124
lemma has_derivative_right:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   125
  fixes f :: "real \<Rightarrow> real"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   126
    and y :: "real"
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   127
  shows "(f has_derivative (op * y)) (at x within ({x <..} \<inter> I)) \<longleftrightarrow>
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   128
    ((\<lambda>t. (f x - f t) / (x - t)) ---> y) (at x within ({x <..} \<inter> I))"
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   129
proof -
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   130
  have "((\<lambda>t. (f t - (f x + y * (t - x))) / \<bar>t - x\<bar>) ---> 0) (at x within ({x<..} \<inter> I)) \<longleftrightarrow>
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   131
    ((\<lambda>t. (f t - f x) / (t - x) - y) ---> 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
   132
    by (intro Lim_cong_within) (auto simp add: diff_divide_distrib add_divide_distrib)
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   133
  also have "\<dots> \<longleftrightarrow> ((\<lambda>t. (f t - f x) / (t - x)) ---> y) (at x within ({x<..} \<inter> I))"
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   134
    by (simp add: Lim_null[symmetric])
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   135
  also have "\<dots> \<longleftrightarrow> ((\<lambda>t. (f x - f t) / (x - t)) ---> y) (at x within ({x<..} \<inter> I))"
44140
2c10c35dd4be remove several redundant and unused theorems about derivatives
huffman
parents: 44137
diff changeset
   136
    by (intro Lim_cong_within) (simp_all add: field_simps)
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   137
  finally show ?thesis
44282
f0de18b62d63 remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents: 44140
diff changeset
   138
    by (simp add: bounded_linear_mult_right has_derivative_within)
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   139
qed
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   140
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   141
subsubsection {*Caratheodory characterization*}
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   142
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   143
lemma DERIV_within_iff:
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   144
  "(f has_field_derivative D) (at a within s) \<longleftrightarrow> ((\<lambda>z. (f z - f a) / (z - a)) ---> D) (at a within s)"
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   145
proof -
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   146
  have 1: "\<And>w y. ~(w = a) ==> y / (w - a) - D = (y - (w - a)*D)/(w - a)"
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   147
    by (metis divide_diff_eq_iff eq_iff_diff_eq_0)
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   148
  show ?thesis
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   149
    apply (simp add: has_field_derivative_def has_derivative_within bounded_linear_mult_right)
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   150
    apply (simp add: LIM_zero_iff [where l = D, symmetric])
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   151
    apply (simp add: Lim_within dist_norm)
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   152
    apply (simp add: nonzero_norm_divide [symmetric])
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   153
    apply (simp add: 1 diff_add_eq_diff_diff ac_simps)
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   154
    done
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   155
qed
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   156
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   157
lemma DERIV_caratheodory_within:
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   158
  "(f has_field_derivative l) (at x within s) \<longleftrightarrow> 
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   159
   (\<exists>g. (\<forall>z. f z - f x = g z * (z - x)) \<and> continuous (at x within s) g \<and> g x = l)"
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   160
      (is "?lhs = ?rhs")
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   161
proof
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   162
  assume ?lhs
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   163
  show ?rhs
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   164
  proof (intro exI conjI)
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   165
    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
   166
    show "\<forall>z. f z - f x = ?g z * (z-x)" by simp
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   167
    show "continuous (at x within s) ?g" using `?lhs`
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   168
      by (auto simp add: continuous_within DERIV_within_iff cong: Lim_cong_within)
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   169
    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
   170
  qed
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   171
next
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   172
  assume ?rhs
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   173
  then obtain g where
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   174
    "(\<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
   175
  thus ?lhs
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   176
    by (auto simp add: continuous_within DERIV_within_iff cong: Lim_cong_within)
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   177
qed
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   178
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   179
lemma CARAT_DERIV: (*FIXME: REPLACES THE ONE IN Deriv.thy*)
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   180
  "(DERIV f x :> l) \<longleftrightarrow> (\<exists>g. (\<forall>z. f z - f x = g z * (z - x)) \<and> isCont g x \<and> g x = l)"
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   181
by (rule DERIV_caratheodory_within)
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   182
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   183
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   184
subsubsection {* Limit transformation for derivatives *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   185
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   186
lemma has_derivative_transform_within:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   187
  assumes "0 < d"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   188
    and "x \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   189
    and "\<forall>x'\<in>s. dist x' x < d \<longrightarrow> f x' = g x'"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   190
    and "(f has_derivative f') (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
   191
  shows "(g has_derivative f') (at x within s)"
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   192
  using assms
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   193
  unfolding has_derivative_within
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   194
  apply clarify
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   195
  apply (rule Lim_transform_within, auto)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   196
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   197
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   198
lemma has_derivative_transform_at:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   199
  assumes "0 < d"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   200
    and "\<forall>x'. dist x' x < d \<longrightarrow> f x' = g x'"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   201
    and "(f has_derivative f') (at x)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   202
  shows "(g has_derivative f') (at x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   203
  using has_derivative_transform_within [of d x UNIV f g f'] assms
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   204
  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
   205
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   206
lemma has_derivative_transform_within_open:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   207
  assumes "open s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   208
    and "x \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   209
    and "\<forall>y\<in>s. f y = g y"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   210
    and "(f has_derivative f') (at x)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   211
  shows "(g has_derivative f') (at x)"
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   212
  using assms
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   213
  unfolding has_derivative_at
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   214
  apply clarify
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   215
  apply (rule Lim_transform_within_open[OF assms(1,2)], auto)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   216
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   217
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   218
subsection {* Differentiability *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   219
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   220
definition
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   221
  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
   222
    (infix "differentiable'_on" 50)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   223
  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
   224
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   225
lemma differentiableI: "(f has_derivative f') net \<Longrightarrow> f differentiable net"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   226
  unfolding differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   227
  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
   228
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   229
lemma differentiable_at_withinI: "f differentiable (at x) \<Longrightarrow> f differentiable (at x within s)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   230
  unfolding differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   231
  using has_derivative_at_within
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   232
  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
   233
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   234
lemma differentiable_within_open: (* TODO: delete *)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   235
  assumes "a \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   236
    and "open s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   237
  shows "f differentiable (at a within s) \<longleftrightarrow> f differentiable (at a)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   238
  using assms
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   239
  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
   240
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   241
lemma differentiable_on_eq_differentiable_at:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   242
  "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
   243
  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
   244
  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
   245
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   246
lemma differentiable_transform_within:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   247
  assumes "0 < d"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   248
    and "x \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   249
    and "\<forall>x'\<in>s. dist x' x < d \<longrightarrow> f x' = g x'"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   250
  assumes "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
   251
  shows "g differentiable (at x within s)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   252
  using assms(4)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   253
  unfolding differentiable_def
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   254
  by (auto intro!: has_derivative_transform_within[OF assms(1-3)])
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   255
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   256
lemma differentiable_transform_at:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   257
  assumes "0 < d"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   258
    and "\<forall>x'. dist x' x < d \<longrightarrow> f x' = g x'"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   259
    and "f differentiable at x"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   260
  shows "g differentiable at x"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   261
  using assms(3)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   262
  unfolding differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   263
  using has_derivative_transform_at[OF assms(1-2)]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   264
  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
   265
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   266
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   267
subsection {* Frechet derivative and Jacobian matrix *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   268
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   269
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
   270
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   271
lemma frechet_derivative_works:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   272
  "f differentiable net \<longleftrightarrow> (f has_derivative (frechet_derivative f net)) net"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   273
  unfolding frechet_derivative_def differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   274
  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
   275
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   276
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
   277
  unfolding frechet_derivative_works has_derivative_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   278
  by (auto intro: bounded_linear_imp_linear)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   279
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   280
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   281
subsection {* Differentiability implies continuity *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   282
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   283
lemma 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
   284
  "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
   285
  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
   286
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   287
lemma differentiable_imp_continuous_on:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   288
  "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
   289
  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
   290
  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
   291
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   292
lemma has_derivative_within_subset:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   293
  "(f has_derivative f') (at x within s) \<Longrightarrow> t \<subseteq> s \<Longrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   294
    (f has_derivative f') (at x within t)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   295
  unfolding has_derivative_within
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   296
  using tendsto_within_subset
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   297
  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
   298
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   299
lemma differentiable_within_subset:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   300
  "f differentiable (at x within t) \<Longrightarrow> s \<subseteq> t \<Longrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   301
    f differentiable (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   302
  unfolding differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   303
  using has_derivative_within_subset
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   304
  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
   305
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   306
lemma differentiable_on_subset:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   307
  "f differentiable_on t \<Longrightarrow> s \<subseteq> t \<Longrightarrow> f differentiable_on s"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   308
  unfolding differentiable_on_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   309
  using differentiable_within_subset
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   310
  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
   311
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   312
lemma differentiable_on_empty: "f differentiable_on {}"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   313
  unfolding differentiable_on_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   314
  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
   315
56151
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   316
text {* Results about neighborhoods filter. *}
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   317
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   318
lemma eventually_nhds_metric_le:
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   319
  "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
   320
  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
   321
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   322
lemma le_nhds: "F \<le> nhds a \<longleftrightarrow> (\<forall>S. open S \<and> a \<in> S \<longrightarrow> eventually (\<lambda>x. x \<in> S) F)"
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   323
  unfolding le_filter_def eventually_nhds by (fast elim: eventually_elim1)
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   324
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   325
lemma le_nhds_metric: "F \<le> nhds a \<longleftrightarrow> (\<forall>e>0. eventually (\<lambda>x. dist x a < e) F)"
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   326
  unfolding le_filter_def eventually_nhds_metric by (fast elim: eventually_elim1)
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   327
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   328
lemma le_nhds_metric_le: "F \<le> nhds a \<longleftrightarrow> (\<forall>e>0. eventually (\<lambda>x. dist x a \<le> e) F)"
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   329
  unfolding le_filter_def eventually_nhds_metric_le by (fast elim: eventually_elim1)
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   330
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   331
text {* Several results are easier using a "multiplied-out" variant.
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   332
(I got this idea from Dieudonne's proof of the chain rule). *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   333
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   334
lemma has_derivative_within_alt:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   335
  "(f has_derivative f') (at x within s) \<longleftrightarrow> bounded_linear f' \<and>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   336
    (\<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
   337
  unfolding has_derivative_within filterlim_def le_nhds_metric_le eventually_filtermap
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   338
    eventually_at dist_norm diff_add_eq_diff_diff
41f9d22a9fa4 add lemmas about nhds filter; tuned proof
huffman
parents: 56150
diff changeset
   339
  by (force simp add: linear_0 bounded_linear_imp_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
   340
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   341
lemma has_derivative_at_alt:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   342
  "(f has_derivative f') (at x) \<longleftrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   343
    bounded_linear f' \<and>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   344
    (\<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
   345
  using has_derivative_within_alt[where s=UNIV]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   346
  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
   347
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   348
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   349
subsection {* The chain rule *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   350
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   351
lemma diff_chain_within[has_derivative_intros]:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   352
  assumes "(f has_derivative f') (at x within s)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   353
    and "(g has_derivative g') (at (f x) within (f ` s))"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   354
  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
   355
  using has_derivative_in_compose[OF assms]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   356
  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
   357
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   358
lemma diff_chain_at[has_derivative_intros]:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   359
  "(f has_derivative f') (at x) \<Longrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   360
    (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
   361
  using has_derivative_compose[of f f' x UNIV g g']
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   362
  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
   363
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   364
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   365
subsection {* Composition rules stated just for differentiability *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   366
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   367
lemma differentiable_chain_at:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   368
  "f differentiable (at x) \<Longrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   369
    g differentiable (at (f x)) \<Longrightarrow> (g \<circ> f) differentiable (at x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   370
  unfolding differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   371
  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
   372
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   373
lemma differentiable_chain_within:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   374
  "f differentiable (at x within s) \<Longrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   375
    g differentiable (at(f x) within (f ` s)) \<Longrightarrow> (g \<circ> f) differentiable (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   376
  unfolding differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   377
  by (meson diff_chain_within)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   378
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   379
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   380
subsection {* Uniqueness of derivative *}
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   381
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   382
text {*
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   383
 The general result is a bit messy because we need approachability of the
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   384
 limit point from any direction. But OK for nontrivial intervals etc.
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   385
*}
51363
d4d00c804645 changed has_derivative_intros into a named theorems collection
hoelzl
parents: 50939
diff changeset
   386
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   387
lemma frechet_derivative_unique_within:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   388
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   389
  assumes "(f has_derivative f') (at x within s)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   390
    and "(f has_derivative f'') (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   391
    and "\<forall>i\<in>Basis. \<forall>e>0. \<exists>d. 0 < abs d \<and> abs d < e \<and> (x + d *\<^sub>R i) \<in> s"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   392
  shows "f' = f''"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   393
proof -
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   394
  note as = assms(1,2)[unfolded has_derivative_def]
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   395
  then interpret f': bounded_linear f' by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   396
  from as interpret f'': bounded_linear f'' by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   397
  have "x islimpt s" unfolding islimpt_approachable
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   398
  proof (rule, rule)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   399
    fix e :: real
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   400
    assume "e > 0"
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   401
    obtain d where "0 < \<bar>d\<bar>" and "\<bar>d\<bar> < e" and "x + d *\<^sub>R (SOME i. i \<in> Basis) \<in> s"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   402
      using assms(3) SOME_Basis `e>0` by blast
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   403
    then show "\<exists>x'\<in>s. x' \<noteq> x \<and> dist x' x < e"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   404
      apply (rule_tac x="x + d *\<^sub>R (SOME i. i \<in> Basis)" in bexI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   405
      unfolding dist_norm
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   406
      apply (auto simp: SOME_Basis nonzero_Basis)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   407
      done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   408
  qed
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   409
  then have *: "netlimit (at x within s) = x"
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   410
    apply (auto intro!: netlimit_within)
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   411
    by (metis trivial_limit_within)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   412
  show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   413
    apply (rule linear_eq_stdbasis)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   414
    unfolding linear_conv_bounded_linear
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   415
    apply (rule as(1,2)[THEN conjunct1])+
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   416
  proof (rule, rule ccontr)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   417
    fix i :: 'a
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   418
    assume i: "i \<in> Basis"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   419
    def e \<equiv> "norm (f' i - f'' i)"
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
   420
    assume "f' i \<noteq> f'' i"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   421
    then have "e > 0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   422
      unfolding e_def by auto
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   423
    obtain d where d:
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   424
      "0 < d"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   425
      "(\<And>xa. xa\<in>s \<longrightarrow> 0 < dist xa x \<and> dist xa x < d \<longrightarrow>
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   426
          dist ((f xa - f x - f' (xa - x)) /\<^sub>R norm (xa - x) -
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   427
              (f xa - f x - f'' (xa - x)) /\<^sub>R norm (xa - x)) (0 - 0) < e)"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   428
      using tendsto_diff [OF as(1,2)[THEN conjunct2]]
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   429
      unfolding * Lim_within
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   430
      using `e>0` by blast
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   431
    obtain c where c: "0 < \<bar>c\<bar>" "\<bar>c\<bar> < d \<and> x + c *\<^sub>R i \<in> s"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   432
      using assms(3) i d(1) by blast
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   433
    have *: "norm (- ((1 / \<bar>c\<bar>) *\<^sub>R f' (c *\<^sub>R i)) + (1 / \<bar>c\<bar>) *\<^sub>R f'' (c *\<^sub>R i)) =
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   434
        norm ((1 / abs c) *\<^sub>R (- (f' (c *\<^sub>R i)) + f'' (c *\<^sub>R i)))"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   435
      unfolding scaleR_right_distrib by auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   436
    also have "\<dots> = norm ((1 / abs c) *\<^sub>R (c *\<^sub>R (- (f' i) + f'' i)))"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   437
      unfolding f'.scaleR f''.scaleR
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   438
      unfolding scaleR_right_distrib scaleR_minus_right
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   439
      by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   440
    also have "\<dots> = e"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   441
      unfolding e_def
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   442
      using c(1)
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
   443
      using norm_minus_cancel[of "f' i - f'' i"]
54230
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 53799
diff changeset
   444
      by auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   445
    finally show False
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   446
      using c
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   447
      using d(2)[of "x + c *\<^sub>R i"]
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   448
      unfolding dist_norm
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   449
      unfolding f'.scaleR f''.scaleR f'.add f''.add f'.diff f''.diff
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   450
        scaleR_scaleR scaleR_right_diff_distrib scaleR_right_distrib
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   451
      using i
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   452
      by (auto simp: inverse_eq_divide)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   453
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   454
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   455
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   456
lemma frechet_derivative_unique_at:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   457
  "(f has_derivative f') (at x) \<Longrightarrow> (f has_derivative f'') (at x) \<Longrightarrow> f' = f''"
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   458
  by (rule has_derivative_unique)
41829
455cbcbba8c2 add name continuous_isCont to unnamed lemma
hoelzl
parents: 40702
diff changeset
   459
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   460
lemma frechet_derivative_unique_within_closed_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   461
  fixes f::"'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   462
  assumes "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   463
    and "x \<in> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   464
    and "(f has_derivative f' ) (at x within cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   465
    and "(f has_derivative f'') (at x within cbox a b)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   466
  shows "f' = f''"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   467
  apply(rule frechet_derivative_unique_within)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   468
  apply(rule assms(3,4))+
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   469
proof (rule, rule, rule)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   470
  fix e :: real
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   471
  fix i :: 'a
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   472
  assume "e > 0" and i: "i \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   473
  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
   474
  proof (cases "x\<bullet>i = a\<bullet>i")
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   475
    case True
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   476
    then show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   477
      apply (rule_tac x="(min (b\<bullet>i - a\<bullet>i)  e) / 2" in exI)
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
   478
      using assms(1)[THEN bspec[where x=i]] and `e>0` and assms(2)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   479
      unfolding mem_box
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   480
      using i
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   481
      apply (auto simp add: field_simps inner_simps inner_Basis)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   482
      done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   483
  next
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   484
    note * = assms(2)[unfolded mem_box, THEN bspec, OF i]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   485
    case False
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   486
    moreover have "a \<bullet> i < x \<bullet> i"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   487
      using False * by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   488
    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
   489
      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
   490
        by auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   491
      also have "\<dots> = a\<bullet>i + x\<bullet>i"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   492
        by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   493
      also have "\<dots> \<le> 2 * (x\<bullet>i)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   494
        using * by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   495
      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
   496
        by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   497
    }
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   498
    moreover have "min (x \<bullet> i - a \<bullet> i) e \<ge> 0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   499
      using * and `e>0` by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   500
    then have "x \<bullet> i * 2 \<le> b \<bullet> i * 2 + min (x \<bullet> i - a \<bullet> i) e"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   501
      using * by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   502
    ultimately show ?thesis
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   503
      apply (rule_tac x="- (min (x\<bullet>i - a\<bullet>i) e) / 2" in exI)
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
   504
      using assms(1)[THEN bspec, OF i] and `e>0` and assms(2)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   505
      unfolding mem_box
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   506
      using i
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   507
      apply (auto simp add: field_simps inner_simps inner_Basis)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   508
      done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   509
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   510
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   511
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   512
lemma frechet_derivative_unique_within_open_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   513
  fixes f::"'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54230
diff changeset
   514
  assumes "x \<in> box a b"
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54230
diff changeset
   515
    and "(f has_derivative f' ) (at x within box a b)"
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54230
diff changeset
   516
    and "(f has_derivative f'') (at x within box a b)"
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   517
  shows "f' = f''"
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   518
proof -
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54230
diff changeset
   519
  from assms(1) have *: "at x within box a b = at x"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   520
    by (metis at_within_interior interior_open open_box)
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   521
  from assms(2,3) [unfolded *] show "f' = f''"
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   522
    by (rule frechet_derivative_unique_at)
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   523
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   524
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   525
lemma frechet_derivative_at:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   526
  "(f has_derivative f') (at x) \<Longrightarrow> f' = frechet_derivative f (at x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   527
  apply (rule frechet_derivative_unique_at[of f])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   528
  apply assumption
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   529
  unfolding frechet_derivative_works[symmetric]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   530
  using differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   531
  apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   532
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   533
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   534
lemma frechet_derivative_within_cbox:
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   535
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   536
  assumes "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   537
    and "x \<in> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   538
    and "(f has_derivative f') (at x within cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   539
  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
   540
  using assms
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   541
  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
   542
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   543
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   544
subsection {* The traditional Rolle theorem in one dimension *}
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   545
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   546
lemma linear_componentwise:
56196
32b7eafc5a52 remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents: 56193
diff changeset
   547
  fixes f:: "'a::euclidean_space \<Rightarrow> 'b::real_inner"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   548
  assumes lf: "linear f"
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
   549
  shows "(f x) \<bullet> j = (\<Sum>i\<in>Basis. (x\<bullet>i) * (f i\<bullet>j))" (is "?lhs = ?rhs")
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   550
proof -
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
   551
  have "?rhs = (\<Sum>i\<in>Basis. (x\<bullet>i) *\<^sub>R (f i))\<bullet>j"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   552
    by (simp add: inner_setsum_left)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   553
  then show ?thesis
56196
32b7eafc5a52 remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents: 56193
diff changeset
   554
    unfolding linear_setsum_mul[OF lf, symmetric]
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
   555
    unfolding euclidean_representation ..
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   556
qed
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   557
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   558
text {* Derivatives of local minima and maxima are zero. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   559
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   560
lemma has_derivative_local_min:
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   561
  fixes f :: "'a::real_normed_vector \<Rightarrow> real"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   562
  assumes deriv: "(f has_derivative f') (at x)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   563
  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
   564
  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
   565
proof
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   566
  fix h :: 'a
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   567
  interpret f': bounded_linear f'
56182
528fae0816ea update syntax of has_*derivative to infix 50; fixed proofs
hoelzl
parents: 56181
diff changeset
   568
    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
   569
  show "f' h = 0"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   570
  proof (cases "h = 0")
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   571
    assume "h \<noteq> 0"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   572
    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
   573
      unfolding eventually_at by (force simp: dist_commute)
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   574
    have "FDERIV (\<lambda>r. x + r *\<^sub>R h) 0 :> (\<lambda>r. r *\<^sub>R h)"
56182
528fae0816ea update syntax of has_*derivative to infix 50; fixed proofs
hoelzl
parents: 56181
diff changeset
   575
      by (intro has_derivative_eq_intros, auto)
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   576
    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
   577
      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
   578
    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
   579
      unfolding has_field_derivative_def by (simp add: f'.scaleR mult_commute_abs)
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   580
    moreover have "0 < d / norm h"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   581
      using d1 and `h \<noteq> 0` by (simp add: divide_pos_pos)
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   582
    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)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   583
      using `h \<noteq> 0` by (auto simp add: d2 dist_norm pos_less_divide_eq)
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   584
    ultimately show "f' h = 0"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   585
      by (rule DERIV_local_min)
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   586
  qed (simp add: f'.zero)
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   587
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
   588
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   589
lemma has_derivative_local_max:
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   590
  fixes f :: "'a::real_normed_vector \<Rightarrow> real"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   591
  assumes "(f has_derivative f') (at x)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   592
  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
   593
  shows "f' = (\<lambda>h. 0)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   594
  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
   595
  using assms unfolding fun_eq_iff by simp
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   596
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   597
lemma differential_zero_maxmin:
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   598
  fixes f::"'a::real_normed_vector \<Rightarrow> real"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   599
  assumes "x \<in> s"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   600
    and "open s"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   601
    and deriv: "(f has_derivative f') (at x)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   602
    and mono: "(\<forall>y\<in>s. f y \<le> f x) \<or> (\<forall>y\<in>s. f x \<le> f y)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   603
  shows "f' = (\<lambda>v. 0)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   604
  using mono
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   605
proof
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   606
  assume "\<forall>y\<in>s. f y \<le> f x"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   607
  with `x \<in> s` and `open s` have "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
   608
    unfolding eventually_at_topological by auto
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   609
  with deriv show ?thesis
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   610
    by (rule has_derivative_local_max)
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   611
next
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   612
  assume "\<forall>y\<in>s. f x \<le> f y"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   613
  with `x \<in> s` and `open s` have "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
   614
    unfolding eventually_at_topological by auto
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   615
  with deriv show ?thesis
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   616
    by (rule has_derivative_local_min)
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   617
qed
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   618
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   619
lemma differential_zero_maxmin_component: (* TODO: delete? *)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   620
  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
   621
  assumes k: "k \<in> Basis"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   622
    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
   623
    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
   624
  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
   625
proof -
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   626
  let ?f' = "frechet_derivative f (at x)"
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   627
  have "x \<in> ball x e" using `0 < e` by simp
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   628
  moreover have "open (ball x e)" by simp
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   629
  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
   630
    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
   631
    by (rule bounded_linear.has_derivative)
56133
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   632
  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
   633
    using ball(2) by (rule differential_zero_maxmin)
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   634
  then show ?thesis
304e37faf1ac generalization of differential_zero_maxmin to class real_normed_vector
huffman
parents: 56117
diff changeset
   635
    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
   636
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   637
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
   638
lemma rolle:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   639
  fixes f :: "real \<Rightarrow> real"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   640
  assumes "a < b"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   641
    and "f a = f b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   642
    and "continuous_on {a .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   643
    and "\<forall>x\<in>{a <..< b}. (f has_derivative f' x) (at x)"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   644
  shows "\<exists>x\<in>{a <..< b}. f' x = (\<lambda>v. 0)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   645
proof -
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54230
diff changeset
   646
  have "\<exists>x\<in>box a b. (\<forall>y\<in>box a b. f x \<le> f y) \<or> (\<forall>y\<in>box a b. f y \<le> f x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   647
  proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   648
    have "(a + b) / 2 \<in> {a .. b}"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   649
      using assms(1) by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   650
    then have *: "{a .. b} \<noteq> {}"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   651
      by auto
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   652
    obtain d where d:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   653
        "d \<in>cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   654
        "\<forall>y\<in>cbox a b. f y \<le> f d"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   655
      using continuous_attains_sup[OF compact_Icc * assms(3)] by auto
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   656
    obtain c where c:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   657
        "c \<in> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   658
        "\<forall>y\<in>cbox a b. f c \<le> f y"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   659
      using continuous_attains_inf[OF compact_Icc * assms(3)] by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   660
    show ?thesis
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54230
diff changeset
   661
    proof (cases "d \<in> box a b \<or> c \<in> box a b")
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   662
      case True
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   663
      then show ?thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   664
        by (metis c(2) d(2) box_subset_cbox subset_iff)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   665
    next
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   666
      def e \<equiv> "(a + b) /2"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   667
      case False
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   668
      then have "f d = f c"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   669
        using d c assms(2) by auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   670
      then have "\<And>x. x \<in> {a..b} \<Longrightarrow> f x = f d"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   671
        using c d
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   672
        by force
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   673
      then show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   674
        apply (rule_tac x=e in bexI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   675
        unfolding e_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   676
        using assms(1)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   677
        apply auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   678
        done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   679
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   680
  qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   681
  then obtain x where x: "x \<in> {a <..< b}" "(\<forall>y\<in>{a <..< b}. f x \<le> f y) \<or> (\<forall>y\<in>{a <..< b}. f y \<le> f x)"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   682
    by auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   683
  then have "f' x = (\<lambda>v. 0)"
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54230
diff changeset
   684
    apply (rule_tac differential_zero_maxmin[of x "box a b" f "f' x"])
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   685
    using assms
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   686
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   687
    done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   688
  then show ?thesis
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
   689
    by (metis x(1))
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   690
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   691
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   692
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   693
subsection {* One-dimensional mean value theorem *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   694
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   695
lemma mvt:
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   696
  fixes f :: "real \<Rightarrow> real"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   697
  assumes "a < b"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   698
    and "continuous_on {a..b} f"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   699
  assumes "\<forall>x\<in>{a<..<b}. (f has_derivative (f' x)) (at x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   700
  shows "\<exists>x\<in>{a<..<b}. f b - f a = (f' x) (b - a)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   701
proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   702
  have "\<exists>x\<in>{a <..< b}. (\<lambda>xa. f' x xa - (f b - f a) / (b - a) * xa) = (\<lambda>v. 0)"
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51363
diff changeset
   703
  proof (intro rolle[OF assms(1), of "\<lambda>x. f x - (f b - f a) / (b - a) * x"] ballI)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   704
    fix x
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   705
    assume x: "x \<in> {a <..< b}"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   706
    show "((\<lambda>x. f x - (f b - f a) / (b - a) * x) has_derivative
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   707
        (\<lambda>xa. f' x xa - (f b - f a) / (b - a) * xa)) (at x)"
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   708
      by (intro has_derivative_intros assms(3)[rule_format,OF x] mult_right_has_derivative)
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51363
diff changeset
   709
  qed (insert assms(1,2), auto intro!: continuous_on_intros simp: field_simps)
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   710
  then obtain x where
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   711
    "x \<in> {a <..< b}"
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   712
    "(\<lambda>xa. f' x xa - (f b - f a) / (b - a) * xa) = (\<lambda>v. 0)" ..
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   713
  then show ?thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   714
    by (metis (erased, hide_lams) assms(1) diff_less_iff(1) eq_iff_diff_eq_0
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   715
      linordered_field_class.sign_simps(41) nonzero_mult_divide_cancel_right not_real_square_gt_zero
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   716
      times_divide_eq_left)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   717
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   718
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   719
lemma mvt_simple:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   720
  fixes f :: "real \<Rightarrow> real"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   721
  assumes "a < b"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   722
    and "\<forall>x\<in>{a..b}. (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
   723
  shows "\<exists>x\<in>{a<..<b}. f b - f a = f' x (b - a)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   724
  apply (rule mvt)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   725
  apply (rule assms(1))
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   726
  apply (rule differentiable_imp_continuous_on)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   727
  unfolding differentiable_on_def differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   728
  defer
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   729
proof
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   730
  fix x
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   731
  assume x: "x \<in> {a <..< b}"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   732
  show "(f has_derivative f' x) (at x)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   733
    unfolding has_derivative_within_open[OF x open_greaterThanLessThan,symmetric]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   734
    apply (rule has_derivative_within_subset)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   735
    apply (rule assms(2)[rule_format])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   736
    using x
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   737
    apply auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   738
    done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   739
qed (insert assms(2), auto)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   740
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   741
lemma mvt_very_simple:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   742
  fixes f :: "real \<Rightarrow> real"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   743
  assumes "a \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   744
    and "\<forall>x\<in>{a .. b}. (f has_derivative f' x) (at x within {a .. b})"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   745
  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
   746
proof (cases "a = b")
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   747
  interpret bounded_linear "f' b"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   748
    using assms(2) assms(1) by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   749
  case True
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   750
  then show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   751
    apply (rule_tac x=a in bexI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   752
    using assms(2)[THEN bspec[where x=a]]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   753
    unfolding has_derivative_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   754
    unfolding True
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   755
    using zero
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   756
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   757
    done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   758
next
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   759
  case False
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   760
  then show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   761
    using mvt_simple[OF _ assms(2)]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   762
    using assms(1)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   763
    by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   764
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   765
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   766
text {* A nice generalization (see Havin's proof of 5.19 from Rudin's book). *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   767
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   768
lemma mvt_general:
56223
7696903b9e61 generalize theory of operator norms to work with class real_normed_vector
huffman
parents: 56217
diff changeset
   769
  fixes f :: "real \<Rightarrow> 'a::real_inner"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   770
  assumes "a < b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   771
    and "continuous_on {a .. b} f"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   772
    and "\<forall>x\<in>{a<..<b}. (f has_derivative f'(x)) (at x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   773
  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
   774
proof -
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   775
  have "\<exists>x\<in>{a<..<b}. (op \<bullet> (f b - f a) \<circ> f) b - (op \<bullet> (f b - f a) \<circ> f) a = (f b - f a) \<bullet> f' x (b - a)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   776
    apply (rule mvt)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   777
    apply (rule assms(1))
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   778
    apply (rule continuous_on_inner continuous_on_intros assms(2) ballI)+
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
   779
    unfolding o_def
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   780
    apply (rule has_derivative_inner_right)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   781
    using assms(3)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   782
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   783
    done
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   784
  then obtain x where x:
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   785
    "x \<in> {a<..<b}"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   786
    "(op \<bullet> (f b - f a) \<circ> f) b - (op \<bullet> (f b - f a) \<circ> f) a = (f b - f a) \<bullet> f' x (b - a)" ..
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   787
  show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   788
  proof (cases "f a = f b")
36844
5f9385ecc1a7 Removed usage of normalizating locales.
hoelzl
parents: 36725
diff changeset
   789
    case False
53077
a1b3784f8129 more symbols;
wenzelm
parents: 51733
diff changeset
   790
    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
   791
      by (simp add: power2_eq_square)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   792
    also have "\<dots> = (f b - f a) \<bullet> (f b - f a)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   793
      unfolding power2_norm_eq_inner ..
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   794
    also have "\<dots> = (f b - f a) \<bullet> f' x (b - a)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   795
      using x
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   796
      unfolding inner_simps
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   797
      by (auto simp add: inner_diff_left)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   798
    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
   799
      by (rule norm_cauchy_schwarz)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   800
    finally show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   801
      using False x(1)
56217
dc429a5b13c4 Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents: 56196
diff changeset
   802
      by (auto simp add: mult_left_cancel)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   803
  next
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   804
    case True
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   805
    then show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   806
      using assms(1)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   807
      apply (rule_tac x="(a + b) /2" in bexI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   808
      apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   809
      done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   810
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   811
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   812
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   813
text {* Still more general bound theorem. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   814
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   815
lemma differentiable_bound:
56223
7696903b9e61 generalize theory of operator norms to work with class real_normed_vector
huffman
parents: 56217
diff changeset
   816
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_inner"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   817
  assumes "convex s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   818
    and "\<forall>x\<in>s. (f has_derivative f' x) (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   819
    and "\<forall>x\<in>s. onorm (f' x) \<le> B"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   820
    and x: "x \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   821
    and y: "y \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   822
  shows "norm (f x - f y) \<le> B * norm (x - y)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   823
proof -
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   824
  let ?p = "\<lambda>u. x + u *\<^sub>R (y - x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   825
  have *: "\<And>u. u\<in>{0..1} \<Longrightarrow> x + u *\<^sub>R (y - x) \<in> s"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   826
    using assms(1)[unfolded convex_alt,rule_format,OF x y]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   827
    unfolding scaleR_left_diff_distrib scaleR_right_diff_distrib
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   828
    by (auto simp add: algebra_simps)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   829
  then have 1: "continuous_on {0 .. 1} (f \<circ> ?p)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   830
    apply -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   831
    apply (rule continuous_on_intros)+
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   832
    unfolding continuous_on_eq_continuous_within
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   833
    apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   834
    apply (rule differentiable_imp_continuous_within)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   835
    unfolding differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   836
    apply (rule_tac x="f' xa" in exI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   837
    apply (rule has_derivative_within_subset)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   838
    apply (rule assms(2)[rule_format])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   839
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   840
    done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   841
  have 2: "\<forall>u\<in>{0 <..< 1}.
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   842
    ((f \<circ> ?p) has_derivative f' (x + u *\<^sub>R (y - x)) \<circ> (\<lambda>u. 0 + u *\<^sub>R (y - x))) (at u)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   843
  proof rule
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   844
    case goal1
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   845
    let ?u = "x + u *\<^sub>R (y - x)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   846
    have "(f \<circ> ?p has_derivative (f' ?u) \<circ> (\<lambda>u. 0 + u *\<^sub>R (y - x))) (at u within box 0 1)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   847
      apply (rule diff_chain_within)
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
   848
      apply (rule has_derivative_intros)+
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   849
      apply (rule has_derivative_within_subset)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   850
      apply (rule assms(2)[rule_format])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   851
      using goal1 *
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   852
      apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   853
      done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   854
    then show ?case
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
   855
      by (simp add: has_derivative_within_open[OF goal1 open_greaterThanLessThan])
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   856
  qed
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   857
  obtain u where u:
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   858
      "u \<in> {0<..<1}"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   859
      "norm ((f \<circ> (\<lambda>u. x + u *\<^sub>R (y - x))) 1 - (f \<circ> (\<lambda>u. x + u *\<^sub>R (y - x))) 0)
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   860
        \<le> norm ((f' (x + u *\<^sub>R (y - x)) \<circ> (\<lambda>u. 0 + u *\<^sub>R (y - x))) (1 - 0))"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   861
    using mvt_general[OF zero_less_one 1 2] ..
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   862
  have **: "\<And>x y. x \<in> s \<Longrightarrow> norm (f' x y) \<le> B * norm y"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   863
  proof -
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   864
    case goal1
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   865
    have "norm (f' x y) \<le> onorm (f' x) * norm y"
56223
7696903b9e61 generalize theory of operator norms to work with class real_normed_vector
huffman
parents: 56217
diff changeset
   866
      by (rule onorm[OF derivative_linear[OF assms(2)[rule_format,OF goal1]]])
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   867
    also have "\<dots> \<le> B * norm y"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   868
      apply (rule mult_right_mono)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   869
      using assms(3)[rule_format,OF goal1]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   870
      apply (auto simp add: field_simps)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   871
      done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   872
    finally show ?case
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   873
      by simp
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   874
  qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   875
  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
   876
    by (auto simp add: norm_minus_commute)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   877
  also have "\<dots> \<le> norm (f' (x + u *\<^sub>R (y - x)) (y - x))"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   878
    using u by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   879
  also have "\<dots> \<le> B * norm(y - x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   880
    apply (rule **)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   881
    using * and u
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   882
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   883
    done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   884
  finally show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   885
    by (auto simp add: norm_minus_commute)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   886
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   887
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   888
text {* In particular. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   889
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   890
lemma has_derivative_zero_constant:
56227
67a5f004583d generalize more theorems
huffman
parents: 56226
diff changeset
   891
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_inner"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   892
  assumes "convex s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   893
    and "\<forall>x\<in>s. (f has_derivative (\<lambda>h. 0)) (at x within s)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   894
  shows "\<exists>c. \<forall>x\<in>s. f x = c"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   895
proof (cases "s={}")
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   896
  case False
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   897
  then obtain x where "x \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   898
    by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   899
  have "\<And>y. y \<in> s \<Longrightarrow> f x = f y"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   900
  proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   901
    case goal1
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   902
    then show ?case
56223
7696903b9e61 generalize theory of operator norms to work with class real_normed_vector
huffman
parents: 56217
diff changeset
   903
      using differentiable_bound[OF assms(1-2), of 0 x y] and `x \<in> s`
7696903b9e61 generalize theory of operator norms to work with class real_normed_vector
huffman
parents: 56217
diff changeset
   904
      unfolding onorm_zero
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   905
      by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   906
  qed
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   907
  then show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   908
    apply (rule_tac x="f x" in exI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   909
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   910
    done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   911
next
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   912
  case True
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   913
  then show ?thesis by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   914
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   915
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   916
lemma has_derivative_zero_unique:
56227
67a5f004583d generalize more theorems
huffman
parents: 56226
diff changeset
   917
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_inner"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   918
  assumes "convex s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   919
    and "a \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   920
    and "f a = c"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   921
    and "\<forall>x\<in>s. (f has_derivative (\<lambda>h. 0)) (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   922
    and "x \<in> s"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   923
  shows "f x = c"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   924
  using has_derivative_zero_constant[OF assms(1,4)]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   925
  using assms(2-3,5)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   926
  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
   927
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   928
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   929
subsection {* Differentiability of inverse function (most basic form) *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   930
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   931
lemma has_derivative_inverse_basic:
56226
29fd6bd9228e generalize some theorems
huffman
parents: 56223
diff changeset
   932
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   933
  assumes "(f has_derivative f') (at (g y))"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   934
    and "bounded_linear g'"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   935
    and "g' \<circ> f' = id"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   936
    and "continuous (at y) g"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   937
    and "open t"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   938
    and "y \<in> t"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   939
    and "\<forall>z\<in>t. f (g z) = z"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   940
  shows "(g has_derivative g') (at y)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   941
proof -
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   942
  interpret f': bounded_linear f'
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   943
    using assms unfolding has_derivative_def by auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   944
  interpret g': bounded_linear g'
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   945
    using assms by auto
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   946
  obtain C where C: "0 < C" "\<And>x. norm (g' x) \<le> norm x * C"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   947
    using bounded_linear.pos_bounded[OF assms(2)] by blast
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   948
  have lem1: "\<forall>e>0. \<exists>d>0. \<forall>z.
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   949
    norm (z - y) < d \<longrightarrow> norm (g z - g y - g'(z - y)) \<le> e * norm (g z - g y)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   950
  proof (rule, rule)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   951
    case goal1
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   952
    have *: "e / C > 0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   953
      apply (rule divide_pos_pos)
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   954
      using `e > 0` C(1)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   955
      apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   956
      done
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   957
    obtain d0 where d0:
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   958
        "0 < d0"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   959
        "\<forall>ya. norm (ya - g y) < d0 \<longrightarrow> norm (f ya - f (g y) - f' (ya - g y)) \<le> e / C * norm (ya - g y)"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   960
      using assms(1)
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   961
      unfolding has_derivative_at_alt
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   962
      using * by blast
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   963
    obtain d1 where d1:
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   964
        "0 < d1"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   965
        "\<forall>x. 0 < dist x y \<and> dist x y < d1 \<longrightarrow> dist (g x) (g y) < d0"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   966
      using assms(4)
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   967
      unfolding continuous_at Lim_at
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   968
      using d0(1) by blast
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   969
    obtain d2 where d2:
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   970
        "0 < d2"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   971
        "\<forall>ya. dist ya y < d2 \<longrightarrow> ya \<in> t"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   972
      using assms(5)
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   973
      unfolding open_dist
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   974
      using assms(6) by blast
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   975
    obtain d where d: "0 < d" "d < d1" "d < d2"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   976
      using real_lbound_gt_zero[OF d1(1) d2(1)] by blast
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   977
    then show ?case
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   978
      apply (rule_tac x=d in exI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   979
      apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   980
      defer
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   981
      apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   982
      apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   983
    proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   984
      fix z
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   985
      assume as: "norm (z - y) < d"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   986
      then have "z \<in> t"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   987
        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
   988
      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
   989
        unfolding g'.diff f'.diff
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   990
        unfolding assms(3)[unfolded o_def id_def, THEN fun_cong]
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   991
        unfolding assms(7)[rule_format,OF `z\<in>t`]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   992
        apply (subst norm_minus_cancel[symmetric])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   993
        apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   994
        done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   995
      also have "\<dots> \<le> norm (f (g z) - y - f' (g z - g y)) * C"
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   996
        by (rule C(2))
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   997
      also have "\<dots> \<le> (e / C) * norm (g z - g y) * C"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
   998
        apply (rule mult_right_mono)
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
   999
        apply (rule d0(2)[rule_format,unfolded assms(7)[rule_format,OF `y\<in>t`]])
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1000
        apply (cases "z = y")
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1001
        defer
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1002
        apply (rule d1(2)[unfolded dist_norm,rule_format])
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1003
        using as d C d0
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1004
        apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1005
        done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1006
      also have "\<dots> \<le> e * norm (g z - g y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1007
        using C by (auto simp add: field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1008
      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
  1009
        by simp
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1010
    qed auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1011
  qed
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1012
  have *: "(0::real) < 1 / 2"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1013
    by auto
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1014
  obtain d where d:
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1015
      "0 < d"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1016
      "\<forall>z. norm (z - y) < d \<longrightarrow> norm (g z - g y - g' (z - y)) \<le> 1 / 2 * norm (g z - g y)"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1017
    using lem1 * by blast
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1018
  def B \<equiv> "C * 2"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1019
  have "B > 0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1020
    unfolding B_def using C by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1021
  have lem2: "\<forall>z. norm(z - y) < d \<longrightarrow> norm (g z - g y) \<le> B * norm (z - y)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1022
  proof (rule, rule)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1023
    case goal1
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1024
    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
  1025
      by (rule norm_triangle_sub)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1026
    also have "\<dots> \<le> norm (g' (z - y)) + 1 / 2 * norm (g z - g y)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1027
      apply (rule add_left_mono)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1028
      using d and goal1
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1029
      apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1030
      done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1031
    also have "\<dots> \<le> norm (z - y) * C + 1 / 2 * norm (g z - g y)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1032
      apply (rule add_right_mono)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1033
      using C
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1034
      apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1035
      done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1036
    finally show ?case
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1037
      unfolding B_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1038
      by (auto simp add: field_simps)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1039
  qed
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1040
  show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1041
    unfolding has_derivative_at_alt
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1042
    apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1043
    apply (rule assms)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1044
    apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1045
    apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1046
  proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1047
    case goal1
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1048
    then have *: "e / B >0"
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
  1049
      by (metis `0 < B` divide_pos_pos)
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1050
    obtain d' where d':
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1051
        "0 < d'"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1052
        "\<forall>z. norm (z - y) < d' \<longrightarrow> norm (g z - g y - g' (z - y)) \<le> e / B * norm (g z - g y)"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1053
      using lem1 * by blast
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1054
    obtain k where k: "0 < k" "k < d" "k < d'"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1055
      using real_lbound_gt_zero[OF d(1) d'(1)] by blast
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1056
    show ?case
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1057
      apply (rule_tac x=k in exI)
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
  1058
      apply auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1059
    proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1060
      fix z
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1061
      assume as: "norm (z - y) < k"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1062
      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
  1063
        using d' k by auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1064
      also have "\<dots> \<le> e * norm (z - y)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1065
        unfolding times_divide_eq_left pos_divide_le_eq[OF `B>0`]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1066
        using lem2[THEN spec[where x=z]]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1067
        using k as using `e > 0`
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1068
        by (auto simp add: field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1069
      finally show "norm (g z - g y - g' (z - y)) \<le> e * norm (z - y)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1070
        by simp
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1071
    qed(insert k, auto)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1072
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1073
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1074
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
  1075
text {* Simply rewrite that based on the domain point x. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1076
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1077
lemma has_derivative_inverse_basic_x:
56226
29fd6bd9228e generalize some theorems
huffman
parents: 56223
diff changeset
  1078
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1079
  assumes "(f has_derivative f') (at x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1080
    and "bounded_linear g'"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1081
    and "g' \<circ> f' = id"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1082
    and "continuous (at (f x)) g"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1083
    and "g (f x) = x"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1084
    and "open t"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1085
    and "f x \<in> t"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1086
    and "\<forall>y\<in>t. f (g y) = y"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1087
  shows "(g has_derivative g') (at (f x))"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1088
  apply (rule has_derivative_inverse_basic)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1089
  using assms
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1090
  apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1091
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1092
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
  1093
text {* This is the version in Dieudonne', assuming continuity of f and g. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1094
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1095
lemma has_derivative_inverse_dieudonne:
56226
29fd6bd9228e generalize some theorems
huffman
parents: 56223
diff changeset
  1096
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1097
  assumes "open s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1098
    and "open (f ` s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1099
    and "continuous_on s f"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1100
    and "continuous_on (f ` s) g"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1101
    and "\<forall>x\<in>s. g (f x) = x"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1102
    and "x \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1103
    and "(f has_derivative f') (at x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1104
    and "bounded_linear g'"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1105
    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
  1106
  shows "(g has_derivative g') (at (f x))"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1107
  apply (rule has_derivative_inverse_basic_x[OF assms(7-9) _ _ assms(2)])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1108
  using assms(3-6)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1109
  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
  1110
  apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1111
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1112
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
  1113
text {* Here's the simplest way of not assuming much about g. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1114
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1115
lemma has_derivative_inverse:
56226
29fd6bd9228e generalize some theorems
huffman
parents: 56223
diff changeset
  1116
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1117
  assumes "compact s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1118
    and "x \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1119
    and "f x \<in> interior (f ` s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1120
    and "continuous_on s f"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1121
    and "\<forall>y\<in>s. g (f y) = y"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1122
    and "(f has_derivative f') (at x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1123
    and "bounded_linear g'"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1124
    and "g' \<circ> f' = id"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1125
  shows "(g has_derivative g') (at (f x))"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1126
proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1127
  {
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1128
    fix y
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1129
    assume "y \<in> interior (f ` s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1130
    then obtain x where "x \<in> s" and *: "y = f x"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1131
      unfolding image_iff
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1132
      using interior_subset
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1133
      by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1134
    have "f (g y) = y"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1135
      unfolding * and assms(5)[rule_format,OF `x\<in>s`] ..
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1136
  } note * = this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1137
  show ?thesis
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1138
    apply (rule has_derivative_inverse_basic_x[OF assms(6-8)])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1139
    apply (rule continuous_on_interior[OF _ assms(3)])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1140
    apply (rule continuous_on_inv[OF assms(4,1)])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1141
    apply (rule assms(2,5) assms(5)[rule_format] open_interior assms(3))+
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
  1142
    apply (metis *)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1143
    done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1144
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1145
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1146
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1147
subsection {* Proving surjectivity via Brouwer fixpoint theorem *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1148
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1149
lemma brouwer_surjective:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55970
diff changeset
  1150
  fixes f :: "'n::euclidean_space \<Rightarrow> 'n"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1151
  assumes "compact t"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1152
    and "convex t"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1153
    and "t \<noteq> {}"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1154
    and "continuous_on t f"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1155
    and "\<forall>x\<in>s. \<forall>y\<in>t. x + (y - f y) \<in> t"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1156
    and "x \<in> s"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1157
  shows "\<exists>y\<in>t. f y = x"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1158
proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1159
  have *: "\<And>x y. f y = x \<longleftrightarrow> x + (y - f y) = y"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1160
    by (auto simp add: algebra_simps)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1161
  show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1162
    unfolding *
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1163
    apply (rule brouwer[OF assms(1-3), of "\<lambda>y. x + (y - f y)"])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1164
    apply (rule continuous_on_intros assms)+
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1165
    using assms(4-6)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1166
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1167
    done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1168
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1169
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1170
lemma brouwer_surjective_cball:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55970
diff changeset
  1171
  fixes f :: "'n::euclidean_space \<Rightarrow> 'n"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1172
  assumes "e > 0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1173
    and "continuous_on (cball a e) f"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1174
    and "\<forall>x\<in>s. \<forall>y\<in>cball a e. x + (y - f y) \<in> cball a e"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1175
    and "x \<in> s"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1176
  shows "\<exists>y\<in>cball a e. f y = x"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1177
  apply (rule brouwer_surjective)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1178
  apply (rule compact_cball convex_cball)+
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1179
  unfolding cball_eq_empty
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1180
  using assms
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1181
  apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1182
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1183
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1184
text {* See Sussmann: "Multidifferential calculus", Theorem 2.1.1 *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1185
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1186
lemma sussmann_open_mapping:
56227
67a5f004583d generalize more theorems
huffman
parents: 56226
diff changeset
  1187
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::euclidean_space"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1188
  assumes "open s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1189
    and "continuous_on s f"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1190
    and "x \<in> s"
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'" "f' \<circ> g' = id"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1193
    and "t \<subseteq> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1194
    and "x \<in> interior t"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1195
  shows "f x \<in> interior (f ` t)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1196
proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1197
  interpret f': bounded_linear f'
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1198
    using assms
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1199
    unfolding has_derivative_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1200
    by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1201
  interpret g': bounded_linear g'
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1202
    using assms
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1203
    by auto
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1204
  obtain B where B: "0 < B" "\<forall>x. norm (g' x) \<le> norm x * B"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1205
    using bounded_linear.pos_bounded[OF assms(5)] by blast
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1206
  then have *: "1 / (2 * B) > 0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1207
    by (auto intro!: divide_pos_pos)
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1208
  obtain e0 where e0:
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1209
      "0 < e0"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1210
      "\<forall>y. norm (y - x) < e0 \<longrightarrow> norm (f y - f x - f' (y - x)) \<le> 1 / (2 * B) * norm (y - x)"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1211
    using assms(4)
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1212
    unfolding has_derivative_at_alt
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1213
    using * by blast
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1214
  obtain e1 where e1: "0 < e1" "cball x e1 \<subseteq> t"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1215
    using assms(8)
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1216
    unfolding mem_interior_cball
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1217
    by blast
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1218
  have *: "0 < e0 / B" "0 < e1 / B"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1219
    apply (rule_tac[!] divide_pos_pos)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1220
    using e0 e1 B
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1221
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1222
    done
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1223
  obtain e where e: "0 < e" "e < e0 / B" "e < e1 / B"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1224
    using real_lbound_gt_zero[OF *] by blast
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1225
  have "\<forall>z\<in>cball (f x) (e / 2). \<exists>y\<in>cball (f x) e. f (x + g' (y - f x)) = z"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1226
    apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1227
    apply (rule brouwer_surjective_cball[where s="cball (f x) (e/2)"])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1228
    prefer 3
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1229
    apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1230
    apply rule
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1231
  proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1232
    show "continuous_on (cball (f x) e) (\<lambda>y. f (x + g' (y - f x)))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1233
      unfolding g'.diff
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1234
      apply (rule continuous_on_compose[of _ _ f, unfolded o_def])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1235
      apply (rule continuous_on_intros linear_continuous_on[OF assms(5)])+
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1236
      apply (rule continuous_on_subset[OF assms(2)])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1237
      apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1238
      apply (unfold image_iff)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1239
      apply (erule bexE)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1240
    proof-
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1241
      fix y z
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1242
      assume as: "y \<in>cball (f x) e" "z = x + (g' y - g' (f x))"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1243
      have "dist x z = norm (g' (f x) - g' y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1244
        unfolding as(2) and dist_norm by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1245
      also have "\<dots> \<le> norm (f x - y) * B"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1246
        unfolding g'.diff[symmetric]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1247
        using B
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1248
        by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1249
      also have "\<dots> \<le> e * B"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1250
        using as(1)[unfolded mem_cball dist_norm]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1251
        using B
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1252
        by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1253
      also have "\<dots> \<le> e1"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1254
        using e
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1255
        unfolding less_divide_eq
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1256
        using B
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1257
        by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1258
      finally have "z \<in> cball x e1"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1259
        unfolding mem_cball
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1260
        by force
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1261
      then show "z \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1262
        using e1 assms(7) by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1263
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1264
  next
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1265
    fix y z
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1266
    assume as: "y \<in> cball (f x) (e / 2)" "z \<in> cball (f x) e"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1267
    have "norm (g' (z - f x)) \<le> norm (z - f x) * B"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1268
      using B by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1269
    also have "\<dots> \<le> e * B"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1270
      apply (rule mult_right_mono)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1271
      using as(2)[unfolded mem_cball dist_norm] and B
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1272
      unfolding norm_minus_commute
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1273
      apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1274
      done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1275
    also have "\<dots> < e0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1276
      using e and B
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1277
      unfolding less_divide_eq
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1278
      by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1279
    finally have *: "norm (x + g' (z - f x) - x) < e0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1280
      by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1281
    have **: "f x + f' (x + g' (z - f x) - x) = z"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1282
      using assms(6)[unfolded o_def id_def,THEN cong]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1283
      by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1284
    have "norm (f x - (y + (z - f (x + g' (z - f x))))) \<le>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1285
        norm (f (x + g' (z - f x)) - z) + norm (f x - y)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1286
      using norm_triangle_ineq[of "f (x + g'(z - f x)) - z" "f x - y"]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1287
      by (auto simp add: algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1288
    also have "\<dots> \<le> 1 / (B * 2) * norm (g' (z - f x)) + norm (f x - y)"
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1289
      using e0(2)[rule_format, OF *]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1290
      unfolding algebra_simps **
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1291
      by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1292
    also have "\<dots> \<le> 1 / (B * 2) * norm (g' (z - f x)) + e/2"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1293
      using as(1)[unfolded mem_cball dist_norm]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1294
      by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1295
    also have "\<dots> \<le> 1 / (B * 2) * B * norm (z - f x) + e/2"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1296
      using * and B
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1297
      by (auto simp add: field_simps)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1298
    also have "\<dots> \<le> 1 / 2 * norm (z - f x) + e/2"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1299
      by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1300
    also have "\<dots> \<le> e/2 + e/2"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1301
      apply (rule add_right_mono)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1302
      using as(2)[unfolded mem_cball dist_norm]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1303
      unfolding norm_minus_commute
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1304
      apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1305
      done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1306
    finally show "y + (z - f (x + g' (z - f x))) \<in> cball (f x) e"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1307
      unfolding mem_cball dist_norm
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1308
      by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1309
  qed (insert e, auto) note lem = this
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1310
  show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1311
    unfolding mem_interior
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1312
    apply (rule_tac x="e/2" in exI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1313
    apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1314
    apply (rule divide_pos_pos)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1315
    prefer 3
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1316
  proof
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1317
    fix y
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1318
    assume "y \<in> ball (f x) (e / 2)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1319
    then have *: "y \<in> cball (f x) (e / 2)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1320
      by auto
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1321
    obtain z where z: "z \<in> cball (f x) e" "f (x + g' (z - f x)) = y"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1322
      using lem * by blast
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1323
    then have "norm (g' (z - f x)) \<le> norm (z - f x) * B"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1324
      using B
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1325
      by (auto simp add: field_simps)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1326
    also have "\<dots> \<le> e * B"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1327
      apply (rule mult_right_mono)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1328
      using z(1)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1329
      unfolding mem_cball dist_norm norm_minus_commute
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1330
      using B
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1331
      apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1332
      done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1333
    also have "\<dots> \<le> e1"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1334
      using e B unfolding less_divide_eq by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1335
    finally have "x + g'(z - f x) \<in> t"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1336
      apply -
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1337
      apply (rule e1(2)[unfolded subset_eq,rule_format])
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1338
      unfolding mem_cball dist_norm
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1339
      apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1340
      done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1341
    then show "y \<in> f ` t"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1342
      using z by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1343
  qed (insert e, auto)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1344
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1345
53799
784223a8576e proper text for document preparation;
wenzelm
parents: 53781
diff changeset
  1346
text {* Hence the following eccentric variant of the inverse function theorem.
784223a8576e proper text for document preparation;
wenzelm
parents: 53781
diff changeset
  1347
  This has no continuity assumptions, but we do need the inverse function.
784223a8576e proper text for document preparation;
wenzelm
parents: 53781
diff changeset
  1348
  We could put @{text "f' \<circ> g = I"} but this happens to fit with the minimal linear
784223a8576e proper text for document preparation;
wenzelm
parents: 53781
diff changeset
  1349
  algebra theory I've set up so far. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1350
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1351
(* move  before left_inverse_linear in Euclidean_Space*)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1352
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1353
lemma right_inverse_linear:
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1354
  fixes f :: "'a::euclidean_space \<Rightarrow> 'a"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1355
  assumes lf: "linear f"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1356
    and gf: "f \<circ> g = id"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1357
  shows "linear g"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1358
proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1359
  from gf have fi: "surj f"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1360
    by (auto simp add: surj_def o_def id_def) metis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1361
  from linear_surjective_isomorphism[OF lf fi]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1362
  obtain h:: "'a \<Rightarrow> 'a" where h: "linear h" "\<forall>x. h (f x) = x" "\<forall>x. f (h x) = x"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1363
    by blast
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1364
  have "h = g"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1365
    apply (rule ext)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1366
    using gf h(2,3)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1367
    apply (simp add: o_def id_def fun_eq_iff)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1368
    apply metis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1369
    done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1370
  with h(1) show ?thesis by blast
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1371
qed
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1372
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1373
lemma has_derivative_inverse_strong:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55970
diff changeset
  1374
  fixes f :: "'n::euclidean_space \<Rightarrow> 'n"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1375
  assumes "open s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1376
    and "x \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1377
    and "continuous_on s f"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1378
    and "\<forall>x\<in>s. g (f x) = x"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1379
    and "(f has_derivative f') (at x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1380
    and "f' \<circ> g' = id"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1381
  shows "(g has_derivative g') (at (f x))"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1382
proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1383
  have linf: "bounded_linear f'"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1384
    using assms(5) unfolding has_derivative_def by auto
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1385
  then have ling: "bounded_linear g'"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1386
    unfolding linear_conv_bounded_linear[symmetric]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1387
    apply -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1388
    apply (rule right_inverse_linear)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1389
    using assms(6)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1390
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1391
    done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1392
  moreover have "g' \<circ> f' = id"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1393
    using assms(6) linf ling
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1394
    unfolding linear_conv_bounded_linear[symmetric]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1395
    using linear_inverse_left
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1396
    by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1397
  moreover have *:"\<forall>t\<subseteq>s. x \<in> interior t \<longrightarrow> f x \<in> interior (f ` t)"
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
  1398
    apply clarify
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1399
    apply (rule sussmann_open_mapping)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1400
    apply (rule assms ling)+
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1401
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1402
    done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1403
  have "continuous (at (f x)) g"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1404
    unfolding continuous_at Lim_at
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1405
  proof (rule, rule)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1406
    fix e :: real
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1407
    assume "e > 0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1408
    then have "f x \<in> interior (f ` (ball x e \<inter> s))"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1409
      using *[rule_format,of "ball x e \<inter> s"] `x \<in> s`
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1410
      by (auto simp add: interior_open[OF open_ball] interior_open[OF assms(1)])
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1411
    then obtain d where d: "0 < d" "ball (f x) d \<subseteq> f ` (ball x e \<inter> s)"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1412
      unfolding mem_interior 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
  1413
    show "\<exists>d>0. \<forall>y. 0 < dist y (f x) \<and> dist y (f x) < d \<longrightarrow> dist (g y) (g (f x)) < e"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1414
      apply (rule_tac x=d in exI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1415
      apply rule
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1416
      apply (rule d(1))
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1417
      apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1418
      apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1419
    proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1420
      case goal1
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1421
      then have "g y \<in> g ` f ` (ball x e \<inter> s)"
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1422
        using d(2)[unfolded subset_eq,THEN bspec[where x=y]]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1423
        by (auto simp add: dist_commute)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1424
      then have "g y \<in> ball x e \<inter> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1425
        using assms(4) by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1426
      then show "dist (g y) (g (f x)) < e"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1427
        using assms(4)[rule_format,OF `x \<in> s`]
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1428
        by (auto simp add: dist_commute)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1429
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1430
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1431
  moreover have "f x \<in> interior (f ` s)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1432
    apply (rule sussmann_open_mapping)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1433
    apply (rule assms ling)+
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1434
    using interior_open[OF assms(1)] and `x \<in> s`
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1435
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1436
    done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1437
  moreover have "\<And>y. y \<in> interior (f ` s) \<Longrightarrow> f (g y) = y"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1438
  proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1439
    case goal1
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1440
    then have "y \<in> f ` s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1441
      using interior_subset by auto
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1442
    then obtain z where "z \<in> s" "y = f z" unfolding image_iff ..
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1443
    then show ?case
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1444
      using assms(4) by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1445
  qed
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
  1446
  ultimately show ?thesis using assms
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
  1447
    by (metis has_derivative_inverse_basic_x open_interior)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1448
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1449
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
  1450
text {* A rewrite based on the other domain. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1451
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1452
lemma has_derivative_inverse_strong_x:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55970
diff changeset
  1453
  fixes f :: "'a::euclidean_space \<Rightarrow> 'a"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1454
  assumes "open s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1455
    and "g y \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1456
    and "continuous_on s f"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1457
    and "\<forall>x\<in>s. g (f x) = x"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1458
    and "(f has_derivative f') (at (g y))"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1459
    and "f' \<circ> g' = id"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1460
    and "f (g y) = y"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1461
  shows "(g has_derivative g') (at y)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1462
  using has_derivative_inverse_strong[OF assms(1-6)]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1463
  unfolding assms(7)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1464
  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
  1465
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
  1466
text {* On a region. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1467
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1468
lemma has_derivative_inverse_on:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55970
diff changeset
  1469
  fixes f :: "'n::euclidean_space \<Rightarrow> 'n"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1470
  assumes "open s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1471
    and "\<forall>x\<in>s. (f has_derivative f'(x)) (at x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1472
    and "\<forall>x\<in>s. g (f x) = x"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1473
    and "f' x \<circ> g' x = id"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1474
    and "x \<in> s"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1475
  shows "(g has_derivative g'(x)) (at (f x))"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1476
  apply (rule has_derivative_inverse_strong[where g'="g' x" and f=f])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1477
  apply (rule assms)+
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1478
  unfolding continuous_on_eq_continuous_at[OF assms(1)]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1479
  apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1480
  apply (rule differentiable_imp_continuous_within)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1481
  unfolding differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1482
  using assms
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1483
  apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1484
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1485
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1486
text {* Invertible derivative continous at a point implies local
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1487
injectivity. It's only for this we need continuity of the derivative,
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1488
except of course if we want the fact that the inverse derivative is
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1489
also continuous. So if we know for some other reason that the inverse
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1490
function exists, it's OK. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1491
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1492
lemma bounded_linear_sub: "bounded_linear f \<Longrightarrow> bounded_linear g \<Longrightarrow> bounded_linear (\<lambda>x. f x - g x)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1493
  using bounded_linear_add[of f "\<lambda>x. - g x"] bounded_linear_minus[of g]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1494
  by (auto simp add: algebra_simps)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1495
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1496
lemma has_derivative_locally_injective:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1497
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1498
  assumes "a \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1499
    and "open s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1500
    and "bounded_linear g'"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1501
    and "g' \<circ> f' a = id"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1502
    and "\<forall>x\<in>s. (f has_derivative f' x) (at x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1503
    and "\<forall>e>0. \<exists>d>0. \<forall>x. dist a x < d \<longrightarrow> onorm (\<lambda>v. f' x v - f' a v) < e"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1504
  obtains t where "a \<in> t" "open t" "\<forall>x\<in>t. \<forall>x'\<in>t. f x' = f x \<longrightarrow> x' = x"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1505
proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1506
  interpret bounded_linear g'
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1507
    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
  1508
  note f'g' = assms(4)[unfolded id_def o_def,THEN cong]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1509
  have "g' (f' a (\<Sum>Basis)) = (\<Sum>Basis)" "(\<Sum>Basis) \<noteq> (0::'n)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1510
    defer
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1511
    apply (subst euclidean_eq_iff)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1512
    using f'g'
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1513
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1514
    done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1515
  then have *: "0 < onorm g'"
56223
7696903b9e61 generalize theory of operator norms to work with class real_normed_vector
huffman
parents: 56217
diff changeset
  1516
    unfolding onorm_pos_lt[OF assms(3)]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1517
    by fastforce
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1518
  def k \<equiv> "1 / onorm g' / 2"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1519
  have *: "k > 0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1520
    unfolding k_def using * by auto
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1521
  obtain d1 where d1:
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1522
      "0 < d1"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1523
      "\<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
  1524
    using assms(6) * by blast
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1525
  from `open s` obtain d2 where "d2 > 0" "ball a d2 \<subseteq> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1526
    using `a\<in>s` ..
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1527
  obtain d2 where "d2 > 0" "ball a d2 \<subseteq> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1528
    using assms(2,1) ..
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1529
  obtain d2 where d2: "0 < d2" "ball a d2 \<subseteq> s"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1530
    using assms(2)
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1531
    unfolding open_contains_ball
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1532
    using `a\<in>s` by blast
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1533
  obtain d where d: "0 < d" "d < d1" "d < d2"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1534
    using real_lbound_gt_zero[OF d1(1) d2(1)] by blast
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1535
  show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1536
  proof
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1537
    show "a \<in> ball a d"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1538
      using d by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1539
    show "\<forall>x\<in>ball a d. \<forall>x'\<in>ball a d. f x' = f x \<longrightarrow> x' = x"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1540
    proof (intro strip)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1541
      fix x y
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1542
      assume as: "x \<in> ball a d" "y \<in> ball a d" "f x = f y"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1543
      def ph \<equiv> "\<lambda>w. w - g' (f w - f x)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1544
      have ph':"ph = g' \<circ> (\<lambda>w. f' a w - (f w - f x))"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1545
        unfolding ph_def o_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1546
        unfolding diff
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1547
        using f'g'
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1548
        by (auto simp add: algebra_simps)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1549
      have "norm (ph x - ph y) \<le> (1 / 2) * norm (x - y)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1550
        apply (rule differentiable_bound[OF convex_ball _ _ as(1-2), where f'="\<lambda>x v. v - g'(f' x v)"])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1551
        apply (rule_tac[!] ballI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1552
      proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1553
        fix u
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1554
        assume u: "u \<in> ball a d"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1555
        then have "u \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1556
          using d d2 by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1557
        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
  1558
          unfolding o_def and diff
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1559
          using f'g' by auto
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1560
        show "(ph has_derivative (\<lambda>v. v - g' (f' u v))) (at u within ball a d)"
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
  1561
          unfolding ph' *
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1562
          apply (simp add: comp_def)
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
  1563
          apply (rule bounded_linear.has_derivative[OF assms(3)])
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
  1564
          apply (rule has_derivative_intros)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1565
          defer
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1566
          apply (rule has_derivative_sub[where g'="\<lambda>x.0",unfolded diff_0_right])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1567
          apply (rule has_derivative_at_within)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1568
          using assms(5) and `u \<in> s` `a \<in> s`
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
  1569
          apply (auto intro!: has_derivative_intros bounded_linear.has_derivative[of _ "\<lambda>x. x"] derivative_linear)
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
  1570
          done
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1571
        have **: "bounded_linear (\<lambda>x. f' u x - f' a x)" "bounded_linear (\<lambda>x. f' a x - f' u x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1572
          apply (rule_tac[!] bounded_linear_sub)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1573
          apply (rule_tac[!] derivative_linear)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1574
          using assms(5) `u \<in> s` `a \<in> s`
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1575
          apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1576
          done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1577
        have "onorm (\<lambda>v. v - g' (f' u v)) \<le> onorm g' * onorm (\<lambda>w. f' a w - f' u w)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1578
          unfolding *
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1579
          apply (rule onorm_compose)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1580
          apply (rule assms(3) **)+
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1581
          done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1582
        also have "\<dots> \<le> onorm g' * k"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1583
          apply (rule mult_left_mono)
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1584
          using d1(2)[of u]
56223
7696903b9e61 generalize theory of operator norms to work with class real_normed_vector
huffman
parents: 56217
diff changeset
  1585
          using onorm_neg[where f="\<lambda>x. f' u x - f' a x"]
7696903b9e61 generalize theory of operator norms to work with class real_normed_vector
huffman
parents: 56217
diff changeset
  1586
          using d and u and onorm_pos_le[OF assms(3)]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1587
          apply (auto simp add: algebra_simps)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1588
          done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1589
        also have "\<dots> \<le> 1 / 2"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1590
          unfolding k_def by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1591
        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
  1592
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1593
      moreover have "norm (ph y - ph x) = norm (y - x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1594
        apply (rule arg_cong[where f=norm])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1595
        unfolding ph_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1596
        using diff
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1597
        unfolding as
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1598
        apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1599
        done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1600
      ultimately show "x = y"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1601
        unfolding norm_minus_commute by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1602
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1603
  qed auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1604
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1605
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1606
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1607
subsection {* Uniformly convergent sequence of derivatives *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1608
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1609
lemma has_derivative_sequence_lipschitz_lemma:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1610
  fixes f :: "nat \<Rightarrow> 'm::euclidean_space \<Rightarrow> 'n::euclidean_space"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1611
  assumes "convex s"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1612
    and "\<forall>n. \<forall>x\<in>s. ((f n) has_derivative (f' n x)) (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1613
    and "\<forall>n\<ge>N. \<forall>x\<in>s. \<forall>h. norm (f' n x h - g' x h) \<le> e * norm h"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1614
  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)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1615
proof rule+
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1616
  fix m n x y
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1617
  assume as: "N \<le> m" "N \<le> n" "x \<in> s" "y \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1618
  show "norm ((f m x - f n x) - (f m y - f n y)) \<le> 2 * e * norm (x - y)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1619
    apply (rule differentiable_bound[where f'="\<lambda>x h. f' m x h - f' n x h", OF assms(1) _ _ as(3-4)])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1620
    apply (rule_tac[!] ballI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1621
  proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1622
    fix x
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1623
    assume "x \<in> s"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1624
    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)"
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
  1625
      by (rule has_derivative_intros assms(2)[rule_format] `x\<in>s`)+
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1626
    {
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1627
      fix h
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1628
      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
  1629
        using norm_triangle_ineq[of "f' m x h - g' x h" "- f' n x h + g' x h"]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1630
        unfolding norm_minus_commute
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1631
        by (auto simp add: algebra_simps)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1632
      also have "\<dots> \<le> e * norm h + e * norm h"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1633
        using assms(3)[rule_format,OF `N \<le> m` `x \<in> s`, of h]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1634
        using assms(3)[rule_format,OF `N \<le> n` `x \<in> s`, of h]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1635
        by (auto simp add: field_simps)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1636
      finally have "norm (f' m x h - f' n x h) \<le> 2 * e * norm h"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1637
        by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1638
    }
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1639
    then show "onorm (\<lambda>h. f' m x h - f' n x h) \<le> 2 * e"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1640
      apply -
56223
7696903b9e61 generalize theory of operator norms to work with class real_normed_vector
huffman
parents: 56217
diff changeset
  1641
      apply (rule onorm_le)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1642
      apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1643
      done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1644
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1645
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1646
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1647
lemma has_derivative_sequence_lipschitz:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1648
  fixes f :: "nat \<Rightarrow> 'm::euclidean_space \<Rightarrow> 'n::euclidean_space"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1649
  assumes "convex s"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1650
    and "\<forall>n. \<forall>x\<in>s. ((f n) has_derivative (f' n x)) (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1651
    and "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. \<forall>x\<in>s. \<forall>h. norm (f' n x h - g' x h) \<le> e * norm h"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1652
    and "e > 0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1653
  shows "\<forall>e>0. \<exists>N. \<forall>m\<ge>N. \<forall>n\<ge>N. \<forall>x\<in>s. \<forall>y\<in>s.
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1654
    norm ((f m x - f n x) - (f m y - f n y)) \<le> e * norm (x - y)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1655
proof (rule, rule)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1656
  case goal1 have *: "2 * (1/2* e) = e" "1/2 * e >0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1657
    using `e > 0` by auto
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1658
  obtain N where "\<forall>n\<ge>N. \<forall>x\<in>s. \<forall>h. norm (f' n x h - g' x h) \<le> 1 / 2 * e * norm h"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1659
    using assms(3) *(2) by blast
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1660
  then show ?case
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1661
    apply (rule_tac x=N in exI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1662
    apply (rule has_derivative_sequence_lipschitz_lemma[where e="1/2 *e", unfolded *])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1663
    using assms
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1664
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1665
    done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1666
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1667
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1668
lemma has_derivative_sequence:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1669
  fixes f::"nat\<Rightarrow> 'm::euclidean_space \<Rightarrow> 'n::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1670
  assumes "convex s"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1671
    and "\<forall>n. \<forall>x\<in>s. ((f n) has_derivative (f' n x)) (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1672
    and "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. \<forall>x\<in>s. \<forall>h. norm (f' n x h - g' x h) \<le> e * norm h"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1673
    and "x0 \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1674
    and "((\<lambda>n. f n x0) ---> l) sequentially"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1675
  shows "\<exists>g. \<forall>x\<in>s. ((\<lambda>n. f n x) ---> g x) sequentially \<and> (g has_derivative g'(x)) (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1676
proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1677
  have lem1: "\<forall>e>0. \<exists>N. \<forall>m\<ge>N. \<forall>n\<ge>N. \<forall>x\<in>s. \<forall>y\<in>s.
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1678
      norm ((f m x - f n x) - (f m y - f n y)) \<le> e * norm (x - y)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1679
    apply (rule has_derivative_sequence_lipschitz[where e="42::nat"])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1680
    apply (rule assms)+
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1681
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1682
    done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1683
  have "\<exists>g. \<forall>x\<in>s. ((\<lambda>n. f n x) ---> g x) sequentially"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1684
    apply (rule bchoice)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1685
    unfolding convergent_eq_cauchy
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1686
  proof
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1687
    fix x
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1688
    assume "x \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1689
    show "Cauchy (\<lambda>n. f n x)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1690
    proof (cases "x = x0")
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1691
      case True
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1692
      then show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1693
        using LIMSEQ_imp_Cauchy[OF assms(5)] by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1694
    next
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1695
      case False
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1696
      show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1697
        unfolding Cauchy_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1698
      proof (rule, rule)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1699
        fix e :: real
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1700
        assume "e > 0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1701
        then have *: "e / 2 > 0" "e / 2 / norm (x - x0) > 0"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1702
          using False by (auto intro!: divide_pos_pos)
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1703
        obtain M where M: "\<forall>m\<ge>M. \<forall>n\<ge>M. dist (f m x0) (f n x0) < e / 2"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1704
          using LIMSEQ_imp_Cauchy[OF assms(5)]
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1705
          unfolding Cauchy_def
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1706
          using *(1) by blast
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1707
        obtain N where N:
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1708
          "\<forall>m\<ge>N. \<forall>n\<ge>N.
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1709
            \<forall>xa\<in>s. \<forall>y\<in>s. norm (f m xa - f n xa - (f m y - f n y)) \<le>
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1710
              e / 2 / norm (x - x0) * norm (xa - y)"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1711
        using lem1 *(2) by blast
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1712
        show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (f m x) (f n x) < e"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1713
          apply (rule_tac x="max M N" in exI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1714
        proof rule+
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1715
          fix m n
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1716
          assume as: "max M N \<le>m" "max M N\<le>n"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1717
          have "dist (f m x) (f n x) \<le>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1718
              norm (f m x0 - f n x0) + norm (f m x - f n x - (f m x0 - f n x0))"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1719
            unfolding dist_norm
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1720
            by (rule norm_triangle_sub)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1721
          also have "\<dots> \<le> norm (f m x0 - f n x0) + e / 2"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1722
            using N[rule_format,OF _ _ `x\<in>s` `x0\<in>s`, of m n] and as and False
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1723
            by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1724
          also have "\<dots> < e / 2 + e / 2"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1725
            apply (rule add_strict_right_mono)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1726
            using as and M[rule_format]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1727
            unfolding dist_norm
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1728
            apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1729
            done
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1730
          finally show "dist (f m x) (f n x) < e"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1731
            by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1732
        qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1733
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1734
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1735
  qed
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1736
  then obtain g where g: "\<forall>x\<in>s. (\<lambda>n. f n x) ----> g x" ..
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1737
  have lem2: "\<forall>e>0. \<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)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1738
  proof (rule, rule)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1739
    fix e :: real
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1740
    assume *: "e > 0"
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1741
    obtain N where
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1742
      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)"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1743
      using lem1 * by blast
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1744
    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)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1745
      apply (rule_tac x=N in exI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1746
    proof rule+
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1747
      fix n x y
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1748
      assume as: "N \<le> n" "x \<in> s" "y \<in> s"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1749
      have "eventually (\<lambda>xa. norm (f n x - f n y - (f xa x - f xa y)) \<le> e * norm (x - y)) sequentially"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1750
        unfolding eventually_sequentially
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1751
        apply (rule_tac x=N in exI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1752
        apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1753
        apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1754
      proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1755
        fix m
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1756
        assume "N \<le> m"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1757
        then show "norm (f n x - f n y - (f m x - f m y)) \<le> e * norm (x - y)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1758
          using N[rule_format, of n m x y] and as
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1759
          by (auto simp add: algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1760
      qed
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1761
      then show "norm (f n x - f n y - (g x - g y)) \<le> e * norm (x - y)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1762
        apply -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1763
        apply (rule Lim_norm_ubound[OF trivial_limit_sequentially, where f="\<lambda>m. (f n x - f n y) - (f m x - f m y)"])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1764
        apply (rule tendsto_intros g[rule_format] as)+
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1765
        apply assumption
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1766
        done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1767
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1768
  qed
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1769
  show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1770
    unfolding has_derivative_within_alt
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1771
    apply (rule_tac x=g in exI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1772
    apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1773
    apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1774
    apply (rule g[rule_format])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1775
    apply assumption
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1776
  proof
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1777
    fix x
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1778
    assume "x \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1779
    have lem3: "\<forall>u. ((\<lambda>n. f' n x u) ---> g' x u) sequentially"
44907
93943da0a010 remove redundant lemma Lim_sequentially in favor of lemma LIMSEQ_def
huffman
parents: 44890
diff changeset
  1780
      unfolding LIMSEQ_def
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1781
    proof (rule, rule, rule)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1782
      fix u
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1783
      fix e :: real
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1784
      assume "e > 0"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1785
      show "\<exists>N. \<forall>n\<ge>N. dist (f' n x u) (g' x u) < e"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1786
      proof (cases "u = 0")
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1787
        case True
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1788
        obtain N where N: "\<forall>n\<ge>N. \<forall>x\<in>s. \<forall>h. norm (f' n x h - g' x h) \<le> e * norm h"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1789
          using assms(3) `e>0` by blast
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1790
        show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1791
          apply (rule_tac x=N in exI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1792
          unfolding True
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1793
          using N[rule_format,OF _ `x\<in>s`,of _ 0] and `e>0`
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1794
          apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1795
          done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1796
      next
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1797
        case False
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1798
        then have *: "e / 2 / norm u > 0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1799
          using `e > 0`
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1800
          by (auto intro!: divide_pos_pos)
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1801
        obtain N where N: "\<forall>n\<ge>N. \<forall>x\<in>s. \<forall>h. norm (f' n x h - g' x h) \<le> e / 2 / norm u * norm h"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1802
          using assms(3) * by blast
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1803
        show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1804
          apply (rule_tac x=N in exI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1805
          apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1806
          apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1807
        proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1808
          case goal1
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1809
          show ?case
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1810
            unfolding dist_norm
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1811
            using N[rule_format,OF goal1 `x\<in>s`, of u] False `e>0`
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1812
            by (auto simp add: field_simps)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1813
        qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1814
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1815
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1816
    show "bounded_linear (g' x)"
53600
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53374
diff changeset
  1817
      unfolding linear_linear linear_iff
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1818
      apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1819
      apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1820
      apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1821
      defer
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1822
      apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1823
      apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1824
    proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1825
      fix x' y z :: 'm
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1826
      fix c :: real
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1827
      note lin = assms(2)[rule_format,OF `x\<in>s`,THEN derivative_linear]
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1828
      show "g' x (c *\<^sub>R x') = c *\<^sub>R g' x x'"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1829
        apply (rule tendsto_unique[OF trivial_limit_sequentially])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1830
        apply (rule lem3[rule_format])
53600
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53374
diff changeset
  1831
        unfolding lin[THEN bounded_linear_imp_linear, THEN linear_cmul]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1832
        apply (intro tendsto_intros)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1833
        apply (rule lem3[rule_format])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1834
        done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1835
      show "g' x (y + z) = g' x y + g' x z"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1836
        apply (rule tendsto_unique[OF trivial_limit_sequentially])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1837
        apply (rule lem3[rule_format])
53600
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53374
diff changeset
  1838
        unfolding lin[THEN bounded_linear_imp_linear, THEN linear_add]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1839
        apply (rule tendsto_add)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1840
        apply (rule lem3[rule_format])+
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1841
        done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1842
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1843
    show "\<forall>e>0. \<exists>d>0. \<forall>y\<in>s. norm (y - x) < d \<longrightarrow> norm (g y - g x - g' x (y - x)) \<le> e * norm (y - x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1844
    proof (rule, rule)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1845
      case goal1
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1846
      have *: "e / 3 > 0"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1847
        using goal1 by auto
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1848
      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"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1849
        using assms(3) * by blast
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1850
      obtain N2 where
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1851
          N2: "\<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)"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1852
        using lem2 * by blast
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1853
      obtain d1 where d1:
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1854
          "0 < d1"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1855
          "\<forall>y\<in>s. norm (y - x) < d1 \<longrightarrow>
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1856
            norm (f (max N1 N2) y - f (max N1 N2) x - f' (max N1 N2) x (y - x)) \<le>
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1857
            e / 3 * norm (y - x)"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1858
        using assms(2)[unfolded has_derivative_within_alt, rule_format,
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1859
            OF `x\<in>s`, of "max N1 N2", THEN conjunct2, rule_format, OF *]
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1860
        by blast
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1861
      show ?case
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1862
        apply (rule_tac x=d1 in exI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1863
        apply rule
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1864
        apply (rule d1(1))
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1865
        apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1866
        apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1867
      proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1868
        fix y
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1869
        assume as: "y \<in> s" "norm (y - x) < d1"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1870
        let ?N = "max N1 N2"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1871
        have "norm (g y - g x - (f ?N y - f ?N x)) \<le> e /3 * norm (y - x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1872
          apply (subst norm_minus_cancel[symmetric])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1873
          using N2[rule_format, OF _ `y \<in> s` `x \<in> s`, of ?N]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1874
          apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1875
          done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1876
        moreover
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1877
        have "norm (f ?N y - f ?N x - f' ?N x (y - x)) \<le> e / 3 * norm (y - x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1878
          using d1 and as
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1879
          by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1880
        ultimately
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1881
        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
  1882
          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
  1883
          by (auto simp add: algebra_simps)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1884
        moreover
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1885
        have " norm (f' ?N x (y - x) - g' x (y - x)) \<le> e / 3 * norm (y - x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1886
          using N1 `x \<in> s` by auto
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1887
        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
  1888
          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
  1889
          by (auto simp add: algebra_simps)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1890
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1891
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1892
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1893
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1894
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
  1895
text {* Can choose to line up antiderivatives if we want. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1896
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1897
lemma has_antiderivative_sequence:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1898
  fixes f :: "nat \<Rightarrow> 'm::euclidean_space \<Rightarrow> 'n::euclidean_space"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1899
  assumes "convex s"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1900
    and "\<forall>n. \<forall>x\<in>s. ((f n) has_derivative (f' n x)) (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1901
    and "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. \<forall>x\<in>s. \<forall>h. norm (f' n x h - g' x h) \<le> e * norm h"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1902
  shows "\<exists>g. \<forall>x\<in>s. (g has_derivative g' x) (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1903
proof (cases "s = {}")
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1904
  case False
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1905
  then obtain a where "a \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1906
    by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1907
  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"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1908
    by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1909
  show ?thesis
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1910
    apply (rule *)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1911
    apply (rule has_derivative_sequence[OF assms(1) _ assms(3), of "\<lambda>n x. f n x + (f 0 a - f n a)"])
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
  1912
    apply (metis assms(2) has_derivative_add_const)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1913
    apply (rule `a \<in> s`)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1914
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1915
    done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1916
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
  1917
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1918
lemma has_antiderivative_limit:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1919
  fixes g' :: "'m::euclidean_space \<Rightarrow> 'm \<Rightarrow> 'n::euclidean_space"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1920
  assumes "convex s"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1921
    and "\<forall>e>0. \<exists>f f'. \<forall>x\<in>s.
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1922
      (f has_derivative (f' x)) (at x within s) \<and> (\<forall>h. norm (f' x h - g' x h) \<le> e * norm h)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1923
  shows "\<exists>g. \<forall>x\<in>s. (g has_derivative g' x) (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1924
proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1925
  have *: "\<forall>n. \<exists>f f'. \<forall>x\<in>s.
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1926
    (f has_derivative (f' x)) (at x within s) \<and>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1927
    (\<forall>h. norm(f' x h - g' x h) \<le> inverse (real (Suc n)) * norm h)"
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
  1928
    by (metis assms(2) inverse_positive_iff_positive real_of_nat_Suc_gt_zero)
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1929
  obtain f where
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
  1930
    *: "\<forall>x. \<exists>f'. \<forall>xa\<in>s. (f x has_derivative f' xa) (at xa within s) \<and>
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1931
      (\<forall>h. norm (f' xa h - g' xa h) \<le> inverse (real (Suc x)) * norm h)"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1932
    using *[THEN choice] ..
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1933
  obtain f' where
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
  1934
    f: "\<forall>x. \<forall>xa\<in>s. (f x has_derivative f' x xa) (at xa within s) \<and>
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1935
      (\<forall>h. norm (f' x xa h - g' xa h) \<le> inverse (real (Suc x)) * norm h)"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1936
    using *[THEN choice] ..
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1937
  show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1938
    apply (rule has_antiderivative_sequence[OF assms(1), of f f'])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1939
    defer
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1940
    apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1941
    apply rule
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1942
  proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1943
    fix e :: real
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1944
    assume "e > 0"
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1945
    obtain N where N: "inverse (real (Suc N)) < e"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  1946
      using reals_Archimedean[OF `e>0`] ..
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1947
    show "\<exists>N. \<forall>n\<ge>N. \<forall>x\<in>s. \<forall>h. norm (f' n x h - g' x h) \<le> e * norm h"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1948
      apply (rule_tac x=N in exI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1949
    proof rule+
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1950
      case goal1
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1951
      have *: "inverse (real (Suc n)) \<le> e"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1952
        apply (rule order_trans[OF _ N[THEN less_imp_le]])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1953
        using goal1(1)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1954
        apply (auto simp add: field_simps)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1955
        done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1956
      show ?case
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1957
        using f[rule_format,THEN conjunct2,OF goal1(2), of n, THEN spec[where x=h]]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1958
        apply (rule order_trans)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1959
        using N *
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1960
        apply (cases "h = 0")
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1961
        apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1962
        done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1963
    qed
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1964
  qed (insert f, auto)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1965
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1966
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1967
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1968
subsection {* Differentiation of a series *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1969
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1970
lemma has_derivative_series:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1971
  fixes f :: "nat \<Rightarrow> 'm::euclidean_space \<Rightarrow> 'n::euclidean_space"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1972
  assumes "convex s"
56183
f998bdd40763 remove sums_seq, it is not used
hoelzl
parents: 56182
diff changeset
  1973
    and "\<And>n x. x \<in> s \<Longrightarrow> ((f n) has_derivative (f' n x)) (at x within s)"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56188
diff changeset
  1974
    and "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. \<forall>x\<in>s. \<forall>h. norm (setsum (\<lambda>i. f' i x h) {..<n} - g' x h) \<le> e * norm h"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1975
    and "x \<in> s"
56183
f998bdd40763 remove sums_seq, it is not used
hoelzl
parents: 56182
diff changeset
  1976
    and "(\<lambda>n. f n x) sums l"
f998bdd40763 remove sums_seq, it is not used
hoelzl
parents: 56182
diff changeset
  1977
  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)"
f998bdd40763 remove sums_seq, it is not used
hoelzl
parents: 56182
diff changeset
  1978
  unfolding sums_def
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1979
  apply (rule has_derivative_sequence[OF assms(1) _ assms(3)])
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
  1980
  apply (metis assms(2) has_derivative_setsum)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1981
  using assms(4-5)
56183
f998bdd40763 remove sums_seq, it is not used
hoelzl
parents: 56182
diff changeset
  1982
  unfolding sums_def
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1983
  apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1984
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1985
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1986
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1987
text {* Considering derivative @{typ "real \<Rightarrow> 'b\<Colon>real_normed_vector"} as a vector. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1988
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1989
definition has_vector_derivative :: "(real \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'b \<Rightarrow> real filter \<Rightarrow> bool"
56182
528fae0816ea update syntax of has_*derivative to infix 50; fixed proofs
hoelzl
parents: 56181
diff changeset
  1990
    (infix "has'_vector'_derivative" 50)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1991
  where "(f has_vector_derivative f') net \<longleftrightarrow> (f has_derivative (\<lambda>x. x *\<^sub>R 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
  1992
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1993
definition "vector_derivative f net = (SOME f'. (f has_vector_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
  1994
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1995
lemma vector_derivative_works:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1996
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1997
  shows "f differentiable net \<longleftrightarrow> (f has_vector_derivative (vector_derivative f net)) net"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  1998
    (is "?l = ?r")
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1999
proof
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2000
  assume ?l
55665
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  2001
  obtain f' where f': "(f has_derivative f') net"
4381a2b622ea tuned proofs;
wenzelm
parents: 54775
diff changeset
  2002
    using `?l` unfolding differentiable_def ..
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2003
  then interpret bounded_linear f'
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2004
    by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2005
  show ?r
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2006
    unfolding vector_derivative_def has_vector_derivative_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2007
    apply -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2008
    apply (rule someI_ex,rule_tac x="f' 1" in exI)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2009
    using f'
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2010
    unfolding scaleR[symmetric]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2011
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2012
    done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2013
next
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2014
  assume ?r
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2015
  then show ?l
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2016
    unfolding vector_derivative_def has_vector_derivative_def differentiable_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2017
    by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2018
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2019
56181
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
  2020
lemma has_field_derivative_iff_has_vector_derivative:
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
  2021
  "(f has_field_derivative y) F \<longleftrightarrow> (f has_vector_derivative y) F"
2aa0b19e74f3 unify syntax for has_derivative and differentiable
hoelzl
parents: 56151
diff changeset
  2022
  unfolding has_vector_derivative_def has_field_derivative_def real_scaleR_def mult_commute_abs ..
50418
bd68cf816dd3 fundamental theorem of calculus for the Lebesgue integral
hoelzl
parents: 46898
diff changeset
  2023
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  2024
lemma vector_derivative_unique_at:
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  2025
  assumes "(f has_vector_derivative f') (at x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2026
    and "(f has_vector_derivative f'') (at x)"
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  2027
  shows "f' = f''"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2028
proof -
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  2029
  have "(\<lambda>x. x *\<^sub>R f') = (\<lambda>x. x *\<^sub>R f'')"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  2030
    using assms [unfolded has_vector_derivative_def]
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  2031
    by (rule frechet_derivative_unique_at)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2032
  then show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2033
    unfolding fun_eq_iff by auto
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  2034
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2035
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2036
lemma vector_derivative_unique_within_closed_interval:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2037
  assumes "a < b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
  2038
    and "x \<in> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
  2039
  assumes "(f has_vector_derivative f') (at x within cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
  2040
  assumes "(f has_vector_derivative f'') (at x within cbox a b)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2041
  shows "f' = f''"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2042
proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2043
  have *: "(\<lambda>x. x *\<^sub>R f') = (\<lambda>x. x *\<^sub>R f'')"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2044
    apply (rule frechet_derivative_unique_within_closed_interval[of "a" "b"])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2045
    using assms(3-)[unfolded has_vector_derivative_def]
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2046
    using assms(1-2)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2047
    apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2048
    done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2049
  show ?thesis
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2050
  proof (rule ccontr)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53077
diff changeset
  2051
    assume **: "f' \<noteq> f''"
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53077
diff changeset
  2052
    with * have "(\<lambda>x. x *\<^sub>R f') 1 = (\<lambda>x. x *\<^sub>R f'') 1"
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53077
diff changeset
  2053
      by (auto simp: fun_eq_iff)
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53077
diff changeset
  2054
    with ** show False
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53077
diff changeset
  2055
      unfolding o_def by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2056
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2057
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2058
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  2059
lemma vector_derivative_at:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2060
  "(f has_vector_derivative f') (at x) \<Longrightarrow> vector_derivative f (at x) = f'"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2061
  apply (rule vector_derivative_unique_at)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2062
  defer
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2063
  apply assumption
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2064
  unfolding vector_derivative_works[symmetric] differentiable_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2065
  unfolding has_vector_derivative_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2066
  apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2067
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2068
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2069
lemma vector_derivative_within_closed_interval:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2070
  assumes "a < b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
  2071
    and "x \<in> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
  2072
  assumes "(f has_vector_derivative f') (at x within cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56183
diff changeset
  2073
  shows "vector_derivative f (at x within cbox a b) = f'"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2074
  apply (rule vector_derivative_unique_within_closed_interval)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2075
  using vector_derivative_works[unfolded differentiable_def]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2076
  using assms
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2077
  apply (auto simp add:has_vector_derivative_def)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2078
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2079
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2080
lemma has_vector_derivative_within_subset:
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2081
  "(f has_vector_derivative f') (at x within s) \<Longrightarrow> t \<subseteq> s \<Longrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2082
    (f has_vector_derivative f') (at x within t)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2083
  unfolding has_vector_derivative_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2084
  apply (rule has_derivative_within_subset)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2085
  apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2086
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2087
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2088
lemma has_vector_derivative_const: "((\<lambda>x. c) has_vector_derivative 0) net"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2089
  unfolding has_vector_derivative_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2090
  using has_derivative_const
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2091
  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
  2092
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2093
lemma has_vector_derivative_id: "((\<lambda>x::real. x) has_vector_derivative 1) net"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2094
  unfolding has_vector_derivative_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2095
  using has_derivative_id
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2096
  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
  2097
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2098
lemma has_vector_derivative_cmul:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2099
  "(f has_vector_derivative f') net \<Longrightarrow>
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2100
    ((\<lambda>x. c *\<^sub>R f x) has_vector_derivative (c *\<^sub>R f')) net"
44140
2c10c35dd4be remove several redundant and unused theorems about derivatives
huffman
parents: 44137
diff changeset
  2101
  unfolding has_vector_derivative_def
44282
f0de18b62d63 remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents: 44140
diff changeset
  2102
  apply (drule scaleR_right_has_derivative)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2103
  apply (auto simp add: algebra_simps)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2104
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2105
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2106
lemma has_vector_derivative_cmul_eq:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2107
  assumes "c \<noteq> 0"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2108
  shows "(((\<lambda>x. c *\<^sub>R f x) has_vector_derivative (c *\<^sub>R f')) net \<longleftrightarrow> (f has_vector_derivative f') net)"
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
  2109
  apply (rule iffI)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2110
  apply (drule has_vector_derivative_cmul[where c="1/c"])
55970
6d123f0ae358 Some new proofs. Tidying up, esp to remove "apply rule".
paulson <lp15@cam.ac.uk>
parents: 55665
diff changeset
  2111
  apply (rule_tac [2] has_vector_derivative_cmul)
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2112
  using assms
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2113
  apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2114
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2115
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2116
lemma has_vector_derivative_neg:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2117
  "(f has_vector_derivative f') net \<Longrightarrow> ((\<lambda>x. - f x) has_vector_derivative (- f')) net"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2118
  unfolding has_vector_derivative_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2119
  apply (drule has_derivative_neg)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2120
  apply auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2121
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2122
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2123
lemma has_vector_derivative_add:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2124
  assumes "(f has_vector_derivative f') net"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2125
    and "(g has_vector_derivative g') net"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2126
  shows "((\<lambda>x. f x + g x) has_vector_derivative (f' + g')) net"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2127
  using has_derivative_add[OF assms[unfolded has_vector_derivative_def]]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2128
  unfolding has_vector_derivative_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2129
  unfolding scaleR_right_distrib
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2130
  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
  2131
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2132
lemma has_vector_derivative_sub:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2133
  assumes "(f has_vector_derivative f') net"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2134
    and "(g has_vector_derivative g') net"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2135
  shows "((\<lambda>x. f x - g x) has_vector_derivative (f' - g')) net"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2136
  using has_derivative_sub[OF assms[unfolded has_vector_derivative_def]]
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2137
  unfolding has_vector_derivative_def scaleR_right_diff_distrib
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2138
  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
  2139
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
  2140
lemma has_vector_derivative_bilinear_within:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2141
  assumes "(f has_vector_derivative f') (at x within s)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2142
    and "(g has_vector_derivative g') (at x within s)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2143
  assumes "bounded_bilinear h"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2144
  shows "((\<lambda>x. h (f x) (g x)) has_vector_derivative (h (f x) g' + h f' (g x))) (at x within s)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2145
proof -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2146
  interpret bounded_bilinear h
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2147
    using assms by auto
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2148
  show ?thesis
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2149
    using has_derivative_bilinear_within[OF assms(1-2)[unfolded has_vector_derivative_def], of h]
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  2150
    unfolding o_def has_vector_derivative_def
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2151
    using assms(3)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2152
    unfolding scaleR_right scaleR_left scaleR_right_distrib
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2153
    by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2154
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2155
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
  2156
lemma has_vector_derivative_bilinear_at:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2157
  assumes "(f has_vector_derivative f') (at x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2158
    and "(g has_vector_derivative g') (at x)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2159
  assumes "bounded_bilinear h"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2160
  shows "((\<lambda>x. h (f x) (g x)) has_vector_derivative (h (f x) g' + h f' (g x))) (at x)"
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
  2161
  using has_vector_derivative_bilinear_within[OF assms] .
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2162
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2163
lemma has_vector_derivative_at_within:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2164
  "(f has_vector_derivative f') (at x) \<Longrightarrow> (f has_vector_derivative f') (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2165
  unfolding has_vector_derivative_def
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44907
diff changeset
  2166
  by (rule has_derivative_at_within)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2167
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2168
lemma has_vector_derivative_transform_within:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2169
  assumes "0 < d"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2170
    and "x \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2171
    and "\<forall>x'\<in>s. dist x' x < d \<longrightarrow> f x' = g x'"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2172
  assumes "(f has_vector_derivative f') (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
  2173
  shows "(g has_vector_derivative f') (at x within s)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2174
  using assms
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2175
  unfolding has_vector_derivative_def
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2176
  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
  2177
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2178
lemma has_vector_derivative_transform_at:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2179
  assumes "0 < d"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2180
    and "\<forall>x'. dist x' x < d \<longrightarrow> f x' = g x'"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2181
    and "(f has_vector_derivative f') (at x)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2182
  shows "(g has_vector_derivative f') (at x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2183
  using assms
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2184
  unfolding has_vector_derivative_def
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2185
  by (rule has_derivative_transform_at)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2186
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2187
lemma has_vector_derivative_transform_within_open:
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2188
  assumes "open s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2189
    and "x \<in> s"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2190
    and "\<forall>y\<in>s. f y = g y"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2191
    and "(f has_vector_derivative f') (at x)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2192
  shows "(g has_vector_derivative f') (at x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2193
  using assms
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2194
  unfolding has_vector_derivative_def
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2195
  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
  2196
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2197
lemma vector_diff_chain_at:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2198
  assumes "(f has_vector_derivative f') (at x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2199
    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
  2200
  shows "((g \<circ> f) has_vector_derivative (f' *\<^sub>R g')) (at x)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2201
  using assms(2)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2202
  unfolding has_vector_derivative_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2203
  apply -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2204
  apply (drule diff_chain_at[OF assms(1)[unfolded has_vector_derivative_def]])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2205
  apply (simp only: o_def real_scaleR_def scaleR_scaleR)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2206
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2207
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2208
lemma vector_diff_chain_within:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  2209
  assumes "(f has_vector_derivative f') (at x within s)"
53781
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2210
    and "(g has_vector_derivative g') (at (f x) within f ` s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2211
  shows "((g \<circ> f) has_vector_derivative (f' *\<^sub>R g')) (at x within s)"
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2212
  using assms(2)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2213
  unfolding has_vector_derivative_def
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2214
  apply -
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2215
  apply (drule diff_chain_within[OF assms(1)[unfolded has_vector_derivative_def]])
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2216
  apply (simp only: o_def real_scaleR_def scaleR_scaleR)
1e86d0b66866 tuned proofs;
wenzelm
parents: 53600
diff changeset
  2217
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2218
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2219
end