src/HOL/Multivariate_Analysis/Derivative.thy
author huffman
Tue, 09 Aug 2011 07:37:18 -0700
changeset 44123 2362a970e348
parent 44081 730f7cced3a6
child 44124 4c2a61a897d8
permissions -rw-r--r--
Derivative.thy: clean up formatting
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36350
bc7982c54e37 dropped group_simps, ring_simps, field_eq_simps
haftmann
parents: 36334
diff changeset
     1
(*  Title:                       HOL/Multivariate_Analysis/Derivative.thy
bc7982c54e37 dropped group_simps, ring_simps, field_eq_simps
haftmann
parents: 36334
diff changeset
     2
    Author:                      John Harrison
bc7982c54e37 dropped group_simps, ring_simps, field_eq_simps
haftmann
parents: 36334
diff changeset
     3
    Translation from HOL Light:  Robert Himmelmann, TU Muenchen
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
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
     6
header {* Multivariate calculus in Euclidean space. *}
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
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    12
(* Because I do not want to type this all the time *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    13
lemmas linear_linear = linear_conv_bounded_linear[THEN sym]
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    14
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    15
subsection {* Derivatives *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    16
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    17
text {* The definition is slightly tricky since we make it work over
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    18
  nets of a particular form. This lets us prove theorems generally and use 
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    19
  "at a" or "at a within s" for restriction to a set (1-sided on R etc.) *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    20
44081
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 43338
diff changeset
    21
definition has_derivative :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('a filter \<Rightarrow> bool)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    22
(infixl "(has'_derivative)" 12) where
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    23
 "(f has_derivative f') net \<equiv> bounded_linear f' \<and> ((\<lambda>y. (1 / (norm (y - netlimit net))) *\<^sub>R
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    24
   (f y - (f (netlimit net) + f'(y - netlimit net)))) ---> 0) net"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    25
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    26
lemma derivative_linear[dest]:"(f has_derivative f') net \<Longrightarrow> bounded_linear f'"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    27
  unfolding has_derivative_def by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    28
35290
3707f625314f Equivalence between DERIV and one-dimensional derivation in Multivariate-Analysis
himmelma
parents: 35172
diff changeset
    29
lemma DERIV_conv_has_derivative:"(DERIV f x :> f') = (f has_derivative op * f') (at (x::real))" (is "?l = ?r") proof 
3707f625314f Equivalence between DERIV and one-dimensional derivation in Multivariate-Analysis
himmelma
parents: 35172
diff changeset
    30
  assume ?l note as = this[unfolded deriv_def LIM_def,rule_format]
3707f625314f Equivalence between DERIV and one-dimensional derivation in Multivariate-Analysis
himmelma
parents: 35172
diff changeset
    31
  show ?r unfolding has_derivative_def Lim_at apply- apply(rule,rule mult.bounded_linear_right)
3707f625314f Equivalence between DERIV and one-dimensional derivation in Multivariate-Analysis
himmelma
parents: 35172
diff changeset
    32
    apply safe apply(drule as,safe) apply(rule_tac x=s in exI) apply safe
36587
534418d8d494 remove redundant lemma vector_dist_norm
huffman
parents: 36581
diff changeset
    33
    apply(erule_tac x="xa - x" in allE) unfolding dist_norm netlimit_at[of x] unfolding diff_0_right norm_scaleR
35290
3707f625314f Equivalence between DERIV and one-dimensional derivation in Multivariate-Analysis
himmelma
parents: 35172
diff changeset
    34
    by(auto simp add:field_simps) 
3707f625314f Equivalence between DERIV and one-dimensional derivation in Multivariate-Analysis
himmelma
parents: 35172
diff changeset
    35
next assume ?r note this[unfolded has_derivative_def Lim_at] note as=conjunct2[OF this,rule_format]
3707f625314f Equivalence between DERIV and one-dimensional derivation in Multivariate-Analysis
himmelma
parents: 35172
diff changeset
    36
  have *:"\<And>x xa f'. xa \<noteq> 0 \<Longrightarrow> \<bar>(f (xa + x) - f x) / xa - f'\<bar> = \<bar>(f (xa + x) - f x) - xa * f'\<bar> / \<bar>xa\<bar>" by(auto simp add:field_simps) 
3707f625314f Equivalence between DERIV and one-dimensional derivation in Multivariate-Analysis
himmelma
parents: 35172
diff changeset
    37
  show ?l unfolding deriv_def LIM_def apply safe apply(drule as,safe)
3707f625314f Equivalence between DERIV and one-dimensional derivation in Multivariate-Analysis
himmelma
parents: 35172
diff changeset
    38
    apply(rule_tac x=d in exI,safe) apply(erule_tac x="xa + x" in allE)
36587
534418d8d494 remove redundant lemma vector_dist_norm
huffman
parents: 36581
diff changeset
    39
    unfolding dist_norm diff_0_right norm_scaleR
534418d8d494 remove redundant lemma vector_dist_norm
huffman
parents: 36581
diff changeset
    40
    unfolding dist_norm netlimit_at[of x] by(auto simp add:algebra_simps *) qed
35290
3707f625314f Equivalence between DERIV and one-dimensional derivation in Multivariate-Analysis
himmelma
parents: 35172
diff changeset
    41
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    42
lemma netlimit_at_vector:
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    43
  fixes a :: "'a::real_normed_vector"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    44
  shows "netlimit (at a) = a"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    45
proof (cases "\<exists>x. x \<noteq> a")
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    46
  case True then obtain x where x: "x \<noteq> a" ..
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    47
  have "\<not> trivial_limit (at a)"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    48
    unfolding trivial_limit_def eventually_at dist_norm
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    49
    apply clarsimp
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    50
    apply (rule_tac x="a + scaleR (d / 2) (sgn (x - a))" in exI)
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    51
    apply (simp add: norm_sgn sgn_zero_iff x)
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    52
    done
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    53
  thus ?thesis
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    54
    by (rule netlimit_within [of a UNIV, unfolded within_UNIV])
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    55
qed simp
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    56
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    57
lemma FDERIV_conv_has_derivative:
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    58
  shows "FDERIV f x :> f' = (f has_derivative f') (at x)" (is "?l = ?r")
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    59
proof
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    60
  assume ?l note as = this[unfolded fderiv_def]
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    61
  show ?r unfolding has_derivative_def Lim_at apply-apply(rule,rule as[THEN conjunct1]) proof(rule,rule)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    62
    fix e::real assume "e>0"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    63
    guess d using as[THEN conjunct2,unfolded LIM_def,rule_format,OF`e>0`] ..
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    64
    thus "\<exists>d>0. \<forall>xa. 0 < dist xa x \<and> dist xa x < d \<longrightarrow>
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    65
      dist ((1 / norm (xa - netlimit (at x))) *\<^sub>R (f xa - (f (netlimit (at x)) + f' (xa - netlimit (at x))))) (0) < e"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    66
      apply(rule_tac x=d in exI) apply(erule conjE,rule,assumption) apply rule apply(erule_tac x="xa - x" in allE)
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    67
      unfolding dist_norm netlimit_at_vector[of x] by (auto simp add: diff_diff_eq) qed next
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    68
  assume ?r note as = this[unfolded has_derivative_def]
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    69
  show ?l unfolding fderiv_def LIM_def apply-apply(rule,rule as[THEN conjunct1]) proof(rule,rule)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    70
    fix e::real assume "e>0"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    71
    guess d using as[THEN conjunct2,unfolded Lim_at,rule_format,OF`e>0`] ..
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    72
    thus "\<exists>s>0. \<forall>xa. xa \<noteq> 0 \<and> dist xa 0 < s \<longrightarrow> dist (norm (f (x + xa) - f x - f' xa) / norm xa) 0 < e" apply-
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    73
      apply(rule_tac x=d in exI) apply(erule conjE,rule,assumption) apply rule apply(erule_tac x="xa + x" in allE)
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    74
      unfolding dist_norm netlimit_at_vector[of x] by (auto simp add: diff_diff_eq add.commute) qed qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    75
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    76
subsection {* These are the only cases we'll care about, probably. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    77
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    78
lemma has_derivative_within: "(f has_derivative f') (at x within s) \<longleftrightarrow>
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    79
         bounded_linear f' \<and> ((\<lambda>y. (1 / norm(y - x)) *\<^sub>R (f y - (f x + f' (y - x)))) ---> 0) (at x within s)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    80
  unfolding has_derivative_def and Lim by(auto simp add:netlimit_within)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    81
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    82
lemma has_derivative_at: "(f has_derivative f') (at x) \<longleftrightarrow>
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    83
         bounded_linear f' \<and> ((\<lambda>y. (1 / (norm(y - x))) *\<^sub>R (f y - (f x + f' (y - x)))) ---> 0) (at x)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    84
  apply(subst within_UNIV[THEN sym]) unfolding has_derivative_within unfolding within_UNIV by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    85
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    86
subsection {* More explicit epsilon-delta forms. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    87
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    88
lemma has_derivative_within':
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    89
  "(f has_derivative f')(at x within s) \<longleftrightarrow> bounded_linear f' \<and>
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    90
        (\<forall>e>0. \<exists>d>0. \<forall>x'\<in>s. 0 < norm(x' - x) \<and> norm(x' - x) < d
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    91
        \<longrightarrow> 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
    92
  unfolding has_derivative_within Lim_within dist_norm
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
    93
  unfolding diff_0_right 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
    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':
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    96
 "(f has_derivative f') (at x) \<longleftrightarrow> bounded_linear f' \<and>
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    97
   (\<forall>e>0. \<exists>d>0. \<forall>x'. 0 < norm(x' - x) \<and> norm(x' - x) < d
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    98
        \<longrightarrow> norm(f x' - f x - f'(x' - x)) / norm(x' - x) < e)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    99
  apply(subst within_UNIV[THEN sym]) unfolding has_derivative_within' by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   100
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   101
lemma has_derivative_at_within: "(f has_derivative f') (at x) \<Longrightarrow> (f has_derivative f') (at x within s)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   102
  unfolding has_derivative_within' has_derivative_at' by meson
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   103
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   104
lemma has_derivative_within_open:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   105
  "a \<in> s \<Longrightarrow> open s \<Longrightarrow> ((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
   106
  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
   107
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   108
lemma has_derivative_right:
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   109
  fixes f :: "real \<Rightarrow> real" and y :: "real"
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   110
  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
   111
    ((\<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
   112
proof -
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   113
  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
   114
    ((\<lambda>t. (f t - f x) / (t - x) - y) ---> 0) (at x within ({x<..} \<inter> I))"
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   115
    by (intro Lim_cong_within) (auto simp add: divide.diff divide.add)
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   116
  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
   117
    by (simp add: Lim_null[symmetric])
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   118
  also have "\<dots> \<longleftrightarrow> ((\<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
   119
    by (intro Lim_cong_within) (simp_all add: times_divide_eq field_simps)
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   120
  finally show ?thesis
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   121
    by (simp add: mult.bounded_linear_right has_derivative_within)
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   122
qed
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   123
37648
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   124
lemma bounded_linear_imp_linear: "bounded_linear f \<Longrightarrow> linear f" (* TODO: move elsewhere *)
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   125
proof -
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   126
  assume "bounded_linear f"
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   127
  then interpret f: bounded_linear f .
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   128
  show "linear f"
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   129
    by (simp add: f.add f.scaleR linear_def)
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   130
qed
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   131
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   132
lemma derivative_is_linear:
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   133
  "(f has_derivative f') net \<Longrightarrow> linear f'"
37648
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   134
  by (rule derivative_linear [THEN 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
   135
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   136
subsection {* Combining theorems. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   137
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   138
lemma (in bounded_linear) has_derivative: "(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
   139
  unfolding has_derivative_def apply(rule,rule bounded_linear_axioms)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   140
  unfolding diff by(simp add: Lim_const)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   141
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   142
lemma has_derivative_id: "((\<lambda>x. x) has_derivative (\<lambda>h. h)) net"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   143
  apply(rule bounded_linear.has_derivative) using bounded_linear_ident[unfolded id_def] by simp
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   144
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   145
lemma has_derivative_const: "((\<lambda>x. c) has_derivative (\<lambda>h. 0)) net"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   146
  unfolding has_derivative_def apply(rule,rule bounded_linear_zero) by(simp add: Lim_const)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   147
36434
2a74926bd760 simplify proof
huffman
parents: 36433
diff changeset
   148
lemma (in bounded_linear) cmul: shows "bounded_linear (\<lambda>x. (c::real) *\<^sub>R f x)"
2a74926bd760 simplify proof
huffman
parents: 36433
diff changeset
   149
proof -
2a74926bd760 simplify proof
huffman
parents: 36433
diff changeset
   150
  have "bounded_linear (\<lambda>x. c *\<^sub>R x)"
2a74926bd760 simplify proof
huffman
parents: 36433
diff changeset
   151
    by (rule scaleR.bounded_linear_right)
2a74926bd760 simplify proof
huffman
parents: 36433
diff changeset
   152
  moreover have "bounded_linear f" ..
2a74926bd760 simplify proof
huffman
parents: 36433
diff changeset
   153
  ultimately show ?thesis
2a74926bd760 simplify proof
huffman
parents: 36433
diff changeset
   154
    by (rule bounded_linear_compose)
2a74926bd760 simplify proof
huffman
parents: 36433
diff changeset
   155
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   156
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   157
lemma has_derivative_cmul: assumes "(f has_derivative f') net" shows "((\<lambda>x. c *\<^sub>R f(x)) has_derivative (\<lambda>h. c *\<^sub>R f'(h))) net"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   158
  unfolding has_derivative_def apply(rule,rule bounded_linear.cmul)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   159
  using assms[unfolded has_derivative_def] using Lim_cmul[OF assms[unfolded has_derivative_def,THEN conjunct2]]
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   160
  unfolding scaleR_right_diff_distrib scaleR_right_distrib by auto 
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   161
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   162
lemma has_derivative_cmul_eq: assumes "c \<noteq> 0" 
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   163
  shows "(((\<lambda>x. c *\<^sub>R f(x)) has_derivative (\<lambda>h. c *\<^sub>R f'(h))) net \<longleftrightarrow> (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
   164
  apply(rule) defer apply(rule has_derivative_cmul,assumption) 
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   165
  apply(drule has_derivative_cmul[where c="1/c"]) using assms by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   166
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   167
lemma has_derivative_neg:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   168
 "(f has_derivative f') net \<Longrightarrow> ((\<lambda>x. -(f x)) has_derivative (\<lambda>h. -(f' h))) net"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   169
  apply(drule has_derivative_cmul[where c="-1"]) by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   170
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   171
lemma has_derivative_neg_eq: "((\<lambda>x. -(f x)) has_derivative (\<lambda>h. -(f' h))) net \<longleftrightarrow> (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
   172
  apply(rule, drule_tac[!] has_derivative_neg) by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   173
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   174
lemma has_derivative_add:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   175
  assumes "(f has_derivative f') net" and "(g has_derivative g') net"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   176
  shows "((\<lambda>x. f(x) + g(x)) has_derivative (\<lambda>h. f'(h) + g'(h))) net"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   177
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   178
  note as = assms[unfolded has_derivative_def]
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   179
  show ?thesis unfolding has_derivative_def apply(rule,rule bounded_linear_add)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   180
    using Lim_add[OF as(1)[THEN conjunct2] as(2)[THEN conjunct2]] and as
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   181
    by (auto simp add:algebra_simps scaleR_right_diff_distrib scaleR_right_distrib)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   182
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   183
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   184
lemma has_derivative_add_const:"(f has_derivative f') net \<Longrightarrow> ((\<lambda>x. f x + c) 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
   185
  apply(drule has_derivative_add) apply(rule has_derivative_const) by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   186
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   187
lemma has_derivative_sub:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   188
  assumes "(f has_derivative f') net" and "(g has_derivative g') net"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   189
  shows "((\<lambda>x. f(x) - g(x)) has_derivative (\<lambda>h. f'(h) - g'(h))) net"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   190
  unfolding diff_minus by (intro has_derivative_add has_derivative_neg assms)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   191
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   192
lemma has_derivative_setsum:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   193
  assumes "finite s" and "\<forall>a\<in>s. ((f a) has_derivative (f' a)) net"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   194
  shows "((\<lambda>x. setsum (\<lambda>a. f a x) s) has_derivative (\<lambda>h. setsum (\<lambda>a. f' a h) s)) net"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   195
  using assms by (induct, simp_all add: has_derivative_const has_derivative_add)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   196
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   197
lemma has_derivative_setsum_numseg:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   198
  "\<forall>i. m \<le> i \<and> i \<le> n \<longrightarrow> ((f i) has_derivative (f' i)) net \<Longrightarrow>
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   199
  ((\<lambda>x. setsum (\<lambda>i. f i x) {m..n::nat}) has_derivative (\<lambda>h. setsum (\<lambda>i. f' i h) {m..n})) net"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   200
  by (rule has_derivative_setsum) simp_all
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   201
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   202
subsection {* somewhat different results for derivative of scalar multiplier. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   203
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   204
(** move **)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   205
lemma linear_vmul_component:
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   206
  assumes lf: "linear f"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   207
  shows "linear (\<lambda>x. f x $$ k *\<^sub>R v)"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   208
  using lf
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   209
  by (auto simp add: linear_def algebra_simps)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   210
37648
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   211
lemma bounded_linear_euclidean_component: "bounded_linear (\<lambda>x. x $$ k)"
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   212
  unfolding euclidean_component_def
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   213
  by (rule inner.bounded_linear_right)
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   214
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   215
lemma has_derivative_vmul_component:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   216
  fixes c::"'a::real_normed_vector \<Rightarrow> 'b::euclidean_space" and v::"'c::real_normed_vector"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   217
  assumes "(c has_derivative c') 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
   218
  shows "((\<lambda>x. c(x)$$k *\<^sub>R v) has_derivative (\<lambda>x. (c' x)$$k *\<^sub>R v)) net" proof-
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   219
  have *:"\<And>y. (c y $$ k *\<^sub>R v - (c (netlimit net) $$ k *\<^sub>R v + c' (y - netlimit net) $$ k *\<^sub>R v)) = 
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   220
        (c y $$ k - (c (netlimit net) $$ k + c' (y - netlimit net) $$ k)) *\<^sub>R v" 
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   221
    unfolding scaleR_left_diff_distrib scaleR_left_distrib by auto
37648
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   222
  show ?thesis unfolding has_derivative_def and *
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   223
    apply (rule conjI)
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   224
    apply (rule bounded_linear_compose [OF scaleR.bounded_linear_left])
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   225
    apply (rule bounded_linear_compose [OF bounded_linear_euclidean_component])
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   226
    apply (rule derivative_linear [OF assms])
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   227
    apply(subst scaleR_zero_left[THEN sym, of v]) unfolding scaleR_scaleR apply(rule Lim_vmul)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   228
    using assms[unfolded has_derivative_def] unfolding Lim o_def apply- apply(cases "trivial_limit net")
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   229
    apply(rule,assumption,rule disjI2,rule,rule) proof-
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   230
    have *:"\<And>x. x - 0 = (x::'a)" by auto 
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   231
    have **:"\<And>d x. d * (c x $$ k - (c (netlimit net) $$ k + c' (x - netlimit net) $$ k)) =
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   232
      (d *\<^sub>R (c x - (c (netlimit net) + c' (x - netlimit net) ))) $$k" by(auto simp add: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
   233
    fix e assume "\<not> trivial_limit net" "0 < (e::real)"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   234
    then have "eventually (\<lambda>x. dist ((1 / norm (x - netlimit net)) *\<^sub>R
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   235
      (c x - (c (netlimit net) + c' (x - netlimit net)))) 0 < e) net"
34103
9095ba4d2cd4 make proof use only abstract properties of eventually
huffman
parents: 33759
diff changeset
   236
      using assms[unfolded has_derivative_def Lim] 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
   237
    thus "eventually (\<lambda>x. dist (1 / norm (x - netlimit net) *
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   238
      (c x $$ k - (c (netlimit net) $$ k + c' (x - netlimit net) $$ k))) 0 < e) net"
34103
9095ba4d2cd4 make proof use only abstract properties of eventually
huffman
parents: 33759
diff changeset
   239
      proof (rule eventually_elim1)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   240
      case goal1 thus ?case apply - unfolding dist_norm  apply(rule le_less_trans)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   241
        prefer 2 apply assumption unfolding * **
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   242
        using component_le_norm[of "(1 / norm (x - netlimit net)) *\<^sub>R
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   243
          (c x - (c (netlimit net) + c' (x - netlimit net))) - 0" k] by auto
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   244
    qed
37648
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   245
  qed
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   246
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   247
37648
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   248
lemma has_derivative_vmul_within: fixes c::"real \<Rightarrow> real"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   249
  assumes "(c has_derivative c') (at x within s)"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   250
  shows "((\<lambda>x. (c x) *\<^sub>R v) has_derivative (\<lambda>x. (c' x) *\<^sub>R v)) (at x within s)"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   251
  using has_derivative_vmul_component[OF assms, of 0 v] 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
   252
37648
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   253
lemma has_derivative_vmul_at: fixes c::"real \<Rightarrow> real"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   254
  assumes "(c has_derivative c') (at x)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   255
  shows "((\<lambda>x. (c x) *\<^sub>R v) has_derivative (\<lambda>x. (c' x) *\<^sub>R v)) (at x)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   256
  using has_derivative_vmul_within[where s=UNIV] and assms by(auto simp add: within_UNIV)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   257
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   258
lemma has_derivative_lift_dot:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   259
  assumes "(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
   260
  shows "((\<lambda>x. inner v (f x)) has_derivative (\<lambda>t. inner v (f' t))) net" proof-
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   261
  show ?thesis using assms unfolding has_derivative_def apply- apply(erule conjE,rule)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   262
    apply(rule bounded_linear_compose[of _ f']) apply(rule inner.bounded_linear_right,assumption)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   263
    apply(drule Lim_inner[where a=v]) unfolding o_def
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   264
    by(auto simp add:inner.scaleR_right inner.add_right inner.diff_right) qed
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   265
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   266
lemmas has_derivative_intros =
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   267
  has_derivative_sub has_derivative_add has_derivative_cmul has_derivative_id
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   268
  has_derivative_const has_derivative_neg has_derivative_vmul_component
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   269
  has_derivative_vmul_at has_derivative_vmul_within has_derivative_cmul 
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   270
  bounded_linear.has_derivative has_derivative_lift_dot
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   271
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   272
subsection {* limit transformation for derivatives. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   273
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   274
lemma has_derivative_transform_within:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   275
  assumes "0 < d" "x \<in> s" "\<forall>x'\<in>s. dist x' x < d \<longrightarrow> f x' = g x'" "(f has_derivative f') (at x within s)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   276
  shows "(g has_derivative f') (at x within s)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   277
  using assms(4) unfolding has_derivative_within apply- apply(erule conjE,rule,assumption)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   278
  apply(rule Lim_transform_within[OF assms(1)]) defer apply assumption
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   279
  apply(rule,rule) apply(drule assms(3)[rule_format]) using assms(3)[rule_format, OF assms(2)] by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   280
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   281
lemma has_derivative_transform_at:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   282
  assumes "0 < d" "\<forall>x'. dist x' x < d \<longrightarrow> f x' = g x'" "(f has_derivative f') (at x)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   283
  shows "(g has_derivative f') (at x)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   284
  apply(subst within_UNIV[THEN sym]) apply(rule has_derivative_transform_within[OF assms(1)])
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   285
  using assms(2-3) unfolding within_UNIV by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   286
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   287
lemma has_derivative_transform_within_open:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   288
  assumes "open s" "x \<in> s" "\<forall>y\<in>s. f y = g y" "(f has_derivative f') (at x)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   289
  shows "(g has_derivative f') (at x)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   290
  using assms(4) unfolding has_derivative_at apply- apply(erule conjE,rule,assumption)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   291
  apply(rule Lim_transform_within_open[OF assms(1,2)]) defer apply assumption
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   292
  apply(rule,rule) apply(drule assms(3)[rule_format]) using assms(3)[rule_format, OF assms(2)] by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   293
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   294
subsection {* differentiability. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   295
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36334
diff changeset
   296
no_notation Deriv.differentiable (infixl "differentiable" 60)
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36334
diff changeset
   297
44081
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 43338
diff changeset
   298
definition differentiable :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a filter \<Rightarrow> bool" (infixr "differentiable" 30) where
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   299
  "f differentiable net \<equiv> (\<exists>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
   300
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   301
definition differentiable_on :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a set \<Rightarrow> bool" (infixr "differentiable'_on" 30) where
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   302
  "f differentiable_on s \<equiv> (\<forall>x\<in>s. f differentiable (at x within s))"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   303
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   304
lemma differentiableI: "(f has_derivative f') net \<Longrightarrow> f differentiable net"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   305
  unfolding differentiable_def by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   306
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   307
lemma differentiable_at_withinI: "f differentiable (at x) \<Longrightarrow> f differentiable (at x within s)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   308
  unfolding differentiable_def using has_derivative_at_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
   309
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   310
lemma differentiable_within_open: (* TODO: delete *)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   311
  assumes "a \<in> s" and "open s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   312
  shows "f differentiable (at a within s) \<longleftrightarrow> (f differentiable (at a))"
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   313
  using assms 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
   314
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   315
lemma differentiable_on_eq_differentiable_at:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   316
  "open s \<Longrightarrow> (f differentiable_on s \<longleftrightarrow> (\<forall>x\<in>s. f differentiable at x))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   317
  unfolding differentiable_on_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   318
  by (auto simp add: 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
   319
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   320
lemma differentiable_transform_within:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   321
  assumes "0 < d" and "x \<in> s" and "\<forall>x'\<in>s. dist x' x < d \<longrightarrow> f x' = g x'"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   322
  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
   323
  shows "g differentiable (at x within s)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   324
  using assms(4) unfolding differentiable_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   325
  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
   326
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   327
lemma differentiable_transform_at:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   328
  assumes "0 < d" "\<forall>x'. dist x' x < d \<longrightarrow> f x' = g x'" "f differentiable at x"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   329
  shows "g differentiable at x"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   330
  using assms(3) unfolding differentiable_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   331
  using has_derivative_transform_at[OF assms(1-2)] 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
   332
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   333
subsection {* Frechet derivative and Jacobian matrix. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   334
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   335
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
   336
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   337
lemma frechet_derivative_works:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   338
 "f differentiable net \<longleftrightarrow> (f has_derivative (frechet_derivative f net)) net"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   339
  unfolding frechet_derivative_def differentiable_def and some_eq_ex[of "\<lambda> 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
   340
37648
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   341
lemma linear_frechet_derivative:
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   342
  shows "f differentiable net \<Longrightarrow> linear(frechet_derivative f net)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   343
  unfolding frechet_derivative_works has_derivative_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   344
  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
   345
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   346
subsection {* Differentiability implies continuity. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   347
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   348
lemma Lim_mul_norm_within:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   349
  fixes f::"'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   350
  shows "(f ---> 0) (at a within s) \<Longrightarrow> ((\<lambda>x. norm(x - a) *\<^sub>R f(x)) ---> 0) (at a within s)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   351
  unfolding Lim_within apply(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   352
  apply(erule_tac x=e in allE,erule impE,assumption,erule exE,erule conjE)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   353
  apply(rule_tac x="min d 1" in exI) apply rule defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   354
  apply(rule,erule_tac x=x in ballE) unfolding dist_norm diff_0_right
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   355
  by(auto intro!: mult_strict_mono[of _ "1::real", unfolded mult_1_left])
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   356
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   357
lemma differentiable_imp_continuous_within:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   358
  assumes "f differentiable (at x within s)" 
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   359
  shows "continuous (at x within s) f"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   360
proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   361
  from assms guess f' unfolding differentiable_def has_derivative_within ..
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   362
  note f'=this
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   363
  then interpret bounded_linear f' by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   364
  have *:"\<And>xa. x\<noteq>xa \<Longrightarrow> (f' \<circ> (\<lambda>y. y - x)) xa + norm (xa - x) *\<^sub>R ((1 / norm (xa - x)) *\<^sub>R (f xa - (f x + f' (xa - x)))) - ((f' \<circ> (\<lambda>y. y - x)) x + 0) = f xa - f x"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   365
    using zero by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   366
  have **:"continuous (at x within s) (f' \<circ> (\<lambda>y. y - x))"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   367
    apply(rule continuous_within_compose) apply(rule continuous_intros)+
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   368
    by(rule linear_continuous_within[OF f'[THEN conjunct1]])
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   369
  show ?thesis unfolding continuous_within
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   370
    using f'[THEN conjunct2, THEN Lim_mul_norm_within]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   371
    apply- apply(drule Lim_add)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   372
    apply(rule **[unfolded continuous_within])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   373
    unfolding Lim_within and dist_norm
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   374
    apply (rule, rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   375
    apply (erule_tac x=e in allE)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   376
    apply (erule impE | assumption)+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   377
    apply (erule exE, rule_tac x=d in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   378
    by (auto simp add: zero * elim!: allE)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   379
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   380
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   381
lemma differentiable_imp_continuous_at:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   382
  "f differentiable at x \<Longrightarrow> continuous (at x) f"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   383
 by(rule differentiable_imp_continuous_within[of _ x UNIV, unfolded within_UNIV])
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   384
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   385
lemma differentiable_imp_continuous_on:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   386
  "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
   387
  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
   388
  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
   389
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   390
lemma has_derivative_within_subset:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   391
 "(f has_derivative f') (at x within s) \<Longrightarrow> t \<subseteq> s \<Longrightarrow> (f has_derivative f') (at x within t)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   392
  unfolding has_derivative_within using Lim_within_subset by blast
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   393
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   394
lemma differentiable_within_subset:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   395
  "f differentiable (at x within t) \<Longrightarrow> s \<subseteq> t \<Longrightarrow> f differentiable (at x within s)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   396
  unfolding differentiable_def using has_derivative_within_subset by blast
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   397
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   398
lemma differentiable_on_subset:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   399
  "f differentiable_on t \<Longrightarrow> s \<subseteq> t \<Longrightarrow> f differentiable_on s"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   400
  unfolding differentiable_on_def using differentiable_within_subset by blast
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   401
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   402
lemma differentiable_on_empty: "f differentiable_on {}"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   403
  unfolding differentiable_on_def by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   404
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   405
subsection {* Several results are easier using a "multiplied-out" variant.              *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   406
(* (I got this idea from Dieudonne's proof of the chain rule). *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   407
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   408
lemma has_derivative_within_alt:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   409
 "(f has_derivative f') (at x within s) \<longleftrightarrow> bounded_linear f' \<and>
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   410
  (\<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))" (is "?lhs \<longleftrightarrow> ?rhs")
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   411
proof
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   412
  assume ?lhs thus ?rhs
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   413
    unfolding has_derivative_within apply-apply(erule conjE,rule,assumption)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   414
    unfolding Lim_within
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   415
    apply(rule,erule_tac x=e in allE,rule,erule impE,assumption)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   416
    apply(erule exE,rule_tac x=d in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   417
    apply(erule conjE,rule,assumption,rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   418
  proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   419
    fix x y e d assume as:"0 < e" "0 < d" "norm (y - x) < d" "\<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow>
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   420
      dist ((1 / norm (xa - x)) *\<^sub>R (f xa - (f x + f' (xa - x)))) 0 < e" "y \<in> s" "bounded_linear f'"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   421
    then interpret bounded_linear f' by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   422
    show "norm (f y - f x - f' (y - x)) \<le> e * norm (y - x)" proof(cases "y=x")
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   423
      case True thus ?thesis using `bounded_linear f'` by(auto simp add: zero)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   424
    next
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   425
      case False hence "norm (f y - (f x + f' (y - x))) < e * norm (y - x)" using as(4)[rule_format, OF `y\<in>s`]
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
   426
        unfolding dist_norm diff_0_right using as(3)
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
   427
        using pos_divide_less_eq[OF False[unfolded dist_nz], unfolded dist_norm]
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
   428
        by (auto simp add: linear_0 linear_sub)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   429
      thus ?thesis by(auto simp add:algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   430
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   431
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   432
next
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   433
  assume ?rhs thus ?lhs unfolding has_derivative_within Lim_within
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   434
    apply-apply(erule conjE,rule,assumption)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   435
    apply(rule,erule_tac x="e/2" in allE,rule,erule impE) defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   436
    apply(erule exE,rule_tac x=d in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   437
    apply(erule conjE,rule,assumption,rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   438
    unfolding dist_norm diff_0_right norm_scaleR
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   439
    apply(erule_tac x=xa in ballE,erule impE)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   440
  proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   441
    fix e d y assume "bounded_linear f'" "0 < e" "0 < d" "y \<in> s" "0 < norm (y - x) \<and> norm (y - x) < d"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   442
        "norm (f y - f x - f' (y - x)) \<le> e / 2 * norm (y - x)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   443
    thus "\<bar>1 / norm (y - x)\<bar> * norm (f y - (f x + f' (y - x))) < e"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   444
      apply(rule_tac le_less_trans[of _ "e/2"])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   445
      by(auto intro!:mult_imp_div_pos_le simp add:algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   446
  qed auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   447
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   448
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   449
lemma has_derivative_at_alt:
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents: 35028
diff changeset
   450
  "(f has_derivative f') (at x) \<longleftrightarrow> bounded_linear f' \<and>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   451
  (\<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))"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   452
  using has_derivative_within_alt[where s=UNIV] unfolding within_UNIV by auto
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
subsection {* The chain rule. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   455
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   456
lemma diff_chain_within:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   457
  assumes "(f has_derivative f') (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   458
  assumes "(g has_derivative g') (at (f x) within (f ` s))"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   459
  shows "((g o f) has_derivative (g' o f'))(at x within s)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   460
  unfolding has_derivative_within_alt
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   461
  apply(rule,rule bounded_linear_compose[unfolded o_def[THEN sym]])
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   462
  apply(rule assms(2)[unfolded has_derivative_def,THEN conjE],assumption)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   463
  apply(rule assms(1)[unfolded has_derivative_def,THEN conjE],assumption)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   464
proof(rule,rule)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   465
  note assms = assms[unfolded has_derivative_within_alt]
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   466
  fix e::real assume "0<e"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   467
  guess B1 using bounded_linear.pos_bounded[OF assms(1)[THEN conjunct1, rule_format]] .. note B1 = this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   468
  guess B2 using bounded_linear.pos_bounded[OF assms(2)[THEN conjunct1, rule_format]] .. note B2 = this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   469
  have *:"e / 2 / B2 > 0" using `e>0` B2 apply-apply(rule divide_pos_pos) by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   470
  guess d1 using assms(1)[THEN conjunct2, rule_format, OF *] .. note d1 = this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   471
  have *:"e / 2 / (1 + B1) > 0" using `e>0` B1 apply-apply(rule divide_pos_pos) by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   472
  guess de using assms(2)[THEN conjunct2, rule_format, OF *] .. note de = this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   473
  guess d2 using assms(1)[THEN conjunct2, rule_format, OF zero_less_one] .. note d2 = this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   474
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   475
  def d0 \<equiv> "(min d1 d2)/2" have d0:"d0>0" "d0 < d1" "d0 < d2" unfolding d0_def using d1 d2 by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   476
  def d \<equiv> "(min d0 (de / (B1 + 1))) / 2" have "de * 2 / (B1 + 1) > de / (B1 + 1)" apply(rule divide_strict_right_mono) using B1 de by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   477
  hence d:"d>0" "d < d1" "d < d2" "d < (de / (B1 + 1))" unfolding d_def using d0 d1 d2 de B1 by(auto intro!: divide_pos_pos simp add:min_less_iff_disj not_less)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   478
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   479
  show "\<exists>d>0. \<forall>y\<in>s. norm (y - x) < d \<longrightarrow> norm ((g \<circ> f) y - (g \<circ> f) x - (g' \<circ> f') (y - x)) \<le> e * norm (y - x)" apply(rule_tac x=d in exI)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   480
    proof(rule,rule `d>0`,rule,rule) 
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   481
    fix y assume as:"y \<in> s" "norm (y - x) < d"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   482
    hence 1:"norm (f y - f x - f' (y - x)) \<le> min (norm (y - x)) (e / 2 / B2 * norm (y - x))" using d1 d2 d by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   483
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   484
    have "norm (f y - f x) \<le> norm (f y - f x - f' (y - x)) + norm (f' (y - x))"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   485
      using norm_triangle_sub[of "f y - f x" "f' (y - x)"]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   486
      by(auto simp add:algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   487
    also have "\<dots> \<le> norm (f y - f x - f' (y - x)) + B1 * norm (y - x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   488
      apply(rule add_left_mono) using B1 by(auto simp add:algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   489
    also have "\<dots> \<le> min (norm (y - x)) (e / 2 / B2 * norm (y - x)) + B1 * norm (y - x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   490
      apply(rule add_right_mono) using d1 d2 d as 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
   491
    also have "\<dots> \<le> norm (y - x) + B1 * norm (y - x)" by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   492
    also have "\<dots> = norm (y - x) * (1 + B1)" by(auto simp add:field_simps)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   493
    finally have 3:"norm (f y - f x) \<le> norm (y - x) * (1 + B1)" by auto 
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   494
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   495
    hence "norm (f y - f x) \<le> d * (1 + B1)" apply-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   496
      apply(rule order_trans,assumption,rule mult_right_mono)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   497
      using as B1 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
   498
    also have "\<dots> < de" using d B1 by(auto simp add:field_simps) 
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   499
    finally have "norm (g (f y) - g (f x) - g' (f y - f x)) \<le> e / 2 / (1 + B1) * norm (f y - f x)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   500
      apply-apply(rule de[THEN conjunct2,rule_format])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   501
      using `y\<in>s` using d as 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
   502
    also have "\<dots> = (e / 2) * (1 / (1 + B1) * norm (f y - f x))" by auto 
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   503
    also have "\<dots> \<le> e / 2 * norm (y - x)" apply(rule mult_left_mono)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   504
      using `e>0` and 3 using B1 and `e>0` by(auto simp add:divide_le_eq)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   505
    finally have 4:"norm (g (f y) - g (f x) - g' (f y - f x)) \<le> e / 2 * norm (y - x)" by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   506
    
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   507
    interpret g': bounded_linear g' using assms(2) by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   508
    interpret f': bounded_linear f' using assms(1) by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   509
    have "norm (- g' (f' (y - x)) + g' (f y - f x)) = norm (g' (f y - f x - f' (y - x)))"
36350
bc7982c54e37 dropped group_simps, ring_simps, field_eq_simps
haftmann
parents: 36334
diff changeset
   510
      by(auto simp add:algebra_simps f'.diff g'.diff g'.add)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   511
    also have "\<dots> \<le> B2 * norm (f y - f x - f' (y - x))" using B2
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   512
      by (auto simp add: algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   513
    also have "\<dots> \<le> B2 * (e / 2 / B2 * norm (y - x))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   514
      apply (rule mult_left_mono) using as d1 d2 d B2 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
   515
    also have "\<dots> \<le> e / 2 * norm (y - x)" using B2 by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   516
    finally have 5:"norm (- g' (f' (y - x)) + g' (f y - f x)) \<le> e / 2 * norm (y - x)" by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   517
    
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   518
    have "norm (g (f y) - g (f x) - g' (f y - f x)) + norm (g (f y) - g (f x) - g' (f' (y - x)) - (g (f y) - g (f x) - g' (f y - f x))) \<le> e * norm (y - x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   519
      using 5 4 by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   520
    thus "norm ((g \<circ> f) y - (g \<circ> f) x - (g' \<circ> f') (y - x)) \<le> e * norm (y - x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   521
      unfolding o_def apply- apply(rule order_trans, rule norm_triangle_sub)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   522
      by assumption
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   523
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   524
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   525
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   526
lemma diff_chain_at:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   527
  "(f has_derivative f') (at x) \<Longrightarrow> (g has_derivative g') (at (f x)) \<Longrightarrow> ((g o f) has_derivative (g' o f')) (at x)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   528
  using diff_chain_within[of f f' x UNIV g g']
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   529
  using has_derivative_within_subset[of g g' "f x" UNIV "range f"]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   530
  unfolding within_UNIV 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
   531
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   532
subsection {* Composition rules stated just for differentiability. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   533
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   534
lemma differentiable_const [intro]:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   535
  "(\<lambda>z. c) differentiable (net::'a::real_normed_vector filter)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   536
  unfolding differentiable_def using has_derivative_const by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   537
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   538
lemma differentiable_id [intro]:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   539
  "(\<lambda>z. z) differentiable (net::'a::real_normed_vector filter)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   540
    unfolding differentiable_def using has_derivative_id by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   541
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   542
lemma differentiable_cmul [intro]:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   543
  "f differentiable net \<Longrightarrow>
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   544
  (\<lambda>x. c *\<^sub>R f(x)) differentiable (net::'a::real_normed_vector filter)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   545
  unfolding differentiable_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   546
  apply(erule exE, drule has_derivative_cmul) 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
   547
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   548
lemma differentiable_neg [intro]:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   549
  "f differentiable net \<Longrightarrow>
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   550
  (\<lambda>z. -(f z)) differentiable (net::'a::real_normed_vector filter)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   551
  unfolding differentiable_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   552
  apply(erule exE, drule has_derivative_neg) 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
   553
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   554
lemma differentiable_add: "f differentiable net \<Longrightarrow> g differentiable net
44081
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 43338
diff changeset
   555
   \<Longrightarrow> (\<lambda>z. f z + g z) differentiable (net::'a::real_normed_vector filter)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   556
    unfolding differentiable_def apply(erule exE)+ apply(rule_tac x="\<lambda>z. f' z + f'a z" in exI)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   557
    apply(rule has_derivative_add) by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   558
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   559
lemma differentiable_sub: "f differentiable net \<Longrightarrow> g differentiable net
44081
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 43338
diff changeset
   560
  \<Longrightarrow> (\<lambda>z. f z - g z) differentiable (net::'a::real_normed_vector filter)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   561
  unfolding differentiable_def apply(erule exE)+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   562
  apply(rule_tac x="\<lambda>z. f' z - f'a z" in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   563
  apply(rule has_derivative_sub) 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
   564
37648
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   565
lemma differentiable_setsum:
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   566
  assumes "finite s" "\<forall>a\<in>s. (f a) differentiable net"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   567
  shows "(\<lambda>x. setsum (\<lambda>a. f a x) s) differentiable net"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   568
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   569
  guess f' using bchoice[OF assms(2)[unfolded differentiable_def]] ..
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   570
  thus ?thesis unfolding differentiable_def apply-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   571
    apply(rule,rule has_derivative_setsum[where f'=f'],rule assms(1)) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   572
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   573
37648
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   574
lemma differentiable_setsum_numseg:
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   575
  shows "\<forall>i. m \<le> i \<and> i \<le> n \<longrightarrow> (f i) differentiable net \<Longrightarrow> (\<lambda>x. setsum (\<lambda>a. f a x) {m::nat..n}) differentiable net"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   576
  apply(rule differentiable_setsum) using finite_atLeastAtMost[of n m] by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   577
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   578
lemma differentiable_chain_at:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   579
  "f differentiable (at x) \<Longrightarrow> g differentiable (at(f x)) \<Longrightarrow> (g o f) differentiable (at x)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   580
  unfolding differentiable_def by(meson diff_chain_at)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   581
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   582
lemma differentiable_chain_within:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   583
  "f differentiable (at x within s) \<Longrightarrow> g differentiable (at(f x) within (f ` s))
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   584
   \<Longrightarrow> (g o f) differentiable (at x within s)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   585
  unfolding differentiable_def by(meson diff_chain_within)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   586
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   587
subsection {* Uniqueness of derivative *}
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   588
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   589
text {*
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   590
 The general result is a bit messy because we need approachability of the
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   591
 limit point from any direction. But OK for nontrivial intervals etc.
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   592
*}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   593
    
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   594
lemma frechet_derivative_unique_within:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   595
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   596
  assumes "(f has_derivative f') (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   597
  assumes "(f has_derivative f'') (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   598
  assumes "(\<forall>i<DIM('a). \<forall>e>0. \<exists>d. 0 < abs(d) \<and> abs(d) < e \<and> (x + d *\<^sub>R basis i) \<in> s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   599
  shows "f' = f''"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   600
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   601
  note as = assms(1,2)[unfolded has_derivative_def]
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   602
  then interpret f': bounded_linear f' by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   603
  from as interpret f'': bounded_linear f'' by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   604
  have "x islimpt s" unfolding islimpt_approachable
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   605
  proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   606
    fix e::real assume "0<e" guess d
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   607
      using assms(3)[rule_format,OF DIM_positive `e>0`] ..
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   608
    thus "\<exists>x'\<in>s. x' \<noteq> x \<and> dist x' x < e"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   609
      apply(rule_tac x="x + d *\<^sub>R basis 0" in bexI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   610
      unfolding dist_norm by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   611
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   612
  hence *:"netlimit (at x within s) = x" apply-apply(rule netlimit_within)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   613
    unfolding trivial_limit_within by simp
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   614
  show ?thesis  apply(rule linear_eq_stdbasis)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   615
    unfolding linear_conv_bounded_linear
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   616
    apply(rule as(1,2)[THEN conjunct1])+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   617
  proof(rule,rule,rule ccontr)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   618
    fix i assume i:"i<DIM('a)" def e \<equiv> "norm (f' (basis i) - f'' (basis i))"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   619
    assume "f' (basis i) \<noteq> f'' (basis i)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   620
    hence "e>0" unfolding e_def 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
   621
    guess d using Lim_sub[OF as(1,2)[THEN conjunct2], unfolded * Lim_within,rule_format,OF `e>0`] .. note d=this
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   622
    guess c using assms(3)[rule_format,OF i d[THEN conjunct1]] .. note c=this
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   623
    have *:"norm (- ((1 / \<bar>c\<bar>) *\<^sub>R f' (c *\<^sub>R basis i)) + (1 / \<bar>c\<bar>) *\<^sub>R f'' (c *\<^sub>R basis i)) = norm ((1 / abs c) *\<^sub>R (- (f' (c *\<^sub>R basis i)) + f'' (c *\<^sub>R basis i)))"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   624
      unfolding scaleR_right_distrib by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   625
    also have "\<dots> = norm ((1 / abs c) *\<^sub>R (c *\<^sub>R (- (f' (basis i)) + f'' (basis i))))"  
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   626
      unfolding f'.scaleR f''.scaleR
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   627
      unfolding scaleR_right_distrib scaleR_minus_right by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   628
    also have "\<dots> = e" unfolding e_def using c[THEN conjunct1]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   629
      using norm_minus_cancel[of "f' (basis i) - f'' (basis i)"]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   630
      by (auto simp add: add.commute ab_diff_minus)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   631
    finally show False using c
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   632
      using d[THEN conjunct2,rule_format,of "x + c *\<^sub>R basis i"]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   633
      unfolding dist_norm
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   634
      unfolding f'.scaleR f''.scaleR f'.add f''.add f'.diff f''.diff
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   635
        scaleR_scaleR scaleR_right_diff_distrib scaleR_right_distrib
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   636
      using i by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   637
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   638
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   639
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   640
lemma frechet_derivative_unique_at:
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   641
  shows "(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
   642
  unfolding FDERIV_conv_has_derivative [symmetric]
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   643
  by (rule FDERIV_unique)
41829
455cbcbba8c2 add name continuous_isCont to unnamed lemma
hoelzl
parents: 40702
diff changeset
   644
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   645
lemma continuous_isCont: "isCont f x = continuous (at x) f"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   646
  unfolding isCont_def LIM_def
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   647
  unfolding continuous_at Lim_at unfolding dist_nz by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   648
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   649
lemma frechet_derivative_unique_within_closed_interval:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   650
  fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   651
  assumes "\<forall>i<DIM('a). a$$i < b$$i" "x \<in> {a..b}" (is "x\<in>?I")
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   652
  assumes "(f has_derivative f' ) (at x within {a..b})"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   653
  assumes "(f has_derivative f'') (at x within {a..b})"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   654
  shows "f' = f''"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   655
  apply(rule frechet_derivative_unique_within)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   656
  apply(rule assms(3,4))+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   657
proof(rule,rule,rule,rule)
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
  fix e::real and i assume "e>0" and i:"i<DIM('a)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   659
  thus "\<exists>d. 0 < \<bar>d\<bar> \<and> \<bar>d\<bar> < e \<and> x + d *\<^sub>R basis i \<in> {a..b}"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   660
  proof(cases "x$$i=a$$i")
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   661
    case True thus ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   662
      apply(rule_tac x="(min (b$$i - a$$i)  e) / 2" in exI)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   663
      using assms(1)[THEN spec[where x=i]] and `e>0` and assms(2)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   664
      unfolding mem_interval euclidean_simps basis_component
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   665
      using i by (auto simp add: field_simps)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   666
  next note * = assms(2)[unfolded mem_interval,THEN spec[where x=i]]
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   667
    case False moreover have "a $$ i < x $$ i" using False * by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   668
    moreover {
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   669
      have "a $$ i * 2 + min (x $$ i - a $$ i) e \<le> a$$i *2 + x$$i - a$$i"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   670
        by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   671
      also have "\<dots> = a$$i + x$$i" by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   672
      also have "\<dots> \<le> 2 * x$$i" using * by auto 
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   673
      finally have "a $$ i * 2 + min (x $$ i - a $$ i) e \<le> x $$ i * 2" by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   674
    }
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   675
    moreover have "min (x $$ i - a $$ i) e \<ge> 0" using * and `e>0` by auto
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   676
    hence "x $$ i * 2 \<le> b $$ i * 2 + min (x $$ i - a $$ i) e" using * by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   677
    ultimately show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   678
      apply(rule_tac x="- (min (x$$i - a$$i) e) / 2" in exI)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   679
      using assms(1)[THEN spec[where x=i]] and `e>0` and assms(2)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   680
      unfolding mem_interval euclidean_simps basis_component
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   681
      using i by (auto simp add: field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   682
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   683
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   684
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   685
lemma frechet_derivative_unique_within_open_interval:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   686
  fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   687
  assumes "x \<in> {a<..<b}"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   688
  assumes "(f has_derivative f' ) (at x within {a<..<b})"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   689
  assumes "(f has_derivative f'') (at x within {a<..<b})"
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   690
  shows "f' = f''"
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   691
proof -
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   692
  from assms(1) have *: "at x within {a<..<b} = at x"
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   693
    by (simp add: at_within_interior interior_open open_interval)
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   694
  from assms(2,3) [unfolded *] show "f' = f''"
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   695
    by (rule frechet_derivative_unique_at)
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   696
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   697
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   698
lemma frechet_derivative_at:
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   699
  shows "(f has_derivative f') (at x) \<Longrightarrow> (f' = frechet_derivative f (at x))"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   700
  apply(rule frechet_derivative_unique_at[of f],assumption)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   701
  unfolding frechet_derivative_works[THEN sym] using differentiable_def by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   702
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   703
lemma frechet_derivative_within_closed_interval:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   704
  fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   705
  assumes "\<forall>i<DIM('a). a$$i < b$$i" and "x \<in> {a..b}"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   706
  assumes "(f has_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
   707
  shows "frechet_derivative f (at x within {a.. b}) = f'"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   708
  apply(rule frechet_derivative_unique_within_closed_interval[where f=f]) 
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   709
  apply(rule assms(1,2))+ unfolding frechet_derivative_works[THEN sym]
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   710
  unfolding differentiable_def using assms(3) by auto 
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   711
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   712
subsection {* The traditional Rolle theorem in one dimension. *}
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   713
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   714
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
   715
  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
   716
  assumes lf: "linear f"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   717
  shows "(f x) $$ j = (\<Sum>i<DIM('a). (x$$i) * (f (basis i)$$j))" (is "?lhs = ?rhs")
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   718
proof -
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   719
  have fA: "finite {..<DIM('a)}" by simp
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   720
  have "?rhs = (\<Sum>i<DIM('a). x$$i *\<^sub>R f (basis i))$$j"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   721
    by (simp add: euclidean_simps)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   722
  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
   723
    unfolding linear_setsum_mul[OF lf fA, symmetric]
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   724
    unfolding euclidean_representation[symmetric] ..
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   725
qed
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   726
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   727
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
   728
  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
   729
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   730
lemma jacobian_works:
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   731
  "(f::('a::euclidean_space) \<Rightarrow> ('b::euclidean_space)) differentiable net \<longleftrightarrow>
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   732
   (f has_derivative (\<lambda>h. \<chi>\<chi> i.
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   733
      \<Sum>j<DIM('a). frechet_derivative f net (basis j) $$ i * h $$ j)) net"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   734
  (is "?differentiable \<longleftrightarrow> (f has_derivative (\<lambda>h. \<chi>\<chi> i. ?SUM h i)) net")
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   735
proof
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   736
  assume *: ?differentiable
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   737
  { fix h i
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   738
    have "?SUM h i = frechet_derivative f net h $$ i" using *
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   739
      by (auto intro!: setsum_cong
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   740
               simp: linear_componentwise[of _ h i] linear_frechet_derivative) }
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   741
  thus "(f has_derivative (\<lambda>h. \<chi>\<chi> i. ?SUM h i)) net"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   742
    using * by (simp add: frechet_derivative_works)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   743
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
   744
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   745
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
   746
  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
   747
  assumes k: "k < DIM('b)"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   748
    and ball: "0 < e" "((\<forall>y \<in> ball x e. (f y)$$k \<le> (f x)$$k) \<or> (\<forall>y\<in>ball x e. (f x)$$k \<le> (f y)$$k))"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   749
    and diff: "f differentiable (at x)"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   750
  shows "(\<chi>\<chi> j. frechet_derivative f (at x) (basis j) $$ k) = (0::'a)" (is "?D k = 0")
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   751
proof (rule ccontr)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   752
  assume "?D k \<noteq> 0"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   753
  then obtain j where j: "?D k $$ j \<noteq> 0" "j < DIM('a)"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   754
    unfolding euclidean_lambda_beta euclidean_eq[of _ "0::'a"] by auto
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   755
  hence *: "\<bar>?D k $$ j\<bar> / 2 > 0" by auto
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   756
  note as = diff[unfolded jacobian_works has_derivative_at_alt]
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   757
  guess e' using as[THEN conjunct2, rule_format, OF *] .. note e' = this
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   758
  guess d using real_lbound_gt_zero[OF ball(1) e'[THEN conjunct1]] .. note d = this
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   759
  { fix c assume "abs c \<le> d"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   760
    hence *:"norm (x + c *\<^sub>R basis j - x) < e'" using norm_basis[of j] d 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
   761
    let ?v = "(\<chi>\<chi> i. \<Sum>l<DIM('a). ?D i $$ l * (c *\<^sub>R basis j :: 'a) $$ l)"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   762
    have if_dist: "\<And> P a b c. a * (if P then b else c) = (if P then a * b else a * c)" by auto
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   763
    have "\<bar>(f (x + c *\<^sub>R basis j) - f x - ?v) $$ k\<bar> \<le>
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   764
        norm (f (x + c *\<^sub>R basis j) - f x - ?v)" by (rule component_le_norm)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   765
    also have "\<dots> \<le> \<bar>?D k $$ j\<bar> / 2 * \<bar>c\<bar>"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   766
      using e'[THEN conjunct2, rule_format, OF *] and norm_basis[of j] by fastsimp
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   767
    finally have "\<bar>(f (x + c *\<^sub>R basis j) - f x - ?v) $$ k\<bar> \<le> \<bar>?D k $$ j\<bar> / 2 * \<bar>c\<bar>" by simp
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   768
    hence "\<bar>f (x + c *\<^sub>R basis j) $$ k - f x $$ k - c * ?D k $$ j\<bar> \<le> \<bar>?D k $$ j\<bar> / 2 * \<bar>c\<bar>"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   769
      unfolding euclidean_simps euclidean_lambda_beta using j k
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   770
      by (simp add: if_dist setsum_cases field_simps) } note * = this
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   771
  have "x + d *\<^sub>R basis j \<in> ball x e" "x - d *\<^sub>R basis j \<in> ball x e"
36587
534418d8d494 remove redundant lemma vector_dist_norm
huffman
parents: 36581
diff changeset
   772
    unfolding mem_ball dist_norm using norm_basis[of j] d 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
   773
  hence **:"((f (x - d *\<^sub>R basis j))$$k \<le> (f x)$$k \<and> (f (x + d *\<^sub>R basis j))$$k \<le> (f x)$$k) \<or>
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   774
         ((f (x - d *\<^sub>R basis j))$$k \<ge> (f x)$$k \<and> (f (x + d *\<^sub>R basis j))$$k \<ge> (f x)$$k)" using ball by auto
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   775
  have ***: "\<And>y y1 y2 d dx::real.
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   776
    (y1\<le>y\<and>y2\<le>y) \<or> (y\<le>y1\<and>y\<le>y2) \<Longrightarrow> d < abs dx \<Longrightarrow> abs(y1 - y - - dx) \<le> d \<Longrightarrow> (abs (y2 - y - dx) \<le> d) \<Longrightarrow> False" by arith
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   777
  show False apply(rule ***[OF **, where dx="d * ?D k $$ j" and d="\<bar>?D k $$ j\<bar> / 2 * \<bar>d\<bar>"])
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   778
    using *[of "-d"] and *[of d] and d[THEN conjunct1] and j
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   779
    unfolding mult_minus_left
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   780
    unfolding abs_mult diff_minus_eq_add scaleR.minus_left
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   781
    unfolding algebra_simps by (auto intro: mult_pos_pos)
34906
bb9dad7de515 spurious proof failure
haftmann
parents: 34291
diff changeset
   782
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   783
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   784
subsection {* 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
   785
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   786
lemma differential_zero_maxmin:
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   787
  fixes f::"'a\<Colon>euclidean_space \<Rightarrow> real"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   788
  assumes "x \<in> s" "open s"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   789
  and deriv: "(f has_derivative f') (at x)"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   790
  and mono: "(\<forall>y\<in>s. f y \<le> f x) \<or> (\<forall>y\<in>s. f x \<le> f y)"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   791
  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
   792
proof -
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   793
  obtain e where e:"e>0" "ball x e \<subseteq> s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   794
    using `open s`[unfolded open_contains_ball] and `x \<in> s` 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
   795
  with differential_zero_maxmin_component[where 'b=real, of 0 e x f, simplified]
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   796
  have "(\<chi>\<chi> j. frechet_derivative f (at x) (basis j)) = (0::'a)"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   797
    unfolding differentiable_def using mono deriv by auto
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   798
  with frechet_derivative_at[OF deriv, symmetric]
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   799
  have "\<forall>i<DIM('a). f' (basis i) = 0"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   800
    by (simp add: euclidean_eq[of _ "0::'a"])
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   801
  with derivative_is_linear[OF deriv, THEN linear_componentwise, of _ 0]
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
   802
  show ?thesis 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
   803
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   804
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   805
lemma rolle: fixes f::"real\<Rightarrow>real"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   806
  assumes "a < b" and "f a = f b" and "continuous_on {a..b} f"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   807
  assumes "\<forall>x\<in>{a<..<b}. (f has_derivative f'(x)) (at x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   808
  shows "\<exists>x\<in>{a<..<b}. f' x = (\<lambda>v. 0)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   809
proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   810
  have "\<exists>x\<in>{a<..<b}. ((\<forall>y\<in>{a<..<b}. f x \<le> f y) \<or> (\<forall>y\<in>{a<..<b}. f y \<le> f x))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   811
  proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   812
    have "(a + b) / 2 \<in> {a .. b}" using assms(1) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   813
    hence *:"{a .. b}\<noteq>{}" 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
   814
    guess d using continuous_attains_sup[OF compact_interval * assms(3)] .. note d=this
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   815
    guess c using continuous_attains_inf[OF compact_interval * assms(3)] .. note c=this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   816
    show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   817
    proof(cases "d\<in>{a<..<b} \<or> c\<in>{a<..<b}")
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   818
      case True thus ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   819
        apply(erule_tac disjE) apply(rule_tac x=d in bexI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   820
        apply(rule_tac[3] x=c in bexI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   821
        using d c by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   822
    next
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   823
      def e \<equiv> "(a + b) /2"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   824
      case False hence "f d = f c" using d c assms(2) by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   825
      hence "\<And>x. x\<in>{a..b} \<Longrightarrow> f x = f d"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   826
        using c d apply- apply(erule_tac x=x in ballE)+ by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   827
      thus ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   828
        apply(rule_tac x=e in bexI) unfolding e_def using assms(1) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   829
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   830
  qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   831
  then guess x .. note x=this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   832
  hence "f' x = (\<lambda>v. 0)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   833
    apply(rule_tac differential_zero_maxmin[of x "{a<..<b}" f "f' x"])
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   834
    defer apply(rule open_interval)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   835
    apply(rule assms(4)[unfolded has_derivative_at[THEN sym],THEN bspec[where x=x]],assumption)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   836
    unfolding o_def apply(erule disjE,rule disjI2) by auto
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   837
  thus ?thesis apply(rule_tac x=x in bexI) unfolding o_def apply rule
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   838
    apply(drule_tac x=v in fun_cong) using x(1) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   839
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   840
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   841
subsection {* One-dimensional mean value theorem. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   842
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   843
lemma mvt: fixes f::"real \<Rightarrow> real"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   844
  assumes "a < b" and "continuous_on {a .. b} f"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   845
  assumes "\<forall>x\<in>{a<..<b}. (f has_derivative (f' x)) (at x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   846
  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
   847
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   848
  have "\<exists>x\<in>{a<..<b}. (\<lambda>xa. f' x xa - (f b - f a) / (b - a) * xa) = (\<lambda>v. 0)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   849
    apply(rule rolle[OF assms(1), of "\<lambda>x. f x - (f b - f a) / (b - a) * x"])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   850
    defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   851
    apply(rule continuous_on_intros assms(2) continuous_on_cmul[where 'b=real, unfolded real_scaleR_def])+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   852
  proof
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   853
    fix x assume x:"x \<in> {a<..<b}"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   854
    show "((\<lambda>x. f x - (f b - f a) / (b - a) * x) has_derivative (\<lambda>xa. f' x xa - (f b - f a) / (b - a) * xa)) (at x)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   855
      by(rule has_derivative_intros assms(3)[rule_format,OF x]
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   856
        has_derivative_cmul[where 'b=real, unfolded real_scaleR_def])+
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   857
  qed(insert assms(1), auto simp add:field_simps)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   858
  then guess x ..
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   859
  thus ?thesis apply(rule_tac x=x in bexI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   860
    apply(drule fun_cong[of _ _ "b - a"]) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   861
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   862
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   863
lemma mvt_simple:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   864
  fixes f::"real \<Rightarrow> real"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   865
  assumes "a<b" 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
   866
  shows "\<exists>x\<in>{a<..<b}. f b - f a = f' x (b - a)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   867
  apply(rule mvt)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   868
  apply(rule assms(1), rule differentiable_imp_continuous_on)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   869
  unfolding differentiable_on_def differentiable_def defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   870
proof
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   871
  fix x assume x:"x \<in> {a<..<b}" show "(f has_derivative f' x) (at x)"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   872
    unfolding has_derivative_within_open[OF x open_interval,THEN sym] 
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   873
    apply(rule has_derivative_within_subset)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   874
    apply(rule assms(2)[rule_format])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   875
    using x by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
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:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   879
  fixes f::"real \<Rightarrow> real"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   880
  assumes "a \<le> b" and "\<forall>x\<in>{a..b}. (f has_derivative f'(x)) (at x within {a..b})"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   881
  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
   882
proof (cases "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
   883
  interpret bounded_linear "f' b" using assms(2) assms(1) by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   884
  case True thus ?thesis apply(rule_tac x=a in bexI)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   885
    using assms(2)[THEN bspec[where x=a]] unfolding has_derivative_def
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   886
    unfolding True using zero by auto next
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   887
  case False thus ?thesis using mvt_simple[OF _ assms(2)] using assms(1) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   888
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   889
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   890
subsection {* A nice generalization (see Havin's proof of 5.19 from Rudin's book). *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   891
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   892
lemma mvt_general:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   893
  fixes f::"real\<Rightarrow>'a::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   894
  assumes "a<b" and "continuous_on {a..b} f"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   895
  assumes "\<forall>x\<in>{a<..<b}. (f has_derivative f'(x)) (at x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   896
  shows "\<exists>x\<in>{a<..<b}. norm(f b - f a) \<le> norm(f'(x) (b - a))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   897
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   898
  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)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   899
    apply(rule mvt) apply(rule assms(1))
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   900
    apply(rule continuous_on_inner continuous_on_intros assms(2))+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   901
    unfolding o_def apply(rule,rule has_derivative_lift_dot)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   902
    using assms(3) 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
   903
  then guess x .. note x=this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   904
  show ?thesis proof(cases "f a = f b")
36844
5f9385ecc1a7 Removed usage of normalizating locales.
hoelzl
parents: 36725
diff changeset
   905
    case False
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   906
    have "norm (f b - f a) * norm (f b - f a) = norm (f b - f a)^2"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   907
      by (simp add: power2_eq_square)
35542
8f97d8caabfd replaced \<bullet> with inner
himmelma
parents: 35290
diff changeset
   908
    also have "\<dots> = (f b - f a) \<bullet> (f b - f a)" unfolding power2_norm_eq_inner ..
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   909
    also have "\<dots> = (f b - f a) \<bullet> f' x (b - a)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   910
      using x unfolding inner_simps by (auto simp add: inner_diff_left)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   911
    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
   912
      by (rule norm_cauchy_schwarz)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   913
    finally show ?thesis using False x(1)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   914
      by (auto simp add: real_mult_left_cancel)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   915
  next
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   916
    case True thus ?thesis using assms(1)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   917
      apply (rule_tac x="(a + b) /2" in bexI) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   918
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   919
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   920
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   921
subsection {* Still more general bound theorem. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   922
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   923
lemma differentiable_bound:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   924
  fixes f::"'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   925
  assumes "convex s" and "\<forall>x\<in>s. (f has_derivative f'(x)) (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   926
  assumes "\<forall>x\<in>s. onorm(f' x) \<le> B" and x:"x\<in>s" and y:"y\<in>s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   927
  shows "norm(f x - f y) \<le> B * norm(x - y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   928
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   929
  let ?p = "\<lambda>u. x + u *\<^sub>R (y - x)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   930
  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
   931
    using assms(1)[unfolded convex_alt,rule_format,OF x y]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   932
    unfolding scaleR_left_diff_distrib scaleR_right_diff_distrib
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   933
    by (auto simp add: algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   934
  hence 1:"continuous_on {0..1} (f \<circ> ?p)" apply-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   935
    apply(rule continuous_on_intros continuous_on_vmul)+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   936
    unfolding continuous_on_eq_continuous_within
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   937
    apply(rule,rule differentiable_imp_continuous_within)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   938
    unfolding differentiable_def apply(rule_tac x="f' xa" in exI)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   939
    apply(rule has_derivative_within_subset)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   940
    apply(rule assms(2)[rule_format]) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   941
  have 2:"\<forall>u\<in>{0<..<1}. ((f \<circ> ?p) has_derivative f' (x + u *\<^sub>R (y - x)) \<circ> (\<lambda>u. 0 + u *\<^sub>R (y - x))) (at u)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   942
  proof rule
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   943
    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
   944
    let ?u = "x + u *\<^sub>R (y - x)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   945
    have "(f \<circ> ?p has_derivative (f' ?u) \<circ> (\<lambda>u. 0 + u *\<^sub>R (y - x))) (at u within {0<..<1})" 
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   946
      apply(rule diff_chain_within) apply(rule has_derivative_intros)+ 
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   947
      apply(rule has_derivative_within_subset)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   948
      apply(rule assms(2)[rule_format]) using goal1 * by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   949
    thus ?case
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   950
      unfolding has_derivative_within_open[OF goal1 open_interval] by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   951
  qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   952
  guess u using mvt_general[OF zero_less_one 1 2] .. note u = this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   953
  have **:"\<And>x y. x\<in>s \<Longrightarrow> norm (f' x y) \<le> B * norm y"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   954
  proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   955
    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
   956
    have "norm (f' x y) \<le> onorm (f' x) * norm y"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   957
      using onorm(1)[OF derivative_is_linear[OF assms(2)[rule_format,OF goal1]]] by assumption
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   958
    also have "\<dots> \<le> B * norm y"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   959
      apply(rule mult_right_mono)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   960
      using assms(3)[rule_format,OF goal1]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   961
      by(auto simp add:field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   962
    finally show ?case by simp
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   963
  qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   964
  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)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   965
    by(auto simp add:norm_minus_commute) 
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   966
  also have "\<dots> \<le> norm (f' (x + u *\<^sub>R (y - x)) (y - x))" using u by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   967
  also have "\<dots> \<le> B * norm(y - x)" apply(rule **) using * and u by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   968
  finally show ?thesis by(auto simp add:norm_minus_commute)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   969
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   970
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   971
lemma differentiable_bound_real:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   972
  fixes f::"real \<Rightarrow> real"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   973
  assumes "convex s" and "\<forall>x\<in>s. (f has_derivative f' x) (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   974
  assumes "\<forall>x\<in>s. onorm(f' x) \<le> B" and x:"x\<in>s" and y:"y\<in>s"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   975
  shows "norm(f x - f y) \<le> B * norm(x - y)"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   976
  using differentiable_bound[of s f f' B x y]
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   977
  unfolding Ball_def image_iff o_def using assms by auto
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   978
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   979
subsection {* In particular. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   980
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   981
lemma has_derivative_zero_constant:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   982
  fixes f::"real\<Rightarrow>real"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   983
  assumes "convex s" "\<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
   984
  shows "\<exists>c. \<forall>x\<in>s. f x = c"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   985
proof(cases "s={}")
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   986
  case False then obtain x where "x\<in>s" by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   987
  have "\<And>y. y\<in>s \<Longrightarrow> f x = f y" proof- case goal1
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   988
    thus ?case
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   989
      using differentiable_bound_real[OF assms(1-2), of 0 x y] and `x\<in>s`
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   990
      unfolding onorm_const by auto qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   991
  thus ?thesis apply(rule_tac x="f x" in exI) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   992
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
   993
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   994
lemma has_derivative_zero_unique: fixes f::"real\<Rightarrow>real"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   995
  assumes "convex s" and "a \<in> s" and "f a = c"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   996
  assumes "\<forall>x\<in>s. (f has_derivative (\<lambda>h. 0)) (at x within s)" and "x\<in>s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   997
  shows "f x = c"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   998
  using has_derivative_zero_constant[OF assms(1,4)] using assms(2-3,5) 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
   999
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1000
subsection {* Differentiability of inverse function (most basic form). *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1001
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1002
lemma has_derivative_inverse_basic:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1003
  fixes f::"'b::euclidean_space \<Rightarrow> 'c::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1004
  assumes "(f has_derivative f') (at (g y))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1005
  assumes "bounded_linear g'" and "g' \<circ> f' = id" and "continuous (at y) g"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1006
  assumes "open t" and "y \<in> t" and "\<forall>z\<in>t. f(g z) = z"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1007
  shows "(g has_derivative g') (at y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1008
proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1009
  interpret f': bounded_linear f'
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1010
    using assms unfolding has_derivative_def 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
  1011
  interpret g': bounded_linear g' using assms by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1012
  guess C using bounded_linear.pos_bounded[OF assms(2)] .. note C = this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1013
(*  have fgid:"\<And>x. g' (f' x) = x" using assms(3) unfolding o_def id_def apply()*)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1014
  have lem1:"\<forall>e>0. \<exists>d>0. \<forall>z. norm(z - y) < d \<longrightarrow> norm(g z - g y - g'(z - y)) \<le> e * norm(g z - g y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1015
  proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1016
    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
  1017
    have *:"e / C > 0" apply(rule divide_pos_pos) using `e>0` C by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1018
    guess d0 using assms(1)[unfolded has_derivative_at_alt,THEN conjunct2,rule_format,OF *] .. note d0=this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1019
    guess d1 using assms(4)[unfolded continuous_at Lim_at,rule_format,OF d0[THEN conjunct1]] .. note d1=this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1020
    guess d2 using assms(5)[unfolded open_dist,rule_format,OF assms(6)] .. note d2=this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1021
    guess d using real_lbound_gt_zero[OF d1[THEN conjunct1] d2[THEN conjunct1]] .. note d=this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1022
    thus ?case apply(rule_tac x=d in exI) apply rule defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1023
    proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1024
      fix z assume as:"norm (z - y) < d" hence "z\<in>t"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1025
        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
  1026
      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
  1027
        unfolding g'.diff f'.diff
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1028
        unfolding assms(3)[unfolded o_def id_def, THEN fun_cong] 
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1029
        unfolding assms(7)[rule_format,OF `z\<in>t`]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1030
        apply(subst norm_minus_cancel[THEN sym]) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1031
      also have "\<dots> \<le> norm(f (g z) - y - f' (g z - g y)) * C"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1032
        by (rule C [THEN conjunct2, rule_format])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1033
      also have "\<dots> \<le> (e / C) * norm (g z - g y) * C"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1034
        apply(rule mult_right_mono)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1035
        apply(rule d0[THEN conjunct2,rule_format,unfolded assms(7)[rule_format,OF `y\<in>t`]])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1036
        apply(cases "z=y") defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1037
        apply(rule d1[THEN conjunct2, unfolded dist_norm,rule_format])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1038
        using as d C d0 by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1039
      also have "\<dots> \<le> e * norm (g z - g y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1040
        using C by (auto simp add: field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1041
      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
  1042
        by simp
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1043
    qed auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1044
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1045
  have *:"(0::real) < 1 / 2" by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1046
  guess d using lem1[rule_format,OF *] .. note d=this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1047
  def B\<equiv>"C*2"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1048
  have "B>0" unfolding B_def using C by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1049
  have lem2:"\<forall>z. norm(z - y) < d \<longrightarrow> norm(g z - g y) \<le> B * norm(z - y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1050
  proof(rule,rule) case goal1
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1051
    have "norm (g z - g y) \<le> norm(g' (z - y)) + norm ((g z - g y) - g'(z - y))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1052
      by(rule norm_triangle_sub)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1053
    also have "\<dots> \<le> norm(g' (z - y)) + 1 / 2 * norm (g z - g y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1054
      apply(rule add_left_mono) using d and goal1 by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1055
    also have "\<dots> \<le> norm (z - y) * C + 1 / 2 * norm (g z - g y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1056
      apply(rule add_right_mono) using C by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1057
    finally show ?case unfolding B_def by(auto simp add:field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1058
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1059
  show ?thesis unfolding has_derivative_at_alt
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1060
  proof(rule,rule assms,rule,rule) 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
  1061
    hence *:"e/B >0" apply-apply(rule divide_pos_pos) using `B>0` by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1062
    guess d' using lem1[rule_format,OF *] .. note d'=this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1063
    guess k using real_lbound_gt_zero[OF d[THEN conjunct1] d'[THEN conjunct1]] .. note k=this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1064
    show ?case
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1065
      apply(rule_tac x=k in exI,rule) defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1066
    proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1067
      fix z assume as:"norm(z - y) < k"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1068
      hence "norm (g z - g y - g' (z - y)) \<le> e / B * norm(g z - g y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1069
        using d' k by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1070
      also have "\<dots> \<le> e * norm(z - y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1071
        unfolding times_divide_eq_left pos_divide_le_eq[OF `B>0`]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1072
        using lem2[THEN spec[where x=z]] using k as using `e>0`
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1073
        by (auto simp add: field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1074
      finally show "norm (g z - g y - g' (z - y)) \<le> e * norm (z - y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1075
        by simp qed(insert k, auto)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1076
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1077
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1078
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1079
subsection {* Simply rewrite that based on the domain point x. *}
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_x:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1082
  fixes f::"'b::euclidean_space \<Rightarrow> 'c::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
  1083
  assumes "(f has_derivative f') (at x)" "bounded_linear g'" "g' o f' = id"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1084
  "continuous (at (f x)) g" "g(f x) = x" "open t" "f x \<in> t" "\<forall>y\<in>t. f(g y) = y"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1085
  shows "(g has_derivative g') (at (f(x)))"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1086
  apply(rule has_derivative_inverse_basic) using assms by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1087
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1088
subsection {* This is the version in Dieudonne', assuming continuity of f and g. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1089
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1090
lemma has_derivative_inverse_dieudonne:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1091
  fixes f::"'a::euclidean_space \<Rightarrow> 'b::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
  1092
  assumes "open s" "open (f ` s)" "continuous_on s f" "continuous_on (f ` s) g" "\<forall>x\<in>s. g(f x) = x"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1093
  (**) "x\<in>s" "(f has_derivative f') (at x)"  "bounded_linear g'" "g' o f' = id"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1094
  shows "(g has_derivative g') (at (f x))"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1095
  apply(rule has_derivative_inverse_basic_x[OF assms(7-9) _ _ assms(2)])
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1096
  using assms(3-6) unfolding continuous_on_eq_continuous_at[OF assms(1)]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1097
    continuous_on_eq_continuous_at[OF assms(2)] 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
  1098
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1099
subsection {* Here's the simplest way of not assuming much about g. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1100
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1101
lemma has_derivative_inverse:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1102
  fixes f::"'a::euclidean_space \<Rightarrow> 'b::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
  1103
  assumes "compact s" "x \<in> s" "f x \<in> interior(f ` s)" "continuous_on s f"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1104
  "\<forall>y\<in>s. g(f y) = y" "(f has_derivative f') (at x)" "bounded_linear g'" "g' \<circ> f' = id"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1105
  shows "(g has_derivative g') (at (f x))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1106
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1107
  { fix y assume "y\<in>interior (f ` s)" 
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1108
    then obtain x where "x\<in>s" and *:"y = f x"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1109
      unfolding image_iff using interior_subset by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1110
    have "f (g y) = y" unfolding * and assms(5)[rule_format,OF `x\<in>s`] ..
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1111
  } note * = this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1112
  show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1113
    apply(rule has_derivative_inverse_basic_x[OF assms(6-8)])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1114
    apply(rule continuous_on_interior[OF _ assms(3)])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1115
    apply(rule continuous_on_inverse[OF assms(4,1)])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1116
    apply(rule assms(2,5) assms(5)[rule_format] open_interior assms(3))+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1117
    by(rule, rule *, assumption)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1118
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1119
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1120
subsection {* Proving surjectivity via Brouwer fixpoint theorem. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1121
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1122
lemma brouwer_surjective:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1123
  fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'n"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1124
  assumes "compact t" "convex t"  "t \<noteq> {}" "continuous_on t f"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1125
  "\<forall>x\<in>s. \<forall>y\<in>t. x + (y - f y) \<in> t" "x\<in>s"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1126
  shows "\<exists>y\<in>t. f y = x"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1127
proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1128
  have *:"\<And>x y. f y = x \<longleftrightarrow> x + (y - f y) = y"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1129
    by(auto simp add:algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1130
  show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1131
    unfolding *
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1132
    apply(rule brouwer[OF assms(1-3), of "\<lambda>y. x + (y - f y)"])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1133
    apply(rule continuous_on_intros assms)+ using assms(4-6) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1134
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1135
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1136
lemma brouwer_surjective_cball:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1137
  fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'n"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1138
  assumes "0 < e" "continuous_on (cball a e) f"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1139
  "\<forall>x\<in>s. \<forall>y\<in>cball a e. x + (y - f y) \<in> cball a e" "x\<in>s"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1140
  shows "\<exists>y\<in>cball a e. f y = x"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1141
  apply(rule brouwer_surjective)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1142
  apply(rule compact_cball convex_cball)+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1143
  unfolding cball_eq_empty 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
  1144
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1145
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
  1146
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1147
lemma sussmann_open_mapping:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1148
  fixes f::"'a::euclidean_space \<Rightarrow> 'b::ordered_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
  1149
  assumes "open s" "continuous_on s f" "x \<in> s" 
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1150
  "(f has_derivative f') (at x)" "bounded_linear g'" "f' \<circ> g' = id"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1151
  "t \<subseteq> s" "x \<in> interior t"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1152
  shows "f x \<in> interior (f ` t)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1153
proof- 
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1154
  interpret f':bounded_linear f'
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1155
    using assms unfolding has_derivative_def 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
  1156
  interpret g':bounded_linear g' using assms by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1157
  guess B using bounded_linear.pos_bounded[OF assms(5)] .. note B=this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1158
  hence *:"1/(2*B)>0" by (auto intro!: divide_pos_pos)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1159
  guess e0 using assms(4)[unfolded has_derivative_at_alt,THEN conjunct2,rule_format,OF *] .. note e0=this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1160
  guess e1 using assms(8)[unfolded mem_interior_cball] .. note e1=this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1161
  have *:"0<e0/B" "0<e1/B"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1162
    apply(rule_tac[!] divide_pos_pos) using e0 e1 B 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
  1163
  guess e using real_lbound_gt_zero[OF *] .. note e=this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1164
  have "\<forall>z\<in>cball (f x) (e/2). \<exists>y\<in>cball (f x) e. f (x + g' (y - f x)) = z"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1165
    apply(rule,rule brouwer_surjective_cball[where s="cball (f x) (e/2)"])
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1166
    prefer 3 apply(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1167
  proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1168
    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
  1169
      unfolding g'.diff
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1170
      apply(rule continuous_on_compose[of _ _ f, unfolded o_def])
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1171
      apply(rule continuous_on_intros linear_continuous_on[OF assms(5)])+
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1172
      apply(rule continuous_on_subset[OF assms(2)])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1173
      apply(rule,unfold image_iff,erule bexE)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1174
    proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1175
      fix y z 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
  1176
      have "dist x z = norm (g' (f x) - g' y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1177
        unfolding as(2) and dist_norm by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1178
      also have "\<dots> \<le> norm (f x - y) * B"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1179
        unfolding g'.diff[THEN sym] using B by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1180
      also have "\<dots> \<le> e * B"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1181
        using as(1)[unfolded mem_cball dist_norm] using B 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
  1182
      also have "\<dots> \<le> e1" using e unfolding less_divide_eq using B by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1183
      finally have "z\<in>cball x e1" unfolding mem_cball by force
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1184
      thus "z \<in> s" using e1 assms(7) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1185
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1186
  next
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1187
    fix y z assume as:"y \<in> cball (f x) (e / 2)" "z \<in> cball (f x) e"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1188
    have "norm (g' (z - f x)) \<le> norm (z - f x) * B" using B by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1189
    also have "\<dots> \<le> e * B" apply(rule mult_right_mono)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1190
      using as(2)[unfolded mem_cball dist_norm] and B
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1191
      unfolding norm_minus_commute 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
  1192
    also have "\<dots> < e0" using e and B unfolding less_divide_eq by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1193
    finally have *:"norm (x + g' (z - f x) - x) < e0" by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1194
    have **:"f x + f' (x + g' (z - f x) - x) = z"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1195
      using assms(6)[unfolded o_def id_def,THEN cong] 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
  1196
    have "norm (f x - (y + (z - f (x + g' (z - f x))))) \<le> norm (f (x + g' (z - f x)) - z) + norm (f x - y)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1197
      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
  1198
      by (auto simp add: algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1199
    also have "\<dots> \<le> 1 / (B * 2) * norm (g' (z - f x)) + norm (f x - y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1200
      using e0[THEN conjunct2,rule_format,OF *]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1201
      unfolding algebra_simps ** by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1202
    also have "\<dots> \<le> 1 / (B * 2) * norm (g' (z - f x)) + e/2"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1203
      using as(1)[unfolded mem_cball dist_norm] by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1204
    also have "\<dots> \<le> 1 / (B * 2) * B * norm (z - f x) + e/2"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1205
      using * and B by (auto simp add: 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
  1206
    also have "\<dots> \<le> 1 / 2 * norm (z - f x) + e/2" by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1207
    also have "\<dots> \<le> e/2 + e/2" apply(rule add_right_mono)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1208
      using as(2)[unfolded mem_cball dist_norm]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1209
      unfolding norm_minus_commute by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1210
    finally show "y + (z - f (x + g' (z - f x))) \<in> cball (f x) e"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1211
      unfolding mem_cball 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
  1212
  qed(insert e, auto) note lem = this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1213
  show ?thesis unfolding mem_interior apply(rule_tac x="e/2" in exI)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1214
    apply(rule,rule divide_pos_pos) prefer 3
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1215
  proof
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1216
    fix y assume "y \<in> ball (f x) (e/2)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1217
    hence *:"y\<in>cball (f x) (e/2)" 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
  1218
    guess z using lem[rule_format,OF *] .. note z=this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1219
    hence "norm (g' (z - f x)) \<le> norm (z - f x) * B"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1220
      using B by (auto simp add: field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1221
    also have "\<dots> \<le> e * B"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1222
      apply (rule mult_right_mono) using z(1)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1223
      unfolding mem_cball dist_norm norm_minus_commute using B 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
  1224
    also have "\<dots> \<le> e1"  using e B unfolding less_divide_eq by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1225
    finally have "x + g'(z - f x) \<in> t" apply-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1226
      apply(rule e1[THEN conjunct2,unfolded subset_eq,rule_format])
36587
534418d8d494 remove redundant lemma vector_dist_norm
huffman
parents: 36581
diff changeset
  1227
      unfolding mem_cball dist_norm by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1228
    thus "y \<in> f ` t" using z by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1229
  qed(insert e, auto)
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
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1232
text {* Hence the following eccentric variant of the inverse function theorem.    *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1233
(* This has no continuity assumptions, but we do need the inverse function.  *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1234
(* We could put f' o g = I but this happens to fit with the minimal linear   *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1235
(* algebra theory I've set up so far. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1236
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1237
(* 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
  1238
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1239
 lemma right_inverse_linear:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1240
   fixes f::"'a::euclidean_space => 'a"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1241
   assumes lf: "linear f" and gf: "f o g = id"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1242
   shows "linear g"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1243
 proof-
40702
cf26dd7395e4 Replace surj by abbreviation; remove surj_on.
hoelzl
parents: 39302
diff changeset
  1244
   from gf have fi: "surj f" by (auto simp add: surj_def o_def id_def) metis
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1245
   from linear_surjective_isomorphism[OF lf fi]
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1246
   obtain h:: "'a => 'a" where
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1247
     h: "linear h" "\<forall>x. h (f x) = x" "\<forall>x. f (h x) = x" by blast
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1248
   have "h = g" apply (rule ext) using gf h(2,3)
40702
cf26dd7395e4 Replace surj by abbreviation; remove surj_on.
hoelzl
parents: 39302
diff changeset
  1249
     by (simp add: o_def id_def fun_eq_iff) metis
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1250
   with h(1) show ?thesis by blast
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1251
 qed
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1252
 
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1253
lemma has_derivative_inverse_strong:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1254
  fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'n"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1255
  assumes "open s" and "x \<in> s" and "continuous_on s f"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1256
  assumes "\<forall>x\<in>s. g(f x) = x" "(f has_derivative f') (at x)" and "f' o g' = id"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1257
  shows "(g has_derivative g') (at (f x))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1258
proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1259
  have linf:"bounded_linear f'"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1260
    using assms(5) unfolding has_derivative_def by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1261
  hence ling:"bounded_linear g'"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1262
    unfolding linear_conv_bounded_linear[THEN sym]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1263
    apply- apply(rule right_inverse_linear) using assms(6) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1264
  moreover have "g' \<circ> f' = id" using assms(6) linf ling
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1265
    unfolding linear_conv_bounded_linear[THEN sym]
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1266
    using linear_inverse_left by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1267
  moreover have *:"\<forall>t\<subseteq>s. x\<in>interior t \<longrightarrow> f x \<in> interior (f ` t)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1268
    apply(rule,rule,rule,rule sussmann_open_mapping )
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1269
    apply(rule assms ling)+ by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1270
  have "continuous (at (f x)) g" unfolding continuous_at Lim_at
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1271
  proof(rule,rule)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1272
    fix e::real assume "e>0"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1273
    hence "f x \<in> interior (f ` (ball x e \<inter> s))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1274
      using *[rule_format,of "ball x e \<inter> s"] `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
  1275
      by(auto simp add: interior_open[OF open_ball] interior_open[OF assms(1)])
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1276
    then guess d unfolding mem_interior .. note d=this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1277
    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"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1278
      apply(rule_tac x=d in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1279
      apply(rule,rule d[THEN conjunct1])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1280
    proof(rule,rule) case goal1
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1281
      hence "g y \<in> g ` f ` (ball x e \<inter> s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1282
        using d[THEN conjunct2,unfolded subset_eq,THEN bspec[where x=y]]
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1283
        by(auto simp add:dist_commute)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1284
      hence "g y \<in> ball x e \<inter> s" using assms(4) by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1285
      thus "dist (g y) (g (f x)) < e"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1286
        using assms(4)[rule_format,OF `x\<in>s`]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1287
        by (auto simp add: dist_commute)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1288
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1289
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1290
  moreover have "f x \<in> interior (f ` s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1291
    apply(rule sussmann_open_mapping)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1292
    apply(rule assms ling)+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1293
    using interior_open[OF assms(1)] and `x\<in>s` by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1294
  moreover have "\<And>y. y \<in> interior (f ` s) \<Longrightarrow> f (g y) = y"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1295
  proof- case goal1
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1296
    hence "y\<in>f ` s" using interior_subset by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1297
    then guess z unfolding image_iff ..
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1298
    thus ?case using assms(4) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1299
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1300
  ultimately show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1301
    apply- apply(rule has_derivative_inverse_basic_x[OF assms(5)])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1302
    using assms by auto
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
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1305
subsection {* A rewrite based on the other domain. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1306
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1307
lemma has_derivative_inverse_strong_x:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1308
  fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'a"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1309
  assumes "open s" and "g y \<in> s" and "continuous_on s f"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1310
  assumes "\<forall>x\<in>s. g(f x) = x" "(f has_derivative f') (at (g y))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1311
  assumes "f' o g' = id" 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
  1312
  shows "(g has_derivative g') (at y)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1313
  using has_derivative_inverse_strong[OF assms(1-6)] unfolding assms(7) by simp
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1314
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1315
subsection {* On a region. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1316
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1317
lemma has_derivative_inverse_on:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1318
  fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'n"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1319
  assumes "open s" and "\<forall>x\<in>s. (f has_derivative f'(x)) (at x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1320
  assumes "\<forall>x\<in>s. g(f x) = x" and "f'(x) o g'(x) = id" 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
  1321
  shows "(g has_derivative g'(x)) (at (f x))"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1322
  apply(rule has_derivative_inverse_strong[where g'="g' x" and f=f])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1323
  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
  1324
  unfolding continuous_on_eq_continuous_at[OF assms(1)]
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1325
  apply(rule,rule differentiable_imp_continuous_at)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1326
  unfolding differentiable_def 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
  1327
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1328
text {* Invertible derivative continous at a point implies local
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1329
injectivity. It's only for this we need continuity of the derivative,
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1330
except of course if we want the fact that the inverse derivative is
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1331
also continuous. So if we know for some other reason that the inverse
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1332
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
  1333
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1334
lemma bounded_linear_sub:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1335
  "bounded_linear f \<Longrightarrow> bounded_linear g ==> bounded_linear (\<lambda>x. f x - g x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1336
  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
  1337
  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
  1338
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1339
lemma has_derivative_locally_injective:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1340
  fixes f::"'n::euclidean_space \<Rightarrow> 'm::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
  1341
  assumes "a \<in> s" "open s" "bounded_linear g'" "g' o f'(a) = id"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1342
  "\<forall>x\<in>s. (f has_derivative f'(x)) (at x)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1343
  "\<forall>e>0. \<exists>d>0. \<forall>x. dist a x < d \<longrightarrow> onorm(\<lambda>v. f' x v - f' a v) < e"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1344
  obtains t where "a \<in> t" "open t" "\<forall>x\<in>t. \<forall>x'\<in>t. (f x' = f x) \<longrightarrow> (x' = x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1345
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1346
  interpret bounded_linear g' using assms by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1347
  note f'g' = assms(4)[unfolded id_def o_def,THEN cong]
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1348
  have "g' (f' a (\<chi>\<chi> i.1)) = (\<chi>\<chi> i.1)" "(\<chi>\<chi> i.1) \<noteq> (0::'n)" defer 
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1349
    apply(subst euclidean_eq) using f'g' by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1350
  hence *:"0 < onorm g'"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1351
    unfolding onorm_pos_lt[OF assms(3)[unfolded linear_linear]] by fastsimp
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1352
  def k \<equiv> "1 / onorm g' / 2" have *:"k>0" unfolding k_def using * by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1353
  guess d1 using assms(6)[rule_format,OF *] .. note d1=this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1354
  from `open s` obtain d2 where "d2>0" "ball a d2 \<subseteq> s" using `a\<in>s` ..
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1355
  obtain d2 where "d2>0" "ball a d2 \<subseteq> s" using assms(2,1) ..
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1356
  guess d2 using assms(2)[unfolded open_contains_ball,rule_format,OF `a\<in>s`] ..
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1357
  note d2=this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1358
  guess d using real_lbound_gt_zero[OF d1[THEN conjunct1] d2[THEN conjunct1]] ..
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1359
  note d = this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1360
  show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1361
  proof
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1362
    show "a\<in>ball a d" using d by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1363
    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
  1364
    proof (intro strip)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1365
      fix x y assume as:"x\<in>ball a d" "y\<in>ball a d" "f x = f y"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1366
      def ph \<equiv> "\<lambda>w. w - g'(f w - f x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1367
      have ph':"ph = g' \<circ> (\<lambda>w. f' a w - (f w - f x))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1368
        unfolding ph_def o_def unfolding diff using f'g'
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1369
        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
  1370
      have "norm (ph x - ph y) \<le> (1/2) * norm (x - y)"
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1371
        apply(rule differentiable_bound[OF convex_ball _ _ as(1-2), where f'="\<lambda>x v. v - g'(f' x v)"])
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1372
        apply(rule_tac[!] ballI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1373
      proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1374
        fix u assume u:"u \<in> ball a d"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1375
        hence "u\<in>s" using d d2 by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1376
        have *:"(\<lambda>v. v - g' (f' u v)) = g' \<circ> (\<lambda>w. f' a w - f' u w)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1377
          unfolding o_def and diff using f'g' by auto
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1378
        show "(ph has_derivative (\<lambda>v. v - g' (f' u v))) (at u within ball a d)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1379
          unfolding ph' * apply(rule diff_chain_within) defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1380
          apply(rule bounded_linear.has_derivative[OF assms(3)])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1381
          apply(rule has_derivative_intros) defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1382
          apply(rule has_derivative_sub[where g'="\<lambda>x.0",unfolded diff_0_right])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1383
          apply(rule has_derivative_at_within)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1384
          using assms(5) and `u\<in>s` `a\<in>s`
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36334
diff changeset
  1385
          by(auto intro!: has_derivative_intros derivative_linear)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1386
        have **:"bounded_linear (\<lambda>x. f' u x - f' a x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1387
          "bounded_linear (\<lambda>x. f' a x - f' u x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1388
          apply(rule_tac[!] bounded_linear_sub)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1389
          apply(rule_tac[!] derivative_linear)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1390
          using assms(5) `u\<in>s` `a\<in>s` by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1391
        have "onorm (\<lambda>v. v - g' (f' u v)) \<le> onorm g' * onorm (\<lambda>w. f' a w - f' u w)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1392
          unfolding * apply(rule onorm_compose)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1393
          unfolding linear_conv_bounded_linear by(rule assms(3) **)+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1394
        also have "\<dots> \<le> onorm g' * k"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1395
          apply(rule mult_left_mono) 
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1396
          using d1[THEN conjunct2,rule_format,of u]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1397
          using onorm_neg[OF **(1)[unfolded linear_linear]]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1398
          using d and u and onorm_pos_le[OF assms(3)[unfolded linear_linear]]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1399
          by (auto simp add: algebra_simps)
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1400
        also have "\<dots> \<le> 1/2" unfolding k_def by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1401
        finally show "onorm (\<lambda>v. v - g' (f' u v)) \<le> 1 / 2" by assumption
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1402
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1403
      moreover have "norm (ph y - ph x) = norm (y - x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1404
        apply(rule arg_cong[where f=norm])
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1405
        unfolding ph_def using diff unfolding as by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1406
      ultimately show "x = y" unfolding norm_minus_commute by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1407
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1408
  qed auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1409
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1410
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1411
subsection {* Uniformly convergent sequence of derivatives. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1412
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1413
lemma has_derivative_sequence_lipschitz_lemma:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1414
  fixes f::"nat \<Rightarrow> 'm::euclidean_space \<Rightarrow> 'n::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1415
  assumes "convex s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1416
  assumes "\<forall>n. \<forall>x\<in>s. ((f n) has_derivative (f' n x)) (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1417
  assumes "\<forall>n\<ge>N. \<forall>x\<in>s. \<forall>h. norm(f' n x h - g' x h) \<le> e * norm(h)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1418
  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)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1419
proof (default)+
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1420
  fix m n x y assume as:"N\<le>m" "N\<le>n" "x\<in>s" "y\<in>s"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1421
  show "norm((f m x - f n x) - (f m y - f n y)) \<le> 2 * e * norm(x - y)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1422
    apply(rule differentiable_bound[where f'="\<lambda>x h. f' m x h - f' n x h", OF assms(1) _ _ as(3-4)])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1423
    apply(rule_tac[!] ballI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1424
  proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1425
    fix x assume "x\<in>s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1426
    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)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1427
      by(rule has_derivative_intros assms(2)[rule_format] `x\<in>s`)+
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1428
    { fix h
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1429
      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
  1430
        using norm_triangle_ineq[of "f' m x h - g' x h" "- f' n x h + g' x h"]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1431
        unfolding norm_minus_commute by (auto simp add: algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1432
      also have "\<dots> \<le> e * norm h+ e * norm h"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1433
        using assms(3)[rule_format,OF `N\<le>m` `x\<in>s`, of h]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1434
        using assms(3)[rule_format,OF `N\<le>n` `x\<in>s`, of h]
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1435
        by(auto simp add: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
  1436
      finally have "norm (f' m x h - f' n x h) \<le> 2 * e * norm h" by auto }
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1437
    thus "onorm (\<lambda>h. f' m x h - f' n x h) \<le> 2 * e"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1438
      apply-apply(rule onorm(2)) apply(rule linear_compose_sub)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1439
      unfolding linear_conv_bounded_linear
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1440
      using assms(2)[rule_format,OF `x\<in>s`, THEN derivative_linear]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1441
      by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1442
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1443
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1444
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1445
lemma has_derivative_sequence_lipschitz:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1446
  fixes f::"nat \<Rightarrow> 'm::euclidean_space \<Rightarrow> 'n::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1447
  assumes "convex s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1448
  assumes "\<forall>n. \<forall>x\<in>s. ((f n) has_derivative (f' n x)) (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1449
  assumes "\<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)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1450
  assumes "0 < e"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1451
  shows "\<forall>e>0. \<exists>N. \<forall>m\<ge>N. \<forall>n\<ge>N. \<forall>x\<in>s. \<forall>y\<in>s. norm((f m x - f n x) - (f m y - f n y)) \<le> e * norm(x - y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1452
proof(rule,rule)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1453
  case goal1 have *:"2 * (1/2* e) = e" "1/2 * e >0" using `e>0` by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1454
  guess N using assms(3)[rule_format,OF *(2)] ..
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1455
  thus ?case
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1456
    apply(rule_tac x=N in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1457
    apply(rule has_derivative_sequence_lipschitz_lemma[where e="1/2 *e", unfolded *])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1458
    using assms by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1459
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1460
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1461
lemma has_derivative_sequence:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1462
  fixes f::"nat\<Rightarrow> 'm::euclidean_space \<Rightarrow> 'n::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1463
  assumes "convex s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1464
  assumes "\<forall>n. \<forall>x\<in>s. ((f n) has_derivative (f' n x)) (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1465
  assumes "\<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)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1466
  assumes "x0 \<in> s" and "((\<lambda>n. f n x0) ---> l) sequentially"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1467
  shows "\<exists>g. \<forall>x\<in>s. ((\<lambda>n. f n x) ---> g x) sequentially \<and>
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1468
    (g has_derivative g'(x)) (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1469
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1470
  have lem1:"\<forall>e>0. \<exists>N. \<forall>m\<ge>N. \<forall>n\<ge>N. \<forall>x\<in>s. \<forall>y\<in>s. norm((f m x - f n x) - (f m y - f n y)) \<le> e * norm(x - y)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1471
    apply(rule has_derivative_sequence_lipschitz[where e="42::nat"])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1472
    apply(rule assms)+ by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1473
  have "\<exists>g. \<forall>x\<in>s. ((\<lambda>n. f n x) ---> g x) sequentially"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1474
    apply(rule bchoice) unfolding convergent_eq_cauchy
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1475
  proof
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1476
    fix x assume "x\<in>s" show "Cauchy (\<lambda>n. f n x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1477
    proof(cases "x=x0")
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1478
      case True thus ?thesis using convergent_imp_cauchy[OF assms(5)] by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1479
    next
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1480
      case False show ?thesis unfolding Cauchy_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1481
      proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1482
        fix e::real assume "e>0"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1483
        hence *:"e/2>0" "e/2/norm(x-x0)>0"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1484
          using False by (auto intro!: divide_pos_pos)
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1485
        guess M using convergent_imp_cauchy[OF assms(5), unfolded Cauchy_def, rule_format,OF *(1)] .. note M=this
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1486
        guess N using lem1[rule_format,OF *(2)] .. note N = this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1487
        show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (f m x) (f n x) < e"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1488
          apply(rule_tac x="max M N" in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1489
        proof(default+)
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1490
          fix m n assume as:"max M N \<le>m" "max M N\<le>n"
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1491
          have "dist (f m x) (f n x) \<le> norm (f m x0 - f n x0) + norm (f m x - f n x - (f m x0 - f n x0))"
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1492
            unfolding dist_norm by(rule norm_triangle_sub)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1493
          also have "\<dots> \<le> norm (f m x0 - f n x0) + e / 2"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1494
            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
  1495
            by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1496
          also have "\<dots> < e / 2 + e / 2"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1497
            apply(rule add_strict_right_mono)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1498
            using as and M[rule_format] unfolding dist_norm by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1499
          finally show "dist (f m x) (f n x) < e" by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1500
        qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1501
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1502
    qed
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
  then guess g .. note g = this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1505
  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)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1506
  proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1507
    fix e::real assume *:"e>0"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1508
    guess N using lem1[rule_format,OF *] .. note N=this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1509
    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)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1510
      apply(rule_tac x=N in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1511
    proof(default+)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1512
      fix n x y assume as:"N \<le> n" "x \<in> s" "y \<in> s"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1513
      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
  1514
        unfolding eventually_sequentially
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1515
        apply(rule_tac x=N in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1516
      proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1517
        fix m assume "N\<le>m"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1518
        thus "norm (f n x - f n y - (f m x - f m y)) \<le> e * norm (x - y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1519
          using N[rule_format, of n m x y] and as
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1520
          by (auto simp add: algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1521
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1522
      thus "norm (f n x - f n y - (g x - g y)) \<le> e * norm (x - y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1523
        apply-
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1524
        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)"])
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1525
        apply(rule Lim_sub Lim_const g[rule_format] as)+ by assumption
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1526
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1527
  qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1528
  show ?thesis unfolding has_derivative_within_alt apply(rule_tac x=g in exI)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1529
    apply(rule,rule,rule g[rule_format],assumption)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1530
  proof fix x assume "x\<in>s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1531
    have lem3:"\<forall>u. ((\<lambda>n. f' n x u) ---> g' x u) sequentially"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1532
      unfolding Lim_sequentially
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1533
    proof(rule,rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1534
      fix u and e::real assume "e>0"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1535
      show "\<exists>N. \<forall>n\<ge>N. dist (f' n x u) (g' x u) < e"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1536
      proof(cases "u=0")
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1537
        case True guess N using assms(3)[rule_format,OF `e>0`] .. note N=this
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1538
        show ?thesis apply(rule_tac x=N in exI) unfolding True 
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1539
          using N[rule_format,OF _ `x\<in>s`,of _ 0] and `e>0` by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1540
      next
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1541
        case False hence *:"e / 2 / norm u > 0"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1542
          using `e>0` by (auto intro!: divide_pos_pos)
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1543
        guess N using assms(3)[rule_format,OF *] .. note N=this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1544
        show ?thesis apply(rule_tac x=N in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1545
        proof(rule,rule) case goal1
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1546
          show ?case unfolding dist_norm
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1547
            using N[rule_format,OF goal1 `x\<in>s`, of u] False `e>0`
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1548
            by (auto simp add:field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1549
        qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1550
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1551
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1552
    show "bounded_linear (g' x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1553
      unfolding linear_linear linear_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1554
      apply(rule,rule,rule) defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1555
    proof(rule,rule)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1556
      fix x' y z::"'m" and 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
  1557
      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
  1558
      show "g' x (c *\<^sub>R x') = c *\<^sub>R g' x x'"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1559
        apply(rule tendsto_unique[OF trivial_limit_sequentially])
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1560
        apply(rule lem3[rule_format])
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1561
        unfolding lin[unfolded bounded_linear_def bounded_linear_axioms_def,THEN conjunct2,THEN conjunct1,rule_format]
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1562
        apply(rule Lim_cmul) by(rule lem3[rule_format])
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1563
      show "g' x (y + z) = g' x y + g' x z"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1564
        apply(rule tendsto_unique[OF trivial_limit_sequentially])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1565
        apply(rule lem3[rule_format])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1566
        unfolding lin[unfolded bounded_linear_def additive_def,THEN conjunct1,rule_format]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1567
        apply(rule Lim_add) by(rule lem3[rule_format])+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1568
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1569
    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)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1570
    proof(rule,rule) case goal1
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1571
      have *:"e/3>0" using goal1 by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1572
      guess N1 using assms(3)[rule_format,OF *] .. note N1=this
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1573
      guess N2 using lem2[rule_format,OF *] .. note N2=this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1574
      guess d1 using assms(2)[unfolded has_derivative_within_alt, rule_format,OF `x\<in>s`, of "max N1 N2",THEN conjunct2,rule_format,OF *] .. note d1=this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1575
      show ?case apply(rule_tac x=d1 in exI) apply(rule,rule d1[THEN conjunct1])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1576
      proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1577
        fix y assume as:"y \<in> s" "norm (y - x) < d1"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1578
        let ?N ="max N1 N2"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1579
        have "norm (g y - g x - (f ?N y - f ?N x)) \<le> e /3 * norm (y - x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1580
          apply(subst norm_minus_cancel[THEN sym])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1581
          using N2[rule_format, OF _ `y\<in>s` `x\<in>s`, of ?N] by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1582
        moreover
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1583
        have "norm (f ?N y - f ?N x - f' ?N x (y - x)) \<le> e / 3 * norm (y - x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1584
          using d1 and as by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1585
        ultimately
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1586
        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
  1587
          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)"]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1588
          by (auto simp add:algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1589
        moreover
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1590
        have " norm (f' ?N x (y - x) - g' x (y - x)) \<le> e / 3 * norm (y - x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1591
          using N1 `x\<in>s` by auto
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1592
        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
  1593
          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)"]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1594
          by(auto simp add:algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1595
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1596
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1597
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1598
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1599
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1600
subsection {* Can choose to line up antiderivatives if we want. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1601
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1602
lemma has_antiderivative_sequence:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1603
  fixes f::"nat\<Rightarrow> 'm::euclidean_space \<Rightarrow> 'n::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1604
  assumes "convex s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1605
  assumes "\<forall>n. \<forall>x\<in>s. ((f n) has_derivative (f' n x)) (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1606
  assumes "\<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"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1607
  shows "\<exists>g. \<forall>x\<in>s. (g has_derivative g'(x)) (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1608
proof(cases "s={}")
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1609
  case False then obtain a where "a\<in>s" by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1610
  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" by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1611
  show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1612
    apply(rule *)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1613
    apply(rule has_derivative_sequence[OF assms(1) _ assms(3), of "\<lambda>n x. f n x + (f 0 a - f n a)"])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1614
    apply(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1615
    apply(rule has_derivative_add_const, rule assms(2)[rule_format], assumption)  
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1616
    apply(rule `a\<in>s`) by(auto intro!: Lim_const)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1617
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
  1618
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1619
lemma has_antiderivative_limit:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1620
  fixes g'::"'m::euclidean_space \<Rightarrow> 'm \<Rightarrow> 'n::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1621
  assumes "convex s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1622
  assumes "\<forall>e>0. \<exists>f f'. \<forall>x\<in>s. (f has_derivative (f' x)) (at x within s) \<and> (\<forall>h. norm(f' x h - g' x h) \<le> e * norm(h))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1623
  shows "\<exists>g. \<forall>x\<in>s. (g has_derivative g'(x)) (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1624
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1625
  have *:"\<forall>n. \<exists>f f'. \<forall>x\<in>s. (f has_derivative (f' x)) (at x within s) \<and> (\<forall>h. norm(f' x h - g' x h) \<le> inverse (real (Suc n)) * norm(h))"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1626
    apply(rule) using assms(2)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1627
    apply(erule_tac x="inverse (real (Suc n))" in allE) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1628
  guess f using *[THEN choice] .. note * = this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1629
  guess f' using *[THEN choice] .. note f=this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1630
  show ?thesis apply(rule has_antiderivative_sequence[OF assms(1), of f f']) defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1631
  proof(rule,rule)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1632
    fix e::real assume "0<e" guess  N using reals_Archimedean[OF `e>0`] .. note N=this 
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1633
    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"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1634
      apply(rule_tac x=N in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1635
    proof(default+)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1636
      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
  1637
      have *:"inverse (real (Suc n)) \<le> e" apply(rule order_trans[OF _ N[THEN less_imp_le]])
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1638
        using goal1(1) by(auto simp add:field_simps) 
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1639
      show ?case
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1640
        using f[rule_format,THEN conjunct2,OF goal1(2), of n, THEN spec[where x=h]] 
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1641
        apply(rule order_trans) using N * apply(cases "h=0") by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1642
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1643
  qed(insert f,auto)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1644
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1645
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1646
subsection {* Differentiation of a series. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1647
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1648
definition sums_seq :: "(nat \<Rightarrow> 'a::real_normed_vector) \<Rightarrow> 'a \<Rightarrow> (nat set) \<Rightarrow> bool"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1649
(infixl "sums'_seq" 12) where "(f sums_seq l) s \<equiv> ((\<lambda>n. setsum f (s \<inter> {0..n})) ---> l) sequentially"
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
lemma has_derivative_series:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1652
  fixes f::"nat \<Rightarrow> 'm::euclidean_space \<Rightarrow> 'n::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1653
  assumes "convex s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1654
  assumes "\<forall>n. \<forall>x\<in>s. ((f n) has_derivative (f' n x)) (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1655
  assumes "\<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)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1656
  assumes "x\<in>s" and "((\<lambda>n. f n x) sums_seq l) k"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1657
  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
  1658
  unfolding sums_seq_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1659
  apply(rule has_derivative_sequence[OF assms(1) _ assms(3)])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1660
  apply(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1661
  apply(rule has_derivative_setsum) defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1662
  apply(rule,rule assms(2)[rule_format],assumption)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1663
  using assms(4-5) unfolding sums_seq_def by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1664
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1665
subsection {* Derivative with composed bilinear function. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1666
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
  1667
lemma has_derivative_bilinear_within:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1668
  assumes "(f has_derivative f') (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1669
  assumes "(g has_derivative g') (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1670
  assumes "bounded_bilinear h"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1671
  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)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1672
proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1673
  have "(g ---> g x) (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1674
    apply(rule differentiable_imp_continuous_within[unfolded continuous_within])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1675
    using assms(2) unfolding differentiable_def by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1676
  moreover
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1677
  interpret f':bounded_linear f'
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1678
    using assms unfolding has_derivative_def by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1679
  interpret g':bounded_linear g'
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1680
    using assms unfolding has_derivative_def by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1681
  interpret h:bounded_bilinear h
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1682
    using assms by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1683
  have "((\<lambda>y. f' (y - x)) ---> 0) (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1684
    unfolding f'.zero[THEN sym]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1685
    apply(rule Lim_linear[of "\<lambda>y. y - x" 0 "at x within s" f'])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1686
    using Lim_sub[OF Lim_within_id Lim_const, of x x s]
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1687
    unfolding id_def using assms(1) unfolding has_derivative_def by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1688
  hence "((\<lambda>y. f x + f' (y - x)) ---> f x) (at x within s)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1689
    using Lim_add[OF Lim_const, of "\<lambda>y. f' (y - x)" 0 "at x within s" "f x"]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1690
    by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1691
  ultimately
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1692
  have *:"((\<lambda>x'. h (f x + f' (x' - x)) ((1/(norm (x' - x))) *\<^sub>R (g x' - (g x + g' (x' - x))))
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1693
             + h ((1/ (norm (x' - x))) *\<^sub>R (f x' - (f x + f' (x' - x)))) (g x')) ---> h (f x) 0 + h 0 (g x)) (at x within s)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1694
    apply-apply(rule Lim_add) apply(rule_tac[!] Lim_bilinear[OF _ _ assms(3)])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1695
    using assms(1-2)  unfolding has_derivative_within 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
  1696
  guess B using bounded_bilinear.pos_bounded[OF assms(3)] .. note B=this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1697
  guess C using f'.pos_bounded .. note C=this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1698
  guess D using g'.pos_bounded .. note D=this
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1699
  have bcd:"B * C * D > 0" using B C D by (auto intro!: mult_pos_pos)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1700
  have **:"((\<lambda>y. (1/(norm(y - x))) *\<^sub>R (h (f'(y - x)) (g'(y - x)))) ---> 0) (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1701
    unfolding Lim_within
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1702
  proof(rule,rule) 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
  1703
    hence "e/(B*C*D)>0" using B C D by(auto intro!:divide_pos_pos mult_pos_pos)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1704
    thus ?case apply(rule_tac x="e/(B*C*D)" in exI,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1705
    proof(rule,rule,erule conjE)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1706
      fix y assume as:"y \<in> s" "0 < dist y x" "dist y x < e / (B * C * D)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1707
      have "norm (h (f' (y - x)) (g' (y - x))) \<le> norm (f' (y - x)) * norm (g' (y - x)) * B" using B by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1708
      also have "\<dots> \<le> (norm (y - x) * C) * (D * norm (y - x)) * B"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1709
        apply(rule mult_right_mono)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1710
        apply(rule mult_mono) using B C D
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1711
        by (auto simp add: field_simps intro!:mult_nonneg_nonneg)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1712
      also have "\<dots> = (B * C * D * norm (y - x)) * norm (y - x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1713
        by (auto simp add: field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1714
      also have "\<dots> < e * norm (y - x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1715
        apply(rule mult_strict_right_mono)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1716
        using as(3)[unfolded dist_norm] and as(2)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1717
        unfolding pos_less_divide_eq[OF bcd] by (auto simp add: 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
  1718
      finally show "dist ((1 / norm (y - x)) *\<^sub>R h (f' (y - x)) (g' (y - x))) 0 < e"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1719
        unfolding dist_norm apply-apply(cases "y = x")
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1720
        by(auto simp add: field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1721
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1722
  qed
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
  1723
  have "bounded_linear (\<lambda>d. h (f x) (g' d) + h (f' d) (g x))"
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
  1724
    apply (rule bounded_linear_add)
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
  1725
    apply (rule bounded_linear_compose [OF h.bounded_linear_right `bounded_linear g'`])
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
  1726
    apply (rule bounded_linear_compose [OF h.bounded_linear_left `bounded_linear f'`])
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
  1727
    done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1728
  thus ?thesis using Lim_add[OF * **] unfolding has_derivative_within 
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1729
    unfolding g'.add f'.scaleR f'.add g'.scaleR f'.diff g'.diff
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1730
     h.add_right h.add_left scaleR_right_distrib h.scaleR_left h.scaleR_right h.diff_right h.diff_left
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1731
    scaleR_right_diff_distrib h.zero_right h.zero_left
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1732
    by(auto simp add:field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1733
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1734
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
  1735
lemma has_derivative_bilinear_at:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1736
  assumes "(f has_derivative f') (at x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1737
  assumes "(g has_derivative g') (at x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1738
  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
  1739
  shows "((\<lambda>x. h (f x) (g x)) has_derivative (\<lambda>d. h (f x) (g' d) + h (f' d) (g x))) (at x)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1740
  using has_derivative_bilinear_within[of f f' x UNIV g g' h]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1741
  unfolding within_UNIV 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
  1742
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1743
subsection {* 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
  1744
44081
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 43338
diff changeset
  1745
definition has_vector_derivative :: "(real \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'b \<Rightarrow> (real filter \<Rightarrow> bool)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1746
(infixl "has'_vector'_derivative" 12) where
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1747
 "(f has_vector_derivative f') net \<equiv> (f has_derivative (\<lambda>x. x *\<^sub>R f')) net"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1748
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1749
definition "vector_derivative f net \<equiv> (SOME f'. (f has_vector_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
  1750
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1751
lemma vector_derivative_works:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1752
  fixes f::"real \<Rightarrow> 'a::real_normed_vector"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1753
  shows "f differentiable net \<longleftrightarrow> (f has_vector_derivative (vector_derivative f net)) net" (is "?l = ?r")
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1754
proof
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1755
  assume ?l guess f' using `?l`[unfolded differentiable_def] .. note f' = this
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1756
  then interpret bounded_linear f' by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1757
  thus ?r unfolding vector_derivative_def has_vector_derivative_def
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1758
    apply-apply(rule someI_ex,rule_tac x="f' 1" in exI)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1759
    using f' unfolding scaleR[THEN sym] by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1760
next
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1761
  assume ?r thus ?l
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1762
    unfolding vector_derivative_def has_vector_derivative_def differentiable_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1763
    by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1764
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1765
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1766
lemma vector_derivative_unique_at:
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1767
  assumes "(f has_vector_derivative f') (at x)"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1768
  assumes "(f has_vector_derivative f'') (at x)"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1769
  shows "f' = f''"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1770
proof-
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1771
  have "(\<lambda>x. x *\<^sub>R f') = (\<lambda>x. x *\<^sub>R f'')"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1772
    using assms [unfolded has_vector_derivative_def]
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1773
    by (rule frechet_derivative_unique_at)
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
  1774
  thus ?thesis unfolding fun_eq_iff by auto
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1775
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1776
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1777
lemma vector_derivative_unique_within_closed_interval:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1778
  fixes f::"real \<Rightarrow> 'n::ordered_euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1779
  assumes "a < b" and "x \<in> {a..b}"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1780
  assumes "(f has_vector_derivative f') (at x within {a..b})"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1781
  assumes "(f has_vector_derivative f'') (at x within {a..b})"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1782
  shows "f' = f''"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1783
proof-
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1784
  have *:"(\<lambda>x. x *\<^sub>R f') = (\<lambda>x. x *\<^sub>R f'')"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1785
    apply(rule frechet_derivative_unique_within_closed_interval[of "a" "b"])
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1786
    using assms(3-)[unfolded has_vector_derivative_def] using assms(1-2)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1787
    by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1788
  show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1789
  proof(rule ccontr)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1790
    assume "f' \<noteq> f''"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1791
    moreover
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1792
    hence "(\<lambda>x. x *\<^sub>R f') 1 = (\<lambda>x. x *\<^sub>R f'') 1"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1793
      using * by (auto simp: fun_eq_iff)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1794
    ultimately show False unfolding o_def by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1795
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1796
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1797
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1798
lemma vector_derivative_at:
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1799
  shows "(f has_vector_derivative f') (at x) \<Longrightarrow> vector_derivative f (at x) = f'"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1800
  apply(rule vector_derivative_unique_at) defer apply assumption
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1801
  unfolding vector_derivative_works[THEN sym] differentiable_def
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1802
  unfolding has_vector_derivative_def by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1803
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1804
lemma vector_derivative_within_closed_interval:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1805
  fixes f::"real \<Rightarrow> 'a::ordered_euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1806
  assumes "a < b" and "x \<in> {a..b}"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1807
  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
  1808
  shows "vector_derivative f (at x within {a..b}) = f'"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1809
  apply(rule vector_derivative_unique_within_closed_interval)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1810
  using vector_derivative_works[unfolded differentiable_def]
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1811
  using assms by(auto simp add:has_vector_derivative_def)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1812
34981
475aef44d5fb Removed explicit type annotations
himmelma
parents: 34964
diff changeset
  1813
lemma has_vector_derivative_within_subset: 
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1814
 "(f has_vector_derivative f') (at x within s) \<Longrightarrow> t \<subseteq> s \<Longrightarrow> (f has_vector_derivative f') (at x within t)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1815
  unfolding has_vector_derivative_def apply(rule has_derivative_within_subset) by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1816
34981
475aef44d5fb Removed explicit type annotations
himmelma
parents: 34964
diff changeset
  1817
lemma has_vector_derivative_const: 
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1818
 "((\<lambda>x. c) has_vector_derivative 0) net"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1819
  unfolding has_vector_derivative_def using has_derivative_const by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1820
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1821
lemma has_vector_derivative_id: "((\<lambda>x::real. x) has_vector_derivative 1) net"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1822
  unfolding has_vector_derivative_def using has_derivative_id by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1823
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1824
lemma has_vector_derivative_cmul:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1825
  "(f has_vector_derivative f') net \<Longrightarrow> ((\<lambda>x. c *\<^sub>R f x) has_vector_derivative (c *\<^sub>R f')) net"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1826
  unfolding has_vector_derivative_def apply(drule has_derivative_cmul)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1827
  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
  1828
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1829
lemma has_vector_derivative_cmul_eq:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1830
  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
  1831
  shows "(((\<lambda>x. c *\<^sub>R f x) has_vector_derivative (c *\<^sub>R f')) net \<longleftrightarrow> (f has_vector_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
  1832
  apply rule apply(drule has_vector_derivative_cmul[where c="1/c"]) defer
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1833
  apply(rule has_vector_derivative_cmul) using assms by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1834
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1835
lemma has_vector_derivative_neg:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1836
  "(f has_vector_derivative f') net \<Longrightarrow> ((\<lambda>x. -(f x)) 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
  1837
  unfolding has_vector_derivative_def apply(drule has_derivative_neg) by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1838
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1839
lemma has_vector_derivative_add:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1840
  assumes "(f has_vector_derivative f') net"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1841
  assumes "(g has_vector_derivative 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
  1842
  shows "((\<lambda>x. f(x) + g(x)) has_vector_derivative (f' + g')) net"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1843
  using has_derivative_add[OF assms[unfolded has_vector_derivative_def]]
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1844
  unfolding has_vector_derivative_def unfolding scaleR_right_distrib by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1845
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1846
lemma has_vector_derivative_sub:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1847
  assumes "(f has_vector_derivative f') net"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1848
  assumes "(g has_vector_derivative 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
  1849
  shows "((\<lambda>x. f(x) - g(x)) has_vector_derivative (f' - g')) net"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1850
  using has_derivative_sub[OF assms[unfolded has_vector_derivative_def]]
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1851
  unfolding has_vector_derivative_def scaleR_right_diff_distrib by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1852
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
  1853
lemma has_vector_derivative_bilinear_within:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1854
  assumes "(f has_vector_derivative f') (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1855
  assumes "(g has_vector_derivative g') (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1856
  assumes "bounded_bilinear h"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1857
  shows "((\<lambda>x. h (f x) (g x)) has_vector_derivative (h (f x) g' + h f' (g x))) (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1858
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1859
  interpret bounded_bilinear h using assms 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
  1860
  show ?thesis using has_derivative_bilinear_within[OF assms(1-2)[unfolded has_vector_derivative_def], of h]
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1861
    unfolding o_def has_vector_derivative_def
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1862
    using assms(3) unfolding scaleR_right scaleR_left scaleR_right_distrib
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1863
    by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1864
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1865
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
  1866
lemma has_vector_derivative_bilinear_at:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1867
  assumes "(f has_vector_derivative f') (at x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1868
  assumes "(g has_vector_derivative g') (at x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1869
  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
  1870
  shows "((\<lambda>x. h (f x) (g x)) has_vector_derivative (h (f x) g' + h f' (g x))) (at x)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1871
  apply(rule has_vector_derivative_bilinear_within[where s=UNIV, unfolded within_UNIV]) using assms by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1872
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1873
lemma has_vector_derivative_at_within:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1874
  "(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
  1875
  unfolding has_vector_derivative_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1876
  by (rule has_derivative_at_within) auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1877
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1878
lemma has_vector_derivative_transform_within:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1879
  assumes "0 < d" and "x \<in> s" and "\<forall>x'\<in>s. dist x' x < d \<longrightarrow> f x' = g x'"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1880
  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
  1881
  shows "(g has_vector_derivative f') (at x within s)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1882
  using assms unfolding has_vector_derivative_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1883
  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
  1884
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1885
lemma has_vector_derivative_transform_at:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1886
  assumes "0 < d" and "\<forall>x'. dist x' x < d \<longrightarrow> f x' = g x'"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1887
  assumes "(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
  1888
  shows "(g has_vector_derivative f') (at x)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1889
  using assms unfolding has_vector_derivative_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1890
  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
  1891
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1892
lemma has_vector_derivative_transform_within_open:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1893
  assumes "open s" and "x \<in> s" and "\<forall>y\<in>s. f y = g y"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1894
  assumes "(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
  1895
  shows "(g has_vector_derivative f') (at x)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1896
  using assms unfolding has_vector_derivative_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1897
  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
  1898
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1899
lemma vector_diff_chain_at:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1900
  assumes "(f has_vector_derivative f') (at x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1901
  assumes "(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
  1902
  shows "((g \<circ> f) has_vector_derivative (f' *\<^sub>R g')) (at x)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1903
  using assms(2) unfolding has_vector_derivative_def apply-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1904
  apply(drule diff_chain_at[OF assms(1)[unfolded has_vector_derivative_def]])
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1905
  unfolding o_def scaleR.scaleR_left by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1906
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1907
lemma vector_diff_chain_within:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1908
  assumes "(f has_vector_derivative f') (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1909
  assumes "(g has_vector_derivative g') (at (f x) within f ` s)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1910
  shows "((g o f) has_vector_derivative (f' *\<^sub>R g')) (at x within s)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1911
  using assms(2) unfolding has_vector_derivative_def apply-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1912
  apply(drule diff_chain_within[OF assms(1)[unfolded has_vector_derivative_def]])
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1913
  unfolding o_def scaleR.scaleR_left by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1914
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1915
end