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