Debian Codegraph @

Formal_ineqs/taylor/theory/taylor_interval-compiled.hl

raw
1 needs "Formal_ineqs/lib/ssrbool.hl";;
2 needs "Formal_ineqs/lib/ssrnat.hl";;
3 needs "Formal_ineqs/arith/interval_arith.hl";;
4 needs "Formal_ineqs/trig/matan.hl";;
5 needs "Multivariate/realanalysis.ml";;
6
7 (* Module Taylor_interval*)
8 module Taylor_interval = struct
9
10 open Ssreflect;;
11 open Ssrfun;;
12 open Ssrbool;;
13 open Ssrnat;;
14 open Interval_arith;;
15 open Matan;;
16 prioritize_real();;
17 let derivative = new_definition `derivative f = \y. @d. (f has_real_derivative d) (atreal y)`;;
18 let nth_derivative = new_definition `nth_derivative n f = iter n derivative f`;;
19 let nth_differentiable = define `(nth_differentiable 0 f x <=> f real_continuous atreal x) /\
20 (nth_differentiable (SUC n) f x <=> nth_differentiable n f x /\
21 nth_derivative n f real_differentiable atreal x)`;;
22 let nth_differentiable_on = new_definition `nth_differentiable_on n s f <=>
23 !x. x IN s ==> nth_differentiable n f x`;;
24 let nth_differentiable_on_int = new_definition `nth_differentiable_on_int n int f <=>
25 !x. interval_arith x int ==> nth_differentiable n f x`;;
26 let nth_diff_weak = new_definition `nth_diff_weak n f x <=> f real_continuous atreal x /\
27 ?F. F 0 = f /\ !i. i < n ==> (F i has_real_derivative F (SUC i) x) (atreal x)`;;
28 let nth_diff_strong = new_definition `nth_diff_strong n f x <=>
29 ?s. real_open s /\ x IN s /\ nth_differentiable_on n s f`;;
30 let nth_diff_strong_int = new_definition `nth_diff_strong_int n int f <=>
31 !x. interval_arith x int ==> nth_diff_strong n f x`;;
32
33 (* Section NthDerivatives *)
34 Sections.begin_section "NthDerivatives";;
35
36 (* Lemma derivative_eq_real_derivative *)
37 let derivative_eq_real_derivative = Sections.section_proof []
38 `derivative = real_derivative`
39 [
40 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("derivative", [derivative]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_derivative", [real_derivative]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
41 ];;
42
43 (* Lemma has_derivative_cond *)
44 let has_derivative_cond = Sections.section_proof ["f";"x"]
45 `(?d. (f has_real_derivative d) (atreal x)) ==>
46 (f has_real_derivative (derivative f x)) (atreal x)`
47 [
48 (BETA_TAC THEN (case THEN (move ["d"])) THEN (move ["df"]));
49 ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`derivative f x = d`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) (exact_tac));
50 (((((use_arg_then2 ("derivative", [derivative]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("SELECT_UNIQUE", [SELECT_UNIQUE])) (thm_tac apply_tac)) THEN (simp_tac) THEN (move ["y"])) THEN ((THENL) (split_tac) [(move ["df2"]); ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))]));
51 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_DERIVATIVE_UNIQUE_ATREAL", [REAL_DERIVATIVE_UNIQUE_ATREAL])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (done_tac));
52 ];;
53
54 (* Lemma has_derivative_alt *)
55 let has_derivative_alt = Sections.section_proof ["f";"x"]
56 `f real_differentiable atreal x ==>
57 (f has_real_derivative (derivative f x)) (atreal x)`
58 [
59 (((((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("has_derivative_cond", [has_derivative_cond])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac));
60 ];;
61
62 (* Lemma derivative_unique *)
63 let derivative_unique = Sections.section_proof ["f";"f'";"x"]
64 `(f has_real_derivative f') (atreal x) ==> derivative f x = f'`
65 [
66 ((BETA_TAC THEN (move ["df"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_DERIVATIVE_UNIQUE_ATREAL", [REAL_DERIVATIVE_UNIQUE_ATREAL])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)));
67 (((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_derivative_cond", [has_derivative_cond]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((use_arg_then2 ("f'", [])) (term_tac exists_tac)) THEN (done_tac));
68 ];;
69
70 (* Lemma derivative_unique_on *)
71 let derivative_unique_on = Sections.section_proof ["s";"f";"f'"]
72 `(!x. x IN s ==> (f has_real_derivative f' x) (atreal x)) ==>
73 (!x. x IN s ==> f' x = derivative f x)`
74 [
75 (BETA_TAC THEN (move ["df"]) THEN (move ["x"]) THEN (move ["xs"]));
76 (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("derivative_unique", [derivative_unique])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f' x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
77 ];;
78
79 (* Lemma has_derivative_lemma *)
80 let has_derivative_lemma = Sections.section_proof ["f";"f'";"x"]
81 `f real_differentiable atreal x /\
82 derivative f x = f' ==>
83 (f has_real_derivative f') (atreal x)`
84 [
85 ((BETA_TAC THEN (case THEN ((move ["diff"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))))) THEN (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
86 ];;
87
88 (* Lemma nth_derivative0 *)
89 let nth_derivative0 = Sections.section_proof ["f"]
90 `nth_derivative 0 f = f`
91 [
92 (((((use_arg_then2 ("nth_derivative", [nth_derivative]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL iter)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
93 ];;
94
95 (* Lemma nth_derivativeS *)
96 let nth_derivativeS = Sections.section_proof ["n";"f"]
97 `nth_derivative (SUC n) f = derivative (nth_derivative n f)`
98 [
99 (((repeat_tactic 1 9 (((use_arg_then2 ("nth_derivative", [nth_derivative]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iterS", [iterS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
100 ];;
101
102 (* Lemma nth_Sderivative *)
103 let nth_Sderivative = Sections.section_proof ["n";"f"]
104 `nth_derivative (SUC n) f = nth_derivative n (derivative f)`
105 [
106 (((((use_arg_then2 ("nth_derivative", [nth_derivative]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iterSr", [iterSr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_derivative", [nth_derivative]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
107 ];;
108
109 (* Lemma nth_derivative1 *)
110 let nth_derivative1 = Sections.section_proof ["f"]
111 `nth_derivative 1 f = derivative f`
112 [
113 (((((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_derivativeS", [nth_derivativeS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_derivative0", [nth_derivative0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
114 ];;
115
116 (* Lemma nth_derivative2 *)
117 let nth_derivative2 = Sections.section_proof ["f"]
118 `nth_derivative 2 f = derivative (derivative f)`
119 [
120 (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 = SUC(SUC 0)`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_derivative", [nth_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("iterS", [iterS]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL iter)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
121 ];;
122
123 (* Lemma nth_derivative_add *)
124 let nth_derivative_add = Sections.section_proof ["n";"m";"f"]
125 `nth_derivative n (nth_derivative m f) = nth_derivative (n + m) f`
126 [
127 (((repeat_tactic 1 9 (((use_arg_then2 ("nth_derivative", [nth_derivative]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iter_add", [iter_add]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
128 ];;
129
130 (* Lemma nth_diff_continuous *)
131 let nth_diff_continuous = Sections.section_proof ["n";"f";"x"]
132 `nth_differentiable n f x ==>
133 f real_continuous atreal x`
134 [
135 (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((use_arg_then2 ("nth_differentiable", [nth_differentiable]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
136 ((BETA_TAC THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHn", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (simp_tac)) THEN (done_tac));
137 ];;
138
139 (* Lemma nth_differentiable_cond *)
140 let nth_differentiable_cond = Sections.section_proof ["n";"f";"x"]
141 `nth_differentiable n f x ==>
142 !i. i < n ==> (nth_derivative i f has_real_derivative (nth_derivative (SUC i) f x)) (atreal x)`
143 [
144 ((THENL_FIRST) ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) ((((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
145 ((((use_arg_then2 ("nth_differentiable", [nth_differentiable]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHn", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["df_n"]) THEN (move ["dfn"]))) THEN (move ["i"]));
146 (((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_eqVlt", [leq_eqVlt]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("df_n", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN ((TRY done_tac)))]));
147 (((((use_arg_then2 ("nth_derivativeS", [nth_derivativeS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
148 ];;
149
150 (* Lemma nth_differentiable_on_cond *)
151 let nth_differentiable_on_cond = Sections.section_proof ["n";"s";"f"]
152 `nth_differentiable_on n s f ==>
153 !x. x IN s ==>
154 !i. i < n ==> (nth_derivative i f has_real_derivative (nth_derivative (SUC i) f x)) (atreal x)`
155 [
156 ((((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] [])))) THEN (move ["cond"]) THEN (move ["x"]));
157 (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("cond", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("nth_differentiable_cond", [nth_differentiable_cond])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac));
158 ];;
159
160 (* Lemma nth_differentiable_eq *)
161 let nth_differentiable_eq = Sections.section_proof ["n";"f";"x"]
162 `nth_differentiable n f x <=>
163 f real_continuous atreal x /\
164 !i. i < n ==> (nth_derivative i f has_real_derivative (nth_derivative (SUC i) f x)) (atreal x)`
165 [
166 ((THENL) (split_tac) [(move ["dn_f"]); (case THEN (move ["f_cont"]))]);
167 (((((fun arg_tac -> (use_arg_then2 ("nth_diff_continuous", [nth_diff_continuous])) (fun fst_arg -> (use_arg_then2 ("dn_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_differentiable_cond", [nth_differentiable_cond])) (disch_tac [])) THEN (clear_assumption "nth_differentiable_cond") THEN (exact_tac)) THEN (done_tac));
168 (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN (((((use_arg_then2 ("nth_differentiable", [nth_differentiable]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_eqVlt", [leq_eqVlt]))(thm_tac (new_rewrite [] []))))) THEN (move ["cond"])));
169 ((THENL_FIRST) ((((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((BETA_TAC THEN (move ["i"]) THEN (move ["i_lt_n"])) THEN (((use_arg_then2 ("cond", [])) (disch_tac [])) THEN (clear_assumption "cond") THEN (DISCH_THEN apply_tac)) THEN (done_tac)));
170 ((((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`nth_derivative (SUC n) f x`))) (term_tac exists_tac)));
171 (((use_arg_then2 ("cond", [])) (disch_tac [])) THEN (clear_assumption "cond") THEN (exact_tac));
172 ];;
173
174 (* Lemma nth_differentiable_on_int2 *)
175 let nth_differentiable_on_int2 = Sections.section_proof ["f";"int"]
176 `nth_differentiable_on_int 2 int f ==>
177 ?f' f''. f' = derivative f /\ f'' = nth_derivative 2 f /\
178 !x. interval_arith x int ==> (f has_real_derivative f' x) (atreal x) /\
179 (f' has_real_derivative f'' x) (atreal x)`
180 [
181 ((((use_arg_then2 ("nth_differentiable_on_int", [nth_differentiable_on_int]))(thm_tac (new_rewrite [] [])))) THEN (move ["h"]));
182 ((((fun arg_tac -> arg_tac (Arg_term (`derivative f`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`nth_derivative 2 f`))) (term_tac exists_tac))) THEN (simp_tac) THEN (move ["x"]) THEN (move ["ineq"]));
183 ((((use_arg_then2 ("nth_derivative1", [nth_derivative1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("nth_derivative0", [nth_derivative0])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [1] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 = SUC 1`)))(thm_tac (new_rewrite [] [])))));
184 (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("nth_differentiable_cond", [nth_differentiable_cond])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac));
185 ];;
186
187 (* Lemma nth_mth_diff *)
188 let nth_mth_diff = Sections.section_proof ["n";"m";"f";"x"]
189 `n <= m ==> nth_differentiable m f x ==> nth_differentiable n f x`
190 [
191 ((BETA_TAC THEN (move ["n_le_m"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_eq", [nth_differentiable_eq]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["cond"])))) THEN ((((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["i_lt"])));
192 ((((use_arg_then2 ("cond", [])) (disch_tac [])) THEN (clear_assumption "cond") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("n_le_m", [])) (disch_tac [])) THEN (clear_assumption "n_le_m") THEN ((use_arg_then2 ("ltn_leq_trans", [ltn_leq_trans])) (disch_tac [])) THEN (clear_assumption "ltn_leq_trans") THEN (DISCH_THEN apply_tac)) THEN (done_tac));
193 ];;
194
195 (* Lemma nth_differentiable1 *)
196 let nth_differentiable1 = Sections.section_proof ["f";"x"]
197 `nth_differentiable 1 f x <=> f real_differentiable atreal x`
198 [
199 (((((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL nth_differentiable)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_derivative0", [nth_derivative0]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (move ["df"])]));
200 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL", [REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
201 ];;
202
203 (* Lemma nth_diff_imp_diff *)
204 let nth_diff_imp_diff = Sections.section_proof ["n";"f";"x"]
205 `0 < n ==> nth_differentiable n f x ==>
206 f real_differentiable atreal x`
207 [
208 ((((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["ineq"]) THEN (move ["df"])) THEN (((use_arg_then2 ("nth_differentiable1", [nth_differentiable1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_mth_diff", [nth_mth_diff])) (disch_tac [])) THEN (clear_assumption "nth_mth_diff") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("n", [])) (term_tac exists_tac)) THEN (done_tac));
209 ];;
210
211 (* Lemma nth_derivative_continuous *)
212 let nth_derivative_continuous = Sections.section_proof ["n";"f";"x";"i"]
213 `nth_differentiable n f x ==> i < n ==>
214 nth_derivative i f real_continuous atreal x`
215 [
216 ((((use_arg_then2 ("nth_differentiable_eq", [nth_differentiable_eq]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (move ["df"]));
217 (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("df", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["cond"])) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL", [REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL") THEN (DISCH_THEN apply_tac)));
218 ((((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`nth_derivative (SUC i) f x`))) (term_tac exists_tac)) THEN (done_tac));
219 ];;
220
221 (* Lemma ith_derivative_differentiable *)
222 let ith_derivative_differentiable = Sections.section_proof ["i";"n";"f";"x"]
223 `nth_differentiable n f x ==> i < n ==>
224 nth_differentiable (n - i) (nth_derivative i f) x`
225 [
226 (BETA_TAC THEN (move ["dnf"]));
227 ((((use_arg_then2 ("dnf", [])) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_eq", [nth_differentiable_eq]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (move ["cond"]) THEN (move ["i_lt_n"])));
228 (((((fun arg_tac -> (use_arg_then2 ("nth_derivative_continuous", [nth_derivative_continuous])) (fun fst_arg -> (use_arg_then2 ("dnf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["j_lt_ni"]));
229 (((repeat_tactic 1 9 (((use_arg_then2 ("nth_derivative_add", [nth_derivative_add]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cond", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("j_lt_ni", [])) (disch_tac [])) THEN (clear_assumption "j_lt_ni") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
230 ];;
231
232 (* Lemma nth_diff_strong_imp_diff *)
233 let nth_diff_strong_imp_diff = Sections.section_proof ["n";"f";"x"]
234 `nth_diff_strong n f x ==> nth_differentiable n f x`
235 [
236 (((((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"]))) THEN ((((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] [])))) THEN (move ["h"])));
237 (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac));
238 ];;
239
240 (* Section DerivativeArith *)
241 Sections.begin_section "DerivativeArith";;
242
243 (* Section ElementaryDerivatives *)
244 Sections.begin_section "ElementaryDerivatives";;
245
246 (* Lemma HAS_REAL_DERIVATIVE_ABS_POS *)
247 let HAS_REAL_DERIVATIVE_ABS_POS = Sections.section_proof ["x"]
248 `&0 < x ==> (abs has_real_derivative &1) (atreal x)`
249 [
250 (BETA_TAC THEN (move ["x_pos"]));
251 (((use_arg_then2 ("HAS_REAL_DERIVATIVE_TRANSFORM_ATREAL", [HAS_REAL_DERIVATIVE_TRANSFORM_ATREAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_TRANSFORM_ATREAL") THEN (DISCH_THEN apply_tac));
252 ((((fun arg_tac -> arg_tac (Arg_term (`\x. x`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac))) THEN (((((use_arg_then2 ("HAS_REAL_DERIVATIVE_ID", [HAS_REAL_DERIVATIVE_ID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_pos", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["t"])));
253 ((((use_arg_then2 ("x_pos", [])) (disch_tac [])) THEN (clear_assumption "x_pos") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
254 ];;
255
256 (* Lemma HAS_REAL_DERIVATIVE_ABS_NEG *)
257 let HAS_REAL_DERIVATIVE_ABS_NEG = Sections.section_proof ["x"]
258 `x < &0 ==> (abs has_real_derivative (-- &1)) (atreal x)`
259 [
260 (BETA_TAC THEN (move ["x_neg"]));
261 (((use_arg_then2 ("HAS_REAL_DERIVATIVE_TRANSFORM_ATREAL", [HAS_REAL_DERIVATIVE_TRANSFORM_ATREAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_TRANSFORM_ATREAL") THEN (DISCH_THEN apply_tac));
262 ((((fun arg_tac -> arg_tac (Arg_term (`\x. --x`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`--x`))) (term_tac exists_tac))) THEN ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_NEG", [HAS_REAL_DERIVATIVE_NEG]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("HAS_REAL_DERIVATIVE_ID", [HAS_REAL_DERIVATIVE_ID]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)));
263 ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("x_neg", [])) (disch_tac [])) THEN (clear_assumption "x_neg") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
264 ((BETA_TAC THEN (move ["t"])) THEN (((use_arg_then2 ("x_neg", [])) (disch_tac [])) THEN (clear_assumption "x_neg") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
265 ];;
266
267 (* Lemma derivative_x *)
268 let derivative_x = Sections.section_proof []
269 `derivative (\x. x) = (\x. &1)`
270 [
271 ((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac));
272 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_ID", [HAS_REAL_DERIVATIVE_ID]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
273 ];;
274
275 (* Lemma derivative_const *)
276 let derivative_const = Sections.section_proof ["c"]
277 `derivative (\x. c) = (\x. &0)`
278 [
279 ((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac));
280 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_CONST", [HAS_REAL_DERIVATIVE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
281 ];;
282
283 (* Lemma derivative_abs_pos *)
284 let derivative_abs_pos = Sections.section_proof ["x"]
285 `&0 < x ==> derivative abs x = &1`
286 [
287 (BETA_TAC THEN (move ["x_pos"]));
288 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_ABS_POS", [HAS_REAL_DERIVATIVE_ABS_POS]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
289 ];;
290
291 (* Lemma derivative_abs_neg *)
292 let derivative_abs_neg = Sections.section_proof ["x"]
293 `x < &0 ==> derivative abs x = -- &1`
294 [
295 (BETA_TAC THEN (move ["x_neg"]));
296 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_ABS_NEG", [HAS_REAL_DERIVATIVE_ABS_NEG]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
297 ];;
298
299 (* Lemma derivative_pow_x *)
300 let derivative_pow_x = Sections.section_proof ["n"]
301 `derivative (\x. x pow n) = (\x. &n * x pow (n - 1))`
302 [
303 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac)) THEN (((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)));
304 ((((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(gsym_then (thm_tac (new_rewrite [] [(`x pow (n - 1)`)]))))) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_POW_ATREAL", [HAS_REAL_DERIVATIVE_POW_ATREAL]))(thm_tac (new_rewrite [] [])))));
305 ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_ID", [HAS_REAL_DERIVATIVE_ID]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
306 ];;
307
308 (* Lemma derivative_pow2_x *)
309 let derivative_pow2_x = Sections.section_proof []
310 `derivative (\x. x pow 2) = (\x. &2 * x)`
311 [
312 (((((use_arg_then2 ("derivative_pow_x", [derivative_pow_x]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 - 1 = 1`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POW_1", [REAL_POW_1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
313 ];;
314
315 (* Lemma derivative_pow3_x *)
316 let derivative_pow3_x = Sections.section_proof []
317 `derivative (\x. x pow 3) = (\x. &3 * x pow 2)`
318 [
319 (((((use_arg_then2 ("derivative_pow_x", [derivative_pow_x]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 - 1 = 2`)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
320 ];;
321
322 (* Lemma derivative_inv *)
323 let derivative_inv = Sections.section_proof ["x"]
324 `~(x = &0) ==> derivative inv x = -- inv (x * x)`
325 [
326 (BETA_TAC THEN (move ["xn0"]));
327 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_INV_BASIC", [HAS_REAL_DERIVATIVE_INV_BASIC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
328 ];;
329
330 (* Lemma derivative_atn *)
331 let derivative_atn = Sections.section_proof []
332 `derivative atn = (\x. inv (&1 + x * x))`
333 [
334 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["x"]) THEN (simp_tac));
335 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_ATN", [HAS_REAL_DERIVATIVE_ATN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
336 ];;
337
338 (* Lemma derivative_exp *)
339 let derivative_exp = Sections.section_proof []
340 `derivative exp = exp`
341 [
342 ((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac));
343 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_EXP", [HAS_REAL_DERIVATIVE_EXP]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
344 ];;
345
346 (* Lemma derivative_log *)
347 let derivative_log = Sections.section_proof ["x"]
348 `&0 < x ==> derivative log x = inv x`
349 [
350 ((BETA_TAC THEN (move ["x_ineq"])) THEN (((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOG", [HAS_REAL_DERIVATIVE_LOG]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
351 ];;
352
353 (* Lemma derivative_sin *)
354 let derivative_sin = Sections.section_proof []
355 `derivative sin = cos`
356 [
357 ((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac));
358 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_SIN", [HAS_REAL_DERIVATIVE_SIN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
359 ];;
360
361 (* Lemma derivative_cos *)
362 let derivative_cos = Sections.section_proof []
363 `derivative cos = (\x. --sin x)`
364 [
365 ((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac));
366 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_COS", [HAS_REAL_DERIVATIVE_COS]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
367 ];;
368
369 (* Lemma derivative_asn *)
370 let derivative_asn = Sections.section_proof ["x"]
371 `abs x < &1 ==> derivative asn x = inv(sqrt(&1 - x * x))`
372 [
373 (BETA_TAC THEN (move ["x_ineq"]));
374 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_ASN", [HAS_REAL_DERIVATIVE_ASN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
375 ];;
376
377 (* Lemma derivative_acs *)
378 let derivative_acs = Sections.section_proof ["x"]
379 `abs x < &1 ==> derivative acs x = --inv(sqrt(&1 - x * x))`
380 [
381 (BETA_TAC THEN (move ["x_ineq"]));
382 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_ACS", [HAS_REAL_DERIVATIVE_ACS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
383 ];;
384
385 (* Lemma derivative_sqrt *)
386 let derivative_sqrt = Sections.section_proof ["x"]
387 `&0 < x ==> derivative sqrt x = inv (&2 * sqrt x)`
388 [
389 (BETA_TAC THEN (move ["xg0"]));
390 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_SQRT", [HAS_REAL_DERIVATIVE_SQRT]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
391 ];;
392
393 (* Lemma derivative_matan *)
394 let derivative_matan = Sections.section_proof ["x"]
395 `derivative matan x = dmatan x`
396 [
397 (((((use_arg_then2 ("derivative_eq_real_derivative", [derivative_eq_real_derivative]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dmatan", [dmatan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
398 ];;
399
400 (* Lemma matan_differentiable *)
401 let matan_differentiable = Sections.section_proof ["x"]
402 `-- &1 < x ==> matan real_differentiable atreal x`
403 [
404 (BETA_TAC THEN (move ["x_ineq"]));
405 (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x < &1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["x_ineq2"]));
406 ((((use_arg_then2 ("matan_real_derivative_abs1", [matan_real_derivative_abs1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_ineq2", [])) (disch_tac [])) THEN (clear_assumption "x_ineq2") THEN ((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
407 (((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] []))));
408 ((fun arg_tac -> (use_arg_then2 ("matan_has_derivative_gt0", [matan_has_derivative_gt0])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
409 ((fun arg_tac -> arg_tac (Arg_term (`inv _1 - _2`))) (term_tac (set_tac "t")));
410 ((BETA_TAC THEN (move ["h"])) THEN ((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("x_ineq2", [])) (disch_tac [])) THEN (clear_assumption "x_ineq2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
411 ];;
412
413 (* Lemma derivative_composition *)
414 let derivative_composition = Sections.section_proof ["f";"g";"x"]
415 `f real_differentiable atreal x ==>
416 g real_differentiable atreal (f x) ==>
417 derivative (\x. g (f x)) x = derivative f x * derivative g (f x)`
418 [
419 ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("has_derivative_alt", [has_derivative_alt])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["df"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("has_derivative_alt", [has_derivative_alt])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["dg"])) THEN (((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)));
420 ((THENL_FIRST) (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_REAL_DERIVATIVE_CHAIN))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative g`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\y. y = f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)) ((BETA_TAC THEN (move ["y"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
421 ((BETA_TAC THEN (case THEN (move ["_"]))) THEN (DISCH_THEN apply_tac) THEN (done_tac));
422 ];;
423
424 (* Section ElementaryCompose *)
425 Sections.begin_section "ElementaryCompose";;
426
427 (* Lemma REAL_DIFFERENTIABLE_AT_INV *)
428 let REAL_DIFFERENTIABLE_AT_INV = Sections.section_proof ["x"]
429 `~(x = &0) ==> inv real_differentiable atreal x`
430 [
431 (BETA_TAC THEN (move ["xn0"]));
432 ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_DIFFERENTIABLE_INV_ATREAL", [REAL_DIFFERENTIABLE_INV_ATREAL])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(\x. x:real)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
433 (((simp_tac) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_ID", [REAL_DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xn0", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac));
434 ];;
435
436 (* Lemma REAL_DIFFERENTIABLE_AT_ABS_POS *)
437 let REAL_DIFFERENTIABLE_AT_ABS_POS = Sections.section_proof ["x"]
438 `&0 < x ==> abs real_differentiable atreal x`
439 [
440 (BETA_TAC THEN (move ["x_pos"]));
441 ((((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`&1`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_ABS_POS", [HAS_REAL_DERIVATIVE_ABS_POS]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
442 ];;
443
444 (* Lemma REAL_DIFFERENTIABLE_AT_ABS_NEG *)
445 let REAL_DIFFERENTIABLE_AT_ABS_NEG = Sections.section_proof ["x"]
446 `x < &0 ==> abs real_differentiable atreal x`
447 [
448 (BETA_TAC THEN (move ["x_pos"]));
449 ((((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`-- &1`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_ABS_NEG", [HAS_REAL_DERIVATIVE_ABS_NEG]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
450 ];;
451 (Sections.add_section_var (mk_var ("f", (`:real->real`))));;
452 (Sections.add_section_var (mk_var ("x", (`:real`))));;
453 (Sections.add_section_hyp "df" (`f real_differentiable atreal x`));;
454
455 (* Lemma derivative_compose_abs_pos *)
456 let derivative_compose_abs_pos = Sections.section_proof []
457 `&0 < f x ==> (\x. abs (f x)) real_differentiable atreal x /\
458 derivative (\x. abs (f x)) x = derivative f x`
459 [
460 ((BETA_TAC THEN (move ["f_ineq"])) THEN (split_tac));
461 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`abs`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac)));
462 (((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_ABS_POS", [REAL_DIFFERENTIABLE_AT_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
463 ((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_ABS_POS", [REAL_DIFFERENTIABLE_AT_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
464 (((((use_arg_then2 ("derivative_abs_pos", [derivative_abs_pos]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
465 ];;
466
467 (* Lemma derivative_compose_abs_neg *)
468 let derivative_compose_abs_neg = Sections.section_proof []
469 `f x < &0 ==> (\x. abs (f x)) real_differentiable atreal x /\
470 derivative (\x. abs (f x)) x = --derivative f x`
471 [
472 ((BETA_TAC THEN (move ["f_ineq"])) THEN (split_tac));
473 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`abs`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac)));
474 (((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_ABS_NEG", [REAL_DIFFERENTIABLE_AT_ABS_NEG]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
475 ((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_ABS_NEG", [REAL_DIFFERENTIABLE_AT_ABS_NEG]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
476 (((((use_arg_then2 ("derivative_abs_neg", [derivative_abs_neg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_RNEG", [REAL_MUL_RNEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
477 ];;
478
479 (* Lemma derivative_compose_pow *)
480 let derivative_compose_pow = Sections.section_proof ["n"]
481 `(\x. (f x) pow n) real_differentiable atreal x /\
482 derivative (\x. (f x) pow n) x = &n * (f x) pow (n - 1) * derivative f x`
483 [
484 ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("REAL_DIFFERENTIABLE_POW_ATREAL", [REAL_DIFFERENTIABLE_POW_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
485 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_POW_ATREAL", [HAS_REAL_DERIVATIVE_POW_ATREAL]))(thm_tac (new_rewrite [] [])))));
486 ((((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
487 ];;
488
489 (* Lemma derivative_compose_pow2 *)
490 let derivative_compose_pow2 = Sections.section_proof []
491 `(\x. (f x) pow 2) real_differentiable atreal x /\
492 derivative (\x. (f x) pow 2) x = &2 * f x * derivative f x`
493 [
494 (((repeat_tactic 1 9 (((use_arg_then2 ("derivative_compose_pow", [derivative_compose_pow]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 - 1 = 1`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POW_1", [REAL_POW_1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
495 ];;
496
497 (* Lemma derivative_compose_pow3 *)
498 let derivative_compose_pow3 = Sections.section_proof []
499 `(\x. (f x) pow 3) real_differentiable atreal x /\
500 derivative (\x. (f x) pow 3) x = &3 * (f x pow 2) * derivative f x`
501 [
502 (((repeat_tactic 1 9 (((use_arg_then2 ("derivative_compose_pow", [derivative_compose_pow]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 - 1 = 2`)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
503 ];;
504
505 (* Lemma derivative_compose_atn *)
506 let derivative_compose_atn = Sections.section_proof []
507 `(\x. atn (f x)) real_differentiable atreal x /\
508 derivative (\x. atn (f x)) x = derivative f x / (&1 + f x * f x)`
509 [
510 (split_tac);
511 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`atn`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac)));
512 (((((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_ATN", [REAL_DIFFERENTIABLE_AT_ATN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
513 ((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_ATN", [REAL_DIFFERENTIABLE_AT_ATN]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
514 (((((use_arg_then2 ("derivative_atn", [derivative_atn]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
515 ];;
516
517 (* Lemma derivative_compose_exp *)
518 let derivative_compose_exp = Sections.section_proof []
519 `(\x. exp (f x)) real_differentiable atreal x /\
520 derivative (\x. exp (f x)) x = exp (f x) * derivative f x`
521 [
522 (split_tac);
523 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`exp`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac)));
524 (((((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_EXP", [REAL_DIFFERENTIABLE_AT_EXP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
525 ((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_EXP", [REAL_DIFFERENTIABLE_AT_EXP]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
526 (((((use_arg_then2 ("derivative_exp", [derivative_exp]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
527 ];;
528
529 (* Lemma derivative_compose_log *)
530 let derivative_compose_log = Sections.section_proof []
531 `&0 < f x ==> (\x. log (f x)) real_differentiable atreal x /\
532 derivative (\x. log (f x)) x = derivative f x / f x`
533 [
534 ((BETA_TAC THEN (move ["f_ineq"])) THEN (split_tac));
535 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`log`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac)));
536 (((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_LOG", [REAL_DIFFERENTIABLE_AT_LOG]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
537 ((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_LOG", [REAL_DIFFERENTIABLE_AT_LOG]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
538 (((((use_arg_then2 ("derivative_log", [derivative_log]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
539 ];;
540
541 (* Lemma derivative_compose_cos *)
542 let derivative_compose_cos = Sections.section_proof []
543 `(\x. cos (f x)) real_differentiable atreal x /\
544 derivative (\x. cos (f x)) x = --(sin (f x) * derivative f x)`
545 [
546 (split_tac);
547 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`cos`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac)));
548 (((((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_COS", [REAL_DIFFERENTIABLE_AT_COS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
549 ((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_COS", [REAL_DIFFERENTIABLE_AT_COS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
550 (((((use_arg_then2 ("derivative_cos", [derivative_cos]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_LMUL", [REAL_NEG_LMUL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
551 ];;
552
553 (* Lemma derivative_compose_sin *)
554 let derivative_compose_sin = Sections.section_proof []
555 `(\x. sin (f x)) real_differentiable atreal x /\
556 derivative (\x. sin (f x)) x = cos (f x) * derivative f x`
557 [
558 (split_tac);
559 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sin`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac)));
560 (((((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_SIN", [REAL_DIFFERENTIABLE_AT_SIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
561 ((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_SIN", [REAL_DIFFERENTIABLE_AT_SIN]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
562 (((((use_arg_then2 ("derivative_sin", [derivative_sin]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
563 ];;
564
565 (* Lemma derivative_compose_inv *)
566 let derivative_compose_inv = Sections.section_proof []
567 `~(f x = &0) ==>
568 (\x. inv (f x)) real_differentiable atreal x /\
569 derivative (\x. inv (f x)) x = -- inv (f x * f x) * derivative f x`
570 [
571 ((THENL_FIRST) ((BETA_TAC THEN (move ["fn0"])) THEN (split_tac)) ((((use_arg_then2 ("REAL_DIFFERENTIABLE_INV_ATREAL", [REAL_DIFFERENTIABLE_INV_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_INV_ATREAL") THEN (DISCH_THEN apply_tac)) THEN (done_tac)));
572 (((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("derivative_inv", [derivative_inv]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_INV", [REAL_DIFFERENTIABLE_AT_INV]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
573 ];;
574
575 (* Lemma derivative_compose_sqrt *)
576 let derivative_compose_sqrt = Sections.section_proof []
577 `&0 < f x ==>
578 (\x. sqrt (f x)) real_differentiable atreal x /\
579 derivative (\x. sqrt (f x)) x = derivative f x / (&2 * sqrt (f x))`
580 [
581 ((BETA_TAC THEN (move ["f_pos"])) THEN (split_tac));
582 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sqrt`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac)));
583 (((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_SQRT", [REAL_DIFFERENTIABLE_AT_SQRT])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_AT_SQRT") THEN (DISCH_THEN apply_tac)) THEN (done_tac));
584 ((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_SQRT", [REAL_DIFFERENTIABLE_AT_SQRT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
585 (((((use_arg_then2 ("derivative_sqrt", [derivative_sqrt]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
586 ];;
587
588 (* Lemma derivative_compose_acs *)
589 let derivative_compose_acs = Sections.section_proof []
590 `abs (f x) < &1 ==>
591 (\x. acs (f x)) real_differentiable atreal x /\
592 derivative (\x. acs (f x)) x = -- (derivative f x / sqrt (&1 - f x * f x))`
593 [
594 ((BETA_TAC THEN (move ["f_abs"])) THEN (split_tac));
595 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`acs`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac)));
596 (((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_ACS", [REAL_DIFFERENTIABLE_AT_ACS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
597 ((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_ACS", [REAL_DIFFERENTIABLE_AT_ACS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
598 (((((use_arg_then2 ("derivative_acs", [derivative_acs]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_RNEG", [REAL_MUL_RNEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
599 ];;
600
601 (* Lemma derivative_compose_asn *)
602 let derivative_compose_asn = Sections.section_proof []
603 `abs (f x) < &1 ==>
604 (\x. asn (f x)) real_differentiable atreal x /\
605 derivative (\x. asn (f x)) x = derivative f x / sqrt (&1 - f x * f x)`
606 [
607 ((BETA_TAC THEN (move ["f_abs"])) THEN (split_tac));
608 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`asn`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac)));
609 (((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_ASN", [REAL_DIFFERENTIABLE_AT_ASN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
610 ((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_ASN", [REAL_DIFFERENTIABLE_AT_ASN]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
611 (((((use_arg_then2 ("derivative_asn", [derivative_asn]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
612 ];;
613
614 (* Lemma derivative_compose_matan *)
615 let derivative_compose_matan = Sections.section_proof []
616 `-- &1 < f x ==>
617 (\x. matan (f x)) real_differentiable atreal x /\
618 derivative (\x. matan (f x)) x = dmatan (f x) * derivative f x`
619 [
620 ((BETA_TAC THEN (move ["f_ineq"])) THEN (split_tac));
621 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`matan`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac)));
622 (((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("matan_differentiable", [matan_differentiable]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
623 ((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("matan_differentiable", [matan_differentiable]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
624 (((((use_arg_then2 ("derivative_matan", [derivative_matan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
625 ];;
626
627 (* Finalization of the section ElementaryCompose *)
628 let REAL_DIFFERENTIABLE_AT_INV = Sections.finalize_theorem REAL_DIFFERENTIABLE_AT_INV;;
629 let REAL_DIFFERENTIABLE_AT_ABS_POS = Sections.finalize_theorem REAL_DIFFERENTIABLE_AT_ABS_POS;;
630 let REAL_DIFFERENTIABLE_AT_ABS_NEG = Sections.finalize_theorem REAL_DIFFERENTIABLE_AT_ABS_NEG;;
631 let derivative_compose_abs_pos = Sections.finalize_theorem derivative_compose_abs_pos;;
632 let derivative_compose_abs_neg = Sections.finalize_theorem derivative_compose_abs_neg;;
633 let derivative_compose_pow = Sections.finalize_theorem derivative_compose_pow;;
634 let derivative_compose_pow2 = Sections.finalize_theorem derivative_compose_pow2;;
635 let derivative_compose_pow3 = Sections.finalize_theorem derivative_compose_pow3;;
636 let derivative_compose_atn = Sections.finalize_theorem derivative_compose_atn;;
637 let derivative_compose_exp = Sections.finalize_theorem derivative_compose_exp;;
638 let derivative_compose_log = Sections.finalize_theorem derivative_compose_log;;
639 let derivative_compose_cos = Sections.finalize_theorem derivative_compose_cos;;
640 let derivative_compose_sin = Sections.finalize_theorem derivative_compose_sin;;
641 let derivative_compose_inv = Sections.finalize_theorem derivative_compose_inv;;
642 let derivative_compose_sqrt = Sections.finalize_theorem derivative_compose_sqrt;;
643 let derivative_compose_acs = Sections.finalize_theorem derivative_compose_acs;;
644 let derivative_compose_asn = Sections.finalize_theorem derivative_compose_asn;;
645 let derivative_compose_matan = Sections.finalize_theorem derivative_compose_matan;;
646 Sections.end_section "ElementaryCompose";;
647
648 (* Finalization of the section ElementaryDerivatives *)
649 let HAS_REAL_DERIVATIVE_ABS_POS = Sections.finalize_theorem HAS_REAL_DERIVATIVE_ABS_POS;;
650 let HAS_REAL_DERIVATIVE_ABS_NEG = Sections.finalize_theorem HAS_REAL_DERIVATIVE_ABS_NEG;;
651 let derivative_x = Sections.finalize_theorem derivative_x;;
652 let derivative_const = Sections.finalize_theorem derivative_const;;
653 let derivative_abs_pos = Sections.finalize_theorem derivative_abs_pos;;
654 let derivative_abs_neg = Sections.finalize_theorem derivative_abs_neg;;
655 let derivative_pow_x = Sections.finalize_theorem derivative_pow_x;;
656 let derivative_pow2_x = Sections.finalize_theorem derivative_pow2_x;;
657 let derivative_pow3_x = Sections.finalize_theorem derivative_pow3_x;;
658 let derivative_inv = Sections.finalize_theorem derivative_inv;;
659 let derivative_atn = Sections.finalize_theorem derivative_atn;;
660 let derivative_exp = Sections.finalize_theorem derivative_exp;;
661 let derivative_log = Sections.finalize_theorem derivative_log;;
662 let derivative_sin = Sections.finalize_theorem derivative_sin;;
663 let derivative_cos = Sections.finalize_theorem derivative_cos;;
664 let derivative_asn = Sections.finalize_theorem derivative_asn;;
665 let derivative_acs = Sections.finalize_theorem derivative_acs;;
666 let derivative_sqrt = Sections.finalize_theorem derivative_sqrt;;
667 let derivative_matan = Sections.finalize_theorem derivative_matan;;
668 let matan_differentiable = Sections.finalize_theorem matan_differentiable;;
669 let derivative_composition = Sections.finalize_theorem derivative_composition;;
670 let REAL_DIFFERENTIABLE_AT_INV = Sections.finalize_theorem REAL_DIFFERENTIABLE_AT_INV;;
671 let REAL_DIFFERENTIABLE_AT_ABS_POS = Sections.finalize_theorem REAL_DIFFERENTIABLE_AT_ABS_POS;;
672 let REAL_DIFFERENTIABLE_AT_ABS_NEG = Sections.finalize_theorem REAL_DIFFERENTIABLE_AT_ABS_NEG;;
673 let derivative_compose_abs_pos = Sections.finalize_theorem derivative_compose_abs_pos;;
674 let derivative_compose_abs_neg = Sections.finalize_theorem derivative_compose_abs_neg;;
675 let derivative_compose_pow = Sections.finalize_theorem derivative_compose_pow;;
676 let derivative_compose_pow2 = Sections.finalize_theorem derivative_compose_pow2;;
677 let derivative_compose_pow3 = Sections.finalize_theorem derivative_compose_pow3;;
678 let derivative_compose_atn = Sections.finalize_theorem derivative_compose_atn;;
679 let derivative_compose_exp = Sections.finalize_theorem derivative_compose_exp;;
680 let derivative_compose_log = Sections.finalize_theorem derivative_compose_log;;
681 let derivative_compose_cos = Sections.finalize_theorem derivative_compose_cos;;
682 let derivative_compose_sin = Sections.finalize_theorem derivative_compose_sin;;
683 let derivative_compose_inv = Sections.finalize_theorem derivative_compose_inv;;
684 let derivative_compose_sqrt = Sections.finalize_theorem derivative_compose_sqrt;;
685 let derivative_compose_acs = Sections.finalize_theorem derivative_compose_acs;;
686 let derivative_compose_asn = Sections.finalize_theorem derivative_compose_asn;;
687 let derivative_compose_matan = Sections.finalize_theorem derivative_compose_matan;;
688 Sections.end_section "ElementaryDerivatives";;
689 (Sections.add_section_var (mk_var ("f", (`:real -> real`))); Sections.add_section_var (mk_var ("g", (`:real -> real`))));;
690 (Sections.add_section_var (mk_var ("x", (`:real`))); Sections.add_section_var (mk_var ("c", (`:real`))));;
691 (Sections.add_section_hyp "df" (`f real_differentiable atreal x`));;
692
693 (* Lemma derivative_scale *)
694 let derivative_scale = Sections.section_proof []
695 `derivative (\x. c * f x) x = c * derivative f x`
696 [
697 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_LMUL_ATREAL", [HAS_REAL_DERIVATIVE_LMUL_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
698 ];;
699
700 (* Lemma derivative_neg *)
701 let derivative_neg = Sections.section_proof []
702 `derivative (\x. -- f x) x = -- derivative f x`
703 [
704 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_NEG", [HAS_REAL_DERIVATIVE_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
705 ];;
706
707 (* Lemma derivative_pow *)
708 let derivative_pow = Sections.section_proof ["n"]
709 `derivative (\x. f x pow n) x = &n * f x pow (n - 1) * derivative f x`
710 [
711 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_POW_ATREAL", [HAS_REAL_DERIVATIVE_POW_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
712 ];;
713 (Sections.add_section_hyp "dg" (`g real_differentiable atreal x`));;
714
715 (* Lemma derivative_add *)
716 let derivative_add = Sections.section_proof []
717 `derivative (\x. f x + g x) x = derivative f x + derivative g x`
718 [
719 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_ADD", [HAS_REAL_DERIVATIVE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
720 ];;
721
722 (* Lemma derivative_mul *)
723 let derivative_mul = Sections.section_proof []
724 `derivative (\x. f x * g x) x = f x * derivative g x + derivative f x * g x`
725 [
726 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_MUL_ATREAL", [HAS_REAL_DERIVATIVE_MUL_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
727 ];;
728
729 (* Lemma derivative_sub *)
730 let derivative_sub = Sections.section_proof []
731 `derivative (\x. f x - g x) x = derivative f x - derivative g x`
732 [
733 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_SUB", [HAS_REAL_DERIVATIVE_SUB]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
734 ];;
735
736 (* Lemma derivative_div *)
737 let derivative_div = Sections.section_proof []
738 `~(g x = &0) ==>
739 derivative (\x. f x / g x) x = (derivative f x * g x - f x * derivative g x) / (g x * g x)`
740 [
741 ((BETA_TAC THEN (move ["gn0"])) THEN (((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_DIV_ATREAL", [HAS_REAL_DERIVATIVE_DIV_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
742 ((repeat_tactic 1 9 (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
743 ];;
744
745 (* Finalization of the section DerivativeArith *)
746 let HAS_REAL_DERIVATIVE_ABS_POS = Sections.finalize_theorem HAS_REAL_DERIVATIVE_ABS_POS;;
747 let HAS_REAL_DERIVATIVE_ABS_NEG = Sections.finalize_theorem HAS_REAL_DERIVATIVE_ABS_NEG;;
748 let derivative_x = Sections.finalize_theorem derivative_x;;
749 let derivative_const = Sections.finalize_theorem derivative_const;;
750 let derivative_abs_pos = Sections.finalize_theorem derivative_abs_pos;;
751 let derivative_abs_neg = Sections.finalize_theorem derivative_abs_neg;;
752 let derivative_pow_x = Sections.finalize_theorem derivative_pow_x;;
753 let derivative_pow2_x = Sections.finalize_theorem derivative_pow2_x;;
754 let derivative_pow3_x = Sections.finalize_theorem derivative_pow3_x;;
755 let derivative_inv = Sections.finalize_theorem derivative_inv;;
756 let derivative_atn = Sections.finalize_theorem derivative_atn;;
757 let derivative_exp = Sections.finalize_theorem derivative_exp;;
758 let derivative_log = Sections.finalize_theorem derivative_log;;
759 let derivative_sin = Sections.finalize_theorem derivative_sin;;
760 let derivative_cos = Sections.finalize_theorem derivative_cos;;
761 let derivative_asn = Sections.finalize_theorem derivative_asn;;
762 let derivative_acs = Sections.finalize_theorem derivative_acs;;
763 let derivative_sqrt = Sections.finalize_theorem derivative_sqrt;;
764 let derivative_matan = Sections.finalize_theorem derivative_matan;;
765 let matan_differentiable = Sections.finalize_theorem matan_differentiable;;
766 let derivative_composition = Sections.finalize_theorem derivative_composition;;
767 let REAL_DIFFERENTIABLE_AT_INV = Sections.finalize_theorem REAL_DIFFERENTIABLE_AT_INV;;
768 let REAL_DIFFERENTIABLE_AT_ABS_POS = Sections.finalize_theorem REAL_DIFFERENTIABLE_AT_ABS_POS;;
769 let REAL_DIFFERENTIABLE_AT_ABS_NEG = Sections.finalize_theorem REAL_DIFFERENTIABLE_AT_ABS_NEG;;
770 let derivative_compose_abs_pos = Sections.finalize_theorem derivative_compose_abs_pos;;
771 let derivative_compose_abs_neg = Sections.finalize_theorem derivative_compose_abs_neg;;
772 let derivative_compose_pow = Sections.finalize_theorem derivative_compose_pow;;
773 let derivative_compose_pow2 = Sections.finalize_theorem derivative_compose_pow2;;
774 let derivative_compose_pow3 = Sections.finalize_theorem derivative_compose_pow3;;
775 let derivative_compose_atn = Sections.finalize_theorem derivative_compose_atn;;
776 let derivative_compose_exp = Sections.finalize_theorem derivative_compose_exp;;
777 let derivative_compose_log = Sections.finalize_theorem derivative_compose_log;;
778 let derivative_compose_cos = Sections.finalize_theorem derivative_compose_cos;;
779 let derivative_compose_sin = Sections.finalize_theorem derivative_compose_sin;;
780 let derivative_compose_inv = Sections.finalize_theorem derivative_compose_inv;;
781 let derivative_compose_sqrt = Sections.finalize_theorem derivative_compose_sqrt;;
782 let derivative_compose_acs = Sections.finalize_theorem derivative_compose_acs;;
783 let derivative_compose_asn = Sections.finalize_theorem derivative_compose_asn;;
784 let derivative_compose_matan = Sections.finalize_theorem derivative_compose_matan;;
785 let derivative_scale = Sections.finalize_theorem derivative_scale;;
786 let derivative_neg = Sections.finalize_theorem derivative_neg;;
787 let derivative_pow = Sections.finalize_theorem derivative_pow;;
788 let derivative_add = Sections.finalize_theorem derivative_add;;
789 let derivative_mul = Sections.finalize_theorem derivative_mul;;
790 let derivative_sub = Sections.finalize_theorem derivative_sub;;
791 let derivative_div = Sections.finalize_theorem derivative_div;;
792 Sections.end_section "DerivativeArith";;
793
794 (* Section MoreDerivativeArith *)
795 Sections.begin_section "MoreDerivativeArith";;
796
797 (* Lemma differentiable_sum_numseg *)
798 let differentiable_sum_numseg = Sections.section_proof ["G";"n";"m";"x"]
799 `(!i. i IN n..m ==> G i real_differentiable atreal x) ==>
800 (\x. sum (n..m) (\i. G i x)) real_differentiable atreal x`
801 [
802 ((((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))]) THEN (move ["dG"])) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL SUM_CLAUSES_NUMSEG)))(thm_tac (new_rewrite [] []))))));
803 ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n = 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["n_eq_0"])) THEN ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))));
804 (((((use_arg_then2 ("dG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_eq_0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
805 ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n <= SUC m`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["n_le_Sm"])));
806 ((((use_arg_then2 ("IHm", [])) (disch_tac [])) THEN (clear_assumption "IHm") THEN (DISCH_THEN apply_tac) THEN (move ["i"]) THEN (move ["i_in"])) THEN (((use_arg_then2 ("dG", [])) (disch_tac [])) THEN (clear_assumption "dG") THEN (DISCH_THEN apply_tac)));
807 ((((use_arg_then2 ("i_in", [])) (disch_tac [])) THEN (clear_assumption "i_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
808 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_ADD", [REAL_DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((use_arg_then2 ("dG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IHm", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("n_le_Sm", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
809 ((BETA_TAC THEN (move ["i"]) THEN (move ["ineq"])) THEN (((use_arg_then2 ("dG", [])) (disch_tac [])) THEN (clear_assumption "dG") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))));
810 ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
811 ];;
812
813 (* Lemma derivative_sum_numseg *)
814 let derivative_sum_numseg = Sections.section_proof ["G";"n";"m";"x"]
815 `(!i. i IN n..m ==> G i real_differentiable atreal x) ==>
816 derivative (\x. sum (n..m) (\i. G i x)) x = sum (n..m) (\i. derivative (G i) x)`
817 [
818 ((((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))]) THEN (move ["dG"])) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL SUM_CLAUSES_NUMSEG)))(thm_tac (new_rewrite [] []))))));
819 ((((fun arg_tac -> arg_tac (Arg_term (`n = 0`))) (disch_tac [])) THEN case THEN (simp_tac)) THEN ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("derivative_const", [derivative_const]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac));
820 ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n <= SUC m`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["n_le_Sm"])));
821 ((((use_arg_then2 ("IHm", [])) (disch_tac [])) THEN (clear_assumption "IHm") THEN (DISCH_THEN apply_tac) THEN (move ["i"]) THEN (move ["i_in"])) THEN (((use_arg_then2 ("dG", [])) (disch_tac [])) THEN (clear_assumption "dG") THEN (DISCH_THEN apply_tac)));
822 ((((use_arg_then2 ("i_in", [])) (disch_tac [])) THEN (clear_assumption "i_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
823 (((use_arg_then2 ("IHm", []))(gsym_then (thm_tac (new_rewrite [] [])))));
824 ((BETA_TAC THEN (move ["i"]) THEN (move ["i_in"])) THEN (((use_arg_then2 ("dG", [])) (disch_tac [])) THEN (clear_assumption "dG") THEN (DISCH_THEN apply_tac)));
825 ((((use_arg_then2 ("i_in", [])) (disch_tac [])) THEN (clear_assumption "i_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac));
826 ((((use_arg_then2 ("derivative_add", [derivative_add]))(thm_tac (new_rewrite [] [])))) THEN ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))));
827 (((((use_arg_then2 ("dG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("differentiable_sum_numseg", [differentiable_sum_numseg]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_in"]));
828 ((((use_arg_then2 ("dG", [])) (disch_tac [])) THEN (clear_assumption "dG") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("i_in", [])) (disch_tac [])) THEN (clear_assumption "i_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
829 ];;
830
831 (* Finalization of the section MoreDerivativeArith *)
832 let differentiable_sum_numseg = Sections.finalize_theorem differentiable_sum_numseg;;
833 let derivative_sum_numseg = Sections.finalize_theorem derivative_sum_numseg;;
834 Sections.end_section "MoreDerivativeArith";;
835
836 (* Lemma HAS_REAL_DERIVATIVE_LOCAL *)
837 let HAS_REAL_DERIVATIVE_LOCAL = Sections.section_proof ["f";"g";"x";"g'"]
838 `(g has_real_derivative g') (atreal x) /\
839 (?s. real_open s /\ x IN s /\ (!y. y IN s ==> f y = g y))
840 ==> (f has_real_derivative g') (atreal x)`
841 [
842 (BETA_TAC THEN (case THEN (move ["dg"])) THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["f_eq_g"]));
843 ((((use_arg_then2 ("dg", [])) (disch_tac [])) THEN (clear_assumption "dg") THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("HAS_REAL_DERIVATIVE_WITHIN_REAL_OPEN", [HAS_REAL_DERIVATIVE_WITHIN_REAL_OPEN])) (fun fst_arg -> (use_arg_then2 ("open_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (move ["dg"])));
844 (((fun arg_tac -> (use_arg_then2 ("HAS_REAL_DERIVATIVE_TRANSFORM_WITHIN", [HAS_REAL_DERIVATIVE_TRANSFORM_WITHIN])) (fun fst_arg -> (use_arg_then2 ("dg", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
845 (((fun arg_tac -> arg_tac (Arg_term (`&1`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("REAL_LT_01", [REAL_LT_01]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("f_eq_g", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
846 ];;
847
848 (* Lemma differentiable_local *)
849 let differentiable_local = Sections.section_proof ["f";"g";"x";"s"]
850 `g real_differentiable atreal x /\ real_open s /\ x IN s /\
851 (!y. y IN s ==> f y = g y) ==> f real_differentiable atreal x`
852 [
853 ((repeat_tactic 1 9 (((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["f'"])) THEN (move ["dg"]) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["eq"]));
854 (((use_arg_then2 ("f'", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)));
855 (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (done_tac));
856 ];;
857
858 (* Section NthDerivativeArith *)
859 Sections.begin_section "NthDerivativeArith";;
860 (Sections.add_section_var (mk_var ("f", (`:real->real`))); Sections.add_section_var (mk_var ("g", (`:real->real`))));;
861 (Sections.add_section_var (mk_var ("int", (`:real#real`))));;
862 (Sections.add_section_var (mk_var ("n", (`:num`))));;
863 (Sections.add_section_hyp "df" (`nth_diff_strong_int n int f`));;
864
865 (* Lemma nth_derivative_scale_strong *)
866 let nth_derivative_scale_strong = Sections.section_proof ["c";"i";"x"]
867 `interval_arith x int ==> i <= n ==>
868 ?s. real_open s /\ x IN s /\
869 !y. y IN s ==> nth_derivative i (\y. c * f y) y = c * nth_derivative i f y`
870 [
871 ((((use_arg_then2 ("df", [])) (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN (((((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] []))))) THEN (move ["df"])));
872 (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("df", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"]))) THEN (((((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_differentiable_eq", [nth_differentiable_eq]))(thm_tac (new_rewrite [] []))))) THEN (move ["diff"])));
873 ((THENL_FIRST) ((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN elim) [(move ["_"]); ((move ["i"]) THEN (move ["IHi"]))]) ((repeat_tactic 1 9 (((use_arg_then2 ("nth_derivative0", [nth_derivative0]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (done_tac)));
874 (((((use_arg_then2 ("nth_derivativeS", [nth_derivativeS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["i_lt_n"]));
875 ((((fun arg_tac -> (use_arg_then2 ("IHi", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ltnW", [ltnW])) (fun fst_arg -> (use_arg_then2 ("i_lt_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["eq"])) THEN (((use_arg_then2 ("IHi", [])) (disch_tac [])) THEN (clear_assumption "IHi") THEN BETA_TAC THEN (move ["_"])));
876 (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))));
877 (((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac));
878 (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac));
879 ((fun arg_tac -> arg_tac (Arg_term (`\y. c * nth_derivative i f y`))) (term_tac exists_tac));
880 ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_LMUL_ATREAL", [HAS_REAL_DERIVATIVE_LMUL_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
881 ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((fun arg_tac -> (use_arg_then2 ("diff", [])) (fun fst_arg -> (use_arg_then2 ("ys", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
882 (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("yt", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (move ["z_in"]) THEN (simp_tac)));
883 ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
884 ];;
885
886 (* Lemma nth_derivative_scale_strong_all *)
887 let nth_derivative_scale_strong_all = Sections.section_proof ["c";"x"]
888 `interval_arith x int ==>
889 ?s. real_open s /\ x IN s /\
890 !i y. i <= n /\ y IN s ==> nth_derivative i (\y. c * f y) y = c * nth_derivative i f y`
891 [
892 (BETA_TAC THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("nth_derivative_scale_strong", [nth_derivative_scale_strong])) (fun fst_arg -> (use_arg_then2 ("c", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"]));
893 ((fun arg_tac -> arg_tac (Arg_term (`\i s. real_open s /\ x IN s /\
894 (!y. y IN s ==> nth_derivative i (\y. c * f y) y = c * nth_derivative i f y)`))) (term_tac (set_tac "P")));
895 ((fun arg_tac -> arg_tac (Arg_term (`!i. i <= n:num ==> P i ((@) (P i))`))) (term_tac (have_gen_tac [](move ["sel_P"]))));
896 ((BETA_TAC THEN (move ["i"]) THEN (move ["i_le_n"])) THEN ((use_arg_then2 ("SELECT_AX", [SELECT_AX])) (thm_tac apply_tac)));
897 (((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("i_le_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["cond"]));
898 (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac));
899 ((fun arg_tac -> arg_tac (Arg_term (`INTERS (IMAGE (\i. (@) (P i)) (0..n))`))) (term_tac (set_tac "S")));
900 ((use_arg_then2 ("S", [])) (term_tac exists_tac));
901 ((((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_OPEN_INTERS", [REAL_OPEN_INTERS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
902 ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("IN_NUMSEG_0", [IN_NUMSEG_0]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("sel_P", [])) (thm_tac (match_mp_then snd_th MP_TAC))))));
903 (((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac));
904 (((repeat_tactic 1 9 (((use_arg_then2 ("IN_INTERS", [IN_INTERS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac));
905 ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("IN_NUMSEG_0", [IN_NUMSEG_0]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("sel_P", [])) (thm_tac (match_mp_then snd_th MP_TAC))))));
906 (((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac));
907 (BETA_TAC THEN (move ["i"]) THEN (move ["y"]) THEN (case THEN (move ["i_le_n"])));
908 ((((fun arg_tac -> (use_arg_then2 ("sel_P", [])) (fun fst_arg -> (use_arg_then2 ("i_le_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["y_in"]) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@) (P i)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))));
909 ((THENL_FIRST) (ANTS_TAC) (((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("IN_NUMSEG_0", [IN_NUMSEG_0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
910 (((use_arg_then2 ("y_in", [])) (disch_tac [])) THEN (clear_assumption "y_in") THEN (exact_tac));
911 ];;
912
913 (* Lemma nth_derivative_scale *)
914 let nth_derivative_scale = Sections.section_proof ["c";"i";"x"]
915 `interval_arith x int ==> i <= n ==>
916 nth_derivative i (\x. c * f x) x = c * nth_derivative i f x`
917 [
918 (BETA_TAC THEN (move ["ineq"]) THEN (move ["i_le_n"]));
919 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_derivative_scale_strong", [nth_derivative_scale_strong])) (fun fst_arg -> (use_arg_then2 ("c", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i_le_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
920 (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"])) THEN (move ["h"]));
921 (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac));
922 ];;
923
924 (* Lemma nth_diff_scale *)
925 let nth_diff_scale = Sections.section_proof ["c"]
926 `nth_diff_strong_int n int (\x. c * f x)`
927 [
928 ((((use_arg_then2 ("df", [])) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_eq", [nth_differentiable_eq]))(thm_tac (new_rewrite [] [])))))));
929 (BETA_TAC THEN (move ["df"]) THEN (move ["x"]) THEN (move ["ineq"]));
930 ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_derivative_scale_strong_all", [nth_derivative_scale_strong_all])) (fun fst_arg -> (use_arg_then2 ("c", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
931 (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["diff"]));
932 (((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["diff2"]));
933 (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("xt", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))));
934 (((((use_arg_then2 ("REAL_CONTINUOUS_LMUL", [REAL_CONTINUOUS_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_lt_n"]));
935 ((((use_arg_then2 ("diff", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)));
936 (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac));
937 ((fun arg_tac -> arg_tac (Arg_term (`(\y. c * nth_derivative i f y)`))) (term_tac exists_tac));
938 ((THENL_FIRST) ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_LMUL_ATREAL", [HAS_REAL_DERIVATIVE_LMUL_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((fun arg_tac -> (use_arg_then2 ("diff2", [])) (fun fst_arg -> (use_arg_then2 ("yt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
939 (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (move ["zs"]) THEN (simp_tac)));
940 ((((use_arg_then2 ("diff", [])) (disch_tac [])) THEN (clear_assumption "diff") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
941 ];;
942 (Sections.add_section_hyp "dg" (`nth_diff_strong_int n int g`));;
943
944 (* Lemma nth_derivative_add_strong *)
945 let nth_derivative_add_strong = Sections.section_proof ["i";"x"]
946 `interval_arith x int ==> i <= n ==>
947 ?s. real_open s /\ x IN s /\
948 !y. y IN s ==> nth_derivative i (\y. f y + g y) y = nth_derivative i f y + nth_derivative i g y`
949 [
950 ((((use_arg_then2 ("dg", [])) (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then2 ("df", [])) (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] [])))))) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["ineq"])));
951 ((((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["sf"])) THEN (case THEN (move ["open_sf"])) THEN (case THEN (move ["xsf"]))) THEN (((use_arg_then2 ("df", [])) (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC THEN (move ["_"])));
952 ((((fun arg_tac -> (use_arg_then2 ("dg", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["sg"])) THEN (case THEN (move ["open_sg"])) THEN (case THEN (move ["xsg"]))) THEN (((use_arg_then2 ("dg", [])) (disch_tac [])) THEN (clear_assumption "dg") THEN BETA_TAC THEN (move ["_"])));
953 (((repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_eq", [nth_differentiable_eq]))(thm_tac (new_rewrite [] [])))))) THEN (move ["diff_g"]) THEN (move ["diff_f"]));
954 ((THENL_FIRST) ((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN elim) [(move ["_"]); ((move ["i"]) THEN (move ["IHi"]))]) ((repeat_tactic 1 9 (((use_arg_then2 ("nth_derivative0", [nth_derivative0]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("sf", [])) (term_tac exists_tac)) THEN (done_tac)));
955 (((((use_arg_then2 ("nth_derivativeS", [nth_derivativeS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["i_lt_n"]));
956 ((((fun arg_tac -> (use_arg_then2 ("IHi", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ltnW", [ltnW])) (fun fst_arg -> (use_arg_then2 ("i_lt_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["eq"])) THEN (((use_arg_then2 ("IHi", [])) (disch_tac [])) THEN (clear_assumption "IHi") THEN BETA_TAC THEN (move ["_"])));
957 ((fun arg_tac -> arg_tac (Arg_term (`sf INTER sg INTER t`))) (term_tac exists_tac));
958 (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xsf", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xsg", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (case THEN (move ["ysf"])) THEN (case THEN ((move ["ysg"]) THEN (move ["yt"]))));
959 (((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac));
960 (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac));
961 ((fun arg_tac -> arg_tac (Arg_term (`(\y. nth_derivative i f y + nth_derivative i g y)`))) (term_tac exists_tac));
962 ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_ADD", [HAS_REAL_DERIVATIVE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
963 ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((fun arg_tac -> (use_arg_then2 ("diff_f", [])) (fun fst_arg -> (use_arg_then2 ("ysf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("diff_g", [])) (fun fst_arg -> (use_arg_then2 ("ysg", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
964 (((fun arg_tac -> arg_tac (Arg_term (`sf INTER sg INTER t`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("yt", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("ysf", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("ysg", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))));
965 ((BETA_TAC THEN (move ["z"]) THEN (move ["z_in"]) THEN (simp_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
966 ];;
967
968 (* Lemma nth_derivative_add_strong_all *)
969 let nth_derivative_add_strong_all = Sections.section_proof ["x"]
970 `interval_arith x int ==>
971 ?s. real_open s /\ x IN s /\
972 !i y. i <= n /\ y IN s ==>
973 nth_derivative i (\y. f y + g y) y = nth_derivative i f y + nth_derivative i g y`
974 [
975 (BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("nth_derivative_add_strong", [nth_derivative_add_strong])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"]));
976 ((fun arg_tac -> arg_tac (Arg_term (`\i s. real_open s /\ x IN s /\
977 (!y. y IN s ==> nth_derivative i (\y. f y + g y) y = nth_derivative i f y + nth_derivative i g y)`))) (term_tac (set_tac "P")));
978 ((fun arg_tac -> arg_tac (Arg_term (`!i. i <= n:num ==> P i ((@) (P i))`))) (term_tac (have_gen_tac [](move ["sel_P"]))));
979 ((BETA_TAC THEN (move ["i"]) THEN (move ["i_le_n"])) THEN ((use_arg_then2 ("SELECT_AX", [SELECT_AX])) (thm_tac apply_tac)));
980 (((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("i_le_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["cond"]));
981 (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac));
982 ((fun arg_tac -> arg_tac (Arg_term (`INTERS (IMAGE (\i. (@) (P i)) (0..n))`))) (term_tac (set_tac "S")));
983 ((use_arg_then2 ("S", [])) (term_tac exists_tac));
984 ((((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_OPEN_INTERS", [REAL_OPEN_INTERS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
985 ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("IN_NUMSEG_0", [IN_NUMSEG_0]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("sel_P", [])) (thm_tac (match_mp_then snd_th MP_TAC))))));
986 (((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac));
987 (((repeat_tactic 1 9 (((use_arg_then2 ("IN_INTERS", [IN_INTERS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac));
988 ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("IN_NUMSEG_0", [IN_NUMSEG_0]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("sel_P", [])) (thm_tac (match_mp_then snd_th MP_TAC))))));
989 (((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac));
990 (BETA_TAC THEN (move ["i"]) THEN (move ["y"]) THEN (case THEN (move ["i_le_n"])));
991 ((((fun arg_tac -> (use_arg_then2 ("sel_P", [])) (fun fst_arg -> (use_arg_then2 ("i_le_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["y_in"]) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@) (P i)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))));
992 ((THENL_FIRST) (ANTS_TAC) (((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("IN_NUMSEG_0", [IN_NUMSEG_0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
993 (((use_arg_then2 ("y_in", [])) (disch_tac [])) THEN (clear_assumption "y_in") THEN (exact_tac));
994 ];;
995
996 (* Lemma nth_derivative_add *)
997 let nth_derivative_add = Sections.section_proof ["i";"x"]
998 `interval_arith x int ==> i <= n ==>
999 nth_derivative i (\x. f x + g x) x = nth_derivative i f x + nth_derivative i g x`
1000 [
1001 (BETA_TAC THEN (move ["ineq"]) THEN (move ["i_le_n"]));
1002 ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_derivative_add_strong", [nth_derivative_add_strong])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i_le_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1003 (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"])) THEN (move ["h"]));
1004 (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac));
1005 ];;
1006
1007 (* Lemma nth_diff_add *)
1008 let nth_diff_add = Sections.section_proof []
1009 `nth_diff_strong_int n int (\x. f x + g x)`
1010 [
1011 (((use_arg_then2 ("dg", [])) (disch_tac [])) THEN ((use_arg_then2 ("df", [])) (disch_tac [])) THEN BETA_TAC);
1012 ((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_eq", [nth_differentiable_eq]))(thm_tac (new_rewrite [] []))))));
1013 (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["x"]) THEN (move ["ineq"]));
1014 ((fun arg_tac -> (use_arg_then2 ("nth_derivative_add_strong_all", [nth_derivative_add_strong_all])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1015 (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["diff"]));
1016 (((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["tf"])) THEN (case THEN (move ["open_tf"])) THEN (case THEN (move ["xtf"])) THEN (move ["diff_f"]));
1017 (((fun arg_tac -> (use_arg_then2 ("dg", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["tg"])) THEN (case THEN (move ["open_tg"])) THEN (case THEN (move ["xtg"])) THEN (move ["diff_g"]));
1018 (((fun arg_tac -> arg_tac (Arg_term (`s INTER tf INTER tg`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("xtf", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("xtg", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))));
1019 (BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (case THEN ((move ["ytf"]) THEN (move ["ytg"]))))));
1020 (((((use_arg_then2 ("REAL_CONTINUOUS_ADD", [REAL_CONTINUOUS_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff_f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff_g", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_lt_n"]));
1021 ((((use_arg_then2 ("diff", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)));
1022 (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac));
1023 ((fun arg_tac -> arg_tac (Arg_term (`(\y. nth_derivative i f y + nth_derivative i g y)`))) (term_tac exists_tac));
1024 ((THENL_FIRST) ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_ADD", [HAS_REAL_DERIVATIVE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((fun arg_tac -> (use_arg_then2 ("diff_f", [])) (fun fst_arg -> (use_arg_then2 ("ytf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("diff_g", [])) (fun fst_arg -> (use_arg_then2 ("ytg", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
1025 (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (move ["zs"]) THEN (simp_tac)));
1026 ((((use_arg_then2 ("diff", [])) (disch_tac [])) THEN (clear_assumption "diff") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1027 ];;
1028
1029 (* Lemma nth_derivative_sub_strong *)
1030 let nth_derivative_sub_strong = Sections.section_proof ["i";"x"]
1031 `interval_arith x int ==> i <= n ==>
1032 ?s. real_open s /\ x IN s /\
1033 !y. y IN s ==> nth_derivative i (\y. f y - g y) y = nth_derivative i f y - nth_derivative i g y`
1034 [
1035 ((((use_arg_then2 ("dg", [])) (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then2 ("df", [])) (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] [])))))) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["ineq"])));
1036 ((((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["sf"])) THEN (case THEN (move ["open_sf"])) THEN (case THEN (move ["xsf"]))) THEN (((use_arg_then2 ("df", [])) (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC THEN (move ["_"])));
1037 ((((fun arg_tac -> (use_arg_then2 ("dg", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["sg"])) THEN (case THEN (move ["open_sg"])) THEN (case THEN (move ["xsg"]))) THEN (((use_arg_then2 ("dg", [])) (disch_tac [])) THEN (clear_assumption "dg") THEN BETA_TAC THEN (move ["_"])));
1038 (((repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_eq", [nth_differentiable_eq]))(thm_tac (new_rewrite [] [])))))) THEN (move ["diff_g"]) THEN (move ["diff_f"]));
1039 ((THENL_FIRST) ((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN elim) [(move ["_"]); ((move ["i"]) THEN (move ["IHi"]))]) ((repeat_tactic 1 9 (((use_arg_then2 ("nth_derivative0", [nth_derivative0]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("sf", [])) (term_tac exists_tac)) THEN (done_tac)));
1040 (((((use_arg_then2 ("nth_derivativeS", [nth_derivativeS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["i_lt_n"]));
1041 ((((fun arg_tac -> (use_arg_then2 ("IHi", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ltnW", [ltnW])) (fun fst_arg -> (use_arg_then2 ("i_lt_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["eq"])) THEN (((use_arg_then2 ("IHi", [])) (disch_tac [])) THEN (clear_assumption "IHi") THEN BETA_TAC THEN (move ["_"])));
1042 ((fun arg_tac -> arg_tac (Arg_term (`sf INTER sg INTER t`))) (term_tac exists_tac));
1043 (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xsf", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xsg", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (case THEN (move ["ysf"])) THEN (case THEN ((move ["ysg"]) THEN (move ["yt"]))));
1044 (((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac));
1045 (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac));
1046 ((fun arg_tac -> arg_tac (Arg_term (`(\y. nth_derivative i f y - nth_derivative i g y)`))) (term_tac exists_tac));
1047 ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_SUB", [HAS_REAL_DERIVATIVE_SUB]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
1048 ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((fun arg_tac -> (use_arg_then2 ("diff_f", [])) (fun fst_arg -> (use_arg_then2 ("ysf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("diff_g", [])) (fun fst_arg -> (use_arg_then2 ("ysg", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1049 (((fun arg_tac -> arg_tac (Arg_term (`sf INTER sg INTER t`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("yt", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("ysf", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("ysg", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))));
1050 ((BETA_TAC THEN (move ["z"]) THEN (move ["z_in"]) THEN (simp_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1051 ];;
1052
1053 (* Lemma nth_derivative_sub_strong_all *)
1054 let nth_derivative_sub_strong_all = Sections.section_proof ["x"]
1055 `interval_arith x int ==>
1056 ?s. real_open s /\ x IN s /\
1057 !i y. i <= n /\ y IN s ==>
1058 nth_derivative i (\y. f y - g y) y = nth_derivative i f y - nth_derivative i g y`
1059 [
1060 (BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("nth_derivative_sub_strong", [nth_derivative_sub_strong])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"]));
1061 ((fun arg_tac -> arg_tac (Arg_term (`\i s. real_open s /\ x IN s /\
1062 (!y. y IN s ==> nth_derivative i (\y. f y - g y) y = nth_derivative i f y - nth_derivative i g y)`))) (term_tac (set_tac "P")));
1063 ((fun arg_tac -> arg_tac (Arg_term (`!i. i <= n:num ==> P i ((@) (P i))`))) (term_tac (have_gen_tac [](move ["sel_P"]))));
1064 ((BETA_TAC THEN (move ["i"]) THEN (move ["i_le_n"])) THEN ((use_arg_then2 ("SELECT_AX", [SELECT_AX])) (thm_tac apply_tac)));
1065 (((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("i_le_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["cond"]));
1066 (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac));
1067 ((fun arg_tac -> arg_tac (Arg_term (`INTERS (IMAGE (\i. (@) (P i)) (0..n))`))) (term_tac (set_tac "S")));
1068 ((use_arg_then2 ("S", [])) (term_tac exists_tac));
1069 ((((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_OPEN_INTERS", [REAL_OPEN_INTERS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
1070 ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("IN_NUMSEG_0", [IN_NUMSEG_0]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("sel_P", [])) (thm_tac (match_mp_then snd_th MP_TAC))))));
1071 (((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac));
1072 (((repeat_tactic 1 9 (((use_arg_then2 ("IN_INTERS", [IN_INTERS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac));
1073 ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("IN_NUMSEG_0", [IN_NUMSEG_0]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("sel_P", [])) (thm_tac (match_mp_then snd_th MP_TAC))))));
1074 (((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac));
1075 (BETA_TAC THEN (move ["i"]) THEN (move ["y"]) THEN (case THEN (move ["i_le_n"])));
1076 ((((fun arg_tac -> (use_arg_then2 ("sel_P", [])) (fun fst_arg -> (use_arg_then2 ("i_le_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["y_in"]) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@) (P i)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))));
1077 ((THENL_FIRST) (ANTS_TAC) (((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("IN_NUMSEG_0", [IN_NUMSEG_0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
1078 (((use_arg_then2 ("y_in", [])) (disch_tac [])) THEN (clear_assumption "y_in") THEN (exact_tac));
1079 ];;
1080
1081 (* Lemma nth_derivative_sub *)
1082 let nth_derivative_sub = Sections.section_proof ["i";"x"]
1083 `interval_arith x int ==> i <= n ==>
1084 nth_derivative i (\x. f x - g x) x = nth_derivative i f x - nth_derivative i g x`
1085 [
1086 (BETA_TAC THEN (move ["ineq"]) THEN (move ["i_le_n"]));
1087 ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_derivative_sub_strong", [nth_derivative_sub_strong])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i_le_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1088 (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"])) THEN (move ["h"]));
1089 (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac));
1090 ];;
1091
1092 (* Lemma nth_diff_sub *)
1093 let nth_diff_sub = Sections.section_proof []
1094 `nth_diff_strong_int n int (\x. f x - g x)`
1095 [
1096 (((use_arg_then2 ("dg", [])) (disch_tac [])) THEN ((use_arg_then2 ("df", [])) (disch_tac [])) THEN BETA_TAC);
1097 ((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_eq", [nth_differentiable_eq]))(thm_tac (new_rewrite [] []))))));
1098 (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["x"]) THEN (move ["ineq"]));
1099 ((fun arg_tac -> (use_arg_then2 ("nth_derivative_sub_strong_all", [nth_derivative_sub_strong_all])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1100 (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["diff"]));
1101 (((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["tf"])) THEN (case THEN (move ["open_tf"])) THEN (case THEN (move ["xtf"])) THEN (move ["diff_f"]));
1102 (((fun arg_tac -> (use_arg_then2 ("dg", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["tg"])) THEN (case THEN (move ["open_tg"])) THEN (case THEN (move ["xtg"])) THEN (move ["diff_g"]));
1103 (((fun arg_tac -> arg_tac (Arg_term (`s INTER tf INTER tg`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("xtf", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("xtg", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))));
1104 (BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (case THEN ((move ["ytf"]) THEN (move ["ytg"]))))));
1105 (((((use_arg_then2 ("REAL_CONTINUOUS_SUB", [REAL_CONTINUOUS_SUB]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff_f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff_g", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_lt_n"]));
1106 ((((use_arg_then2 ("diff", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)));
1107 (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac));
1108 ((fun arg_tac -> arg_tac (Arg_term (`(\y. nth_derivative i f y - nth_derivative i g y)`))) (term_tac exists_tac));
1109 ((THENL_FIRST) ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_SUB", [HAS_REAL_DERIVATIVE_SUB]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((fun arg_tac -> (use_arg_then2 ("diff_f", [])) (fun fst_arg -> (use_arg_then2 ("ytf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("diff_g", [])) (fun fst_arg -> (use_arg_then2 ("ytg", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
1110 (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (move ["zs"]) THEN (simp_tac)));
1111 ((((use_arg_then2 ("diff", [])) (disch_tac [])) THEN (clear_assumption "diff") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1112 ];;
1113
1114 (* Lemma nth_derivative_mul_strong *)
1115 let nth_derivative_mul_strong = Sections.section_proof ["i";"x"]
1116 `interval_arith x int ==> i <= n ==>
1117 ?s. real_open s /\ x IN s /\
1118 !y. y IN s ==> nth_derivative i (\y. f y * g y) y =
1119 sum (0..i) (\k. &(binom (i, k)) * nth_derivative k f y * nth_derivative (i - k) g y)`
1120 [
1121 ((((use_arg_then2 ("dg", [])) (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then2 ("df", [])) (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] [])))))) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["ineq"])));
1122 ((((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["sf"])) THEN (case THEN (move ["open_sf"])) THEN (case THEN (move ["xsf"]))) THEN (((use_arg_then2 ("df", [])) (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC THEN (move ["_"])));
1123 ((((fun arg_tac -> (use_arg_then2 ("dg", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["sg"])) THEN (case THEN (move ["open_sg"])) THEN (case THEN (move ["xsg"]))) THEN (((use_arg_then2 ("dg", [])) (disch_tac [])) THEN (clear_assumption "dg") THEN BETA_TAC THEN (move ["_"])));
1124 (((repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_eq", [nth_differentiable_eq]))(thm_tac (new_rewrite [] [])))))) THEN (move ["diff_g"]) THEN (move ["diff_f"]));
1125 ((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN elim) [(move ["_"]); ((move ["i"]) THEN (move ["IHi"]))]);
1126 (((use_arg_then2 ("sf", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("open_sf", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xsf", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_derivative0", [nth_derivative0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_SING_NUMSEG", [SUM_SING_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (move ["_"]) THEN (simp_tac)));
1127 (((((use_arg_then2 ("subn0", [subn0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_derivative0", [nth_derivative0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("binom", [binom]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1128 (((((use_arg_then2 ("nth_derivativeS", [nth_derivativeS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["i_lt_n"]));
1129 ((((fun arg_tac -> (use_arg_then2 ("IHi", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ltnW", [ltnW])) (fun fst_arg -> (use_arg_then2 ("i_lt_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["eq"])) THEN (((use_arg_then2 ("IHi", [])) (disch_tac [])) THEN (clear_assumption "IHi") THEN BETA_TAC THEN (move ["_"])));
1130 ((fun arg_tac -> arg_tac (Arg_term (`sf INTER sg INTER t`))) (term_tac exists_tac));
1131 (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xsf", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xsg", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (case THEN (move ["ysf"])) THEN (case THEN ((move ["ysg"]) THEN (move ["yt"]))));
1132 (((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac));
1133 (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac));
1134 ((fun arg_tac -> arg_tac (Arg_term (`\y. sum (0..i) (\k. &(binom (i, k)) * nth_derivative k f y * nth_derivative (i - k) g y)`))) (term_tac exists_tac));
1135 ((THENL_ROT (-1)) (split_tac));
1136 (((fun arg_tac -> arg_tac (Arg_term (`sf INTER sg INTER t`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("yt", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("ysf", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("ysg", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))));
1137 ((BETA_TAC THEN (move ["z"]) THEN (move ["z_in"]) THEN (simp_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1138 (((use_arg_then2 ("has_derivative_lemma", [has_derivative_lemma])) (disch_tac [])) THEN (clear_assumption "has_derivative_lemma") THEN (DISCH_THEN apply_tac));
1139 ((fun arg_tac -> arg_tac (Arg_term (`!k. k IN 0..i ==>
1140 nth_derivative k f real_differentiable atreal y /\
1141 nth_derivative (i - k) g real_differentiable atreal y`))) (term_tac (have_gen_tac [](move ["diff_cond"]))));
1142 (((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["k"]) THEN (move ["ineq"]) THEN (simp_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
1143 (((fun arg_tac -> arg_tac (Arg_term (`nth_derivative (SUC k) f y`))) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("diff_f", [])) (fun fst_arg -> (use_arg_then2 ("ysf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))));
1144 ((((use_arg_then2 ("i_lt_n", [])) (disch_tac [])) THEN (clear_assumption "i_lt_n") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1145 (((fun arg_tac -> arg_tac (Arg_term (`nth_derivative (SUC (i - k)) g y`))) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("diff_g", [])) (fun fst_arg -> (use_arg_then2 ("ysg", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))));
1146 ((((use_arg_then2 ("i_lt_n", [])) (disch_tac [])) THEN (clear_assumption "i_lt_n") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1147 ((fun arg_tac -> arg_tac (Arg_term (`!k. k IN 0..i ==>
1148 (\y. &(binom (i, k)) * nth_derivative k f y * nth_derivative (i - k) g y)
1149 real_differentiable atreal y`))) (term_tac (have_gen_tac [](move ["diff_cond2"]))));
1150 (BETA_TAC THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac));
1151 (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_DIFFERENTIABLE_MUL_ATREAL", [REAL_DIFFERENTIABLE_MUL_ATREAL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff_cond", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (done_tac));
1152 (((((use_arg_then2 ("differentiable_sum_numseg", [differentiable_sum_numseg]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("derivative_sum_numseg", [derivative_sum_numseg]))(thm_tac (new_rewrite [] [])))))) THEN ((simp_tac) THEN (((use_arg_then2 ("diff_cond2", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))));
1153 ((fun arg_tac -> arg_tac (Arg_term (`sum (0..i) _`))) (term_tac (set_tac "lhs")));
1154 ((fun arg_tac -> arg_tac (Arg_term (`sum (0 + 1..i + 1) (\k. &(binom (i, k - 1)) * nth_derivative k f y * nth_derivative (SUC i - k) g y)`))) (term_tac (set_tac "sum1")));
1155 ((fun arg_tac -> arg_tac (Arg_term (`sum (0..i + 1) (\k. &(binom (i, k)) * nth_derivative k f y * nth_derivative (SUC i - k) g y)`))) (term_tac (set_tac "sum2")));
1156 ((fun arg_tac -> arg_tac (Arg_term (`lhs = sum1 + sum2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
1157 ((((use_arg_then2 ("sum1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_OFFSET", [SUM_OFFSET]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("addn1", [addn1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subSS", [subSS]))(thm_tac (new_rewrite [] [])))));
1158 ((((use_arg_then2 ("sum2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addn1", [addn1]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL SUM_CLAUSES_NUMSEG)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 <= SUC i`)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
1159 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`binom(i, SUC i) = 0`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("BINOM_EQ_0", [BINOM_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)));
1160 ((((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_ADD_NUMSEG", [SUM_ADD_NUMSEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("lhs_def", []))(gsym_then (thm_tac (new_rewrite [] []))))));
1161 (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac));
1162 (((((use_arg_then2 ("derivative_scale", [derivative_scale]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_MUL_ATREAL", [REAL_DIFFERENTIABLE_MUL_ATREAL]))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("diff_cond", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
1163 (((((use_arg_then2 ("REAL_ADD_LDISTRIB", [REAL_ADD_LDISTRIB]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_EQ_MUL_LCANCEL", [REAL_EQ_MUL_LCANCEL]))(thm_tac (new_rewrite [] []))))) THEN (DISJ2_TAC));
1164 ((((use_arg_then2 ("derivative_mul", [derivative_mul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("diff_cond", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
1165 ((((use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_derivativeS", [nth_derivativeS]))(gsym_then (thm_tac (new_rewrite [] [])))))));
1166 ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`SUC (i - k) = SUC i - k`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((done_tac) THEN (done_tac)));
1167 ((((use_arg_then2 ("k_in", [])) (disch_tac [])) THEN (clear_assumption "k_in") THEN BETA_TAC) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac));
1168 (((((use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_CLAUSES_LEFT", [SUM_CLAUSES_LEFT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sum2_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("SUM_CLAUSES_LEFT", [SUM_CLAUSES_LEFT]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (TRY ((arith_tac))));
1169 ((repeat_tactic 1 9 (((use_arg_then2 ("binom", [binom]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_EQ_ADD_LCANCEL", [REAL_EQ_ADD_LCANCEL]))(thm_tac (new_rewrite [] [])))));
1170 ((((use_arg_then2 ("sum1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_ADD_NUMSEG", [SUM_ADD_NUMSEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("addn1", [addn1])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))));
1171 (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac));
1172 (((((use_arg_then2 ("REAL_ADD_RDISTRIB", [REAL_ADD_RDISTRIB]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_EQ_MUL_RCANCEL", [REAL_EQ_MUL_RCANCEL]))(thm_tac (new_rewrite [] []))))) THEN (DISJ1_TAC));
1173 ((THENL_FIRST) (((THENL) (((use_arg_then2 ("k_in", [])) (disch_tac [])) THEN (clear_assumption "k_in") THEN ((use_arg_then2 ("k", [])) (disch_tac [])) THEN (clear_assumption "k") THEN case) [ALL_TAC; (move ["k"])]) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac)));
1174 (((((use_arg_then2 ("binom", [binom]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subSS", [subSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subn0", [subn0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OF_NUM_ADD", [REAL_OF_NUM_ADD]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1175 ];;
1176
1177 (* Lemma nth_derivative_mul_strong_all *)
1178 let nth_derivative_mul_strong_all = Sections.section_proof ["x"]
1179 `interval_arith x int ==>
1180 ?s. real_open s /\ x IN s /\
1181 !i y. i <= n /\ y IN s ==>
1182 nth_derivative i (\y. f y * g y) y =
1183 sum (0..i) (\k. &(binom (i, k)) * nth_derivative k f y * nth_derivative (i - k) g y)`
1184 [
1185 (BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("nth_derivative_mul_strong", [nth_derivative_mul_strong])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"]));
1186 ((fun arg_tac -> arg_tac (Arg_term (`\i s. real_open s /\ x IN s /\
1187 (!y. y IN s ==> nth_derivative i (\y. f y * g y) y =
1188 sum (0..i) (\k. &(binom (i, k)) * nth_derivative k f y * nth_derivative (i - k) g y))`))) (term_tac (set_tac "P")));
1189 ((fun arg_tac -> arg_tac (Arg_term (`!i. i <= n:num ==> P i ((@) (P i))`))) (term_tac (have_gen_tac [](move ["sel_P"]))));
1190 ((BETA_TAC THEN (move ["i"]) THEN (move ["i_le_n"])) THEN ((use_arg_then2 ("SELECT_AX", [SELECT_AX])) (thm_tac apply_tac)));
1191 (((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("i_le_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["cond"]));
1192 (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac));
1193 ((fun arg_tac -> arg_tac (Arg_term (`INTERS (IMAGE (\i. (@) (P i)) (0..n))`))) (term_tac (set_tac "S")));
1194 ((use_arg_then2 ("S", [])) (term_tac exists_tac));
1195 ((((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_OPEN_INTERS", [REAL_OPEN_INTERS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
1196 ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("IN_NUMSEG_0", [IN_NUMSEG_0]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("sel_P", [])) (thm_tac (match_mp_then snd_th MP_TAC))))));
1197 (((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac));
1198 (((repeat_tactic 1 9 (((use_arg_then2 ("IN_INTERS", [IN_INTERS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac));
1199 ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("IN_NUMSEG_0", [IN_NUMSEG_0]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("sel_P", [])) (thm_tac (match_mp_then snd_th MP_TAC))))));
1200 (((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac));
1201 (BETA_TAC THEN (move ["i"]) THEN (move ["y"]) THEN (case THEN (move ["i_le_n"])));
1202 ((((fun arg_tac -> (use_arg_then2 ("sel_P", [])) (fun fst_arg -> (use_arg_then2 ("i_le_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["y_in"]) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@) (P i)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))));
1203 ((THENL_FIRST) (ANTS_TAC) (((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("IN_NUMSEG_0", [IN_NUMSEG_0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
1204 (((use_arg_then2 ("y_in", [])) (disch_tac [])) THEN (clear_assumption "y_in") THEN (exact_tac));
1205 ];;
1206
1207 (* Lemma nth_derivative_mul *)
1208 let nth_derivative_mul = Sections.section_proof ["i";"x"]
1209 `interval_arith x int ==> i <= n ==>
1210 nth_derivative i (\x. f x * g x) x =
1211 sum (0..i) (\k. &(binom (i, k)) * nth_derivative k f x * nth_derivative (i - k) g x)`
1212 [
1213 (BETA_TAC THEN (move ["ineq"]) THEN (move ["i_le_n"]));
1214 ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_derivative_mul_strong", [nth_derivative_mul_strong])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i_le_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1215 (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"])) THEN (move ["h"]));
1216 (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac));
1217 ];;
1218
1219 (* Lemma nth_diff_mul *)
1220 let nth_diff_mul = Sections.section_proof []
1221 `nth_diff_strong_int n int (\x. f x * g x)`
1222 [
1223 (((use_arg_then2 ("dg", [])) (disch_tac [])) THEN ((use_arg_then2 ("df", [])) (disch_tac [])) THEN BETA_TAC);
1224 ((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_differentiable_eq", [nth_differentiable_eq]))(thm_tac (new_rewrite [] []))))));
1225 (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["x"]) THEN (move ["ineq"]));
1226 ((fun arg_tac -> (use_arg_then2 ("nth_derivative_mul_strong_all", [nth_derivative_mul_strong_all])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1227 (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["diff"]));
1228 (((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["tf"])) THEN (case THEN (move ["open_tf"])) THEN (case THEN (move ["xtf"])) THEN (move ["diff_f"]));
1229 (((fun arg_tac -> (use_arg_then2 ("dg", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["tg"])) THEN (case THEN (move ["open_tg"])) THEN (case THEN (move ["xtg"])) THEN (move ["diff_g"]));
1230 (((fun arg_tac -> arg_tac (Arg_term (`s INTER tf INTER tg`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("xtf", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("xtg", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))));
1231 (BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (case THEN ((move ["ytf"]) THEN (move ["ytg"]))))));
1232 (((((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff_f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff_g", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_lt_n"]));
1233 ((((use_arg_then2 ("nth_derivativeS", [nth_derivativeS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] [])))));
1234 (((use_arg_then2 ("differentiable_local", [differentiable_local])) (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac));
1235 (((fun arg_tac -> arg_tac (Arg_term (`\y. sum (0..i) (\k. &(binom(i, k)) * nth_derivative k f y * nth_derivative (i - k) g y)`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("s", [])) (term_tac exists_tac)));
1236 ((THENL_LAST) (((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)) ((BETA_TAC THEN (move ["z"]) THEN (move ["zs"])) THEN ((((use_arg_then2 ("diff", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
1237 (((((use_arg_then2 ("differentiable_sum_numseg", [differentiable_sum_numseg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac));
1238 (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_DIFFERENTIABLE_MUL_ATREAL", [REAL_DIFFERENTIABLE_MUL_ATREAL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
1239 ((repeat_tactic 1 9 (((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
1240 (((fun arg_tac -> arg_tac (Arg_term (`nth_derivative (SUC k) f y`))) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("diff_f", [])) (fun fst_arg -> (use_arg_then2 ("ytf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))));
1241 ((((use_arg_then2 ("i_lt_n", [])) (disch_tac [])) THEN (clear_assumption "i_lt_n") THEN ((use_arg_then2 ("k_in", [])) (disch_tac [])) THEN (clear_assumption "k_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1242 (((fun arg_tac -> arg_tac (Arg_term (`nth_derivative (SUC (i - k)) g y`))) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("diff_g", [])) (fun fst_arg -> (use_arg_then2 ("ytg", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))));
1243 ((((use_arg_then2 ("i_lt_n", [])) (disch_tac [])) THEN (clear_assumption "i_lt_n") THEN ((use_arg_then2 ("k_in", [])) (disch_tac [])) THEN (clear_assumption "k_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1244 ];;
1245
1246 (* Finalization of the section NthDerivativeArith *)
1247 let nth_derivative_scale_strong = Sections.finalize_theorem nth_derivative_scale_strong;;
1248 let nth_derivative_scale_strong_all = Sections.finalize_theorem nth_derivative_scale_strong_all;;
1249 let nth_derivative_scale = Sections.finalize_theorem nth_derivative_scale;;
1250 let nth_diff_scale = Sections.finalize_theorem nth_diff_scale;;
1251 let nth_derivative_add_strong = Sections.finalize_theorem nth_derivative_add_strong;;
1252 let nth_derivative_add_strong_all = Sections.finalize_theorem nth_derivative_add_strong_all;;
1253 let nth_derivative_add = Sections.finalize_theorem nth_derivative_add;;
1254 let nth_diff_add = Sections.finalize_theorem nth_diff_add;;
1255 let nth_derivative_sub_strong = Sections.finalize_theorem nth_derivative_sub_strong;;
1256 let nth_derivative_sub_strong_all = Sections.finalize_theorem nth_derivative_sub_strong_all;;
1257 let nth_derivative_sub = Sections.finalize_theorem nth_derivative_sub;;
1258 let nth_diff_sub = Sections.finalize_theorem nth_diff_sub;;
1259 let nth_derivative_mul_strong = Sections.finalize_theorem nth_derivative_mul_strong;;
1260 let nth_derivative_mul_strong_all = Sections.finalize_theorem nth_derivative_mul_strong_all;;
1261 let nth_derivative_mul = Sections.finalize_theorem nth_derivative_mul;;
1262 let nth_diff_mul = Sections.finalize_theorem nth_diff_mul;;
1263 Sections.end_section "NthDerivativeArith";;
1264
1265 (* Finalization of the section NthDerivatives *)
1266 let derivative_eq_real_derivative = Sections.finalize_theorem derivative_eq_real_derivative;;
1267 let has_derivative_cond = Sections.finalize_theorem has_derivative_cond;;
1268 let has_derivative_alt = Sections.finalize_theorem has_derivative_alt;;
1269 let derivative_unique = Sections.finalize_theorem derivative_unique;;
1270 let derivative_unique_on = Sections.finalize_theorem derivative_unique_on;;
1271 let has_derivative_lemma = Sections.finalize_theorem has_derivative_lemma;;
1272 let nth_derivative0 = Sections.finalize_theorem nth_derivative0;;
1273 let nth_derivativeS = Sections.finalize_theorem nth_derivativeS;;
1274 let nth_Sderivative = Sections.finalize_theorem nth_Sderivative;;
1275 let nth_derivative1 = Sections.finalize_theorem nth_derivative1;;
1276 let nth_derivative2 = Sections.finalize_theorem nth_derivative2;;
1277 let nth_derivative_add = Sections.finalize_theorem nth_derivative_add;;
1278 let nth_diff_continuous = Sections.finalize_theorem nth_diff_continuous;;
1279 let nth_differentiable_cond = Sections.finalize_theorem nth_differentiable_cond;;
1280 let nth_differentiable_on_cond = Sections.finalize_theorem nth_differentiable_on_cond;;
1281 let nth_differentiable_eq = Sections.finalize_theorem nth_differentiable_eq;;
1282 let nth_differentiable_on_int2 = Sections.finalize_theorem nth_differentiable_on_int2;;
1283 let nth_mth_diff = Sections.finalize_theorem nth_mth_diff;;
1284 let nth_differentiable1 = Sections.finalize_theorem nth_differentiable1;;
1285 let nth_diff_imp_diff = Sections.finalize_theorem nth_diff_imp_diff;;
1286 let nth_derivative_continuous = Sections.finalize_theorem nth_derivative_continuous;;
1287 let ith_derivative_differentiable = Sections.finalize_theorem ith_derivative_differentiable;;
1288 let nth_diff_strong_imp_diff = Sections.finalize_theorem nth_diff_strong_imp_diff;;
1289 let HAS_REAL_DERIVATIVE_ABS_POS = Sections.finalize_theorem HAS_REAL_DERIVATIVE_ABS_POS;;
1290 let HAS_REAL_DERIVATIVE_ABS_NEG = Sections.finalize_theorem HAS_REAL_DERIVATIVE_ABS_NEG;;
1291 let derivative_x = Sections.finalize_theorem derivative_x;;
1292 let derivative_const = Sections.finalize_theorem derivative_const;;
1293 let derivative_abs_pos = Sections.finalize_theorem derivative_abs_pos;;
1294 let derivative_abs_neg = Sections.finalize_theorem derivative_abs_neg;;
1295 let derivative_pow_x = Sections.finalize_theorem derivative_pow_x;;
1296 let derivative_pow2_x = Sections.finalize_theorem derivative_pow2_x;;
1297 let derivative_pow3_x = Sections.finalize_theorem derivative_pow3_x;;
1298 let derivative_inv = Sections.finalize_theorem derivative_inv;;
1299 let derivative_atn = Sections.finalize_theorem derivative_atn;;
1300 let derivative_exp = Sections.finalize_theorem derivative_exp;;
1301 let derivative_log = Sections.finalize_theorem derivative_log;;
1302 let derivative_sin = Sections.finalize_theorem derivative_sin;;
1303 let derivative_cos = Sections.finalize_theorem derivative_cos;;
1304 let derivative_asn = Sections.finalize_theorem derivative_asn;;
1305 let derivative_acs = Sections.finalize_theorem derivative_acs;;
1306 let derivative_sqrt = Sections.finalize_theorem derivative_sqrt;;
1307 let derivative_matan = Sections.finalize_theorem derivative_matan;;
1308 let matan_differentiable = Sections.finalize_theorem matan_differentiable;;
1309 let derivative_composition = Sections.finalize_theorem derivative_composition;;
1310 let REAL_DIFFERENTIABLE_AT_INV = Sections.finalize_theorem REAL_DIFFERENTIABLE_AT_INV;;
1311 let REAL_DIFFERENTIABLE_AT_ABS_POS = Sections.finalize_theorem REAL_DIFFERENTIABLE_AT_ABS_POS;;
1312 let REAL_DIFFERENTIABLE_AT_ABS_NEG = Sections.finalize_theorem REAL_DIFFERENTIABLE_AT_ABS_NEG;;
1313 let derivative_compose_abs_pos = Sections.finalize_theorem derivative_compose_abs_pos;;
1314 let derivative_compose_abs_neg = Sections.finalize_theorem derivative_compose_abs_neg;;
1315 let derivative_compose_pow = Sections.finalize_theorem derivative_compose_pow;;
1316 let derivative_compose_pow2 = Sections.finalize_theorem derivative_compose_pow2;;
1317 let derivative_compose_pow3 = Sections.finalize_theorem derivative_compose_pow3;;
1318 let derivative_compose_atn = Sections.finalize_theorem derivative_compose_atn;;
1319 let derivative_compose_exp = Sections.finalize_theorem derivative_compose_exp;;
1320 let derivative_compose_log = Sections.finalize_theorem derivative_compose_log;;
1321 let derivative_compose_cos = Sections.finalize_theorem derivative_compose_cos;;
1322 let derivative_compose_sin = Sections.finalize_theorem derivative_compose_sin;;
1323 let derivative_compose_inv = Sections.finalize_theorem derivative_compose_inv;;
1324 let derivative_compose_sqrt = Sections.finalize_theorem derivative_compose_sqrt;;
1325 let derivative_compose_acs = Sections.finalize_theorem derivative_compose_acs;;
1326 let derivative_compose_asn = Sections.finalize_theorem derivative_compose_asn;;
1327 let derivative_compose_matan = Sections.finalize_theorem derivative_compose_matan;;
1328 let derivative_scale = Sections.finalize_theorem derivative_scale;;
1329 let derivative_neg = Sections.finalize_theorem derivative_neg;;
1330 let derivative_pow = Sections.finalize_theorem derivative_pow;;
1331 let derivative_add = Sections.finalize_theorem derivative_add;;
1332 let derivative_mul = Sections.finalize_theorem derivative_mul;;
1333 let derivative_sub = Sections.finalize_theorem derivative_sub;;
1334 let derivative_div = Sections.finalize_theorem derivative_div;;
1335 let differentiable_sum_numseg = Sections.finalize_theorem differentiable_sum_numseg;;
1336 let derivative_sum_numseg = Sections.finalize_theorem derivative_sum_numseg;;
1337 let HAS_REAL_DERIVATIVE_LOCAL = Sections.finalize_theorem HAS_REAL_DERIVATIVE_LOCAL;;
1338 let differentiable_local = Sections.finalize_theorem differentiable_local;;
1339 let nth_derivative_scale_strong = Sections.finalize_theorem nth_derivative_scale_strong;;
1340 let nth_derivative_scale_strong_all = Sections.finalize_theorem nth_derivative_scale_strong_all;;
1341 let nth_derivative_scale = Sections.finalize_theorem nth_derivative_scale;;
1342 let nth_diff_scale = Sections.finalize_theorem nth_diff_scale;;
1343 let nth_derivative_add_strong = Sections.finalize_theorem nth_derivative_add_strong;;
1344 let nth_derivative_add_strong_all = Sections.finalize_theorem nth_derivative_add_strong_all;;
1345 let nth_derivative_add = Sections.finalize_theorem nth_derivative_add;;
1346 let nth_diff_add = Sections.finalize_theorem nth_diff_add;;
1347 let nth_derivative_sub_strong = Sections.finalize_theorem nth_derivative_sub_strong;;
1348 let nth_derivative_sub_strong_all = Sections.finalize_theorem nth_derivative_sub_strong_all;;
1349 let nth_derivative_sub = Sections.finalize_theorem nth_derivative_sub;;
1350 let nth_diff_sub = Sections.finalize_theorem nth_diff_sub;;
1351 let nth_derivative_mul_strong = Sections.finalize_theorem nth_derivative_mul_strong;;
1352 let nth_derivative_mul_strong_all = Sections.finalize_theorem nth_derivative_mul_strong_all;;
1353 let nth_derivative_mul = Sections.finalize_theorem nth_derivative_mul;;
1354 let nth_diff_mul = Sections.finalize_theorem nth_diff_mul;;
1355 Sections.end_section "NthDerivatives";;
1356 let lin_approx = new_definition `lin_approx f x f_bounds df_bounds <=>
1357 interval_arith (f x) f_bounds /\
1358 (?f'. (f has_real_derivative f') (atreal x) /\ interval_arith f' df_bounds)`;;
1359 let has_bounded_second_derivative = new_definition `has_bounded_second_derivative f int dd_bounds <=>
1360 nth_diff_strong_int 2 int f /\
1361 bounded_on_int (nth_derivative 2 f) int dd_bounds`;;
1362 let taylor_interval = new_definition
1363 `taylor_interval f x y z w f_bounds df_bounds ddf_bounds <=>
1364 x <= y /\ y <= z /\ y - x <= w /\ z - y <= w /\
1365 lin_approx f y f_bounds df_bounds /\
1366 has_bounded_second_derivative f (x, z) ddf_bounds`;;
1367
1368 (* Lemma nth_diff_strong_imp_diff_int *)
1369 let nth_diff_strong_imp_diff_int = Sections.section_proof ["n";"int";"f"]
1370 `nth_diff_strong_int n int f ==>
1371 nth_differentiable_on_int n int f`
1372 [
1373 ((((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_differentiable_on_int", [nth_differentiable_on_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] [])))));
1374 (BETA_TAC THEN (move ["h"]) THEN (move ["x"]) THEN (move ["ineq"]));
1375 ((((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"]))) THEN (exact_tac) THEN (done_tac));
1376 ];;
1377
1378 (* Lemma has_bounded_second_derivative_old *)
1379 let has_bounded_second_derivative_old = Sections.section_proof ["f";"int";"dd_bounds"]
1380 `has_bounded_second_derivative f int dd_bounds ==>
1381 ?f' f''. (!x. interval_arith x int ==> (f has_real_derivative f' x) (atreal x) /\
1382 (f' has_real_derivative f'' x) (atreal x) /\ interval_arith (f'' x) dd_bounds)`
1383 [
1384 ((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("nth_diff_strong_imp_diff_int", [nth_diff_strong_imp_diff_int])) (thm_tac (match_mp_then snd_th MP_TAC))))));
1385 ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("nth_differentiable_on_int2", [nth_differentiable_on_int2])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["f'"])) THEN (case THEN (move ["f''"])));
1386 ((BETA_TAC THEN (case THEN (move ["eq1"])) THEN (case THEN (move ["eq2"])) THEN (move ["h"]) THEN (move ["b"])) THEN ((((use_arg_then2 ("f'", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("f''", [])) (term_tac exists_tac))) THEN (move ["x"]) THEN (move ["ineq"])));
1387 ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN BETA_TAC) THEN (((((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq2", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["b"])));
1388 (((repeat_tactic 1 9 (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("b", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1389 ];;
1390
1391 (* Lemma exists_and_left *)
1392 let exists_and_left = Sections.section_proof ["P";"Q"]
1393 `(?x. P x /\ Q x) ==> (?x. P x)`
1394 [
1395 (BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["Px"]) THEN (move ["_"]))));
1396 (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac));
1397 ];;
1398
1399 (* Lemma lim_ineq *)
1400 let lim_ineq = Sections.section_proof ["a";"b"]
1401 `(!e. &0 < e ==> a <= b + e) <=> (a <= b)`
1402 [
1403 ((THENL_ROT (-1)) ((THENL) (split_tac) [ALL_TAC; ((move ["ineq"]) THEN (move ["e"]) THEN (move ["e0"]))]));
1404 (((((fun arg_tac -> (use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID])) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1405 ((((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IMP", [NOT_IMP]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] [])))))) THEN (move ["ba"])));
1406 (((fun arg_tac -> arg_tac (Arg_term (`(a - b) / &2`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("ba", [])) (disch_tac [])) THEN (clear_assumption "ba") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1407 ];;
1408
1409 (* Lemma continuous_leq *)
1410 let continuous_leq = Sections.section_proof ["f";"c";"a"]
1411 `(?b. a < b /\ !x. x IN real_interval (a, b) ==> f x <= c) /\
1412 f real_continuous atreal a ==> f a <= c`
1413 [
1414 (BETA_TAC THEN (case THEN ((case THEN (move ["b"])) THEN (case THEN (move ["ab"])) THEN (move ["ineq"]))));
1415 (((((use_arg_then2 ("REAL_CONTINUOUS_ATREAL", [REAL_CONTINUOUS_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REALLIM_ATREAL", [REALLIM_ATREAL]))(thm_tac (new_rewrite [] []))))) THEN (move ["f_cont"]));
1416 ((((use_arg_then2 ("lim_ineq", [lim_ineq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["e"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("f_cont", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["cond"]));
1417 ((fun arg_tac -> arg_tac (Arg_term (`a + min (b - a) d / &2`))) (term_tac (set_tac "r")));
1418 ((THENL_FIRST) ((((fun arg_tac -> (use_arg_then2 ("cond", [])) (fun fst_arg -> (use_arg_then2 ("r", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) ((((use_arg_then2 ("ab", [])) (disch_tac [])) THEN (clear_assumption "ab") THEN ((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN ((use_arg_then2 ("r_def", [])) (disch_tac [])) THEN (clear_assumption "r_def") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1419 ((THENL_LAST) ((((fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("r", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) ((arith_tac) THEN (done_tac)));
1420 ((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ab", [])) (disch_tac [])) THEN (clear_assumption "ab") THEN ((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN ((use_arg_then2 ("r_def", [])) (disch_tac [])) THEN (clear_assumption "r_def") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1421 ];;
1422
1423 (* Lemma continuous_reflection *)
1424 let continuous_reflection = Sections.section_proof ["f";"x"]
1425 `f real_continuous atreal x <=>
1426 (\x. f (--x)) real_continuous atreal (--x)`
1427 [
1428 (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_CONTINUOUS_ATREAL", [REAL_CONTINUOUS_ATREAL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REALLIM_ATREAL", [REALLIM_ATREAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_NEG_NEG", [REAL_NEG_NEG]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((split_tac) THEN (move ["h"]) THEN (move ["e"]) THEN (move ["e0"])));
1429 (((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("e0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["cond"]));
1430 (((use_arg_then2 ("d", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("d0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (move ["ineqs"])) THEN (((use_arg_then2 ("cond", [])) (disch_tac [])) THEN (clear_assumption "cond") THEN (DISCH_THEN apply_tac)));
1431 ((((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1432 (((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("e0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["cond"]));
1433 (((use_arg_then2 ("d", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("d0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (move ["ineqs"])));
1434 ((((fun arg_tac -> (use_arg_then2 ("cond", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`--y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("REAL_NEG_NEG", [REAL_NEG_NEG]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1435 ];;
1436
1437 (* Lemma continuous_leq_segment *)
1438 let continuous_leq_segment = Sections.section_proof ["f";"c";"a";"b"]
1439 `a < b ==> f real_continuous atreal a ==> f real_continuous atreal b ==>
1440 (!x. x IN real_interval (a, b) ==> f x <= c) ==>
1441 (!x. x IN real_interval [a, b] ==> f x <= c)`
1442 [
1443 (BETA_TAC THEN (move ["ab"]) THEN (move ["f_cont_a"]) THEN (move ["f_cont_b"]) THEN (move ["ineq"]) THEN (move ["x"]));
1444 ((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 2 0 (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b. a <= b <=> (a = b \/ a < b)`)))(thm_tac (new_rewrite [] []))))));
1445 (case THEN ((THENL) case [((((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["_"])); (move ["ax"])]));
1446 ((((use_arg_then2 ("continuous_leq", [continuous_leq])) (disch_tac [])) THEN (clear_assumption "continuous_leq") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("f_cont_a", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("b", [])) (term_tac exists_tac)) THEN (done_tac));
1447 ((THENL_LAST) ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (move ["xb"])]) ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
1448 ((fun arg_tac -> arg_tac (Arg_term (`\x. f (--x)`))) (term_tac (set_tac "g")));
1449 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`!x. f x = g (--x)`))) (term_tac (have_gen_tac [](move ["fg"])))) (((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_NEG_NEG", [REAL_NEG_NEG]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
1450 ((((use_arg_then2 ("fg", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("continuous_leq", [continuous_leq])) (disch_tac [])) THEN (clear_assumption "continuous_leq") THEN (DISCH_THEN apply_tac)) THEN (split_tac));
1451 (((fun arg_tac -> arg_tac (Arg_term (`--a`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("REAL_LT_NEG2", [REAL_LT_NEG2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ab", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"])));
1452 ((((fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`--y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fg", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_NEG", [REAL_NEG_NEG]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1453 (((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("continuous_reflection", [continuous_reflection]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1454 ];;
1455
1456 (* Lemma pair_eq *)
1457 let pair_eq = Sections.section_proof ["p"]
1458 `p = (FST p, SND p)`
1459 [
1460 (done_tac);
1461 ];;
1462
1463 (* Section Taylor *)
1464 Sections.begin_section "Taylor";;
1465
1466 (* Lemma iabs_alt *)
1467 let iabs_alt = Sections.section_proof ["lo";"hi";"a"]
1468 `interval_arith a (lo, hi) ==> iabs (lo, hi) = max (abs lo) (abs hi)`
1469 [
1470 (((((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iabs", [iabs]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1471 ];;
1472
1473 (* Lemma iabs_pos *)
1474 let iabs_pos = Sections.section_proof ["lo";"hi";"a"]
1475 `interval_arith a (lo, hi) ==> &0 <= iabs (lo, hi)`
1476 [
1477 (((((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iabs", [iabs]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1478 ];;
1479 (Sections.add_section_var (mk_var ("f", (`:real -> real`))));;
1480 (Sections.add_section_var (mk_var ("x", (`:real`))); Sections.add_section_var (mk_var ("y", (`:real`))); Sections.add_section_var (mk_var ("z", (`:real`))); Sections.add_section_var (mk_var ("w", (`:real`))));;
1481 (Sections.add_section_var (mk_var ("f_bounds", (`:real#real`))); Sections.add_section_var (mk_var ("df_bounds", (`:real#real`))); Sections.add_section_var (mk_var ("ddf_bounds", (`:real#real`))));;
1482 (Sections.add_section_var (mk_var ("dd_bound", (`:real`))));;
1483 (Sections.add_section_hyp "dd_bound_eq" (`dd_bound = iabs ddf_bounds`));;
1484 (Sections.add_section_hyp "tif" (`taylor_interval f x y z w f_bounds df_bounds ddf_bounds`));;
1485
1486 (* Lemma f_continuous *)
1487 let f_continuous = Sections.section_proof []
1488 `!t. t IN real_interval [x, z] ==> f real_continuous atreal t`
1489 [
1490 (((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["t"]) THEN (move ["t_in"]));
1491 (((use_arg_then2 ("HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL", [HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL") THEN (DISCH_THEN apply_tac));
1492 ((((use_arg_then2 ("tif", [])) (disch_tac [])) THEN (clear_assumption "tif") THEN BETA_TAC) THEN (((((use_arg_then2 ("taylor_interval", [taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbA", [andbA]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("has_bounded_second_derivative_old", [has_bounded_second_derivative_old])) (thm_tac (match_mp_then snd_th MP_TAC))))));
1493 (BETA_TAC THEN (case THEN (move ["f'"])) THEN (case THEN (move ["f''"])) THEN (move ["df"]));
1494 (((fun arg_tac -> arg_tac (Arg_term (`f' t`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1495 ];;
1496
1497 (* Lemma taylor_error *)
1498 let taylor_error = Sections.section_proof ["t"]
1499 `x <= t /\ t <= z ==>
1500 abs (f t - f y) <= w * iabs df_bounds + w * w * dd_bound / &2`
1501 [
1502 (BETA_TAC THEN (move ["t_ineqs"]));
1503 (((use_arg_then2 ("tif", [])) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (((((use_arg_then2 ("taylor_interval", [taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbA", [andbA]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["domain_ineqs"])) THEN (move ["lin_app"])));
1504 ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("has_bounded_second_derivative_old", [has_bounded_second_derivative_old])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["f'"])) THEN (case THEN (move ["f''"])) THEN (move ["df"]));
1505 ((fun arg_tac -> arg_tac (Arg_term (`abs (t - y) <= w`))) (term_tac (have_gen_tac [](move ["abs_ty"]))));
1506 ((((use_arg_then2 ("t_ineqs", [])) (disch_tac [])) THEN (clear_assumption "t_ineqs") THEN ((use_arg_then2 ("domain_ineqs", [])) (disch_tac [])) THEN (clear_assumption "domain_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1507 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`interval_arith y (x, z)`))) (term_tac (have_gen_tac [](move ["y_in"])))) ((((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
1508 ((fun arg_tac -> arg_tac (Arg_term (`&0 <= dd_bound /\ !p. p IN real_interval [x, z] ==> abs (f'' p) <= dd_bound`))) (term_tac (have_gen_tac [](move ["dd_prop"]))));
1509 ((((use_arg_then2 ("dd_bound_eq", []))(thm_tac (new_rewrite [] [])))) THEN (split_tac));
1510 ((((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("y_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iabs", [iabs]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1511 (((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("df", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN ((((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iabs", [iabs]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1512 (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`abs (f t - (f y + f' y * (t - y) pow 1)) <= dd_bound * abs (t - y) pow (1 + 1) / &2`))) (term_tac (have_gen_tac []ALL_TAC))));
1513 (((fun arg_tac -> arg_tac (Arg_term (`f' y * _`))) (term_tac (set_tac "b1"))) THEN (((fun arg_tac -> arg_tac (Arg_term (`dd_bound * _`))) (term_tac (set_tac "b2"))) THEN (move ["ineq1"])));
1514 ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`abs (f t - (f y + b1)) + abs b1`))) (term_tac exists_tac)) THEN (split_tac));
1515 (((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b. a - b = (a - (b + b1)) + b1`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_TRIANGLE", [REAL_ABS_TRIANGLE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1516 ((((use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("b1_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("REAL_POW_1", [REAL_POW_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_MUL", [REAL_ABS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_MUL2", [REAL_LE_MUL2]))(thm_tac (new_rewrite [] [])))));
1517 ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("abs_ty", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iabs", [iabs]))(thm_tac (new_rewrite [] [])))));
1518 ((((use_arg_then2 ("lin_app", [])) (disch_tac [])) THEN (clear_assumption "lin_app") THEN BETA_TAC) THEN ((((use_arg_then2 ("lin_approx", [lin_approx]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["ff"])) THEN (case THEN (move ["df'"]))));
1519 ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`ff = f' y`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) (((((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)));
1520 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_DERIVATIVE_UNIQUE_ATREAL", [REAL_DERIVATIVE_UNIQUE_ATREAL])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("df'", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1521 ((((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("b2", [])) (term_tac exists_tac)));
1522 ((((use_arg_then2 ("ineq1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("b2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_MUL2", [REAL_LE_MUL2]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `1 + 1 = 2`)))(thm_tac (new_rewrite [] [])))));
1523 (((((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_INV", [REAL_LE_INV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dd_prop", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_POW_2", [REAL_LE_POW_2]))(thm_tac (new_rewrite [] [])))))) THEN (TRY ((arith_tac))));
1524 ((((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_MUL2", [REAL_LE_MUL2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dd_prop", []))(thm_tac (new_rewrite [] [])))));
1525 (((((use_arg_then2 ("REAL_LE_POW_2", [REAL_LE_POW_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_SQUARE_ABS", [REAL_LE_SQUARE_ABS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ABS_ABS", [REAL_ABS_ABS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("abs_ty", [])) (disch_tac [])) THEN (clear_assumption "abs_ty") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1526 ((fun arg_tac -> arg_tac (Arg_term (`\i. if i = 0 then f else if i = 1 then f' else if i = 2 then f'' else I`))) (term_tac (set_tac "Df")));
1527 ((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 + 1 = 1 /\ ~(1 = 0) /\ 1 + 1 = 2 /\
1528 ~(2 = 1) /\ ~(2 = 1) /\ ~(2 = 0)`))) (fun arg -> thm_tac MP_TAC arg THEN (move ["arith"])));
1529 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_TAYLOR", [REAL_TAYLOR])) (fun fst_arg -> (use_arg_then2 ("Df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`real_interval [x, z]`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("dd_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1530 (ANTS_TAC);
1531 (((((use_arg_then2 ("IS_REALINTERVAL_INTERVAL", [IS_REALINTERVAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
1532 ((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] []))))));
1533 ((BETA_TAC THEN (move ["i"]) THEN (move ["p"]) THEN (case THEN (move ["p_in"]))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `i <= 1 <=> i = 0 \/ i = 1`)))(thm_tac (new_rewrite [] [])))));
1534 ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("Df_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ((use_arg_then2 ("HAS_REAL_DERIVATIVE_ATREAL_WITHIN", [HAS_REAL_DERIVATIVE_ATREAL_WITHIN])) (thm_tac apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("arith", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1535 ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then2 ("Df_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)));
1536 (((repeat_tactic 1 9 (((use_arg_then2 ("arith", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("dd_prop", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1537 ((BETA_TAC THEN ((fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("domain_ineqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("t_ineqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)));
1538 ((((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [1] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL SUM_CLAUSES_NUMSEG)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_SING_NUMSEG", [SUM_SING_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("Df_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))));
1539 ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 <= 1 /\ ~(1 = 0)`)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL real_pow)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FACT", [FACT]))(thm_tac (new_rewrite [] [])))));
1540 (((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `FACT 1 = 1 /\ FACT (1 + 1) = 2`)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_DIV_1", [REAL_DIV_1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1541 ];;
1542
1543 (* Lemma taylor_upper_bound *)
1544 let taylor_upper_bound = Sections.section_proof []
1545 `!t. x <= t /\ t <= z ==>
1546 f t <= SND f_bounds + (w * iabs df_bounds + w * w * dd_bound / &2)`
1547 [
1548 (((fun arg_tac -> (use_arg_then2 ("pair_eq", [pair_eq])) (fun fst_arg -> (use_arg_then2 ("f_bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["eq"]));
1549 (BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("taylor_error", [taylor_error])) (thm_tac (match_mp_then snd_th MP_TAC)))));
1550 ((((use_arg_then2 ("tif", [])) (disch_tac [])) THEN (clear_assumption "tif") THEN BETA_TAC) THEN (((((use_arg_then2 ("taylor_interval", [taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbA", [andbA]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lin_approx", [lin_approx]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (case THEN (move ["f_int"])) THEN (move ["_"]) THEN (move ["_"])));
1551 ((((use_arg_then2 ("f_int", [])) (disch_tac [])) THEN (clear_assumption "f_int") THEN BETA_TAC) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1552 ];;
1553
1554 (* Lemma taylor_lower_bound *)
1555 let taylor_lower_bound = Sections.section_proof []
1556 `!t. x <= t /\ t <= z ==>
1557 FST f_bounds - (w * iabs df_bounds + w * w * dd_bound / &2) <= f t`
1558 [
1559 ((fun arg_tac -> (use_arg_then2 ("pair_eq", [pair_eq])) (fun fst_arg -> (use_arg_then2 ("f_bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["eq"])));
1560 (BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("taylor_error", [taylor_error])) (thm_tac (match_mp_then snd_th MP_TAC)))));
1561 ((((use_arg_then2 ("tif", [])) (disch_tac [])) THEN (clear_assumption "tif") THEN BETA_TAC) THEN (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("taylor_interval", [taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbA", [andbA]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lin_approx", [lin_approx]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (case THEN (move ["f_int"])) THEN (move ["_"]) THEN (move ["_"])));
1562 ((((use_arg_then2 ("f_int", [])) (disch_tac [])) THEN (clear_assumption "f_int") THEN BETA_TAC) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac));
1563 ];;
1564
1565 (* Lemma taylor_derivative_error *)
1566 let taylor_derivative_error = Sections.section_proof []
1567 `!t. x <= t /\ t <= z ==>
1568 abs (derivative f t - derivative f y) <= w * dd_bound`
1569 [
1570 (BETA_TAC THEN (move ["t"]) THEN (move ["t_ineqs"]));
1571 (((use_arg_then2 ("tif", [])) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (((((use_arg_then2 ("taylor_interval", [taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbA", [andbA]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["domain_ineqs"])) THEN (move ["_"])));
1572 ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("has_bounded_second_derivative_old", [has_bounded_second_derivative_old])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["f'"])) THEN (case THEN (move ["f''"])) THEN (move ["df"]));
1573 ((fun arg_tac -> arg_tac (Arg_term (`abs (t - y) <= w`))) (term_tac (have_gen_tac [](move ["abs_ty"]))));
1574 ((((use_arg_then2 ("t_ineqs", [])) (disch_tac [])) THEN (clear_assumption "t_ineqs") THEN ((use_arg_then2 ("domain_ineqs", [])) (disch_tac [])) THEN (clear_assumption "domain_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1575 ((fun arg_tac -> arg_tac (Arg_term (`!p. x <= p /\ p <= z ==> derivative f p = f' p`))) (term_tac (have_gen_tac [](move ["der_eq"]))));
1576 (((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("derivative_unique_on", [derivative_unique_on])) (disch_tac [])) THEN (clear_assumption "derivative_unique_on") THEN (DISCH_THEN apply_tac)));
1577 ((((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("df", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (simp_tac)) THEN (done_tac));
1578 ((repeat_tactic 1 9 (((use_arg_then2 ("der_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
1579 ((fun arg_tac -> arg_tac (Arg_term (`&0 <= dd_bound /\ !p. p IN real_interval [x, z] ==> abs (f'' p) <= dd_bound`))) (term_tac (have_gen_tac [](move ["dd_prop"]))));
1580 (((((use_arg_then2 ("dd_bound_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (split_tac));
1581 ((((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((fun arg_tac -> (use_arg_then2 ("pair_eq", [pair_eq])) (fun fst_arg -> (use_arg_then2 ("ddf_bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iabs", [iabs]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("domain_ineqs", []))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac));
1582 ((BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("df", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN ((((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iabs", [iabs]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1583 ((fun arg_tac -> arg_tac (Arg_term (`\i. if i = 0 then f' else if i = 1 then f'' else I`))) (term_tac (set_tac "Df")));
1584 ((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 + 1 = 1 /\ ~(1 = 0) /\ 1 + 1 = 2 /\
1585 ~(2 = 1) /\ ~(2 = 1) /\ ~(2 = 0)`))) (fun arg -> thm_tac MP_TAC arg THEN (move ["arith"])));
1586 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_TAYLOR", [REAL_TAYLOR])) (fun fst_arg -> (use_arg_then2 ("Df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`real_interval [x, z]`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("dd_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1587 (ANTS_TAC);
1588 (((((use_arg_then2 ("IS_REALINTERVAL_INTERVAL", [IS_REALINTERVAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
1589 ((BETA_TAC THEN (move ["i"]) THEN (move ["p"]) THEN (case THEN (move ["p_in"]))) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `i <= 0 <=> i = 0`)))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))));
1590 (((((use_arg_then2 ("Df_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("arith", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_ATREAL_WITHIN", [HAS_REAL_DERIVATIVE_ATREAL_WITHIN])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_ATREAL_WITHIN") THEN (DISCH_THEN apply_tac)));
1591 (((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1592 ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then2 ("Df_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)));
1593 (((repeat_tactic 1 9 (((use_arg_then2 ("arith", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("dd_prop", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1594 ((BETA_TAC THEN ((fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("domain_ineqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("t_ineqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)));
1595 ((((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("SUM_SING_NUMSEG", [SUM_SING_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("Df_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))));
1596 ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL real_pow)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("arith", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FACT", [FACT]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `FACT 1 = 1`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_DIV_1", [REAL_DIV_1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))));
1597 ((((use_arg_then2 ("REAL_POW_1", [REAL_POW_1]))(thm_tac (new_rewrite [] [])))) THEN (move ["ineq"]));
1598 ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`dd_bound * abs (t - y)`))) (term_tac exists_tac)));
1599 (((((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_RMUL", [REAL_LE_RMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dd_prop", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("abs_ty", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1600 ];;
1601
1602 (* Lemma derivative_interval *)
1603 let derivative_interval = Sections.section_proof []
1604 `FST df_bounds <= derivative f y /\ derivative f y <= SND df_bounds`
1605 [
1606 ((fun arg_tac -> (use_arg_then2 ("pair_eq", [pair_eq])) (fun fst_arg -> (use_arg_then2 ("df_bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["eq"])));
1607 ((((use_arg_then2 ("tif", [])) (disch_tac [])) THEN (clear_assumption "tif") THEN BETA_TAC) THEN (((((use_arg_then2 ("taylor_interval", [taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lin_approx", [lin_approx]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbA", [andbA]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["ineqs"])) THEN (case THEN (move ["g"])) THEN (case THEN ((move ["fg"]) THEN (move ["g_int"]))) THEN (move ["_"])));
1608 ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`derivative f y = g`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((((use_arg_then2 ("g_int", [])) (disch_tac [])) THEN (clear_assumption "g_int") THEN BETA_TAC) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
1609 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_DERIVATIVE_UNIQUE_ATREAL", [REAL_DERIVATIVE_UNIQUE_ATREAL])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
1610 (((((use_arg_then2 ("fg", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_derivative_cond", [has_derivative_cond]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN (done_tac));
1611 ];;
1612
1613 (* Lemma taylor_derivative_upper_bound *)
1614 let taylor_derivative_upper_bound = Sections.section_proof []
1615 `!t. x <= t /\ t <= z ==>
1616 derivative f t <= SND df_bounds + w * dd_bound`
1617 [
1618 ((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("taylor_derivative_error", [taylor_derivative_error])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("derivative_interval", [derivative_interval])) (disch_tac [])) THEN (clear_assumption "derivative_interval") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1619 ];;
1620
1621 (* Lemma taylor_derivative_lower_bound *)
1622 let taylor_derivative_lower_bound = Sections.section_proof []
1623 `!t. x <= t /\ t <= z ==>
1624 FST df_bounds - w * dd_bound <= derivative f t`
1625 [
1626 ((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("taylor_derivative_error", [taylor_derivative_error])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("derivative_interval", [derivative_interval])) (disch_tac [])) THEN (clear_assumption "derivative_interval") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1627 ];;
1628
1629 (* Finalization of the section Taylor *)
1630 let iabs_alt = Sections.finalize_theorem iabs_alt;;
1631 let iabs_pos = Sections.finalize_theorem iabs_pos;;
1632 let f_continuous = Sections.finalize_theorem f_continuous;;
1633 let taylor_error = Sections.finalize_theorem taylor_error;;
1634 let taylor_upper_bound = Sections.finalize_theorem taylor_upper_bound;;
1635 let taylor_lower_bound = Sections.finalize_theorem taylor_lower_bound;;
1636 let taylor_derivative_error = Sections.finalize_theorem taylor_derivative_error;;
1637 let derivative_interval = Sections.finalize_theorem derivative_interval;;
1638 let taylor_derivative_upper_bound = Sections.finalize_theorem taylor_derivative_upper_bound;;
1639 let taylor_derivative_lower_bound = Sections.finalize_theorem taylor_derivative_lower_bound;;
1640 Sections.end_section "Taylor";;
1641
1642 (* Section LinearApproximation *)
1643 Sections.begin_section "LinearApproximation";;
1644 (Sections.add_section_var (mk_var ("f", (`:real->real`))));;
1645 (Sections.add_section_var (mk_var ("f_bounds", (`:real#real`))); Sections.add_section_var (mk_var ("df_bounds", (`:real#real`))));;
1646 (Sections.add_section_var (mk_var ("x", (`:real`))));;
1647
1648 (* Lemma lin_approx_eq *)
1649 let lin_approx_eq = Sections.section_proof []
1650 `lin_approx f x f_bounds df_bounds <=>
1651 (f real_differentiable atreal x /\ interval_arith (f x) f_bounds /\
1652 interval_arith (derivative f x) df_bounds)`
1653 [
1654 (((((use_arg_then2 ("lin_approx", [lin_approx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [(case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (case THEN (move ["f'"])) THEN (case THEN ((move ["df'"]) THEN (move ["int_f'"]))))); ((case THEN ((case THEN (move ["f'"])) THEN (move ["df"]))) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["df_int"]))))]));
1655 ((THENL_FIRST) (split_tac) (((use_arg_then2 ("f'", [])) (term_tac exists_tac)) THEN (done_tac)));
1656 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("derivative_unique", [derivative_unique])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1657 ((((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("f'", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("derivative_unique", [derivative_unique])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1658 ];;
1659 (Sections.add_section_hyp "approx_f" (`lin_approx f x f_bounds df_bounds`));;
1660
1661 (* Lemma lin_approx_imp_f_interval *)
1662 let lin_approx_imp_f_interval = Sections.section_proof []
1663 `interval_arith (f x) f_bounds`
1664 [
1665 ((((use_arg_then2 ("approx_f", [])) (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
1666 ];;
1667
1668 (* Lemma lin_approx_imp_df_interval *)
1669 let lin_approx_imp_df_interval = Sections.section_proof []
1670 `interval_arith (derivative f x) df_bounds`
1671 [
1672 ((((use_arg_then2 ("approx_f", [])) (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
1673 ];;
1674
1675 (* Lemma lin_approx_imp_f_diff *)
1676 let lin_approx_imp_f_diff = Sections.section_proof []
1677 `f real_differentiable atreal x`
1678 [
1679 ((((use_arg_then2 ("approx_f", [])) (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
1680 ];;
1681
1682 (* Finalization of the section LinearApproximation *)
1683 let lin_approx_eq = Sections.finalize_theorem lin_approx_eq;;
1684 let lin_approx_imp_f_interval = Sections.finalize_theorem lin_approx_imp_f_interval;;
1685 let lin_approx_imp_df_interval = Sections.finalize_theorem lin_approx_imp_df_interval;;
1686 let lin_approx_imp_f_diff = Sections.finalize_theorem lin_approx_imp_f_diff;;
1687 Sections.end_section "LinearApproximation";;
1688
1689 (* Section MoreLinearApproximation *)
1690 Sections.begin_section "MoreLinearApproximation";;
1691 (Sections.add_section_var (mk_var ("f", (`:real->real`))); Sections.add_section_var (mk_var ("g", (`:real->real`))));;
1692 (Sections.add_section_var (mk_var ("x", (`:real`))));;
1693 (Sections.add_section_var (mk_var ("f_bounds", (`:real#real`))); Sections.add_section_var (mk_var ("df_bounds", (`:real#real`))));;
1694 (Sections.add_section_var (mk_var ("g_bounds", (`:real#real`))); Sections.add_section_var (mk_var ("dg_bounds", (`:real#real`))));;
1695
1696 (* Lemma interval_arith_not_zero *)
1697 let interval_arith_not_zero = Sections.section_proof ["x";"int"]
1698 `interval_arith x int ==> interval_not_zero int ==>
1699 ~(x = &0)`
1700 [
1701 (((((fun arg_tac -> (use_arg_then2 ("PAIR", [PAIR])) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_not_zero", [interval_not_zero]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1702 ];;
1703
1704 (* Lemma interval_arith_pos *)
1705 let interval_arith_pos = Sections.section_proof ["x";"int"]
1706 `interval_arith x int ==> interval_pos int ==> &0 < x`
1707 [
1708 ((((use_arg_then2 ("int", [])) (disch_tac [])) THEN (clear_assumption "int") THEN case) THEN ((((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_pos", [interval_pos]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1709 ];;
1710
1711 (* Lemma interval_arith_neg *)
1712 let interval_arith_neg = Sections.section_proof ["x";"int"]
1713 `interval_arith x int ==> interval_neg int ==> x < &0`
1714 [
1715 ((((use_arg_then2 ("int", [])) (disch_tac [])) THEN (clear_assumption "int") THEN case) THEN ((((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_neg", [interval_neg]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1716 ];;
1717
1718 (* Lemma interval_arith_abs *)
1719 let interval_arith_abs = Sections.section_proof ["x";"int";"y"]
1720 `interval_arith x int ==> iabs int < y ==> abs x < y`
1721 [
1722 (((((fun arg_tac -> (use_arg_then2 ("PAIR", [PAIR])) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iabs", [iabs]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1723 ];;
1724
1725 (* Lemma lin_approx_x *)
1726 let lin_approx_x = Sections.section_proof []
1727 `lin_approx (\x. x) x (x, x) (&1, &1)`
1728 [
1729 (((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_x", [derivative_x]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_ID", [REAL_DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1730 ];;
1731
1732 (* Lemma lin_approx_const *)
1733 let lin_approx_const = Sections.section_proof ["c"]
1734 `lin_approx (\x. c) x (c, c) (&0, &0)`
1735 [
1736 ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))));
1737 ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1738 ];;
1739
1740 (* Section LinearApproxUnivariateComposition *)
1741 Sections.begin_section "LinearApproxUnivariateComposition";;
1742 (Sections.add_section_hyp "approx_f" (`lin_approx f x f_bounds df_bounds`));;
1743
1744 (* Lemma lin_approx_compose_atn *)
1745 let lin_approx_compose_atn = Sections.section_proof []
1746 `(\x. atn (f x)) real_differentiable atreal x /\
1747 derivative (\x. atn (f x)) x = derivative f x / (&1 + f x * f x)`
1748 [
1749 ((((use_arg_then2 ("derivative_compose_atn", [derivative_compose_atn])) (disch_tac [])) THEN (clear_assumption "derivative_compose_atn") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("approx_f", [])) (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1750 ];;
1751
1752 (* Lemma lin_approx_compose_exp *)
1753 let lin_approx_compose_exp = Sections.section_proof []
1754 `(\x. exp (f x)) real_differentiable atreal x /\
1755 derivative (\x. exp (f x)) x = exp (f x) * derivative f x`
1756 [
1757 ((((use_arg_then2 ("derivative_compose_exp", [derivative_compose_exp])) (disch_tac [])) THEN (clear_assumption "derivative_compose_exp") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("approx_f", [])) (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1758 ];;
1759
1760 (* Lemma lin_approx_compose_log *)
1761 let lin_approx_compose_log = Sections.section_proof []
1762 `interval_pos f_bounds ==>
1763 (\x. log (f x)) real_differentiable atreal x /\
1764 derivative (\x. log (f x)) x = derivative f x / f x`
1765 [
1766 ((((use_arg_then2 ("approx_f", [])) (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["df"]) THEN (move ["h"]))) THEN (move ["f_ineq"])));
1767 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < f x`))) (term_tac (have_gen_tac [](move ["f_pos"])))) ((((use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (disch_tac [])) THEN (clear_assumption "interval_arith_pos") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("f_bounds", [])) (term_tac exists_tac)) THEN (done_tac)));
1768 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("derivative_compose_log", [derivative_compose_log])) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_pos", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac));
1769 ];;
1770
1771 (* Lemma lin_approx_compose_cos *)
1772 let lin_approx_compose_cos = Sections.section_proof []
1773 `(\x. cos (f x)) real_differentiable atreal x /\
1774 derivative (\x. cos (f x)) x = --(sin (f x) * derivative f x)`
1775 [
1776 ((((use_arg_then2 ("derivative_compose_cos", [derivative_compose_cos])) (disch_tac [])) THEN (clear_assumption "derivative_compose_cos") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("approx_f", [])) (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1777 ];;
1778
1779 (* Lemma lin_approx_compose_sin *)
1780 let lin_approx_compose_sin = Sections.section_proof []
1781 `(\x. sin (f x)) real_differentiable atreal x /\
1782 derivative (\x. sin (f x)) x = cos (f x) * derivative f x`
1783 [
1784 ((((use_arg_then2 ("derivative_compose_sin", [derivative_compose_sin])) (disch_tac [])) THEN (clear_assumption "derivative_compose_sin") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("approx_f", [])) (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1785 ];;
1786
1787 (* Lemma lin_approx_compose_inv *)
1788 let lin_approx_compose_inv = Sections.section_proof []
1789 `interval_not_zero f_bounds ==>
1790 (\x. inv (f x)) real_differentiable atreal x /\
1791 derivative (\x. inv (f x)) x = -- inv (f x * f x) * derivative f x`
1792 [
1793 ((((use_arg_then2 ("approx_f", [])) (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["df"]) THEN (move ["h"]))) THEN (move ["f0"])));
1794 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(f x = &0)`))) (term_tac (have_gen_tac [](move ["fn0"])))) ((((use_arg_then2 ("interval_arith_not_zero", [interval_arith_not_zero])) (disch_tac [])) THEN (clear_assumption "interval_arith_not_zero") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("f_bounds", [])) (term_tac exists_tac)) THEN (done_tac)));
1795 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("derivative_compose_inv", [derivative_compose_inv])) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fn0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac));
1796 ];;
1797
1798 (* Lemma lin_approx_compose_sqrt *)
1799 let lin_approx_compose_sqrt = Sections.section_proof []
1800 `interval_pos f_bounds ==>
1801 (\x. sqrt (f x)) real_differentiable atreal x /\
1802 derivative (\x. sqrt (f x)) x = derivative f x / (&2 * sqrt (f x))`
1803 [
1804 ((((use_arg_then2 ("approx_f", [])) (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["df"]) THEN (move ["h"]))) THEN (move ["f_ineq"])));
1805 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < f x`))) (term_tac (have_gen_tac [](move ["f_pos"])))) ((((use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (disch_tac [])) THEN (clear_assumption "interval_arith_pos") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("f_bounds", [])) (term_tac exists_tac)) THEN (done_tac)));
1806 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("derivative_compose_sqrt", [derivative_compose_sqrt])) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_pos", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac));
1807 ];;
1808
1809 (* Lemma lin_approx_compose_acs *)
1810 let lin_approx_compose_acs = Sections.section_proof []
1811 `iabs f_bounds < &1 ==>
1812 (\x. acs (f x)) real_differentiable atreal x /\
1813 derivative (\x. acs (f x)) x = -- (derivative f x / sqrt (&1 - f x * f x))`
1814 [
1815 ((((use_arg_then2 ("approx_f", [])) (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["df"]) THEN (move ["h"]))) THEN (move ["f_ineq"])));
1816 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`abs (f x) < &1`))) (term_tac (have_gen_tac [](move ["f_abs"])))) ((((use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (disch_tac [])) THEN (clear_assumption "interval_arith_abs") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("f_bounds", [])) (term_tac exists_tac)) THEN (done_tac)));
1817 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("derivative_compose_acs", [derivative_compose_acs])) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_abs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac));
1818 ];;
1819
1820 (* Lemma lin_approx_compose_asn *)
1821 let lin_approx_compose_asn = Sections.section_proof []
1822 `iabs f_bounds < &1 ==>
1823 (\x. asn (f x)) real_differentiable atreal x /\
1824 derivative (\x. asn (f x)) x = derivative f x / sqrt (&1 - f x * f x)`
1825 [
1826 ((((use_arg_then2 ("approx_f", [])) (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["df"]) THEN (move ["h"]))) THEN (move ["f_ineq"])));
1827 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`abs (f x) < &1`))) (term_tac (have_gen_tac [](move ["f_abs"])))) ((((use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (disch_tac [])) THEN (clear_assumption "interval_arith_abs") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("f_bounds", [])) (term_tac exists_tac)) THEN (done_tac)));
1828 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("derivative_compose_asn", [derivative_compose_asn])) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_abs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac));
1829 ];;
1830
1831 (* Lemma lin_approx_compose_matan *)
1832 let lin_approx_compose_matan = Sections.section_proof []
1833 `interval_gt (-- &1) f_bounds ==>
1834 (\x. matan (f x)) real_differentiable atreal x /\
1835 derivative (\x. matan (f x)) x = dmatan (f x) * derivative f x`
1836 [
1837 ((((use_arg_then2 ("approx_f", [])) (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["df"]) THEN (move ["h"]))) THEN (move ["f_ineq"])));
1838 ((fun arg_tac -> arg_tac (Arg_term (`-- &1 < f x`))) (term_tac (have_gen_tac [](move ["f_ineq2"]))));
1839 ((((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN ((use_arg_then2 ("f_ineq", [])) (disch_tac [])) THEN (clear_assumption "f_ineq") THEN BETA_TAC) THEN ((((fun arg_tac -> (use_arg_then2 ("pair_eq", [pair_eq])) (fun fst_arg -> (use_arg_then2 ("f_bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_gt", [interval_gt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1840 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("derivative_compose_matan", [derivative_compose_matan])) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_ineq2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac));
1841 ];;
1842
1843 (* Finalization of the section LinearApproxUnivariateComposition *)
1844 let lin_approx_compose_atn = Sections.finalize_theorem lin_approx_compose_atn;;
1845 let lin_approx_compose_exp = Sections.finalize_theorem lin_approx_compose_exp;;
1846 let lin_approx_compose_log = Sections.finalize_theorem lin_approx_compose_log;;
1847 let lin_approx_compose_cos = Sections.finalize_theorem lin_approx_compose_cos;;
1848 let lin_approx_compose_sin = Sections.finalize_theorem lin_approx_compose_sin;;
1849 let lin_approx_compose_inv = Sections.finalize_theorem lin_approx_compose_inv;;
1850 let lin_approx_compose_sqrt = Sections.finalize_theorem lin_approx_compose_sqrt;;
1851 let lin_approx_compose_acs = Sections.finalize_theorem lin_approx_compose_acs;;
1852 let lin_approx_compose_asn = Sections.finalize_theorem lin_approx_compose_asn;;
1853 let lin_approx_compose_matan = Sections.finalize_theorem lin_approx_compose_matan;;
1854 Sections.end_section "LinearApproxUnivariateComposition";;
1855 (Sections.add_section_hyp "approx_f" (`lin_approx f x f_bounds df_bounds`));;
1856 (Sections.add_section_hyp "approx_g" (`lin_approx g x g_bounds dg_bounds`));;
1857
1858 (* Lemma lin_approx_imp_add_diff *)
1859 let lin_approx_imp_add_diff = Sections.section_proof []
1860 `(\x. f x + g x) real_differentiable atreal x`
1861 [
1862 (((use_arg_then2 ("REAL_DIFFERENTIABLE_ADD", [REAL_DIFFERENTIABLE_ADD])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_ADD") THEN (DISCH_THEN apply_tac));
1863 (((((fun arg_tac -> (use_arg_then2 ("lin_approx_imp_f_diff", [lin_approx_imp_f_diff])) (fun fst_arg -> (use_arg_then2 ("approx_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("lin_approx_imp_f_diff", [lin_approx_imp_f_diff])) (fun fst_arg -> (use_arg_then2 ("approx_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1864 ];;
1865
1866 (* Lemma lin_approx_imp_sub_diff *)
1867 let lin_approx_imp_sub_diff = Sections.section_proof []
1868 `(\x. f x - g x) real_differentiable atreal x`
1869 [
1870 (((use_arg_then2 ("REAL_DIFFERENTIABLE_SUB", [REAL_DIFFERENTIABLE_SUB])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_SUB") THEN (DISCH_THEN apply_tac));
1871 (((((fun arg_tac -> (use_arg_then2 ("lin_approx_imp_f_diff", [lin_approx_imp_f_diff])) (fun fst_arg -> (use_arg_then2 ("approx_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("lin_approx_imp_f_diff", [lin_approx_imp_f_diff])) (fun fst_arg -> (use_arg_then2 ("approx_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1872 ];;
1873
1874 (* Lemma lin_approx_imp_mul_diff *)
1875 let lin_approx_imp_mul_diff = Sections.section_proof []
1876 `(\x. f x * g x) real_differentiable atreal x`
1877 [
1878 (((use_arg_then2 ("REAL_DIFFERENTIABLE_MUL_ATREAL", [REAL_DIFFERENTIABLE_MUL_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_MUL_ATREAL") THEN (DISCH_THEN apply_tac));
1879 (((((fun arg_tac -> (use_arg_then2 ("lin_approx_imp_f_diff", [lin_approx_imp_f_diff])) (fun fst_arg -> (use_arg_then2 ("approx_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("lin_approx_imp_f_diff", [lin_approx_imp_f_diff])) (fun fst_arg -> (use_arg_then2 ("approx_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1880 ];;
1881
1882 (* Lemma lin_approx_imp_div_diff *)
1883 let lin_approx_imp_div_diff = Sections.section_proof []
1884 `interval_not_zero g_bounds ==> (\x. f x / g x) real_differentiable atreal x`
1885 [
1886 ((BETA_TAC THEN (move ["gn0"])) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_DIV_ATREAL", [REAL_DIFFERENTIABLE_DIV_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_DIV_ATREAL") THEN (DISCH_THEN apply_tac)));
1887 ((((fun arg_tac -> (use_arg_then2 ("lin_approx_imp_f_diff", [lin_approx_imp_f_diff])) (fun fst_arg -> (use_arg_then2 ("approx_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("lin_approx_imp_f_diff", [lin_approx_imp_f_diff])) (fun fst_arg -> (use_arg_then2 ("approx_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
1888 ((((use_arg_then2 ("interval_arith_not_zero", [interval_arith_not_zero])) (disch_tac [])) THEN (clear_assumption "interval_arith_not_zero") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("g_bounds", [])) (term_tac exists_tac)));
1889 ((((use_arg_then2 ("approx_g", [])) (disch_tac [])) THEN (clear_assumption "approx_g") THEN BETA_TAC) THEN ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1890 ];;
1891
1892 (* Finalization of the section MoreLinearApproximation *)
1893 let interval_arith_not_zero = Sections.finalize_theorem interval_arith_not_zero;;
1894 let interval_arith_pos = Sections.finalize_theorem interval_arith_pos;;
1895 let interval_arith_neg = Sections.finalize_theorem interval_arith_neg;;
1896 let interval_arith_abs = Sections.finalize_theorem interval_arith_abs;;
1897 let lin_approx_x = Sections.finalize_theorem lin_approx_x;;
1898 let lin_approx_const = Sections.finalize_theorem lin_approx_const;;
1899 let lin_approx_compose_atn = Sections.finalize_theorem lin_approx_compose_atn;;
1900 let lin_approx_compose_exp = Sections.finalize_theorem lin_approx_compose_exp;;
1901 let lin_approx_compose_log = Sections.finalize_theorem lin_approx_compose_log;;
1902 let lin_approx_compose_cos = Sections.finalize_theorem lin_approx_compose_cos;;
1903 let lin_approx_compose_sin = Sections.finalize_theorem lin_approx_compose_sin;;
1904 let lin_approx_compose_inv = Sections.finalize_theorem lin_approx_compose_inv;;
1905 let lin_approx_compose_sqrt = Sections.finalize_theorem lin_approx_compose_sqrt;;
1906 let lin_approx_compose_acs = Sections.finalize_theorem lin_approx_compose_acs;;
1907 let lin_approx_compose_asn = Sections.finalize_theorem lin_approx_compose_asn;;
1908 let lin_approx_compose_matan = Sections.finalize_theorem lin_approx_compose_matan;;
1909 let lin_approx_imp_add_diff = Sections.finalize_theorem lin_approx_imp_add_diff;;
1910 let lin_approx_imp_sub_diff = Sections.finalize_theorem lin_approx_imp_sub_diff;;
1911 let lin_approx_imp_mul_diff = Sections.finalize_theorem lin_approx_imp_mul_diff;;
1912 let lin_approx_imp_div_diff = Sections.finalize_theorem lin_approx_imp_div_diff;;
1913 Sections.end_section "MoreLinearApproximation";;
1914
1915 (* Section LinearApproxArith *)
1916 Sections.begin_section "LinearApproxArith";;
1917 (Sections.add_section_var (mk_var ("f1", (`:real->real`))); Sections.add_section_var (mk_var ("f2", (`:real->real`))));;
1918 (Sections.add_section_var (mk_var ("f1_bounds", (`:real#real`))); Sections.add_section_var (mk_var ("f2_bounds", (`:real#real`))));;
1919 (Sections.add_section_var (mk_var ("df1_lo", (`:real`))); Sections.add_section_var (mk_var ("df1_hi", (`:real`))); Sections.add_section_var (mk_var ("df2_lo", (`:real`))); Sections.add_section_var (mk_var ("df2_hi", (`:real`))));;
1920 (Sections.add_section_var (mk_var ("f_bounds", (`:real#real`))));;
1921 (Sections.add_section_var (mk_var ("df_lo", (`:real`))); Sections.add_section_var (mk_var ("df_hi", (`:real`))));;
1922 (Sections.add_section_var (mk_var ("x", (`:real`))));;
1923 (Sections.add_section_hyp "approx1" (`lin_approx f1 x f1_bounds (df1_lo, df1_hi)`));;
1924
1925 (* Lemma lin_approx_scale *)
1926 let lin_approx_scale = Sections.section_proof ["c"]
1927 `&0 <= c ==> interval_arith (c * f1 x) f_bounds /\
1928 df_lo <= c * df1_lo /\ c * df1_hi <= df_hi ==>
1929 lin_approx (\x. c * f1 x) x f_bounds (df_lo, df_hi)`
1930 [
1931 (((((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] []))))) THEN (move ["c0"]) THEN (move ["ineqs"]));
1932 (((((use_arg_then2 ("lin_approx", [lin_approx]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac));
1933 ((((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN ((use_arg_then2 ("approx1", [])) (disch_tac [])) THEN (clear_assumption "approx1") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("lin_approx", [lin_approx]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac));
1934 ((((use_arg_then2 ("approx1", [])) (disch_tac [])) THEN (clear_assumption "approx1") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("lin_approx", [lin_approx]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["int_f1"])) THEN (case THEN (move ["f1'"])) THEN (case THEN ((move ["df1"]) THEN (move ["int_f1'"])))));
1935 (((fun arg_tac -> arg_tac (Arg_term (`c * f1'`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_LMUL_ATREAL", [HAS_REAL_DERIVATIVE_LMUL_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
1936 ((((use_arg_then2 ("int_f1'", [])) (disch_tac [])) THEN (clear_assumption "int_f1'") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] []))))) THEN (move ["ineqs2"])) THEN (split_tac) THEN (((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)));
1937 (((fun arg_tac -> arg_tac (Arg_term (`c * df1_lo`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_LMUL", [REAL_LE_LMUL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1938 (((fun arg_tac -> arg_tac (Arg_term (`c * df1_hi`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_LMUL", [REAL_LE_LMUL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1939 ];;
1940 (Sections.add_section_hyp "approx2" (`lin_approx f2 x f2_bounds (df2_lo, df2_hi)`));;
1941
1942 (* Lemma lin_approx_add *)
1943 let lin_approx_add = Sections.section_proof []
1944 `interval_arith (f1 x + f2 x) f_bounds /\
1945 df_lo <= df1_lo + df2_lo /\ df1_hi + df2_hi <= df_hi ==>
1946 lin_approx (\x. f1 x + f2 x) x f_bounds (df_lo, df_hi)`
1947 [
1948 (((((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] []))))) THEN (move ["ineqs"]));
1949 (((((use_arg_then2 ("lin_approx", [lin_approx]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac));
1950 ((((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN ((use_arg_then2 ("approx2", [])) (disch_tac [])) THEN (clear_assumption "approx2") THEN ((use_arg_then2 ("approx1", [])) (disch_tac [])) THEN (clear_assumption "approx1") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("lin_approx", [lin_approx]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac));
1951 ((((use_arg_then2 ("approx2", [])) (disch_tac [])) THEN (clear_assumption "approx2") THEN ((use_arg_then2 ("approx1", [])) (disch_tac [])) THEN (clear_assumption "approx1") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("lin_approx", [lin_approx]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["int_f1"])) THEN (case THEN (move ["f1'"])) THEN (case THEN ((move ["df1"]) THEN (move ["int_f1'"])))));
1952 (BETA_TAC THEN (case THEN (move ["int_f2"])) THEN (case THEN (move ["f2'"])) THEN (case THEN ((move ["df2"]) THEN (move ["int_f2'"]))));
1953 (((fun arg_tac -> arg_tac (Arg_term (`f1' + f2':real`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_ADD", [HAS_REAL_DERIVATIVE_ADD]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
1954 ((((use_arg_then2 ("int_f2'", [])) (disch_tac [])) THEN (clear_assumption "int_f2'") THEN ((use_arg_then2 ("int_f1'", [])) (disch_tac [])) THEN (clear_assumption "int_f1'") THEN ((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1955 ];;
1956
1957 (* Finalization of the section LinearApproxArith *)
1958 let lin_approx_scale = Sections.finalize_theorem lin_approx_scale;;
1959 let lin_approx_add = Sections.finalize_theorem lin_approx_add;;
1960 Sections.end_section "LinearApproxArith";;
1961
1962 (* Section SecondDerivativeBound *)
1963 Sections.begin_section "SecondDerivativeBound";;
1964 (Sections.add_section_var (mk_var ("f1", (`:real->real`))); Sections.add_section_var (mk_var ("f2", (`:real->real`))));;
1965 (Sections.add_section_var (mk_var ("int", (`:real#real`))));;
1966 (Sections.add_section_var (mk_var ("dd1", (`:real#real`))); Sections.add_section_var (mk_var ("dd2", (`:real#real`))));;
1967
1968 (* Lemma nth_diff_strong2_eq_alt *)
1969 let nth_diff_strong2_eq_alt = Sections.section_proof ["f";"x"]
1970 `nth_diff_strong 2 f x <=> ?s. real_open s /\ x IN s /\
1971 !y. y IN s ==> (f has_real_derivative derivative f y) (atreal y) /\
1972 (derivative f has_real_derivative nth_derivative 2 f y) (atreal y)`
1973 [
1974 ((((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_differentiable_eq", [nth_differentiable_eq]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `i < 2 <=> i = 0 \/ i = 1`)))(thm_tac (new_rewrite [] [])))));
1975 ((split_tac) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]));
1976 (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("df", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["_"])) THEN (move ["h"])));
1977 ((((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (simp_tac)) THEN (((((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_derivative1", [nth_derivative1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_derivative0", [nth_derivative0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("TWO", [TWO]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1978 (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("df", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"])));
1979 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL", [REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
1980 ((((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`derivative f y`))) (term_tac exists_tac)) THEN (done_tac));
1981 ((BETA_TAC THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("TWO", [TWO]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("nth_derivative0", [nth_derivative0]))(fun tmp_arg1 -> (use_arg_then2 ("nth_derivative1", [nth_derivative1]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1982 ];;
1983
1984 (* Lemma nth_diff_strong2_eq *)
1985 let nth_diff_strong2_eq = Sections.section_proof ["f";"x"]
1986 `nth_diff_strong 2 f x <=> ?s. real_open s /\ x IN s /\
1987 !y. y IN s ==> f real_differentiable atreal y /\ derivative f real_differentiable atreal y`
1988 [
1989 ((((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("TWO", [TWO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL nth_differentiable)))(thm_tac (new_rewrite [] []))))));
1990 ((((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_derivative0", [nth_derivative0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_derivative1", [nth_derivative1]))(thm_tac (new_rewrite [] [])))));
1991 ((split_tac) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]));
1992 (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("df", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"])) THEN (done_tac));
1993 (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("df", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"])));
1994 (((repeat_tactic 1 9 (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL", [REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1995 ];;
1996
1997 (* Lemma lin_approx_compose *)
1998 let lin_approx_compose = Sections.section_proof ["f";"g";"y";"g_bounds";"f_bounds";"d_bounds"]
1999 `nth_diff_strong_int 2 g_bounds f ==>
2000 g real_differentiable atreal y ==>
2001 interval_arith (g y) g_bounds ==>
2002 bounded_on_int f g_bounds f_bounds ==>
2003 interval_arith (derivative g y * derivative f (g y)) d_bounds ==>
2004 lin_approx (\x. f (g x)) y f_bounds d_bounds`
2005 [
2006 (((((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["g_int"]) THEN (move ["f_int"]) THEN (move ["dfg_int"]));
2007 ((fun arg_tac -> arg_tac (Arg_term (`f real_differentiable atreal (g y)`))) (term_tac (have_gen_tac [](move ["dfgy"]))));
2008 ((((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("g_int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["ys"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2009 ((((use_arg_then2 ("lin_approx_eq", [lin_approx_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dfg_int", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_int", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))));
2010 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL])) (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (exact_tac)) THEN (done_tac));
2011 ];;
2012
2013 (* Lemma second_derivative_abs_pos *)
2014 let second_derivative_abs_pos = Sections.section_proof ["x"]
2015 `&0 < x ==> nth_derivative 2 abs x = &0`
2016 [
2017 ((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (move ["x_pos"]));
2018 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_TRANSFORM_ATREAL", [HAS_REAL_DERIVATIVE_TRANSFORM_ATREAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_TRANSFORM_ATREAL") THEN (DISCH_THEN apply_tac)));
2019 ((((fun arg_tac -> arg_tac (Arg_term (`\x. &1`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac))) THEN (((((use_arg_then2 ("HAS_REAL_DERIVATIVE_CONST", [HAS_REAL_DERIVATIVE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_pos", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["t"]) THEN (move ["t_ineq"])));
2020 ((((use_arg_then2 ("derivative_abs_pos", [derivative_abs_pos]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2021 ((((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then2 ("x_pos", [])) (disch_tac [])) THEN (clear_assumption "x_pos") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2022 ];;
2023
2024 (* Lemma second_derivative_abs_neg *)
2025 let second_derivative_abs_neg = Sections.section_proof ["x"]
2026 `x < &0 ==> nth_derivative 2 abs x = &0`
2027 [
2028 ((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (move ["x_neg"]));
2029 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_TRANSFORM_ATREAL", [HAS_REAL_DERIVATIVE_TRANSFORM_ATREAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_TRANSFORM_ATREAL") THEN (DISCH_THEN apply_tac)));
2030 ((((fun arg_tac -> arg_tac (Arg_term (`\x. -- &1`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`--x`))) (term_tac exists_tac))) THEN ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_CONST", [HAS_REAL_DERIVATIVE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)));
2031 ((THENL_FIRST) ((THENL) (split_tac) [ALL_TAC; ((move ["t"]) THEN (move ["t_ineq"]))]) ((((use_arg_then2 ("x_neg", [])) (disch_tac [])) THEN (clear_assumption "x_neg") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2032 ((((use_arg_then2 ("derivative_abs_neg", [derivative_abs_neg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2033 ((((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then2 ("x_neg", [])) (disch_tac [])) THEN (clear_assumption "x_neg") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2034 ];;
2035
2036 (* Lemma diff2_abs_pos *)
2037 let diff2_abs_pos = Sections.section_proof ["x"]
2038 `&0 < x ==> nth_diff_strong 2 abs x`
2039 [
2040 ((((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] [])))) THEN (move ["x_ineq"]));
2041 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - abs x, x + abs x)`))) (term_tac exists_tac));
2042 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))]));
2043 ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2044 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_ABS_POS", [REAL_DIFFERENTIABLE_AT_ABS_POS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
2045 ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2046 ((((use_arg_then2 ("differentiable_local", [differentiable_local])) (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`\x. &1`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval (y - abs y, y + abs y)`))) (term_tac exists_tac))));
2047 ((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
2048 ((THENL_FIRST) ((THENL) (split_tac) [ALL_TAC; ((move ["t"]) THEN (move ["t_ineq"]))]) ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2049 ((((use_arg_then2 ("derivative_abs_pos", [derivative_abs_pos]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2050 ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2051 ];;
2052
2053 (* Lemma diff2_abs_neg *)
2054 let diff2_abs_neg = Sections.section_proof ["x"]
2055 `x < &0 ==> nth_diff_strong 2 abs x`
2056 [
2057 ((((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] [])))) THEN (move ["x_ineq"]));
2058 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - abs x, x + abs x)`))) (term_tac exists_tac));
2059 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))]));
2060 ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2061 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_ABS_NEG", [REAL_DIFFERENTIABLE_AT_ABS_NEG]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
2062 ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2063 ((((use_arg_then2 ("differentiable_local", [differentiable_local])) (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`\x. -- &1`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval (y - abs y, y + abs y)`))) (term_tac exists_tac))));
2064 ((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
2065 ((THENL_FIRST) ((THENL) (split_tac) [ALL_TAC; ((move ["t"]) THEN (move ["t_ineq"]))]) ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2066 ((((use_arg_then2 ("derivative_abs_neg", [derivative_abs_neg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2067 ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2068 ];;
2069
2070 (* Lemma pow_x_has_real_derivative *)
2071 let pow_x_has_real_derivative = Sections.section_proof ["n";"x"]
2072 `((\x. x pow n) has_real_derivative &n * x pow (n - 1)) (atreal x)`
2073 [
2074 ((((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(gsym_then (thm_tac (new_rewrite [] [(`x pow (n - 1)`)]))))) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_POW_ATREAL", [HAS_REAL_DERIVATIVE_POW_ATREAL]))(thm_tac (new_rewrite [] [])))));
2075 ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_ID", [HAS_REAL_DERIVATIVE_ID]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2076 ];;
2077
2078 (* Lemma second_derivative_pow_x *)
2079 let second_derivative_pow_x = Sections.section_proof ["n"]
2080 `derivative (derivative (\x. x pow n)) = (\x. &(n * (n - 1)) * x pow (n - 2))`
2081 [
2082 ((((((use_arg_then2 ("derivative_pow_x", [derivative_pow_x]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["x"]) THEN (simp_tac)) THEN (((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)));
2083 ((((use_arg_then2 ("REAL_OF_NUM_MUL", [REAL_OF_NUM_MUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LMUL_ATREAL", [HAS_REAL_DERIVATIVE_LMUL_ATREAL]))(thm_tac (new_rewrite [] [])))));
2084 (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `n - 2 = (n - 1) - 1`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pow_x_has_real_derivative", [pow_x_has_real_derivative]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2085 ];;
2086
2087 (* Lemma diff2_pow_x *)
2088 let diff2_pow_x = Sections.section_proof ["n";"x"]
2089 `nth_diff_strong 2 (\x. x pow n) x`
2090 [
2091 ((((use_arg_then2 ("nth_diff_strong2_eq_alt", [nth_diff_strong2_eq_alt]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real)`))) (term_tac exists_tac)));
2092 (((((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OPEN_UNIV", [REAL_OPEN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (simp_tac));
2093 ((((use_arg_then2 ("derivative_pow_x", [derivative_pow_x]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("pow_x_has_real_derivative", [pow_x_has_real_derivative]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2094 ((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("second_derivative_pow_x", [second_derivative_pow_x]))(thm_tac (new_rewrite [] [])))));
2095 ((((use_arg_then2 ("REAL_OF_NUM_MUL", [REAL_OF_NUM_MUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LMUL_ATREAL", [HAS_REAL_DERIVATIVE_LMUL_ATREAL]))(thm_tac (new_rewrite [] [])))));
2096 (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `n - 2 = (n - 1) - 1`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pow_x_has_real_derivative", [pow_x_has_real_derivative]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2097 ];;
2098
2099 (* Lemma second_derivative_pow2_x *)
2100 let second_derivative_pow2_x = Sections.section_proof []
2101 `derivative (derivative (\x. x pow 2)) = (\x. &2)`
2102 [
2103 ((((use_arg_then2 ("second_derivative_pow_x", [second_derivative_pow_x]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_pow", [real_pow]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 * (2 - 1) = 2`)))(thm_tac (new_rewrite [] [])))));
2104 ((((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2105 ];;
2106
2107 (* Lemma second_derivative_pow3_x *)
2108 let second_derivative_pow3_x = Sections.section_proof []
2109 `derivative (derivative (\x. x pow 3)) = (\x. &6 * x)`
2110 [
2111 ((((use_arg_then2 ("second_derivative_pow_x", [second_derivative_pow_x]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 * (3 - 1) = 6 /\ 3 - 2 = 1`)))(thm_tac (new_rewrite [] []))))));
2112 ((((use_arg_then2 ("REAL_POW_1", [REAL_POW_1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2113 ];;
2114
2115 (* Lemma second_derivative_atn_eq *)
2116 let second_derivative_atn_eq = Sections.section_proof ["x"]
2117 `((\x. inv (&1 + x pow 2)) has_real_derivative
2118 (-- &2 * x) * inv (&1 + x pow 2) pow 2) (atreal x)`
2119 [
2120 (((((use_arg_then2 ("REAL_POW_INV", [REAL_POW_INV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_NEG_LMUL", [REAL_NEG_LMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_INV_ATREAL", [HAS_REAL_DERIVATIVE_INV_ATREAL]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
2121 ((((fun arg_tac -> (use_arg_then2 ("REAL_ADD_LID", [REAL_ADD_LID])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&2 * x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_ADD", [HAS_REAL_DERIVATIVE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_CONST", [HAS_REAL_DERIVATIVE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2122 ((((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `&2 * x = x * &1 + &1 * x`)))(thm_tac (new_rewrite [] [])))));
2123 (((((use_arg_then2 ("HAS_REAL_DERIVATIVE_MUL_ATREAL", [HAS_REAL_DERIVATIVE_MUL_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_ID", [HAS_REAL_DERIVATIVE_ID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2124 (((((use_arg_then2 ("REAL_LT_IMP_NZ", [REAL_LT_IMP_NZ]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_ADD1", [REAL_LT_ADD1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_POW_2", [REAL_LE_POW_2]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2125 ];;
2126
2127 (* Lemma second_derivative_atn *)
2128 let second_derivative_atn = Sections.section_proof []
2129 `derivative (derivative atn) = (\x. (-- &2 * x) * inv (&1 + x pow 2) pow 2)`
2130 [
2131 ((((((use_arg_then2 ("derivative_atn", [derivative_atn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["x"]) THEN (simp_tac)) THEN (((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)));
2132 (((((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("second_derivative_atn_eq", [second_derivative_atn_eq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2133 ];;
2134
2135 (* Lemma diff2_atn *)
2136 let diff2_atn = Sections.section_proof ["x"]
2137 `nth_diff_strong 2 atn x`
2138 [
2139 ((((use_arg_then2 ("nth_diff_strong2_eq_alt", [nth_diff_strong2_eq_alt]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real)`))) (term_tac exists_tac)));
2140 (((((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OPEN_UNIV", [REAL_OPEN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (simp_tac));
2141 ((((use_arg_then2 ("derivative_atn", [derivative_atn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_ATN", [HAS_REAL_DERIVATIVE_ATN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2142 (((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("second_derivative_atn", [second_derivative_atn]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("second_derivative_atn_eq", [second_derivative_atn_eq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2143 ];;
2144
2145 (* Lemma second_derivative_cos *)
2146 let second_derivative_cos = Sections.section_proof []
2147 `nth_derivative 2 cos = (\x. --cos x)`
2148 [
2149 (((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_cos", [derivative_cos]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["x"]));
2150 (((((use_arg_then2 ("derivative_neg", [derivative_neg]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_SIN", [REAL_DIFFERENTIABLE_AT_SIN]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("derivative_sin", [derivative_sin]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2151 ];;
2152
2153 (* Lemma diff2_cos *)
2154 let diff2_cos = Sections.section_proof ["x"]
2155 `nth_diff_strong 2 cos x`
2156 [
2157 ((((use_arg_then2 ("nth_diff_strong2_eq_alt", [nth_diff_strong2_eq_alt]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real)`))) (term_tac exists_tac)));
2158 (((((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OPEN_UNIV", [REAL_OPEN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (simp_tac));
2159 ((((use_arg_then2 ("derivative_cos", [derivative_cos]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_COS", [HAS_REAL_DERIVATIVE_COS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2160 (((((use_arg_then2 ("second_derivative_cos", [second_derivative_cos]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_NEG", [HAS_REAL_DERIVATIVE_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_SIN", [HAS_REAL_DERIVATIVE_SIN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2161 ];;
2162
2163 (* Lemma second_derivative_sin *)
2164 let second_derivative_sin = Sections.section_proof []
2165 `nth_derivative 2 sin = (\x. --sin x)`
2166 [
2167 (((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_sin", [derivative_sin]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("derivative_cos", [derivative_cos]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2168 ];;
2169
2170 (* Lemma diff2_sin *)
2171 let diff2_sin = Sections.section_proof ["x"]
2172 `nth_diff_strong 2 sin x`
2173 [
2174 ((((use_arg_then2 ("nth_diff_strong2_eq_alt", [nth_diff_strong2_eq_alt]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real)`))) (term_tac exists_tac)));
2175 (((((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OPEN_UNIV", [REAL_OPEN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (simp_tac));
2176 ((((use_arg_then2 ("derivative_sin", [derivative_sin]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_SIN", [HAS_REAL_DERIVATIVE_SIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2177 (((((use_arg_then2 ("second_derivative_sin", [second_derivative_sin]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_COS", [HAS_REAL_DERIVATIVE_COS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2178 ];;
2179
2180 (* Lemma second_derivative_exp *)
2181 let second_derivative_exp = Sections.section_proof []
2182 `nth_derivative 2 exp = exp`
2183 [
2184 (((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("derivative_exp", [derivative_exp]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2185 ];;
2186
2187 (* Lemma diff2_exp *)
2188 let diff2_exp = Sections.section_proof ["x"]
2189 `nth_diff_strong 2 exp x`
2190 [
2191 ((((use_arg_then2 ("nth_diff_strong2_eq_alt", [nth_diff_strong2_eq_alt]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real)`))) (term_tac exists_tac)));
2192 (((((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OPEN_UNIV", [REAL_OPEN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (simp_tac));
2193 ((((use_arg_then2 ("derivative_exp", [derivative_exp]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_EXP", [HAS_REAL_DERIVATIVE_EXP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2194 (((((use_arg_then2 ("second_derivative_exp", [second_derivative_exp]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_EXP", [HAS_REAL_DERIVATIVE_EXP]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2195 ];;
2196
2197 (* Lemma second_derivative_log *)
2198 let second_derivative_log = Sections.section_proof ["x"]
2199 `&0 < x ==> nth_derivative 2 log x = --inv (x pow 2)`
2200 [
2201 ((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (move ["x_ineq"]));
2202 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)));
2203 (((fun arg_tac -> arg_tac (Arg_term (`(\x. inv x)`))) (term_tac exists_tac)) THEN (split_tac));
2204 (((fun arg_tac -> arg_tac (Arg_theorem ((DISCH_ALL o REAL_DIFF_CONV) `((\x. inv x) has_real_derivative f) (atreal x)`))) (disch_tac [])) THEN BETA_TAC);
2205 (((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `&0 < x ==> ~(x = &0)`)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. -- &1 * a = --a`)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2206 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - abs x, x + abs x)`))) (term_tac exists_tac));
2207 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))]));
2208 ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2209 ((((use_arg_then2 ("derivative_log", [derivative_log]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
2210 ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2211 ];;
2212
2213 (* Lemma diff2_log *)
2214 let diff2_log = Sections.section_proof ["x"]
2215 `&0 < x ==> nth_diff_strong 2 log x`
2216 [
2217 ((((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] [])))) THEN (move ["x_ineq"]));
2218 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - abs x, x + abs x)`))) (term_tac exists_tac));
2219 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))]));
2220 ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2221 ((THENL_FIRST) ((((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_LOG", [REAL_DIFFERENTIABLE_AT_LOG]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2222 ((((use_arg_then2 ("differentiable_local", [differentiable_local])) (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`\x. inv x`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval (y - abs y, y + abs y)`))) (term_tac exists_tac))));
2223 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
2224 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_INV_ATREAL", [REAL_DIFFERENTIABLE_INV_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_ID", [REAL_DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] [])))));
2225 ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2226 ((THENL) (split_tac) [ALL_TAC; ((move ["z"]) THEN (move ["ineq2"]))]);
2227 ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2228 (((((use_arg_then2 ("derivative_log", [derivative_log]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq2", [])) (disch_tac [])) THEN (clear_assumption "ineq2") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2229 ];;
2230
2231 (* Lemma second_derivative_inv *)
2232 let second_derivative_inv = Sections.section_proof ["x"]
2233 `~(x = &0) ==> nth_derivative 2 inv x = &2 * inv (x pow 3)`
2234 [
2235 ((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (move ["xn0"]));
2236 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)));
2237 (((fun arg_tac -> arg_tac (Arg_term (`(\x. -- inv (x * x))`))) (term_tac exists_tac)) THEN (split_tac));
2238 (((fun arg_tac -> arg_tac (Arg_theorem ((DISCH_ALL o REAL_DIFF_CONV) `((\x. -- inv(x * x)) has_real_derivative f) (atreal x)`))) (disch_tac [])) THEN BETA_TAC);
2239 ((((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xn0", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_NEG", [REAL_NEG_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_2", [REAL_MUL_2]))(gsym_then (thm_tac (new_rewrite [] []))))));
2240 ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `(x * x) pow 2 = x * x pow 3`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_INV_MUL", [REAL_INV_MUL]))(thm_tac (new_rewrite [] []))))));
2241 (((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. (&2 * x) * inv x * a = &2 * (x * inv x) * a`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2242 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - abs x, x + abs x)`))) (term_tac exists_tac));
2243 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))]));
2244 ((((use_arg_then2 ("xn0", [])) (disch_tac [])) THEN (clear_assumption "xn0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2245 ((((use_arg_then2 ("derivative_inv", [derivative_inv]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
2246 ((((use_arg_then2 ("xn0", [])) (disch_tac [])) THEN (clear_assumption "xn0") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2247 ];;
2248
2249 (* Lemma diff2_inv *)
2250 let diff2_inv = Sections.section_proof ["x"]
2251 `~(x = &0) ==> nth_diff_strong 2 inv x`
2252 [
2253 ((((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] [])))) THEN (move ["xn0"]));
2254 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - abs x, x + abs x)`))) (term_tac exists_tac));
2255 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))]));
2256 ((((use_arg_then2 ("xn0", [])) (disch_tac [])) THEN (clear_assumption "xn0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2257 ((THENL_FIRST) ((((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_INV", [REAL_DIFFERENTIABLE_AT_INV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("xn0", [])) (disch_tac [])) THEN (clear_assumption "xn0") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2258 ((((use_arg_then2 ("differentiable_local", [differentiable_local])) (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`\x. --inv (x * x)`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval (y - abs y, y + abs y)`))) (term_tac exists_tac))));
2259 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
2260 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_NEG", [REAL_DIFFERENTIABLE_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_INV_ATREAL", [REAL_DIFFERENTIABLE_INV_ATREAL]))(thm_tac (new_rewrite [] [])))));
2261 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_MUL_ATREAL", [REAL_DIFFERENTIABLE_MUL_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_ID", [REAL_DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))));
2262 ((((use_arg_then2 ("xn0", [])) (disch_tac [])) THEN (clear_assumption "xn0") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2263 ((THENL) (split_tac) [ALL_TAC; ((move ["z"]) THEN (move ["ineq2"]))]);
2264 ((((use_arg_then2 ("xn0", [])) (disch_tac [])) THEN (clear_assumption "xn0") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2265 (((((use_arg_then2 ("derivative_inv", [derivative_inv]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("xn0", [])) (disch_tac [])) THEN (clear_assumption "xn0") THEN ((use_arg_then2 ("ineq2", [])) (disch_tac [])) THEN (clear_assumption "ineq2") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2266 ];;
2267
2268 (* Lemma SQRT_POW *)
2269 let SQRT_POW = Sections.section_proof ["x";"n"]
2270 `sqrt x pow n = sqrt (x pow n)`
2271 [
2272 (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL real_pow)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SQRT_1", [SQRT_1]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
2273 (((((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SQRT_MUL", [SQRT_MUL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2274 ];;
2275
2276 (* Lemma second_derivative_sqrt *)
2277 let second_derivative_sqrt = Sections.section_proof ["x"]
2278 `&0 < x ==> nth_derivative 2 sqrt x = -- inv(&4 * sqrt (x pow 3))`
2279 [
2280 ((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (move ["x_pos"]));
2281 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)));
2282 (((fun arg_tac -> arg_tac (Arg_term (`(\x. inv (&2 * sqrt x))`))) (term_tac exists_tac)) THEN (split_tac));
2283 (((fun arg_tac -> arg_tac (Arg_theorem ((DISCH_ALL o REAL_DIFF_CONV) `((\x. inv(&2 * sqrt x)) has_real_derivative f) (atreal x)`))) (disch_tac [])) THEN BETA_TAC);
2284 ((fun arg_tac -> arg_tac (Arg_term (`~(&2 * sqrt x = &0)`))) (term_tac (have_gen_tac [](move ["ineq"]))));
2285 (((((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("x_pos", [])) (disch_tac [])) THEN (clear_assumption "x_pos") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2286 ((((use_arg_then2 ("x_pos", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_INV_POW", [REAL_INV_POW]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))));
2287 ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL real_pow)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_INV_POW", [REAL_INV_POW]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_POW_MUL", [REAL_POW_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_INV_MUL", [REAL_INV_MUL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SQRT_POW", [SQRT_POW]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
2288 ((((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL real_pow)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_INV_MUL", [REAL_INV_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))));
2289 ((THENL_FIRST) ((((use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac)));
2290 (((((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `&2 pow 2 = &4`)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `SUC 2 = 3`)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2291 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (&0, x + &1)`))) (term_tac exists_tac));
2292 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))]));
2293 ((((use_arg_then2 ("x_pos", [])) (disch_tac [])) THEN (clear_assumption "x_pos") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2294 ((((use_arg_then2 ("derivative_sqrt", [derivative_sqrt]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2295 ];;
2296
2297 (* Lemma diff2_sqrt *)
2298 let diff2_sqrt = Sections.section_proof ["x"]
2299 `&0 < x ==> nth_diff_strong 2 sqrt x`
2300 [
2301 ((((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] [])))) THEN (move ["x_pos"]));
2302 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (&0, x + &1)`))) (term_tac exists_tac));
2303 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))]));
2304 ((((use_arg_then2 ("x_pos", [])) (disch_tac [])) THEN (clear_assumption "x_pos") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2305 ((THENL_FIRST) ((((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_SQRT", [REAL_DIFFERENTIABLE_AT_SQRT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("x_pos", [])) (disch_tac [])) THEN (clear_assumption "x_pos") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2306 ((((use_arg_then2 ("differentiable_local", [differentiable_local])) (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`\x. inv (&2 * sqrt x)`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval (&0, y + &1)`))) (term_tac exists_tac))));
2307 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
2308 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_INV_ATREAL", [REAL_DIFFERENTIABLE_INV_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_MUL_ATREAL", [REAL_DIFFERENTIABLE_MUL_ATREAL]))(thm_tac (new_rewrite [] [])))));
2309 (((((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_SQRT", [REAL_DIFFERENTIABLE_AT_SQRT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2310 (((((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2311 ((THENL_FIRST) ((THENL) (split_tac) [ALL_TAC; ((move ["z"]) THEN (move ["ineq2"]))]) ((((use_arg_then2 ("x_pos", [])) (disch_tac [])) THEN (clear_assumption "x_pos") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2312 ((((use_arg_then2 ("derivative_sqrt", [derivative_sqrt]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2313 ];;
2314
2315 (* Lemma real_powS *)
2316 let real_powS = Sections.section_proof ["x";"n"]
2317 `x pow (SUC n) = x * x pow n`
2318 [
2319 ((((use_arg_then2 ("real_pow", [real_pow]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2320 ];;
2321
2322 (* Lemma second_derivative_acs *)
2323 let second_derivative_acs = Sections.section_proof ["x"]
2324 `abs x < &1 ==>
2325 nth_derivative 2 acs x = --(x / sqrt ((&1 - x * x) pow 3))`
2326 [
2327 ((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (move ["x_ineq"]));
2328 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)));
2329 (((fun arg_tac -> arg_tac (Arg_term (`\x. --inv (sqrt (&1 - x * x))`))) (term_tac exists_tac)) THEN (split_tac));
2330 (((fun arg_tac -> arg_tac (Arg_theorem ((DISCH_ALL o REAL_DIFF_CONV) `((\x. --inv (sqrt (&1 - x * x))) has_real_derivative f) (atreal x)`))) (disch_tac [])) THEN BETA_TAC);
2331 ((fun arg_tac -> arg_tac (Arg_term (`&0 < &1 - x * x /\ ~(sqrt(&1 - x * x) = &0)`))) (term_tac (have_gen_tac [](move ["ineqs"]))));
2332 (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&0 < &1 - x * x`))) (term_tac (have_gen_tac [](move ["h"])))));
2333 (((((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2334 ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `&1 - x * x = (&1 - x) * (&1 + x)`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] [])))));
2335 ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2336 ((repeat_tactic 1 9 (((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_INV_MUL", [REAL_INV_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_SUB_LZERO", [REAL_SUB_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_NEG_NEG", [REAL_NEG_NEG]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))));
2337 ((((use_arg_then2 ("REAL_INV_MUL", [REAL_INV_MUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_powS", [real_powS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SQRT_POW", [SQRT_POW]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
2338 ((((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_2", [REAL_MUL_2]))(gsym_then (thm_tac (new_rewrite [] []))))));
2339 ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. (&2 * x) * inv (&2) * a = (&2 * inv (&2)) * x * a`)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `SUC 2 = 3`)))(thm_tac (new_rewrite [] [])))));
2340 (((((use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac));
2341 ((fun arg_tac -> arg_tac (Arg_term (`&1 - abs x`))) (term_tac (set_tac "e")));
2342 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - e, x + e)`))) (term_tac exists_tac));
2343 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))]));
2344 ((((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2345 ((((use_arg_then2 ("derivative_acs", [derivative_acs]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
2346 ((((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2347 ];;
2348
2349 (* Lemma diff2_acs *)
2350 let diff2_acs = Sections.section_proof ["x"]
2351 `abs x < &1 ==> nth_diff_strong 2 acs x`
2352 [
2353 ((((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] [])))) THEN (move ["x_ineq"]));
2354 ((fun arg_tac -> arg_tac (Arg_term (`&1 - abs x`))) (term_tac (set_tac "e")));
2355 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - e, x + e)`))) (term_tac exists_tac));
2356 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))]));
2357 ((((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2358 ((THENL_FIRST) ((((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_ACS", [REAL_DIFFERENTIABLE_AT_ACS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2359 ((fun arg_tac -> arg_tac (Arg_term (`&1 - abs y`))) (term_tac (set_tac "e2")));
2360 ((((use_arg_then2 ("differentiable_local", [differentiable_local])) (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`\x. --inv (sqrt (&1 - x * x))`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval (y - e2, y + e2)`))) (term_tac exists_tac))));
2361 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
2362 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_NEG", [REAL_DIFFERENTIABLE_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_INV_ATREAL", [REAL_DIFFERENTIABLE_INV_ATREAL]))(thm_tac (new_rewrite [] [])))));
2363 ((fun arg_tac -> arg_tac (Arg_term (`&0 < &1 - y * y`))) (term_tac (have_gen_tac [](move ["gt0"]))));
2364 (((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `&1 - y * y = (&1 - y) * (&1 + y)`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2365 ((((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LT_IMP_NZ", [REAL_LT_IMP_NZ]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
2366 ((fun arg_tac -> arg_tac (Arg_term (`(\x. sqrt (&1 - x * x)) = sqrt o (\x. &1 - x * x)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
2367 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
2368 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_SQRT", [REAL_DIFFERENTIABLE_AT_SQRT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2369 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_SUB", [REAL_DIFFERENTIABLE_SUB]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_MUL_ATREAL", [REAL_DIFFERENTIABLE_MUL_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2370 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_ID", [REAL_DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2371 ((THENL) (split_tac) [ALL_TAC; ((move ["z"]) THEN (move ["ineq2"]))]);
2372 ((((use_arg_then2 ("e2_def", [])) (disch_tac [])) THEN (clear_assumption "e2_def") THEN ((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2373 ((((use_arg_then2 ("derivative_acs", [derivative_acs]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
2374 ((((use_arg_then2 ("ineq2", [])) (disch_tac [])) THEN (clear_assumption "ineq2") THEN ((use_arg_then2 ("e2_def", [])) (disch_tac [])) THEN (clear_assumption "e2_def") THEN ((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2375 ];;
2376
2377 (* Lemma second_derivative_asn *)
2378 let second_derivative_asn = Sections.section_proof ["x"]
2379 `abs x < &1 ==>
2380 nth_derivative 2 asn x = x / sqrt ((&1 - x * x) pow 3)`
2381 [
2382 ((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (move ["x_ineq"]));
2383 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)));
2384 (((fun arg_tac -> arg_tac (Arg_term (`\x. inv (sqrt (&1 - x * x))`))) (term_tac exists_tac)) THEN (split_tac));
2385 (((fun arg_tac -> arg_tac (Arg_theorem ((DISCH_ALL o REAL_DIFF_CONV) `((\x. inv (sqrt (&1 - x * x))) has_real_derivative f) (atreal x)`))) (disch_tac [])) THEN BETA_TAC);
2386 ((fun arg_tac -> arg_tac (Arg_term (`&0 < &1 - x * x /\ ~(sqrt(&1 - x * x) = &0)`))) (term_tac (have_gen_tac [](move ["ineqs"]))));
2387 (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&0 < &1 - x * x`))) (term_tac (have_gen_tac [](move ["h"])))));
2388 (((((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2389 ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `&1 - x * x = (&1 - x) * (&1 + x)`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] [])))));
2390 ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2391 ((repeat_tactic 1 9 (((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_INV_MUL", [REAL_INV_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_SUB_LZERO", [REAL_SUB_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_NEG_NEG", [REAL_NEG_NEG]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))));
2392 ((((use_arg_then2 ("REAL_INV_MUL", [REAL_INV_MUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_powS", [real_powS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SQRT_POW", [SQRT_POW]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
2393 ((((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_2", [REAL_MUL_2]))(gsym_then (thm_tac (new_rewrite [] []))))));
2394 ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. (&2 * x) * inv (&2) * a = (&2 * inv (&2)) * x * a`)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `SUC 2 = 3`)))(thm_tac (new_rewrite [] [])))));
2395 (((((use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac));
2396 ((fun arg_tac -> arg_tac (Arg_term (`&1 - abs x`))) (term_tac (set_tac "e")));
2397 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - e, x + e)`))) (term_tac exists_tac));
2398 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))]));
2399 ((((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2400 ((((use_arg_then2 ("derivative_asn", [derivative_asn]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
2401 ((((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2402 ];;
2403
2404 (* Lemma diff2_asn *)
2405 let diff2_asn = Sections.section_proof ["x"]
2406 `abs x < &1 ==> nth_diff_strong 2 asn x`
2407 [
2408 ((((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] [])))) THEN (move ["x_ineq"]));
2409 ((fun arg_tac -> arg_tac (Arg_term (`&1 - abs x`))) (term_tac (set_tac "e")));
2410 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - e, x + e)`))) (term_tac exists_tac));
2411 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))]));
2412 ((((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2413 ((THENL_FIRST) ((((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_ASN", [REAL_DIFFERENTIABLE_AT_ASN]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2414 ((fun arg_tac -> arg_tac (Arg_term (`&1 - abs y`))) (term_tac (set_tac "e2")));
2415 ((((use_arg_then2 ("differentiable_local", [differentiable_local])) (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`\x. inv (sqrt (&1 - x * x))`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval (y - e2, y + e2)`))) (term_tac exists_tac))));
2416 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
2417 (((use_arg_then2 ("REAL_DIFFERENTIABLE_INV_ATREAL", [REAL_DIFFERENTIABLE_INV_ATREAL]))(thm_tac (new_rewrite [] []))));
2418 ((fun arg_tac -> arg_tac (Arg_term (`&0 < &1 - y * y`))) (term_tac (have_gen_tac [](move ["gt0"]))));
2419 (((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `&1 - y * y = (&1 - y) * (&1 + y)`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2420 ((((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LT_IMP_NZ", [REAL_LT_IMP_NZ]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
2421 ((fun arg_tac -> arg_tac (Arg_term (`(\x. sqrt (&1 - x * x)) = sqrt o (\x. &1 - x * x)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
2422 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
2423 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_AT_SQRT", [REAL_DIFFERENTIABLE_AT_SQRT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2424 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_SUB", [REAL_DIFFERENTIABLE_SUB]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_MUL_ATREAL", [REAL_DIFFERENTIABLE_MUL_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2425 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_ID", [REAL_DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2426 ((THENL) (split_tac) [ALL_TAC; ((move ["z"]) THEN (move ["ineq2"]))]);
2427 ((((use_arg_then2 ("e2_def", [])) (disch_tac [])) THEN (clear_assumption "e2_def") THEN ((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2428 ((((use_arg_then2 ("derivative_asn", [derivative_asn]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
2429 ((((use_arg_then2 ("ineq2", [])) (disch_tac [])) THEN (clear_assumption "ineq2") THEN ((use_arg_then2 ("e2_def", [])) (disch_tac [])) THEN (clear_assumption "e2_def") THEN ((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2430 ];;
2431
2432 (* Lemma second_derivative_matan *)
2433 let second_derivative_matan = Sections.section_proof ["x"]
2434 `nth_derivative 2 matan x = ddmatan x`
2435 [
2436 (((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_eq_real_derivative", [derivative_eq_real_derivative]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ddmatan", [ddmatan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2437 ];;
2438
2439 (* Lemma diff2_matan *)
2440 let diff2_matan = Sections.section_proof ["x"]
2441 `-- &1 < x ==> nth_diff_strong 2 matan x`
2442 [
2443 ((((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] [])))) THEN (move ["x_ineq"]));
2444 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (-- &1, x + &1)`))) (term_tac exists_tac));
2445 (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))]));
2446 ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2447 ((((use_arg_then2 ("matan_differentiable", [matan_differentiable]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2448 ((((use_arg_then2 ("differentiable_local", [differentiable_local])) (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`dmatan`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval (-- &1, y + &1)`))) (term_tac exists_tac))));
2449 ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)));
2450 ((THENL_FIRST) ((THENL) (split_tac) [ALL_TAC; ((move ["z"]) THEN (move ["ineq2"]))]) ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2451 ((((use_arg_then2 ("derivative_matan", [derivative_matan]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2452 (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y < &1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["y_ineq"]));
2453 ((((use_arg_then2 ("dmatan", [dmatan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("matan_second_derivative_abs1", [matan_second_derivative_abs1]))(thm_tac (new_rewrite [] [])))));
2454 ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("y_ineq", [])) (disch_tac [])) THEN (clear_assumption "y_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2455 ((((use_arg_then2 ("dmatan", [dmatan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("differentiable_local", [differentiable_local])) (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)));
2456 ((fun arg_tac -> arg_tac (Arg_term (`\x. inv (&2 * x * (x + &1)) - atn (sqrt x) / (&2 * x * sqrt x)`))) (term_tac (set_tac "f'")));
2457 (((use_arg_then2 ("f'", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval (y - &1, y + &1)`))) (term_tac exists_tac)));
2458 ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)));
2459 ((THENL_FIRST) (split_tac) ((arith_tac) THEN (done_tac)));
2460 ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN ((((use_arg_then2 ("f'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("matan_real_derivative_gt0", [matan_real_derivative_gt0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
2461 ((((use_arg_then2 ("y_ineq", [])) (disch_tac [])) THEN (clear_assumption "y_ineq") THEN ((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2462 (((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] []))));
2463 (((fun arg_tac -> (use_arg_then2 ("matan_has_derivative2_gt0", [matan_has_derivative2_gt0])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (((use_arg_then2 ("f'_def", []))(thm_tac (new_rewrite [] [])))));
2464 (((fun arg_tac -> arg_tac (Arg_term (`_1 - _2`))) (term_tac (set_tac "f''"))) THEN (BETA_TAC THEN (move ["h"])));
2465 (((use_arg_then2 ("f''", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_ineq", [])) (disch_tac [])) THEN (clear_assumption "y_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2466 ];;
2467
2468 (* Section SecondDerivativeCompose *)
2469 Sections.begin_section "SecondDerivativeCompose";;
2470
2471 (* Lemma REAL_CONTINUOUS_OPEN_PREIMAGE *)
2472 let REAL_CONTINUOUS_OPEN_PREIMAGE = Sections.section_proof ["f";"s";"t"]
2473 `f real_continuous_on s ==> real_open s ==> real_open t ==>
2474 real_open {x | x IN s /\ f x IN t}`
2475 [
2476 (BETA_TAC THEN (move ["f_cont"]) THEN (move ["open_s"]) THEN (move ["open_t"]));
2477 (((use_arg_then2 ("REAL_OPEN", [REAL_OPEN]))(thm_tac (new_rewrite [] []))));
2478 (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`IMAGE lift {x | x IN s /\ f x IN t} =
2479 {x | x IN (IMAGE lift s) /\ (lift o f o drop) x IN (IMAGE lift t)}`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))));
2480 (((((use_arg_then2 ("CONTINUOUS_OPEN_PREIMAGE", [CONTINUOUS_OPEN_PREIMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_OPEN", [REAL_OPEN]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ON", [REAL_CONTINUOUS_ON]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac));
2481 ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE_LIFT_DROP", [IN_IMAGE_LIFT_DROP]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE_LIFT_DROP", [IN_IMAGE_LIFT_DROP]))(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (simp_tac)) THEN (split_tac));
2482 ((BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["x_in"])) THEN (move ["x_eq"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`lift x`))) (term_tac exists_tac)));
2483 (((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("x_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2484 (((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["x_in"])) THEN (move ["x_eq"]));
2485 (((fun arg_tac -> arg_tac (Arg_term (`drop x`))) (term_tac exists_tac)) THEN (done_tac));
2486 ];;
2487
2488 (* Lemma second_derivative_compose *)
2489 let second_derivative_compose = Sections.section_proof ["f";"g";"x"]
2490 `nth_diff_strong 2 g x ==> nth_diff_strong 2 f (g x) ==>
2491 nth_derivative 2 (\x. f (g x)) x =
2492 nth_derivative 2 f (g x) * (derivative g x) pow 2 + derivative f (g x) * nth_derivative 2 g x`
2493 [
2494 (BETA_TAC THEN (move ["dg"]) THEN (move ["df"]));
2495 ((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)));
2496 ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`\x. derivative f (g x) * derivative g x`))) (term_tac exists_tac)) THEN (split_tac)));
2497 ((((use_arg_then2 ("dg", [])) (disch_tac [])) THEN ((use_arg_then2 ("df", [])) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["gxs"])) THEN (move ["d_f"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["d_g"])));
2498 ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN t /\ g z IN s}`))) (term_tac (set_tac "s'")));
2499 ((fun arg_tac -> arg_tac (Arg_term (`real_open s'`))) (term_tac (have_gen_tac [](move ["open_s'"]))));
2500 ((((use_arg_then2 ("s'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_OPEN_PREIMAGE", [REAL_CONTINUOUS_OPEN_PREIMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("open_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))));
2501 (((((use_arg_then2 ("REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT", [REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["y"]) THEN (move ["yt"]));
2502 (((((use_arg_then2 ("REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL", [REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_g", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2503 (((fun arg_tac -> arg_tac (Arg_term (`t INTER s'`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
2504 (((((use_arg_then2 ("s'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac));
2505 ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["yt"]) THEN (move ["ys'"])))) THEN ((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
2506 (((((use_arg_then2 ("d_g", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("d_f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("ys'", [])) (disch_tac [])) THEN (clear_assumption "ys'") THEN BETA_TAC) THEN (((((use_arg_then2 ("s'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["z"])) THEN (simp_tac)) THEN (done_tac));
2507 ((((use_arg_then2 ("dg", [])) (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then2 ("df", [])) (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong2_eq_alt", [nth_diff_strong2_eq_alt]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (move ["d_f"]) THEN (case THEN (move ["_"])) THEN (move ["d_g"])));
2508 ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_MUL_ATREAL", [HAS_REAL_DERIVATIVE_MUL_ATREAL]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)));
2509 ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("d_g", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2510 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_DIFF_CHAIN_ATREAL", [REAL_DIFF_CHAIN_ATREAL]))(thm_tac (new_rewrite [] [])))));
2511 (((((use_arg_then2 ("d_g", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("d_f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2512 ];;
2513
2514 (* Lemma diff2_compose *)
2515 let diff2_compose = Sections.section_proof ["f";"g";"x"]
2516 `nth_diff_strong 2 g x ==> nth_diff_strong 2 f (g x) ==>
2517 nth_diff_strong 2 (\x. f (g x)) x`
2518 [
2519 ((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["dg"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["gxt"])) THEN (move ["df"]));
2520 ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN s /\ g z IN t}`))) (term_tac (set_tac "s'")));
2521 ((fun arg_tac -> arg_tac (Arg_term (`real_open s'`))) (term_tac (have_gen_tac [](move ["open_s'"]))));
2522 ((((use_arg_then2 ("s'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_OPEN_PREIMAGE", [REAL_CONTINUOUS_OPEN_PREIMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("open_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))));
2523 (((((use_arg_then2 ("REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT", [REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["y"]) THEN (move ["yt"]));
2524 (((((use_arg_then2 ("REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL", [REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2525 (((fun arg_tac -> arg_tac (Arg_term (`s INTER s'`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
2526 (((((use_arg_then2 ("s'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (simp_tac)) THEN (done_tac));
2527 (BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["ys'"]))));
2528 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
2529 ((((use_arg_then2 ("ys'", [])) (disch_tac [])) THEN (clear_assumption "ys'") THEN BETA_TAC) THEN (((use_arg_then2 ("s'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["z"])) THEN (simp_tac)) THEN (done_tac));
2530 (((use_arg_then2 ("differentiable_local", [differentiable_local])) (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac));
2531 ((THENL_ROT (-1)) ((((fun arg_tac -> arg_tac (Arg_term (`\x. derivative g x * derivative f (g x)`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`s INTER s'`))) (term_tac exists_tac))) THEN (split_tac)));
2532 (((((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("ys'", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (move ["z_in"]));
2533 ((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2534 ((((use_arg_then2 ("z_in", [])) (disch_tac [])) THEN (clear_assumption "z_in") THEN BETA_TAC) THEN (((use_arg_then2 ("s'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (simp_tac)) THEN (done_tac));
2535 ((((use_arg_then2 ("REAL_DIFFERENTIABLE_MUL_ATREAL", [REAL_DIFFERENTIABLE_MUL_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
2536 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((use_arg_then2 ("REAL_DIFFERENTIABLE_COMPOSE_ATREAL", [REAL_DIFFERENTIABLE_COMPOSE_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
2537 ((((use_arg_then2 ("ys'", [])) (disch_tac [])) THEN (clear_assumption "ys'") THEN BETA_TAC) THEN (((use_arg_then2 ("s'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["z"])) THEN (simp_tac)) THEN (done_tac));
2538 ];;
2539
2540 (* Lemma continuous_not0_exists_open *)
2541 let continuous_not0_exists_open = Sections.section_proof ["f";"x"]
2542 `~(f x = &0) ==> f real_continuous atreal x ==>
2543 ?s. real_open s /\ x IN s /\ !y. y IN s ==> ~(f y = &0)`
2544 [
2545 ((((use_arg_then2 ("real_continuous_atreal", [real_continuous_atreal]))(thm_tac (new_rewrite [] [])))) THEN (move ["fn0"]) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`abs (f x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)));
2546 ((THENL_FIRST) (ANTS_TAC) ((((use_arg_then2 ("fn0", [])) (disch_tac [])) THEN (clear_assumption "fn0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2547 (BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["ineq"]));
2548 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - d, x + d)`))) (term_tac exists_tac));
2549 ((THENL_FIRST) (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [ALL_TAC; (move ["y"])])) ((((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2550 ((((use_arg_then2 ("fn0", [])) (disch_tac [])) THEN (clear_assumption "fn0") THEN ((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN ((fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2551 ];;
2552
2553 (* Lemma continuous_gt_exists_open *)
2554 let continuous_gt_exists_open = Sections.section_proof ["a";"f";"x"]
2555 `a < f x ==> f real_continuous atreal x ==>
2556 ?s. real_open s /\ x IN s /\ !y. y IN s ==> a < f y`
2557 [
2558 ((BETA_TAC THEN (move ["f_ineq"])) THEN ((((use_arg_then2 ("real_continuous_atreal", [real_continuous_atreal]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x - a`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))));
2559 ((THENL_FIRST) (ANTS_TAC) ((((use_arg_then2 ("f_ineq", [])) (disch_tac [])) THEN (clear_assumption "f_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2560 (BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["ineq"]));
2561 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - d, x + d)`))) (term_tac exists_tac));
2562 ((THENL_FIRST) (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [ALL_TAC; (move ["y"])])) ((((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2563 ((((use_arg_then2 ("f_ineq", [])) (disch_tac [])) THEN (clear_assumption "f_ineq") THEN ((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN ((fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2564 ];;
2565
2566 (* Lemma continuous_lt_exists_open *)
2567 let continuous_lt_exists_open = Sections.section_proof ["a";"f";"x"]
2568 `f x < a ==> f real_continuous atreal x ==>
2569 ?s. real_open s /\ x IN s /\ !y. y IN s ==> f y < a`
2570 [
2571 ((BETA_TAC THEN (move ["f_ineq"])) THEN ((((use_arg_then2 ("real_continuous_atreal", [real_continuous_atreal]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`a - f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))));
2572 ((THENL_FIRST) (ANTS_TAC) ((((use_arg_then2 ("f_ineq", [])) (disch_tac [])) THEN (clear_assumption "f_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2573 (BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["ineq"]));
2574 ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - d, x + d)`))) (term_tac exists_tac));
2575 ((THENL_FIRST) (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [ALL_TAC; (move ["y"])])) ((((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2576 ((((use_arg_then2 ("f_ineq", [])) (disch_tac [])) THEN (clear_assumption "f_ineq") THEN ((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN ((fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2577 ];;
2578 (Sections.add_section_var (mk_var ("f", (`:real->real`))));;
2579 (Sections.add_section_var (mk_var ("x", (`:real`))));;
2580 (Sections.add_section_hyp "df" (`nth_diff_strong 2 f x`));;
2581
2582 (* Lemma second_derivative_compose_abs_pos *)
2583 let second_derivative_compose_abs_pos = Sections.section_proof []
2584 `&0 < f x ==>
2585 nth_derivative 2 (\x. abs (f x)) x = nth_derivative 2 f x`
2586 [
2587 (BETA_TAC THEN (move ["f_ineq"]));
2588 ((((use_arg_then2 ("second_derivative_compose", [second_derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_abs_pos", [diff2_abs_pos]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("second_derivative_abs_pos", [second_derivative_abs_pos]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("derivative_abs_pos", [derivative_abs_pos]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2589 ((arith_tac) THEN (done_tac));
2590 ];;
2591
2592 (* Lemma second_derivative_compose_abs_neg *)
2593 let second_derivative_compose_abs_neg = Sections.section_proof []
2594 `f x < &0 ==>
2595 nth_derivative 2 (\x. abs (f x)) x = --nth_derivative 2 f x`
2596 [
2597 (BETA_TAC THEN (move ["f_ineq"]));
2598 ((((use_arg_then2 ("second_derivative_compose", [second_derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_abs_neg", [diff2_abs_neg]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("second_derivative_abs_neg", [second_derivative_abs_neg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("derivative_abs_neg", [derivative_abs_neg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2599 ((arith_tac) THEN (done_tac));
2600 ];;
2601
2602 (* Lemma second_derivative_compose_pow *)
2603 let second_derivative_compose_pow = Sections.section_proof ["n"]
2604 `nth_derivative 2 (\x. f x pow n) x =
2605 &n * (nth_derivative 2 f x * f x pow (n - 1)
2606 + &(n - 1) * f x pow (n - 2) * derivative f x pow 2)`
2607 [
2608 ((fun arg_tac -> arg_tac (Arg_term (`\x. x pow n`))) (term_tac (set_tac "g")));
2609 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(\x. f x pow n) = (\x. g (f x))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)));
2610 ((((use_arg_then2 ("second_derivative_compose", [second_derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_pow_x", [diff2_pow_x]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
2611 ((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("second_derivative_pow_x", [second_derivative_pow_x]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_pow_x", [derivative_pow_x]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2612 ((((use_arg_then2 ("REAL_OF_NUM_MUL", [REAL_OF_NUM_MUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
2613 ];;
2614
2615 (* Lemma second_derivative_compose_pow2 *)
2616 let second_derivative_compose_pow2 = Sections.section_proof []
2617 `nth_derivative 2 (\x. f x pow 2) x =
2618 &2 * (nth_derivative 2 f x * f x + derivative f x pow 2)`
2619 [
2620 ((((use_arg_then2 ("second_derivative_compose_pow", [second_derivative_compose_pow]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 - 1 = 1`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))));
2621 (((((use_arg_then2 ("REAL_POW_1", [REAL_POW_1]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL real_pow)))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
2622 ];;
2623
2624 (* Lemma second_derivative_compose_pow3 *)
2625 let second_derivative_compose_pow3 = Sections.section_proof []
2626 `nth_derivative 2 (\x. f x pow 3) x =
2627 &3 * (nth_derivative 2 f x * f x pow 2 + &2 * f x * derivative f x pow 2)`
2628 [
2629 ((((use_arg_then2 ("second_derivative_compose_pow", [second_derivative_compose_pow]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 - 1 = 2 /\ 3 - 2 = 1`)))(thm_tac (new_rewrite [] []))))));
2630 ((((use_arg_then2 ("REAL_POW_1", [REAL_POW_1]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac));
2631 ];;
2632
2633 (* Lemma second_derivative_compose_atn *)
2634 let second_derivative_compose_atn = Sections.section_proof []
2635 `nth_derivative 2 (\x. atn (f x)) x =
2636 (nth_derivative 2 f x * (&1 + f x * f x) - &2 * f x * derivative f x pow 2) / (&1 + f x * f x) pow 2`
2637 [
2638 ((((use_arg_then2 ("second_derivative_compose", [second_derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_atn", [diff2_atn]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("second_derivative_atn", [second_derivative_atn]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("derivative_atn", [derivative_atn]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2639 ((((use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] []))))));
2640 (((fun arg_tac -> arg_tac (Arg_term (`_1 * _2`))) (term_tac (set_tac "lhs1"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`_1 * _2`))) (term_tac (set_tac "lhs2"))));
2641 ((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_INV_POW", [REAL_INV_POW]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_SUB_RDISTRIB", [REAL_SUB_RDISTRIB]))(thm_tac (new_rewrite [] [])))));
2642 (((fun arg_tac -> arg_tac (Arg_term (`_1 * _2`))) (term_tac (set_tac "rhs1"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`_1 * _2`))) (term_tac (set_tac "rhs2"))));
2643 (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `lhs1 = rhs1 /\ lhs2 = rhs2 ==> lhs1 - lhs2 = rhs1 - rhs2`))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
2644 (((((use_arg_then2 ("lhs2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rhs2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [(`_1 * _2 pow 2`)])))) THEN (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((split_tac) THEN ((TRY done_tac))));
2645 ((((use_arg_then2 ("rhs1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. a * b * c * d = a * (b * c) * d`)))(thm_tac (new_rewrite [] [])))));
2646 ((((use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lhs1_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
2647 ((((fun arg_tac -> (use_arg_then2 ("REAL_LE_SQUARE", [REAL_LE_SQUARE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2648 ];;
2649
2650 (* Lemma second_derivative_compose_cos *)
2651 let second_derivative_compose_cos = Sections.section_proof []
2652 `nth_derivative 2 (\x. cos (f x)) x =
2653 --(nth_derivative 2 f x * sin (f x) + cos (f x) * derivative f x pow 2)`
2654 [
2655 ((((use_arg_then2 ("second_derivative_compose", [second_derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_cos", [diff2_cos]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("second_derivative_cos", [second_derivative_cos]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("derivative_cos", [derivative_cos]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2656 ((arith_tac) THEN (done_tac));
2657 ];;
2658
2659 (* Lemma second_derivative_compose_sin *)
2660 let second_derivative_compose_sin = Sections.section_proof []
2661 `nth_derivative 2 (\x. sin (f x)) x =
2662 nth_derivative 2 f x * cos (f x) - sin (f x) * derivative f x pow 2`
2663 [
2664 ((((use_arg_then2 ("second_derivative_compose", [second_derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_sin", [diff2_sin]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("second_derivative_sin", [second_derivative_sin]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("derivative_sin", [derivative_sin]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2665 ((arith_tac) THEN (done_tac));
2666 ];;
2667
2668 (* Lemma second_derivative_compose_exp *)
2669 let second_derivative_compose_exp = Sections.section_proof []
2670 `nth_derivative 2 (\x. exp (f x)) x =
2671 nth_derivative 2 f x * exp (f x) + exp (f x) * derivative f x pow 2`
2672 [
2673 ((((use_arg_then2 ("second_derivative_compose", [second_derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_exp", [diff2_exp]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("second_derivative_exp", [second_derivative_exp]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("derivative_exp", [derivative_exp]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2674 ((arith_tac) THEN (done_tac));
2675 ];;
2676
2677 (* Lemma second_derivative_compose_log *)
2678 let second_derivative_compose_log = Sections.section_proof []
2679 `&0 < f x ==>
2680 nth_derivative 2 (\x. log (f x)) x =
2681 nth_derivative 2 f x / f x - (derivative f x / f x) pow 2`
2682 [
2683 (BETA_TAC THEN (move ["f_ineq"]));
2684 ((((use_arg_then2 ("second_derivative_compose", [second_derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_log", [diff2_log]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("second_derivative_log", [second_derivative_log]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("derivative_log", [derivative_log]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2685 (((((use_arg_then2 ("REAL_POW_DIV", [REAL_POW_DIV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac));
2686 ];;
2687
2688 (* Lemma second_derivative_compose_inv *)
2689 let second_derivative_compose_inv = Sections.section_proof []
2690 `~(f x = &0) ==>
2691 nth_derivative 2 (\x. inv (f x)) x =
2692 (&2 * derivative f x pow 2 - nth_derivative 2 f x * f x) / (f x pow 3)`
2693 [
2694 (BETA_TAC THEN (move ["fn0"]));
2695 ((((use_arg_then2 ("second_derivative_compose", [second_derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_inv", [diff2_inv]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("second_derivative_inv", [second_derivative_inv]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("derivative_inv", [derivative_inv]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2696 ((((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_SUB_RDISTRIB", [REAL_SUB_RDISTRIB]))(thm_tac (new_rewrite [] [])))));
2697 ((THENL_FIRST) ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. a = c /\ b = d ==> a - b = c - d`))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac)));
2698 ((((use_arg_then2 ("REAL_INV_POW", [REAL_INV_POW]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 = SUC 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_powS", [real_powS]))(thm_tac (new_rewrite [] [])))));
2699 ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. (a * b) * c * d = a * (b * c) * d`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] [])))));
2700 (((((use_arg_then2 ("REAL_INV_MUL", [REAL_INV_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2701 ];;
2702
2703 (* Lemma second_derivative_compose_sqrt *)
2704 let second_derivative_compose_sqrt = Sections.section_proof []
2705 `&0 < f x ==>
2706 nth_derivative 2 (\x. sqrt (f x)) x =
2707 (&2 * nth_derivative 2 f x * f x - derivative f x pow 2) / (&4 * sqrt (f x pow 3))`
2708 [
2709 (BETA_TAC THEN (move ["f_pos"]));
2710 ((((use_arg_then2 ("second_derivative_compose", [second_derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_sqrt", [diff2_sqrt]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("second_derivative_sqrt", [second_derivative_sqrt]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("derivative_sqrt", [derivative_sqrt]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2711 ((((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_SUB_RDISTRIB", [REAL_SUB_RDISTRIB]))(thm_tac (new_rewrite [] [])))));
2712 ((THENL_LAST) ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. a = c /\ b = d ==> a - b = c - d`))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac)));
2713 ((fun arg_tac -> arg_tac (Arg_term (`sqrt (f x pow 3) = sqrt (f x) * f x`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
2714 (((((use_arg_then2 ("SQRT_POW", [SQRT_POW]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 = SUC 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_powS", [real_powS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SQRT_POW_2", [SQRT_POW_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2715 (repeat_tactic 1 9 (((use_arg_then2 ("REAL_INV_MUL", [REAL_INV_MUL]))(thm_tac (new_rewrite [] [])))));
2716 (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. (&2 * a * b) * inv (&4) * c * d = (inv (&2) * c) * a * (b * d)`)))(thm_tac (new_rewrite [] []))));
2717 (((((use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_IMP_NZ", [REAL_LT_IMP_NZ]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2718 ];;
2719
2720 (* Lemma second_derivative_compose_acs *)
2721 let second_derivative_compose_acs = Sections.section_proof []
2722 `abs (f x) < &1 ==>
2723 nth_derivative 2 (\x. acs (f x)) x =
2724 -- ((nth_derivative 2 f x * (&1 - f x * f x) + f x * derivative f x pow 2) /
2725 sqrt ((&1 - f x * f x) pow 3))`
2726 [
2727 (BETA_TAC THEN (move ["f_ineq"]));
2728 ((((use_arg_then2 ("second_derivative_compose", [second_derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_acs", [diff2_acs]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("second_derivative_acs", [second_derivative_acs]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("derivative_acs", [derivative_acs]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2729 ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_NEG_ADD", [REAL_NEG_ADD]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_EQ_NEG2", [REAL_EQ_NEG2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ADD_RDISTRIB", [REAL_ADD_RDISTRIB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM]))(thm_tac (new_rewrite [] [])))));
2730 ((THENL_LAST) ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. a = c /\ b = d ==> a + b = c + d`))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac)));
2731 ((fun arg_tac -> arg_tac (Arg_term (`&1 - f x * f x`))) (term_tac (set_tac "y")));
2732 ((fun arg_tac -> arg_tac (Arg_term (`&0 <= y /\ &0 < y /\ ~(y = &0)`))) (term_tac (have_gen_tac [](move ["y_ineq"]))));
2733 ((((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. &1 - a * a = (&1 - a) * (&1 + a)`)))(thm_tac (new_rewrite [] [])))));
2734 (((((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("f_ineq", [])) (disch_tac [])) THEN (clear_assumption "f_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2735 ((fun arg_tac -> arg_tac (Arg_term (`sqrt (y pow 3) = sqrt y * y`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
2736 (((((use_arg_then2 ("SQRT_POW", [SQRT_POW]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 = SUC 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_powS", [real_powS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SQRT_POW_2", [SQRT_POW_2]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2737 ((((use_arg_then2 ("REAL_INV_MUL", [REAL_INV_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. (a * b) * c * d = c * a * (b * d)`)))(thm_tac (new_rewrite [] [])))));
2738 (((((use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2739 ];;
2740
2741 (* Lemma second_derivative_compose_asn *)
2742 let second_derivative_compose_asn = Sections.section_proof []
2743 `abs (f x) < &1 ==>
2744 nth_derivative 2 (\x. asn (f x)) x =
2745 ((nth_derivative 2 f x * (&1 - f x * f x) + f x * derivative f x pow 2) /
2746 sqrt ((&1 - f x * f x) pow 3))`
2747 [
2748 (BETA_TAC THEN (move ["f_ineq"]));
2749 ((((use_arg_then2 ("second_derivative_compose", [second_derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_asn", [diff2_asn]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("second_derivative_asn", [second_derivative_asn]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("derivative_asn", [derivative_asn]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2750 ((repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ADD_RDISTRIB", [REAL_ADD_RDISTRIB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM]))(thm_tac (new_rewrite [] [])))));
2751 ((THENL_LAST) ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. a = c /\ b = d ==> a + b = c + d`))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac)));
2752 ((fun arg_tac -> arg_tac (Arg_term (`&1 - f x * f x`))) (term_tac (set_tac "y")));
2753 ((fun arg_tac -> arg_tac (Arg_term (`&0 <= y /\ &0 < y /\ ~(y = &0)`))) (term_tac (have_gen_tac [](move ["y_ineq"]))));
2754 ((((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. &1 - a * a = (&1 - a) * (&1 + a)`)))(thm_tac (new_rewrite [] [])))));
2755 (((((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("f_ineq", [])) (disch_tac [])) THEN (clear_assumption "f_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2756 ((fun arg_tac -> arg_tac (Arg_term (`sqrt (y pow 3) = sqrt y * y`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
2757 (((((use_arg_then2 ("SQRT_POW", [SQRT_POW]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 = SUC 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_powS", [real_powS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SQRT_POW_2", [SQRT_POW_2]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2758 ((((use_arg_then2 ("REAL_INV_MUL", [REAL_INV_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. (a * b) * c * d = c * a * (b * d)`)))(thm_tac (new_rewrite [] [])))));
2759 (((((use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2760 ];;
2761
2762 (* Lemma second_derivative_compose_matan *)
2763 let second_derivative_compose_matan = Sections.section_proof []
2764 `-- &1 < f x ==>
2765 nth_derivative 2 (\x. matan (f x)) x =
2766 nth_derivative 2 f x * dmatan (f x) + derivative f x pow 2 * ddmatan (f x)`
2767 [
2768 (BETA_TAC THEN (move ["f_ineq"]));
2769 ((((use_arg_then2 ("second_derivative_compose", [second_derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_matan", [diff2_matan]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("second_derivative_matan", [second_derivative_matan]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("derivative_matan", [derivative_matan]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2770 ((arith_tac) THEN (done_tac));
2771 ];;
2772
2773 (* Lemma diff2_compose_abs_pos *)
2774 let diff2_compose_abs_pos = Sections.section_proof []
2775 `&0 < f x ==> nth_diff_strong 2 (\x. abs (f x)) x`
2776 [
2777 ((BETA_TAC THEN (move ["f_ineq"])) THEN ((((use_arg_then2 ("diff2_compose", [diff2_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_abs_pos", [diff2_abs_pos]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2778 ];;
2779
2780 (* Lemma diff2_compose_abs_neg *)
2781 let diff2_compose_abs_neg = Sections.section_proof []
2782 `f x < &0 ==> nth_diff_strong 2 (\x. abs (f x)) x`
2783 [
2784 ((BETA_TAC THEN (move ["f_ineq"])) THEN ((((use_arg_then2 ("diff2_compose", [diff2_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_abs_neg", [diff2_abs_neg]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2785 ];;
2786
2787 (* Lemma diff2_compose_pow *)
2788 let diff2_compose_pow = Sections.section_proof ["n"]
2789 `nth_diff_strong 2 (\x. f x pow n) x`
2790 [
2791 ((fun arg_tac -> arg_tac (Arg_term (`\x. x pow n`))) (term_tac (set_tac "g")));
2792 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(\x. f x pow n) = (\x. g (f x))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)));
2793 (((((use_arg_then2 ("diff2_compose", [diff2_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("diff2_pow_x", [diff2_pow_x]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2794 ];;
2795
2796 (* Lemma diff2_compose_atn *)
2797 let diff2_compose_atn = Sections.section_proof []
2798 `nth_diff_strong 2 (\x. atn (f x)) x`
2799 [
2800 (((((use_arg_then2 ("diff2_compose", [diff2_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_atn", [diff2_atn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2801 ];;
2802
2803 (* Lemma diff2_compose_cos *)
2804 let diff2_compose_cos = Sections.section_proof []
2805 `nth_diff_strong 2 (\x. cos (f x)) x`
2806 [
2807 (((((use_arg_then2 ("diff2_compose", [diff2_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_cos", [diff2_cos]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2808 ];;
2809
2810 (* Lemma diff2_compose_sin *)
2811 let diff2_compose_sin = Sections.section_proof []
2812 `nth_diff_strong 2 (\x. sin (f x)) x`
2813 [
2814 (((((use_arg_then2 ("diff2_compose", [diff2_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_sin", [diff2_sin]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2815 ];;
2816
2817 (* Lemma diff2_compose_exp *)
2818 let diff2_compose_exp = Sections.section_proof []
2819 `nth_diff_strong 2 (\x. exp (f x)) x`
2820 [
2821 (((((use_arg_then2 ("diff2_compose", [diff2_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_exp", [diff2_exp]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2822 ];;
2823
2824 (* Lemma diff2_compose_log *)
2825 let diff2_compose_log = Sections.section_proof []
2826 `&0 < f x ==> nth_diff_strong 2 (\x. log (f x)) x`
2827 [
2828 ((BETA_TAC THEN (move ["f_ineq"])) THEN ((((use_arg_then2 ("diff2_compose", [diff2_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_log", [diff2_log]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2829 ];;
2830
2831 (* Lemma diff2_compose_inv *)
2832 let diff2_compose_inv = Sections.section_proof []
2833 `~(f x = &0) ==> nth_diff_strong 2 (\x. inv (f x)) x`
2834 [
2835 ((BETA_TAC THEN (move ["fn0"])) THEN ((((use_arg_then2 ("diff2_compose", [diff2_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_inv", [diff2_inv]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2836 ];;
2837
2838 (* Lemma diff2_compose_sqrt *)
2839 let diff2_compose_sqrt = Sections.section_proof []
2840 `&0 < f x ==> nth_diff_strong 2 (\x. sqrt (f x)) x`
2841 [
2842 ((BETA_TAC THEN (move ["f_pos"])) THEN ((((use_arg_then2 ("diff2_compose", [diff2_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_sqrt", [diff2_sqrt]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2843 ];;
2844
2845 (* Lemma diff2_compose_acs *)
2846 let diff2_compose_acs = Sections.section_proof []
2847 `abs (f x) < &1 ==> nth_diff_strong 2 (\x. acs (f x)) x`
2848 [
2849 ((BETA_TAC THEN (move ["f_abs"])) THEN ((((use_arg_then2 ("diff2_compose", [diff2_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_acs", [diff2_acs]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2850 ];;
2851
2852 (* Lemma diff2_compose_asn *)
2853 let diff2_compose_asn = Sections.section_proof []
2854 `abs (f x) < &1 ==> nth_diff_strong 2 (\x. asn (f x)) x`
2855 [
2856 ((BETA_TAC THEN (move ["f_abs"])) THEN ((((use_arg_then2 ("diff2_compose", [diff2_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_asn", [diff2_asn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2857 ];;
2858
2859 (* Lemma diff2_compose_matan *)
2860 let diff2_compose_matan = Sections.section_proof []
2861 `-- &1 < f x ==> nth_diff_strong 2 (\x. matan (f x)) x`
2862 [
2863 ((BETA_TAC THEN (move ["f_ineq"])) THEN ((((use_arg_then2 ("diff2_compose", [diff2_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_matan", [diff2_matan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2864 ];;
2865
2866 (* Finalization of the section SecondDerivativeCompose *)
2867 let REAL_CONTINUOUS_OPEN_PREIMAGE = Sections.finalize_theorem REAL_CONTINUOUS_OPEN_PREIMAGE;;
2868 let second_derivative_compose = Sections.finalize_theorem second_derivative_compose;;
2869 let diff2_compose = Sections.finalize_theorem diff2_compose;;
2870 let continuous_not0_exists_open = Sections.finalize_theorem continuous_not0_exists_open;;
2871 let continuous_gt_exists_open = Sections.finalize_theorem continuous_gt_exists_open;;
2872 let continuous_lt_exists_open = Sections.finalize_theorem continuous_lt_exists_open;;
2873 let second_derivative_compose_abs_pos = Sections.finalize_theorem second_derivative_compose_abs_pos;;
2874 let second_derivative_compose_abs_neg = Sections.finalize_theorem second_derivative_compose_abs_neg;;
2875 let second_derivative_compose_pow = Sections.finalize_theorem second_derivative_compose_pow;;
2876 let second_derivative_compose_pow2 = Sections.finalize_theorem second_derivative_compose_pow2;;
2877 let second_derivative_compose_pow3 = Sections.finalize_theorem second_derivative_compose_pow3;;
2878 let second_derivative_compose_atn = Sections.finalize_theorem second_derivative_compose_atn;;
2879 let second_derivative_compose_cos = Sections.finalize_theorem second_derivative_compose_cos;;
2880 let second_derivative_compose_sin = Sections.finalize_theorem second_derivative_compose_sin;;
2881 let second_derivative_compose_exp = Sections.finalize_theorem second_derivative_compose_exp;;
2882 let second_derivative_compose_log = Sections.finalize_theorem second_derivative_compose_log;;
2883 let second_derivative_compose_inv = Sections.finalize_theorem second_derivative_compose_inv;;
2884 let second_derivative_compose_sqrt = Sections.finalize_theorem second_derivative_compose_sqrt;;
2885 let second_derivative_compose_acs = Sections.finalize_theorem second_derivative_compose_acs;;
2886 let second_derivative_compose_asn = Sections.finalize_theorem second_derivative_compose_asn;;
2887 let second_derivative_compose_matan = Sections.finalize_theorem second_derivative_compose_matan;;
2888 let diff2_compose_abs_pos = Sections.finalize_theorem diff2_compose_abs_pos;;
2889 let diff2_compose_abs_neg = Sections.finalize_theorem diff2_compose_abs_neg;;
2890 let diff2_compose_pow = Sections.finalize_theorem diff2_compose_pow;;
2891 let diff2_compose_atn = Sections.finalize_theorem diff2_compose_atn;;
2892 let diff2_compose_cos = Sections.finalize_theorem diff2_compose_cos;;
2893 let diff2_compose_sin = Sections.finalize_theorem diff2_compose_sin;;
2894 let diff2_compose_exp = Sections.finalize_theorem diff2_compose_exp;;
2895 let diff2_compose_log = Sections.finalize_theorem diff2_compose_log;;
2896 let diff2_compose_inv = Sections.finalize_theorem diff2_compose_inv;;
2897 let diff2_compose_sqrt = Sections.finalize_theorem diff2_compose_sqrt;;
2898 let diff2_compose_acs = Sections.finalize_theorem diff2_compose_acs;;
2899 let diff2_compose_asn = Sections.finalize_theorem diff2_compose_asn;;
2900 let diff2_compose_matan = Sections.finalize_theorem diff2_compose_matan;;
2901 Sections.end_section "SecondDerivativeCompose";;
2902
2903 (* Lemma second_derivative_mul *)
2904 let second_derivative_mul = Sections.section_proof ["f";"g";"x"]
2905 `nth_diff_strong 2 f x ==>
2906 nth_diff_strong 2 g x ==>
2907 nth_derivative 2 (\x. f x * g x) x =
2908 f x * nth_derivative 2 g x + &2 * derivative f x * derivative g x + nth_derivative 2 f x * g x`
2909 [
2910 ((BETA_TAC THEN (move ["df0"]) THEN (move ["dg0"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`(x,x)`))) (term_tac (set_tac "int"))));
2911 ((fun arg_tac -> arg_tac (Arg_term (`interval_arith x int /\ nth_diff_strong_int 2 int f /\ nth_diff_strong_int 2 int g`))) (term_tac (have_gen_tac [](case THEN ((move ["ineq"]) THEN (case THEN ((move ["df"]) THEN (move ["dg"]))))))));
2912 ((repeat_tactic 1 9 (((use_arg_then2 ("int_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CONST_INTERVAL", [CONST_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2913 (((split_tac) THEN (move ["y"])) THEN (((((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_ANTISYM", [REAL_LE_ANTISYM]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2914 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_derivative_mul", [nth_derivative_mul])) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("dg", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
2915 ((((use_arg_then2 ("TWO", [TWO]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL SUM_CLAUSES_NUMSEG)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `!n. 0 <= SUC n`)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("TWO", [TWO]))(gsym_then (thm_tac (new_rewrite [] []))))));
2916 ((((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subn0", [subn0]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 - 1 = 1`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_derivative0", [nth_derivative0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_derivative1", [nth_derivative1]))(thm_tac (new_rewrite [] []))))));
2917 (((((use_arg_then2 ("binom", [binom]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("BINOM_1", [BINOM_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("BINOM_REFL", [BINOM_REFL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2918 ];;
2919
2920 (* Lemma second_derivative_div *)
2921 let second_derivative_div = Sections.section_proof ["f";"g";"x"]
2922 `~(g x = &0) ==>
2923 nth_diff_strong 2 f x ==>
2924 nth_diff_strong 2 g x ==>
2925 nth_derivative 2 (\x. f x / g x) x =
2926 ((nth_derivative 2 f x * g x - f x * nth_derivative 2 g x) * g x -
2927 &2 * derivative g x * (derivative f x * g x - f x * derivative g x)) / (g x pow 3)`
2928 [
2929 (BETA_TAC THEN (move ["gn0"]) THEN (move ["diff_f"]) THEN (move ["diff_g"]));
2930 (((fun arg_tac -> arg_tac (Arg_term (`derivative g x`))) (term_tac (set_tac "dg"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`derivative f x`))) (term_tac (set_tac "df"))));
2931 (((fun arg_tac -> arg_tac (Arg_term (`nth_derivative 2 g x`))) (term_tac (set_tac "ddg"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`nth_derivative 2 f x`))) (term_tac (set_tac "ddf"))));
2932 ((repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("second_derivative_mul", [second_derivative_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("second_derivative_compose_inv", [second_derivative_compose_inv]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_compose_inv", [diff2_compose_inv]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
2933 (((use_arg_then2 ("derivative_compose_inv", [derivative_compose_inv]))(thm_tac (new_rewrite [] []))));
2934 ((((use_arg_then2 ("diff_g", [])) (disch_tac [])) THEN (clear_assumption "diff_g") THEN BETA_TAC) THEN ((((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (done_tac));
2935 ((((use_arg_then2 ("ddf_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ddg_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dg_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))));
2936 ((fun arg_tac -> arg_tac (Arg_term (`_1 + _2`))) (term_tac (set_tac "lhs")));
2937 (((fun arg_tac -> arg_tac (Arg_theorem (REAL_RING `!f g x. ((ddf * g x - f x * ddg) * g x - &2 * dg * (df * g x - f x * dg)) *
2938 inv (g x pow 3) =
2939 f x * (&2 * dg pow 2 - ddg * g x) * inv (g x pow 3) +
2940 &2 * df * --(g x * inv (g x pow 3)) * dg +
2941 ddf * (g x * g x * inv (g x pow 3))`)))(thm_tac (new_rewrite [] []))));
2942 ((fun arg_tac -> arg_tac (Arg_term (`g x * inv (g x pow 3) = inv (g x pow 2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
2943 (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 = SUC 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_powS", [real_powS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_INV_MUL", [REAL_INV_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2944 ((fun arg_tac -> arg_tac (Arg_term (`g x * inv (g x pow 2) = inv (g x)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
2945 (((((use_arg_then2 ("TWO", [TWO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_powS", [real_powS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_INV_MUL", [REAL_INV_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POW_1", [REAL_POW_1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2946 (((((fun arg_tac -> (use_arg_then2 ("REAL_POW_2", [REAL_POW_2])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`g x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lhs_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2947 ];;
2948
2949 (* Lemma diff2_div *)
2950 let diff2_div = Sections.section_proof ["f";"g";"x"]
2951 `~(g x = &0) ==> nth_diff_strong 2 f x ==> nth_diff_strong 2 g x ==>
2952 nth_diff_strong 2 (\x. f x / g x) x`
2953 [
2954 ((BETA_TAC THEN (move ["gn0"]) THEN (move ["df0"]) THEN (move ["dg0"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`(x,x)`))) (term_tac (set_tac "int"))));
2955 ((fun arg_tac -> arg_tac (Arg_term (`interval_arith x int /\ nth_diff_strong_int 2 int f /\ nth_diff_strong_int 2 int g`))) (term_tac (have_gen_tac [](case THEN ((move ["ineq"]) THEN (case THEN ((move ["df"]) THEN (move ["dg"]))))))));
2956 ((repeat_tactic 1 9 (((use_arg_then2 ("int_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CONST_INTERVAL", [CONST_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2957 (((split_tac) THEN (move ["y"])) THEN (((((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_ANTISYM", [REAL_LE_ANTISYM]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2958 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_diff_mul", [nth_diff_mul])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\x. inv (g x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
2959 ((((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN ((TRY done_tac)) THEN (move ["y"])));
2960 (((((use_arg_then2 ("int_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_ANTISYM", [REAL_LE_ANTISYM]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))));
2961 ((((use_arg_then2 ("diff2_compose_inv", [diff2_compose_inv]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2962 ];;
2963
2964 (* Lemma second_derivative_scale *)
2965 let second_derivative_scale = Sections.section_proof ["f";"c";"x"]
2966 `nth_diff_strong 2 f x ==>
2967 nth_derivative 2 (\x. c * f x) x = c * nth_derivative 2 f x`
2968 [
2969 ((BETA_TAC THEN (move ["df0"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`(x,x)`))) (term_tac (set_tac "int"))));
2970 ((fun arg_tac -> arg_tac (Arg_term (`interval_arith x int /\ nth_diff_strong_int 2 int f`))) (term_tac (have_gen_tac [](case THEN ((move ["ineq"]) THEN (move ["df"]))))));
2971 ((repeat_tactic 1 9 (((use_arg_then2 ("int_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CONST_INTERVAL", [CONST_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2972 ((BETA_TAC THEN (move ["y"])) THEN (((((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_ANTISYM", [REAL_LE_ANTISYM]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2973 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_derivative_scale", [nth_derivative_scale])) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("c", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2974 ];;
2975
2976 (* Lemma second_derivative_add *)
2977 let second_derivative_add = Sections.section_proof ["f";"g";"x"]
2978 `nth_diff_strong 2 f x ==>
2979 nth_diff_strong 2 g x ==>
2980 nth_derivative 2 (\x. f x + g x) x = nth_derivative 2 f x + nth_derivative 2 g x`
2981 [
2982 ((BETA_TAC THEN (move ["df0"]) THEN (move ["dg0"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`(x,x)`))) (term_tac (set_tac "int"))));
2983 ((fun arg_tac -> arg_tac (Arg_term (`interval_arith x int /\ nth_diff_strong_int 2 int f /\ nth_diff_strong_int 2 int g`))) (term_tac (have_gen_tac [](case THEN ((move ["ineq"]) THEN (case THEN ((move ["df"]) THEN (move ["dg"]))))))));
2984 ((repeat_tactic 1 9 (((use_arg_then2 ("int_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CONST_INTERVAL", [CONST_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2985 (((split_tac) THEN (move ["y"])) THEN (((((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_ANTISYM", [REAL_LE_ANTISYM]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2986 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_derivative_add", [nth_derivative_add])) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("dg", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2987 ];;
2988
2989 (* Lemma second_derivative_sub *)
2990 let second_derivative_sub = Sections.section_proof ["f";"g";"x"]
2991 `nth_diff_strong 2 f x ==>
2992 nth_diff_strong 2 g x ==>
2993 nth_derivative 2 (\x. f x - g x) x = nth_derivative 2 f x - nth_derivative 2 g x`
2994 [
2995 ((BETA_TAC THEN (move ["df0"]) THEN (move ["dg0"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`(x,x)`))) (term_tac (set_tac "int"))));
2996 ((fun arg_tac -> arg_tac (Arg_term (`interval_arith x int /\ nth_diff_strong_int 2 int f /\ nth_diff_strong_int 2 int g`))) (term_tac (have_gen_tac [](case THEN ((move ["ineq"]) THEN (case THEN ((move ["df"]) THEN (move ["dg"]))))))));
2997 ((repeat_tactic 1 9 (((use_arg_then2 ("int_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CONST_INTERVAL", [CONST_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2998 (((split_tac) THEN (move ["y"])) THEN (((((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_ANTISYM", [REAL_LE_ANTISYM]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2999 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_derivative_sub", [nth_derivative_sub])) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("dg", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3000 ];;
3001
3002 (* Lemma second_derivative_compose_bounds *)
3003 let second_derivative_compose_bounds = Sections.section_proof ["f";"g";"int";"g_bounds";"dd_bounds"]
3004 `nth_diff_strong_int 2 int g ==>
3005 bounded_on_int g int g_bounds ==>
3006 nth_diff_strong_int 2 g_bounds f ==>
3007 bounded_on_int (\x. nth_derivative 2 f (g x) * derivative g x pow 2 +
3008 derivative f (g x) * nth_derivative 2 g x) int dd_bounds ==>
3009 has_bounded_second_derivative (\x. f (g x)) int dd_bounds`
3010 [
3011 ((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac));
3012 ((BETA_TAC THEN (move ["dg"]) THEN (move ["g_bounded"]) THEN (move ["df"]) THEN (move ["bounded"])) THEN ((split_tac) THEN (move ["x"]) THEN (move ["ineq"])));
3013 (((((use_arg_then2 ("diff2_compose", [diff2_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("g_bounded", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3014 (((((use_arg_then2 ("second_derivative_compose", [second_derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("g_bounded", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3015 ];;
3016
3017 (* Lemma second_derivative_abs_pos_bounds *)
3018 let second_derivative_abs_pos_bounds = Sections.section_proof ["dd_bounds"]
3019 `interval_pos int ==>
3020 bounded_on_int (\x. &0) int dd_bounds ==>
3021 has_bounded_second_derivative abs int dd_bounds`
3022 [
3023 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["int_pos"]) THEN (move ["bounded"]));
3024 ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]));
3025 (((((use_arg_then2 ("diff2_abs_pos", [diff2_abs_pos]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3026 ((((use_arg_then2 ("second_derivative_abs_pos", [second_derivative_abs_pos]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("bounded", [bounded])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))));
3027 ];;
3028
3029 (* Lemma second_derivative_abs_neg_bounds *)
3030 let second_derivative_abs_neg_bounds = Sections.section_proof ["dd_bounds"]
3031 `interval_neg int ==>
3032 bounded_on_int (\x. &0) int dd_bounds ==>
3033 has_bounded_second_derivative abs int dd_bounds`
3034 [
3035 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["int_neg"]) THEN (move ["bounded"]));
3036 ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]));
3037 (((((use_arg_then2 ("diff2_abs_neg", [diff2_abs_neg]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_neg", [interval_arith_neg])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3038 ((((use_arg_then2 ("second_derivative_abs_neg", [second_derivative_abs_neg]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_neg", [interval_arith_neg])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("bounded", [bounded])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))));
3039 ];;
3040
3041 (* Lemma second_derivative_compose_abs_pos_bounds *)
3042 let second_derivative_compose_abs_pos_bounds = Sections.section_proof ["f";"f_bounds";"dd_bounds"]
3043 `bounded_on_int f int f_bounds ==> interval_pos f_bounds ==>
3044 nth_diff_strong_int 2 int f ==>
3045 bounded_on_int (\x. nth_derivative 2 f x) int dd_bounds ==>
3046 has_bounded_second_derivative (\x. abs (f x)) int dd_bounds`
3047 [
3048 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["f_bounded"]) THEN (move ["f_int"]) THEN (move ["df"]) THEN (move ["bounded"]));
3049 ((fun arg_tac -> arg_tac (Arg_term (`!x. interval_arith x int ==> &0 < f x`))) (term_tac (have_gen_tac [](move ["f_pos"]))));
3050 ((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_bounded", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3051 ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]));
3052 (((((use_arg_then2 ("diff2_compose_abs_pos", [diff2_compose_abs_pos]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_pos", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3053 (((((use_arg_then2 ("second_derivative_compose_abs_pos", [second_derivative_compose_abs_pos]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_pos", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3054 ];;
3055
3056 (* Lemma second_derivative_compose_abs_neg_bounds *)
3057 let second_derivative_compose_abs_neg_bounds = Sections.section_proof ["f";"f_bounds";"dd_bounds"]
3058 `bounded_on_int f int f_bounds ==> interval_neg f_bounds ==>
3059 nth_diff_strong_int 2 int f ==>
3060 bounded_on_int (\x. --nth_derivative 2 f x) int dd_bounds ==>
3061 has_bounded_second_derivative (\x. abs (f x)) int dd_bounds`
3062 [
3063 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["f_bounded"]) THEN (move ["f_int"]) THEN (move ["df"]) THEN (move ["bounded"]));
3064 ((fun arg_tac -> arg_tac (Arg_term (`!x. interval_arith x int ==> f x < &0`))) (term_tac (have_gen_tac [](move ["f_ineq"]))));
3065 ((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_neg", [interval_arith_neg])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_bounded", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3066 ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]));
3067 (((((use_arg_then2 ("diff2_compose_abs_neg", [diff2_compose_abs_neg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_ineq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3068 (((((use_arg_then2 ("second_derivative_compose_abs_neg", [second_derivative_compose_abs_neg]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_ineq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3069 ];;
3070
3071 (* Lemma second_derivative_pow_bounds *)
3072 let second_derivative_pow_bounds = Sections.section_proof ["n";"dd_bounds"]
3073 `bounded_on_int (\x. &(n * (n - 1)) * x pow (n - 2)) int dd_bounds ==>
3074 has_bounded_second_derivative (\x. x pow n) int dd_bounds`
3075 [
3076 (((((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"]));
3077 ((THENL_LAST) (split_tac) (((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("second_derivative_pow_x", [second_derivative_pow_x]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
3078 (((((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_pow_x", [diff2_pow_x]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3079 ];;
3080
3081 (* Lemma second_derivative_compose_pow_bounds *)
3082 let second_derivative_compose_pow_bounds = Sections.section_proof ["n";"f";"dd_bounds"]
3083 `nth_diff_strong_int 2 int f ==>
3084 bounded_on_int (\x. &n * (nth_derivative 2 f x * f x pow (n - 1) +
3085 &(n - 1) * f x pow (n - 2) * derivative f x pow 2)) int dd_bounds ==>
3086 has_bounded_second_derivative (\x. f x pow n) int dd_bounds`
3087 [
3088 ((((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["df"]) THEN (move ["bounded"])) THEN ((split_tac) THEN (move ["x"]) THEN (move ["ineq"])));
3089 (((((use_arg_then2 ("diff2_compose_pow", [diff2_compose_pow]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3090 (((((use_arg_then2 ("second_derivative_compose_pow", [second_derivative_compose_pow]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3091 ];;
3092
3093 (* Lemma second_derivative_pow2_bounds *)
3094 let second_derivative_pow2_bounds = Sections.section_proof ["dd_bounds"]
3095 `bounded_on_int (\x. &2) int dd_bounds ==>
3096 has_bounded_second_derivative (\x. x pow 2) int dd_bounds`
3097 [
3098 ((BETA_TAC THEN (move ["bounded"])) THEN ((((use_arg_then2 ("second_derivative_pow_bounds", [second_derivative_pow_bounds]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_pow", [real_pow]))(thm_tac (new_rewrite [] []))))));
3099 (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 * (2 - 1) = 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3100 ];;
3101
3102 (* Lemma second_derivative_compose_pow2_bounds *)
3103 let second_derivative_compose_pow2_bounds = Sections.section_proof ["f";"dd_bounds"]
3104 `nth_diff_strong_int 2 int f ==>
3105 bounded_on_int (\x. &2 * (nth_derivative 2 f x * f x +
3106 derivative f x pow 2)) int dd_bounds ==>
3107 has_bounded_second_derivative (\x. f x pow 2) int dd_bounds`
3108 [
3109 ((BETA_TAC THEN (move ["df"]) THEN (move ["bounded"])) THEN ((((use_arg_then2 ("second_derivative_compose_pow_bounds", [second_derivative_compose_pow_bounds]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
3110 (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 - 1 = 1`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL real_pow)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_POW_1", [REAL_POW_1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3111 ];;
3112
3113 (* Lemma second_derivative_pow3_bounds *)
3114 let second_derivative_pow3_bounds = Sections.section_proof ["dd_bounds"]
3115 `bounded_on_int (\x. &6 * x) int dd_bounds ==>
3116 has_bounded_second_derivative (\x. x pow 3) int dd_bounds`
3117 [
3118 ((BETA_TAC THEN (move ["bounded"])) THEN ((((use_arg_then2 ("second_derivative_pow_bounds", [second_derivative_pow_bounds]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
3119 (((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 * (3 - 1) = 6 /\ 3 - 2 = 1`)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_POW_1", [REAL_POW_1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3120 ];;
3121
3122 (* Lemma second_derivative_compose_pow3_bounds *)
3123 let second_derivative_compose_pow3_bounds = Sections.section_proof ["f";"dd_bounds"]
3124 `nth_diff_strong_int 2 int f ==>
3125 bounded_on_int (\x. &3 * (nth_derivative 2 f x * f x pow 2 +
3126 &2 * f x * derivative f x pow 2)) int dd_bounds ==>
3127 has_bounded_second_derivative (\x. f x pow 3) int dd_bounds`
3128 [
3129 ((BETA_TAC THEN (move ["df"]) THEN (move ["bounded"])) THEN ((((use_arg_then2 ("second_derivative_compose_pow_bounds", [second_derivative_compose_pow_bounds]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
3130 (((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 - 1 = 2 /\ 3 - 2 = 1`)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_POW_1", [REAL_POW_1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3131 ];;
3132
3133 (* Lemma second_derivative_atn_bounds *)
3134 let second_derivative_atn_bounds = Sections.section_proof ["dd_bounds"]
3135 `bounded_on_int (\x. (-- &2 * x) * inv(&1 + x pow 2) pow 2) int dd_bounds ==>
3136 has_bounded_second_derivative atn int dd_bounds`
3137 [
3138 (((((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"]));
3139 ((THENL_LAST) (split_tac) (((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("second_derivative_atn", [second_derivative_atn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
3140 (((((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_atn", [diff2_atn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3141 ];;
3142
3143 (* Lemma second_derivative_compose_atn_bounds *)
3144 let second_derivative_compose_atn_bounds = Sections.section_proof ["f";"dd_bounds"]
3145 `nth_diff_strong_int 2 int f ==>
3146 bounded_on_int (\x. (nth_derivative 2 f x * (&1 + f x * f x) - &2 * f x * derivative f x pow 2) /
3147 (&1 + f x * f x) pow 2) int dd_bounds ==>
3148 has_bounded_second_derivative (\x. atn (f x)) int dd_bounds`
3149 [
3150 ((((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["df"]) THEN (move ["bounded"])) THEN ((split_tac) THEN (move ["x"]) THEN (move ["ineq"])));
3151 (((((use_arg_then2 ("diff2_compose_atn", [diff2_compose_atn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3152 (((((use_arg_then2 ("second_derivative_compose_atn", [second_derivative_compose_atn]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3153 ];;
3154
3155 (* Lemma second_derivative_cos_bounds *)
3156 let second_derivative_cos_bounds = Sections.section_proof ["dd_bounds"]
3157 `bounded_on_int (\x. -- cos x) int dd_bounds ==>
3158 has_bounded_second_derivative cos int dd_bounds`
3159 [
3160 (((((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"]));
3161 ((THENL_LAST) (split_tac) (((((use_arg_then2 ("second_derivative_cos", [second_derivative_cos]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
3162 (((((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_cos", [diff2_cos]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3163 ];;
3164
3165 (* Lemma second_derivative_compose_cos_bounds *)
3166 let second_derivative_compose_cos_bounds = Sections.section_proof ["f";"dd_bounds"]
3167 `nth_diff_strong_int 2 int f ==>
3168 bounded_on_int (\x. --(nth_derivative 2 f x * sin (f x)
3169 + cos (f x) * derivative f x pow 2)) int dd_bounds ==>
3170 has_bounded_second_derivative (\x. cos (f x)) int dd_bounds`
3171 [
3172 ((((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["df"]) THEN (move ["bounded"])) THEN ((split_tac) THEN (move ["x"]) THEN (move ["ineq"])));
3173 (((((use_arg_then2 ("diff2_compose_cos", [diff2_compose_cos]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3174 (((((use_arg_then2 ("second_derivative_compose_cos", [second_derivative_compose_cos]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3175 ];;
3176
3177 (* Lemma second_derivative_sin_bounds *)
3178 let second_derivative_sin_bounds = Sections.section_proof ["dd_bounds"]
3179 `bounded_on_int (\x. -- sin x) int dd_bounds ==>
3180 has_bounded_second_derivative sin int dd_bounds`
3181 [
3182 (((((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"]));
3183 ((THENL_LAST) (split_tac) (((((use_arg_then2 ("second_derivative_sin", [second_derivative_sin]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
3184 (((((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_sin", [diff2_sin]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3185 ];;
3186
3187 (* Lemma second_derivative_compose_sin_bounds *)
3188 let second_derivative_compose_sin_bounds = Sections.section_proof ["f";"dd_bounds"]
3189 `nth_diff_strong_int 2 int f ==>
3190 bounded_on_int (\x. nth_derivative 2 f x * cos (f x)
3191 - sin (f x) * derivative f x pow 2) int dd_bounds ==>
3192 has_bounded_second_derivative (\x. sin (f x)) int dd_bounds`
3193 [
3194 ((((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["df"]) THEN (move ["bounded"])) THEN ((split_tac) THEN (move ["x"]) THEN (move ["ineq"])));
3195 (((((use_arg_then2 ("diff2_compose_sin", [diff2_compose_sin]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3196 (((((use_arg_then2 ("second_derivative_compose_sin", [second_derivative_compose_sin]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3197 ];;
3198
3199 (* Lemma second_derivative_exp_bounds *)
3200 let second_derivative_exp_bounds = Sections.section_proof ["dd_bounds"]
3201 `bounded_on_int exp int dd_bounds ==>
3202 has_bounded_second_derivative exp int dd_bounds`
3203 [
3204 (((((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"]));
3205 ((THENL_LAST) (split_tac) (((((use_arg_then2 ("second_derivative_exp", [second_derivative_exp]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
3206 (((((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_exp", [diff2_exp]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3207 ];;
3208
3209 (* Lemma second_derivative_compose_exp_bounds *)
3210 let second_derivative_compose_exp_bounds = Sections.section_proof ["f";"dd_bounds"]
3211 `nth_diff_strong_int 2 int f ==>
3212 bounded_on_int (\x. nth_derivative 2 f x * exp (f x)
3213 + exp (f x) * derivative f x pow 2) int dd_bounds ==>
3214 has_bounded_second_derivative (\x. exp (f x)) int dd_bounds`
3215 [
3216 ((((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["df"]) THEN (move ["bounded"])) THEN ((split_tac) THEN (move ["x"]) THEN (move ["ineq"])));
3217 (((((use_arg_then2 ("diff2_compose_exp", [diff2_compose_exp]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3218 (((((use_arg_then2 ("second_derivative_compose_exp", [second_derivative_compose_exp]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3219 ];;
3220
3221 (* Lemma second_derivative_log_bounds *)
3222 let second_derivative_log_bounds = Sections.section_proof ["dd_bounds"]
3223 `interval_pos int ==>
3224 bounded_on_int (\x. --inv (x pow 2)) int dd_bounds ==>
3225 has_bounded_second_derivative log int dd_bounds`
3226 [
3227 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["int_pos"]) THEN (move ["bounded"]));
3228 ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]));
3229 (((((use_arg_then2 ("diff2_log", [diff2_log]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3230 (((((use_arg_then2 ("second_derivative_log", [second_derivative_log]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3231 ];;
3232
3233 (* Lemma second_derivative_compose_log_bounds *)
3234 let second_derivative_compose_log_bounds = Sections.section_proof ["f";"f_bounds";"dd_bounds"]
3235 `bounded_on_int f int f_bounds ==> interval_pos f_bounds ==>
3236 nth_diff_strong_int 2 int f ==>
3237 bounded_on_int (\x. nth_derivative 2 f x / f x - (derivative f x / f x) pow 2)
3238 int dd_bounds ==>
3239 has_bounded_second_derivative (\x. log (f x)) int dd_bounds`
3240 [
3241 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["f_bounded"]) THEN (move ["f_int"]) THEN (move ["df"]) THEN (move ["bounded"]));
3242 ((fun arg_tac -> arg_tac (Arg_term (`!x. interval_arith x int ==> &0 < f x`))) (term_tac (have_gen_tac [](move ["f_pos"]))));
3243 ((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_bounded", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3244 ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]));
3245 (((((use_arg_then2 ("diff2_compose_log", [diff2_compose_log]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_pos", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3246 (((((use_arg_then2 ("second_derivative_compose_log", [second_derivative_compose_log]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_pos", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3247 ];;
3248
3249 (* Lemma second_derivative_inv_bounds *)
3250 let second_derivative_inv_bounds = Sections.section_proof ["dd_bounds"]
3251 `interval_not_zero int ==>
3252 bounded_on_int (\x. &2 * inv (x pow 3)) int dd_bounds ==>
3253 has_bounded_second_derivative inv int dd_bounds`
3254 [
3255 ((((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["int0"]) THEN (move ["bounded"])) THEN ((split_tac) THEN (move ["x"]) THEN (move ["ineq"])));
3256 (((((use_arg_then2 ("diff2_inv", [diff2_inv]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_not_zero", [interval_arith_not_zero])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3257 (((((use_arg_then2 ("second_derivative_inv", [second_derivative_inv]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_not_zero", [interval_arith_not_zero])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3258 ];;
3259
3260 (* Lemma second_derivative_compose_inv_bounds *)
3261 let second_derivative_compose_inv_bounds = Sections.section_proof ["f";"f_bounds";"dd_bounds"]
3262 `bounded_on_int f int f_bounds ==> interval_not_zero f_bounds ==>
3263 nth_diff_strong_int 2 int f ==>
3264 bounded_on_int (\x. (&2 * derivative f x pow 2 - nth_derivative 2 f x * f x) / f x pow 3)
3265 int dd_bounds ==>
3266 has_bounded_second_derivative (\x. inv (f x)) int dd_bounds`
3267 [
3268 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["f_bounded"]) THEN (move ["f0"]) THEN (move ["df"]) THEN (move ["bounded"]));
3269 ((fun arg_tac -> arg_tac (Arg_term (`!x. interval_arith x int ==> ~(f x = &0)`))) (term_tac (have_gen_tac [](move ["fn0"]))));
3270 ((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_not_zero", [interval_arith_not_zero])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_bounded", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3271 ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]));
3272 (((((use_arg_then2 ("diff2_compose_inv", [diff2_compose_inv]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fn0", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3273 (((((use_arg_then2 ("second_derivative_compose_inv", [second_derivative_compose_inv]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("fn0", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3274 ];;
3275
3276 (* Lemma second_derivative_sqrt_bounds *)
3277 let second_derivative_sqrt_bounds = Sections.section_proof ["dd_bounds"]
3278 `interval_pos int ==>
3279 bounded_on_int (\x. --inv (&4 * sqrt (x pow 3))) int dd_bounds ==>
3280 has_bounded_second_derivative sqrt int dd_bounds`
3281 [
3282 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["int_pos"]) THEN (move ["bounded"]));
3283 ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]));
3284 (((((use_arg_then2 ("diff2_sqrt", [diff2_sqrt]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3285 (((((use_arg_then2 ("second_derivative_sqrt", [second_derivative_sqrt]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3286 ];;
3287
3288 (* Lemma second_derivative_compose_sqrt_bounds *)
3289 let second_derivative_compose_sqrt_bounds = Sections.section_proof ["f";"f_bounds";"dd_bounds"]
3290 `bounded_on_int f int f_bounds ==> interval_pos f_bounds ==>
3291 nth_diff_strong_int 2 int f ==>
3292 bounded_on_int (\x. (&2 * nth_derivative 2 f x * f x - derivative f x pow 2) /
3293 (&4 * sqrt (f x pow 3)))
3294 int dd_bounds ==>
3295 has_bounded_second_derivative (\x. sqrt (f x)) int dd_bounds`
3296 [
3297 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["f_bounded"]) THEN (move ["f_int"]) THEN (move ["df"]) THEN (move ["bounded"]));
3298 ((fun arg_tac -> arg_tac (Arg_term (`!x. interval_arith x int ==> &0 < f x`))) (term_tac (have_gen_tac [](move ["f_pos"]))));
3299 ((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_bounded", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3300 ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]));
3301 (((((use_arg_then2 ("diff2_compose_sqrt", [diff2_compose_sqrt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_pos", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3302 (((((use_arg_then2 ("second_derivative_compose_sqrt", [second_derivative_compose_sqrt]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_pos", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3303 ];;
3304
3305 (* Lemma second_derivative_acs_bounds *)
3306 let second_derivative_acs_bounds = Sections.section_proof ["dd_bounds"]
3307 `iabs int < &1 ==>
3308 bounded_on_int (\x. --(x / sqrt ((&1 - x * x) pow 3))) int dd_bounds ==>
3309 has_bounded_second_derivative acs int dd_bounds`
3310 [
3311 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["int_abs"]) THEN (move ["bounded"]));
3312 ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]));
3313 (((((use_arg_then2 ("diff2_acs", [diff2_acs]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3314 (((((use_arg_then2 ("second_derivative_acs", [second_derivative_acs]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3315 ];;
3316
3317 (* Lemma second_derivative_compose_acs_bounds *)
3318 let second_derivative_compose_acs_bounds = Sections.section_proof ["f";"f_bounds";"dd_bounds"]
3319 `bounded_on_int f int f_bounds ==> iabs f_bounds < &1 ==>
3320 nth_diff_strong_int 2 int f ==>
3321 bounded_on_int (\x. --((nth_derivative 2 f x * (&1 - f x * f x) + f x * derivative f x pow 2) /
3322 sqrt ((&1 - f x * f x) pow 3))) int dd_bounds ==>
3323 has_bounded_second_derivative (\x. acs (f x)) int dd_bounds`
3324 [
3325 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["f_bounded"]) THEN (move ["f_abs"]) THEN (move ["df"]) THEN (move ["bounded"]));
3326 ((fun arg_tac -> arg_tac (Arg_term (`!x. interval_arith x int ==> abs (f x) < &1`))) (term_tac (have_gen_tac [](move ["fabs"]))));
3327 ((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_bounded", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3328 ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]));
3329 (((((use_arg_then2 ("diff2_compose_acs", [diff2_compose_acs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fabs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3330 (((((use_arg_then2 ("second_derivative_compose_acs", [second_derivative_compose_acs]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("fabs", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3331 ];;
3332
3333 (* Lemma second_derivative_asn_bounds *)
3334 let second_derivative_asn_bounds = Sections.section_proof ["dd_bounds"]
3335 `iabs int < &1 ==>
3336 bounded_on_int (\x. x / sqrt ((&1 - x * x) pow 3)) int dd_bounds ==>
3337 has_bounded_second_derivative asn int dd_bounds`
3338 [
3339 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["int_abs"]) THEN (move ["bounded"]));
3340 ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]));
3341 (((((use_arg_then2 ("diff2_asn", [diff2_asn]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3342 (((((use_arg_then2 ("second_derivative_asn", [second_derivative_asn]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3343 ];;
3344
3345 (* Lemma second_derivative_compose_asn_bounds *)
3346 let second_derivative_compose_asn_bounds = Sections.section_proof ["f";"f_bounds";"dd_bounds"]
3347 `bounded_on_int f int f_bounds ==> iabs f_bounds < &1 ==>
3348 nth_diff_strong_int 2 int f ==>
3349 bounded_on_int (\x. (nth_derivative 2 f x * (&1 - f x * f x) + f x * derivative f x pow 2) /
3350 sqrt ((&1 - f x * f x) pow 3)) int dd_bounds ==>
3351 has_bounded_second_derivative (\x. asn (f x)) int dd_bounds`
3352 [
3353 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["f_bounded"]) THEN (move ["f_abs"]) THEN (move ["df"]) THEN (move ["bounded"]));
3354 ((fun arg_tac -> arg_tac (Arg_term (`!x. interval_arith x int ==> abs (f x) < &1`))) (term_tac (have_gen_tac [](move ["fabs"]))));
3355 ((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_bounded", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3356 ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]));
3357 (((((use_arg_then2 ("diff2_compose_asn", [diff2_compose_asn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fabs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3358 (((((use_arg_then2 ("second_derivative_compose_asn", [second_derivative_compose_asn]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("fabs", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3359 ];;
3360
3361 (* Lemma interval_arith_gt *)
3362 let interval_arith_gt = Sections.section_proof ["x";"int";"f"]
3363 `interval_arith x int /\ interval_gt f int ==> f < x`
3364 [
3365 (((((fun arg_tac -> (use_arg_then2 ("pair_eq", [pair_eq])) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_gt", [interval_gt]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
3366 ];;
3367
3368 (* Lemma second_derivative_matan_bounds *)
3369 let second_derivative_matan_bounds = Sections.section_proof ["dd_bounds"]
3370 `interval_gt (-- &1) int ==>
3371 bounded_on_int ddmatan int dd_bounds ==>
3372 has_bounded_second_derivative matan int dd_bounds`
3373 [
3374 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["int_gt"]) THEN (move ["bounded"]));
3375 ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]));
3376 (((((use_arg_then2 ("diff2_matan", [diff2_matan]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_gt", [interval_arith_gt])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3377 (((((use_arg_then2 ("second_derivative_matan", [second_derivative_matan]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_gt", [interval_arith_gt])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("int", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3378 ];;
3379
3380 (* Lemma second_derivative_compose_matan_bounds *)
3381 let second_derivative_compose_matan_bounds = Sections.section_proof ["f";"f_bounds";"dd_bounds"]
3382 `bounded_on_int f int f_bounds ==> interval_gt (-- &1) f_bounds ==>
3383 nth_diff_strong_int 2 int f ==>
3384 bounded_on_int (\x. nth_derivative 2 f x * dmatan (f x) + derivative f x pow 2 * ddmatan (f x))
3385 int dd_bounds ==>
3386 has_bounded_second_derivative (\x. matan (f x)) int dd_bounds`
3387 [
3388 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["f_bounded"]) THEN (move ["f_int"]) THEN (move ["df"]) THEN (move ["bounded"]));
3389 ((fun arg_tac -> arg_tac (Arg_term (`!x. interval_arith x int ==> -- &1 < f x`))) (term_tac (have_gen_tac [](move ["f_ineq"]))));
3390 ((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("interval_arith_gt", [interval_arith_gt])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_bounded", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3391 ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]));
3392 (((((use_arg_then2 ("diff2_compose_matan", [diff2_compose_matan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_ineq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3393 (((((use_arg_then2 ("second_derivative_compose_matan", [second_derivative_compose_matan]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_ineq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3394 ];;
3395
3396 (* Lemma second_derivative_scale_bounds *)
3397 let second_derivative_scale_bounds = Sections.section_proof ["c";"f";"dd_bounds"]
3398 `nth_diff_strong_int 2 int f ==>
3399 bounded_on_int (\x. c * nth_derivative 2 f x) int dd_bounds ==>
3400 has_bounded_second_derivative (\x. c * f x) int dd_bounds`
3401 [
3402 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))))) THEN (simp_tac) THEN (move ["df"]) THEN (move ["b"]));
3403 (((((use_arg_then2 ("nth_diff_scale", [nth_diff_scale]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["ineq"]));
3404 ((((use_arg_then2 ("second_derivative_scale", [second_derivative_scale]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("b", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
3405 ((((use_arg_then2 ("df", [])) (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))) THEN (exact_tac) THEN (done_tac));
3406 ];;
3407
3408 (* Lemma second_derivative_add_bounds *)
3409 let second_derivative_add_bounds = Sections.section_proof ["f";"g";"dd_bounds"]
3410 `nth_diff_strong_int 2 int f ==>
3411 nth_diff_strong_int 2 int g ==>
3412 bounded_on_int (\x. nth_derivative 2 f x + nth_derivative 2 g x) int dd_bounds ==>
3413 has_bounded_second_derivative (\x. f x + g x) int dd_bounds`
3414 [
3415 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))))) THEN (simp_tac) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["b"]));
3416 (((((use_arg_then2 ("nth_diff_add", [nth_diff_add]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["ineq"]));
3417 ((((use_arg_then2 ("second_derivative_add", [second_derivative_add]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("b", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
3418 ((((use_arg_then2 ("dg", [])) (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then2 ("df", [])) (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3419 ];;
3420
3421 (* Lemma second_derivative_sub_bounds *)
3422 let second_derivative_sub_bounds = Sections.section_proof ["f";"g";"dd_bounds"]
3423 `nth_diff_strong_int 2 int f ==>
3424 nth_diff_strong_int 2 int g ==>
3425 bounded_on_int (\x. nth_derivative 2 f x - nth_derivative 2 g x) int dd_bounds ==>
3426 has_bounded_second_derivative (\x. f x - g x) int dd_bounds`
3427 [
3428 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))))) THEN (simp_tac) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["b"]));
3429 (((((use_arg_then2 ("nth_diff_sub", [nth_diff_sub]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["ineq"]));
3430 ((((use_arg_then2 ("second_derivative_sub", [second_derivative_sub]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("b", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
3431 ((((use_arg_then2 ("dg", [])) (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then2 ("df", [])) (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3432 ];;
3433
3434 (* Lemma second_derivative_mul_bounds *)
3435 let second_derivative_mul_bounds = Sections.section_proof ["f";"g";"dd_bounds"]
3436 `nth_diff_strong_int 2 int f ==>
3437 nth_diff_strong_int 2 int g ==>
3438 bounded_on_int (\x. f x * nth_derivative 2 g x + &2 * derivative f x * derivative g x +
3439 nth_derivative 2 f x * g x) int dd_bounds ==>
3440 has_bounded_second_derivative (\x. f x * g x) int dd_bounds`
3441 [
3442 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))))) THEN (simp_tac) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["b"]));
3443 (((((use_arg_then2 ("nth_diff_mul", [nth_diff_mul]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["ineq"]));
3444 ((((use_arg_then2 ("second_derivative_mul", [second_derivative_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("b", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
3445 ((((use_arg_then2 ("dg", [])) (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then2 ("df", [])) (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3446 ];;
3447
3448 (* Lemma second_derivative_div_bounds *)
3449 let second_derivative_div_bounds = Sections.section_proof ["f";"g";"g_bounds";"dd_bounds"]
3450 `bounded_on_int g int g_bounds ==> interval_not_zero g_bounds ==>
3451 nth_diff_strong_int 2 int f ==>
3452 nth_diff_strong_int 2 int g ==>
3453 bounded_on_int (\x. ((nth_derivative 2 f x * g x - f x * nth_derivative 2 g x) * g x -
3454 &2 * derivative g x * (derivative f x * g x - f x * derivative g x)) / g x pow 3) int dd_bounds ==>
3455 has_bounded_second_derivative (\x. f x / g x) int dd_bounds`
3456 [
3457 (((((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))))) THEN (move ["bg"]) THEN (move ["gn0"]) THEN (simp_tac) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["b"]));
3458 ((fun arg_tac -> arg_tac (Arg_term (`!x. interval_arith x int ==> ~(g x = &0)`))) (term_tac (have_gen_tac [](move ["g0"]))));
3459 ((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN (((use_arg_then2 ("interval_arith_not_zero", [interval_arith_not_zero])) (disch_tac [])) THEN (clear_assumption "interval_arith_not_zero") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`g_bounds`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("bg", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
3460 ((THENL_FIRST) ((split_tac) THEN (move ["x"]) THEN (move ["ineq"])) (((((use_arg_then2 ("diff2_div", [diff2_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("g0", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)));
3461 (((((use_arg_then2 ("second_derivative_div", [second_derivative_div]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("g0", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("b", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3462 ];;
3463
3464 (* Finalization of the section SecondDerivativeBound *)
3465 let nth_diff_strong2_eq_alt = Sections.finalize_theorem nth_diff_strong2_eq_alt;;
3466 let nth_diff_strong2_eq = Sections.finalize_theorem nth_diff_strong2_eq;;
3467 let lin_approx_compose = Sections.finalize_theorem lin_approx_compose;;
3468 let second_derivative_abs_pos = Sections.finalize_theorem second_derivative_abs_pos;;
3469 let second_derivative_abs_neg = Sections.finalize_theorem second_derivative_abs_neg;;
3470 let diff2_abs_pos = Sections.finalize_theorem diff2_abs_pos;;
3471 let diff2_abs_neg = Sections.finalize_theorem diff2_abs_neg;;
3472 let pow_x_has_real_derivative = Sections.finalize_theorem pow_x_has_real_derivative;;
3473 let second_derivative_pow_x = Sections.finalize_theorem second_derivative_pow_x;;
3474 let diff2_pow_x = Sections.finalize_theorem diff2_pow_x;;
3475 let second_derivative_pow2_x = Sections.finalize_theorem second_derivative_pow2_x;;
3476 let second_derivative_pow3_x = Sections.finalize_theorem second_derivative_pow3_x;;
3477 let second_derivative_atn_eq = Sections.finalize_theorem second_derivative_atn_eq;;
3478 let second_derivative_atn = Sections.finalize_theorem second_derivative_atn;;
3479 let diff2_atn = Sections.finalize_theorem diff2_atn;;
3480 let second_derivative_cos = Sections.finalize_theorem second_derivative_cos;;
3481 let diff2_cos = Sections.finalize_theorem diff2_cos;;
3482 let second_derivative_sin = Sections.finalize_theorem second_derivative_sin;;
3483 let diff2_sin = Sections.finalize_theorem diff2_sin;;
3484 let second_derivative_exp = Sections.finalize_theorem second_derivative_exp;;
3485 let diff2_exp = Sections.finalize_theorem diff2_exp;;
3486 let second_derivative_log = Sections.finalize_theorem second_derivative_log;;
3487 let diff2_log = Sections.finalize_theorem diff2_log;;
3488 let second_derivative_inv = Sections.finalize_theorem second_derivative_inv;;
3489 let diff2_inv = Sections.finalize_theorem diff2_inv;;
3490 let SQRT_POW = Sections.finalize_theorem SQRT_POW;;
3491 let second_derivative_sqrt = Sections.finalize_theorem second_derivative_sqrt;;
3492 let diff2_sqrt = Sections.finalize_theorem diff2_sqrt;;
3493 let real_powS = Sections.finalize_theorem real_powS;;
3494 let second_derivative_acs = Sections.finalize_theorem second_derivative_acs;;
3495 let diff2_acs = Sections.finalize_theorem diff2_acs;;
3496 let second_derivative_asn = Sections.finalize_theorem second_derivative_asn;;
3497 let diff2_asn = Sections.finalize_theorem diff2_asn;;
3498 let second_derivative_matan = Sections.finalize_theorem second_derivative_matan;;
3499 let diff2_matan = Sections.finalize_theorem diff2_matan;;
3500 let REAL_CONTINUOUS_OPEN_PREIMAGE = Sections.finalize_theorem REAL_CONTINUOUS_OPEN_PREIMAGE;;
3501 let second_derivative_compose = Sections.finalize_theorem second_derivative_compose;;
3502 let diff2_compose = Sections.finalize_theorem diff2_compose;;
3503 let continuous_not0_exists_open = Sections.finalize_theorem continuous_not0_exists_open;;
3504 let continuous_gt_exists_open = Sections.finalize_theorem continuous_gt_exists_open;;
3505 let continuous_lt_exists_open = Sections.finalize_theorem continuous_lt_exists_open;;
3506 let second_derivative_compose_abs_pos = Sections.finalize_theorem second_derivative_compose_abs_pos;;
3507 let second_derivative_compose_abs_neg = Sections.finalize_theorem second_derivative_compose_abs_neg;;
3508 let second_derivative_compose_pow = Sections.finalize_theorem second_derivative_compose_pow;;
3509 let second_derivative_compose_pow2 = Sections.finalize_theorem second_derivative_compose_pow2;;
3510 let second_derivative_compose_pow3 = Sections.finalize_theorem second_derivative_compose_pow3;;
3511 let second_derivative_compose_atn = Sections.finalize_theorem second_derivative_compose_atn;;
3512 let second_derivative_compose_cos = Sections.finalize_theorem second_derivative_compose_cos;;
3513 let second_derivative_compose_sin = Sections.finalize_theorem second_derivative_compose_sin;;
3514 let second_derivative_compose_exp = Sections.finalize_theorem second_derivative_compose_exp;;
3515 let second_derivative_compose_log = Sections.finalize_theorem second_derivative_compose_log;;
3516 let second_derivative_compose_inv = Sections.finalize_theorem second_derivative_compose_inv;;
3517 let second_derivative_compose_sqrt = Sections.finalize_theorem second_derivative_compose_sqrt;;
3518 let second_derivative_compose_acs = Sections.finalize_theorem second_derivative_compose_acs;;
3519 let second_derivative_compose_asn = Sections.finalize_theorem second_derivative_compose_asn;;
3520 let second_derivative_compose_matan = Sections.finalize_theorem second_derivative_compose_matan;;
3521 let diff2_compose_abs_pos = Sections.finalize_theorem diff2_compose_abs_pos;;
3522 let diff2_compose_abs_neg = Sections.finalize_theorem diff2_compose_abs_neg;;
3523 let diff2_compose_pow = Sections.finalize_theorem diff2_compose_pow;;
3524 let diff2_compose_atn = Sections.finalize_theorem diff2_compose_atn;;
3525 let diff2_compose_cos = Sections.finalize_theorem diff2_compose_cos;;
3526 let diff2_compose_sin = Sections.finalize_theorem diff2_compose_sin;;
3527 let diff2_compose_exp = Sections.finalize_theorem diff2_compose_exp;;
3528 let diff2_compose_log = Sections.finalize_theorem diff2_compose_log;;
3529 let diff2_compose_inv = Sections.finalize_theorem diff2_compose_inv;;
3530 let diff2_compose_sqrt = Sections.finalize_theorem diff2_compose_sqrt;;
3531 let diff2_compose_acs = Sections.finalize_theorem diff2_compose_acs;;
3532 let diff2_compose_asn = Sections.finalize_theorem diff2_compose_asn;;
3533 let diff2_compose_matan = Sections.finalize_theorem diff2_compose_matan;;
3534 let second_derivative_mul = Sections.finalize_theorem second_derivative_mul;;
3535 let second_derivative_div = Sections.finalize_theorem second_derivative_div;;
3536 let diff2_div = Sections.finalize_theorem diff2_div;;
3537 let second_derivative_scale = Sections.finalize_theorem second_derivative_scale;;
3538 let second_derivative_add = Sections.finalize_theorem second_derivative_add;;
3539 let second_derivative_sub = Sections.finalize_theorem second_derivative_sub;;
3540 let second_derivative_compose_bounds = Sections.finalize_theorem second_derivative_compose_bounds;;
3541 let second_derivative_abs_pos_bounds = Sections.finalize_theorem second_derivative_abs_pos_bounds;;
3542 let second_derivative_abs_neg_bounds = Sections.finalize_theorem second_derivative_abs_neg_bounds;;
3543 let second_derivative_compose_abs_pos_bounds = Sections.finalize_theorem second_derivative_compose_abs_pos_bounds;;
3544 let second_derivative_compose_abs_neg_bounds = Sections.finalize_theorem second_derivative_compose_abs_neg_bounds;;
3545 let second_derivative_pow_bounds = Sections.finalize_theorem second_derivative_pow_bounds;;
3546 let second_derivative_compose_pow_bounds = Sections.finalize_theorem second_derivative_compose_pow_bounds;;
3547 let second_derivative_pow2_bounds = Sections.finalize_theorem second_derivative_pow2_bounds;;
3548 let second_derivative_compose_pow2_bounds = Sections.finalize_theorem second_derivative_compose_pow2_bounds;;
3549 let second_derivative_pow3_bounds = Sections.finalize_theorem second_derivative_pow3_bounds;;
3550 let second_derivative_compose_pow3_bounds = Sections.finalize_theorem second_derivative_compose_pow3_bounds;;
3551 let second_derivative_atn_bounds = Sections.finalize_theorem second_derivative_atn_bounds;;
3552 let second_derivative_compose_atn_bounds = Sections.finalize_theorem second_derivative_compose_atn_bounds;;
3553 let second_derivative_cos_bounds = Sections.finalize_theorem second_derivative_cos_bounds;;
3554 let second_derivative_compose_cos_bounds = Sections.finalize_theorem second_derivative_compose_cos_bounds;;
3555 let second_derivative_sin_bounds = Sections.finalize_theorem second_derivative_sin_bounds;;
3556 let second_derivative_compose_sin_bounds = Sections.finalize_theorem second_derivative_compose_sin_bounds;;
3557 let second_derivative_exp_bounds = Sections.finalize_theorem second_derivative_exp_bounds;;
3558 let second_derivative_compose_exp_bounds = Sections.finalize_theorem second_derivative_compose_exp_bounds;;
3559 let second_derivative_log_bounds = Sections.finalize_theorem second_derivative_log_bounds;;
3560 let second_derivative_compose_log_bounds = Sections.finalize_theorem second_derivative_compose_log_bounds;;
3561 let second_derivative_inv_bounds = Sections.finalize_theorem second_derivative_inv_bounds;;
3562 let second_derivative_compose_inv_bounds = Sections.finalize_theorem second_derivative_compose_inv_bounds;;
3563 let second_derivative_sqrt_bounds = Sections.finalize_theorem second_derivative_sqrt_bounds;;
3564 let second_derivative_compose_sqrt_bounds = Sections.finalize_theorem second_derivative_compose_sqrt_bounds;;
3565 let second_derivative_acs_bounds = Sections.finalize_theorem second_derivative_acs_bounds;;
3566 let second_derivative_compose_acs_bounds = Sections.finalize_theorem second_derivative_compose_acs_bounds;;
3567 let second_derivative_asn_bounds = Sections.finalize_theorem second_derivative_asn_bounds;;
3568 let second_derivative_compose_asn_bounds = Sections.finalize_theorem second_derivative_compose_asn_bounds;;
3569 let interval_arith_gt = Sections.finalize_theorem interval_arith_gt;;
3570 let second_derivative_matan_bounds = Sections.finalize_theorem second_derivative_matan_bounds;;
3571 let second_derivative_compose_matan_bounds = Sections.finalize_theorem second_derivative_compose_matan_bounds;;
3572 let second_derivative_scale_bounds = Sections.finalize_theorem second_derivative_scale_bounds;;
3573 let second_derivative_add_bounds = Sections.finalize_theorem second_derivative_add_bounds;;
3574 let second_derivative_sub_bounds = Sections.finalize_theorem second_derivative_sub_bounds;;
3575 let second_derivative_mul_bounds = Sections.finalize_theorem second_derivative_mul_bounds;;
3576 let second_derivative_div_bounds = Sections.finalize_theorem second_derivative_div_bounds;;
3577 Sections.end_section "SecondDerivativeBound";;
3578
3579 (* Section TaylorArith *)
3580 Sections.begin_section "TaylorArith";;
3581 let cell_domain = new_definition `cell_domain x y z w <=>
3582 x <= y /\ y <= z /\ y - x <= w /\ z - y <= w`;;
3583
3584 (* Lemma taylor_x *)
3585 let taylor_x = Sections.section_proof ["x";"y";"z";"w"]
3586 `cell_domain x y z w ==>
3587 taylor_interval (\x. x) x y z w (y, y) (&1, &1) (&0, &0)`
3588 [
3589 ((((use_arg_then2 ("cell_domain", [cell_domain]))(thm_tac (new_rewrite [] [])))) THEN (move ["ineqs"]));
3590 ((((use_arg_then2 ("taylor_interval", [taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lin_approx_x", [lin_approx_x]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
3591 (((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] []))));
3592 (((((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_differentiable_eq", [nth_differentiable_eq]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
3593 ((BETA_TAC THEN (move ["p"]) THEN (move ["_"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real)`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("REAL_OPEN_UNIV", [REAL_OPEN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["q"]) THEN (simp_tac)));
3594 (((((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]));
3595 ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `i < 2 <=> i = 0 \/ i = 1`)))(thm_tac (new_rewrite [] [])))) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))));
3596 (((((use_arg_then2 ("nth_derivative0", [nth_derivative0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_derivative1", [nth_derivative1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_x", [derivative_x]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_ID", [HAS_REAL_DERIVATIVE_ID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3597 ((((use_arg_then2 ("nth_derivative1", [nth_derivative1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("TWO", [TWO]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_x", [derivative_x]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
3598 ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_CONST", [HAS_REAL_DERIVATIVE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
3599 ((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_x", [derivative_x]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
3600 (((repeat_tactic 1 9 (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3601 ];;
3602
3603 (* Lemma taylor_const *)
3604 let taylor_const = Sections.section_proof ["c";"x";"y";"z";"w"]
3605 `cell_domain x y z w ==>
3606 taylor_interval (\x. c) x y z w (c, c) (&0, &0) (&0, &0)`
3607 [
3608 ((((use_arg_then2 ("cell_domain", [cell_domain]))(thm_tac (new_rewrite [] [])))) THEN (move ["ineqs"]));
3609 ((((use_arg_then2 ("taylor_interval", [taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lin_approx_const", [lin_approx_const]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
3610 (((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] []))));
3611 (((((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_differentiable_eq", [nth_differentiable_eq]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
3612 ((BETA_TAC THEN (move ["p"]) THEN (move ["_"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real)`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("REAL_OPEN_UNIV", [REAL_OPEN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["q"]) THEN (simp_tac)));
3613 (((((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]));
3614 ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `i < 2 <=> i = 0 \/ i = 1`)))(thm_tac (new_rewrite [] [])))) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))));
3615 (((((use_arg_then2 ("nth_derivative0", [nth_derivative0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_derivative1", [nth_derivative1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_CONST", [HAS_REAL_DERIVATIVE_CONST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3616 (((((use_arg_then2 ("nth_derivative1", [nth_derivative1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("TWO", [TWO]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_CONST", [HAS_REAL_DERIVATIVE_CONST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3617 ((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
3618 (((repeat_tactic 1 9 (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3619 ];;
3620 (Sections.add_section_var (mk_var ("f", (`:real->real`))));;
3621 (Sections.add_section_var (mk_var ("x", (`:real`))); Sections.add_section_var (mk_var ("y", (`:real`))); Sections.add_section_var (mk_var ("z", (`:real`))); Sections.add_section_var (mk_var ("w", (`:real`))));;
3622 (Sections.add_section_var (mk_var ("f_bounds", (`:real#real`))); Sections.add_section_var (mk_var ("df_bounds", (`:real#real`))); Sections.add_section_var (mk_var ("dd_bounds", (`:real#real`))));;
3623 (Sections.add_section_var (mk_var ("f_lo", (`:real`))); Sections.add_section_var (mk_var ("f_hi", (`:real`))); Sections.add_section_var (mk_var ("df_lo", (`:real`))); Sections.add_section_var (mk_var ("df_hi", (`:real`))));;
3624
3625 (* Lemma taylor_f_bounds *)
3626 let taylor_f_bounds = Sections.section_proof ["df";"dd";"lo";"hi";"t"]
3627 `taylor_interval f x y z w (f_lo, f_hi) df_bounds dd_bounds ==>
3628 iabs df_bounds = df ==>
3629 iabs dd_bounds = dd ==>
3630 w * (df + w * dd * inv(&2)) <= t ==>
3631 f_hi + t <= hi ==> lo <= f_lo - t ==>
3632 bounded_on_int f (x, z) (lo, hi)`
3633 [
3634 (BETA_TAC THEN (move ["taylor_f"]) THEN (move ["iabs_df"]) THEN (move ["iabs_dd"]) THEN (move ["t_ineq"]) THEN (move ["hi_ineq"]) THEN (move ["lo_ineq"]));
3635 (((((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))))) THEN (move ["p"]) THEN (move ["ineq"]));
3636 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("taylor_upper_bound", [taylor_upper_bound])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("EQ_SYM", [EQ_SYM])) (fun fst_arg -> (use_arg_then2 ("iabs_dd", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("taylor_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("taylor_lower_bound", [taylor_lower_bound])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("EQ_SYM", [EQ_SYM])) (fun fst_arg -> (use_arg_then2 ("iabs_dd", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("taylor_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
3637 (((simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iabs_df", []))(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (move ["ineq1"]) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (move ["ineq2"]));
3638 ((((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then2 ("hi_ineq", [])) (disch_tac [])) THEN (clear_assumption "hi_ineq") THEN ((use_arg_then2 ("lo_ineq", [])) (disch_tac [])) THEN (clear_assumption "lo_ineq") THEN ((use_arg_then2 ("ineq2", [])) (disch_tac [])) THEN (clear_assumption "ineq2") THEN ((use_arg_then2 ("ineq1", [])) (disch_tac [])) THEN (clear_assumption "ineq1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
3639 ];;
3640
3641 (* Lemma taylor_df_bounds *)
3642 let taylor_df_bounds = Sections.section_proof ["dd";"lo";"hi"]
3643 `taylor_interval f x y z w f_bounds (df_lo, df_hi) dd_bounds ==>
3644 iabs dd_bounds = dd ==>
3645 df_hi + w * dd <= hi ==>
3646 lo <= df_lo - w * dd ==>
3647 bounded_on_int (derivative f) (x, z) (lo, hi)`
3648 [
3649 (BETA_TAC THEN (move ["taylor_f"]) THEN (move ["iabs_dd"]) THEN (move ["hi_ineq"]) THEN (move ["lo_ineq"]));
3650 (((((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))))) THEN (move ["p"]) THEN (move ["ineq"]));
3651 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("taylor_derivative_lower_bound", [taylor_derivative_lower_bound])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("EQ_SYM", [EQ_SYM])) (fun fst_arg -> (use_arg_then2 ("iabs_dd", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("taylor_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
3652 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("taylor_derivative_upper_bound", [taylor_derivative_upper_bound])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("EQ_SYM", [EQ_SYM])) (fun fst_arg -> (use_arg_then2 ("iabs_dd", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("taylor_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
3653 ((((use_arg_then2 ("hi_ineq", [])) (disch_tac [])) THEN (clear_assumption "hi_ineq") THEN ((use_arg_then2 ("lo_ineq", [])) (disch_tac [])) THEN (clear_assumption "lo_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
3654 ];;
3655
3656 (* Lemma bounded_on_int_compose *)
3657 let bounded_on_int_compose = Sections.section_proof ["g";"int";"g_bounds"]
3658 `bounded_on_int g int g_bounds ==>
3659 bounded_on_int f g_bounds f_bounds ==>
3660 bounded_on_int (\x. f (g x)) int f_bounds`
3661 [
3662 ((repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] []))))) THEN (move ["g_bounded"]) THEN (move ["f_bounded"]) THEN (move ["x"]) THEN (move ["ineq"]) THEN (simp_tac));
3663 (((((use_arg_then2 ("f_bounded", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("g_bounded", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3664 ];;
3665
3666 (* Lemma bounded_on_int_imp_interval_arith *)
3667 let bounded_on_int_imp_interval_arith = Sections.section_proof ["int"]
3668 `bounded_on_int f int f_bounds ==>
3669 interval_arith y int ==> interval_arith (f y) f_bounds`
3670 [
3671 ((((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (move ["bounded_f"]) THEN (move ["int_y"]));
3672 ((((use_arg_then2 ("bounded_f", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
3673 ];;
3674
3675 (* Lemma taylor_interval_narrow *)
3676 let taylor_interval_narrow = Sections.section_proof ["x0";"z0";"w0"]
3677 `taylor_interval f x y z w f_bounds df_bounds dd_bounds ==>
3678 cell_domain x0 y z0 w0 ==>
3679 x <= x0 ==> z0 <= z ==>
3680 taylor_interval f x0 y z0 w0 f_bounds df_bounds dd_bounds`
3681 [
3682 (((repeat_tactic 1 9 (((use_arg_then2 ("taylor_interval", [taylor_interval]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cell_domain", [cell_domain]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbA", [andbA]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ((case THEN ((move ["ineq"]) THEN (move ["lin"]))) THEN (move ["dd"]))) THEN (move ["c"]) THEN (move ["i1"]) THEN (move ["i2"]));
3683 ((THENL_FIRST) (((((use_arg_then2 ("lin", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)) ((((use_arg_then2 ("i2", [])) (disch_tac [])) THEN (clear_assumption "i2") THEN ((use_arg_then2 ("i1", [])) (disch_tac [])) THEN (clear_assumption "i1") THEN ((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
3684 ((((use_arg_then2 ("dd", [])) (disch_tac [])) THEN (clear_assumption "dd") THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("has_bounded_second_derivative", [has_bounded_second_derivative]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounded_on_int", [bounded_on_int]))(thm_tac (new_rewrite [] [])))))) THEN (move ["df"])));
3685 ((split_tac) THEN (move ["p"]) THEN (move ["int_p"]));
3686 ((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i2", [])) (disch_tac [])) THEN (clear_assumption "i2") THEN ((use_arg_then2 ("i1", [])) (disch_tac [])) THEN (clear_assumption "i1") THEN ((use_arg_then2 ("int_p", [])) (disch_tac [])) THEN (clear_assumption "int_p") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL interval_arith)))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
3687 ((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i2", [])) (disch_tac [])) THEN (clear_assumption "i2") THEN ((use_arg_then2 ("i1", [])) (disch_tac [])) THEN (clear_assumption "i1") THEN ((use_arg_then2 ("int_p", [])) (disch_tac [])) THEN (clear_assumption "int_p") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL interval_arith)))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
3688 ];;
3689
3690 (* Finalization of the section TaylorArith *)
3691 let taylor_x = Sections.finalize_theorem taylor_x;;
3692 let taylor_const = Sections.finalize_theorem taylor_const;;
3693 let taylor_f_bounds = Sections.finalize_theorem taylor_f_bounds;;
3694 let taylor_df_bounds = Sections.finalize_theorem taylor_df_bounds;;
3695 let bounded_on_int_compose = Sections.finalize_theorem bounded_on_int_compose;;
3696 let bounded_on_int_imp_interval_arith = Sections.finalize_theorem bounded_on_int_imp_interval_arith;;
3697 let taylor_interval_narrow = Sections.finalize_theorem taylor_interval_narrow;;
3698 Sections.end_section "TaylorArith";;
3699
3700 (* Close the module *)
3701 end;;