src/HOL/Multivariate_Analysis/Derivative.thy
author wenzelm
Sun, 18 Aug 2013 19:59:19 +0200
changeset 53077 a1b3784f8129
parent 51733 70abecafe9ac
child 53374 a14d2a854c02
permissions -rw-r--r--
more symbols;
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
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    12
lemma bounded_linear_imp_linear: "bounded_linear f \<Longrightarrow> linear f" (* TODO: move elsewhere *)
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    13
proof -
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    14
  assume "bounded_linear f"
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    15
  then interpret f: bounded_linear f .
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    16
  show "linear f"
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    17
    by (simp add: f.add f.scaleR linear_def)
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    18
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    19
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    20
lemma netlimit_at_vector: (* TODO: move *)
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    21
  fixes a :: "'a::real_normed_vector"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    22
  shows "netlimit (at a) = a"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    23
proof (cases "\<exists>x. x \<noteq> a")
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    24
  case True then obtain x where x: "x \<noteq> a" ..
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    25
  have "\<not> trivial_limit (at a)"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    26
    unfolding trivial_limit_def eventually_at dist_norm
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    27
    apply clarsimp
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    28
    apply (rule_tac x="a + scaleR (d / 2) (sgn (x - a))" in exI)
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    29
    apply (simp add: norm_sgn sgn_zero_iff x)
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    30
    done
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    31
  thus ?thesis
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51478
diff changeset
    32
    by (rule netlimit_within [of a UNIV])
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    33
qed simp
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
    34
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    35
(* Because I do not want to type this all the time *)
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    36
lemmas linear_linear = linear_conv_bounded_linear[THEN sym]
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    37
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    38
lemma derivative_linear[dest]:
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    39
  "(f has_derivative f') net \<Longrightarrow> bounded_linear f'"
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    40
  unfolding has_derivative_def by auto
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    41
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    42
lemma derivative_is_linear:
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    43
  "(f has_derivative f') net \<Longrightarrow> linear f'"
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    44
  by (rule derivative_linear [THEN bounded_linear_imp_linear])
44137
ac5cb4c86448 simplify some proofs
huffman
parents: 44125
diff changeset
    45
ac5cb4c86448 simplify some proofs
huffman
parents: 44125
diff changeset
    46
lemma DERIV_conv_has_derivative:
ac5cb4c86448 simplify some proofs
huffman
parents: 44125
diff changeset
    47
  "(DERIV f x :> f') = (f has_derivative op * f') (at x)"
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    48
  using deriv_fderiv[of f x UNIV f'] by (subst (asm) mult_commute)
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    49
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    50
subsection {* Derivatives *}
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    51
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    52
subsubsection {* Combining theorems. *}
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    53
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    54
lemmas has_derivative_id = FDERIV_ident
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    55
lemmas has_derivative_const = FDERIV_const
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    56
lemmas has_derivative_neg = FDERIV_minus
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    57
lemmas has_derivative_add = FDERIV_add
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    58
lemmas has_derivative_sub = FDERIV_diff
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    59
lemmas has_derivative_setsum = FDERIV_setsum
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    60
lemmas scaleR_right_has_derivative = FDERIV_scaleR_right
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    61
lemmas scaleR_left_has_derivative = FDERIV_scaleR_left
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    62
lemmas inner_right_has_derivative = FDERIV_inner_right
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    63
lemmas inner_left_has_derivative = FDERIV_inner_left
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    64
lemmas mult_right_has_derivative = FDERIV_mult_right
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    65
lemmas mult_left_has_derivative = FDERIV_mult_left
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    66
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    67
lemma has_derivative_add_const:
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    68
  "(f has_derivative f') net \<Longrightarrow> ((\<lambda>x. f x + c) has_derivative f') net"
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    69
  by (intro FDERIV_eq_intros) auto
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    70
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    71
subsection {* Derivative with composed bilinear function. *}
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    72
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    73
lemma has_derivative_bilinear_within:
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    74
  assumes "(f has_derivative f') (at x within s)"
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    75
  assumes "(g has_derivative g') (at x within s)"
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    76
  assumes "bounded_bilinear h"
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    77
  shows "((\<lambda>x. h (f x) (g x)) has_derivative (\<lambda>d. h (f x) (g' d) + h (f' d) (g x))) (at x within s)"
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    78
  using bounded_bilinear.FDERIV[OF assms(3,1,2)] .
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    79
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    80
lemma has_derivative_bilinear_at:
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    81
  assumes "(f has_derivative f') (at x)"
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    82
  assumes "(g has_derivative g') (at x)"
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    83
  assumes "bounded_bilinear h"
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    84
  shows "((\<lambda>x. h (f x) (g x)) has_derivative (\<lambda>d. h (f x) (g' d) + h (f' d) (g x))) (at x)"
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    85
  using has_derivative_bilinear_within[of f f' x UNIV g g' h] assms by simp
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    86
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
    87
text {* These are the only cases we'll care about, probably. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    88
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    89
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
    90
         bounded_linear f' \<and> ((\<lambda>y. (1 / norm(y - x)) *\<^sub>R (f y - (f x + f' (y - x)))) ---> 0) (at x within s)"
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
    91
  unfolding has_derivative_def Lim by (auto simp add: netlimit_within inverse_eq_divide field_simps)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    92
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    93
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
    94
         bounded_linear f' \<and> ((\<lambda>y. (1 / (norm(y - x))) *\<^sub>R (f y - (f x + f' (y - x)))) ---> 0) (at x)"
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44907
diff changeset
    95
  using has_derivative_within [of f f' x UNIV] by simp
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    96
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
    97
text {* More explicit epsilon-delta forms. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    98
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    99
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
   100
  "(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
   101
        (\<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
   102
        \<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
   103
  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
   104
  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
   105
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   106
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
   107
 "(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
   108
   (\<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
   109
        \<longrightarrow> norm(f x' - f x - f'(x' - x)) / norm(x' - x) < e)"
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44907
diff changeset
   110
  using has_derivative_within' [of f f' x UNIV] by simp
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   111
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   112
lemma has_derivative_at_within: "(f has_derivative f') (at x) \<Longrightarrow> (f has_derivative f') (at x within s)"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51478
diff changeset
   113
  unfolding has_derivative_within' has_derivative_at' by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   114
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   115
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
   116
  "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
   117
  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
   118
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   119
lemma has_derivative_right:
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   120
  fixes f :: "real \<Rightarrow> real" and y :: "real"
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   121
  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
   122
    ((\<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
   123
proof -
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   124
  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
   125
    ((\<lambda>t. (f t - f x) / (t - x) - y) ---> 0) (at x within ({x<..} \<inter> I))"
44282
f0de18b62d63 remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents: 44140
diff changeset
   126
    by (intro Lim_cong_within) (auto simp add: diff_divide_distrib add_divide_distrib)
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   127
  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
   128
    by (simp add: Lim_null[symmetric])
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   129
  also have "\<dots> \<longleftrightarrow> ((\<lambda>t. (f x - f t) / (x - t)) ---> y) (at x within ({x<..} \<inter> I))"
44140
2c10c35dd4be remove several redundant and unused theorems about derivatives
huffman
parents: 44137
diff changeset
   130
    by (intro Lim_cong_within) (simp_all add: field_simps)
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   131
  finally show ?thesis
44282
f0de18b62d63 remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents: 44140
diff changeset
   132
    by (simp add: bounded_linear_mult_right has_derivative_within)
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   133
qed
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 41970
diff changeset
   134
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   135
subsubsection {* Limit transformation for derivatives *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   136
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   137
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
   138
  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
   139
  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
   140
  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
   141
  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
   142
  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
   143
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   144
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
   145
  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
   146
  shows "(g has_derivative f') (at x)"
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44907
diff changeset
   147
  using has_derivative_transform_within [of d x UNIV f g f'] assms by simp
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   148
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   149
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
   150
  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
   151
  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
   152
  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
   153
  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
   154
  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
   155
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   156
subsection {* Differentiability *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   157
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36334
diff changeset
   158
no_notation Deriv.differentiable (infixl "differentiable" 60)
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36334
diff changeset
   159
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   160
abbreviation differentiable :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a filter \<Rightarrow> bool" (infixr "differentiable" 30) where
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   161
  "f differentiable net \<equiv> isDiff net f"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   162
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   163
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
   164
  "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
   165
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   166
lemmas differentiable_def = isDiff_def
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   167
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   168
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
   169
  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
   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 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
   172
  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
   173
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   174
lemma differentiable_within_open: (* TODO: delete *)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   175
  assumes "a \<in> s" and "open s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   176
  shows "f differentiable (at a within s) \<longleftrightarrow> (f differentiable (at a))"
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   177
  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
   178
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   179
lemma differentiable_on_eq_differentiable_at:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   180
  "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
   181
  unfolding differentiable_on_def
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51478
diff changeset
   182
  by (metis at_within_interior interior_open)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   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 differentiable_transform_within:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   185
  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
   186
  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
   187
  shows "g differentiable (at x within s)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   188
  using assms(4) unfolding differentiable_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   189
  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
   190
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   191
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
   192
  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
   193
  shows "g differentiable at x"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   194
  using assms(3) unfolding differentiable_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   195
  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
   196
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   197
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
   198
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   199
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
   200
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   201
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
   202
 "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
   203
  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
   204
37648
41b7dfdc4941 generalize more euclidean_space lemmas
huffman
parents: 37606
diff changeset
   205
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
   206
  shows "f differentiable net \<Longrightarrow> linear(frechet_derivative f net)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   207
  unfolding frechet_derivative_works has_derivative_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   208
  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
   209
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   210
subsection {* Differentiability implies continuity *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   211
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   212
lemma Lim_mul_norm_within:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   213
  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
   214
  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
   215
  unfolding Lim_within apply(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   216
  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
   217
  apply(rule_tac x="min d 1" in exI) apply rule defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   218
  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
   219
  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
   220
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   221
lemma differentiable_imp_continuous_within:
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   222
  "f differentiable (at x within s) \<Longrightarrow> continuous (at x within s) f"
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   223
  by (auto simp: differentiable_def intro: FDERIV_continuous)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   224
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   225
lemma differentiable_imp_continuous_on:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   226
  "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
   227
  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
   228
  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
   229
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   230
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
   231
 "(f has_derivative f') (at x within s) \<Longrightarrow> t \<subseteq> s \<Longrightarrow> (f has_derivative f') (at x within t)"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51478
diff changeset
   232
  unfolding has_derivative_within using tendsto_within_subset by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   233
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   234
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
   235
  "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
   236
  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
   237
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   238
lemma differentiable_on_subset:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   239
  "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
   240
  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
   241
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   242
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
   243
  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
   244
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   245
text {* Several results are easier using a "multiplied-out" variant.
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   246
(I got this idea from Dieudonne's proof of the chain rule). *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   247
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   248
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
   249
 "(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
   250
  (\<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
   251
proof
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   252
  assume ?lhs thus ?rhs
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   253
    unfolding has_derivative_within apply-apply(erule conjE,rule,assumption)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   254
    unfolding Lim_within
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   255
    apply(rule,erule_tac x=e in allE,rule,erule impE,assumption)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   256
    apply(erule exE,rule_tac x=d in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   257
    apply(erule conjE,rule,assumption,rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   258
  proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   259
    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
   260
      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
   261
    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
   262
    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
   263
      case True thus ?thesis using `bounded_linear f'` by(auto simp add: zero)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   264
    next
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   265
      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
   266
        unfolding dist_norm diff_0_right using as(3)
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
   267
        using pos_divide_less_eq[OF False[unfolded dist_nz], unfolded dist_norm]
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
   268
        by (auto simp add: linear_0 linear_sub)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   269
      thus ?thesis by(auto simp add:algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   270
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   271
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   272
next
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   273
  assume ?rhs thus ?lhs unfolding has_derivative_within Lim_within
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   274
    apply-apply(erule conjE,rule,assumption)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   275
    apply(rule,erule_tac x="e/2" in allE,rule,erule impE) defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   276
    apply(erule exE,rule_tac x=d in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   277
    apply(erule conjE,rule,assumption,rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   278
    unfolding dist_norm diff_0_right norm_scaleR
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   279
    apply(erule_tac x=xa in ballE,erule impE)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   280
  proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   281
    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
   282
        "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
   283
    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
   284
      apply(rule_tac le_less_trans[of _ "e/2"])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   285
      by(auto intro!:mult_imp_div_pos_le simp add:algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   286
  qed auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   287
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   288
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   289
lemma has_derivative_at_alt:
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents: 35028
diff changeset
   290
  "(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
   291
  (\<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))"
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44907
diff changeset
   292
  using has_derivative_within_alt[where s=UNIV] by simp
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   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 {* 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
   295
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   296
lemma diff_chain_within[FDERIV_intros]:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   297
  assumes "(f has_derivative f') (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   298
  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
   299
  shows "((g o f) has_derivative (g' o f'))(at x within s)"
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   300
  using FDERIV_in_compose[OF assms] by (simp add: comp_def)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   301
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   302
lemma diff_chain_at[FDERIV_intros]:
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   303
  "(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)"
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   304
  using FDERIV_compose[of f f' x UNIV g g'] by (simp add: comp_def)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   305
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
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
   308
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   309
lemma differentiable_chain_at:
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   310
  "f differentiable (at x) \<Longrightarrow> g differentiable (at (f x)) \<Longrightarrow> (g o f) differentiable (at x)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   311
  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
   312
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   313
lemma differentiable_chain_within:
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   314
  "f differentiable (at x within s) \<Longrightarrow> g differentiable (at(f x) within (f ` s)) \<Longrightarrow> (g o 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
   315
  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
   316
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   317
subsection {* Uniqueness of derivative *}
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   318
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   319
text {*
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   320
 The general result is a bit messy because we need approachability of the
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   321
 limit point from any direction. But OK for nontrivial intervals etc.
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   322
*}
51363
d4d00c804645 changed has_derivative_intros into a named theorems collection
hoelzl
parents: 50939
diff changeset
   323
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   324
lemma frechet_derivative_unique_within:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   325
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   326
  assumes "(f has_derivative f') (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   327
  assumes "(f has_derivative f'') (at x within s)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   328
  assumes "(\<forall>i\<in>Basis. \<forall>e>0. \<exists>d. 0 < abs(d) \<and> abs(d) < e \<and> (x + d *\<^sub>R i) \<in> s)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   329
  shows "f' = f''"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   330
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   331
  note as = assms(1,2)[unfolded has_derivative_def]
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   332
  then interpret f': bounded_linear f' by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   333
  from as interpret f'': bounded_linear f'' by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   334
  have "x islimpt s" unfolding islimpt_approachable
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   335
  proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   336
    fix e::real assume "0<e" guess d
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   337
      using assms(3)[rule_format,OF SOME_Basis `e>0`] ..
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   338
    thus "\<exists>x'\<in>s. x' \<noteq> x \<and> dist x' x < e"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   339
      apply(rule_tac x="x + d *\<^sub>R (SOME i. i \<in> Basis)" in bexI)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   340
      unfolding dist_norm by (auto simp: SOME_Basis nonzero_Basis)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   341
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   342
  hence *:"netlimit (at x within s) = x" apply-apply(rule netlimit_within)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   343
    unfolding trivial_limit_within by simp
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   344
  show ?thesis  apply(rule linear_eq_stdbasis)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   345
    unfolding linear_conv_bounded_linear
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   346
    apply(rule as(1,2)[THEN conjunct1])+
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   347
  proof(rule,rule ccontr)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   348
    fix i :: 'a assume i:"i \<in> Basis" def e \<equiv> "norm (f' i - f'' i)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   349
    assume "f' i \<noteq> f'' i"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   350
    hence "e>0" unfolding e_def by auto
44125
230a8665c919 mark some redundant theorems as legacy
huffman
parents: 44124
diff changeset
   351
    guess d using tendsto_diff [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
   352
    guess c using assms(3)[rule_format,OF i d[THEN conjunct1]] .. note c=this
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   353
    have *:"norm (- ((1 / \<bar>c\<bar>) *\<^sub>R f' (c *\<^sub>R i)) + (1 / \<bar>c\<bar>) *\<^sub>R f'' (c *\<^sub>R i)) = norm ((1 / abs c) *\<^sub>R (- (f' (c *\<^sub>R i)) + f'' (c *\<^sub>R i)))"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   354
      unfolding scaleR_right_distrib by auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   355
    also have "\<dots> = norm ((1 / abs c) *\<^sub>R (c *\<^sub>R (- (f' i) + f'' i)))"  
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   356
      unfolding f'.scaleR f''.scaleR
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   357
      unfolding scaleR_right_distrib scaleR_minus_right by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   358
    also have "\<dots> = e" unfolding e_def using c[THEN conjunct1]
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   359
      using norm_minus_cancel[of "f' i - f'' i"]
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   360
      by (auto simp add: add.commute ab_diff_minus)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   361
    finally show False using c
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   362
      using d[THEN conjunct2,rule_format,of "x + c *\<^sub>R i"]
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   363
      unfolding dist_norm
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   364
      unfolding f'.scaleR f''.scaleR f'.add f''.add f'.diff f''.diff
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   365
        scaleR_scaleR scaleR_right_diff_distrib scaleR_right_distrib
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   366
      using i by (auto simp: inverse_eq_divide)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   367
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   368
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   369
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   370
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
   371
  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
   372
  by (rule FDERIV_unique)
41829
455cbcbba8c2 add name continuous_isCont to unnamed lemma
hoelzl
parents: 40702
diff changeset
   373
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   374
lemma frechet_derivative_unique_within_closed_interval:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   375
  fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   376
  assumes "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i" "x \<in> {a..b}" (is "x\<in>?I")
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   377
  assumes "(f has_derivative f' ) (at x within {a..b})"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   378
  assumes "(f has_derivative f'') (at x within {a..b})"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   379
  shows "f' = f''"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   380
  apply(rule frechet_derivative_unique_within)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   381
  apply(rule assms(3,4))+
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   382
proof(rule,rule,rule)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   383
  fix e::real and i :: 'a assume "e>0" and i:"i\<in>Basis"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   384
  thus "\<exists>d. 0 < \<bar>d\<bar> \<and> \<bar>d\<bar> < e \<and> x + d *\<^sub>R i \<in> {a..b}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   385
  proof(cases "x\<bullet>i=a\<bullet>i")
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   386
    case True thus ?thesis
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   387
      apply(rule_tac x="(min (b\<bullet>i - a\<bullet>i)  e) / 2" in exI)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   388
      using assms(1)[THEN bspec[where x=i]] and `e>0` and assms(2)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   389
      unfolding mem_interval
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   390
      using i by (auto simp add: field_simps inner_simps inner_Basis)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   391
  next 
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   392
    note * = assms(2)[unfolded mem_interval, THEN bspec, OF i]
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   393
    case False moreover have "a \<bullet> i < x \<bullet> i" using False * by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   394
    moreover {
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   395
      have "a \<bullet> i * 2 + min (x \<bullet> i - a \<bullet> i) e \<le> a\<bullet>i *2 + x\<bullet>i - a\<bullet>i"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   396
        by auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   397
      also have "\<dots> = a\<bullet>i + x\<bullet>i" by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   398
      also have "\<dots> \<le> 2 * (x\<bullet>i)" using * by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   399
      finally have "a \<bullet> i * 2 + min (x \<bullet> i - a \<bullet> i) e \<le> x \<bullet> i * 2" by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   400
    }
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   401
    moreover have "min (x \<bullet> i - a \<bullet> i) e \<ge> 0" using * and `e>0` by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   402
    hence "x \<bullet> i * 2 \<le> b \<bullet> i * 2 + min (x \<bullet> i - a \<bullet> i) e" using * by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   403
    ultimately show ?thesis
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   404
      apply(rule_tac x="- (min (x\<bullet>i - a\<bullet>i) e) / 2" in exI)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   405
      using assms(1)[THEN bspec, OF i] and `e>0` and assms(2)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   406
      unfolding mem_interval
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   407
      using i by (auto simp add: field_simps inner_simps inner_Basis)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   408
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   409
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   410
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   411
lemma frechet_derivative_unique_within_open_interval:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   412
  fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   413
  assumes "x \<in> {a<..<b}"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   414
  assumes "(f has_derivative f' ) (at x within {a<..<b})"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   415
  assumes "(f has_derivative f'') (at x within {a<..<b})"
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   416
  shows "f' = f''"
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   417
proof -
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   418
  from assms(1) have *: "at x within {a<..<b} = at x"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51478
diff changeset
   419
    by (metis at_within_interior interior_open open_interval)
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   420
  from assms(2,3) [unfolded *] show "f' = f''"
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   421
    by (rule frechet_derivative_unique_at)
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   422
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   423
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
   424
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
   425
  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
   426
  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
   427
  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
   428
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   429
lemma frechet_derivative_within_closed_interval:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   430
  fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   431
  assumes "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i" and "x \<in> {a..b}"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   432
  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
   433
  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
   434
  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
   435
  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
   436
  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
   437
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   438
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
   439
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   440
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
   441
  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
   442
  assumes lf: "linear f"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   443
  shows "(f x) \<bullet> j = (\<Sum>i\<in>Basis. (x\<bullet>i) * (f i\<bullet>j))" (is "?lhs = ?rhs")
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   444
proof -
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   445
  have fA: "finite Basis" by simp
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   446
  have "?rhs = (\<Sum>i\<in>Basis. (x\<bullet>i) *\<^sub>R (f i))\<bullet>j"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   447
    by (simp add: inner_setsum_left)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   448
  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
   449
    unfolding linear_setsum_mul[OF lf fA, symmetric]
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   450
    unfolding euclidean_representation ..
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   451
qed
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   452
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   453
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
   454
  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
   455
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   456
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
   457
  "(f::('a::euclidean_space) \<Rightarrow> ('b::euclidean_space)) differentiable net \<longleftrightarrow>
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   458
   (f has_derivative (\<lambda>h. \<Sum>i\<in>Basis.
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   459
      (\<Sum>j\<in>Basis. frechet_derivative f net (j) \<bullet> i * (h \<bullet> j)) *\<^sub>R i)) net"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   460
  (is "?differentiable \<longleftrightarrow> (f has_derivative (\<lambda>h. \<Sum>i\<in>Basis. ?SUM h i *\<^sub>R i)) net")
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   461
proof
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   462
  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
   463
  { fix h i
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   464
    have "?SUM h i = frechet_derivative f net h \<bullet> i" using *
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   465
      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
   466
               simp: linear_componentwise[of _ h i] linear_frechet_derivative) }
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   467
  with * show "(f has_derivative (\<lambda>h. \<Sum>i\<in>Basis. ?SUM h i *\<^sub>R i)) net"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   468
    by (simp add: frechet_derivative_works euclidean_representation)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   469
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
   470
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   471
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
   472
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   473
  assumes k: "k \<in> Basis"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   474
    and ball: "0 < e" "((\<forall>y \<in> ball x e. (f y)\<bullet>k \<le> (f x)\<bullet>k) \<or> (\<forall>y\<in>ball x e. (f x)\<bullet>k \<le> (f y)\<bullet>k))"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   475
    and diff: "f differentiable (at x)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   476
  shows "(\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)" (is "?D k = 0")
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   477
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
   478
  assume "?D k \<noteq> 0"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   479
  then obtain j where j: "?D k \<bullet> j \<noteq> 0" "j \<in> Basis"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   480
    unfolding euclidean_eq_iff[of _ "0::'a"] by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   481
  hence *: "\<bar>?D k \<bullet> j\<bar> / 2 > 0" 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
   482
  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
   483
  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
   484
  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
   485
  { fix c assume "abs c \<le> d"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   486
    hence *:"norm (x + c *\<^sub>R j - x) < e'" using norm_Basis[OF j(2)] d by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   487
    let ?v = "(\<Sum>i\<in>Basis. (\<Sum>l\<in>Basis. ?D i \<bullet> l * ((c *\<^sub>R j :: 'a) \<bullet> l)) *\<^sub>R i)"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   488
    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
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   489
    have "\<bar>(f (x + c *\<^sub>R j) - f x - ?v) \<bullet> k\<bar> \<le>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   490
        norm (f (x + c *\<^sub>R j) - f x - ?v)" by (rule Basis_le_norm[OF k])
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   491
    also have "\<dots> \<le> \<bar>?D k \<bullet> j\<bar> / 2 * \<bar>c\<bar>"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   492
      using e'[THEN conjunct2, rule_format, OF *] and norm_Basis[OF j(2)] j
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   493
      by simp
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   494
    finally have "\<bar>(f (x + c *\<^sub>R j) - f x - ?v) \<bullet> k\<bar> \<le> \<bar>?D k \<bullet> j\<bar> / 2 * \<bar>c\<bar>" by simp
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   495
    hence "\<bar>f (x + c *\<^sub>R j) \<bullet> k - f x \<bullet> k - c * (?D k \<bullet> j)\<bar> \<le> \<bar>?D k \<bullet> j\<bar> / 2 * \<bar>c\<bar>"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   496
      using j k
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   497
      by (simp add: inner_simps field_simps inner_Basis setsum_cases if_dist) }
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   498
  note * = this
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   499
  have "x + d *\<^sub>R j \<in> ball x e" "x - d *\<^sub>R j \<in> ball x e"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   500
    unfolding mem_ball dist_norm using norm_Basis[OF j(2)] d by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   501
  hence **:"((f (x - d *\<^sub>R j))\<bullet>k \<le> (f x)\<bullet>k \<and> (f (x + d *\<^sub>R j))\<bullet>k \<le> (f x)\<bullet>k) \<or>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   502
         ((f (x - d *\<^sub>R j))\<bullet>k \<ge> (f x)\<bullet>k \<and> (f (x + d *\<^sub>R j))\<bullet>k \<ge> (f x)\<bullet>k)" using ball 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
   503
  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
   504
    (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
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   505
  show False apply(rule ***[OF **, where dx="d * (?D k \<bullet> j)" and d="\<bar>?D k \<bullet> j\<bar> / 2 * \<bar>d\<bar>"])
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   506
    using *[of "-d"] and *[of d] and d[THEN conjunct1] and j
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   507
    unfolding mult_minus_left
44282
f0de18b62d63 remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents: 44140
diff changeset
   508
    unfolding abs_mult diff_minus_eq_add scaleR_minus_left
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   509
    unfolding algebra_simps by (auto intro: mult_pos_pos)
34906
bb9dad7de515 spurious proof failure
haftmann
parents: 34291
diff changeset
   510
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   511
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   512
text {* In particular if we have a mapping into @{typ "real"}. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   513
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   514
lemma differential_zero_maxmin:
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
   515
  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
   516
  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
   517
  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
   518
  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
   519
  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
   520
proof -
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   521
  obtain e where e:"e>0" "ball x e \<subseteq> s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   522
    using `open s`[unfolded open_contains_ball] and `x \<in> s` by auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   523
  with differential_zero_maxmin_component[where 'b=real, of 1 e x f] mono deriv
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   524
  have "(\<Sum>j\<in>Basis. frechet_derivative f (at x) j *\<^sub>R j) = (0::'a)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   525
    by (auto simp: Basis_real_def differentiable_def)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   526
  with frechet_derivative_at[OF deriv, symmetric]
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   527
  have "\<forall>i\<in>Basis. f' i = 0"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   528
    by (simp add: euclidean_eq_iff[of _ "0::'a"] inner_setsum_left_Basis)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
   529
  with derivative_is_linear[OF deriv, THEN linear_componentwise, of _ 1]
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
   530
  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
   531
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   532
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   533
lemma rolle:
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   534
  fixes f::"real\<Rightarrow>real"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   535
  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
   536
  assumes "\<forall>x\<in>{a<..<b}. (f has_derivative f'(x)) (at x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   537
  shows "\<exists>x\<in>{a<..<b}. f' x = (\<lambda>v. 0)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   538
proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   539
  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
   540
  proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   541
    have "(a + b) / 2 \<in> {a .. b}" using assms(1) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   542
    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
   543
    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
   544
    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
   545
    show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   546
    proof(cases "d\<in>{a<..<b} \<or> c\<in>{a<..<b}")
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   547
      case True thus ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   548
        apply(erule_tac disjE) apply(rule_tac x=d in bexI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   549
        apply(rule_tac[3] x=c in bexI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   550
        using d c by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   551
    next
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   552
      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
   553
      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
   554
      hence "\<And>x. x\<in>{a..b} \<Longrightarrow> f x = f d"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   555
        using c d apply- apply(erule_tac x=x in ballE)+ by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   556
      thus ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   557
        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
   558
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   559
  qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   560
  then guess x .. note x=this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   561
  hence "f' x = (\<lambda>v. 0)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   562
    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
   563
    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
   564
    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
   565
    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
   566
  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
   567
    apply(drule_tac x=v in fun_cong) using x(1) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   568
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   569
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   570
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
   571
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   572
lemma mvt: fixes f::"real \<Rightarrow> real"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   573
  assumes "a < b" and "continuous_on {a .. b} f"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   574
  assumes "\<forall>x\<in>{a<..<b}. (f has_derivative (f' x)) (at x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   575
  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
   576
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   577
  have "\<exists>x\<in>{a<..<b}. (\<lambda>xa. f' x xa - (f b - f a) / (b - a) * xa) = (\<lambda>v. 0)"
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51363
diff changeset
   578
  proof (intro rolle[OF assms(1), of "\<lambda>x. f x - (f b - f a) / (b - a) * x"] ballI)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   579
    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
   580
    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)"
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   581
      by (intro FDERIV_intros assms(3)[rule_format,OF x] mult_right_has_derivative)
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51363
diff changeset
   582
  qed (insert assms(1,2), auto intro!: continuous_on_intros simp: field_simps)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   583
  then guess x ..
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   584
  thus ?thesis apply(rule_tac x=x in bexI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   585
    apply(drule fun_cong[of _ _ "b - a"]) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   586
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   587
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   588
lemma mvt_simple:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   589
  fixes f::"real \<Rightarrow> real"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   590
  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
   591
  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
   592
  apply(rule mvt)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   593
  apply(rule assms(1), rule differentiable_imp_continuous_on)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   594
  unfolding differentiable_on_def differentiable_def defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   595
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
   596
  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
   597
    unfolding has_derivative_within_open[OF x open_interval,THEN sym] 
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   598
    apply(rule has_derivative_within_subset)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   599
    apply(rule assms(2)[rule_format])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   600
    using x by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   601
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
   602
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   603
lemma mvt_very_simple:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   604
  fixes f::"real \<Rightarrow> real"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   605
  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
   606
  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
   607
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
   608
  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
   609
  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
   610
    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
   611
    unfolding True using zero by auto next
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   612
  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
   613
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   614
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   615
text {* A nice generalization (see Havin's proof of 5.19 from Rudin's book). *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   616
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   617
lemma mvt_general:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   618
  fixes f::"real\<Rightarrow>'a::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   619
  assumes "a<b" and "continuous_on {a..b} f"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   620
  assumes "\<forall>x\<in>{a<..<b}. (f has_derivative f'(x)) (at x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   621
  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
   622
proof-
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 "\<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
   624
    apply(rule mvt) apply(rule assms(1))
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   625
    apply(rule continuous_on_inner continuous_on_intros assms(2) ballI)+
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   626
    unfolding o_def
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   627
    apply(rule FDERIV_inner_right)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   628
    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
   629
  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
   630
  show ?thesis proof(cases "f a = f b")
36844
5f9385ecc1a7 Removed usage of normalizating locales.
hoelzl
parents: 36725
diff changeset
   631
    case False
53077
a1b3784f8129 more symbols;
wenzelm
parents: 51733
diff changeset
   632
    have "norm (f b - f a) * norm (f b - f a) = (norm (f b - f a))\<^sup>2"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   633
      by (simp add: power2_eq_square)
35542
8f97d8caabfd replaced \<bullet> with inner
himmelma
parents: 35290
diff changeset
   634
    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
   635
    also have "\<dots> = (f b - f a) \<bullet> f' x (b - a)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   636
      using x unfolding inner_simps by (auto simp add: inner_diff_left)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   637
    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
   638
      by (rule norm_cauchy_schwarz)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   639
    finally show ?thesis using False x(1)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   640
      by (auto simp add: real_mult_left_cancel)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   641
  next
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   642
    case True thus ?thesis using assms(1)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   643
      apply (rule_tac x="(a + b) /2" in bexI) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   644
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   645
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   646
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   647
text {* Still more general bound theorem. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   648
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   649
lemma differentiable_bound:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   650
  fixes f::"'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   651
  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
   652
  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
   653
  shows "norm(f x - f y) \<le> B * norm(x - y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   654
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   655
  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
   656
  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
   657
    using assms(1)[unfolded convex_alt,rule_format,OF x y]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   658
    unfolding scaleR_left_diff_distrib scaleR_right_diff_distrib
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   659
    by (auto simp add: algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   660
  hence 1:"continuous_on {0..1} (f \<circ> ?p)" apply-
44531
1d477a2b1572 replace some continuous_on lemmas with more general versions
huffman
parents: 44457
diff changeset
   661
    apply(rule continuous_on_intros)+
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   662
    unfolding continuous_on_eq_continuous_within
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   663
    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
   664
    unfolding differentiable_def apply(rule_tac x="f' xa" in exI)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   665
    apply(rule has_derivative_within_subset)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   666
    apply(rule assms(2)[rule_format]) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   667
  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
   668
  proof rule
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   669
    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
   670
    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
   671
    have "(f \<circ> ?p has_derivative (f' ?u) \<circ> (\<lambda>u. 0 + u *\<^sub>R (y - x))) (at u within {0<..<1})" 
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
   672
      apply(rule diff_chain_within) apply(rule FDERIV_intros)+ 
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   673
      apply(rule has_derivative_within_subset)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   674
      apply(rule assms(2)[rule_format]) using goal1 * by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   675
    thus ?case
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   676
      unfolding has_derivative_within_open[OF goal1 open_interval] by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   677
  qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   678
  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
   679
  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
   680
  proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   681
    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
   682
    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
   683
      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
   684
    also have "\<dots> \<le> B * norm y"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   685
      apply(rule mult_right_mono)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   686
      using assms(3)[rule_format,OF goal1]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   687
      by(auto simp add:field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   688
    finally show ?case by simp
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   689
  qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   690
  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
   691
    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
   692
  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
   693
  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
   694
  finally show ?thesis by(auto simp add:norm_minus_commute)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   695
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   696
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   697
lemma differentiable_bound_real:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   698
  fixes f::"real \<Rightarrow> real"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   699
  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
   700
  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
   701
  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
   702
  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
   703
  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
   704
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   705
text {* In particular. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   706
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   707
lemma has_derivative_zero_constant:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   708
  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
   709
  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
   710
  shows "\<exists>c. \<forall>x\<in>s. f x = c"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   711
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
   712
  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
   713
  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
   714
    thus ?case
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   715
      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
   716
      unfolding onorm_const by auto qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   717
  thus ?thesis apply(rule_tac x="f x" in exI) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   718
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
   719
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   720
lemma has_derivative_zero_unique: fixes f::"real\<Rightarrow>real"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   721
  assumes "convex s" and "a \<in> s" and "f a = c"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   722
  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
   723
  shows "f x = c"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   724
  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
   725
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   726
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
   727
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   728
lemma has_derivative_inverse_basic:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   729
  fixes f::"'b::euclidean_space \<Rightarrow> 'c::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   730
  assumes "(f has_derivative f') (at (g y))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   731
  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
   732
  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
   733
  shows "(g has_derivative g') (at y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   734
proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   735
  interpret f': bounded_linear f'
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   736
    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
   737
  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
   738
  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
   739
(*  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
   740
  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
   741
  proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   742
    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
   743
    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
   744
    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
   745
    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
   746
    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
   747
    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
   748
    thus ?case apply(rule_tac x=d in exI) apply rule defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   749
    proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   750
      fix z assume as:"norm (z - y) < d" hence "z\<in>t"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   751
        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
   752
      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
   753
        unfolding g'.diff f'.diff
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   754
        unfolding assms(3)[unfolded o_def id_def, THEN fun_cong] 
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   755
        unfolding assms(7)[rule_format,OF `z\<in>t`]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   756
        apply(subst norm_minus_cancel[THEN sym]) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   757
      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
   758
        by (rule C [THEN conjunct2, rule_format])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   759
      also have "\<dots> \<le> (e / C) * norm (g z - g y) * C"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   760
        apply(rule mult_right_mono)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   761
        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
   762
        apply(cases "z=y") defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   763
        apply(rule d1[THEN conjunct2, unfolded dist_norm,rule_format])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   764
        using as d C d0 by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   765
      also have "\<dots> \<le> e * norm (g z - g y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   766
        using C by (auto simp add: field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   767
      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
   768
        by simp
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   769
    qed auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   770
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   771
  have *:"(0::real) < 1 / 2" by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   772
  guess d using lem1[rule_format,OF *] .. note d=this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   773
  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
   774
  have "B>0" unfolding B_def using C by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   775
  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
   776
  proof(rule,rule) case goal1
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   777
    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
   778
      by(rule norm_triangle_sub)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   779
    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
   780
      apply(rule add_left_mono) using d and goal1 by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   781
    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
   782
      apply(rule add_right_mono) using C by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   783
    finally show ?case unfolding B_def by(auto simp add:field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   784
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   785
  show ?thesis unfolding has_derivative_at_alt
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   786
  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
   787
    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
   788
    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
   789
    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
   790
    show ?case
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   791
      apply(rule_tac x=k in exI,rule) defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   792
    proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   793
      fix z assume as:"norm(z - y) < k"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   794
      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
   795
        using d' k by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   796
      also have "\<dots> \<le> e * norm(z - y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   797
        unfolding times_divide_eq_left pos_divide_le_eq[OF `B>0`]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   798
        using lem2[THEN spec[where x=z]] using k as using `e>0`
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   799
        by (auto simp add: field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   800
      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
   801
        by simp qed(insert k, auto)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   802
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
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
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   805
text {* Simply rewrite that based on the domain point x. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   806
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   807
lemma has_derivative_inverse_basic_x:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   808
  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
   809
  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
   810
  "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
   811
  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
   812
  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
   813
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   814
text {* This is the version in Dieudonne', assuming continuity of f and g. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   815
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   816
lemma has_derivative_inverse_dieudonne:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   817
  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
   818
  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
   819
  (**) "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
   820
  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
   821
  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
   822
  using assms(3-6) unfolding continuous_on_eq_continuous_at[OF assms(1)]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   823
    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
   824
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
   825
text {* Here's the simplest way of not assuming much about g. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   826
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   827
lemma has_derivative_inverse:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   828
  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
   829
  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
   830
  "\<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
   831
  shows "(g has_derivative g') (at (f x))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   832
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   833
  { fix y assume "y\<in>interior (f ` s)" 
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   834
    then obtain x where "x\<in>s" and *:"y = f x"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   835
      unfolding image_iff using interior_subset by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   836
    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
   837
  } note * = this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   838
  show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   839
    apply(rule has_derivative_inverse_basic_x[OF assms(6-8)])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   840
    apply(rule continuous_on_interior[OF _ assms(3)])
44647
e4de7750cdeb modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents: 44568
diff changeset
   841
    apply(rule continuous_on_inv[OF assms(4,1)])
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   842
    apply(rule assms(2,5) assms(5)[rule_format] open_interior assms(3))+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   843
    by(rule, rule *, assumption)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   844
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   845
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   846
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
   847
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   848
lemma brouwer_surjective:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   849
  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
   850
  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
   851
  "\<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
   852
  shows "\<exists>y\<in>t. f y = x"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   853
proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   854
  have *:"\<And>x y. f y = x \<longleftrightarrow> x + (y - f y) = y"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   855
    by(auto simp add:algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   856
  show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   857
    unfolding *
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   858
    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
   859
    apply(rule continuous_on_intros assms)+ using assms(4-6) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   860
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   861
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   862
lemma brouwer_surjective_cball:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   863
  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
   864
  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
   865
  "\<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
   866
  shows "\<exists>y\<in>cball a e. f y = x"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   867
  apply(rule brouwer_surjective)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   868
  apply(rule compact_cball convex_cball)+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   869
  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
   870
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   871
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
   872
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   873
lemma sussmann_open_mapping:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   874
  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
   875
  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
   876
  "(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
   877
  "t \<subseteq> s" "x \<in> interior t"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   878
  shows "f x \<in> interior (f ` t)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   879
proof- 
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   880
  interpret f':bounded_linear f'
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   881
    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
   882
  interpret g':bounded_linear g' using assms by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   883
  guess B using bounded_linear.pos_bounded[OF assms(5)] .. note B=this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   884
  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
   885
  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
   886
  guess e1 using assms(8)[unfolded mem_interior_cball] .. note e1=this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   887
  have *:"0<e0/B" "0<e1/B"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   888
    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
   889
  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
   890
  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
   891
    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
   892
    prefer 3 apply(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   893
  proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   894
    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
   895
      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
   896
      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
   897
      apply(rule continuous_on_intros linear_continuous_on[OF assms(5)])+
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   898
      apply(rule continuous_on_subset[OF assms(2)])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   899
      apply(rule,unfold image_iff,erule bexE)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   900
    proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   901
      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
   902
      have "dist x z = norm (g' (f x) - g' y)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   903
        unfolding as(2) and dist_norm by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   904
      also have "\<dots> \<le> norm (f x - y) * B"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   905
        unfolding g'.diff[THEN sym] using B by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   906
      also have "\<dots> \<le> e * B"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   907
        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
   908
      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
   909
      finally have "z\<in>cball x e1" unfolding mem_cball by force
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   910
      thus "z \<in> s" using e1 assms(7) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   911
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   912
  next
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   913
    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
   914
    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
   915
    also have "\<dots> \<le> e * B" apply(rule mult_right_mono)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   916
      using as(2)[unfolded mem_cball dist_norm] and B
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   917
      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
   918
    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
   919
    finally have *:"norm (x + g' (z - f x) - x) < e0" by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   920
    have **:"f x + f' (x + g' (z - f x) - x) = z"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   921
      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
   922
    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
   923
      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
   924
      by (auto simp add: algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   925
    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
   926
      using e0[THEN conjunct2,rule_format,OF *]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   927
      unfolding algebra_simps ** by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   928
    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
   929
      using as(1)[unfolded mem_cball dist_norm] by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   930
    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
   931
      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
   932
    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
   933
    also have "\<dots> \<le> e/2 + e/2" apply(rule add_right_mono)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   934
      using as(2)[unfolded mem_cball dist_norm]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   935
      unfolding norm_minus_commute by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   936
    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
   937
      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
   938
  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
   939
  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
   940
    apply(rule,rule divide_pos_pos) prefer 3
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   941
  proof
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   942
    fix y assume "y \<in> ball (f x) (e/2)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   943
    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
   944
    guess z using lem[rule_format,OF *] .. note z=this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   945
    hence "norm (g' (z - f x)) \<le> norm (z - f x) * B"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   946
      using B by (auto simp add: field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   947
    also have "\<dots> \<le> e * B"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   948
      apply (rule mult_right_mono) using z(1)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   949
      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
   950
    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
   951
    finally have "x + g'(z - f x) \<in> t" apply-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   952
      apply(rule e1[THEN conjunct2,unfolded subset_eq,rule_format])
36587
534418d8d494 remove redundant lemma vector_dist_norm
huffman
parents: 36581
diff changeset
   953
      unfolding mem_cball dist_norm by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   954
    thus "y \<in> f ` t" using z by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   955
  qed(insert e, auto)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   956
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   957
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   958
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
   959
(* 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
   960
(* 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
   961
(* 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
   962
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   963
(* 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
   964
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   965
 lemma right_inverse_linear:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   966
   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
   967
   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
   968
   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
   969
 proof-
40702
cf26dd7395e4 Replace surj by abbreviation; remove surj_on.
hoelzl
parents: 39302
diff changeset
   970
   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
   971
   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
   972
   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
   973
     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
   974
   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
   975
     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
   976
   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
   977
 qed
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   978
 
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   979
lemma has_derivative_inverse_strong:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   980
  fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'n"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   981
  assumes "open s" and "x \<in> s" and "continuous_on s f"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   982
  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
   983
  shows "(g has_derivative g') (at (f x))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   984
proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   985
  have linf:"bounded_linear f'"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   986
    using assms(5) unfolding has_derivative_def by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   987
  hence ling:"bounded_linear g'"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   988
    unfolding linear_conv_bounded_linear[THEN sym]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   989
    apply- apply(rule right_inverse_linear) using assms(6) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   990
  moreover have "g' \<circ> f' = id" using assms(6) linf ling
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   991
    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
   992
    using linear_inverse_left by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   993
  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
   994
    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
   995
    apply(rule assms ling)+ by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   996
  have "continuous (at (f x)) g" unfolding continuous_at Lim_at
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   997
  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
   998
    fix e::real assume "e>0"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
   999
    hence "f x \<in> interior (f ` (ball x e \<inter> s))"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1000
      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
  1001
      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
  1002
    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
  1003
    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
  1004
      apply(rule_tac x=d in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1005
      apply(rule,rule d[THEN conjunct1])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1006
    proof(rule,rule) case goal1
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1007
      hence "g y \<in> g ` f ` (ball x e \<inter> s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1008
        using d[THEN conjunct2,unfolded subset_eq,THEN bspec[where x=y]]
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1009
        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
  1010
      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
  1011
      thus "dist (g y) (g (f x)) < e"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1012
        using assms(4)[rule_format,OF `x\<in>s`]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1013
        by (auto simp add: dist_commute)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1014
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1015
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1016
  moreover have "f x \<in> interior (f ` s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1017
    apply(rule sussmann_open_mapping)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1018
    apply(rule assms ling)+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1019
    using interior_open[OF assms(1)] and `x\<in>s` by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1020
  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
  1021
  proof- case goal1
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1022
    hence "y\<in>f ` s" using interior_subset by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1023
    then guess z unfolding image_iff ..
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1024
    thus ?case using assms(4) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1025
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1026
  ultimately show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1027
    apply- apply(rule has_derivative_inverse_basic_x[OF assms(5)])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1028
    using assms by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1029
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1030
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
  1031
text {* A rewrite based on the other domain. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1032
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1033
lemma has_derivative_inverse_strong_x:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1034
  fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'a"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1035
  assumes "open s" and "g y \<in> s" and "continuous_on s f"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1036
  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
  1037
  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
  1038
  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
  1039
  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
  1040
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
  1041
text {* On a region. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1042
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1043
lemma has_derivative_inverse_on:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1044
  fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'n"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1045
  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
  1046
  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
  1047
  shows "(g has_derivative g'(x)) (at (f x))"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1048
  apply(rule has_derivative_inverse_strong[where g'="g' x" and f=f])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1049
  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
  1050
  unfolding continuous_on_eq_continuous_at[OF assms(1)]
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
  1051
  apply(rule,rule differentiable_imp_continuous_within)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1052
  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
  1053
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1054
text {* Invertible derivative continous at a point implies local
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1055
injectivity. It's only for this we need continuity of the derivative,
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1056
except of course if we want the fact that the inverse derivative is
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1057
also continuous. So if we know for some other reason that the inverse
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1058
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
  1059
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1060
lemma bounded_linear_sub:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1061
  "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
  1062
  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
  1063
  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
  1064
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1065
lemma has_derivative_locally_injective:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1066
  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
  1067
  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
  1068
  "\<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
  1069
  "\<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
  1070
  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
  1071
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1072
  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
  1073
  note f'g' = assms(4)[unfolded id_def o_def,THEN cong]
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
  1074
  have "g' (f' a (\<Sum>Basis)) = (\<Sum>Basis)" "(\<Sum>Basis) \<noteq> (0::'n)" defer 
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
  1075
    apply(subst euclidean_eq_iff) using f'g' by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1076
  hence *:"0 < onorm g'"
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 44647
diff changeset
  1077
    unfolding onorm_pos_lt[OF assms(3)[unfolded linear_linear]] by fastforce
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1078
  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
  1079
  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
  1080
  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
  1081
  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
  1082
  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
  1083
  note d2=this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1084
  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
  1085
  note d = this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1086
  show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1087
  proof
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1088
    show "a\<in>ball a d" using d by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1089
    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
  1090
    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
  1091
      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
  1092
      def ph \<equiv> "\<lambda>w. w - g'(f w - f x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1093
      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
  1094
        unfolding ph_def o_def unfolding diff using f'g'
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1095
        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
  1096
      have "norm (ph x - ph y) \<le> (1/2) * norm (x - y)"
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1097
        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
  1098
        apply(rule_tac[!] ballI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1099
      proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1100
        fix u assume u:"u \<in> ball a d"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1101
        hence "u\<in>s" using d d2 by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1102
        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
  1103
          unfolding o_def and diff using f'g' by auto
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1104
        show "(ph has_derivative (\<lambda>v. v - g' (f' u v))) (at u within ball a d)"
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
  1105
          unfolding ph' *
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
  1106
          apply(simp add: comp_def)
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
  1107
          apply(rule bounded_linear.FDERIV[OF assms(3)])
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
  1108
          apply(rule FDERIV_intros) defer
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1109
          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
  1110
          apply(rule has_derivative_at_within)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1111
          using assms(5) and `u\<in>s` `a\<in>s`
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
  1112
          apply (auto intro!: FDERIV_intros bounded_linear.FDERIV[of _ "\<lambda>x. x"] derivative_linear)
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
  1113
          done
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1114
        have **:"bounded_linear (\<lambda>x. f' u x - f' a x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1115
          "bounded_linear (\<lambda>x. f' a x - f' u x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1116
          apply(rule_tac[!] bounded_linear_sub)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1117
          apply(rule_tac[!] derivative_linear)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1118
          using assms(5) `u\<in>s` `a\<in>s` by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1119
        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
  1120
          unfolding * apply(rule onorm_compose)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1121
          unfolding linear_conv_bounded_linear by(rule assms(3) **)+
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1122
        also have "\<dots> \<le> onorm g' * k"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1123
          apply(rule mult_left_mono) 
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1124
          using d1[THEN conjunct2,rule_format,of u]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1125
          using onorm_neg[OF **(1)[unfolded linear_linear]]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1126
          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
  1127
          by (auto simp add: algebra_simps)
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1128
        also have "\<dots> \<le> 1/2" unfolding k_def by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1129
        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
  1130
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1131
      moreover have "norm (ph y - ph x) = norm (y - x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1132
        apply(rule arg_cong[where f=norm])
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1133
        unfolding ph_def using diff unfolding as by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1134
      ultimately show "x = y" unfolding norm_minus_commute by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1135
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1136
  qed auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1137
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1138
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1139
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
  1140
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1141
lemma has_derivative_sequence_lipschitz_lemma:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1142
  fixes f::"nat \<Rightarrow> 'm::euclidean_space \<Rightarrow> 'n::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1143
  assumes "convex s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1144
  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
  1145
  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
  1146
  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
  1147
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
  1148
  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
  1149
  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
  1150
    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
  1151
    apply(rule_tac[!] ballI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1152
  proof-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1153
    fix x assume "x\<in>s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1154
    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)"
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
  1155
      by(rule FDERIV_intros assms(2)[rule_format] `x\<in>s`)+
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1156
    { fix h
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1157
      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
  1158
        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
  1159
        unfolding norm_minus_commute by (auto simp add: algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1160
      also have "\<dots> \<le> e * norm h+ e * norm h"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1161
        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
  1162
        using assms(3)[rule_format,OF `N\<le>n` `x\<in>s`, of h]
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1163
        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
  1164
      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
  1165
    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
  1166
      apply-apply(rule onorm(2)) apply(rule linear_compose_sub)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1167
      unfolding linear_conv_bounded_linear
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1168
      using assms(2)[rule_format,OF `x\<in>s`, THEN derivative_linear]
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1169
      by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1170
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1171
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1172
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1173
lemma has_derivative_sequence_lipschitz:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1174
  fixes f::"nat \<Rightarrow> 'm::euclidean_space \<Rightarrow> 'n::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1175
  assumes "convex s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1176
  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
  1177
  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
  1178
  assumes "0 < e"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1179
  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
  1180
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
  1181
  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
  1182
  guess N using assms(3)[rule_format,OF *(2)] ..
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1183
  thus ?case
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1184
    apply(rule_tac x=N in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1185
    apply(rule has_derivative_sequence_lipschitz_lemma[where e="1/2 *e", unfolded *])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1186
    using assms by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1187
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1188
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1189
lemma has_derivative_sequence:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1190
  fixes f::"nat\<Rightarrow> 'm::euclidean_space \<Rightarrow> 'n::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1191
  assumes "convex s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1192
  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
  1193
  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
  1194
  assumes "x0 \<in> s" and "((\<lambda>n. f n x0) ---> l) sequentially"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1195
  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
  1196
    (g has_derivative g'(x)) (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1197
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1198
  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
  1199
    apply(rule has_derivative_sequence_lipschitz[where e="42::nat"])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1200
    apply(rule assms)+ by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1201
  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
  1202
    apply(rule bchoice) unfolding convergent_eq_cauchy
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1203
  proof
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1204
    fix x assume "x\<in>s" show "Cauchy (\<lambda>n. f n x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1205
    proof(cases "x=x0")
50939
ae7cd20ed118 replace convergent_imp_cauchy by LIMSEQ_imp_Cauchy
hoelzl
parents: 50526
diff changeset
  1206
      case True thus ?thesis using LIMSEQ_imp_Cauchy[OF assms(5)] by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1207
    next
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1208
      case False show ?thesis unfolding Cauchy_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1209
      proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1210
        fix e::real assume "e>0"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1211
        hence *:"e/2>0" "e/2/norm(x-x0)>0"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1212
          using False by (auto intro!: divide_pos_pos)
50939
ae7cd20ed118 replace convergent_imp_cauchy by LIMSEQ_imp_Cauchy
hoelzl
parents: 50526
diff changeset
  1213
        guess M using LIMSEQ_imp_Cauchy[OF assms(5), unfolded Cauchy_def, rule_format,OF *(1)] .. note M=this
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1214
        guess N using lem1[rule_format,OF *(2)] .. note N = this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1215
        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
  1216
          apply(rule_tac x="max M N" in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1217
        proof(default+)
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1218
          fix m n assume as:"max M N \<le>m" "max M N\<le>n"
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1219
          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
  1220
            unfolding dist_norm by(rule norm_triangle_sub)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1221
          also have "\<dots> \<le> norm (f m x0 - f n x0) + e / 2"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1222
            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
  1223
            by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1224
          also have "\<dots> < e / 2 + e / 2"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1225
            apply(rule add_strict_right_mono)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1226
            using as and M[rule_format] unfolding dist_norm by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1227
          finally show "dist (f m x) (f n x) < e" by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1228
        qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1229
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1230
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1231
  qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1232
  then guess g .. note g = this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1233
  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
  1234
  proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1235
    fix e::real assume *:"e>0"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1236
    guess N using lem1[rule_format,OF *] .. note N=this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1237
    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
  1238
      apply(rule_tac x=N in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1239
    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
  1240
      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
  1241
      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
  1242
        unfolding eventually_sequentially
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1243
        apply(rule_tac x=N in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1244
      proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1245
        fix m assume "N\<le>m"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1246
        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
  1247
          using N[rule_format, of n m x y] and as
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1248
          by (auto simp add: algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1249
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1250
      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
  1251
        apply-
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1252
        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)"])
44125
230a8665c919 mark some redundant theorems as legacy
huffman
parents: 44124
diff changeset
  1253
        apply(rule tendsto_intros g[rule_format] as)+ by assumption
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1254
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1255
  qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1256
  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
  1257
    apply(rule,rule,rule g[rule_format],assumption)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1258
  proof fix x assume "x\<in>s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1259
    have lem3:"\<forall>u. ((\<lambda>n. f' n x u) ---> g' x u) sequentially"
44907
93943da0a010 remove redundant lemma Lim_sequentially in favor of lemma LIMSEQ_def
huffman
parents: 44890
diff changeset
  1260
      unfolding LIMSEQ_def
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1261
    proof(rule,rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1262
      fix u and e::real assume "e>0"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1263
      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
  1264
      proof(cases "u=0")
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1265
        case True guess N using assms(3)[rule_format,OF `e>0`] .. note N=this
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1266
        show ?thesis apply(rule_tac x=N in exI) unfolding True 
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1267
          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
  1268
      next
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1269
        case False hence *:"e / 2 / norm u > 0"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1270
          using `e>0` by (auto intro!: divide_pos_pos)
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1271
        guess N using assms(3)[rule_format,OF *] .. note N=this
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1272
        show ?thesis apply(rule_tac x=N in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1273
        proof(rule,rule) case goal1
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1274
          show ?case unfolding dist_norm
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1275
            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
  1276
            by (auto simp add:field_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1277
        qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1278
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1279
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1280
    show "bounded_linear (g' x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1281
      unfolding linear_linear linear_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1282
      apply(rule,rule,rule) defer
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1283
    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
  1284
      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
  1285
      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
  1286
      show "g' x (c *\<^sub>R x') = c *\<^sub>R g' x x'"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1287
        apply(rule tendsto_unique[OF trivial_limit_sequentially])
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1288
        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
  1289
        unfolding lin[unfolded bounded_linear_def bounded_linear_axioms_def,THEN conjunct2,THEN conjunct1,rule_format]
44125
230a8665c919 mark some redundant theorems as legacy
huffman
parents: 44124
diff changeset
  1290
        apply (intro tendsto_intros) by(rule lem3[rule_format])
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1291
      show "g' x (y + z) = g' x y + g' x z"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1292
        apply(rule tendsto_unique[OF trivial_limit_sequentially])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1293
        apply(rule lem3[rule_format])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1294
        unfolding lin[unfolded bounded_linear_def additive_def,THEN conjunct1,rule_format]
44125
230a8665c919 mark some redundant theorems as legacy
huffman
parents: 44124
diff changeset
  1295
        apply(rule tendsto_add) by(rule lem3[rule_format])+
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1296
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1297
    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
  1298
    proof(rule,rule) case goal1
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1299
      have *:"e/3>0" using goal1 by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1300
      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
  1301
      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
  1302
      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
  1303
      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
  1304
      proof(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1305
        fix y assume as:"y \<in> s" "norm (y - x) < d1"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1306
        let ?N ="max N1 N2"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1307
        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
  1308
          apply(subst norm_minus_cancel[THEN sym])
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1309
          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
  1310
        moreover
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1311
        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
  1312
          using d1 and as by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1313
        ultimately
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1314
        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
  1315
          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
  1316
          by (auto simp add:algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1317
        moreover
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1318
        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
  1319
          using N1 `x\<in>s` by auto
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 41829
diff changeset
  1320
        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
  1321
          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
  1322
          by(auto simp add:algebra_simps)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1323
      qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1324
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1325
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1326
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1327
44124
4c2a61a897d8 Derivative.thy: more sensible subsection headings
huffman
parents: 44123
diff changeset
  1328
text {* Can choose to line up antiderivatives if we want. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1329
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1330
lemma has_antiderivative_sequence:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1331
  fixes f::"nat\<Rightarrow> 'm::euclidean_space \<Rightarrow> 'n::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1332
  assumes "convex s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1333
  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
  1334
  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
  1335
  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
  1336
proof(cases "s={}")
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1337
  case False then obtain a where "a\<in>s" by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1338
  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
  1339
  show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1340
    apply(rule *)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1341
    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
  1342
    apply(rule,rule)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1343
    apply(rule has_derivative_add_const, rule assms(2)[rule_format], assumption)  
44457
d366fa5551ef declare euclidean_simps [simp] at the point they are proved;
huffman
parents: 44282
diff changeset
  1344
    apply(rule `a\<in>s`) by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1345
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
  1346
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1347
lemma has_antiderivative_limit:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1348
  fixes g'::"'m::euclidean_space \<Rightarrow> 'm \<Rightarrow> 'n::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1349
  assumes "convex s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1350
  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
  1351
  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
  1352
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1353
  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
  1354
    apply(rule) using assms(2)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1355
    apply(erule_tac x="inverse (real (Suc n))" in allE) by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1356
  guess f using *[THEN choice] .. note * = this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1357
  guess f' using *[THEN choice] .. note f=this
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1358
  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
  1359
  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
  1360
    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
  1361
    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
  1362
      apply(rule_tac x=N in exI)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1363
    proof(default+)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1364
      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
  1365
      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
  1366
        using goal1(1) by(auto simp add:field_simps) 
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1367
      show ?case
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1368
        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
  1369
        apply(rule order_trans) using N * apply(cases "h=0") by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1370
    qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1371
  qed(insert f,auto)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1372
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1373
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1374
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
  1375
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1376
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
  1377
(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
  1378
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1379
lemma has_derivative_series:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1380
  fixes f::"nat \<Rightarrow> 'm::euclidean_space \<Rightarrow> 'n::euclidean_space"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1381
  assumes "convex s"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1382
  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
  1383
  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
  1384
  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
  1385
  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
  1386
  unfolding sums_seq_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1387
  apply(rule has_derivative_sequence[OF assms(1) _ assms(3)])
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
  1388
  apply(rule, rule)
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
  1389
  apply(rule has_derivative_setsum)
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
  1390
  apply(rule assms(2)[rule_format])
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51641
diff changeset
  1391
  apply assumption
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1392
  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
  1393
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  1394
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
  1395
44081
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 43338
diff changeset
  1396
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
  1397
(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
  1398
 "(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
  1399
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1400
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
  1401
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1402
lemma vector_derivative_works:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1403
  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
  1404
  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
  1405
proof
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1406
  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
  1407
  then interpret bounded_linear f' by auto
46898
1570b30ee040 tuned proofs -- eliminated pointless chaining of facts after 'interpret';
wenzelm
parents: 45605
diff changeset
  1408
  show ?r unfolding vector_derivative_def 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
  1409
    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
  1410
    using f' unfolding scaleR[THEN sym] by auto
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1411
next
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1412
  assume ?r thus ?l
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1413
    unfolding vector_derivative_def has_vector_derivative_def differentiable_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1414
    by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1415
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1416
50418
bd68cf816dd3 fundamental theorem of calculus for the Lebesgue integral
hoelzl
parents: 46898
diff changeset
  1417
lemma has_vector_derivative_withinI_DERIV:
bd68cf816dd3 fundamental theorem of calculus for the Lebesgue integral
hoelzl
parents: 46898
diff changeset
  1418
  assumes f: "DERIV f x :> y" shows "(f has_vector_derivative y) (at x within s)"
bd68cf816dd3 fundamental theorem of calculus for the Lebesgue integral
hoelzl
parents: 46898
diff changeset
  1419
  unfolding has_vector_derivative_def real_scaleR_def
bd68cf816dd3 fundamental theorem of calculus for the Lebesgue integral
hoelzl
parents: 46898
diff changeset
  1420
  apply (rule has_derivative_at_within)
bd68cf816dd3 fundamental theorem of calculus for the Lebesgue integral
hoelzl
parents: 46898
diff changeset
  1421
  using DERIV_conv_has_derivative[THEN iffD1, OF f]
bd68cf816dd3 fundamental theorem of calculus for the Lebesgue integral
hoelzl
parents: 46898
diff changeset
  1422
  apply (subst mult_commute) .
bd68cf816dd3 fundamental theorem of calculus for the Lebesgue integral
hoelzl
parents: 46898
diff changeset
  1423
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1424
lemma vector_derivative_unique_at:
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1425
  assumes "(f has_vector_derivative f') (at x)"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1426
  assumes "(f has_vector_derivative f'') (at x)"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1427
  shows "f' = f''"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1428
proof-
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1429
  have "(\<lambda>x. x *\<^sub>R f') = (\<lambda>x. x *\<^sub>R f'')"
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1430
    using assms [unfolded has_vector_derivative_def]
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1431
    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
  1432
  thus ?thesis unfolding fun_eq_iff by auto
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1433
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1434
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1435
lemma vector_derivative_unique_within_closed_interval:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1436
  assumes "a < b" and "x \<in> {a..b}"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1437
  assumes "(f has_vector_derivative f') (at x within {a..b})"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1438
  assumes "(f has_vector_derivative f'') (at x within {a..b})"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1439
  shows "f' = f''"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1440
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
  1441
  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
  1442
    apply(rule frechet_derivative_unique_within_closed_interval[of "a" "b"])
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1443
    using assms(3-)[unfolded has_vector_derivative_def] using assms(1-2)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50418
diff changeset
  1444
    by (auto simp: Basis_real_def)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1445
  show ?thesis
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1446
  proof(rule ccontr)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1447
    assume "f' \<noteq> f''"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1448
    moreover
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1449
    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
  1450
      using * by (auto simp: fun_eq_iff)
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1451
    ultimately show False unfolding o_def by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1452
  qed
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1453
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1454
37730
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1455
lemma vector_derivative_at:
1a24950dae33 generalize some lemmas about derivatives
huffman
parents: 37650
diff changeset
  1456
  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
  1457
  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
  1458
  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
  1459
  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
  1460
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1461
lemma vector_derivative_within_closed_interval:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1462
  assumes "a < b" and "x \<in> {a..b}"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1463
  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
  1464
  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
  1465
  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
  1466
  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
  1467
  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
  1468
34981
475aef44d5fb Removed explicit type annotations
himmelma
parents: 34964
diff changeset
  1469
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
  1470
 "(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
  1471
  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
  1472
34981
475aef44d5fb Removed explicit type annotations
himmelma
parents: 34964
diff changeset
  1473
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
  1474
 "((\<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
  1475
  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
  1476
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1477
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
  1478
  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
  1479
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1480
lemma has_vector_derivative_cmul:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1481
  "(f has_vector_derivative f') net \<Longrightarrow> ((\<lambda>x. c *\<^sub>R f x) has_vector_derivative (c *\<^sub>R f')) net"
44140
2c10c35dd4be remove several redundant and unused theorems about derivatives
huffman
parents: 44137
diff changeset
  1482
  unfolding has_vector_derivative_def
44282
f0de18b62d63 remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents: 44140
diff changeset
  1483
  apply (drule scaleR_right_has_derivative)
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1484
  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
  1485
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1486
lemma has_vector_derivative_cmul_eq:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1487
  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
  1488
  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
  1489
  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
  1490
  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
  1491
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1492
lemma has_vector_derivative_neg:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1493
  "(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
  1494
  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
  1495
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1496
lemma has_vector_derivative_add:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1497
  assumes "(f has_vector_derivative f') net"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1498
  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
  1499
  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
  1500
  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
  1501
  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
  1502
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1503
lemma has_vector_derivative_sub:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1504
  assumes "(f has_vector_derivative f') net"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1505
  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
  1506
  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
  1507
  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
  1508
  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
  1509
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
  1510
lemma has_vector_derivative_bilinear_within:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1511
  assumes "(f has_vector_derivative f') (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1512
  assumes "(g has_vector_derivative g') (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1513
  assumes "bounded_bilinear h"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1514
  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
  1515
proof-
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1516
  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
  1517
  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
  1518
    unfolding o_def has_vector_derivative_def
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1519
    using assms(3) unfolding scaleR_right scaleR_left scaleR_right_distrib
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1520
    by auto
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1521
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1522
37650
181a70d7b525 generalize some lemmas about derivatives
huffman
parents: 37648
diff changeset
  1523
lemma has_vector_derivative_bilinear_at:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1524
  assumes "(f has_vector_derivative f') (at x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1525
  assumes "(g has_vector_derivative g') (at x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1526
  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
  1527
  shows "((\<lambda>x. h (f x) (g x)) has_vector_derivative (h (f x) g' + h f' (g x))) (at x)"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51478
diff changeset
  1528
  using has_vector_derivative_bilinear_within[OF assms] .
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1529
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1530
lemma has_vector_derivative_at_within:
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1531
  "(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
  1532
  unfolding has_vector_derivative_def
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44907
diff changeset
  1533
  by (rule has_derivative_at_within)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1534
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1535
lemma has_vector_derivative_transform_within:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1536
  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
  1537
  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
  1538
  shows "(g has_vector_derivative f') (at x within s)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1539
  using assms unfolding has_vector_derivative_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1540
  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
  1541
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1542
lemma has_vector_derivative_transform_at:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1543
  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
  1544
  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
  1545
  shows "(g has_vector_derivative f') (at x)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1546
  using assms unfolding has_vector_derivative_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1547
  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
  1548
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1549
lemma has_vector_derivative_transform_within_open:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1550
  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
  1551
  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
  1552
  shows "(g has_vector_derivative f') (at x)"
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1553
  using assms unfolding has_vector_derivative_def
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1554
  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
  1555
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1556
lemma vector_diff_chain_at:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1557
  assumes "(f has_vector_derivative f') (at x)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1558
  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
  1559
  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
  1560
  using assms(2) unfolding has_vector_derivative_def apply-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1561
  apply(drule diff_chain_at[OF assms(1)[unfolded has_vector_derivative_def]])
44282
f0de18b62d63 remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents: 44140
diff changeset
  1562
  unfolding o_def real_scaleR_def scaleR_scaleR .
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1563
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1564
lemma vector_diff_chain_within:
44123
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1565
  assumes "(f has_vector_derivative f') (at x within s)"
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1566
  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
  1567
  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
  1568
  using assms(2) unfolding has_vector_derivative_def apply-
2362a970e348 Derivative.thy: clean up formatting
huffman
parents: 44081
diff changeset
  1569
  apply(drule diff_chain_within[OF assms(1)[unfolded has_vector_derivative_def]])
44282
f0de18b62d63 remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents: 44140
diff changeset
  1570
  unfolding o_def real_scaleR_def scaleR_scaleR .
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1571
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1572
end