Debian Codegraph @

Formal_ineqs/taylor/theory/multivariate_taylor-compiled.hl

raw
1 needs "Formal_ineqs/lib/ssrbool.hl";;
2 needs "Formal_ineqs/lib/ssrnat.hl";;
3 needs "Formal_ineqs/taylor/theory/taylor_interval-compiled.hl";;
4
5 (* Module Multivariate_taylor*)
6 module Multivariate_taylor = struct
7
8 open Ssreflect;;
9 open Ssrfun;;
10 open Ssrbool;;
11 open Ssrnat;;
12 open Taylor_interval;;
13 open Interval_arith;;
14 prioritize_overload `:real^N`;;
15 prioritize_real();;
16 let IMAGE_DELETE_INJ_COMPAT = prove
17 (`!f s a. (!x. f(x) = f(a) ==> x = a)
18 ==> (IMAGE f (s DELETE a) = (IMAGE f s) DELETE (f a))`,
19 SET_TAC[]);;
20 let partial = new_definition `partial i f x = derivative (f o (\t. (x:real^N) + t % basis i)) (&0)`;;
21 let all_n = define `(all_n n [] s <=> T) /\ (all_n n (CONS h t) s <=> s n h /\ all_n (SUC n) t s)`;;
22 let m_lin_approx = new_definition `m_lin_approx (f:real^N->real) x f_bounds df_bounds_list <=>
23 (lift o f) differentiable at x /\
24 interval_arith (f x) f_bounds /\
25 all_n 1 df_bounds_list (\i int. interval_arith (partial i f x) int)`;;
26
27 (* Section Misc *)
28 Sections.begin_section "Misc";;
29
30 (* Lemma f_lift_neg *)
31 let f_lift_neg = Sections.section_proof ["f"]
32 `lift o (\x. --f x) = (\x. --(lift o f) x)`
33 [
34 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("LIFT_NEG", [LIFT_NEG]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
35 ];;
36
37 (* Lemma f_lift_scale *)
38 let f_lift_scale = Sections.section_proof ["f";"c"]
39 `lift o (\x. c * f x) = (\x. c % (lift o f) x)`
40 [
41 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("LIFT_CMUL", [LIFT_CMUL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
42 ];;
43
44 (* Lemma f_lift_add *)
45 let f_lift_add = Sections.section_proof ["f";"g"]
46 `lift o (\x. f x + g x) = (\x. (lift o f) x + (lift o g) x)`
47 [
48 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("LIFT_ADD", [LIFT_ADD]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
49 ];;
50
51 (* Lemma f_lift_sub *)
52 let f_lift_sub = Sections.section_proof ["f";"g"]
53 `lift o (\x. f x - g x) = (\x. (lift o f) x - (lift o g) x)`
54 [
55 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("LIFT_SUB", [LIFT_SUB]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
56 ];;
57
58 (* Lemma f_binary_drop *)
59 let f_binary_drop = Sections.section_proof ["op";"f";"g"]
60 `(\t. op (f t) (g t)) o drop = (\x. op (f (drop x)) (g (drop x)))`
61 [
62 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
63 ];;
64
65 (* Lemma f_unary_drop *)
66 let f_unary_drop = Sections.section_proof ["op";"f"]
67 `(\t. op (f t)) o drop = (\x. op (f (drop x)))`
68 [
69 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
70 ];;
71
72 (* Section MoreFrechet *)
73 Sections.begin_section "MoreFrechet";;
74 (Sections.add_section_var (mk_var ("f", (`:real^N -> real^M`))); Sections.add_section_var (mk_var ("g", (`:real^N -> real^M`))));;
75 (Sections.add_section_var (mk_var ("x", (`:real^N`))); Sections.add_section_var (mk_var ("y", (`:real^N`))));;
76
77 (* Lemma frechet_compose *)
78 let frechet_compose = Sections.section_proof ["f";"g";"x"]
79 `f differentiable at (g x) ==>
80 g differentiable at x ==>
81 frechet_derivative (f o g) (at x) = frechet_derivative f (at (g x)) o frechet_derivative g (at x)`
82 [
83 ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)));
84 (((use_arg_then2 ("DIFF_CHAIN_AT", [DIFF_CHAIN_AT])) (thm_tac apply_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
85 ];;
86
87 (* Lemma frechet_const *)
88 let frechet_const = Sections.section_proof ["z"]
89 `frechet_derivative (\x. y) (at z) = (\x. vec 0)`
90 [
91 ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("HAS_DERIVATIVE_CONST", [HAS_DERIVATIVE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
92 ];;
93
94 (* Lemma frechet_id *)
95 let frechet_id = Sections.section_proof []
96 `frechet_derivative (\x. x) (at y) = (\x. x)`
97 [
98 ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("HAS_DERIVATIVE_ID", [HAS_DERIVATIVE_ID]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
99 ];;
100
101 (* Lemma frechet_vmul *)
102 let frechet_vmul = Sections.section_proof ["z"]
103 `frechet_derivative (\x. drop x % y) (at z) = (\x. drop x % y)`
104 [
105 ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("HAS_DERIVATIVE_VMUL_DROP", [HAS_DERIVATIVE_VMUL_DROP])) (thm_tac apply_tac)));
106 (((use_arg_then2 ("HAS_DERIVATIVE_ID", [HAS_DERIVATIVE_ID]))(thm_tac (new_rewrite [] []))));
107 ];;
108 (Sections.add_section_hyp "df" (`f differentiable at x`));;
109
110 (* Lemma frechet_neg *)
111 let frechet_neg = Sections.section_proof []
112 `frechet_derivative (\x. --f x) (at x) = (\y. --frechet_derivative f (at x) y)`
113 [
114 ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("HAS_DERIVATIVE_NEG", [HAS_DERIVATIVE_NEG])) (thm_tac apply_tac)));
115 ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac));
116 ];;
117
118 (* Lemma frechet_scale *)
119 let frechet_scale = Sections.section_proof ["c"]
120 `frechet_derivative (\x. c % f x) (at x) = (\y. c % frechet_derivative f (at x) y)`
121 [
122 ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("HAS_DERIVATIVE_CMUL", [HAS_DERIVATIVE_CMUL])) (thm_tac apply_tac)));
123 ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac));
124 ];;
125 (Sections.add_section_hyp "dg" (`g differentiable at x`));;
126
127 (* Lemma frechet_add *)
128 let frechet_add = Sections.section_proof []
129 `frechet_derivative (\x. f x + g x) (at x) =
130 (\y. frechet_derivative f (at x) y + frechet_derivative g (at x) y)`
131 [
132 ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("HAS_DERIVATIVE_ADD", [HAS_DERIVATIVE_ADD])) (thm_tac apply_tac)));
133 ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
134 ];;
135
136 (* Lemma frechet_sub *)
137 let frechet_sub = Sections.section_proof []
138 `frechet_derivative (\x. f x - g x) (at x) =
139 (\y. frechet_derivative f (at x) y - frechet_derivative g (at x) y)`
140 [
141 ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("HAS_DERIVATIVE_SUB", [HAS_DERIVATIVE_SUB])) (thm_tac apply_tac)));
142 ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
143 ];;
144
145 (* Finalization of the section MoreFrechet *)
146 let frechet_compose = Sections.finalize_theorem frechet_compose;;
147 let frechet_const = Sections.finalize_theorem frechet_const;;
148 let frechet_id = Sections.finalize_theorem frechet_id;;
149 let frechet_vmul = Sections.finalize_theorem frechet_vmul;;
150 let frechet_neg = Sections.finalize_theorem frechet_neg;;
151 let frechet_scale = Sections.finalize_theorem frechet_scale;;
152 let frechet_add = Sections.finalize_theorem frechet_add;;
153 let frechet_sub = Sections.finalize_theorem frechet_sub;;
154 Sections.end_section "MoreFrechet";;
155
156 (* Lemma differentiable_compose_at *)
157 let differentiable_compose_at = Sections.section_proof ["f";"g";"x"]
158 `f differentiable at (g x) ==>
159 g differentiable at x ==>
160 (f o g) differentiable at x`
161 [
162 ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])) THEN (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(thm_tac (new_rewrite [] [])))));
163 (((((use_arg_then2 ("frechet_compose", [frechet_compose]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((use_arg_then2 ("DIFF_CHAIN_AT", [DIFF_CHAIN_AT])) (thm_tac apply_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
164 ];;
165
166 (* Lemma jacobian_compose *)
167 let jacobian_compose = Sections.section_proof ["f";"g";"x"]
168 `f differentiable at (g x) ==>
169 g differentiable at x ==>
170 jacobian (f o g) (at x) = jacobian f (at (g x)) ** jacobian g (at x)`
171 [
172 (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]));
173 (((repeat_tactic 1 9 (((use_arg_then2 ("jacobian", [jacobian]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("frechet_compose", [frechet_compose]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("MATRIX_COMPOSE", [MATRIX_COMPOSE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LINEAR_FRECHET_DERIVATIVE", [LINEAR_FRECHET_DERIVATIVE]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
174 ];;
175
176 (* Lemma frechet_eq_jacobian *)
177 let frechet_eq_jacobian = Sections.section_proof ["f";"x"]
178 `f differentiable at x ==>
179 frechet_derivative f (at x) = (\h. jacobian f (at x) ** h)`
180 [
181 (BETA_TAC THEN (move ["df"]));
182 (((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("JACOBIAN_WORKS", [JACOBIAN_WORKS]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
183 ];;
184
185 (* Section Product *)
186 Sections.begin_section "Product";;
187
188 (* Lemma REAL_LET_MUL2 *)
189 let REAL_LET_MUL2 = Sections.section_proof ["w";"x";"y";"z"]
190 `&0 < w /\ w <= x /\ &0 <= y /\ y < z ==> w * y < x * z`
191 [
192 (BETA_TAC THEN (move ["ineq"]));
193 ((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`w = x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(move ["w_eq_x"]); (move ["wnx"])]);
194 (((((use_arg_then2 ("w_eq_x", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LT_LMUL", [REAL_LT_LMUL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
195 ((((use_arg_then2 ("REAL_LT_MUL2", [REAL_LT_MUL2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("wnx", [])) (disch_tac [])) THEN (clear_assumption "wnx") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
196 ];;
197
198 (* Lemma has_derivative_x12 *)
199 let has_derivative_x12 = Sections.section_proof ["y"]
200 `(lift o (\x:real^2. x$1 * x$2) has_derivative lift o (\x. y$2 * x$1 + y$1 * x$2)) (at y)`
201 [
202 ((((use_arg_then2 ("has_derivative_at", [has_derivative_at]))(thm_tac (new_rewrite [] [])))) THEN (split_tac));
203 ((((use_arg_then2 ("linear", [linear]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_ADD", [LIFT_ADD]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_CMUL", [LIFT_CMUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_ADD", [LIFT_ADD]))(thm_tac (new_rewrite [] []))))));
204 ((VECTOR_ARITH_TAC) THEN (done_tac));
205 ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("LIFT_ADD", [LIFT_ADD]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LIFT_SUB", [LIFT_SUB]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LIFT_CMUL", [LIFT_CMUL]))(gsym_then (thm_tac (new_rewrite [] []))))));
206 (((((use_arg_then2 ("LIM_AT", [LIM_AT]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_RZERO)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_LIFT", [NORM_LIFT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] [])))))) THEN (move ["e"]) THEN (move ["e0"]));
207 (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `(x:real^2)$1 * x$2 - ((y:real^2)$1 * y$2 + y$2 * (x$1 - y$1) + y$1 * (x$2 - y$2)) =
208 (x$2 - y$2) * (x$1 - y$1)`)))(thm_tac (new_rewrite [] []))));
209 (((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("e0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN ((move ["norm0"]) THEN (move ["norm_e"])))));
210 ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_ABS_MUL", [REAL_ABS_MUL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ABS_INV", [REAL_ABS_INV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_NORM", [REAL_ABS_NORM]))(thm_tac (new_rewrite [] [])))));
211 ((repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`x - y:real^2`))) (term_tac (set_tac "p"))));
212 ((fun arg_tac -> (use_arg_then2 ("NORM_BOUND_COMPONENT_LT", [NORM_BOUND_COMPONENT_LT])) (fun fst_arg -> (use_arg_then2 ("norm_e", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["ineq"])));
213 ((((use_arg_then2 ("REAL_LTE_TRANS", [REAL_LTE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LTE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`inv (infnorm p) * infnorm p * e`))) (term_tac exists_tac)));
214 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < infnorm p`))) (term_tac (have_gen_tac [](move ["infnorm_0"])))) (((((use_arg_then2 ("INFNORM_POS_LT", [INFNORM_POS_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_POS_LT", [NORM_POS_LT]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)));
215 ((THENL_ROT (-1)) (split_tac));
216 (((((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV]))(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_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("INFNORM_EQ_0", [INFNORM_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_POS_LT", [NORM_POS_LT]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
217 ((((use_arg_then2 ("REAL_LET_MUL2", [REAL_LET_MUL2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_INV", [REAL_LT_INV]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LE_INV2", [REAL_LE_INV2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("INFNORM_LE_NORM", [INFNORM_LE_NORM]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
218 ((((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
219 ((fun arg_tac -> arg_tac (Arg_term (`infnorm p = abs (p$1) \/ infnorm p = abs (p$2)`))) (term_tac (have_gen_tac []ALL_TAC)));
220 ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL INFNORM_2)))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac));
221 (((THENL_FIRST) (case THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("REAL_LT_LMUL", [REAL_LT_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DIMINDEX_2", [DIMINDEX_2]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
222 ];;
223
224 (* Lemma lambda_eq_vsum *)
225 let lambda_eq_vsum = Sections.section_proof ["f"]
226 `(\x:A. lambda i. f i x) =
227 (\x. vsum (1..dimindex (:N)) (\i. f i x % (basis i:real^N)))`
228 [
229 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["x"]));
230 (((((use_arg_then2 ("CART_EQ", [CART_EQ]))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["ineq"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("VSUM_COMPONENT", [VSUM_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))));
231 (((fun arg_tac -> arg_tac (Arg_term (`1.. _`))) (term_tac (set_tac "A"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`A DIFF {i}`))) (term_tac (set_tac "B"))));
232 ((fun arg_tac -> arg_tac (Arg_term (`DISJOINT B {i} /\ A = B UNION {i}`))) (term_tac (have_gen_tac [](move ["cond"]))));
233 ((((use_arg_then2 ("DISJOINT", [DISJOINT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("B_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("A_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
234 ((THENL_FIRST) ((split_tac) THEN (move ["x"])) (((repeat_tactic 1 9 (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbA", [orbA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
235 ((((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))));
236 ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x = i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((simp_tac) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
237 ((((use_arg_then2 ("cond", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_UNION", [SUM_UNION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("cond", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("B_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_DIFF", [FINITE_DIFF]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("A_def", []))(gsym_then (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 ("FINITE_SING", [FINITE_SING]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
238 ((((use_arg_then2 ("SUM_SING", [SUM_SING]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
239 (((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b. a = b + a * &1 <=> b = &0`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_EQ_0", [SUM_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["j"]));
240 ((((((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["ineq_j"]) THEN (simp_tac)) THEN ((((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))));
241 (((((use_arg_then2 ("ineq_j", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
242 ];;
243
244 (* Lemma has_derivative_lambda *)
245 let has_derivative_lambda = Sections.section_proof ["f";"f'";"y"]
246 `(!i. i IN 1..dimindex (:M) ==> (lift o (f i) has_derivative lift o (f' i)) (at (y:real^N))) ==>
247 (((\x. lambda i. f i x):real^N->real^M) has_derivative (\x. lambda i. f' i x) ) (at y)`
248 [
249 ((BETA_TAC THEN (move ["df"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("lambda_eq_vsum", [lambda_eq_vsum]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("HAS_DERIVATIVE_VSUM", [HAS_DERIVATIVE_VSUM])) (thm_tac apply_tac)));
250 (((((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac));
251 ((fun arg_tac -> arg_tac (Arg_term (`!f. (\x:real^N. f i x % (basis i:real^M)) = (\x. drop ((lift o f i) x) % basis i)`))) (term_tac (have_gen_tac [](move ["eq"]))));
252 ((BETA_TAC THEN (move ["g"])) THEN ((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
253 (((((fun arg_tac -> (use_arg_then2 ("eq", [])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq", [])) (fun fst_arg -> (use_arg_then2 ("f'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_DERIVATIVE_VMUL_DROP)))(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 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
254 ];;
255
256 (* Lemma vector2_eq_lambda *)
257 let vector2_eq_lambda = Sections.section_proof ["x";"y"]
258 `(vector [x; y]:real^2) = (lambda i. if i = 1 then x else y)`
259 [
260 ((((((use_arg_then2 ("CART_EQ", [CART_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIMINDEX_2", [DIMINDEX_2]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`)))(thm_tac (new_rewrite [] [])))));
261 ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [1; 3] []))))) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_2)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_2", [DIMINDEX_2]))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac));
262 ];;
263
264 (* Lemma has_derivative_vector2 *)
265 let has_derivative_vector2 = Sections.section_proof ["f";"g";"f'";"g'";"y"]
266 `(lift o f has_derivative lift o f') (at y) ==>
267 (lift o g has_derivative lift o g') (at y) ==>
268 ((\x. vector [f x; g x]:real^2) has_derivative (\x. vector [f' x; g' x]:real^2)) (at y)`
269 [
270 ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("vector2_eq_lambda", [vector2_eq_lambda]))(thm_tac (new_rewrite [] []))))));
271 (((use_arg_then2 ("has_derivative_lambda", [has_derivative_lambda])) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("DIMINDEX_2", [DIMINDEX_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"])));
272 ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`)))(thm_tac (new_rewrite [] [])))) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [2; 4] [])))) THEN (simp_tac)) THEN ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))));
273 (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `~(2 = 1)`)))(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));
274 ];;
275
276 (* Lemma has_derivative_mul *)
277 let has_derivative_mul = Sections.section_proof ["f";"g";"f'";"g'";"y"]
278 `(lift o f has_derivative lift o f') (at y) ==>
279 (lift o g has_derivative lift o g') (at y) ==>
280 (lift o (\x. f x * g x) has_derivative lift o (\x. f' x * g y + f y * g' x)) (at y)`
281 [
282 (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]));
283 ((fun arg_tac -> arg_tac (Arg_term (`lift o (\x. f x * g x) = (lift o (\p. p$1 * p$2)) o (\x. vector [f x; g x]:real^2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
284 ((((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["x"])) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_2)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
285 ((fun arg_tac -> arg_tac (Arg_term (`vector [f y; g y]:real^2`))) (term_tac (set_tac "q")));
286 ((fun arg_tac -> arg_tac (Arg_term (`lift o (\x. f' x * g y + f y * g' x) =
287 (lift o (\x:real^2. q$2 * x$1 + q$1 * x$2)) o (\x. vector [f' x; g' x])`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
288 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("q_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_2)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
289 ((((use_arg_then2 ("DIFF_CHAIN_AT", [DIFF_CHAIN_AT])) (thm_tac apply_tac)) THEN (simp_tac)) THEN ((((use_arg_then2 ("q_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_derivative_x12", [has_derivative_x12]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_derivative_vector2", [has_derivative_vector2]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
290 ];;
291
292 (* Lemma f_eq_lift_drop *)
293 let f_eq_lift_drop = Sections.section_proof ["f"]
294 `f = lift o (drop o f)`
295 [
296 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (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 (done_tac));
297 ];;
298
299 (* Lemma differentiable_mul *)
300 let differentiable_mul = Sections.section_proof ["f";"g";"y"]
301 `lift o f differentiable (at y) ==>
302 lift o g differentiable (at y) ==>
303 lift o (\x. f x * g x) differentiable (at y)`
304 [
305 ((repeat_tactic 2 0 (((use_arg_then2 ("differentiable", [differentiable]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["f'"])) THEN (move ["df"]) THEN (case THEN (move ["g'"])) THEN (move ["dg"]));
306 ((((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 (((((fun arg_tac -> (use_arg_then2 ("f_eq_lift_drop", [f_eq_lift_drop])) (fun fst_arg -> (use_arg_then2 ("f'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("f_eq_lift_drop", [f_eq_lift_drop])) (fun fst_arg -> (use_arg_then2 ("g'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (move ["df"]) THEN (move ["dg"])));
307 ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("has_derivative_mul", [has_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 arg -> thm_tac MP_TAC arg THEN ALL_TAC));
308 (((use_arg_then2 ("HAS_DERIVATIVE_IMP_DIFFERENTIABLE", [HAS_DERIVATIVE_IMP_DIFFERENTIABLE])) (thm_tac apply_tac)) THEN (done_tac));
309 ];;
310
311 (* Lemma frechet_mul *)
312 let frechet_mul = Sections.section_proof ["f";"g";"y"]
313 `lift o f differentiable at y ==>
314 lift o g differentiable at y ==>
315 frechet_derivative (lift o (\x. f x * g x)) (at y) =
316 (\x. g y % frechet_derivative (lift o f) (at y) x +
317 f y % frechet_derivative (lift o g) (at y) x)`
318 [
319 (((repeat_tactic 1 9 (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq_lift_drop", [f_eq_lift_drop]))(thm_tac (new_rewrite [] [(`frechet_derivative _1 _2`)]))))) THEN (move ["df"]));
320 ((((use_arg_then2 ("f_eq_lift_drop", [f_eq_lift_drop]))(thm_tac (new_rewrite [] [(`frechet_derivative _1 _2`)])))) THEN (move ["dg"]));
321 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("has_derivative_mul", [has_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 arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))));
322 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] [])))))) THEN (move ["x"]));
323 (((((use_arg_then2 ("LIFT_ADD", [LIFT_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_CMUL", [LIFT_CMUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
324 ];;
325
326 (* Finalization of the section Product *)
327 let REAL_LET_MUL2 = Sections.finalize_theorem REAL_LET_MUL2;;
328 let has_derivative_x12 = Sections.finalize_theorem has_derivative_x12;;
329 let lambda_eq_vsum = Sections.finalize_theorem lambda_eq_vsum;;
330 let has_derivative_lambda = Sections.finalize_theorem has_derivative_lambda;;
331 let vector2_eq_lambda = Sections.finalize_theorem vector2_eq_lambda;;
332 let has_derivative_vector2 = Sections.finalize_theorem has_derivative_vector2;;
333 let has_derivative_mul = Sections.finalize_theorem has_derivative_mul;;
334 let f_eq_lift_drop = Sections.finalize_theorem f_eq_lift_drop;;
335 let differentiable_mul = Sections.finalize_theorem differentiable_mul;;
336 let frechet_mul = Sections.finalize_theorem frechet_mul;;
337 Sections.end_section "Product";;
338
339 (* Finalization of the section Misc *)
340 let f_lift_neg = Sections.finalize_theorem f_lift_neg;;
341 let f_lift_scale = Sections.finalize_theorem f_lift_scale;;
342 let f_lift_add = Sections.finalize_theorem f_lift_add;;
343 let f_lift_sub = Sections.finalize_theorem f_lift_sub;;
344 let f_binary_drop = Sections.finalize_theorem f_binary_drop;;
345 let f_unary_drop = Sections.finalize_theorem f_unary_drop;;
346 let frechet_compose = Sections.finalize_theorem frechet_compose;;
347 let frechet_const = Sections.finalize_theorem frechet_const;;
348 let frechet_id = Sections.finalize_theorem frechet_id;;
349 let frechet_vmul = Sections.finalize_theorem frechet_vmul;;
350 let frechet_neg = Sections.finalize_theorem frechet_neg;;
351 let frechet_scale = Sections.finalize_theorem frechet_scale;;
352 let frechet_add = Sections.finalize_theorem frechet_add;;
353 let frechet_sub = Sections.finalize_theorem frechet_sub;;
354 let differentiable_compose_at = Sections.finalize_theorem differentiable_compose_at;;
355 let jacobian_compose = Sections.finalize_theorem jacobian_compose;;
356 let frechet_eq_jacobian = Sections.finalize_theorem frechet_eq_jacobian;;
357 let REAL_LET_MUL2 = Sections.finalize_theorem REAL_LET_MUL2;;
358 let has_derivative_x12 = Sections.finalize_theorem has_derivative_x12;;
359 let lambda_eq_vsum = Sections.finalize_theorem lambda_eq_vsum;;
360 let has_derivative_lambda = Sections.finalize_theorem has_derivative_lambda;;
361 let vector2_eq_lambda = Sections.finalize_theorem vector2_eq_lambda;;
362 let has_derivative_vector2 = Sections.finalize_theorem has_derivative_vector2;;
363 let has_derivative_mul = Sections.finalize_theorem has_derivative_mul;;
364 let f_eq_lift_drop = Sections.finalize_theorem f_eq_lift_drop;;
365 let differentiable_mul = Sections.finalize_theorem differentiable_mul;;
366 let frechet_mul = Sections.finalize_theorem frechet_mul;;
367 Sections.end_section "Misc";;
368
369 (* Section Partial *)
370 Sections.begin_section "Partial";;
371
372 (* Lemma real_derivative_compose_frechet *)
373 let real_derivative_compose_frechet = Sections.section_proof ["f";"h";"t"]
374 `(lift o f) differentiable at (h t) ==>
375 (h o drop) differentiable at (lift t) ==>
376 ((f o h) has_real_derivative (drop o (frechet_derivative (lift o f) (at (h t)) o
377 frechet_derivative (h o drop) (at (lift t))) o lift) (&1)) (atreal t)`
378 [
379 (BETA_TAC THEN (move ["diff_f"]) THEN (move ["diff_h"]));
380 ((((use_arg_then2 ("diff_h", [])) (disch_tac [])) THEN ((use_arg_then2 ("diff_f", [])) (disch_tac [])) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(thm_tac (new_rewrite [] []))))));
381 ((fun arg_tac -> arg_tac (Arg_term (`frechet_derivative _1 _2`))) (term_tac (set_tac "f'")));
382 ((fun arg_tac -> arg_tac (Arg_term (`frechet_derivative _1 _2`))) (term_tac (set_tac "h'")));
383 (BETA_TAC THEN (move ["df"]) THEN (move ["dh"]));
384 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_REAL_FRECHET_DERIVATIVE_AT)))(thm_tac (new_rewrite [] []))));
385 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`lift o (f o h) o drop = (lift o f) o (h o drop)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((repeat_tactic 1 9 (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
386 (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`(\x. (drop o (f' o h') o lift) (&1) % x) = f' o h'`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))));
387 (((((use_arg_then2 ("DIFF_CHAIN_AT", [DIFF_CHAIN_AT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dh", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
388 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (move ["x"]) THEN (simp_tac));
389 ((fun arg_tac -> arg_tac (Arg_term (`linear f' /\ linear h'`))) (term_tac (have_gen_tac [](move ["lin"]))));
390 (((((use_arg_then2 ("h'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LINEAR_FRECHET_DERIVATIVE", [LINEAR_FRECHET_DERIVATIVE]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
391 ((fun arg_tac -> arg_tac (Arg_term (`x = drop x % lift (&1)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [2] [])))))));
392 (((((use_arg_then2 ("DROP_EQ", [DROP_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DROP_CMUL", [DROP_CMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
393 (((repeat_tactic 1 9 (((use_arg_then2 ("LINEAR_CMUL", [LINEAR_CMUL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DROP_EQ", [DROP_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DROP_CMUL", [DROP_CMUL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
394 ];;
395
396 (* Lemma real_derivative_compose_jacobian *)
397 let real_derivative_compose_jacobian = Sections.section_proof ["f";"h";"t"]
398 `(lift o f) differentiable at (h t) ==>
399 (h o drop) differentiable at (lift t) ==>
400 ((f o h) has_real_derivative (jacobian (lift o f) (at (h t)) **
401 jacobian (h o drop) (at (lift t)))$1$1) (atreal t)`
402 [
403 (BETA_TAC THEN (move ["df"]) THEN (move ["dh"]));
404 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_derivative_compose_frechet", [real_derivative_compose_frechet])) (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 ("dh", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
405 ((repeat_tactic 1 9 (((use_arg_then2 ("frechet_eq_jacobian", [frechet_eq_jacobian]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac));
406 ((((use_arg_then2 ("MATRIX_VECTOR_MUL_ASSOC", [MATRIX_VECTOR_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("matrix_vector_mul", [matrix_vector_mul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DROP_LAMBDA", [DROP_LAMBDA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIMINDEX_1", [DIMINDEX_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_SING_NUMSEG", [SUM_SING_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
407 (((((use_arg_then2 ("LIFT_COMPONENT", [LIFT_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
408 ];;
409
410 (* Lemma diff_imp_real_diff *)
411 let diff_imp_real_diff = Sections.section_proof ["f";"h";"t"]
412 `(lift o f) differentiable at (h t) ==>
413 (h o drop) differentiable at (lift t) ==>
414 (f o h) real_differentiable atreal t`
415 [
416 (BETA_TAC THEN (move ["diff_f"]) THEN (move ["diff_h"]));
417 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_derivative_compose_frechet", [real_derivative_compose_frechet])) (fun fst_arg -> (use_arg_then2 ("diff_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("diff_h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
418 ((fun arg_tac -> arg_tac (Arg_term (`(drop o _ o lift) (&1)`))) (term_tac (set_tac "fh'")));
419 (((((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] [])))) THEN (move ["dfh"])) THEN ((use_arg_then2 ("fh'", [])) (term_tac exists_tac)) THEN (done_tac));
420 ];;
421
422 (* Lemma diff_direction *)
423 let diff_direction = Sections.section_proof ["y";"e";"net"]
424 `((\t. y + t % e) o drop) differentiable net`
425 [
426 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(\t. y + t % e) o drop = (\x. y + drop x % e)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((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 (done_tac)));
427 ((((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
428 ((use_arg_then2 ("HAS_DERIVATIVE_IMP_DIFFERENTIABLE", [HAS_DERIVATIVE_IMP_DIFFERENTIABLE])) (thm_tac apply_tac));
429 (((fun arg_tac -> arg_tac (Arg_term (`\x. drop x % e`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("HAS_DERIVATIVE_VMUL_DROP", [HAS_DERIVATIVE_VMUL_DROP])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("HAS_DERIVATIVE_ID", [HAS_DERIVATIVE_ID]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
430 ];;
431
432 (* Lemma frechet_direction *)
433 let frechet_direction = Sections.section_proof ["y";"e";"t"]
434 `frechet_derivative ((\t. y + t % e) o drop) (at (lift t)) = (\x. drop x % e)`
435 [
436 ((((use_arg_then2 ("f_unary_drop", [f_unary_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("frechet_add", [frechet_add]))(thm_tac (new_rewrite [] [])))));
437 (((((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("HAS_DERIVATIVE_IMP_DIFFERENTIABLE", [HAS_DERIVATIVE_IMP_DIFFERENTIABLE])) (thm_tac apply_tac)));
438 (((fun arg_tac -> arg_tac (Arg_term (`\x. drop x % e`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("HAS_DERIVATIVE_VMUL_DROP", [HAS_DERIVATIVE_VMUL_DROP])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("HAS_DERIVATIVE_ID", [HAS_DERIVATIVE_ID]))(thm_tac (new_rewrite [] [])))));
439 (((((use_arg_then2 ("frechet_vmul", [frechet_vmul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("frechet_const", [frechet_const]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_ADD_LID", [VECTOR_ADD_LID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
440 ];;
441
442 (* Lemma real_dir_derivative_frechet *)
443 let real_dir_derivative_frechet = Sections.section_proof ["f";"y";"e";"t"]
444 `(lift o f) differentiable at (y + t % e) ==>
445 ((f o (\t. y + t % e)) has_real_derivative
446 (drop (frechet_derivative (lift o f) (at (y + t % e)) e))) (atreal t)`
447 [
448 (BETA_TAC THEN (move ["df"]));
449 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_derivative_compose_frechet", [real_derivative_compose_frechet])) (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 (`\t. y + t % e`))) (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))) (disch_tac [])) THEN BETA_TAC);
450 (((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff_direction", [diff_direction]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("frechet_direction", [frechet_direction]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_LID", [VECTOR_MUL_LID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
451 ];;
452
453 (* Lemma real_dir_derivative_jacobian *)
454 let real_dir_derivative_jacobian = Sections.section_proof ["f";"y";"e";"t"]
455 `(lift o f) differentiable at (y + t % e) ==>
456 ((f o (\t. y + t % e)) has_real_derivative
457 drop (jacobian (lift o f) (at (y + t % e)) ** e)) (atreal t)`
458 [
459 (BETA_TAC THEN (move ["df"]));
460 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_dir_derivative_frechet", [real_dir_derivative_frechet])) (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 ("e", [])) (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))) (disch_tac [])) THEN BETA_TAC);
461 ((((use_arg_then2 ("frechet_eq_jacobian", [frechet_eq_jacobian]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
462 ];;
463
464 (* Lemma partial_eq_frechet *)
465 let partial_eq_frechet = Sections.section_proof ["f";"y";"i"]
466 `(lift o f) differentiable at (y:real^N) ==>
467 partial i f y = drop (frechet_derivative (lift o f) (at y) (basis i))`
468 [
469 ((BETA_TAC THEN (move ["df"])) THEN (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] [])))));
470 ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_dir_derivative_frechet", [real_dir_derivative_frechet])) (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))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`basis i:real^N`))) (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))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] []))))));
471 ((BETA_TAC THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("derivative_unique", [derivative_unique])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac));
472 ];;
473
474 (* Lemma partial_eq_jacobian *)
475 let partial_eq_jacobian = Sections.section_proof ["f";"y";"i"]
476 `(lift o f) differentiable at y ==>
477 partial i f y = drop (jacobian (lift o f) (at y) ** basis i)`
478 [
479 (BETA_TAC THEN (move ["df"]));
480 ((((use_arg_then2 ("df", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("JACOBIAN_WORKS", [JACOBIAN_WORKS]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
481 ];;
482
483 (* Lemma partial_eq_jacobian_column *)
484 let partial_eq_jacobian_column = Sections.section_proof ["f";"y";"i"]
485 `(lift o (f:real^N->real)) differentiable at y ==>
486 i IN 1..dimindex (:N) ==>
487 partial i f y = drop (column i (jacobian (lift o f) (at y)))`
488 [
489 ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["df"]) THEN (move ["ineq"]));
490 (((((use_arg_then2 ("partial_eq_jacobian", [partial_eq_jacobian]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("MATRIX_VECTOR_MUL_BASIS", [MATRIX_VECTOR_MUL_BASIS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
491 ];;
492
493 (* Lemma partial_eq_jacobian_entry *)
494 let partial_eq_jacobian_entry = Sections.section_proof ["f";"y";"i"]
495 `(lift o (f:real^N->real)) differentiable at y ==>
496 i IN 1..dimindex (:N) ==>
497 partial i f y = (jacobian (lift o f) (at y))$1$i`
498 [
499 ((BETA_TAC THEN (move ["df"]) THEN (move ["ineq"])) THEN ((((use_arg_then2 ("partial_eq_jacobian_column", [partial_eq_jacobian_column]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("column", [column]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DROP_LAMBDA", [DROP_LAMBDA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
500 ];;
501 (Sections.add_section_var (mk_var ("y", (`:real^N`))));;
502 (Sections.add_section_var (mk_var ("i", (`:num`))));;
503
504 (* Lemma partial_eq0 *)
505 let partial_eq0 = Sections.section_proof ["f"]
506 `~(i IN 1..dimindex (:N)) ==>
507 partial i f y = &0`
508 [
509 ((BETA_TAC THEN (move ["ineq"])) THEN (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] [])))));
510 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`basis i = (vec 0):real^N`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("BASIS_EQ_0", [BASIS_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
511 ((((use_arg_then2 ("VECTOR_MUL_RZERO", [VECTOR_MUL_RZERO]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
512 ((fun arg_tac -> arg_tac (Arg_term (`derivative (f o (\t. y)) = derivative (\t. f y)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
513 ((AP_TERM_TAC) THEN ((((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 (done_tac));
514 ((((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
515 ];;
516
517 (* Lemma derivative_compose *)
518 let derivative_compose = Sections.section_proof ["f";"g";"x"]
519 `f real_differentiable atreal (g x) ==>
520 g real_differentiable atreal x ==>
521 derivative (f o g) x = derivative f (g x) * derivative g x`
522 [
523 (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]));
524 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`f o g = \x. f (g x)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((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 (done_tac)));
525 (((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
526 ];;
527
528 (* Lemma projection_has_derivative *)
529 let projection_has_derivative = Sections.section_proof ["i";"net"]
530 `i IN 1..dimindex (:N) ==>
531 (lift o (\x:real^N. x$i) has_derivative lift o (\x. x$i)) net`
532 [
533 ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["ineq"]));
534 ((fun arg_tac -> arg_tac (Arg_term (`lift o (\x:real^N. x$i) = (\x. x$i % vec 1)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
535 ((((((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 (move ["x"])) THEN ((((use_arg_then2 ("DROP_EQ", [DROP_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DROP_CMUL", [DROP_CMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DROP_VEC", [DROP_VEC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
536 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_DERIVATIVE_VMUL_COMPONENT)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_DERIVATIVE_ID", [HAS_DERIVATIVE_ID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
537 ];;
538
539 (* Lemma projection_diff *)
540 let projection_diff = Sections.section_proof ["i";"net"]
541 `i IN 1..dimindex (:N) ==>
542 (lift o (\x:real^N. x$i)) differentiable net`
543 [
544 ((((use_arg_then2 ("differentiable", [differentiable]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("projection_has_derivative", [projection_has_derivative])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("net", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"]));
545 (((fun arg_tac -> arg_tac (Arg_term (`lift o \x:real^N. x$i`))) (term_tac exists_tac)) THEN (done_tac));
546 ];;
547
548 (* Lemma frechet_projection *)
549 let frechet_projection = Sections.section_proof ["i";"x"]
550 `i IN 1..dimindex (:N) ==>
551 frechet_derivative (lift o (\x:real^N. x$i)) (at x) = lift o (\x:real^N. x$i)`
552 [
553 ((BETA_TAC THEN (move ["ineq"])) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)));
554 ((((use_arg_then2 ("projection_has_derivative", [projection_has_derivative]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
555 ];;
556
557 (* Lemma has_derivative_vector_frechet *)
558 let has_derivative_vector_frechet = Sections.section_proof ["h";"t";"i"]
559 `i IN 1..dimindex (:N) ==>
560 (h o drop) differentiable at (lift t) ==>
561 ((\s. (h:real->real^N) s$i) has_real_derivative
562 (frechet_derivative (h o drop) (at (lift t)) (lift (&1)))$i) (atreal t)`
563 [
564 (BETA_TAC THEN (move ["ineq"]) THEN (move ["dh"]));
565 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(\s. h s$i) = (\x. x$i) o h`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((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 (done_tac)));
566 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_derivative_compose_frechet", [real_derivative_compose_frechet])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\x:real^N. x$i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h", [])) (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))) (disch_tac [])) THEN BETA_TAC);
567 ((((use_arg_then2 ("dh", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("projection_diff", [projection_diff]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
568 ((fun arg_tac -> arg_tac (Arg_term (`(drop o _ o lift) (&1)`))) (term_tac (set_tac "lhs")));
569 ((fun arg_tac -> arg_tac (Arg_term (`(frechet_derivative _1 _2 _3)$i`))) (term_tac (set_tac "rhs")));
570 ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`lhs = rhs`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((done_tac) THEN (done_tac)));
571 (((((use_arg_then2 ("lhs_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("frechet_projection", [frechet_projection]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("rhs_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
572 ];;
573
574 (* Lemma has_derivative_vector_jacobian *)
575 let has_derivative_vector_jacobian = Sections.section_proof ["h";"t";"i"]
576 `i IN 1..dimindex (:N) ==>
577 (h o drop) differentiable at (lift t) ==>
578 ((\s. (h:real->real^N) s$i) has_real_derivative (jacobian (h o drop) (at (lift t)))$i$1) (atreal t)`
579 [
580 (BETA_TAC THEN (move ["ineq"]) THEN (move ["dh"]));
581 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("has_derivative_vector_frechet", [has_derivative_vector_frechet])) (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 ("dh", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
582 ((fun arg_tac -> arg_tac (Arg_term (`(frechet_derivative _1 _2 _3)$i`))) (term_tac (set_tac "lhs")));
583 ((fun arg_tac -> arg_tac (Arg_term (`jacobian _1 _2$i$1`))) (term_tac (set_tac "rhs")));
584 ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`lhs = rhs`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((done_tac) THEN (done_tac)));
585 ((((use_arg_then2 ("lhs_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("frechet_eq_jacobian", [frechet_eq_jacobian]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
586 ((fun arg_tac -> arg_tac (Arg_term (`lift (&1) = basis 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
587 (((((use_arg_then2 ("DROP_EQ", [DROP_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("basis", [basis]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DROP_LAMBDA", [DROP_LAMBDA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
588 (((((use_arg_then2 ("MATRIX_VECTOR_MUL_BASIS", [MATRIX_VECTOR_MUL_BASIS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_GE_1", [DIMINDEX_GE_1]))(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 ("column", [column]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac));
589 ];;
590
591 (* Lemma derivative_vector_jacobian *)
592 let derivative_vector_jacobian = Sections.section_proof ["h";"t";"i"]
593 `i IN 1..dimindex (:N) ==>
594 ((h:real->real^N) o drop) differentiable at (lift t) ==>
595 derivative (\s. h s$i) t = jacobian (h o drop) (at (lift t))$i$1`
596 [
597 ((BETA_TAC THEN (move ["ineq"]) THEN (move ["dh"])) THEN ((use_arg_then2 ("derivative_unique", [derivative_unique])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("has_derivative_vector_jacobian", [has_derivative_vector_jacobian]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
598 ];;
599
600 (* Lemma real_derivative_compose_partial *)
601 let real_derivative_compose_partial = Sections.section_proof ["f";"h";"t"]
602 `(lift o (f:real^N -> real)) differentiable at (h t) ==>
603 (h o drop) differentiable at (lift t) ==>
604 ((f o h) has_real_derivative
605 sum (1..dimindex (:N)) (\i. partial i f (h t) * derivative (\s. h s$i) t)) (atreal t)`
606 [
607 (BETA_TAC THEN (move ["df"]) THEN (move ["dh"]));
608 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_derivative_compose_jacobian", [real_derivative_compose_jacobian])) (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 ("dh", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
609 (((fun arg_tac -> arg_tac (Arg_term (`_$1$1`))) (term_tac (set_tac "lhs"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`sum _ _2`))) (term_tac (set_tac "rhs"))));
610 ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`lhs = rhs`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((done_tac) THEN (done_tac)));
611 (((use_arg_then2 ("lhs_def", []))(gsym_then (thm_tac (new_rewrite [] [])))));
612 ((((use_arg_then2 ("matrix_mul", [matrix_mul]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_GE_1", [DIMINDEX_GE_1]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)));
613 ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_GE_1", [DIMINDEX_GE_1]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("rhs_def", []))(gsym_then (thm_tac (new_rewrite [] []))))));
614 (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac));
615 (((((use_arg_then2 ("partial_eq_jacobian_entry", [partial_eq_jacobian_entry]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_EQ_MUL_LCANCEL", [REAL_EQ_MUL_LCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_vector_jacobian", [derivative_vector_jacobian]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
616 ];;
617
618 (* Lemma real_dir_derivative_partial *)
619 let real_dir_derivative_partial = Sections.section_proof ["f";"e";"t"]
620 `(lift o f) differentiable at (y + t % e) ==>
621 ((f o (\t. y + t % e)) has_real_derivative
622 sum (1..dimindex (:N)) (\i. e$i * (partial i f o (\t. y + t % e)) t)) (atreal t)`
623 [
624 (BETA_TAC THEN (move ["df"]));
625 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_dir_derivative_jacobian", [real_dir_derivative_jacobian])) (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))) (fun fst_arg -> (use_arg_then2 ("e", [])) (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))) (disch_tac [])) THEN BETA_TAC);
626 ((((use_arg_then2 ("matrix_vector_mul", [matrix_vector_mul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DROP_LAMBDA", [DROP_LAMBDA]))(thm_tac (new_rewrite [] [])))));
627 (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "lhs"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "rhs"))));
628 ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`lhs = rhs`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((done_tac) THEN (done_tac)));
629 (((((use_arg_then2 ("lhs_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rhs_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac)));
630 (((((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("partial_eq_jacobian_entry", [partial_eq_jacobian_entry]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
631 ];;
632 (Sections.add_section_var (mk_var ("f", (`:real^N -> real`))); Sections.add_section_var (mk_var ("g", (`:real^N -> real`))));;
633 (Sections.add_section_hyp "df" (`(lift o f) differentiable at y`));;
634
635 (* Lemma partial_uni_compose *)
636 let partial_uni_compose = Sections.section_proof ["u"]
637 `u real_differentiable atreal (f y) ==>
638 partial i (u o f) y = derivative u (f y) * partial i f y`
639 [
640 ((BETA_TAC THEN (move ["du"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("derivative_compose", [derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)));
641 (((((use_arg_then2 ("diff_imp_real_diff", [diff_imp_real_diff]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff_direction", [diff_direction]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
642 (((((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
643 ];;
644
645 (* Lemma partial_neg *)
646 let partial_neg = Sections.section_proof []
647 `partial i (\x. --f x) y = --partial i f y`
648 [
649 (((repeat_tactic 1 9 (((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_lift_neg", [f_lift_neg]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_NEG", [DIFFERENTIABLE_NEG]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("frechet_neg", [frechet_neg]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DROP_NEG", [DROP_NEG]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac));
650 ];;
651
652 (* Lemma partial_scale *)
653 let partial_scale = Sections.section_proof ["c"]
654 `partial i (\x. c * f x) y = c * partial i f y`
655 [
656 (((repeat_tactic 1 9 (((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_lift_scale", [f_lift_scale]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_CMUL", [DIFFERENTIABLE_CMUL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("frechet_scale", [frechet_scale]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac))));
657 ((((use_arg_then2 ("DROP_CMUL", [DROP_CMUL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
658 ];;
659 (Sections.add_section_hyp "dg" (`(lift o g) differentiable at y`));;
660
661 (* Lemma partial_add *)
662 let partial_add = Sections.section_proof []
663 `partial i (\x. f x + g x) y = partial i f y + partial i g y`
664 [
665 (((repeat_tactic 1 9 (((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_lift_add", [f_lift_add]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("frechet_add", [frechet_add]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac))));
666 ((((use_arg_then2 ("DROP_ADD", [DROP_ADD]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
667 ];;
668
669 (* Lemma partial_sub *)
670 let partial_sub = Sections.section_proof []
671 `partial i (\x. f x - g x) y = partial i f y - partial i g y`
672 [
673 (((repeat_tactic 1 9 (((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_lift_sub", [f_lift_sub]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_SUB", [DIFFERENTIABLE_SUB]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("frechet_sub", [frechet_sub]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac))));
674 ((((use_arg_then2 ("DROP_SUB", [DROP_SUB]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
675 ];;
676
677 (* Lemma partial_mul *)
678 let partial_mul = Sections.section_proof []
679 `partial i (\x. f x * g x) y = partial i f y * g y + f y * partial i g y`
680 [
681 ((repeat_tactic 1 9 (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`\t. y + t % basis i`))) (term_tac (set_tac "h"))));
682 ((fun arg_tac -> arg_tac (Arg_term (`(\x. f x * g x) o h = (\t. (f o h) t * (g o h) t)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
683 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
684 ((THENL_ROT (-1)) (((use_arg_then2 ("derivative_mul", [derivative_mul]))(thm_tac (new_rewrite [] [])))));
685 ((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [1; 4] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((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 (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (use_arg_then2 ("g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))));
686 ((((use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac));
687 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`h (&0) = y`))) (term_tac (have_gen_tac [](move ["h0"])))) (((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
688 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(h o drop) differentiable at (lift (&0))`))) (term_tac (have_gen_tac [](move ["dh"])))) (((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("diff_direction", [diff_direction]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
689 ((((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_imp_real_diff", [diff_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("h0", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
690 ];;
691
692 (* Finalization of the section Partial *)
693 let real_derivative_compose_frechet = Sections.finalize_theorem real_derivative_compose_frechet;;
694 let real_derivative_compose_jacobian = Sections.finalize_theorem real_derivative_compose_jacobian;;
695 let diff_imp_real_diff = Sections.finalize_theorem diff_imp_real_diff;;
696 let diff_direction = Sections.finalize_theorem diff_direction;;
697 let frechet_direction = Sections.finalize_theorem frechet_direction;;
698 let real_dir_derivative_frechet = Sections.finalize_theorem real_dir_derivative_frechet;;
699 let real_dir_derivative_jacobian = Sections.finalize_theorem real_dir_derivative_jacobian;;
700 let partial_eq_frechet = Sections.finalize_theorem partial_eq_frechet;;
701 let partial_eq_jacobian = Sections.finalize_theorem partial_eq_jacobian;;
702 let partial_eq_jacobian_column = Sections.finalize_theorem partial_eq_jacobian_column;;
703 let partial_eq_jacobian_entry = Sections.finalize_theorem partial_eq_jacobian_entry;;
704 let partial_eq0 = Sections.finalize_theorem partial_eq0;;
705 let derivative_compose = Sections.finalize_theorem derivative_compose;;
706 let projection_has_derivative = Sections.finalize_theorem projection_has_derivative;;
707 let projection_diff = Sections.finalize_theorem projection_diff;;
708 let frechet_projection = Sections.finalize_theorem frechet_projection;;
709 let has_derivative_vector_frechet = Sections.finalize_theorem has_derivative_vector_frechet;;
710 let has_derivative_vector_jacobian = Sections.finalize_theorem has_derivative_vector_jacobian;;
711 let derivative_vector_jacobian = Sections.finalize_theorem derivative_vector_jacobian;;
712 let real_derivative_compose_partial = Sections.finalize_theorem real_derivative_compose_partial;;
713 let real_dir_derivative_partial = Sections.finalize_theorem real_dir_derivative_partial;;
714 let partial_uni_compose = Sections.finalize_theorem partial_uni_compose;;
715 let partial_neg = Sections.finalize_theorem partial_neg;;
716 let partial_scale = Sections.finalize_theorem partial_scale;;
717 let partial_add = Sections.finalize_theorem partial_add;;
718 let partial_sub = Sections.finalize_theorem partial_sub;;
719 let partial_mul = Sections.finalize_theorem partial_mul;;
720 Sections.end_section "Partial";;
721
722 (* Section PartialMonotone *)
723 Sections.begin_section "PartialMonotone";;
724
725 (* Lemma derivative_translation *)
726 let derivative_translation = Sections.section_proof ["f";"x"]
727 `f real_differentiable atreal x ==>
728 derivative f x = derivative (f o (\t. x + t)) (&0)`
729 [
730 (BETA_TAC THEN (move ["diff_f"]));
731 ((((use_arg_then2 ("derivative_compose", [derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff_f", []))(thm_tac (new_rewrite [] []))))));
732 (((((use_arg_then2 ("REAL_DIFFERENTIABLE_ADD", [REAL_DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_ID", [REAL_DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
733 ((((use_arg_then2 ("derivative_add", [derivative_add]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(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)));
734 (((((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_x", [derivative_x]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac));
735 ];;
736 (Sections.add_section_type (mk_var ("f", (`:real^N->real`))));;
737
738 (* Lemma partial_increasing_left *)
739 let partial_increasing_left = Sections.section_proof ["f";"j";"u";"x";"z";"lo"]
740 `(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i) ==>
741 u$j = x$j ==>
742 (!y. y IN interval [x,z] ==> (lift o f) differentiable at y) ==>
743 (!y. y IN interval [x,z] ==> &0 <= partial j f y) ==>
744 (!y. y IN interval [x,u] ==> lo <= f y) ==>
745 (!y. y IN interval [x,z] ==> lo <= f y)`
746 [
747 (((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] [])))))) THEN (move ["uz_eq"]) THEN (move ["ux_eq"]) THEN (move ["diff_f"]) THEN (move ["partial_pos"]) THEN (move ["f_bound"]) THEN (move ["y"]) THEN (move ["y_in"]));
748 ((((use_arg_then2 ("partial_pos", [])) (disch_tac [])) THEN (clear_assumption "partial_pos") THEN ((use_arg_then2 ("diff_f", [])) (disch_tac [])) THEN (clear_assumption "diff_f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["diff_f"]) THEN (move ["partial_pos"])));
749 ((fun arg_tac -> arg_tac (Arg_term (`(lambda i. if i = j then x$j else y$i):real^N`))) (term_tac (set_tac "y'")));
750 (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`f y' <= f y`))) (term_tac (have_gen_tac []ALL_TAC))));
751 ((((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("f_bound", [])) (disch_tac [])) THEN (clear_assumption "f_bound") THEN (DISCH_THEN apply_tac) THEN (move ["i"]) THEN (move ["i_in"])));
752 ((((use_arg_then2 ("y'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
753 ((THENL_FIRST) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"])) (((((use_arg_then2 ("ux_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
754 (((((use_arg_then2 ("uz_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
755 (((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`j IN 1..dimindex (:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case)) THEN ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["j_in"])));
756 ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`y' = y`))) (term_tac (have_gen_tac []ALL_TAC)))) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
757 ((((use_arg_then2 ("CART_EQ", [CART_EQ]))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["i_in"]));
758 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(i = j)`))) (term_tac (have_gen_tac [](move ["inj"])))) ((((use_arg_then2 ("i_in", [])) (disch_tac [])) THEN (clear_assumption "i_in") THEN ((use_arg_then2 ("j_in", [])) (disch_tac [])) THEN (clear_assumption "j_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
759 (((((use_arg_then2 ("y'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
760 ((fun arg_tac -> arg_tac (Arg_term (`f o (\t. y' + t % basis j)`))) (term_tac (set_tac "g")));
761 ((fun arg_tac -> arg_tac (Arg_term (`f y' = g (&0)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
762 (((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
763 ((fun arg_tac -> arg_tac (Arg_term (`f y = g (y$j - x$j)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
764 (((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (AP_TERM_TAC));
765 ((((use_arg_then2 ("CART_EQ", [CART_EQ]))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["i_in"]));
766 ((((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
767 ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"])) THEN ((((use_arg_then2 ("y'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
768 ((arith_tac) THEN (done_tac));
769 (((simp_tac) THEN (((use_arg_then2 ("ij", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac));
770 ((fun arg_tac -> arg_tac (Arg_term (`real_interval [&0, y$j - x$j]`))) (term_tac (set_tac "s")));
771 ((fun arg_tac -> arg_tac (Arg_term (`!t. t IN s ==> y' + t % basis j IN interval [x,z]`))) (term_tac (have_gen_tac [](move ["in_s"]))));
772 (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] []))))) THEN (move ["t"]) THEN (move ["t_ineq"]) THEN (move ["i"]) THEN (move ["i_ineq"]));
773 ((repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
774 ((((use_arg_then2 ("y'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
775 ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"])));
776 (((((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
777 ((((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((fun arg_tac -> (use_arg_then2 ("y_in", [])) (fun fst_arg -> (use_arg_then2 ("i_ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("ij", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac));
778 ((fun arg_tac -> arg_tac (Arg_term (`!t. t IN s ==> (g has_real_derivative (partial j f (y' + t % basis j))) (atreal t within s)`))) (term_tac (have_gen_tac [](move ["ds"]))));
779 ((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("in_s", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["p_in"])) 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)) THEN (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] [])))));
780 ((fun arg_tac -> arg_tac (Arg_term (`f o _`))) (term_tac (set_tac "h")));
781 ((fun arg_tac -> arg_tac (Arg_term (`h = g o (\t'. t + t')`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
782 ((((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["r"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)));
783 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
784 (((((use_arg_then2 ("derivative_translation", [derivative_translation]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("diff_imp_real_diff", [diff_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("diff_f", []))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("diff_direction", [diff_direction]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
785 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 <= y$j - x$j`))) (term_tac (have_gen_tac [](move ["pos"])))) ((((fun arg_tac -> (use_arg_then2 ("y_in", [])) (fun fst_arg -> (use_arg_then2 ("j_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
786 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("HAS_REAL_DERIVATIVE_INCREASING_IMP", [HAS_REAL_DERIVATIVE_INCREASING_IMP])) (fun fst_arg -> (use_arg_then2 ("g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\t. partial j f (y' + t % basis j)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (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 (`y$j - x$j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
787 (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("IS_REALINTERVAL_INTERVAL", [IS_REALINTERVAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((((use_arg_then2 ("ds", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (DISCH_THEN apply_tac));
788 ((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [2; 3] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("pos", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac));
789 ((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("in_s", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("partial_pos", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac));
790 ];;
791
792 (* Lemma partial_decreasing_left *)
793 let partial_decreasing_left = Sections.section_proof ["f";"j";"u";"x";"z";"hi"]
794 `(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i) ==>
795 u$j = x$j ==>
796 (!y. y IN interval [x,z] ==> (lift o f) differentiable at y) ==>
797 (!y. y IN interval [x,z] ==> partial j f y <= &0) ==>
798 (!y. y IN interval [x,u] ==> f y <= hi) ==>
799 (!y. y IN interval [x,z] ==> f y <= hi)`
800 [
801 (BETA_TAC THEN (move ["u_eq_i"]) THEN (move ["u_eq_j"]) THEN (move ["diff_f"]) THEN (move ["partial_f"]) THEN (move ["f_bound"]) THEN (move ["y"]) THEN (move ["y_in"]));
802 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("partial_increasing_left", [partial_increasing_left])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(\p. -- f p)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("u", [])) (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 fst_arg -> (use_arg_then2 ("z", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`--hi`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("u_eq_i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("u_eq_j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
803 ((THENL_FIRST) (ANTS_TAC) ((BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff_f", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("DIFFERENTIABLE_NEG", [DIFFERENTIABLE_NEG])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("f_lift_neg", [f_lift_neg]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
804 (ANTS_TAC);
805 ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then2 ("partial_neg", [partial_neg]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff_f", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_NEG_GE0", [REAL_NEG_GE0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("partial_f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
806 ((THENL_FIRST) (ANTS_TAC) ((BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("f_bound", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (arith_tac) THEN (done_tac)));
807 ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("y_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
808 ];;
809
810 (* Lemma partial_translation *)
811 let partial_translation = Sections.section_proof ["f";"i";"p";"y"]
812 `lift o f differentiable at (p + y) ==>
813 partial i (f o (\x. p + x)) y = partial i f (p + y)`
814 [
815 (BETA_TAC THEN (move ["diff"]));
816 ((fun arg_tac -> arg_tac (Arg_term (`!net. (\x. p + x) differentiable net`))) (term_tac (have_gen_tac [](move ["diff_p"]))));
817 ((BETA_TAC THEN (move ["net"])) THEN ((((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ID", [DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
818 ((((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_CHAIN_AT", [DIFFERENTIABLE_CHAIN_AT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
819 ((((use_arg_then2 ("frechet_compose", [frechet_compose]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("frechet_add", [frechet_add]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_ID", [DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
820 ((((use_arg_then2 ("frechet_const", [frechet_const]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("frechet_id", [frechet_id]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_ADD_LID", [VECTOR_ADD_LID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_DEF", [I_DEF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("I_O_ID", [I_O_ID]))(thm_tac (new_rewrite [] [])))));
821 ((((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
822 ];;
823
824 (* Lemma partial_rev_translation *)
825 let partial_rev_translation = Sections.section_proof ["f";"i";"p";"y"]
826 `lift o f differentiable at (p - y) ==>
827 partial i (f o (\x. p - x)) y = --partial i f (p - y)`
828 [
829 (BETA_TAC THEN (move ["diff"]));
830 ((fun arg_tac -> arg_tac (Arg_term (`!net. (\x. p - x) differentiable net`))) (term_tac (have_gen_tac [](move ["diff_p"]))));
831 ((BETA_TAC THEN (move ["net"])) THEN ((((use_arg_then2 ("DIFFERENTIABLE_SUB", [DIFFERENTIABLE_SUB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ID", [DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
832 ((((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_CHAIN_AT", [DIFFERENTIABLE_CHAIN_AT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
833 ((((use_arg_then2 ("frechet_compose", [frechet_compose]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("frechet_sub", [frechet_sub]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_ID", [DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
834 ((((use_arg_then2 ("frechet_const", [frechet_const]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("frechet_id", [frechet_id]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_LZERO)))(thm_tac (new_rewrite [] [])))));
835 ((((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac));
836 (((((use_arg_then2 ("LINEAR_NEG", [LINEAR_NEG]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("LINEAR_FRECHET_DERIVATIVE", [LINEAR_FRECHET_DERIVATIVE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DROP_NEG", [DROP_NEG]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
837 ];;
838
839 (* Lemma partial_increasing_right *)
840 let partial_increasing_right = Sections.section_proof ["f";"j";"u";"x";"z";"hi"]
841 `(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = x$i) ==>
842 u$j = z$j ==>
843 (!y. y IN interval [x,z] ==> (lift o f) differentiable at y) ==>
844 (!y. y IN interval [x,z] ==> &0 <= partial j f y) ==>
845 (!y. y IN interval [u,z] ==> f y <= hi) ==>
846 (!y. y IN interval [x,z] ==> f y <= hi)`
847 [
848 (BETA_TAC THEN (move ["u_eq_i"]) THEN (move ["u_eq_j"]) THEN (move ["diff_f"]) THEN (move ["partial_f"]) THEN (move ["f_bound"]) THEN (move ["y"]) THEN (move ["y_in"]));
849 (((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`j IN 1..dimindex (:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case)) THEN ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["j_in"])));
850 ((((use_arg_then2 ("f_bound", [])) (disch_tac [])) THEN (clear_assumption "f_bound") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("y_in", [])) (disch_tac [])) THEN (clear_assumption "y_in") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] []))))) THEN (move ["y_ineq"]) THEN (move ["i"]) THEN (move ["i_in"])));
851 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(i = j)`))) (term_tac (have_gen_tac [](move ["inj"])))) ((((use_arg_then2 ("i_in", [])) (disch_tac [])) THEN (clear_assumption "i_in") THEN ((use_arg_then2 ("j_in", [])) (disch_tac [])) THEN (clear_assumption "j_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
852 (((((use_arg_then2 ("u_eq_i", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_ineq", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
853 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("partial_decreasing_left", [partial_decreasing_left])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f o (\p:real^N. x + (z - p))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x + (z - u):real^N`))) (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 fst_arg -> (use_arg_then2 ("z", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("hi", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
854 (ANTS_TAC);
855 ((BETA_TAC THEN (move ["i"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("u_eq_i", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["eq1"]) THEN (move ["inj"])) THEN ((((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] []))))));
856 (((((use_arg_then2 ("eq1", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac));
857 ((THENL_FIRST) (ANTS_TAC) (((((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("u_eq_j", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)));
858 ((fun arg_tac -> arg_tac (Arg_term (`!p. p IN interval [x,z] ==> x + (z - p) IN interval [x,z]`))) (term_tac (have_gen_tac [](move ["Hp"]))));
859 ((BETA_TAC THEN (move ["p"])) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] []))))) THEN (move ["p_in"]) THEN (move ["i"]) THEN (move ["ineq"])));
860 ((((fun arg_tac -> (use_arg_then2 ("p_in", [])) (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 ((((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
861 ((fun arg_tac -> arg_tac (Arg_term (`!y. _ y`))) (term_tac (set_tac "dP")));
862 ((fun arg_tac -> arg_tac (Arg_term (`dP`))) (term_tac (have_gen_tac [](move ["P"]))));
863 ((((use_arg_then2 ("dP_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])));
864 (((((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CHAIN_AT", [DIFFERENTIABLE_CHAIN_AT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_SUB", [DIFFERENTIABLE_SUB]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_ID", [DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("diff_f", []))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("Hp", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
865 ((((use_arg_then2 ("P", [])) (disch_tac [])) THEN (clear_assumption "P") THEN BETA_TAC THEN (simp_tac)) THEN ((((use_arg_then2 ("dP_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["diff"])));
866 (ANTS_TAC);
867 (BETA_TAC THEN (move ["p"]) THEN (move ["p_in"]));
868 ((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `!x z p. x + z - p = (x + z) - p:real^N`))) (fun arg -> thm_tac MP_TAC arg THEN (move ["assoc"])));
869 ((((use_arg_then2 ("assoc", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("partial_rev_translation", [partial_rev_translation]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("assoc", []))(gsym_then (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 ("Hp", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
870 (((((use_arg_then2 ("REAL_NEG_LE0", [REAL_NEG_LE0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("partial_f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hp", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
871 (ANTS_TAC);
872 ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_bound", []))(thm_tac (new_rewrite [] []))))));
873 ((((use_arg_then2 ("p_in", [])) (disch_tac [])) THEN (clear_assumption "p_in") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"]) THEN (move ["i"]) THEN (move ["i_ineq"])));
874 ((((fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("i_ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac));
875 ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x + z - y:real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN ((((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)));
876 ((((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `!x z y:real^N. x + z - (x + z - y) = y`)))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac));
877 ((((use_arg_then2 ("Hp", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
878 ];;
879
880 (* Finalization of the section PartialMonotone *)
881 let derivative_translation = Sections.finalize_theorem derivative_translation;;
882 let partial_increasing_left = Sections.finalize_theorem partial_increasing_left;;
883 let partial_decreasing_left = Sections.finalize_theorem partial_decreasing_left;;
884 let partial_translation = Sections.finalize_theorem partial_translation;;
885 let partial_rev_translation = Sections.finalize_theorem partial_rev_translation;;
886 let partial_increasing_right = Sections.finalize_theorem partial_increasing_right;;
887 Sections.end_section "PartialMonotone";;
888
889 (* Section Taylor *)
890 Sections.begin_section "Taylor";;
891
892 (* Lemma real_taylor2_bound *)
893 let real_taylor2_bound = Sections.section_proof ["f";"dd_bound"]
894 `nth_diff_strong_int 2 (&0, &1) f ==>
895 (!t. interval_arith t (&0, &1) ==> abs (nth_derivative 2 f t) <= dd_bound) ==>
896 abs (f (&1) - (f (&0) + derivative f (&0))) <= dd_bound / &2`
897 [
898 (((((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_diff_strong2_eq_alt", [nth_diff_strong2_eq_alt]))(thm_tac (new_rewrite [] []))))) THEN (move ["df"]) THEN (move ["dd"]));
899 ((fun arg_tac -> arg_tac (Arg_term (`\i. if i = 0 then f else if i = 1 then derivative f else nth_derivative 2 f`))) (term_tac (set_tac "R")));
900 ((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 + 1 = 1 /\ ~(1 = 0) /\ 1 + 1 = 2 /\ ~(2 = 1) /\ ~(2 = 0)`))) (fun arg -> thm_tac MP_TAC arg THEN (move ["arithH"])));
901 ((((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 ("R", [])) (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 [&0, &1]`))) (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))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC));
902 (((((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));
903 ((BETA_TAC THEN (move ["i"]) THEN (move ["x"])) 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 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `i <= 1 <=> i = 0 \/ i = 1`)))(thm_tac (new_rewrite [] []))))));
904 (BETA_TAC THEN (case THEN ALL_TAC) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("df", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["s"])) THEN (move ["d_f"]));
905 ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("arithH", []))(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 (((use_arg_then2 ("d_f", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
906 ((BETA_TAC THEN (move ["x"])) 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 (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"])));
907 ((((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 ["s"])) THEN (move ["d_f"])) THEN ((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("dd", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
908 ((((fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (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 (`&1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_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 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_01", [REAL_LE_01]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)));
909 ((((use_arg_then2 ("REAL_SUB_RZERO", [REAL_SUB_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_1", [REAL_ABS_1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_ONE", [REAL_POW_ONE]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `FACT (1 + 1) = 2`)))(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_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] []))))));
910 ((((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [2] [])))) 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 (((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 <= 1`)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
911 ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `FACT 0 = 1 /\ FACT 1 = 1`)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_INV_1", [REAL_INV_1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))));
912 (((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
913 ];;
914
915 (* Lemma real_taylor1_bound *)
916 let real_taylor1_bound = Sections.section_proof ["f";"d_bound"]
917 `(!t. interval_arith t (&0, &1) ==> f real_differentiable atreal t /\
918 abs (derivative f t) <= d_bound) ==>
919 abs (f (&1) - f (&0)) <= d_bound`
920 [
921 (BETA_TAC THEN (move ["df"]));
922 ((fun arg_tac -> arg_tac (Arg_term (`\i. if i = 0 then f else derivative f`))) (term_tac (set_tac "R")));
923 ((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 + 1 = 1 /\ ~(1 = 0)`))) (fun arg -> thm_tac MP_TAC arg THEN (move ["arithH"])));
924 ((((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 ("R", [])) (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 [&0, &1]`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC));
925 (((((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));
926 ((BETA_TAC THEN (move ["i"]) THEN (move ["x"])) 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 (((use_arg_then2 ("leqn0", [leqn0]))(thm_tac (new_rewrite [] []))))));
927 (BETA_TAC THEN (case THEN ALL_TAC) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("df", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN ((move ["diff_f"]) THEN (move ["df_bound"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
928 (((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("arithH", []))(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 (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
929 ((BETA_TAC THEN (move ["x"])) 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 (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"])));
930 ((((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 ["s"])) THEN (move ["d_f"])) THEN ((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
931 ((((fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (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 (`&1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_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 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_01", [REAL_LE_01]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)));
932 ((((use_arg_then2 ("SUM_SING_NUMSEG", [SUM_SING_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_SUB_RZERO", [REAL_SUB_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_1", [REAL_ABS_1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_ONE", [REAL_POW_ONE]))(thm_tac (new_rewrite [] []))))));
933 ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `FACT 1 = 1 /\ FACT 0 = 1`)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_DIV_1", [REAL_DIV_1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))));
934 (((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
935 ];;
936 let m_taylor_error = new_definition `m_taylor_error f domain (w:real^N) error <=>
937 !x:real^N. x IN interval [domain] ==> sum (1..dimindex (:N)) (\i. w$i * sum (1..dimindex (:N))
938 (\j. w$j * abs (partial j (partial i f) x))) <= error`;;
939 let m_taylor_partial_error = new_definition `m_taylor_partial_error f i domain (w:real^N) error <=>
940 (!x:real^N. x IN interval[domain] ==>
941 sum (1..dimindex (:N)) (\j. w$j * abs (partial j (partial i f) x)) <= error)`;;
942
943 (* Lemma taylor_error_eq_sum_partial_errors *)
944 let taylor_error_eq_sum_partial_errors = Sections.section_proof ["f";"domain";"w";"p_error";"error"]
945 `(!i. i IN 1..dimindex (:N) ==> m_taylor_partial_error f i domain w (p_error i) /\ &0 <= w$i) ==>
946 sum (1..dimindex (:N)) (\i. w$i * p_error i) <= error ==>
947 m_taylor_error f domain (w:real^N) error`
948 [
949 (((((use_arg_then2 ("m_taylor_partial_error", [m_taylor_partial_error]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("m_taylor_error", [m_taylor_error]))(thm_tac (new_rewrite [] []))))) THEN (move ["partialH"]) THEN (move ["ineq"]) THEN (move ["p"]) THEN (move ["p_in"]));
950 (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
951 (((use_arg_then2 ("SUM_LE", [SUM_LE])) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac)));
952 (((((use_arg_then2 ("REAL_LE_LMUL", [REAL_LE_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("partialH", [])) (fun fst_arg -> (use_arg_then2 ("i_ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
953 ];;
954 let partial2 = new_definition `partial2 j i f = partial j (partial i f)`;;
955 let diff2 = new_definition `diff2 f x <=>
956 ?s. open s /\ x IN s /\ (!y. y IN s ==> (lift o f) differentiable at y /\
957 (!i. (lift o partial i f) differentiable at y))`;;
958 let diff2c = new_definition `diff2c f x <=> diff2 f x /\
959 (!i j. (lift o partial2 j i f) continuous at x)`;;
960
961 (* Lemma diff2c_imp_diff2 *)
962 let diff2c_imp_diff2 = Sections.section_proof ["f";"x"]
963 `diff2c f x ==> diff2 f x`
964 [
965 (((((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
966 ];;
967
968 (* Lemma diff2_eq_diff2_on_open *)
969 let diff2_eq_diff2_on_open = Sections.section_proof ["f";"x"]
970 `diff2 f x <=>
971 ?s. open s /\ x IN s /\ (!y. y IN s ==> diff2 f y)`
972 [
973 ((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])));
974 (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [1] [])))) 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 (move ["ys"])) THEN ((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (done_tac));
975 ((((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("xs", [])) (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 ["df2"])) THEN (((use_arg_then2 ("df", [])) (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC THEN (move ["_"])));
976 (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (done_tac));
977 ];;
978
979 (* Lemma diff2_imp_real_diff *)
980 let diff2_imp_real_diff = Sections.section_proof ["f";"x";"e";"t"]
981 `diff2 f (x + t % e) ==>
982 f o (\t. x + t % e) real_differentiable atreal t`
983 [
984 ((((use_arg_then2 ("diff2", [diff2]))(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 ["df"]));
985 (((use_arg_then2 ("diff_imp_real_diff", [diff_imp_real_diff])) (thm_tac apply_tac)) THEN ((simp_tac) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("diff_direction", [diff_direction]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
986 ];;
987
988 (* Lemma diff2_dir_derivative *)
989 let diff2_dir_derivative = Sections.section_proof ["f";"x";"e";"t"]
990 `diff2 f (x + t % e:real^N) ==>
991 derivative (f o (\t. x + t % e)) t =
992 sum (1..dimindex (:N)) (\i. e$i * (partial i f o (\t. x + t % e)) t)`
993 [
994 ((((use_arg_then2 ("diff2", [diff2]))(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 ["df"]));
995 ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("real_dir_derivative_partial", [real_dir_derivative_partial]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
996 ];;
997
998 (* Lemma diff2_partial_real_diff *)
999 let diff2_partial_real_diff = Sections.section_proof ["f";"i";"x";"e";"t"]
1000 `diff2 f (x + t % e:real^N) ==>
1001 partial i f o (\t. x + t % e) real_differentiable atreal t`
1002 [
1003 ((((use_arg_then2 ("diff2", [diff2]))(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 ["df"]));
1004 (((((use_arg_then2 ("diff_imp_real_diff", [diff_imp_real_diff]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("diff_direction", [diff_direction]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1005 ];;
1006
1007 (* Lemma in_trans *)
1008 let in_trans = Sections.section_proof ["x";"s";"t"]
1009 `t SUBSET s ==> x IN t ==> x IN s`
1010 [
1011 ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["sub"]) THEN (move ["xt"]));
1012 (((use_arg_then2 ("sub", [])) (disch_tac [])) THEN (clear_assumption "sub") THEN (exact_tac));
1013 ];;
1014
1015 (* Lemma open_contains_open_interval *)
1016 let open_contains_open_interval = Sections.section_proof ["e";"s";"x"]
1017 `open s ==> x IN s ==>
1018 ?a b. &0 IN real_interval (a, b) /\ IMAGE (\t. x + t % e) (real_interval (a, b)) SUBSET s`
1019 [
1020 ((((use_arg_then2 ("OPEN_CONTAINS_BALL", [OPEN_CONTAINS_BALL]))(thm_tac (new_rewrite [] [])))) THEN (move ["open_s"]));
1021 (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("open_s", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["ball_s"])) THEN (((use_arg_then2 ("open_s", [])) (disch_tac [])) THEN (clear_assumption "open_s") THEN BETA_TAC THEN (move ["_"])));
1022 ((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`norm e = &0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [ALL_TAC; (move ["n0"])]);
1023 (((((use_arg_then2 ("NORM_EQ_0", [NORM_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_term (`--d`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("d", [])) (term_tac exists_tac))));
1024 ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1025 ((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (case THEN (move ["t"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_MUL_RZERO)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] []))))));
1026 (((((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("ball_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CENTRE_IN_BALL", [CENTRE_IN_BALL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1027 ((fun arg_tac -> arg_tac (Arg_term (`((d / &2) * inv(norm e)) % e`))) (term_tac (set_tac "y")));
1028 ((fun arg_tac -> arg_tac (Arg_term (`norm y = d / &2`))) (term_tac (have_gen_tac [](move ["norm_y"]))));
1029 ((((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("VECTOR_MUL_ASSOC", [VECTOR_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ABS_INV", [REAL_ABS_INV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_NORM", [REAL_ABS_NORM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
1030 ((((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1031 ((((fun arg_tac -> arg_tac (Arg_term (`-- (d / &2 * inv (norm e))`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`d / &2 * inv (norm e)`))) (term_tac exists_tac))) THEN (split_tac));
1032 ((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_LT0", [REAL_NEG_LT0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbb", [andbb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_INV", [REAL_LT_INV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("NORM_POS_LT", [NORM_POS_LT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("NORM_EQ_0", [NORM_EQ_0]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)));
1033 ((((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1034 (((use_arg_then2 ("SUBSET_TRANS", [SUBSET_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`ball (x, d)`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("ball_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["p"]) THEN (case THEN (move ["t"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["t_in"]) THEN (simp_tac)));
1035 ((((use_arg_then2 ("IN_BALL", [IN_BALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_RADD", [VECTOR_SUB_RADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_NEG", [NORM_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] [])))));
1036 ((THENL_LAST) ((((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`d / &2`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1037 ((((fun arg_tac -> (use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`d / &2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_RMUL", [REAL_LE_RMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_POS_LE", [NORM_POS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))));
1038 ((((use_arg_then2 ("t_in", [])) (disch_tac [])) THEN (clear_assumption "t_in") THEN BETA_TAC) THEN (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac));
1039 ];;
1040
1041 (* Lemma diff2_dir *)
1042 let diff2_dir = Sections.section_proof ["f";"x";"e";"t"]
1043 `diff2 f (x + t % e:real^N) ==>
1044 nth_diff_strong 2 (f o (\t. x + t % e)) t`
1045 [
1046 (((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(thm_tac (new_rewrite [] [])))) 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 (move ["df"]));
1047 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("open_contains_open_interval", [open_contains_open_interval])) (fun fst_arg -> (use_arg_then2 ("e", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("open_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["in0"])) THEN (move ["sub"]));
1048 (((fun arg_tac -> arg_tac (Arg_term (`real_interval (a + t, b + t)`))) (term_tac exists_tac)) THEN ((((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 (split_tac));
1049 ((((use_arg_then2 ("in0", [])) (disch_tac [])) THEN (clear_assumption "in0") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1050 (BETA_TAC THEN (move ["p"]) THEN (move ["p_int"]));
1051 ((fun arg_tac -> arg_tac (Arg_term (`x + p % e IN s`))) (term_tac (have_gen_tac [](move ["xp_in"]))));
1052 ((((use_arg_then2 ("sub", [])) (disch_tac [])) THEN (clear_assumption "sub") THEN BETA_TAC) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN ((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`p - t`))) (term_tac exists_tac)));
1053 (((THENL) (split_tac) [(VECTOR_ARITH_TAC); ((((use_arg_then2 ("p_int", [])) (disch_tac [])) THEN (clear_assumption "p_int") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac))]) THEN (done_tac));
1054 ((((use_arg_then2 ("diff2_imp_real_diff", [diff2_imp_real_diff]))(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 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
1055 ((use_arg_then2 ("differentiable_local", [differentiable_local])) (thm_tac apply_tac));
1056 ((fun arg_tac -> arg_tac (Arg_term (`\t. sum (1..dimindex(:N)) (\i. e$i * (partial i f o (\t. x + t % e)) t)`))) (term_tac exists_tac));
1057 ((fun arg_tac -> arg_tac (Arg_term (`min (p - (a + t)) (b + t - p)`))) (term_tac (set_tac "d")));
1058 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < d`))) (term_tac (have_gen_tac [](move ["d0"])))) ((((use_arg_then2 ("p_int", [])) (disch_tac [])) THEN (clear_assumption "p_int") THEN BETA_TAC) THEN ((((use_arg_then2 ("d_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)));
1059 (((fun arg_tac -> arg_tac (Arg_term (`real_interval (p - d, p + d)`))) (term_tac exists_tac)) THEN (split_tac));
1060 ((((use_arg_then2 ("differentiable_sum_numseg", [differentiable_sum_numseg]))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac));
1061 (((((use_arg_then2 ("REAL_DIFFERENTIABLE_MUL_ATREAL", [REAL_DIFFERENTIABLE_MUL_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
1062 (((((use_arg_then2 ("diff2_partial_real_diff", [diff2_partial_real_diff]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1063 (((((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 (split_tac));
1064 ((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1065 ((BETA_TAC THEN (move ["y"]) THEN (move ["y_in"])) THEN ((((use_arg_then2 ("diff2_dir_derivative", [diff2_dir_derivative]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))));
1066 ((((use_arg_then2 ("sub", [])) (disch_tac [])) THEN (clear_assumption "sub") THEN BETA_TAC) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN ((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`y - t`))) (term_tac exists_tac)));
1067 ((THENL_FIRST) (split_tac) ((VECTOR_ARITH_TAC) THEN (done_tac)));
1068 ((((use_arg_then2 ("p_int", [])) (disch_tac [])) THEN (clear_assumption "p_int") THEN ((use_arg_then2 ("d_def", [])) (disch_tac [])) THEN (clear_assumption "d_def") THEN ((use_arg_then2 ("y_in", [])) (disch_tac [])) THEN (clear_assumption "y_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1069 ];;
1070
1071 (* Lemma diff2_dir_derivative2 *)
1072 let diff2_dir_derivative2 = Sections.section_proof ["f";"x";"e";"t"]
1073 `diff2 f (x + t % e:real^N) ==>
1074 nth_derivative 2 (f o (\t. x + t % e)) t =
1075 sum (1..dimindex (:N)) (\i. sum (1..dimindex (:N))
1076 (\j. e$i * e$j * (partial j (partial i f) o (\t. x + t % e)) t))`
1077 [
1078 ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(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 ["df"]));
1079 ((((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)));
1080 (((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));
1081 (((fun arg_tac -> arg_tac (Arg_term (`\t. sum (1..dimindex(:N)) (\i. e$i * (partial i f o (\t. x + t % e)) t)`))) (term_tac exists_tac)) THEN (split_tac));
1082 (((use_arg_then2 ("HAS_REAL_DERIVATIVE_SUM", [HAS_REAL_DERIVATIVE_SUM])) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac)));
1083 (((((use_arg_then2 ("SUM_LMUL", [SUM_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LMUL_ATREAL", [HAS_REAL_DERIVATIVE_LMUL_ATREAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
1084 (((use_arg_then2 ("real_dir_derivative_partial", [real_dir_derivative_partial]))(thm_tac (new_rewrite [] []))));
1085 ((((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["r"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xr"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1086 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("open_contains_open_interval", [open_contains_open_interval])) (fun fst_arg -> (use_arg_then2 ("e", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("open_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["in0"])) THEN (move ["sub"]));
1087 (((fun arg_tac -> arg_tac (Arg_term (`real_interval (a + t, b + t)`))) (term_tac exists_tac)) THEN ((((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 (split_tac));
1088 ((((use_arg_then2 ("in0", [])) (disch_tac [])) THEN (clear_assumption "in0") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1089 ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then2 ("diff2_dir_derivative", [diff2_dir_derivative]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))));
1090 ((((use_arg_then2 ("sub", [])) (disch_tac [])) THEN (clear_assumption "sub") THEN BETA_TAC) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN ((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`p - t`))) (term_tac exists_tac)));
1091 ((THENL_FIRST) (split_tac) ((VECTOR_ARITH_TAC) THEN (done_tac)));
1092 ((((use_arg_then2 ("p_in", [])) (disch_tac [])) THEN (clear_assumption "p_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1093 ];;
1094
1095 (* Lemma diff2_has_derivative_partial *)
1096 let diff2_has_derivative_partial = Sections.section_proof ["f";"i";"x";"e";"t"]
1097 `diff2 f (x + t % e:real^N) ==>
1098 (partial i f o (\t. x + t % e) has_real_derivative
1099 sum (1..dimindex (:N)) (\j. e$j * (partial j (partial i f) o (\t. x + t % e)) t)) (atreal t)`
1100 [
1101 ((((use_arg_then2 ("diff2", [diff2]))(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 ["df"]));
1102 (((((use_arg_then2 ("real_dir_derivative_partial", [real_dir_derivative_partial]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1103 ];;
1104
1105 (* Lemma diff2_derivative_partial *)
1106 let diff2_derivative_partial = Sections.section_proof ["f";"i";"x";"e";"t"]
1107 `diff2 f (x + t % e:real^N) ==>
1108 derivative (partial i f o (\t. x + t % e)) t =
1109 sum (1..dimindex (:N)) (\j. e$j * (partial j (partial i f) o (\t. x + t % e)) t)`
1110 [
1111 ((BETA_TAC THEN (move ["df"])) THEN (((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("diff2_has_derivative_partial", [diff2_has_derivative_partial])) (disch_tac [])) THEN (clear_assumption "diff2_has_derivative_partial") THEN (exact_tac)) THEN (done_tac));
1112 ];;
1113
1114 (* Lemma diff2_real_diff_partial *)
1115 let diff2_real_diff_partial = Sections.section_proof ["f";"i";"x";"e";"t"]
1116 `diff2 f (x + t % e:real^N) ==>
1117 partial i f o (\t. x + t % e) real_differentiable atreal t`
1118 [
1119 (BETA_TAC THEN (move ["df2"]));
1120 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2_has_derivative_partial", [diff2_has_derivative_partial])) (fun fst_arg -> (use_arg_then2 ("df2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s"))));
1121 (((((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] [])))) THEN (move ["df"])) THEN ((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (done_tac));
1122 ];;
1123
1124 (* Lemma partial_const *)
1125 let partial_const = Sections.section_proof ["i";"c"]
1126 `partial i (\x:real^N. c) = (\x. &0)`
1127 [
1128 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac));
1129 (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`(\x. c) o (\t. x + t % basis i) = (\x. c)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))));
1130 ((((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1131 (((((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 (done_tac));
1132 ];;
1133
1134 (* Lemma partial_eq0_alt *)
1135 let partial_eq0_alt = Sections.section_proof ["i";"f"]
1136 `~(i IN 1..dimindex (:N)) ==> partial i f = (\x:real^N. &0)`
1137 [
1138 ((BETA_TAC THEN (move ["ih"])) THEN ((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (move ["x"])) THEN (((use_arg_then2 ("partial_eq0", [partial_eq0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1139 ];;
1140
1141 (* Lemma real_mvt0 *)
1142 let real_mvt0 = Sections.section_proof []
1143 `!f f' a. (!x. abs x <= abs a ==> (f has_real_derivative f' x) (atreal x)) ==>
1144 (?t. abs t <= abs a /\ f a - f (&0) = f' t * a)`
1145 [
1146 (BETA_TAC THEN (move ["f"]) THEN (move ["f'"]) THEN (move ["a"]) THEN (move ["h"]));
1147 (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0 <= a`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["a_ineq"]));
1148 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_MVT_VERY_SIMPLE", [REAL_MVT_VERY_SIMPLE])) (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 -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1149 (((((use_arg_then2 ("a_ineq", []))(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 (ANTS_TAC));
1150 (BETA_TAC THEN (move ["x"]) THEN (move ["x_ineq"]));
1151 (((((use_arg_then2 ("HAS_REAL_DERIVATIVE_ATREAL_WITHIN", [HAS_REAL_DERIVATIVE_ATREAL_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1152 (BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["t_ineq"])) THEN (move ["eq"]));
1153 (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1154 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_MVT_VERY_SIMPLE", [REAL_MVT_VERY_SIMPLE])) (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 ("a", [])) (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 arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1155 ((repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (ANTS_TAC));
1156 ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("a_ineq", [])) (disch_tac [])) THEN (clear_assumption "a_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1157 ((BETA_TAC THEN (move ["x"]) THEN (move ["x_ineq"])) THEN ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_ATREAL_WITHIN", [HAS_REAL_DERIVATIVE_ATREAL_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))));
1158 ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1159 (BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["t_ineq"])) THEN (move ["eq"]));
1160 (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("REAL_NEG_SUB", [REAL_NEG_SUB]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_RMUL", [REAL_NEG_RMUL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1161 ];;
1162
1163 (* Lemma mixed_second_partials *)
1164 let mixed_second_partials = Sections.section_proof ["f";"x";"i";"j"]
1165 `diff2c f x ==> partial2 i j f x = partial2 j i f (x:real^N)`
1166 [
1167 (((((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["pc"]))));
1168 ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i IN 1..dimindex (:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["ih"])));
1169 (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("partial_eq0_alt", [partial_eq0_alt])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("partial_const", [partial_const]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1170 ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`j IN 1..dimindex (:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["jh"])));
1171 (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("partial_eq0_alt", [partial_eq0_alt])) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("partial_const", [partial_const]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1172 ((((use_arg_then2 ("jh", [])) (disch_tac [])) THEN (clear_assumption "jh") THEN ((use_arg_then2 ("ih", [])) (disch_tac [])) THEN (clear_assumption "ih") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (move ["ih"]) THEN (move ["jh"])));
1173 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(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 ["d2f"])));
1174 ((fun arg_tac -> arg_tac (Arg_term (`\h k. f ((x + k % basis j) + h % basis i) - f (x + k % basis j)`))) (term_tac (set_tac "F1")));
1175 ((fun arg_tac -> arg_tac (Arg_term (`\k h. f ((x + h % basis i) + k % basis j) - f (x + h % basis i)`))) (term_tac (set_tac "F2")));
1176 ((fun arg_tac -> arg_tac (Arg_term (`\h k. F1 h k - F1 h (&0)`))) (term_tac (set_tac "G")));
1177 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`!h k. (x + k % basis j) + h % basis i = (x + h % basis i) + k % basis j`))) (term_tac (have_gen_tac [](move ["v_eq"])))) ((VECTOR_ARITH_TAC) THEN (done_tac)));
1178 ((fun arg_tac -> arg_tac (Arg_term (`G = \h k. F2 k h - F2 k (&0)`))) (term_tac (have_gen_tac [](move ["G_eq"]))));
1179 ((repeat_tactic 2 0 (((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["h"]) THEN (move ["k"]));
1180 (((((use_arg_then2 ("G_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("F2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("F1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1181 ((fun arg_tac -> arg_tac (Arg_term (`?r. &0 < r /\ (!h k. abs h <= r /\ abs k <= r ==> (x + h % basis i) + k % basis j IN s)`))) (term_tac (have_gen_tac [](case THEN ((move ["r"]) THEN (case THEN ((move ["r0"]) THEN (move ["rs"]))))))));
1182 ((((use_arg_then2 ("open_s", [])) (disch_tac [])) THEN (clear_assumption "open_s") THEN BETA_TAC) THEN (((((use_arg_then2 ("OPEN_CONTAINS_BALL", [OPEN_CONTAINS_BALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_BALL", [IN_BALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (case THEN (move ["e"])) THEN (case THEN ((move ["e0"]) THEN (move ["de"])))));
1183 ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`e / &3`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then2 ("e0", [])) (disch_tac [])) THEN (clear_assumption "e0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1184 (BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"]));
1185 ((((use_arg_then2 ("de", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("VECTOR_SUB_RADD", [VECTOR_SUB_RADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_NEG", [NORM_NEG]))(thm_tac (new_rewrite [] [])))));
1186 ((THENL_LAST) ((((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`e / &3 + e / &3`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then2 ("e0", [])) (disch_tac [])) THEN (clear_assumption "e0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1187 ((THENL_LAST) ((((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 h + abs k`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1188 ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("NORM_TRIANGLE", [NORM_TRIANGLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`h % basis i:real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`k % basis j:real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1189 (((repeat_tactic 1 9 (((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NORM_BASIS", [NORM_BASIS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1190 ((fun arg_tac -> arg_tac (Arg_term (`(!h. abs h <= r ==> x + h % basis i IN s) /\ (!k. abs k <= r ==> x + k % basis j IN s)`))) (term_tac (have_gen_tac [](move ["in_s"]))));
1191 ((THENL) (split_tac) [((move ["h"]) THEN (move ["h_ineq"])); ((move ["k"]) THEN (move ["k_ineq"]))]);
1192 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("rs", [])) (fun fst_arg -> (use_arg_then2 ("h", [])) (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))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h_ineq", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("r0", [])) (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1193 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("rs", [])) (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 -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("k_ineq", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("r0", [])) (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1194 ((fun arg_tac -> arg_tac (Arg_term (`!h. F1 h = (\k. (f o (\k. (x + h % basis i) + k % basis j)) k - (f o (\k. x + k % basis j)) k)`))) (term_tac (have_gen_tac [](move ["F1h"]))));
1195 (((((use_arg_then2 ("F1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1196 ((fun arg_tac -> arg_tac (Arg_term (`!h. abs h <= r ==> !k. abs k <= r ==> (F1 h) real_differentiable atreal k`))) (term_tac (have_gen_tac [](move ["dF1"]))));
1197 (BETA_TAC THEN (move ["h"]) THEN (move ["h_ineq"]) THEN (move ["k"]) THEN (move ["k_ineq"]));
1198 (((((use_arg_then2 ("F1h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_SUB", [REAL_DIFFERENTIABLE_SUB]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
1199 (((repeat_tactic 1 9 (((use_arg_then2 ("diff2_imp_real_diff", [diff2_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1200 ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==>
1201 derivative (F1 h) k = partial j f ((x + h % basis i) + k % basis j) - partial j f (x + k % basis j)`))) (term_tac (have_gen_tac [](move ["F1_der"]))));
1202 ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then2 ("F1h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_sub", [derivative_sub]))(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 ("diff2_imp_real_diff", [diff2_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
1203 (((((use_arg_then2 ("derivative_translation", [derivative_translation]))(thm_tac (new_rewrite [] [(`derivative (f o (\k. x + k % basis j)) k`)])))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("derivative_translation", [derivative_translation]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("diff2_imp_real_diff", [diff2_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
1204 ((fun arg_tac -> arg_tac (Arg_term (`!y e. (f o (\k. y + k % e)) o (\t. k + t) = f o (\t. (y + k % e) + t % e)`))) (term_tac (have_gen_tac [](move ["eq"]))));
1205 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1206 (((repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("partial", [partial]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac));
1207 ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==>
1208 (?t1. G h k = k * derivative (F1 h) t1 /\ abs t1 <= abs k)`))) (term_tac (have_gen_tac [](move ["Gh"]))));
1209 ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then2 ("G_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)));
1210 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_mvt0", [real_mvt0])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`F1 h`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative (F1 h)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1211 (ANTS_TAC);
1212 ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN ((((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dF1", []))(thm_tac (new_rewrite [] []))))));
1213 ((((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1214 (BETA_TAC THEN (case THEN (move ["t1"])) THEN (case THEN (move ["t1_ineq"])) THEN (move ["eq"]));
1215 (((use_arg_then2 ("t1", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t1_ineq", [])) (disch_tac [])) THEN (clear_assumption "t1_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1216 ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==>
1217 (?t1 t2. G h k = h * k * partial i (partial j f) (x + t1 % basis j + t2 % basis i)
1218 /\ abs t1 <= abs k /\ abs t2 <= abs h)`))) (term_tac (have_gen_tac [](move ["Ghk"]))));
1219 (BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"]));
1220 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Gh", [])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t1"])) THEN (case THEN ((move ["eq"]) THEN (move ["t1k"])))));
1221 ((THENL) ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (((use_arg_then2 ("F1_der", []))(thm_tac (new_rewrite [] []))))) [((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t1k", [])) (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (move ["eq"]))]);
1222 ((fun arg_tac -> arg_tac (Arg_term (`partial j f o (\h. (x + t1 % basis j) + h % basis i)`))) (term_tac (set_tac "g")));
1223 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_mvt0", [real_mvt0])) (fun fst_arg -> (use_arg_then2 ("g", [])) (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 -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1224 (ANTS_TAC);
1225 ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] [])))));
1226 ((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("diff2_partial_real_diff", [diff2_partial_real_diff]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] [])))));
1227 ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then2 ("t1k", [])) (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1228 (BETA_TAC THEN (case THEN (move ["t2"])) THEN (case THEN (move ["t2_ineq"])) THEN (move ["g_eq"]));
1229 ((THENL_LAST) ((((use_arg_then2 ("t1", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("t2", [])) (term_tac exists_tac))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t2_ineq", [])) (disch_tac [])) THEN (clear_assumption "t2_ineq") THEN ((use_arg_then2 ("t1k", [])) (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1230 ((fun arg_tac -> arg_tac (Arg_term (`_1 - _2`))) (term_tac (set_tac "p")));
1231 ((fun arg_tac -> arg_tac (Arg_term (`p = g h - g (&0)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
1232 (((((use_arg_then2 ("p_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1233 ((((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. k * a * h = h * k * a`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] []))))));
1234 (((((use_arg_then2 ("REAL_EQ_MUL_LCANCEL", [REAL_EQ_MUL_LCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISJ2_TAC));
1235 (((use_arg_then2 ("derivative_translation", [derivative_translation]))(thm_tac (new_rewrite [] []))));
1236 (((((use_arg_then2 ("diff2_partial_real_diff", [diff2_partial_real_diff]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t2_ineq", [])) (disch_tac [])) THEN (clear_assumption "t2_ineq") THEN ((use_arg_then2 ("t1k", [])) (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1237 ((((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] [])))) THEN (AP_THM_TAC) THEN (AP_TERM_TAC));
1238 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac));
1239 (((use_arg_then2 ("F1_def", [])) (disch_tac [])) THEN (clear_assumption "F1_def") THEN ((use_arg_then2 ("G_def", [])) (disch_tac [])) THEN (clear_assumption "G_def") THEN ((use_arg_then2 ("F1h", [])) (disch_tac [])) THEN (clear_assumption "F1h") THEN ((use_arg_then2 ("dF1", [])) (disch_tac [])) THEN (clear_assumption "dF1") THEN ((use_arg_then2 ("F1_der", [])) (disch_tac [])) THEN (clear_assumption "F1_der") THEN ((use_arg_then2 ("Gh", [])) (disch_tac [])) THEN (clear_assumption "Gh") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]));
1240 ((fun arg_tac -> arg_tac (Arg_term (`!k. F2 k = (\h. (f o (\h. (x + k % basis j) + h % basis i)) h - (f o (\h. x + h % basis i)) h)`))) (term_tac (have_gen_tac [](move ["F2h"]))));
1241 (((((use_arg_then2 ("F2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1242 ((fun arg_tac -> arg_tac (Arg_term (`!k. abs k <= r ==> !h. abs h <= r ==> (F2 k) real_differentiable atreal h`))) (term_tac (have_gen_tac [](move ["dF2"]))));
1243 (BETA_TAC THEN (move ["k"]) THEN (move ["k_ineq"]) THEN (move ["h"]) THEN (move ["h_ineq"]));
1244 (((((use_arg_then2 ("F2h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_SUB", [REAL_DIFFERENTIABLE_SUB]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
1245 (((repeat_tactic 1 9 (((use_arg_then2 ("diff2_imp_real_diff", [diff2_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1246 ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==>
1247 derivative (F2 k) h = partial i f ((x + k % basis j) + h % basis i) - partial i f (x + h % basis i)`))) (term_tac (have_gen_tac [](move ["F2_der"]))));
1248 ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then2 ("F2h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_sub", [derivative_sub]))(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 ("diff2_imp_real_diff", [diff2_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
1249 (((((use_arg_then2 ("v_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("derivative_translation", [derivative_translation]))(thm_tac (new_rewrite [] [(`derivative (f o (\h. x + h % basis i)) h`)])))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("derivative_translation", [derivative_translation]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("diff2_imp_real_diff", [diff2_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("v_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))));
1250 ((fun arg_tac -> arg_tac (Arg_term (`!y e. (f o (\h. y + h % e)) o (\t. h + t) = f o (\t. (y + h % e) + t % e)`))) (term_tac (have_gen_tac [](move ["eq"]))));
1251 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1252 (((repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("partial", [partial]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac));
1253 ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==>
1254 (?t3. G h k = h * derivative (F2 k) t3 /\ abs t3 <= abs h)`))) (term_tac (have_gen_tac [](move ["Gk"]))));
1255 ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then2 ("G_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)));
1256 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_mvt0", [real_mvt0])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`F2 k`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative (F2 k)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1257 (ANTS_TAC);
1258 ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN ((((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dF2", []))(thm_tac (new_rewrite [] []))))));
1259 ((((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1260 (BETA_TAC THEN (case THEN (move ["t3"])) THEN (case THEN (move ["t3_ineq"])) THEN (move ["eq"]));
1261 (((use_arg_then2 ("t3", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t3_ineq", [])) (disch_tac [])) THEN (clear_assumption "t3_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1262 ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==>
1263 (?t3 t4. G h k = h * k * partial j (partial i f) (x + t4 % basis j + t3 % basis i)
1264 /\ abs t3 <= abs h /\ abs t4 <= abs k)`))) (term_tac (have_gen_tac [](move ["Gkh"]))));
1265 (BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"]));
1266 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Gk", [])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t3"])) THEN (case THEN ((move ["eq"]) THEN (move ["t3h"])))));
1267 ((THENL) ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (((use_arg_then2 ("F2_der", []))(thm_tac (new_rewrite [] []))))) [((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t3h", [])) (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (move ["eq"]))]);
1268 ((fun arg_tac -> arg_tac (Arg_term (`partial i f o (\k. (x + t3 % basis i) + k % basis j)`))) (term_tac (set_tac "g")));
1269 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_mvt0", [real_mvt0])) (fun fst_arg -> (use_arg_then2 ("g", [])) (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 -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1270 (ANTS_TAC);
1271 ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] [])))));
1272 ((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("diff2_partial_real_diff", [diff2_partial_real_diff]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] [])))));
1273 ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then2 ("t3h", [])) (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1274 (BETA_TAC THEN (case THEN (move ["t4"])) THEN (case THEN (move ["t4_ineq"])) THEN (move ["g_eq"]));
1275 ((THENL_LAST) ((((use_arg_then2 ("t3", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("t4", [])) (term_tac exists_tac))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t4_ineq", [])) (disch_tac [])) THEN (clear_assumption "t4_ineq") THEN ((use_arg_then2 ("t3h", [])) (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1276 ((fun arg_tac -> arg_tac (Arg_term (`_1 - _2`))) (term_tac (set_tac "p")));
1277 ((fun arg_tac -> arg_tac (Arg_term (`p = g k - g (&0)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
1278 (((((use_arg_then2 ("p_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1279 ((((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. h * a * k = h * k * a`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] []))))));
1280 (((((use_arg_then2 ("REAL_EQ_MUL_LCANCEL", [REAL_EQ_MUL_LCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISJ2_TAC));
1281 (((use_arg_then2 ("derivative_translation", [derivative_translation]))(thm_tac (new_rewrite [] []))));
1282 (((((use_arg_then2 ("diff2_partial_real_diff", [diff2_partial_real_diff]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t4_ineq", [])) (disch_tac [])) THEN (clear_assumption "t4_ineq") THEN ((use_arg_then2 ("t3h", [])) (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1283 ((((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] [])))) THEN (AP_THM_TAC) THEN (AP_TERM_TAC));
1284 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (move ["y"]));
1285 ((AP_TERM_TAC) THEN (VECTOR_ARITH_TAC) THEN (done_tac));
1286 (((use_arg_then2 ("F2_def", [])) (disch_tac [])) THEN (clear_assumption "F2_def") THEN ((use_arg_then2 ("G_eq", [])) (disch_tac [])) THEN (clear_assumption "G_eq") THEN ((use_arg_then2 ("F2h", [])) (disch_tac [])) THEN (clear_assumption "F2h") THEN ((use_arg_then2 ("dF2", [])) (disch_tac [])) THEN (clear_assumption "dF2") THEN ((use_arg_then2 ("F2_der", [])) (disch_tac [])) THEN (clear_assumption "F2_der") THEN ((use_arg_then2 ("Gk", [])) (disch_tac [])) THEN (clear_assumption "Gk") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]));
1287 ((fun arg_tac -> arg_tac (Arg_term (`(vec 0:real^2) limit_point_of {y | &0 < y$1 /\ &0 < y$2}`))) (term_tac (have_gen_tac [](move ["lim0"]))));
1288 (((((use_arg_then2 ("limit_point_of", [limit_point_of]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("OPEN_CONTAINS_BALL", [OPEN_CONTAINS_BALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_BALL", [IN_BALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN (move ["t"]) THEN (case THEN (move ["v0t"])));
1289 (((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("v0t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC THEN (case THEN (move ["e"])) THEN (case THEN (move ["e0"])) THEN (move ["in_t"]));
1290 ((fun arg_tac -> arg_tac (Arg_term (`e / &2 % (vec 1:real^2)`))) (term_tac (set_tac "y")));
1291 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`!i. y$i = e / (&2)`))) (term_tac (have_gen_tac [](move ["yc"])))) (((((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VEC_COMPONENT", [VEC_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
1292 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < e / (&2)`))) (term_tac (have_gen_tac [](move ["ineq"])))) (((((use_arg_then2 ("REAL_LT_DIV", [REAL_LT_DIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e0", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)));
1293 ((fun arg_tac -> arg_tac (Arg_term (`infnorm y = e / &2`))) (term_tac (have_gen_tac [](move ["inf_y"]))));
1294 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL INFNORM_2)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("yc", []))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL (CONJUNCT2 REAL_MAX_ACI))))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_REFL", [REAL_ABS_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_LT", [REAL_LE_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1295 ((THENL_FIRST) (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (split_tac)) (((((use_arg_then2 ("INFNORM_EQ_0", [INFNORM_EQ_0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inf_y", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1296 ((THENL_FIRST) (split_tac) (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("yc", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
1297 ((((use_arg_then2 ("in_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`e * inv(&2) * sqrt(&2)`))) (term_tac exists_tac)) THEN (split_tac));
1298 ((((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 (`infnorm y * sqrt (&2)`))) (term_tac exists_tac)) THEN (split_tac));
1299 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_MUL_AC)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_SUB", [NORM_SUB]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_RZERO)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIMINDEX_2", [DIMINDEX_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NORM_LE_INFNORM", [NORM_LE_INFNORM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1300 (((((use_arg_then2 ("inf_y", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1301 ((((fun arg_tac -> (use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID])) (fun fst_arg -> (use_arg_then2 ("e", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("REAL_LT_LMUL", [REAL_LT_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
1302 (((((fun arg_tac -> (use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_LMUL", [REAL_LT_LMUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_INV", [REAL_LT_INV]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (TRY ((arith_tac))));
1303 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&2 = sqrt (&2 * &2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [2] []))))))) (((((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POW_2_SQRT_ABS", [POW_2_SQRT_ABS]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)));
1304 ((((use_arg_then2 ("SQRT_MONO_LT", [SQRT_MONO_LT]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac));
1305 ((fun arg_tac -> arg_tac (Arg_term (`((\y:real^2. lift (G (y$1) (y$2) / (y$1 * y$2))) --> lift (partial j (partial i f) x))
1306 (at (vec 0) within {y | &0 < y$1 /\ &0 < y$2})`))) (term_tac (have_gen_tac [](move ["lim_ji"]))));
1307 ((((use_arg_then2 ("LIM_WITHIN", [LIM_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (move ["e"]) THEN (move ["e_gt0"]));
1308 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("pc", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL continuous_at)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["e_ineq"])));
1309 ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`min r (d / &2)`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("REAL_LT_MIN", [REAL_LT_MIN]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN ((use_arg_then2 ("r0", [])) (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1310 (((simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_RZERO)))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (move ["ineq"]));
1311 ((fun arg_tac -> arg_tac (Arg_term (`&0 < abs (y$1) /\ &0 < abs (y$2)`))) (term_tac (have_gen_tac [](move ["y0"]))));
1312 ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z_ineq"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["_"])));
1313 ((((use_arg_then2 ("z_ineq", [])) (disch_tac [])) THEN (clear_assumption "z_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1314 ((fun arg_tac -> arg_tac (Arg_term (`abs (y$1) <= r /\ abs (y$2) <= r /\ abs (y$1) < d / &2 /\ abs (y$2) < d / &2`))) (term_tac (have_gen_tac [](move ["yr"]))));
1315 ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`infnorm y < min r (d / &2)`))) (term_tac (have_gen_tac []ALL_TAC)))) ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL INFNORM_2)))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)));
1316 ((((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`norm y`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("INFNORM_LE_NORM", [INFNORM_LE_NORM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1317 ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Gkh", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y$1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y$2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1318 (((repeat_tactic 1 9 (((use_arg_then2 ("yr", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t1"])) THEN (case THEN (move ["t2"])) THEN (case THEN (move ["G_eq"])) THEN (move ["t_ineq"]));
1319 ((((use_arg_then2 ("G_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_MUL_AC)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (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_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))));
1320 ((((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y0", [])) (disch_tac [])) THEN (clear_assumption "y0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1321 ((((use_arg_then2 ("e_ineq", [])) (disch_tac [])) THEN (clear_assumption "e_ineq") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_SUB)))(thm_tac (new_rewrite [] [])))));
1322 ((((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`norm (t2 % basis j:real^N) + norm (t1 % basis i:real^N)`))) (term_tac exists_tac)));
1323 ((((use_arg_then2 ("NORM_TRIANGLE", [NORM_TRIANGLE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NORM_BASIS", [NORM_BASIS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))));
1324 ((((use_arg_then2 ("yr", [])) (disch_tac [])) THEN (clear_assumption "yr") THEN ((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1325 ((fun arg_tac -> arg_tac (Arg_term (`((\y:real^2. lift (G (y$1) (y$2) / (y$1 * y$2))) --> lift (partial i (partial j f) x))
1326 (at (vec 0) within {y | &0 < y$1 /\ &0 < y$2})`))) (term_tac (have_gen_tac [](move ["lim_ij"]))));
1327 ((((use_arg_then2 ("LIM_WITHIN", [LIM_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (move ["e"]) THEN (move ["e_gt0"]));
1328 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("pc", [])) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL continuous_at)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["e_ineq"])));
1329 ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`min r (d / &2)`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("REAL_LT_MIN", [REAL_LT_MIN]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN ((use_arg_then2 ("r0", [])) (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1330 (((simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_RZERO)))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (move ["ineq"]));
1331 ((fun arg_tac -> arg_tac (Arg_term (`&0 < abs (y$1) /\ &0 < abs (y$2)`))) (term_tac (have_gen_tac [](move ["y0"]))));
1332 ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z_ineq"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["_"])));
1333 ((((use_arg_then2 ("z_ineq", [])) (disch_tac [])) THEN (clear_assumption "z_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1334 ((fun arg_tac -> arg_tac (Arg_term (`abs (y$1) <= r /\ abs (y$2) <= r /\ abs (y$1) < d / &2 /\ abs (y$2) < d / &2`))) (term_tac (have_gen_tac [](move ["yr"]))));
1335 ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`infnorm y < min r (d / &2)`))) (term_tac (have_gen_tac []ALL_TAC)))) ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL INFNORM_2)))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)));
1336 ((((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`norm y`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("INFNORM_LE_NORM", [INFNORM_LE_NORM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1337 ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Ghk", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y$1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y$2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1338 (((repeat_tactic 1 9 (((use_arg_then2 ("yr", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t1"])) THEN (case THEN (move ["t2"])) THEN (case THEN (move ["G_eq"])) THEN (move ["t_ineq"]));
1339 ((((use_arg_then2 ("G_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_MUL_AC)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (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_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))));
1340 ((((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y0", [])) (disch_tac [])) THEN (clear_assumption "y0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1341 ((((use_arg_then2 ("e_ineq", [])) (disch_tac [])) THEN (clear_assumption "e_ineq") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_SUB)))(thm_tac (new_rewrite [] [])))));
1342 ((((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`norm (t1 % basis j:real^N) + norm (t2 % basis i:real^N)`))) (term_tac exists_tac)));
1343 ((((use_arg_then2 ("NORM_TRIANGLE", [NORM_TRIANGLE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NORM_BASIS", [NORM_BASIS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))));
1344 ((((use_arg_then2 ("yr", [])) (disch_tac [])) THEN (clear_assumption "yr") THEN ((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1345 ((((use_arg_then2 ("LIFT_EQ", [LIFT_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> (use_arg_then2 ("LIM_UNIQUE", [LIM_UNIQUE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`at (vec 0:real^2) within {y:real^2 | &0 < y$1 /\ &0 < y$2}`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)));
1346 ((fun arg_tac -> arg_tac (Arg_term (`\y:real^2. lift (G (y$1) (y$2) / (y$1 * y$2))`))) (term_tac exists_tac));
1347 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL TRIVIAL_LIMIT_WITHIN)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lim0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1348 ];;
1349 let m_cell_domain = new_definition `m_cell_domain (x:real^N, z:real^N) (y:real^N) (w:real^N) <=>
1350 !i. i IN 1..dimindex (:N) ==> x$i <= y$i /\ y$i <= z$i /\ max (y$i - x$i) (z$i - y$i) <= w$i`;;
1351 let m_bounded_on_int = new_definition `m_bounded_on_int (f:real^N->real) domain f_bounds <=>
1352 !x. x IN interval [domain] ==> interval_arith (f x) f_bounds`;;
1353 let diff2_domain = new_definition `diff2_domain domain f <=>
1354 !x. x IN interval [domain] ==> diff2 f x`;;
1355 let diff2c_domain = new_definition `diff2c_domain domain f <=>
1356 !x. x IN interval [domain] ==> diff2c f x`;;
1357
1358 (* Lemma diff2c_domain_alt *)
1359 let diff2c_domain_alt = Sections.section_proof ["f";"domain"]
1360 `diff2c_domain domain f <=> diff2_domain domain f /\
1361 (!x. x IN interval [domain] ==> !i j. (lift o partial2 j i f) continuous at x)`
1362 [
1363 (((((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [(move ["h1"]); ((case THEN ((move ["h1"]) THEN (move ["h2"]))) THEN (move ["x"]) THEN (move ["h3"]))]));
1364 (((split_tac) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("h1", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (simp_tac)) THEN (done_tac));
1365 ((((fun arg_tac -> (use_arg_then2 ("h1", [])) (fun fst_arg -> (use_arg_then2 ("h3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("h2", [])) (fun fst_arg -> (use_arg_then2 ("h3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac));
1366 ];;
1367
1368 (* Lemma y_in_domain *)
1369 let y_in_domain = Sections.section_proof ["domain";"y";"w"]
1370 `m_cell_domain domain y w ==> y IN interval [domain]`
1371 [
1372 ((((use_arg_then2 ("domain", [])) (disch_tac [])) THEN (clear_assumption "domain") THEN case THEN (move ["x"]) THEN (move ["z"])) THEN (((((use_arg_then2 ("m_cell_domain", [m_cell_domain]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (move ["ineqs"]) THEN (move ["i"])));
1373 (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("ineqs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac));
1374 ];;
1375
1376 (* Lemma domain_width *)
1377 let domain_width = Sections.section_proof ["p";"domain";"y";"w"]
1378 `m_cell_domain domain y (w:real^N) ==>
1379 p IN interval [domain] ==>
1380 !i. i IN 1..dimindex (:N) ==> abs (p$i - y$i) <= w$i`
1381 [
1382 ((((use_arg_then2 ("domain", [])) (disch_tac [])) THEN (clear_assumption "domain") THEN case THEN (move ["x"]) THEN (move ["z"])) THEN ((((use_arg_then2 ("m_cell_domain", [m_cell_domain]))(thm_tac (new_rewrite [] [])))) THEN (move ["ineqs"]) THEN (move ["p_in"]) THEN (move ["i"]) THEN (move ["i_in"])));
1383 ((((fun arg_tac -> (use_arg_then2 ("ineqs", [])) (fun fst_arg -> (use_arg_then2 ("i_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("p_in", [])) (disch_tac [])) THEN (clear_assumption "p_in") THEN BETA_TAC) THEN (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("i_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (arith_tac) THEN (done_tac));
1384 ];;
1385
1386 (* Lemma sum_swap1 *)
1387 let sum_swap1 = Sections.section_proof ["g";"n"]
1388 `sum (1..n) (\i. sum (i + 1..n) (\j. g i j)) =
1389 sum (1..n) (\i. sum (1..i - 1) (\j. g j i))`
1390 [
1391 ((repeat_tactic 1 9 (((use_arg_then2 ("SUM_SUM_PRODUCT", [SUM_SUM_PRODUCT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))));
1392 ((fun arg_tac -> arg_tac (Arg_term (`{i, j | (1 <= i /\ i <= n) /\ i + 1 <= j /\ j <= n}`))) (term_tac (set_tac "s1")));
1393 ((fun arg_tac -> arg_tac (Arg_term (`{i, j | (1 <= i /\ i <= n) /\ 1 <= j /\ j <= i - 1}`))) (term_tac (set_tac "s2")));
1394 ((fun arg_tac -> arg_tac (Arg_term (`\(i,j):num#num. j, i`))) (term_tac (set_tac "f")));
1395 ((fun arg_tac -> arg_tac (Arg_term (`s1 = IMAGE f s2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
1396 ((((((use_arg_then2 ("s1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["p"])) THEN (split_tac));
1397 (BETA_TAC THEN (case THEN (move ["i"])) THEN (case THEN (move ["j"])) THEN (case THEN (move ["ineq"])) THEN (move ["p_eq"]));
1398 (((fun arg_tac -> arg_tac (Arg_term (`j, i`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("p_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("j", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("i", [])) (term_tac exists_tac))) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1399 (BETA_TAC THEN (case THEN (move ["p1"])) THEN (case THEN (move ["p_eq"])) THEN (case THEN (move ["i"])) THEN (case THEN (move ["j"])) THEN (case THEN (move ["ineq"])) THEN (move ["p1_eq"]));
1400 ((((use_arg_then2 ("j", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("i", [])) (term_tac exists_tac))) THEN ((((use_arg_then2 ("p_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("p1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1401 ((fun arg_tac -> arg_tac (Arg_term (`(\(i,j). g j i) = (\(i,j). g i j) o f`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
1402 (((((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 (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN case THEN (done_tac));
1403 (((use_arg_then2 ("SUM_IMAGE", [SUM_IMAGE])) (thm_tac apply_tac)) THEN (case THEN (move ["i1"]) THEN (move ["j1"])) THEN (case THEN (move ["i2"]) THEN (move ["j2"])));
1404 ((((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac));
1405 ];;
1406
1407 (* Lemma m_taylor_error_eq *)
1408 let m_taylor_error_eq = Sections.section_proof ["f";"domain";"w";"error"]
1409 `diff2c_domain domain f ==>
1410 (m_taylor_error f domain (w:real^N) error <=>
1411 (!x. x IN interval [domain] ==>
1412 sum (1..dimindex (:N)) (\i. w$i * (w$i * abs (partial2 i i f x)
1413 + &2 * sum (1..i - 1) (\j. w$j * abs (partial2 j i f x)))) <= error))`
1414 [
1415 (((((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("m_taylor_error", [m_taylor_error]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]));
1416 ((fun arg_tac -> arg_tac (Arg_term (`!g1 g2. (!x. x IN interval [domain] ==> g1 x = g2 x) ==>
1417 ((!x. x IN interval [domain] ==> g1 x <= error) <=> (!x. x IN interval [domain] ==> g2 x <= error))`))) (term_tac (have_gen_tac [](move ["eq"]))));
1418 ((BETA_TAC THEN (move ["g1"]) THEN (move ["g2"]) THEN (move ["eq"])) THEN ((split_tac) THEN (move ["cond"]) THEN (move ["x"]) THEN (move ["Px"])));
1419 (((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("cond", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1420 (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("cond", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1421 (((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN (DISCH_THEN apply_tac) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("d2f", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["d2fx"]));
1422 ((fun arg_tac -> arg_tac (Arg_term (`\i j. w$i * w$j * abs (partial2 j i f x)`))) (term_tac (set_tac "g")));
1423 ((fun arg_tac -> arg_tac (Arg_term (`dimindex (:N)`))) (term_tac (set_tac "n")));
1424 ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s1")));
1425 ((fun arg_tac -> arg_tac (Arg_term (`s1 = sum (1..n) (\i. sum (1..n) (\j. g i j))`))) (term_tac (have_gen_tac [](move ["s1_eq"]))));
1426 ((((use_arg_then2 ("s1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["i"]) THEN (simp_tac) THEN (move ["i_in"])));
1427 (((((use_arg_then2 ("SUM_LMUL", [SUM_LMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (done_tac));
1428 ((((use_arg_then2 ("REAL_MUL_2", [REAL_MUL_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ADD_LDISTRIB", [REAL_ADD_LDISTRIB]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_LMUL", [SUM_LMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_ADD_NUMSEG", [SUM_ADD_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
1429 ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s2")));
1430 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`s2 = sum (1..n) (\i. g i i + sum (1..i - 1) (\j. g i j))`))) (term_tac (have_gen_tac [](move ["s2_eq"])))) (((((use_arg_then2 ("s2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)));
1431 ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s3")));
1432 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`s3 = sum (1..n) (\i. sum (1..i - 1) (\j. g i j))`))) (term_tac (have_gen_tac [](move ["s3_eq"])))) (((((use_arg_then2 ("s3_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)));
1433 (((use_arg_then2 ("s3_def", [])) (disch_tac [])) THEN (clear_assumption "s3_def") THEN ((use_arg_then2 ("s2_def", [])) (disch_tac [])) THEN (clear_assumption "s2_def") THEN ((use_arg_then2 ("s1_def", [])) (disch_tac [])) THEN (clear_assumption "s1_def") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]));
1434 (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`s3 = sum (1..n) (\i. sum (i + 1..n) (\j. g i j))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))));
1435 (((((use_arg_then2 ("s2_eq", []))(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 ("s1_eq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["i"]) THEN (simp_tac)) THEN ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["i_ineq"])));
1436 (((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c. (a + b) + c = (a + c) + b`)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SUM_SING_NUMSEG", [SUM_SING_NUMSEG])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`g i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i", [])) (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]))));
1437 ((THENL_FIRST) ((((use_arg_then2 ("SUM_COMBINE_R", [SUM_COMBINE_R]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_ineq", []))(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac)));
1438 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_ADD_AC)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_COMBINE_L", [SUM_COMBINE_L]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("i_ineq", [])) (disch_tac [])) THEN (clear_assumption "i_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1439 (((((use_arg_then2 ("s3_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sum_swap1", [sum_swap1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["i"]) THEN (move ["_"]) THEN (simp_tac)) THEN (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["j"]) THEN (move ["_"]) THEN (simp_tac)));
1440 (((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c. a * b * c = b * a * c`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_EQ_MUL_LCANCEL", [REAL_EQ_MUL_LCANCEL]))(thm_tac (new_rewrite [] [])))))) THEN (DISJ2_TAC) THEN (DISJ2_TAC));
1441 ((((use_arg_then2 ("mixed_second_partials", [mixed_second_partials]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1442 ];;
1443
1444 (* Lemma diff2_derivative2_bound *)
1445 let diff2_derivative2_bound = Sections.section_proof ["domain";"y";"w";"p";"f";"dd_bound"]
1446 `m_cell_domain domain y (w:real^N) ==>
1447 p IN interval [domain] ==>
1448 diff2_domain domain f ==>
1449 m_taylor_error f domain w dd_bound ==>
1450 (!t. interval_arith t (&0, &1) ==>
1451 abs (nth_derivative 2 (f o (\t. y + t % (p - y))) t) <= dd_bound)`
1452 [
1453 (((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("m_taylor_error", [m_taylor_error]))(thm_tac (new_rewrite [] []))))) THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["boundedH"]) THEN (move ["t"]) THEN (move ["t_in"]));
1454 ((fun arg_tac -> arg_tac (Arg_term (`y + t % (p - y) IN interval [domain]`))) (term_tac (have_gen_tac [](move ["pt_in"]))));
1455 ((((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_CONVEX_SET", [IN_CONVEX_SET]))(thm_tac (new_rewrite [] [])))));
1456 (((((fun arg_tac -> (use_arg_then2 ("y_in_domain", [y_in_domain])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("p_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("t_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONVEX_INTERVAL", [CONVEX_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1457 ((((use_arg_then2 ("diff2_dir_derivative2", [diff2_dir_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
1458 (((((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("boundedH", [])) (fun fst_arg -> (use_arg_then2 ("pt_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC));
1459 (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s1"))) THEN (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s2"))) THEN (move ["i1"])));
1460 ((((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 ("s1", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("i1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s2_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))));
1461 (((((use_arg_then2 ("SUM_ABS_LE", [SUM_ABS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac));
1462 (((((use_arg_then2 ("SUM_LMUL", [SUM_LMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_ABS_LE", [SUM_ABS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["j_ineq"]) THEN (simp_tac));
1463 (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_ABS_MUL", [REAL_ABS_MUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_MUL2", [REAL_LE_MUL2]))(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 1 9 (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("domain_width", [domain_width])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1464 ];;
1465
1466 (* Lemma m_taylor_error_lemma *)
1467 let m_taylor_error_lemma = Sections.section_proof ["domain";"y";"w";"p";"f";"dd_bound"]
1468 `m_cell_domain domain y (w:real^N) ==>
1469 p IN interval [domain] ==>
1470 diff2_domain domain f ==>
1471 m_taylor_error f domain w dd_bound ==>
1472 abs (f p - (f y + sum (1..dimindex (:N)) (\i. (p - y)$i * partial i f y))) <= dd_bound / &2`
1473 [
1474 ((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (BETA_TAC THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["taylor_error"])));
1475 ((fun arg_tac -> arg_tac (Arg_term (`!t. interval_arith t (&0, &1) ==> y + t % (p - y) IN interval [domain]`))) (term_tac (have_gen_tac [](move ["pt_in"]))));
1476 ((BETA_TAC THEN (move ["t"]) THEN (move ["t_in"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_CONVEX_SET", [IN_CONVEX_SET]))(thm_tac (new_rewrite [] []))))));
1477 (((((fun arg_tac -> (use_arg_then2 ("y_in_domain", [y_in_domain])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("p_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("t_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONVEX_INTERVAL", [CONVEX_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1478 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_taylor2_bound", [real_taylor2_bound])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f o (\t. y + t % (p - y))`))) (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))) (disch_tac [])) THEN BETA_TAC);
1479 ((THENL_FIRST) (ANTS_TAC) (((((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))) THEN (move ["t"]) THEN (move ["t_in"])) THEN ((((use_arg_then2 ("diff2_dir", [diff2_dir]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pt_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
1480 ((THENL_FIRST) (ANTS_TAC) ((((fun arg_tac -> (use_arg_then2 ("diff2_derivative2_bound", [diff2_derivative2_bound])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
1481 ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LID", [VECTOR_MUL_LID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_ADD2)))(thm_tac (new_rewrite [] [])))));
1482 ((THENL_FIRST) ((((use_arg_then2 ("diff2_dir_derivative", [diff2_dir_derivative]))(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 ("pt_in", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac)));
1483 (((((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1484 ];;
1485
1486 (* Lemma m_taylor_upper_bound *)
1487 let m_taylor_upper_bound = Sections.section_proof ["domain";"y";"w";"f";"dd_bound";"hi";"hi_bound"]
1488 `m_cell_domain domain y (w:real^N) ==>
1489 diff2_domain domain f ==>
1490 m_taylor_error f domain w dd_bound ==>
1491 f y <= hi ==>
1492 hi + sum(1..dimindex (:N)) (\i. w$i * abs (partial i f y)) + dd_bound / &2 <= hi_bound ==>
1493 !p. p IN interval [domain] ==> f p <= hi_bound`
1494 [
1495 (BETA_TAC THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (move ["f_bound"]) THEN (move ["total_bound"]) THEN (move ["p"]) THEN (move ["p_in"]));
1496 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_error_lemma", [m_taylor_error_lemma])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_in", [])) (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 fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
1497 ((DISCH_THEN (fun snd_th -> (fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!x y e. abs (x - y) <= e ==> x <= y + e`))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC);
1498 (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s"))) THEN (move ["ineq"]));
1499 ((((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 (`(f y + s) + dd_bound / &2`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
1500 (((use_arg_then2 ("total_bound", [])) (disch_tac [])) THEN (clear_assumption "total_bound") THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
1501 ((((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_RADD", [REAL_LE_RADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_bound", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
1502 ((((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 s`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("REAL_ABS_LE", [REAL_ABS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
1503 (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_ABS_LE", [SUM_ABS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac));
1504 (((((use_arg_then2 ("REAL_ABS_MUL", [REAL_ABS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_MUL2", [REAL_LE_MUL2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("domain_width", [domain_width])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1505 ];;
1506
1507 (* Lemma m_taylor_lower_bound *)
1508 let m_taylor_lower_bound = Sections.section_proof ["domain";"y";"w";"f";"dd_bound";"lo";"lo_bound"]
1509 `m_cell_domain domain y (w:real^N) ==>
1510 diff2_domain domain f ==>
1511 m_taylor_error f domain w dd_bound ==>
1512 lo <= f y ==>
1513 lo_bound <= lo - (sum(1..dimindex (:N)) (\i. w$i * abs (partial i f y)) + dd_bound / &2) ==>
1514 !p. p IN interval [domain] ==> lo_bound <= f p`
1515 [
1516 (BETA_TAC THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (move ["f_bound"]) THEN (move ["total_bound"]) THEN (move ["p"]) THEN (move ["p_in"]));
1517 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_error_lemma", [m_taylor_error_lemma])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_in", [])) (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 fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
1518 ((DISCH_THEN (fun snd_th -> (fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!x y e. abs (x - y) <= e ==> y - e <= x`))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC);
1519 (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s"))) THEN (move ["ineq"]));
1520 ((((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 (`(f y + s) - dd_bound / &2`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))));
1521 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then2 ("total_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
1522 ((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_NEG_ADD", [REAL_NEG_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_RADD", [REAL_LE_RADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_bound", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
1523 ((THENL_LAST) ((((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 s`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("REAL_LE_NEG2", [REAL_LE_NEG2]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((arith_tac) THEN (done_tac)));
1524 (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_ABS_LE", [SUM_ABS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac));
1525 (((((use_arg_then2 ("REAL_ABS_MUL", [REAL_ABS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_MUL2", [REAL_LE_MUL2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("domain_width", [domain_width])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1526 ];;
1527
1528 (* Lemma m_taylor_bounds *)
1529 let m_taylor_bounds = Sections.section_proof ["domain";"y";"w";"f";"dd_bound";"lo";"hi";"err_bound";"lo_bound";"hi_bound"]
1530 `m_cell_domain domain y (w:real^N) ==>
1531 diff2_domain domain f ==>
1532 m_taylor_error f domain w dd_bound ==>
1533 interval_arith (f y) (lo, hi) ==>
1534 sum(1..dimindex (:N)) (\i. w$i * abs(partial i f y)) + dd_bound / &2 <= err_bound ==>
1535 lo_bound <= lo - err_bound ==>
1536 hi + err_bound <= hi_bound ==>
1537 m_bounded_on_int f domain (lo_bound, hi_bound)`
1538 [
1539 (((((use_arg_then2 ("m_bounded_on_int", [m_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 ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (case THEN ((move ["f_lo"]) THEN (move ["f_hi"]))) THEN (move ["err"]) THEN (move ["lo_ineq"]) THEN (move ["hi_ineq"]) THEN (move ["p"]) THEN (move ["p_in"]));
1540 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_lower_bound", [m_taylor_lower_bound])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (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 fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_lo", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("lo_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
1541 (((((use_arg_then2 ("p_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(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 ((fun arg_tac -> arg_tac (Arg_term (`lo - err_bound`))) (term_tac exists_tac)));
1542 (((((use_arg_then2 ("lo_ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_NEG2", [REAL_LE_NEG2]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1543 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_upper_bound", [m_taylor_upper_bound])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (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 fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_hi", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("hi_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
1544 (((((use_arg_then2 ("p_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(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 ((fun arg_tac -> arg_tac (Arg_term (`hi + err_bound`))) (term_tac exists_tac)));
1545 (((((use_arg_then2 ("hi_ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_LADD", [REAL_LE_LADD]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1546 ];;
1547
1548 (* Lemma diff2_derivative_partial_bound *)
1549 let diff2_derivative_partial_bound = Sections.section_proof ["domain";"y";"w";"p";"f";"i";"d_bound"]
1550 `m_cell_domain domain y (w:real^N) ==>
1551 p IN interval [domain] ==>
1552 diff2_domain domain f ==>
1553 m_taylor_partial_error f i domain w d_bound ==>
1554 (!t. interval_arith t (&0, &1) ==>
1555 abs (derivative (partial i f o (\t. y + t % (p - y))) t) <= d_bound)`
1556 [
1557 (((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("m_taylor_partial_error", [m_taylor_partial_error]))(thm_tac (new_rewrite [] []))))) THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["boundedH"]) THEN (move ["t"]) THEN (move ["t_in"]));
1558 ((fun arg_tac -> arg_tac (Arg_term (`y + t % (p - y) IN interval [domain]`))) (term_tac (have_gen_tac [](move ["pt_in"]))));
1559 ((((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_CONVEX_SET", [IN_CONVEX_SET]))(thm_tac (new_rewrite [] [])))));
1560 (((((fun arg_tac -> (use_arg_then2 ("y_in_domain", [y_in_domain])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("p_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("t_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONVEX_INTERVAL", [CONVEX_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1561 ((((use_arg_then2 ("diff2_derivative_partial", [diff2_derivative_partial]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
1562 (((fun arg_tac -> (use_arg_then2 ("boundedH", [])) (fun fst_arg -> (use_arg_then2 ("pt_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
1563 (((((use_arg_then2 ("SUM_ABS_LE", [SUM_ABS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["j_ineq"]) THEN (simp_tac));
1564 ((((use_arg_then2 ("REAL_ABS_MUL", [REAL_ABS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_LE_MUL2", [REAL_LE_MUL2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] [])))));
1565 ((((fun arg_tac -> (use_arg_then2 ("domain_width", [domain_width])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1566 ];;
1567
1568 (* Lemma m_taylor_partial_error_lemma *)
1569 let m_taylor_partial_error_lemma = Sections.section_proof ["domain";"y";"w";"p";"f";"i";"dd_bound"]
1570 `m_cell_domain domain y (w:real^N) ==>
1571 p IN interval [domain] ==>
1572 diff2_domain domain f ==>
1573 m_taylor_partial_error f i domain w dd_bound ==>
1574 abs (partial i f p - partial i f y) <= dd_bound`
1575 [
1576 ((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (BETA_TAC THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["partial_error"])));
1577 ((fun arg_tac -> arg_tac (Arg_term (`!t. interval_arith t (&0, &1) ==> y + t % (p - y) IN interval [domain]`))) (term_tac (have_gen_tac [](move ["pt_in"]))));
1578 ((BETA_TAC THEN (move ["t"]) THEN (move ["t_in"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_CONVEX_SET", [IN_CONVEX_SET]))(thm_tac (new_rewrite [] []))))));
1579 (((((fun arg_tac -> (use_arg_then2 ("y_in_domain", [y_in_domain])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("p_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("t_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONVEX_INTERVAL", [CONVEX_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1580 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_taylor1_bound", [real_taylor1_bound])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`partial i f o (\t. y + t % (p - y))`))) (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))) (disch_tac [])) THEN BETA_TAC);
1581 (ANTS_TAC);
1582 ((BETA_TAC THEN (move ["t"]) THEN (move ["t_in"])) THEN ((((use_arg_then2 ("diff2_real_diff_partial", [diff2_real_diff_partial]))(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 ("pt_in", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("diff2_derivative_partial_bound", [diff2_derivative_partial_bound])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
1583 ((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1584 (((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LID", [VECTOR_MUL_LID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_ADD2)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1585 ];;
1586
1587 (* Lemma m_taylor_upper_partial_bound *)
1588 let m_taylor_upper_partial_bound = Sections.section_proof ["domain";"y";"w";"f";"i";"dd_bound";"hi";"hi_bound"]
1589 `m_cell_domain domain y (w:real^N) ==>
1590 diff2_domain domain f ==>
1591 m_taylor_partial_error f i domain w dd_bound ==>
1592 partial i f y <= hi ==>
1593 hi + dd_bound <= hi_bound ==>
1594 !p. p IN interval [domain] ==> partial i f p <= hi_bound`
1595 [
1596 (BETA_TAC THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (move ["df_bound"]) THEN (move ["total_bound"]) THEN (move ["p"]) THEN (move ["p_in"]));
1597 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_partial_error_lemma", [m_taylor_partial_error_lemma])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_in", [])) (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 fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
1598 ((DISCH_THEN (fun snd_th -> (fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!x y e. abs (x - y) <= e ==> x <= y + e`))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["ineq"]));
1599 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
1600 (((use_arg_then2 ("total_bound", [])) (disch_tac [])) THEN (clear_assumption "total_bound") THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
1601 (((((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1602 ];;
1603
1604 (* Lemma m_taylor_lower_partial_bound *)
1605 let m_taylor_lower_partial_bound = Sections.section_proof ["domain";"y";"w";"f";"i";"dd_bound";"lo";"lo_bound"]
1606 `m_cell_domain domain y (w:real^N) ==>
1607 diff2_domain domain f ==>
1608 m_taylor_partial_error f i domain w dd_bound ==>
1609 lo <= partial i f y ==>
1610 lo_bound <= lo - dd_bound ==>
1611 !p. p IN interval [domain] ==> lo_bound <= partial i f p`
1612 [
1613 (BETA_TAC THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (move ["df_bound"]) THEN (move ["total_bound"]) THEN (move ["p"]) THEN (move ["p_in"]));
1614 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_partial_error_lemma", [m_taylor_partial_error_lemma])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_in", [])) (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 fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
1615 ((DISCH_THEN (fun snd_th -> (fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!x y e. abs (x - y) <= e ==> y - e <= x`))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["ineq"]));
1616 (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
1617 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then2 ("total_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
1618 (((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1619 ];;
1620
1621 (* Lemma m_taylor_partial_bounds *)
1622 let m_taylor_partial_bounds = Sections.section_proof ["domain";"y";"w";"f";"i";"dd_bound";"lo";"hi";"lo_bound";"hi_bound"]
1623 `m_cell_domain domain y (w:real^N) ==>
1624 diff2_domain domain f ==>
1625 m_taylor_partial_error f i domain w dd_bound ==>
1626 interval_arith (partial i f y) (lo, hi) ==>
1627 lo_bound <= lo - dd_bound ==>
1628 hi + dd_bound <= hi_bound ==>
1629 m_bounded_on_int (partial i f) domain (lo_bound, hi_bound)`
1630 [
1631 (((((use_arg_then2 ("m_bounded_on_int", [m_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 ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (case THEN ((move ["df_lo"]) THEN (move ["df_hi"]))) THEN (move ["lo_ineq"]) THEN (move ["hi_ineq"]) THEN (move ["p"]) THEN (move ["p_in"]));
1632 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_lower_partial_bound", [m_taylor_lower_partial_bound])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (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 fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("df_lo", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("lo_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
1633 ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_upper_partial_bound", [m_taylor_upper_partial_bound])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (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 fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("df_hi", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("hi_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1634 ];;
1635
1636 (* Finalization of the section Taylor *)
1637 let real_taylor2_bound = Sections.finalize_theorem real_taylor2_bound;;
1638 let real_taylor1_bound = Sections.finalize_theorem real_taylor1_bound;;
1639 let taylor_error_eq_sum_partial_errors = Sections.finalize_theorem taylor_error_eq_sum_partial_errors;;
1640 let diff2c_imp_diff2 = Sections.finalize_theorem diff2c_imp_diff2;;
1641 let diff2_eq_diff2_on_open = Sections.finalize_theorem diff2_eq_diff2_on_open;;
1642 let diff2_imp_real_diff = Sections.finalize_theorem diff2_imp_real_diff;;
1643 let diff2_dir_derivative = Sections.finalize_theorem diff2_dir_derivative;;
1644 let diff2_partial_real_diff = Sections.finalize_theorem diff2_partial_real_diff;;
1645 let in_trans = Sections.finalize_theorem in_trans;;
1646 let open_contains_open_interval = Sections.finalize_theorem open_contains_open_interval;;
1647 let diff2_dir = Sections.finalize_theorem diff2_dir;;
1648 let diff2_dir_derivative2 = Sections.finalize_theorem diff2_dir_derivative2;;
1649 let diff2_has_derivative_partial = Sections.finalize_theorem diff2_has_derivative_partial;;
1650 let diff2_derivative_partial = Sections.finalize_theorem diff2_derivative_partial;;
1651 let diff2_real_diff_partial = Sections.finalize_theorem diff2_real_diff_partial;;
1652 let partial_const = Sections.finalize_theorem partial_const;;
1653 let partial_eq0_alt = Sections.finalize_theorem partial_eq0_alt;;
1654 let real_mvt0 = Sections.finalize_theorem real_mvt0;;
1655 let mixed_second_partials = Sections.finalize_theorem mixed_second_partials;;
1656 let diff2c_domain_alt = Sections.finalize_theorem diff2c_domain_alt;;
1657 let y_in_domain = Sections.finalize_theorem y_in_domain;;
1658 let domain_width = Sections.finalize_theorem domain_width;;
1659 let sum_swap1 = Sections.finalize_theorem sum_swap1;;
1660 let m_taylor_error_eq = Sections.finalize_theorem m_taylor_error_eq;;
1661 let diff2_derivative2_bound = Sections.finalize_theorem diff2_derivative2_bound;;
1662 let m_taylor_error_lemma = Sections.finalize_theorem m_taylor_error_lemma;;
1663 let m_taylor_upper_bound = Sections.finalize_theorem m_taylor_upper_bound;;
1664 let m_taylor_lower_bound = Sections.finalize_theorem m_taylor_lower_bound;;
1665 let m_taylor_bounds = Sections.finalize_theorem m_taylor_bounds;;
1666 let diff2_derivative_partial_bound = Sections.finalize_theorem diff2_derivative_partial_bound;;
1667 let m_taylor_partial_error_lemma = Sections.finalize_theorem m_taylor_partial_error_lemma;;
1668 let m_taylor_upper_partial_bound = Sections.finalize_theorem m_taylor_upper_partial_bound;;
1669 let m_taylor_lower_partial_bound = Sections.finalize_theorem m_taylor_lower_partial_bound;;
1670 let m_taylor_partial_bounds = Sections.finalize_theorem m_taylor_partial_bounds;;
1671 Sections.end_section "Taylor";;
1672
1673 (* Section Diff2Arith *)
1674 Sections.begin_section "Diff2Arith";;
1675 (Sections.add_section_var (mk_var ("f", (`:real^N -> real`))); Sections.add_section_var (mk_var ("g", (`:real^N -> real`))));;
1676 (Sections.add_section_var (mk_var ("x", (`:real^N`))));;
1677 (Sections.add_section_var (mk_var ("domain", (`:real^N#real^N`))));;
1678
1679 (* Lemma differentiable_local_at *)
1680 let differentiable_local_at = Sections.section_proof ["s";"f";"g";"x"]
1681 `f differentiable at x ==> open s ==> x IN s ==> (!y. y IN s ==> g y = f y) ==>
1682 g differentiable at x`
1683 [
1684 ((((use_arg_then2 ("OPEN_CONTAINS_BALL", [OPEN_CONTAINS_BALL]))(thm_tac (new_rewrite [] [])))) THEN (move ["df"]) THEN (move ["open_s"]) THEN (move ["xs"]) THEN (move ["eq"]));
1685 ((((fun arg_tac -> (use_arg_then2 ("open_s", [])) (fun fst_arg -> (use_arg_then2 ("xs", [])) (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 (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_BALL", [IN_BALL]))(thm_tac (new_rewrite [] []))))) THEN (move ["in_ball"])));
1686 ((((fun arg_tac -> (use_arg_then2 ("DIFFERENTIABLE_TRANSFORM_AT", [DIFFERENTIABLE_TRANSFORM_AT])) (fun fst_arg -> (use_arg_then2 ("f", [])) (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 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))));
1687 (((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 ["z"]) THEN (move ["dzx"])) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("in_ball", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1688 ];;
1689
1690 (* Section Point *)
1691 Sections.begin_section "Point";;
1692
1693 (* Lemma diff2_scale *)
1694 let diff2_scale = Sections.section_proof ["f";"c"]
1695 `diff2 f x ==> diff2 (\x. c * f x) x`
1696 [
1697 ((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(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 ["df"]));
1698 (((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 ["z"]) THEN (move ["zs"])));
1699 ((THENL_FIRST) ((((use_arg_then2 ("f_lift_scale", [f_lift_scale]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CMUL", [DIFFERENTIABLE_CMUL]))(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 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
1700 ((BETA_TAC THEN (move ["i"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("differentiable_local_at", [differentiable_local_at])) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`lift o (\x. c * partial i f x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)));
1701 ((THENL_FIRST) ((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("zs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_lift_scale", [f_lift_scale]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CMUL", [DIFFERENTIABLE_CMUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
1702 ((BETA_TAC THEN (move ["y"]) THEN (move ["ys"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial_scale", [partial_scale]))(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 ("LIFT_CMUL", [LIFT_CMUL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1703 ];;
1704
1705 (* Lemma diff2_neg *)
1706 let diff2_neg = Sections.section_proof ["f"]
1707 `diff2 f x ==> diff2 (\x. --f x) x`
1708 [
1709 (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2_scale", [diff2_scale])) (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 (`--(&1)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("REAL_NEG_MINUS1", [REAL_NEG_MINUS1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac));
1710 ];;
1711
1712 (* Section Composite *)
1713 Sections.begin_section "Composite";;
1714
1715 (* Lemma has_derivative_uni_compose *)
1716 let has_derivative_uni_compose = Sections.section_proof ["u";"f";"u'";"f'";"x"]
1717 `(lift o f has_derivative f') (at x) ==>
1718 (u has_real_derivative u') (atreal (f x)) ==>
1719 (lift o u o f has_derivative (\x. u' % f' x)) (at x)`
1720 [
1721 (BETA_TAC THEN (move ["df"]) THEN (move ["du"]));
1722 ((fun arg_tac -> arg_tac (Arg_term (`lift o u o f = (lift o u o drop) o (lift o f)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
1723 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (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 (done_tac));
1724 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(\x. u' % f' x) = (\x. u' % x) o f'`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)));
1725 (((((use_arg_then2 ("DIFF_CHAIN_AT", [DIFF_CHAIN_AT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_REAL_FRECHET_DERIVATIVE_AT)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1726 ];;
1727
1728 (* Lemma diff_uni_compose *)
1729 let diff_uni_compose = Sections.section_proof ["u";"f";"x"]
1730 `lift o f differentiable at x ==>
1731 u real_differentiable atreal (f x) ==>
1732 lift o u o f differentiable at x`
1733 [
1734 (((repeat_tactic 1 9 (((use_arg_then2 ("differentiable", [differentiable]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["f'"])) THEN (move ["df"]) THEN (case THEN (move ["u'"])) THEN (move ["du"]));
1735 (((fun arg_tac -> arg_tac (Arg_term (`\x. u' % f' x`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("has_derivative_uni_compose", [has_derivative_uni_compose])) (thm_tac apply_tac)) THEN (done_tac));
1736 ];;
1737
1738 (* Lemma diff2_uni_compose *)
1739 let diff2_uni_compose = Sections.section_proof ["u";"f"]
1740 `diff2 f x ==> nth_diff_strong 2 u (f x) ==> diff2 (u o f) x`
1741 [
1742 (((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] []))))) 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 (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["fxt"])) THEN (move ["du"]));
1743 ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN s /\ (lift o f) z IN (IMAGE lift t)}`))) (term_tac (set_tac "r")));
1744 ((fun arg_tac -> arg_tac (Arg_term (`open r`))) (term_tac (have_gen_tac [](move ["open_r"]))));
1745 ((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CONTINUOUS_OPEN_PREIMAGE", [CONTINUOUS_OPEN_PREIMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OPEN", [REAL_OPEN]))(gsym_then (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 [] []))))));
1746 (((use_arg_then2 ("DIFFERENTIABLE_IMP_CONTINUOUS_ON", [DIFFERENTIABLE_IMP_CONTINUOUS_ON])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("differentiable_on", [differentiable_on]))(thm_tac (new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["ys"])) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
1747 (((((use_arg_then2 ("DIFFERENTIABLE_AT_WITHIN", [DIFFERENTIABLE_AT_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1748 ((THENL_FIRST) (((use_arg_then2 ("r", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("open_r", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LIFT_IN_IMAGE_LIFT", [LIFT_IN_IMAGE_LIFT]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)) (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)));
1749 (BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN ((case THEN (move ["zs"])) THEN (move ["fzt"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
1750 (((((use_arg_then2 ("diff_uni_compose", [diff_uni_compose]))(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 ("du", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]));
1751 (((use_arg_then2 ("differentiable_local_at", [differentiable_local_at])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("r", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`lift o (\y. derivative u (f y) * partial i f y)`))) (term_tac exists_tac))));
1752 ((((use_arg_then2 ("open_r", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("differentiable_mul", [differentiable_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
1753 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative u`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then2 ("diff_uni_compose", [diff_uni_compose]))(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 ("du", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1754 ((THENL_FIRST) (((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_IN_IMAGE_LIFT", [LIFT_IN_IMAGE_LIFT]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)) (((use_arg_then2 ("z", [])) (term_tac exists_tac)) THEN (done_tac)));
1755 (BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["p"])) THEN (case THEN ((case THEN (move ["ps"])) THEN (move ["fpt"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
1756 (((((use_arg_then2 ("partial_uni_compose", [partial_uni_compose]))(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 ("du", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1757 ];;
1758
1759 (* Lemma diff2_abs_pos_compose *)
1760 let diff2_abs_pos_compose = Sections.section_proof []
1761 `&0 < f x ==> diff2 f x ==> diff2 (abs o f) x`
1762 [
1763 ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_abs_pos", [diff2_abs_pos])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1764 ];;
1765
1766 (* Lemma diff2_abs_neg_compose *)
1767 let diff2_abs_neg_compose = Sections.section_proof []
1768 `f x < &0 ==> diff2 f x ==> diff2 (abs o f) x`
1769 [
1770 ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_abs_neg", [diff2_abs_neg])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1771 ];;
1772
1773 (* Lemma diff2_pow_compose *)
1774 let diff2_pow_compose = Sections.section_proof ["n"]
1775 `diff2 f x ==> diff2 ((\x. x pow n) o f) x`
1776 [
1777 ((BETA_TAC THEN (move ["df"])) THEN ((((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_pow_x", [diff2_pow_x]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1778 ];;
1779
1780 (* Lemma diff2_inv_compose *)
1781 let diff2_inv_compose = Sections.section_proof []
1782 `~(f x = &0) ==> diff2 f x ==> diff2 (inv o f) x`
1783 [
1784 ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_inv", [diff2_inv])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1785 ];;
1786
1787 (* Lemma diff2_sqrt_compose *)
1788 let diff2_sqrt_compose = Sections.section_proof []
1789 `&0 < f x ==> diff2 f x ==> diff2 (sqrt o f) x`
1790 [
1791 ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_sqrt", [diff2_sqrt])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1792 ];;
1793
1794 (* Lemma diff2_atn_compose *)
1795 let diff2_atn_compose = Sections.section_proof []
1796 `diff2 f x ==> diff2 (atn o f) x`
1797 [
1798 ((BETA_TAC THEN (move ["df"])) THEN ((((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_atn", [diff2_atn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1799 ];;
1800
1801 (* Lemma diff2_cos_compose *)
1802 let diff2_cos_compose = Sections.section_proof []
1803 `diff2 f x ==> diff2 (cos o f) x`
1804 [
1805 ((BETA_TAC THEN (move ["df"])) THEN ((((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_cos", [diff2_cos]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1806 ];;
1807
1808 (* Lemma diff2_sin_compose *)
1809 let diff2_sin_compose = Sections.section_proof []
1810 `diff2 f x ==> diff2 (sin o f) x`
1811 [
1812 ((BETA_TAC THEN (move ["df"])) THEN ((((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_sin", [diff2_sin]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1813 ];;
1814
1815 (* Lemma diff2_exp_compose *)
1816 let diff2_exp_compose = Sections.section_proof []
1817 `diff2 f x ==> diff2 (exp o f) x`
1818 [
1819 ((BETA_TAC THEN (move ["df"])) THEN ((((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_exp", [diff2_exp]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1820 ];;
1821
1822 (* Lemma diff2_log_compose *)
1823 let diff2_log_compose = Sections.section_proof []
1824 `&0 < f x ==> diff2 f x ==> diff2 (log o f) x`
1825 [
1826 ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_log", [diff2_log])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1827 ];;
1828
1829 (* Lemma diff2_acs_compose *)
1830 let diff2_acs_compose = Sections.section_proof []
1831 `abs (f x) < &1 ==> diff2 f x ==> diff2 (acs o f) x`
1832 [
1833 ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_acs", [diff2_acs])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1834 ];;
1835
1836 (* Lemma diff2_asn_compose *)
1837 let diff2_asn_compose = Sections.section_proof []
1838 `abs (f x) < &1 ==> diff2 f x ==> diff2 (asn o f) x`
1839 [
1840 ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_asn", [diff2_asn])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1841 ];;
1842
1843 (* Lemma diff2_matan_compose *)
1844 let diff2_matan_compose = Sections.section_proof []
1845 `-- &1 < f x ==> diff2 f x ==> diff2 (matan o f) x`
1846 [
1847 ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_matan", [diff2_matan])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1848 ];;
1849
1850 (* Finalization of the section Composite *)
1851 let has_derivative_uni_compose = Sections.finalize_theorem has_derivative_uni_compose;;
1852 let diff_uni_compose = Sections.finalize_theorem diff_uni_compose;;
1853 let diff2_uni_compose = Sections.finalize_theorem diff2_uni_compose;;
1854 let diff2_abs_pos_compose = Sections.finalize_theorem diff2_abs_pos_compose;;
1855 let diff2_abs_neg_compose = Sections.finalize_theorem diff2_abs_neg_compose;;
1856 let diff2_pow_compose = Sections.finalize_theorem diff2_pow_compose;;
1857 let diff2_inv_compose = Sections.finalize_theorem diff2_inv_compose;;
1858 let diff2_sqrt_compose = Sections.finalize_theorem diff2_sqrt_compose;;
1859 let diff2_atn_compose = Sections.finalize_theorem diff2_atn_compose;;
1860 let diff2_cos_compose = Sections.finalize_theorem diff2_cos_compose;;
1861 let diff2_sin_compose = Sections.finalize_theorem diff2_sin_compose;;
1862 let diff2_exp_compose = Sections.finalize_theorem diff2_exp_compose;;
1863 let diff2_log_compose = Sections.finalize_theorem diff2_log_compose;;
1864 let diff2_acs_compose = Sections.finalize_theorem diff2_acs_compose;;
1865 let diff2_asn_compose = Sections.finalize_theorem diff2_asn_compose;;
1866 let diff2_matan_compose = Sections.finalize_theorem diff2_matan_compose;;
1867 Sections.end_section "Composite";;
1868
1869 (* Lemma diff2_add *)
1870 let diff2_add = Sections.section_proof ["f";"g"]
1871 `diff2 f x ==> diff2 g x ==> diff2 (\x. f x + g x) x`
1872 [
1873 ((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(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 ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"]));
1874 (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("OPEN_INTER", [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 [] [])))) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"])))));
1875 ((((use_arg_then2 ("f_lift_add", [f_lift_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
1876 ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1877 ((BETA_TAC THEN (move ["i"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("differentiable_local_at", [differentiable_local_at])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`lift o (\x. partial i f x + partial i g x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)));
1878 ((((use_arg_then2 ("OPEN_INTER", [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 ("zt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("zs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_lift_add", [f_lift_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
1879 ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1880 ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial_add", [partial_add]))(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 ("LIFT_ADD", [LIFT_ADD]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1881 ];;
1882
1883 (* Lemma diff2_sub *)
1884 let diff2_sub = Sections.section_proof ["f";"g"]
1885 `diff2 f x ==> diff2 g x ==> diff2 (\x. f x - g x) x`
1886 [
1887 ((BETA_TAC THEN (move ["d2f"]) THEN (move ["d2g"])) THEN ((((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_add", [diff2_add]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("diff2_neg", [diff2_neg]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1888 ];;
1889
1890 (* Lemma diff2_mul *)
1891 let diff2_mul = Sections.section_proof ["f";"g"]
1892 `diff2 f x ==> diff2 g x ==> diff2 (\x. f x * g x) x`
1893 [
1894 ((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(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 ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"]));
1895 (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("OPEN_INTER", [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 [] [])))) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"])))));
1896 (((((use_arg_then2 ("differentiable_mul", [differentiable_mul]))(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 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]));
1897 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("differentiable_local_at", [differentiable_local_at])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`lift o (\x. partial i f x * g x + f x * partial i g x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
1898 ((((use_arg_then2 ("OPEN_INTER", [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 ("zt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("zs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_lift_add", [f_lift_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
1899 ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("differentiable_mul", [differentiable_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 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1900 ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial_mul", [partial_mul]))(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 ("LIFT_ADD", [LIFT_ADD]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1901 ];;
1902
1903 (* Finalization of the section Point *)
1904 let diff2_scale = Sections.finalize_theorem diff2_scale;;
1905 let diff2_neg = Sections.finalize_theorem diff2_neg;;
1906 let has_derivative_uni_compose = Sections.finalize_theorem has_derivative_uni_compose;;
1907 let diff_uni_compose = Sections.finalize_theorem diff_uni_compose;;
1908 let diff2_uni_compose = Sections.finalize_theorem diff2_uni_compose;;
1909 let diff2_abs_pos_compose = Sections.finalize_theorem diff2_abs_pos_compose;;
1910 let diff2_abs_neg_compose = Sections.finalize_theorem diff2_abs_neg_compose;;
1911 let diff2_pow_compose = Sections.finalize_theorem diff2_pow_compose;;
1912 let diff2_inv_compose = Sections.finalize_theorem diff2_inv_compose;;
1913 let diff2_sqrt_compose = Sections.finalize_theorem diff2_sqrt_compose;;
1914 let diff2_atn_compose = Sections.finalize_theorem diff2_atn_compose;;
1915 let diff2_cos_compose = Sections.finalize_theorem diff2_cos_compose;;
1916 let diff2_sin_compose = Sections.finalize_theorem diff2_sin_compose;;
1917 let diff2_exp_compose = Sections.finalize_theorem diff2_exp_compose;;
1918 let diff2_log_compose = Sections.finalize_theorem diff2_log_compose;;
1919 let diff2_acs_compose = Sections.finalize_theorem diff2_acs_compose;;
1920 let diff2_asn_compose = Sections.finalize_theorem diff2_asn_compose;;
1921 let diff2_matan_compose = Sections.finalize_theorem diff2_matan_compose;;
1922 let diff2_add = Sections.finalize_theorem diff2_add;;
1923 let diff2_sub = Sections.finalize_theorem diff2_sub;;
1924 let diff2_mul = Sections.finalize_theorem diff2_mul;;
1925 Sections.end_section "Point";;
1926
1927 (* Section Domain *)
1928 Sections.begin_section "Domain";;
1929 (Sections.add_section_hyp "d2f" (`diff2_domain domain f`));;
1930
1931 (* Lemma diff2_domain_scale *)
1932 let diff2_domain_scale = Sections.section_proof ["c"]
1933 `diff2_domain domain (\x. c * f x)`
1934 [
1935 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_scale", [diff2_scale]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1936 ];;
1937
1938 (* Lemma diff2_domain_neg *)
1939 let diff2_domain_neg = Sections.section_proof []
1940 `diff2_domain domain (\x. --f x)`
1941 [
1942 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_neg", [diff2_neg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1943 ];;
1944 (Sections.add_section_var (mk_var ("bounds", (`:real#real`))));;
1945
1946 (* Lemma diff2_domain_inv_compose *)
1947 let diff2_domain_inv_compose = Sections.section_proof []
1948 `m_bounded_on_int f domain bounds ==>
1949 interval_not_zero bounds ==> diff2_domain domain (inv o f)`
1950 [
1951 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
1952 (((((use_arg_then2 ("diff2_inv_compose", [diff2_inv_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_not_zero", [interval_arith_not_zero])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1953 ];;
1954
1955 (* Lemma diff2_domain_sqrt_compose *)
1956 let diff2_domain_sqrt_compose = Sections.section_proof []
1957 `m_bounded_on_int f domain bounds ==>
1958 interval_pos bounds ==> diff2_domain domain (sqrt o f)`
1959 [
1960 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
1961 (((((use_arg_then2 ("diff2_sqrt_compose", [diff2_sqrt_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1962 ];;
1963
1964 (* Lemma diff2_domain_abs_pos_compose *)
1965 let diff2_domain_abs_pos_compose = Sections.section_proof []
1966 `m_bounded_on_int f domain bounds ==>
1967 interval_pos bounds ==> diff2_domain domain (abs o f)`
1968 [
1969 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
1970 (((((use_arg_then2 ("diff2_abs_pos_compose", [diff2_abs_pos_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1971 ];;
1972
1973 (* Lemma diff2_domain_abs_neg_compose *)
1974 let diff2_domain_abs_neg_compose = Sections.section_proof []
1975 `m_bounded_on_int f domain bounds ==>
1976 interval_neg bounds ==> diff2_domain domain (abs o f)`
1977 [
1978 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
1979 (((((use_arg_then2 ("diff2_abs_neg_compose", [diff2_abs_neg_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_neg", [interval_arith_neg])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1980 ];;
1981
1982 (* Lemma diff2_domain_pow_compose *)
1983 let diff2_domain_pow_compose = Sections.section_proof ["n"]
1984 `diff2_domain domain ((\x. x pow n) o f)`
1985 [
1986 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_pow_compose", [diff2_pow_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1987 ];;
1988
1989 (* Lemma diff2_domain_atn_compose *)
1990 let diff2_domain_atn_compose = Sections.section_proof []
1991 `diff2_domain domain (atn o f)`
1992 [
1993 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_atn_compose", [diff2_atn_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1994 ];;
1995
1996 (* Lemma diff2_domain_cos_compose *)
1997 let diff2_domain_cos_compose = Sections.section_proof []
1998 `diff2_domain domain (cos o f)`
1999 [
2000 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_cos_compose", [diff2_cos_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2001 ];;
2002
2003 (* Lemma diff2_domain_sin_compose *)
2004 let diff2_domain_sin_compose = Sections.section_proof []
2005 `diff2_domain domain (sin o f)`
2006 [
2007 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_sin_compose", [diff2_sin_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2008 ];;
2009
2010 (* Lemma diff2_domain_exp_compose *)
2011 let diff2_domain_exp_compose = Sections.section_proof []
2012 `diff2_domain domain (exp o f)`
2013 [
2014 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_exp_compose", [diff2_exp_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2015 ];;
2016
2017 (* Lemma diff2_domain_log_compose *)
2018 let diff2_domain_log_compose = Sections.section_proof []
2019 `m_bounded_on_int f domain bounds ==>
2020 interval_pos bounds ==> diff2_domain domain (log o f)`
2021 [
2022 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
2023 (((((use_arg_then2 ("diff2_log_compose", [diff2_log_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2024 ];;
2025
2026 (* Lemma diff2_domain_acs_compose *)
2027 let diff2_domain_acs_compose = Sections.section_proof []
2028 `m_bounded_on_int f domain bounds ==>
2029 iabs bounds < &1 ==> diff2_domain domain (acs o f)`
2030 [
2031 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
2032 (((((use_arg_then2 ("diff2_acs_compose", [diff2_acs_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2033 ];;
2034
2035 (* Lemma diff2_domain_asn_compose *)
2036 let diff2_domain_asn_compose = Sections.section_proof []
2037 `m_bounded_on_int f domain bounds ==>
2038 iabs bounds < &1 ==> diff2_domain domain (asn o f)`
2039 [
2040 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
2041 (((((use_arg_then2 ("diff2_asn_compose", [diff2_asn_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2042 ];;
2043
2044 (* Lemma diff2_domain_matan_compose *)
2045 let diff2_domain_matan_compose = Sections.section_proof []
2046 `m_bounded_on_int f domain bounds ==>
2047 interval_gt (-- &1) bounds ==> diff2_domain domain (matan o f)`
2048 [
2049 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
2050 (((((use_arg_then2 ("diff2_matan_compose", [diff2_matan_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_gt", [interval_arith_gt])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2051 ];;
2052 (Sections.add_section_hyp "d2g" (`diff2_domain domain g`));;
2053
2054 (* Lemma diff2_domain_add *)
2055 let diff2_domain_add = Sections.section_proof []
2056 `diff2_domain domain (\x. f x + g x)`
2057 [
2058 ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_add", [diff2_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2059 ];;
2060
2061 (* Lemma diff2_domain_sub *)
2062 let diff2_domain_sub = Sections.section_proof []
2063 `diff2_domain domain (\x. f x - g x)`
2064 [
2065 ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_sub", [diff2_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2066 ];;
2067
2068 (* Lemma diff2_domain_mul *)
2069 let diff2_domain_mul = Sections.section_proof []
2070 `diff2_domain domain (\x. f x * g x)`
2071 [
2072 ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_mul", [diff2_mul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2073 ];;
2074
2075 (* Finalization of the section Domain *)
2076 let diff2_domain_scale = Sections.finalize_theorem diff2_domain_scale;;
2077 let diff2_domain_neg = Sections.finalize_theorem diff2_domain_neg;;
2078 let diff2_domain_inv_compose = Sections.finalize_theorem diff2_domain_inv_compose;;
2079 let diff2_domain_sqrt_compose = Sections.finalize_theorem diff2_domain_sqrt_compose;;
2080 let diff2_domain_abs_pos_compose = Sections.finalize_theorem diff2_domain_abs_pos_compose;;
2081 let diff2_domain_abs_neg_compose = Sections.finalize_theorem diff2_domain_abs_neg_compose;;
2082 let diff2_domain_pow_compose = Sections.finalize_theorem diff2_domain_pow_compose;;
2083 let diff2_domain_atn_compose = Sections.finalize_theorem diff2_domain_atn_compose;;
2084 let diff2_domain_cos_compose = Sections.finalize_theorem diff2_domain_cos_compose;;
2085 let diff2_domain_sin_compose = Sections.finalize_theorem diff2_domain_sin_compose;;
2086 let diff2_domain_exp_compose = Sections.finalize_theorem diff2_domain_exp_compose;;
2087 let diff2_domain_log_compose = Sections.finalize_theorem diff2_domain_log_compose;;
2088 let diff2_domain_acs_compose = Sections.finalize_theorem diff2_domain_acs_compose;;
2089 let diff2_domain_asn_compose = Sections.finalize_theorem diff2_domain_asn_compose;;
2090 let diff2_domain_matan_compose = Sections.finalize_theorem diff2_domain_matan_compose;;
2091 let diff2_domain_add = Sections.finalize_theorem diff2_domain_add;;
2092 let diff2_domain_sub = Sections.finalize_theorem diff2_domain_sub;;
2093 let diff2_domain_mul = Sections.finalize_theorem diff2_domain_mul;;
2094 Sections.end_section "Domain";;
2095
2096 (* Section SecondPartial *)
2097 Sections.begin_section "SecondPartial";;
2098
2099 (* Lemma diff2_imp_diff *)
2100 let diff2_imp_diff = Sections.section_proof ["f";"x"]
2101 `diff2 f x ==> (lift o f) differentiable at x`
2102 [
2103 (((((use_arg_then2 ("diff2", [diff2]))(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 (done_tac));
2104 ];;
2105
2106 (* Lemma diff2_imp_partial_diff *)
2107 let diff2_imp_partial_diff = Sections.section_proof ["f";"i";"x"]
2108 `diff2 f x ==> (lift o partial i f) differentiable at x`
2109 [
2110 (((((use_arg_then2 ("diff2", [diff2]))(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 (done_tac));
2111 ];;
2112
2113 (* Lemma partial_local *)
2114 let partial_local = Sections.section_proof ["s";"f";"g";"i";"x"]
2115 `(lift o f) differentiable at x ==>
2116 open s ==> x IN s ==> (!y:real^N. y IN s ==> f y = g y) ==>
2117 partial i f x = partial i g x`
2118 [
2119 ((BETA_TAC THEN (move ["df"]) THEN (move ["open_s"]) THEN (move ["xs"]) THEN (move ["eq"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] []))))));
2120 ((((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)));
2121 (((fun arg_tac -> arg_tac (Arg_term (`g o (\t. x + t % basis i)`))) (term_tac exists_tac)) THEN (split_tac));
2122 ((((use_arg_then2 ("has_derivative_alt", [has_derivative_alt])) (disch_tac [])) THEN (clear_assumption "has_derivative_alt") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("diff_imp_real_diff", [diff_imp_real_diff])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("diff_direction", [diff_direction]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))));
2123 ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("differentiable_local_at", [differentiable_local_at])) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`lift o f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac));
2124 (((simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) 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 (move ["ys"]));
2125 (((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2126 ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("open_contains_open_interval", [open_contains_open_interval])) (fun fst_arg -> (use_arg_then2 ("open_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`basis i:real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["ab0"]))) THEN ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["sub"])));
2127 (((fun arg_tac -> arg_tac (Arg_term (`real_interval (a, b)`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("ab0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["y_in"])));
2128 (((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sub", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (done_tac));
2129 ];;
2130 (Sections.add_section_var (mk_var ("i", (`:num`))); Sections.add_section_var (mk_var ("j", (`:num`))));;
2131
2132 (* Lemma second_partial_scale *)
2133 let second_partial_scale = Sections.section_proof ["f";"c"]
2134 `diff2 f x ==> partial2 i j (\x. c * f x) x = c * partial2 i j f x`
2135 [
2136 ((BETA_TAC THEN (move ["d2f"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial_scale", [partial_scale]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_imp_partial_diff", [diff2_imp_partial_diff]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] []))))));
2137 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2", [diff2]))(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 ["df"])));
2138 (((use_arg_then2 ("partial_local", [partial_local])) (thm_tac apply_tac)) THEN ((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 (((use_arg_then2 ("f_lift_scale", [f_lift_scale]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CMUL", [DIFFERENTIABLE_CMUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))));
2139 ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2140 ((BETA_TAC THEN (move ["y"]) THEN (move ["ys"])) THEN ((((use_arg_then2 ("partial_scale", [partial_scale]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2141 ];;
2142
2143 (* Lemma second_partial_neg *)
2144 let second_partial_neg = Sections.section_proof ["f"]
2145 `diff2 f x ==> partial2 i j (\x. --f x) x = --partial2 i j f x`
2146 [
2147 (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("second_partial_scale", [second_partial_scale])) (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 (`--(&1)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_NEG_MINUS1", [REAL_NEG_MINUS1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2148 ];;
2149
2150 (* Lemma second_partial_add *)
2151 let second_partial_add = Sections.section_proof ["f";"g"]
2152 `diff2 f x ==> diff2 g x ==>
2153 partial2 i j (\x. f x + g x) x = partial2 i j f x + partial2 i j g x`
2154 [
2155 ((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(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 ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"]));
2156 (((repeat_tactic 1 9 (((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial_add", [partial_add]))(gsym_then (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 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("partial_local", [partial_local])) (thm_tac apply_tac)));
2157 (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("OPEN_INTER", [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 [] [])))) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [] []))))));
2158 ((((use_arg_then2 ("f_lift_add", [f_lift_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
2159 ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) 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));
2160 ((BETA_TAC THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"])))) THEN ((((use_arg_then2 ("partial_add", [partial_add]))(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 (done_tac));
2161 ];;
2162
2163 (* Lemma second_partial_sub *)
2164 let second_partial_sub = Sections.section_proof ["f";"g"]
2165 `diff2 f x ==> diff2 g x ==>
2166 partial2 i j (\x. f x - g x) x = partial2 i j f x - partial2 i j g x`
2167 [
2168 ((BETA_TAC THEN (move ["d2f"]) THEN (move ["d2g"])) THEN ((((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("second_partial_add", [second_partial_add]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_neg", [diff2_neg]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("second_partial_neg", [second_partial_neg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2169 ];;
2170
2171 (* Lemma second_partial_mul *)
2172 let second_partial_mul = Sections.section_proof ["f";"g"]
2173 `diff2 f x ==> diff2 g x ==>
2174 partial2 i j (\x. f x * g x) x = (partial2 i j f x * g x + partial j f x * partial i g x) +
2175 (partial i f x * partial j g x + f x * partial2 i j g x)`
2176 [
2177 ((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(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 ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"]));
2178 ((repeat_tactic 1 9 (((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("partial_mul", [partial_mul]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("partial_add", [partial_add]))(gsym_then (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 (repeat_tactic 0 1 (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] []))))));
2179 ((repeat_tactic 1 9 (((use_arg_then2 ("differentiable_mul", [differentiable_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 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2180 ((use_arg_then2 ("partial_local", [partial_local])) (thm_tac apply_tac));
2181 (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("OPEN_INTER", [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 [] [])))) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [] []))))));
2182 ((((use_arg_then2 ("f_lift_add", [f_lift_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
2183 ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("differentiable_mul", [differentiable_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 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2184 ((BETA_TAC THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"])))) THEN ((((use_arg_then2 ("partial_mul", [partial_mul]))(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 (done_tac));
2185 ];;
2186
2187 (* Lemma second_partial_uni_compose *)
2188 let second_partial_uni_compose = Sections.section_proof ["f";"u"]
2189 `diff2 f x ==> nth_diff_strong 2 u (f x) ==>
2190 partial2 i j (u o f) x = (nth_derivative 2 u (f x) * partial i f x) * partial j f x +
2191 derivative u (f x) * partial2 i j f x`
2192 [
2193 (((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] []))))) 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 (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["fxt"])) THEN (move ["du"]));
2194 ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN s /\ (lift o f) z IN (IMAGE lift t)}`))) (term_tac (set_tac "r")));
2195 ((fun arg_tac -> arg_tac (Arg_term (`open r`))) (term_tac (have_gen_tac [](move ["open_r"]))));
2196 ((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CONTINUOUS_OPEN_PREIMAGE", [CONTINUOUS_OPEN_PREIMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OPEN", [REAL_OPEN]))(gsym_then (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 [] []))))));
2197 (((use_arg_then2 ("DIFFERENTIABLE_IMP_CONTINUOUS_ON", [DIFFERENTIABLE_IMP_CONTINUOUS_ON])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("differentiable_on", [differentiable_on]))(thm_tac (new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["ys"])) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
2198 (((((use_arg_then2 ("DIFFERENTIABLE_AT_WITHIN", [DIFFERENTIABLE_AT_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2199 ((repeat_tactic 1 9 (((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))));
2200 ((((use_arg_then2 ("partial_uni_compose", [partial_uni_compose]))(gsym_then (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 ("du", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative u`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial_mul", [partial_mul]))(gsym_then (thm_tac (new_rewrite [] []))))));
2201 (((((use_arg_then2 ("diff_uni_compose", [diff_uni_compose]))(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 ("du", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2202 (((use_arg_then2 ("partial_local", [partial_local])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("r", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("open_r", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))));
2203 ((THENL_ROT (-1)) (((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LIFT_IN_IMAGE_LIFT", [LIFT_IN_IMAGE_LIFT]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)));
2204 ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN ((case THEN (move ["zs"])) THEN (move ["fpz"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("partial_uni_compose", [partial_uni_compose]))(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 ("du", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2205 ((THENL_LAST) (split_tac) (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)));
2206 (((use_arg_then2 ("differentiable_local_at", [differentiable_local_at])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("r", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`lift o (\y. derivative u (f y) * partial j f y)`))) (term_tac exists_tac))));
2207 ((((use_arg_then2 ("open_r", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("differentiable_mul", [differentiable_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
2208 ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative u`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then2 ("diff_uni_compose", [diff_uni_compose]))(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 ("du", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2209 ((THENL_FIRST) (((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_IN_IMAGE_LIFT", [LIFT_IN_IMAGE_LIFT]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)) (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)));
2210 ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["p"])) THEN (case THEN ((case THEN (move ["ps"])) THEN (move ["fpt"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("partial_uni_compose", [partial_uni_compose]))(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 ("du", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2211 ];;
2212
2213 (* Finalization of the section SecondPartial *)
2214 let diff2_imp_diff = Sections.finalize_theorem diff2_imp_diff;;
2215 let diff2_imp_partial_diff = Sections.finalize_theorem diff2_imp_partial_diff;;
2216 let partial_local = Sections.finalize_theorem partial_local;;
2217 let second_partial_scale = Sections.finalize_theorem second_partial_scale;;
2218 let second_partial_neg = Sections.finalize_theorem second_partial_neg;;
2219 let second_partial_add = Sections.finalize_theorem second_partial_add;;
2220 let second_partial_sub = Sections.finalize_theorem second_partial_sub;;
2221 let second_partial_mul = Sections.finalize_theorem second_partial_mul;;
2222 let second_partial_uni_compose = Sections.finalize_theorem second_partial_uni_compose;;
2223 Sections.end_section "SecondPartial";;
2224
2225 (* Finalization of the section Diff2Arith *)
2226 let differentiable_local_at = Sections.finalize_theorem differentiable_local_at;;
2227 let diff2_scale = Sections.finalize_theorem diff2_scale;;
2228 let diff2_neg = Sections.finalize_theorem diff2_neg;;
2229 let has_derivative_uni_compose = Sections.finalize_theorem has_derivative_uni_compose;;
2230 let diff_uni_compose = Sections.finalize_theorem diff_uni_compose;;
2231 let diff2_uni_compose = Sections.finalize_theorem diff2_uni_compose;;
2232 let diff2_abs_pos_compose = Sections.finalize_theorem diff2_abs_pos_compose;;
2233 let diff2_abs_neg_compose = Sections.finalize_theorem diff2_abs_neg_compose;;
2234 let diff2_pow_compose = Sections.finalize_theorem diff2_pow_compose;;
2235 let diff2_inv_compose = Sections.finalize_theorem diff2_inv_compose;;
2236 let diff2_sqrt_compose = Sections.finalize_theorem diff2_sqrt_compose;;
2237 let diff2_atn_compose = Sections.finalize_theorem diff2_atn_compose;;
2238 let diff2_cos_compose = Sections.finalize_theorem diff2_cos_compose;;
2239 let diff2_sin_compose = Sections.finalize_theorem diff2_sin_compose;;
2240 let diff2_exp_compose = Sections.finalize_theorem diff2_exp_compose;;
2241 let diff2_log_compose = Sections.finalize_theorem diff2_log_compose;;
2242 let diff2_acs_compose = Sections.finalize_theorem diff2_acs_compose;;
2243 let diff2_asn_compose = Sections.finalize_theorem diff2_asn_compose;;
2244 let diff2_matan_compose = Sections.finalize_theorem diff2_matan_compose;;
2245 let diff2_add = Sections.finalize_theorem diff2_add;;
2246 let diff2_sub = Sections.finalize_theorem diff2_sub;;
2247 let diff2_mul = Sections.finalize_theorem diff2_mul;;
2248 let diff2_domain_scale = Sections.finalize_theorem diff2_domain_scale;;
2249 let diff2_domain_neg = Sections.finalize_theorem diff2_domain_neg;;
2250 let diff2_domain_inv_compose = Sections.finalize_theorem diff2_domain_inv_compose;;
2251 let diff2_domain_sqrt_compose = Sections.finalize_theorem diff2_domain_sqrt_compose;;
2252 let diff2_domain_abs_pos_compose = Sections.finalize_theorem diff2_domain_abs_pos_compose;;
2253 let diff2_domain_abs_neg_compose = Sections.finalize_theorem diff2_domain_abs_neg_compose;;
2254 let diff2_domain_pow_compose = Sections.finalize_theorem diff2_domain_pow_compose;;
2255 let diff2_domain_atn_compose = Sections.finalize_theorem diff2_domain_atn_compose;;
2256 let diff2_domain_cos_compose = Sections.finalize_theorem diff2_domain_cos_compose;;
2257 let diff2_domain_sin_compose = Sections.finalize_theorem diff2_domain_sin_compose;;
2258 let diff2_domain_exp_compose = Sections.finalize_theorem diff2_domain_exp_compose;;
2259 let diff2_domain_log_compose = Sections.finalize_theorem diff2_domain_log_compose;;
2260 let diff2_domain_acs_compose = Sections.finalize_theorem diff2_domain_acs_compose;;
2261 let diff2_domain_asn_compose = Sections.finalize_theorem diff2_domain_asn_compose;;
2262 let diff2_domain_matan_compose = Sections.finalize_theorem diff2_domain_matan_compose;;
2263 let diff2_domain_add = Sections.finalize_theorem diff2_domain_add;;
2264 let diff2_domain_sub = Sections.finalize_theorem diff2_domain_sub;;
2265 let diff2_domain_mul = Sections.finalize_theorem diff2_domain_mul;;
2266 let diff2_imp_diff = Sections.finalize_theorem diff2_imp_diff;;
2267 let diff2_imp_partial_diff = Sections.finalize_theorem diff2_imp_partial_diff;;
2268 let partial_local = Sections.finalize_theorem partial_local;;
2269 let second_partial_scale = Sections.finalize_theorem second_partial_scale;;
2270 let second_partial_neg = Sections.finalize_theorem second_partial_neg;;
2271 let second_partial_add = Sections.finalize_theorem second_partial_add;;
2272 let second_partial_sub = Sections.finalize_theorem second_partial_sub;;
2273 let second_partial_mul = Sections.finalize_theorem second_partial_mul;;
2274 let second_partial_uni_compose = Sections.finalize_theorem second_partial_uni_compose;;
2275 Sections.end_section "Diff2Arith";;
2276
2277 (* Section Diff2c *)
2278 Sections.begin_section "Diff2c";;
2279
2280 (* Lemma real_cont_at_local *)
2281 let real_cont_at_local = Sections.section_proof ["f";"g";"x";"s"]
2282 `g real_continuous at x ==> open s ==> x IN s ==>
2283 (!y. y IN s ==> f y = g y) ==> f real_continuous at x`
2284 [
2285 ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL real_continuous_at)))(thm_tac (new_rewrite [] []))))) THEN (move ["g_cont"]) THEN (move ["open_s"]) THEN (move ["xs"]) THEN (move ["f_eq_g"]) THEN (move ["e"]) THEN (move ["e_gt0"]));
2286 (((fun arg_tac -> (use_arg_then2 ("OPEN_CONTAINS_BALL", [OPEN_CONTAINS_BALL])) (fun fst_arg -> (use_arg_then2 ("s", [])) (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 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("ball", [ball]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)));
2287 (((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC THEN (case THEN (move ["d0"])) THEN (case THEN (move ["d0_gt0"])) THEN (move ["sub_s"]));
2288 (((fun arg_tac -> (use_arg_then2 ("g_cont", [])) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["d1"])) THEN (case THEN (move ["d1_gt0"])) THEN (move ["dist_cond"]));
2289 ((fun arg_tac -> arg_tac (Arg_term (`min d0 d1`))) (term_tac exists_tac));
2290 (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_LT_MIN", [REAL_LT_MIN]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d1_gt0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d0_gt0", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"]) THEN (case THEN ((move ["yd0"]) THEN (move ["yd1"]))));
2291 ((repeat_tactic 1 9 (((use_arg_then2 ("f_eq_g", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
2292 (((((use_arg_then2 ("sub_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (done_tac));
2293 (((use_arg_then2 ("dist_cond", [])) (disch_tac [])) THEN (clear_assumption "dist_cond") THEN (exact_tac));
2294 ];;
2295
2296 (* Lemma real_cont_atreal_local *)
2297 let real_cont_atreal_local = Sections.section_proof ["v";"u";"t";"x"]
2298 `v real_continuous atreal x ==> real_open t ==> x IN t ==>
2299 (!y. y IN t ==> u y = v y) ==> u real_continuous atreal x`
2300 [
2301 (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS_ATREAL)))(thm_tac (new_rewrite [] [])))));
2302 (((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("REAL_OPEN", [REAL_OPEN]))(thm_tac (new_rewrite [] []))))) THEN (move ["vc"]) THEN (move ["open_t"]) THEN (move ["xt"]) THEN (move ["v_eq_u"]));
2303 ((use_arg_then2 ("real_cont_at_local", [real_cont_at_local])) (thm_tac apply_tac));
2304 (((fun arg_tac -> arg_tac (Arg_term (`v o drop`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`IMAGE lift t`))) (term_tac exists_tac)));
2305 ((((((use_arg_then2 ("open_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vc", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("LIFT_IN_IMAGE_LIFT", [LIFT_IN_IMAGE_LIFT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xt", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_IMAGE_LIFT_DROP", [IN_IMAGE_LIFT_DROP]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("v_eq_u", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac));
2306 ];;
2307 (Sections.add_section_type (mk_var ("f", (`:real^N -> real`))); Sections.add_section_type (mk_var ("g", (`:real^N -> real`))));;
2308 (Sections.add_section_var (mk_var ("x", (`:real^N`))));;
2309 (Sections.add_section_var (mk_var ("domain", (`:real^N#real^N`))));;
2310
2311 (* Section Point *)
2312 Sections.begin_section "Point";;
2313
2314 (* Lemma diff2c_scale *)
2315 let diff2c_scale = Sections.section_proof ["f";"c"]
2316 `diff2c f x ==> diff2c (\x. c * f x) x`
2317 [
2318 (((repeat_tactic 1 9 (((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["p2c"])))) THEN (((((use_arg_then2 ("diff2_scale", [diff2_scale]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"])));
2319 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("p2c", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["p2ij"])));
2320 ((use_arg_then2 ("real_cont_at_local", [real_cont_at_local])) (thm_tac apply_tac));
2321 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(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 ["d2s"])));
2322 (((fun arg_tac -> arg_tac (Arg_term (`(\x. c * partial2 j i f x)`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("s", [])) (term_tac exists_tac)));
2323 ((THENL_FIRST) (((use_arg_then2 ("REAL_CONTINUOUS_LMUL", [REAL_CONTINUOUS_LMUL]))(thm_tac (new_rewrite [] [])))) ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)));
2324 (((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("d2s", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["d2y"]));
2325 ((((use_arg_then2 ("second_partial_scale", [second_partial_scale]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2326 ];;
2327
2328 (* Lemma diff2c_neg *)
2329 let diff2c_neg = Sections.section_proof ["f"]
2330 `diff2c f x ==> diff2c (\x. --f x) x`
2331 [
2332 (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_scale", [diff2c_scale])) (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 (`--(&1)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("REAL_NEG_MINUS1", [REAL_NEG_MINUS1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac));
2333 ];;
2334
2335 (* Section Composite *)
2336 Sections.begin_section "Composite";;
2337
2338 (* Lemma nth_diff_strong_eq_on_open *)
2339 let nth_diff_strong_eq_on_open = Sections.section_proof ["n";"u";"x"]
2340 `nth_diff_strong n u x ==>
2341 ?s. real_open s /\ x IN s /\ (!y. y IN s ==> nth_diff_strong n u y)`
2342 [
2343 ((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["dt"]));
2344 (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("xt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("open_t", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"]) THEN (move ["yt"])));
2345 (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (done_tac));
2346 ];;
2347
2348 (* Lemma diff2_imp_cont *)
2349 let diff2_imp_cont = Sections.section_proof ["f";"x"]
2350 `diff2 f x ==> f real_continuous at x`
2351 [
2352 ((((use_arg_then2 ("diff2", [diff2]))(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 ["df"]));
2353 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_IMP_CONTINUOUS_AT", [DIFFERENTIABLE_IMP_CONTINUOUS_AT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2354 ];;
2355
2356 (* Lemma diff2_imp_partial_cont *)
2357 let diff2_imp_partial_cont = Sections.section_proof ["f";"i";"x"]
2358 `diff2 f x ==> (partial i f) real_continuous at x`
2359 [
2360 ((((use_arg_then2 ("diff2", [diff2]))(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 ["df"]));
2361 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_IMP_CONTINUOUS_AT", [DIFFERENTIABLE_IMP_CONTINUOUS_AT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2362 ];;
2363
2364 (* Lemma diff2c_uni_compose *)
2365 let diff2c_uni_compose = Sections.section_proof ["u";"f";"x"]
2366 `diff2c f x ==> nth_diff_strong 2 u (f x) ==>
2367 (nth_derivative 2 u) real_continuous atreal (f x) ==> diff2c (u o f) x`
2368 [
2369 ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d2f"])) THEN (move ["p2c"]) THEN (move ["d2u"]) THEN (move ["u2c"]));
2370 (((((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2u", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"]));
2371 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("p2c", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["p2ij"])));
2372 ((use_arg_then2 ("real_cont_at_local", [real_cont_at_local])) (thm_tac apply_tac));
2373 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(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 ["d2s"])));
2374 (((fun arg_tac -> (use_arg_then2 ("nth_diff_strong_eq_on_open", [nth_diff_strong_eq_on_open])) (fun fst_arg -> (use_arg_then2 ("d2u", [])) (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 ["fxt"])) THEN (move ["d2t"]));
2375 ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN s /\ (lift o f) z IN (IMAGE lift t)}`))) (term_tac (set_tac "r")));
2376 ((fun arg_tac -> arg_tac (Arg_term (`open r`))) (term_tac (have_gen_tac [](move ["open_r"]))));
2377 ((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CONTINUOUS_OPEN_PREIMAGE", [CONTINUOUS_OPEN_PREIMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OPEN", [REAL_OPEN]))(gsym_then (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 [] []))))));
2378 (((use_arg_then2 ("DIFFERENTIABLE_IMP_CONTINUOUS_ON", [DIFFERENTIABLE_IMP_CONTINUOUS_ON])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("differentiable_on", [differentiable_on]))(thm_tac (new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["ys"])) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
2379 (((use_arg_then2 ("DIFFERENTIABLE_AT_WITHIN", [DIFFERENTIABLE_AT_WITHIN]))(thm_tac (new_rewrite [] []))));
2380 ((((fun arg_tac -> (use_arg_then2 ("d2s", [])) (fun fst_arg -> (use_arg_then2 ("ys", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s'"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["ys'"]))));
2381 ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("ys'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac));
2382 (((fun arg_tac -> arg_tac (Arg_term (`(\x. (nth_derivative 2 u (f x) * partial j f x) * partial i f x + derivative u (f x) * partial2 j i f x)`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("r", [])) (term_tac exists_tac)));
2383 ((THENL_ROT (-1)) (((((use_arg_then2 ("open_r", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LIFT_IN_IMAGE_LIFT", [LIFT_IN_IMAGE_LIFT]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)));
2384 (BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["zs"])) THEN (move ["fzt"]) THEN (move ["yz"]));
2385 (((((use_arg_then2 ("second_partial_uni_compose", [second_partial_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("yz", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2s", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("d2t", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2386 ((THENL_LAST) (split_tac) (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)));
2387 (((((use_arg_then2 ("REAL_CONTINUOUS_ADD", [REAL_CONTINUOUS_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("diff2_imp_partial_cont", [diff2_imp_partial_cont]))(fun tmp_arg1 -> (use_arg_then2 ("d2s", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
2388 (((((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(gsym_then (thm_tac (new_rewrite [] [(`nth_derivative 2 u _1`)])))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
2389 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] []))));
2390 ((((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONTINUOUS_REAL_CONTINUOUS_AT_COMPOSE", [CONTINUOUS_REAL_CONTINUOUS_AT_COMPOSE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_imp_cont", [diff2_imp_cont]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2s", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2391 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ATREAL_WITHINREAL", [REAL_CONTINUOUS_ATREAL_WITHINREAL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2392 (((((use_arg_then2 ("p2ij", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(gsym_then (thm_tac (new_rewrite [] [(`derivative u _`)])))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
2393 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] []))));
2394 ((((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONTINUOUS_REAL_CONTINUOUS_AT_COMPOSE", [CONTINUOUS_REAL_CONTINUOUS_AT_COMPOSE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_imp_cont", [diff2_imp_cont]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2s", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2395 ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ATREAL_WITHINREAL", [REAL_CONTINUOUS_ATREAL_WITHINREAL]))(thm_tac (new_rewrite [] [])))));
2396 ((((use_arg_then2 ("nth_derivative1", [nth_derivative1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("nth_derivative_continuous", [nth_derivative_continuous])) (thm_tac apply_tac)));
2397 ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`2`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac)));
2398 ((((fun arg_tac -> (use_arg_then2 ("d2t", [])) (fun fst_arg -> (use_arg_then2 ("fxt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) 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 ALL_TAC THEN (case THEN (move ["t'"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["fxt'"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2399 ];;
2400
2401 (* Lemma real_open_delete *)
2402 let real_open_delete = Sections.section_proof ["s";"x"]
2403 `real_open s ==> real_open (s DELETE x)`
2404 [
2405 ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_OPEN", [REAL_OPEN]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("OPEN_DELETE", [OPEN_DELETE])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`lift x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)));
2406 (((((use_arg_then2 ("IMAGE_DELETE_INJ_COMPAT", [IMAGE_DELETE_INJ_COMPAT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("LIFT_EQ", [LIFT_EQ]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2407 ];;
2408
2409 (* Lemma diff2c_inv_compose *)
2410 let diff2c_inv_compose = Sections.section_proof ["f"]
2411 `~(f x = &0) ==> diff2c f x ==> diff2c (inv o f) x`
2412 [
2413 ((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] [])))));
2414 ((((fun arg_tac -> (use_arg_then2 ("diff2_inv", [diff2_inv])) (fun fst_arg -> (use_arg_then2 ("fn0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2415 (((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac));
2416 (((fun arg_tac -> arg_tac (Arg_term (`\x. &2 * inv (x pow 3)`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`UNIV DELETE (&0)`))) (term_tac exists_tac)));
2417 ((THENL_ROT (-1)) (((((use_arg_then2 ("real_open_delete", [real_open_delete]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_OPEN_UNIV", [REAL_OPEN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fn0", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)));
2418 ((BETA_TAC THEN (move ["y"]) THEN (move ["yn0"])) THEN (((use_arg_then2 ("second_derivative_inv", [second_derivative_inv]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2419 ((((use_arg_then2 ("REAL_CONTINUOUS_LMUL", [REAL_CONTINUOUS_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_INV_ATREAL", [REAL_CONTINUOUS_INV_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] []))))));
2420 ((((use_arg_then2 ("REAL_POW_NZ", [REAL_POW_NZ]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2421 ];;
2422
2423 (* Lemma diff2c_sqrt_compose *)
2424 let diff2c_sqrt_compose = Sections.section_proof ["f"]
2425 `&0 < f x ==> diff2c f x ==> diff2c (sqrt o f) x`
2426 [
2427 ((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] [])))));
2428 ((((fun arg_tac -> (use_arg_then2 ("diff2_sqrt", [diff2_sqrt])) (fun fst_arg -> (use_arg_then2 ("fn0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2429 (((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac));
2430 (((fun arg_tac -> arg_tac (Arg_term (`\x. -- inv (&4 * sqrt (x pow 3))`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`{x | x > &0}`))) (term_tac exists_tac)));
2431 ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_OPEN_HALFSPACE_GT", [REAL_OPEN_HALFSPACE_GT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)));
2432 ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z0"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("second_derivative_sqrt", [second_derivative_sqrt]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2433 ((THENL_LAST) (split_tac) (((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (done_tac)));
2434 ((THENL_ROT (-1)) ((((use_arg_then2 ("REAL_CONTINUOUS_NEG", [REAL_CONTINUOUS_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_INV_ATREAL", [REAL_CONTINUOUS_INV_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_LMUL", [REAL_CONTINUOUS_LMUL]))(thm_tac (new_rewrite [] []))))));
2435 ((THENL_FIRST) (((((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 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)) ((arith_tac) THEN (done_tac)));
2436 (((((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_POW_NZ", [REAL_POW_NZ]))(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 (done_tac));
2437 ((fun arg_tac -> arg_tac (Arg_term (`(\x. sqrt (x pow 3)) = (sqrt o (\x. x pow 3))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
2438 (((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2439 ((((use_arg_then2 ("REAL_CONTINUOUS_ATREAL_COMPOSE", [REAL_CONTINUOUS_ATREAL_COMPOSE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((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 [] [])))));
2440 (((((use_arg_then2 ("REAL_CONTINUOUS_AT_SQRT", [REAL_CONTINUOUS_AT_SQRT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POW_LT", [REAL_POW_LT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2441 ];;
2442
2443 (* Lemma diff2c_abs_pos_compose *)
2444 let diff2c_abs_pos_compose = Sections.section_proof ["f"]
2445 `&0 < f x ==> diff2c f x ==> diff2c (abs o f) x`
2446 [
2447 ((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] [])))));
2448 ((((fun arg_tac -> (use_arg_then2 ("diff2_abs_pos", [diff2_abs_pos])) (fun fst_arg -> (use_arg_then2 ("fn0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2449 (((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac));
2450 (((fun arg_tac -> arg_tac (Arg_term (`\x. &0`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`{x | x > &0}`))) (term_tac exists_tac)));
2451 ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_OPEN_HALFSPACE_GT", [REAL_OPEN_HALFSPACE_GT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)));
2452 ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z0"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("second_derivative_abs_pos", [second_derivative_abs_pos]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2453 ((((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2454 (((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (done_tac));
2455 ];;
2456
2457 (* Lemma diff2c_abs_neg_compose *)
2458 let diff2c_abs_neg_compose = Sections.section_proof ["f"]
2459 `f x < &0 ==> diff2c f x ==> diff2c (abs o f) x`
2460 [
2461 ((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] [])))));
2462 ((((fun arg_tac -> (use_arg_then2 ("diff2_abs_neg", [diff2_abs_neg])) (fun fst_arg -> (use_arg_then2 ("fn0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2463 (((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac));
2464 (((fun arg_tac -> arg_tac (Arg_term (`\x. &0`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`{x | x < &0}`))) (term_tac exists_tac)));
2465 ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_OPEN_HALFSPACE_LT", [REAL_OPEN_HALFSPACE_LT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (split_tac)));
2466 ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z0"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("second_derivative_abs_neg", [second_derivative_abs_neg]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2467 ((((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
2468 (((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (done_tac));
2469 ];;
2470
2471 (* Lemma diff2c_pow_compose *)
2472 let diff2c_pow_compose = Sections.section_proof ["n";"f"]
2473 `diff2c f x ==> diff2c ((\x. x pow n) o f) x`
2474 [
2475 ((BETA_TAC THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] [])))));
2476 ((((use_arg_then2 ("diff2_pow_x", [diff2_pow_x]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((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 [] [])))));
2477 (((((use_arg_then2 ("REAL_CONTINUOUS_LMUL", [REAL_CONTINUOUS_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2478 ];;
2479
2480 (* Lemma diff2c_atn_compose *)
2481 let diff2c_atn_compose = Sections.section_proof ["f"]
2482 `diff2c f x ==> diff2c (atn o f) x`
2483 [
2484 ((BETA_TAC THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] [])))));
2485 ((((use_arg_then2 ("diff2_atn", [diff2_atn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_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 [] [])))));
2486 ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)));
2487 ((((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_INV_ATREAL", [REAL_CONTINUOUS_INV_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ADD", [REAL_CONTINUOUS_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
2488 (((((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2489 (((use_arg_then2 ("REAL_RNEG_UNIQ", [REAL_RNEG_UNIQ]))(thm_tac (new_rewrite [] []))));
2490 ((fun arg_tac -> (use_arg_then2 ("REAL_LE_POW_2", [REAL_LE_POW_2])) (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 arg -> thm_tac MP_TAC arg THEN ALL_TAC));
2491 ((arith_tac) THEN (done_tac));
2492 ];;
2493
2494 (* Lemma diff2c_cos_compose *)
2495 let diff2c_cos_compose = Sections.section_proof ["f"]
2496 `diff2c f x ==> diff2c (cos o f) x`
2497 [
2498 ((BETA_TAC THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] [])))));
2499 ((((use_arg_then2 ("diff2_cos", [diff2_cos]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("second_derivative_cos", [second_derivative_cos]))(thm_tac (new_rewrite [] [])))));
2500 (((((use_arg_then2 ("REAL_CONTINUOUS_NEG", [REAL_CONTINUOUS_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_COS", [REAL_CONTINUOUS_AT_COS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2501 ];;
2502
2503 (* Lemma diff2c_sin_compose *)
2504 let diff2c_sin_compose = Sections.section_proof ["f"]
2505 `diff2c f x ==> diff2c (sin o f) x`
2506 [
2507 ((BETA_TAC THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] [])))));
2508 ((((use_arg_then2 ("diff2_sin", [diff2_sin]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("second_derivative_sin", [second_derivative_sin]))(thm_tac (new_rewrite [] [])))));
2509 (((((use_arg_then2 ("REAL_CONTINUOUS_NEG", [REAL_CONTINUOUS_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_SIN", [REAL_CONTINUOUS_AT_SIN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2510 ];;
2511
2512 (* Lemma diff2c_exp_compose *)
2513 let diff2c_exp_compose = Sections.section_proof ["f"]
2514 `diff2c f x ==> diff2c (exp o f) x`
2515 [
2516 ((BETA_TAC THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] [])))));
2517 ((((use_arg_then2 ("diff2_exp", [diff2_exp]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("second_derivative_exp", [second_derivative_exp]))(thm_tac (new_rewrite [] [])))));
2518 ((((use_arg_then2 ("REAL_CONTINUOUS_AT_EXP", [REAL_CONTINUOUS_AT_EXP]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2519 ];;
2520
2521 (* Lemma diff2c_log_compose *)
2522 let diff2c_log_compose = Sections.section_proof ["f"]
2523 `&0 < f x ==> diff2c f x ==> diff2c (log o f) x`
2524 [
2525 ((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] [])))));
2526 ((((fun arg_tac -> (use_arg_then2 ("diff2_log", [diff2_log])) (fun fst_arg -> (use_arg_then2 ("fn0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2527 (((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac));
2528 (((fun arg_tac -> arg_tac (Arg_term (`\x. -- inv (x pow 2)`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`{x | x > &0}`))) (term_tac exists_tac)));
2529 ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_OPEN_HALFSPACE_GT", [REAL_OPEN_HALFSPACE_GT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)));
2530 ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z0"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("second_derivative_log", [second_derivative_log]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2531 ((THENL_LAST) (split_tac) (((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (done_tac)));
2532 ((((use_arg_then2 ("REAL_CONTINUOUS_NEG", [REAL_CONTINUOUS_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_INV_ATREAL", [REAL_CONTINUOUS_INV_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] []))))));
2533 (((((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fn0", [])) (disch_tac [])) THEN (clear_assumption "fn0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2534 ];;
2535
2536 (* Lemma diff2c_acs_compose *)
2537 let diff2c_acs_compose = Sections.section_proof ["f"]
2538 `abs (f x) < &1 ==> diff2c f x ==> diff2c (acs o f) x`
2539 [
2540 ((BETA_TAC THEN (move ["fn1"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] [])))));
2541 ((((fun arg_tac -> (use_arg_then2 ("diff2_acs", [diff2_acs])) (fun fst_arg -> (use_arg_then2 ("fn1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2542 (((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac));
2543 (((fun arg_tac -> arg_tac (Arg_term (`\x. --(x / sqrt ((&1 - x * x) pow 3))`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`{x | x < &1} INTER {x | x > -- &1}`))) (term_tac exists_tac)));
2544 ((((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_OPEN_HALFSPACE_GT", [REAL_OPEN_HALFSPACE_GT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_OPEN_HALFSPACE_LT", [REAL_OPEN_HALFSPACE_LT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
2545 ((THENL_ROT (-1)) (((repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)));
2546 ((BETA_TAC THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["a"])) THEN (case THEN (move ["a1"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (case THEN (move ["b"])) THEN (case THEN (move ["b1"])) THEN (move ["ab"])) THEN ((((use_arg_then2 ("second_derivative_acs", [second_derivative_acs]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
2547 ((((use_arg_then2 ("a1", [])) (disch_tac [])) THEN (clear_assumption "a1") THEN ((use_arg_then2 ("b1", [])) (disch_tac [])) THEN (clear_assumption "b1") THEN ((use_arg_then2 ("ab", [])) (disch_tac [])) THEN (clear_assumption "ab") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2548 ((THENL_LAST) (split_tac) ((split_tac) THEN ((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("fn1", [])) (disch_tac [])) THEN (clear_assumption "fn1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2549 (((use_arg_then2 ("REAL_CONTINUOUS_NEG", [REAL_CONTINUOUS_NEG]))(thm_tac (new_rewrite [] []))));
2550 ((use_arg_then2 ("REAL_CONTINUOUS_DIV_ATREAL", [REAL_CONTINUOUS_DIV_ATREAL])) (thm_tac apply_tac));
2551 ((fun arg_tac -> arg_tac (Arg_term (`&0 < (&1 - f x * f x) pow 3`))) (term_tac (have_gen_tac [](move ["h"]))));
2552 (((use_arg_then2 ("REAL_POW_LT", [REAL_POW_LT]))(thm_tac (new_rewrite [] []))));
2553 ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. &1 - a * a = (&1 - a) * (&1 + a)`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] [])))));
2554 ((((use_arg_then2 ("fn1", [])) (disch_tac [])) THEN (clear_assumption "fn1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2555 ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)));
2556 (((((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_LT", [REAL_LE_LT]))(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 (done_tac));
2557 ((fun arg_tac -> arg_tac (Arg_term (`(\x. sqrt ((&1 - x * x) pow 3)) = sqrt o (\x. (&1 - x * x) pow 3)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
2558 (((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2559 ((((use_arg_then2 ("REAL_CONTINUOUS_ATREAL_COMPOSE", [REAL_CONTINUOUS_ATREAL_COMPOSE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_SQRT", [REAL_CONTINUOUS_AT_SQRT]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
2560 ((((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_SUB", [REAL_CONTINUOUS_SUB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] [])))));
2561 (((((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2562 ];;
2563
2564 (* Lemma diff2c_asn_compose *)
2565 let diff2c_asn_compose = Sections.section_proof ["f"]
2566 `abs (f x) < &1 ==> diff2c f x ==> diff2c (asn o f) x`
2567 [
2568 ((BETA_TAC THEN (move ["fn1"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] [])))));
2569 ((((fun arg_tac -> (use_arg_then2 ("diff2_asn", [diff2_asn])) (fun fst_arg -> (use_arg_then2 ("fn1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2570 (((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac));
2571 (((fun arg_tac -> arg_tac (Arg_term (`\x. x / sqrt ((&1 - x * x) pow 3)`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`{x | x < &1} INTER {x | x > -- &1}`))) (term_tac exists_tac)));
2572 ((((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_OPEN_HALFSPACE_GT", [REAL_OPEN_HALFSPACE_GT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_OPEN_HALFSPACE_LT", [REAL_OPEN_HALFSPACE_LT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
2573 ((THENL_ROT (-1)) (((repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)));
2574 ((BETA_TAC THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["a"])) THEN (case THEN (move ["a1"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (case THEN (move ["b"])) THEN (case THEN (move ["b1"])) THEN (move ["ab"])) THEN ((((use_arg_then2 ("second_derivative_asn", [second_derivative_asn]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
2575 ((((use_arg_then2 ("a1", [])) (disch_tac [])) THEN (clear_assumption "a1") THEN ((use_arg_then2 ("b1", [])) (disch_tac [])) THEN (clear_assumption "b1") THEN ((use_arg_then2 ("ab", [])) (disch_tac [])) THEN (clear_assumption "ab") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2576 ((THENL_LAST) (split_tac) ((split_tac) THEN ((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("fn1", [])) (disch_tac [])) THEN (clear_assumption "fn1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2577 ((use_arg_then2 ("REAL_CONTINUOUS_DIV_ATREAL", [REAL_CONTINUOUS_DIV_ATREAL])) (thm_tac apply_tac));
2578 ((fun arg_tac -> arg_tac (Arg_term (`&0 < (&1 - f x * f x) pow 3`))) (term_tac (have_gen_tac [](move ["h"]))));
2579 (((use_arg_then2 ("REAL_POW_LT", [REAL_POW_LT]))(thm_tac (new_rewrite [] []))));
2580 ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. &1 - a * a = (&1 - a) * (&1 + a)`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] [])))));
2581 ((((use_arg_then2 ("fn1", [])) (disch_tac [])) THEN (clear_assumption "fn1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2582 ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)));
2583 (((((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_LT", [REAL_LE_LT]))(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 (done_tac));
2584 ((fun arg_tac -> arg_tac (Arg_term (`(\x. sqrt ((&1 - x * x) pow 3)) = sqrt o (\x. (&1 - x * x) pow 3)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
2585 (((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2586 ((((use_arg_then2 ("REAL_CONTINUOUS_ATREAL_COMPOSE", [REAL_CONTINUOUS_ATREAL_COMPOSE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_SQRT", [REAL_CONTINUOUS_AT_SQRT]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
2587 ((((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_SUB", [REAL_CONTINUOUS_SUB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] [])))));
2588 (((((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2589 ];;
2590
2591 (* Lemma diff2c_matan_compose *)
2592 let diff2c_matan_compose = Sections.section_proof ["f"]
2593 `-- &1 < f x ==> diff2c f x ==> diff2c (matan o f) x`
2594 [
2595 ((BETA_TAC THEN (move ["fn1"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] [])))));
2596 ((((fun arg_tac -> (use_arg_then2 ("diff2_matan", [diff2_matan])) (fun fst_arg -> (use_arg_then2 ("fn1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2597 ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x < &1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["fn2"])));
2598 ((((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac)) THEN ((((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 [] []))))));
2599 ((fun arg_tac -> arg_tac (Arg_term (`\x. (&3 / &4 * atn (sqrt x) / (x pow 2 * sqrt x) - &3 / &4 * inv (x pow 2 * (x + &1))) - &1 / &2 * inv (x * (x + &1) pow 2)`))) (term_tac (set_tac "g")));
2600 (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval (&0, f x + &1)`))) (term_tac exists_tac)));
2601 ((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 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)));
2602 ((BETA_TAC THEN (move ["y"]) THEN (move ["y_ineq"])) THEN ((((use_arg_then2 ("Matan.matan_second_derivative_gt0", [Matan.matan_second_derivative_gt0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2603 ((THENL_LAST) (split_tac) ((((use_arg_then2 ("fn2", [])) (disch_tac [])) THEN (clear_assumption "fn2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2604 ((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_SUB", [REAL_CONTINUOUS_SUB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_LMUL", [REAL_CONTINUOUS_LMUL]))(thm_tac (new_rewrite [] [])))));
2605 ((((use_arg_then2 ("REAL_CONTINUOUS_INV_ATREAL", [REAL_CONTINUOUS_INV_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
2606 (((((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ADD", [REAL_CONTINUOUS_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2607 (((((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("fn2", [])) (disch_tac [])) THEN (clear_assumption "fn2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2608 ((((use_arg_then2 ("REAL_CONTINUOUS_SUB", [REAL_CONTINUOUS_SUB]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_CONTINUOUS_LMUL", [REAL_CONTINUOUS_LMUL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
2609 ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_DIV_ATREAL)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] [])))));
2610 (((((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_SQRT", [REAL_CONTINUOUS_AT_SQRT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2611 ((THENL_LAST) (((((use_arg_then2 ("andTb", [andTb]))(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_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)) ((((use_arg_then2 ("fn2", [])) (disch_tac [])) THEN (clear_assumption "fn2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2612 ((((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_CONTINUOUS_ATREAL_COMPOSE", [REAL_CONTINUOUS_ATREAL_COMPOSE]))(thm_tac (new_rewrite [] [])))));
2613 (((((use_arg_then2 ("REAL_CONTINUOUS_AT_ATN", [REAL_CONTINUOUS_AT_ATN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_SQRT", [REAL_CONTINUOUS_AT_SQRT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("fn2", [])) (disch_tac [])) THEN (clear_assumption "fn2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2614 ((((use_arg_then2 ("REAL_CONTINUOUS_INV_ATREAL", [REAL_CONTINUOUS_INV_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
2615 (((((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_ADD", [REAL_CONTINUOUS_ADD]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2616 (((((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("fn2", [])) (disch_tac [])) THEN (clear_assumption "fn2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2617 ((((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 ("Matan.ddmatan", [Matan.ddmatan]))(gsym_then (thm_tac (new_rewrite [] []))))));
2618 (((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));
2619 (((use_arg_then2 ("Matan.matan_second_derivative_abs1", [Matan.matan_second_derivative_abs1])) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((((use_arg_then2 ("Matan.ddmatan", [Matan.ddmatan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["d2"])));
2620 ((fun arg_tac -> arg_tac (Arg_term (`\i. -- &1 pow (i + 2) * &((i + 1) * (i + 2)) / &(2 * i + 5)`))) (term_tac (set_tac "a")));
2621 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Series.power_series_has_derivative", [Series.power_series_has_derivative])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`ddmatan`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`from 0`))) (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 arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC));
2622 ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN ((((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("d2", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2623 (BETA_TAC THEN (case THEN (move ["h"])) THEN (move ["h_diff"]));
2624 (((fun arg_tac -> arg_tac (Arg_term (`h (f x)`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("h_diff", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fn1", [])) (disch_tac [])) THEN (clear_assumption "fn1") THEN ((use_arg_then2 ("fn2", [])) (disch_tac [])) THEN (clear_assumption "fn2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2625 ];;
2626
2627 (* Finalization of the section Composite *)
2628 let nth_diff_strong_eq_on_open = Sections.finalize_theorem nth_diff_strong_eq_on_open;;
2629 let diff2_imp_cont = Sections.finalize_theorem diff2_imp_cont;;
2630 let diff2_imp_partial_cont = Sections.finalize_theorem diff2_imp_partial_cont;;
2631 let diff2c_uni_compose = Sections.finalize_theorem diff2c_uni_compose;;
2632 let real_open_delete = Sections.finalize_theorem real_open_delete;;
2633 let diff2c_inv_compose = Sections.finalize_theorem diff2c_inv_compose;;
2634 let diff2c_sqrt_compose = Sections.finalize_theorem diff2c_sqrt_compose;;
2635 let diff2c_abs_pos_compose = Sections.finalize_theorem diff2c_abs_pos_compose;;
2636 let diff2c_abs_neg_compose = Sections.finalize_theorem diff2c_abs_neg_compose;;
2637 let diff2c_pow_compose = Sections.finalize_theorem diff2c_pow_compose;;
2638 let diff2c_atn_compose = Sections.finalize_theorem diff2c_atn_compose;;
2639 let diff2c_cos_compose = Sections.finalize_theorem diff2c_cos_compose;;
2640 let diff2c_sin_compose = Sections.finalize_theorem diff2c_sin_compose;;
2641 let diff2c_exp_compose = Sections.finalize_theorem diff2c_exp_compose;;
2642 let diff2c_log_compose = Sections.finalize_theorem diff2c_log_compose;;
2643 let diff2c_acs_compose = Sections.finalize_theorem diff2c_acs_compose;;
2644 let diff2c_asn_compose = Sections.finalize_theorem diff2c_asn_compose;;
2645 let diff2c_matan_compose = Sections.finalize_theorem diff2c_matan_compose;;
2646 Sections.end_section "Composite";;
2647
2648 (* Lemma diff2c_add *)
2649 let diff2c_add = Sections.section_proof ["f";"g"]
2650 `diff2c f x ==> diff2c g x ==> diff2c (\x. f x + g x) x`
2651 [
2652 (((repeat_tactic 1 9 (((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["p2f"]))) THEN (case THEN ((move ["d2g"]) THEN (move ["p2g"])))) THEN (((((use_arg_then2 ("diff2_add", [diff2_add]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"])));
2653 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("p2g", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("p2f", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["p2fij"]) THEN (move ["p2gij"])));
2654 ((use_arg_then2 ("real_cont_at_local", [real_cont_at_local])) (thm_tac apply_tac));
2655 ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(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 ["d2f"])));
2656 ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["d2g"]));
2657 (((fun arg_tac -> arg_tac (Arg_term (`(\x. partial2 j i f x + partial2 j i g x)`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)));
2658 ((THENL_FIRST) ((repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("OPEN_INTER", [OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ADD", [REAL_CONTINUOUS_ADD]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)));
2659 ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((((use_arg_then2 ("second_partial_add", [second_partial_add]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2660 ];;
2661
2662 (* Lemma diff2c_sub *)
2663 let diff2c_sub = Sections.section_proof ["f";"g"]
2664 `diff2c f x ==> diff2c g x ==> diff2c (\x. f x - g x) x`
2665 [
2666 ((BETA_TAC THEN (move ["d2f"]) THEN (move ["d2g"])) THEN ((((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_add", [diff2c_add]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("diff2c_neg", [diff2c_neg]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2667 ];;
2668
2669 (* Lemma diff2c_mul *)
2670 let diff2c_mul = Sections.section_proof ["f";"g"]
2671 `diff2c f x ==> diff2c g x ==> diff2c (\x. f x * g x) x`
2672 [
2673 (((repeat_tactic 1 9 (((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["p2f"]))) THEN (case THEN ((move ["d2g"]) THEN (move ["p2g"])))) THEN (((((use_arg_then2 ("diff2_mul", [diff2_mul]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"])));
2674 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("p2g", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("p2f", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["p2fij"]) THEN (move ["p2gij"])));
2675 ((use_arg_then2 ("real_cont_at_local", [real_cont_at_local])) (thm_tac apply_tac));
2676 ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(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 ["d2f"])));
2677 ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["d2g"]));
2678 (((fun arg_tac -> arg_tac (Arg_term (`(\x. (partial2 j i f x * g x + partial i f x * partial j g x) +
2679 partial j f x * partial i g x + f x * partial2 j i g x)`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)));
2680 ((THENL_ROT (-1)) (((repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("OPEN_INTER", [OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN (split_tac)));
2681 ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((((use_arg_then2 ("second_partial_mul", [second_partial_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2682 (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_CONTINUOUS_ADD", [REAL_CONTINUOUS_ADD]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(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))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("p2gij", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("p2fij", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_imp_partial_cont", [diff2_imp_partial_cont]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_imp_cont", [diff2_imp_cont]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2683 ];;
2684
2685 (* Finalization of the section Point *)
2686 let diff2c_scale = Sections.finalize_theorem diff2c_scale;;
2687 let diff2c_neg = Sections.finalize_theorem diff2c_neg;;
2688 let nth_diff_strong_eq_on_open = Sections.finalize_theorem nth_diff_strong_eq_on_open;;
2689 let diff2_imp_cont = Sections.finalize_theorem diff2_imp_cont;;
2690 let diff2_imp_partial_cont = Sections.finalize_theorem diff2_imp_partial_cont;;
2691 let diff2c_uni_compose = Sections.finalize_theorem diff2c_uni_compose;;
2692 let real_open_delete = Sections.finalize_theorem real_open_delete;;
2693 let diff2c_inv_compose = Sections.finalize_theorem diff2c_inv_compose;;
2694 let diff2c_sqrt_compose = Sections.finalize_theorem diff2c_sqrt_compose;;
2695 let diff2c_abs_pos_compose = Sections.finalize_theorem diff2c_abs_pos_compose;;
2696 let diff2c_abs_neg_compose = Sections.finalize_theorem diff2c_abs_neg_compose;;
2697 let diff2c_pow_compose = Sections.finalize_theorem diff2c_pow_compose;;
2698 let diff2c_atn_compose = Sections.finalize_theorem diff2c_atn_compose;;
2699 let diff2c_cos_compose = Sections.finalize_theorem diff2c_cos_compose;;
2700 let diff2c_sin_compose = Sections.finalize_theorem diff2c_sin_compose;;
2701 let diff2c_exp_compose = Sections.finalize_theorem diff2c_exp_compose;;
2702 let diff2c_log_compose = Sections.finalize_theorem diff2c_log_compose;;
2703 let diff2c_acs_compose = Sections.finalize_theorem diff2c_acs_compose;;
2704 let diff2c_asn_compose = Sections.finalize_theorem diff2c_asn_compose;;
2705 let diff2c_matan_compose = Sections.finalize_theorem diff2c_matan_compose;;
2706 let diff2c_add = Sections.finalize_theorem diff2c_add;;
2707 let diff2c_sub = Sections.finalize_theorem diff2c_sub;;
2708 let diff2c_mul = Sections.finalize_theorem diff2c_mul;;
2709 Sections.end_section "Point";;
2710
2711 (* Section Domain *)
2712 Sections.begin_section "Domain";;
2713 (Sections.add_section_var (mk_var ("f", (`:real^N -> real`))); Sections.add_section_var (mk_var ("g", (`:real^N -> real`))));;
2714 (Sections.add_section_hyp "d2f" (`diff2c_domain domain f`));;
2715
2716 (* Lemma diff2c_domain_scale *)
2717 let diff2c_domain_scale = Sections.section_proof ["c"]
2718 `diff2c_domain domain (\x. c * f x)`
2719 [
2720 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_scale", [diff2c_scale]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2721 ];;
2722
2723 (* Lemma diff2c_domain_neg *)
2724 let diff2c_domain_neg = Sections.section_proof []
2725 `diff2c_domain domain (\x. --f x)`
2726 [
2727 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_neg", [diff2c_neg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2728 ];;
2729 (Sections.add_section_var (mk_var ("bounds", (`:real#real`))));;
2730
2731 (* Lemma diff2c_domain_inv_compose *)
2732 let diff2c_domain_inv_compose = Sections.section_proof []
2733 `m_bounded_on_int f domain bounds ==>
2734 interval_not_zero bounds ==> diff2c_domain domain (inv o f)`
2735 [
2736 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
2737 (((((use_arg_then2 ("diff2c_inv_compose", [diff2c_inv_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_not_zero", [interval_arith_not_zero])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2738 ];;
2739
2740 (* Lemma diff2c_domain_sqrt_compose *)
2741 let diff2c_domain_sqrt_compose = Sections.section_proof []
2742 `m_bounded_on_int f domain bounds ==>
2743 interval_pos bounds ==> diff2c_domain domain (sqrt o f)`
2744 [
2745 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
2746 (((((use_arg_then2 ("diff2c_sqrt_compose", [diff2c_sqrt_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2747 ];;
2748
2749 (* Lemma diff2c_domain_abs_pos_compose *)
2750 let diff2c_domain_abs_pos_compose = Sections.section_proof []
2751 `m_bounded_on_int f domain bounds ==>
2752 interval_pos bounds ==> diff2c_domain domain (abs o f)`
2753 [
2754 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
2755 (((((use_arg_then2 ("diff2c_abs_pos_compose", [diff2c_abs_pos_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2756 ];;
2757
2758 (* Lemma diff2c_domain_abs_neg_compose *)
2759 let diff2c_domain_abs_neg_compose = Sections.section_proof []
2760 `m_bounded_on_int f domain bounds ==>
2761 interval_neg bounds ==> diff2c_domain domain (abs o f)`
2762 [
2763 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
2764 (((((use_arg_then2 ("diff2c_abs_neg_compose", [diff2c_abs_neg_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_neg", [interval_arith_neg])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2765 ];;
2766
2767 (* Lemma diff2c_domain_pow_compose *)
2768 let diff2c_domain_pow_compose = Sections.section_proof ["n"]
2769 `diff2c_domain domain ((\x. x pow n) o f)`
2770 [
2771 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_pow_compose", [diff2c_pow_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2772 ];;
2773
2774 (* Lemma diff2c_domain_atn_compose *)
2775 let diff2c_domain_atn_compose = Sections.section_proof []
2776 `diff2c_domain domain (atn o f)`
2777 [
2778 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_atn_compose", [diff2c_atn_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2779 ];;
2780
2781 (* Lemma diff2c_domain_cos_compose *)
2782 let diff2c_domain_cos_compose = Sections.section_proof []
2783 `diff2c_domain domain (cos o f)`
2784 [
2785 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_cos_compose", [diff2c_cos_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2786 ];;
2787
2788 (* Lemma diff2c_domain_sin_compose *)
2789 let diff2c_domain_sin_compose = Sections.section_proof []
2790 `diff2c_domain domain (sin o f)`
2791 [
2792 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_sin_compose", [diff2c_sin_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2793 ];;
2794
2795 (* Lemma diff2c_domain_exp_compose *)
2796 let diff2c_domain_exp_compose = Sections.section_proof []
2797 `diff2c_domain domain (exp o f)`
2798 [
2799 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_exp_compose", [diff2c_exp_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2800 ];;
2801
2802 (* Lemma diff2c_domain_log_compose *)
2803 let diff2c_domain_log_compose = Sections.section_proof []
2804 `m_bounded_on_int f domain bounds ==>
2805 interval_pos bounds ==> diff2c_domain domain (log o f)`
2806 [
2807 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
2808 (((((use_arg_then2 ("diff2c_log_compose", [diff2c_log_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2809 ];;
2810
2811 (* Lemma diff2c_domain_acs_compose *)
2812 let diff2c_domain_acs_compose = Sections.section_proof []
2813 `m_bounded_on_int f domain bounds ==>
2814 iabs bounds < &1 ==> diff2c_domain domain (acs o f)`
2815 [
2816 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
2817 (((((use_arg_then2 ("diff2c_acs_compose", [diff2c_acs_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2818 ];;
2819
2820 (* Lemma diff2c_domain_asn_compose *)
2821 let diff2c_domain_asn_compose = Sections.section_proof []
2822 `m_bounded_on_int f domain bounds ==>
2823 iabs bounds < &1 ==> diff2c_domain domain (asn o f)`
2824 [
2825 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
2826 (((((use_arg_then2 ("diff2c_asn_compose", [diff2c_asn_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2827 ];;
2828
2829 (* Lemma diff2c_domain_matan_compose *)
2830 let diff2c_domain_matan_compose = Sections.section_proof []
2831 `m_bounded_on_int f domain bounds ==>
2832 interval_gt (-- &1) bounds ==> diff2c_domain domain (matan o f)`
2833 [
2834 ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
2835 (((((use_arg_then2 ("diff2c_matan_compose", [diff2c_matan_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_gt", [interval_arith_gt])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2836 ];;
2837 (Sections.add_section_hyp "d2g" (`diff2c_domain domain g`));;
2838
2839 (* Lemma diff2c_domain_add *)
2840 let diff2c_domain_add = Sections.section_proof []
2841 `diff2c_domain domain (\x. f x + g x)`
2842 [
2843 ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_add", [diff2c_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2844 ];;
2845
2846 (* Lemma diff2c_domain_sub *)
2847 let diff2c_domain_sub = Sections.section_proof []
2848 `diff2c_domain domain (\x. f x - g x)`
2849 [
2850 ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_sub", [diff2c_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2851 ];;
2852
2853 (* Lemma diff2c_domain_mul *)
2854 let diff2c_domain_mul = Sections.section_proof []
2855 `diff2c_domain domain (\x. f x * g x)`
2856 [
2857 ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_mul", [diff2c_mul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2858 ];;
2859
2860 (* Finalization of the section Domain *)
2861 let diff2c_domain_scale = Sections.finalize_theorem diff2c_domain_scale;;
2862 let diff2c_domain_neg = Sections.finalize_theorem diff2c_domain_neg;;
2863 let diff2c_domain_inv_compose = Sections.finalize_theorem diff2c_domain_inv_compose;;
2864 let diff2c_domain_sqrt_compose = Sections.finalize_theorem diff2c_domain_sqrt_compose;;
2865 let diff2c_domain_abs_pos_compose = Sections.finalize_theorem diff2c_domain_abs_pos_compose;;
2866 let diff2c_domain_abs_neg_compose = Sections.finalize_theorem diff2c_domain_abs_neg_compose;;
2867 let diff2c_domain_pow_compose = Sections.finalize_theorem diff2c_domain_pow_compose;;
2868 let diff2c_domain_atn_compose = Sections.finalize_theorem diff2c_domain_atn_compose;;
2869 let diff2c_domain_cos_compose = Sections.finalize_theorem diff2c_domain_cos_compose;;
2870 let diff2c_domain_sin_compose = Sections.finalize_theorem diff2c_domain_sin_compose;;
2871 let diff2c_domain_exp_compose = Sections.finalize_theorem diff2c_domain_exp_compose;;
2872 let diff2c_domain_log_compose = Sections.finalize_theorem diff2c_domain_log_compose;;
2873 let diff2c_domain_acs_compose = Sections.finalize_theorem diff2c_domain_acs_compose;;
2874 let diff2c_domain_asn_compose = Sections.finalize_theorem diff2c_domain_asn_compose;;
2875 let diff2c_domain_matan_compose = Sections.finalize_theorem diff2c_domain_matan_compose;;
2876 let diff2c_domain_add = Sections.finalize_theorem diff2c_domain_add;;
2877 let diff2c_domain_sub = Sections.finalize_theorem diff2c_domain_sub;;
2878 let diff2c_domain_mul = Sections.finalize_theorem diff2c_domain_mul;;
2879 Sections.end_section "Domain";;
2880
2881 (* Finalization of the section Diff2c *)
2882 let real_cont_at_local = Sections.finalize_theorem real_cont_at_local;;
2883 let real_cont_atreal_local = Sections.finalize_theorem real_cont_atreal_local;;
2884 let diff2c_scale = Sections.finalize_theorem diff2c_scale;;
2885 let diff2c_neg = Sections.finalize_theorem diff2c_neg;;
2886 let nth_diff_strong_eq_on_open = Sections.finalize_theorem nth_diff_strong_eq_on_open;;
2887 let diff2_imp_cont = Sections.finalize_theorem diff2_imp_cont;;
2888 let diff2_imp_partial_cont = Sections.finalize_theorem diff2_imp_partial_cont;;
2889 let diff2c_uni_compose = Sections.finalize_theorem diff2c_uni_compose;;
2890 let real_open_delete = Sections.finalize_theorem real_open_delete;;
2891 let diff2c_inv_compose = Sections.finalize_theorem diff2c_inv_compose;;
2892 let diff2c_sqrt_compose = Sections.finalize_theorem diff2c_sqrt_compose;;
2893 let diff2c_abs_pos_compose = Sections.finalize_theorem diff2c_abs_pos_compose;;
2894 let diff2c_abs_neg_compose = Sections.finalize_theorem diff2c_abs_neg_compose;;
2895 let diff2c_pow_compose = Sections.finalize_theorem diff2c_pow_compose;;
2896 let diff2c_atn_compose = Sections.finalize_theorem diff2c_atn_compose;;
2897 let diff2c_cos_compose = Sections.finalize_theorem diff2c_cos_compose;;
2898 let diff2c_sin_compose = Sections.finalize_theorem diff2c_sin_compose;;
2899 let diff2c_exp_compose = Sections.finalize_theorem diff2c_exp_compose;;
2900 let diff2c_log_compose = Sections.finalize_theorem diff2c_log_compose;;
2901 let diff2c_acs_compose = Sections.finalize_theorem diff2c_acs_compose;;
2902 let diff2c_asn_compose = Sections.finalize_theorem diff2c_asn_compose;;
2903 let diff2c_matan_compose = Sections.finalize_theorem diff2c_matan_compose;;
2904 let diff2c_add = Sections.finalize_theorem diff2c_add;;
2905 let diff2c_sub = Sections.finalize_theorem diff2c_sub;;
2906 let diff2c_mul = Sections.finalize_theorem diff2c_mul;;
2907 let diff2c_domain_scale = Sections.finalize_theorem diff2c_domain_scale;;
2908 let diff2c_domain_neg = Sections.finalize_theorem diff2c_domain_neg;;
2909 let diff2c_domain_inv_compose = Sections.finalize_theorem diff2c_domain_inv_compose;;
2910 let diff2c_domain_sqrt_compose = Sections.finalize_theorem diff2c_domain_sqrt_compose;;
2911 let diff2c_domain_abs_pos_compose = Sections.finalize_theorem diff2c_domain_abs_pos_compose;;
2912 let diff2c_domain_abs_neg_compose = Sections.finalize_theorem diff2c_domain_abs_neg_compose;;
2913 let diff2c_domain_pow_compose = Sections.finalize_theorem diff2c_domain_pow_compose;;
2914 let diff2c_domain_atn_compose = Sections.finalize_theorem diff2c_domain_atn_compose;;
2915 let diff2c_domain_cos_compose = Sections.finalize_theorem diff2c_domain_cos_compose;;
2916 let diff2c_domain_sin_compose = Sections.finalize_theorem diff2c_domain_sin_compose;;
2917 let diff2c_domain_exp_compose = Sections.finalize_theorem diff2c_domain_exp_compose;;
2918 let diff2c_domain_log_compose = Sections.finalize_theorem diff2c_domain_log_compose;;
2919 let diff2c_domain_acs_compose = Sections.finalize_theorem diff2c_domain_acs_compose;;
2920 let diff2c_domain_asn_compose = Sections.finalize_theorem diff2c_domain_asn_compose;;
2921 let diff2c_domain_matan_compose = Sections.finalize_theorem diff2c_domain_matan_compose;;
2922 let diff2c_domain_add = Sections.finalize_theorem diff2c_domain_add;;
2923 let diff2c_domain_sub = Sections.finalize_theorem diff2c_domain_sub;;
2924 let diff2c_domain_mul = Sections.finalize_theorem diff2c_domain_mul;;
2925 Sections.end_section "Diff2c";;
2926
2927 (* Section M_LinApprox *)
2928 Sections.begin_section "M_LinApprox";;
2929 (Sections.add_section_var (mk_var ("f", (`:real^N -> real`))); Sections.add_section_var (mk_var ("g", (`:real^N -> real`))));;
2930 (Sections.add_section_var (mk_var ("bounds", (`:real#real`))));;
2931 (Sections.add_section_var (mk_var ("d_bounds_list", (`:(real#real)list`))));;
2932 (Sections.add_section_var (mk_var ("x", (`:real^N`))));;
2933
2934 (* Lemma m_lin_approx_neg *)
2935 let m_lin_approx_neg = Sections.section_proof []
2936 `(lift o f) differentiable at x ==>
2937 interval_arith (--f x) bounds ==>
2938 all_n 1 d_bounds_list (\i int. interval_arith (--partial i f x) int) ==>
2939 m_lin_approx (\x. --f x) x bounds d_bounds_list`
2940 [
2941 (BETA_TAC THEN (move ["df"]) THEN (move ["b"]) THEN (move ["db"]));
2942 ((THENL_FIRST) ((((use_arg_then2 ("m_lin_approx", [m_lin_approx]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("b", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_lift_neg", [f_lift_neg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_NEG", [DIFFERENTIABLE_NEG]))(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 (done_tac)));
2943 ((ASM_SIMP_TAC[partial_neg]) THEN (done_tac));
2944 ];;
2945
2946 (* Lemma m_lin_approx_scale *)
2947 let m_lin_approx_scale = Sections.section_proof ["c"]
2948 `(lift o f) differentiable at x ==>
2949 interval_arith (c * f x) bounds ==>
2950 all_n 1 d_bounds_list (\i int. interval_arith (c * partial i f x) int) ==>
2951 m_lin_approx (\x. c * f x) x bounds d_bounds_list`
2952 [
2953 (BETA_TAC THEN (move ["df"]) THEN (move ["bH"]) THEN (move ["dbH"]));
2954 ((THENL_FIRST) ((((use_arg_then2 ("m_lin_approx", [m_lin_approx]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("bH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_lift_scale", [f_lift_scale]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CMUL", [DIFFERENTIABLE_CMUL]))(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 (done_tac)));
2955 ((ASM_SIMP_TAC[partial_scale]) THEN (done_tac));
2956 ];;
2957
2958 (* Lemma m_lin_approx_add *)
2959 let m_lin_approx_add = Sections.section_proof []
2960 `(lift o f) differentiable at x ==>
2961 (lift o g) differentiable at x ==>
2962 interval_arith (f x + g x) bounds ==>
2963 all_n 1 d_bounds_list (\i int. interval_arith (partial i f x + partial i g x) int) ==>
2964 m_lin_approx (\x. f x + g x) x bounds d_bounds_list`
2965 [
2966 (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["bH"]) THEN (move ["dbH"]));
2967 ((THENL_FIRST) ((((use_arg_then2 ("m_lin_approx", [m_lin_approx]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("bH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_lift_add", [f_lift_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_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 (done_tac)));
2968 ((ASM_SIMP_TAC[partial_add]) THEN (done_tac));
2969 ];;
2970
2971 (* Lemma m_lin_approx_sub *)
2972 let m_lin_approx_sub = Sections.section_proof []
2973 `(lift o f) differentiable at x ==>
2974 (lift o g) differentiable at x ==>
2975 interval_arith (f x - g x) bounds ==>
2976 all_n 1 d_bounds_list (\i int. interval_arith (partial i f x - partial i g x) int) ==>
2977 m_lin_approx (\x. f x - g x) x bounds d_bounds_list`
2978 [
2979 (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["bH"]) THEN (move ["dbH"]));
2980 ((THENL_FIRST) ((((use_arg_then2 ("m_lin_approx", [m_lin_approx]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("bH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_lift_sub", [f_lift_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_SUB", [DIFFERENTIABLE_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 (done_tac)));
2981 ((ASM_SIMP_TAC[partial_sub]) THEN (done_tac));
2982 ];;
2983
2984 (* Lemma m_lin_approx_mul *)
2985 let m_lin_approx_mul = Sections.section_proof []
2986 `(lift o f) differentiable at x ==>
2987 (lift o g) differentiable at x ==>
2988 interval_arith (f x * g x) bounds ==>
2989 all_n 1 d_bounds_list (\i int. interval_arith (partial i f x * g x + f x * partial i g x) int) ==>
2990 m_lin_approx (\x. f x * g x) x bounds d_bounds_list`
2991 [
2992 (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["bH"]) THEN (move ["dbH"]));
2993 ((((use_arg_then2 ("m_lin_approx", [m_lin_approx]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("bH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("differentiable_mul", [differentiable_mul]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
2994 ((ASM_SIMP_TAC[partial_mul]) THEN (done_tac));
2995 ];;
2996
2997 (* Finalization of the section M_LinApprox *)
2998 let m_lin_approx_neg = Sections.finalize_theorem m_lin_approx_neg;;
2999 let m_lin_approx_scale = Sections.finalize_theorem m_lin_approx_scale;;
3000 let m_lin_approx_add = Sections.finalize_theorem m_lin_approx_add;;
3001 let m_lin_approx_sub = Sections.finalize_theorem m_lin_approx_sub;;
3002 let m_lin_approx_mul = Sections.finalize_theorem m_lin_approx_mul;;
3003 Sections.end_section "M_LinApprox";;
3004 let second_bounded = new_definition `second_bounded f domain dd_bounds_list <=>
3005 !x. x IN interval [domain] ==> all_n 1 dd_bounds_list
3006 (\i list_i. all_n 1 list_i (\j int. interval_arith (partial2 j i f x) int))`;;
3007 let m_taylor_interval =
3008 new_definition `m_taylor_interval f domain y w f_bounds d_bounds_list dd_bounds_list <=>
3009 m_cell_domain domain y w /\
3010 diff2c_domain domain f /\
3011 m_lin_approx f y f_bounds d_bounds_list /\
3012 second_bounded f domain dd_bounds_list`;;
3013
3014 (* Section M_TaylorIntervalArith *)
3015 Sections.begin_section "M_TaylorIntervalArith";;
3016 (Sections.add_section_var (mk_var ("f", (`:real^N -> real`))); Sections.add_section_var (mk_var ("g", (`:real^N -> real`))));;
3017 (Sections.add_section_var (mk_var ("x", (`:real^N`))); Sections.add_section_var (mk_var ("z", (`:real^N`))); Sections.add_section_var (mk_var ("y", (`:real^N`))); Sections.add_section_var (mk_var ("w", (`:real^N`))));;
3018 (Sections.add_section_var (mk_var ("domain", (`:real^N#real^N`))));;
3019 (Sections.add_section_var (mk_var ("f_bounds", (`:real#real`))); Sections.add_section_var (mk_var ("g_bounds", (`:real#real`))); Sections.add_section_var (mk_var ("bounds", (`:real#real`))));;
3020 (Sections.add_section_var (mk_var ("df_bounds_list", (`:(real#real)list`))); Sections.add_section_var (mk_var ("dg_bounds_list", (`:(real#real)list`))); Sections.add_section_var (mk_var ("d_bounds_list", (`:(real#real)list`))));;
3021 (Sections.add_section_var (mk_var ("ddf_bounds_list", (`:((real#real)list)list`))); Sections.add_section_var (mk_var ("ddg_bounds_list", (`:((real#real)list)list`))); Sections.add_section_var (mk_var ("dd_bounds_list", (`:((real#real)list)list`))));;
3022 (Sections.add_section_hyp "domainH" (`m_cell_domain domain y w`));;
3023 (Sections.add_section_hyp "d2f" (`diff2c_domain domain f`));;
3024
3025 (* Lemma m_taylor_inv_compose *)
3026 let m_taylor_inv_compose = Sections.section_proof []
3027 `m_bounded_on_int f domain f_bounds ==> interval_not_zero f_bounds ==>
3028 m_lin_approx (inv o f) y bounds d_bounds_list ==>
3029 second_bounded (inv o f) domain dd_bounds_list ==>
3030 m_taylor_interval (inv o f) domain y w bounds d_bounds_list dd_bounds_list`
3031 [
3032 ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))));
3033 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_inv_compose", [diff2c_domain_inv_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
3034 ];;
3035
3036 (* Lemma m_taylor_sqrt_compose *)
3037 let m_taylor_sqrt_compose = Sections.section_proof []
3038 `m_bounded_on_int f domain f_bounds ==> interval_pos f_bounds ==>
3039 m_lin_approx (sqrt o f) y bounds d_bounds_list ==>
3040 second_bounded (sqrt o f) domain dd_bounds_list ==>
3041 m_taylor_interval (sqrt o f) domain y w bounds d_bounds_list dd_bounds_list`
3042 [
3043 ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))));
3044 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_sqrt_compose", [diff2c_domain_sqrt_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
3045 ];;
3046
3047 (* Lemma m_taylor_abs_pos_compose *)
3048 let m_taylor_abs_pos_compose = Sections.section_proof []
3049 `m_bounded_on_int f domain f_bounds ==> interval_pos f_bounds ==>
3050 m_lin_approx (abs o f) y bounds d_bounds_list ==>
3051 second_bounded (abs o f) domain dd_bounds_list ==>
3052 m_taylor_interval (abs o f) domain y w bounds d_bounds_list dd_bounds_list`
3053 [
3054 ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))));
3055 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_abs_pos_compose", [diff2c_domain_abs_pos_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
3056 ];;
3057
3058 (* Lemma m_taylor_abs_neg_compose *)
3059 let m_taylor_abs_neg_compose = Sections.section_proof []
3060 `m_bounded_on_int f domain f_bounds ==> interval_neg f_bounds ==>
3061 m_lin_approx (abs o f) y bounds d_bounds_list ==>
3062 second_bounded (abs o f) domain dd_bounds_list ==>
3063 m_taylor_interval (abs o f) domain y w bounds d_bounds_list dd_bounds_list`
3064 [
3065 ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))));
3066 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_abs_neg_compose", [diff2c_domain_abs_neg_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
3067 ];;
3068
3069 (* Lemma m_taylor_pow_compose *)
3070 let m_taylor_pow_compose = Sections.section_proof ["n"]
3071 `m_lin_approx ((\x. x pow n) o f) y bounds d_bounds_list ==>
3072 second_bounded ((\x. x pow n) o f) domain dd_bounds_list ==>
3073 m_taylor_interval ((\x. x pow n) o f) domain y w bounds d_bounds_list dd_bounds_list`
3074 [
3075 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_pow_compose", [diff2c_domain_pow_compose]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3076 ];;
3077
3078 (* Lemma m_taylor_atn_compose *)
3079 let m_taylor_atn_compose = Sections.section_proof []
3080 `m_lin_approx (atn o f) y bounds d_bounds_list ==>
3081 second_bounded (atn o f) domain dd_bounds_list ==>
3082 m_taylor_interval (atn o f) domain y w bounds d_bounds_list dd_bounds_list`
3083 [
3084 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_atn_compose", [diff2c_domain_atn_compose]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3085 ];;
3086
3087 (* Lemma m_taylor_cos_compose *)
3088 let m_taylor_cos_compose = Sections.section_proof []
3089 `m_lin_approx (cos o f) y bounds d_bounds_list ==>
3090 second_bounded (cos o f) domain dd_bounds_list ==>
3091 m_taylor_interval (cos o f) domain y w bounds d_bounds_list dd_bounds_list`
3092 [
3093 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_cos_compose", [diff2c_domain_cos_compose]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3094 ];;
3095
3096 (* Lemma m_taylor_sin_compose *)
3097 let m_taylor_sin_compose = Sections.section_proof []
3098 `m_lin_approx (sin o f) y bounds d_bounds_list ==>
3099 second_bounded (sin o f) domain dd_bounds_list ==>
3100 m_taylor_interval (sin o f) domain y w bounds d_bounds_list dd_bounds_list`
3101 [
3102 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_sin_compose", [diff2c_domain_sin_compose]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3103 ];;
3104
3105 (* Lemma m_taylor_exp_compose *)
3106 let m_taylor_exp_compose = Sections.section_proof []
3107 `m_lin_approx (exp o f) y bounds d_bounds_list ==>
3108 second_bounded (exp o f) domain dd_bounds_list ==>
3109 m_taylor_interval (exp o f) domain y w bounds d_bounds_list dd_bounds_list`
3110 [
3111 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_exp_compose", [diff2c_domain_exp_compose]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3112 ];;
3113
3114 (* Lemma m_taylor_log_compose *)
3115 let m_taylor_log_compose = Sections.section_proof []
3116 `m_bounded_on_int f domain f_bounds ==> interval_pos f_bounds ==>
3117 m_lin_approx (log o f) y bounds d_bounds_list ==>
3118 second_bounded (log o f) domain dd_bounds_list ==>
3119 m_taylor_interval (log o f) domain y w bounds d_bounds_list dd_bounds_list`
3120 [
3121 ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))));
3122 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_log_compose", [diff2c_domain_log_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
3123 ];;
3124
3125 (* Lemma m_taylor_acs_compose *)
3126 let m_taylor_acs_compose = Sections.section_proof []
3127 `m_bounded_on_int f domain f_bounds ==> iabs f_bounds < &1 ==>
3128 m_lin_approx (acs o f) y bounds d_bounds_list ==>
3129 second_bounded (acs o f) domain dd_bounds_list ==>
3130 m_taylor_interval (acs o f) domain y w bounds d_bounds_list dd_bounds_list`
3131 [
3132 ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))));
3133 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_acs_compose", [diff2c_domain_acs_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
3134 ];;
3135
3136 (* Lemma m_taylor_asn_compose *)
3137 let m_taylor_asn_compose = Sections.section_proof []
3138 `m_bounded_on_int f domain f_bounds ==> iabs f_bounds < &1 ==>
3139 m_lin_approx (asn o f) y bounds d_bounds_list ==>
3140 second_bounded (asn o f) domain dd_bounds_list ==>
3141 m_taylor_interval (asn o f) domain y w bounds d_bounds_list dd_bounds_list`
3142 [
3143 ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))));
3144 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_asn_compose", [diff2c_domain_asn_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
3145 ];;
3146
3147 (* Lemma m_taylor_matan_compose *)
3148 let m_taylor_matan_compose = Sections.section_proof []
3149 `m_bounded_on_int f domain f_bounds ==> interval_gt (-- &1) f_bounds ==>
3150 m_lin_approx (matan o f) y bounds d_bounds_list ==>
3151 second_bounded (matan o f) domain dd_bounds_list ==>
3152 m_taylor_interval (matan o f) domain y w bounds d_bounds_list dd_bounds_list`
3153 [
3154 ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))));
3155 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_matan_compose", [diff2c_domain_matan_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
3156 ];;
3157
3158 (* Lemma m_taylor_neg *)
3159 let m_taylor_neg = Sections.section_proof []
3160 `m_lin_approx (\x. --f x) y bounds d_bounds_list ==>
3161 second_bounded (\x. --f x) domain dd_bounds_list ==>
3162 m_taylor_interval (\x. --f x) domain y w bounds d_bounds_list dd_bounds_list`
3163 [
3164 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_neg", [diff2c_domain_neg]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3165 ];;
3166
3167 (* Lemma m_taylor_scale *)
3168 let m_taylor_scale = Sections.section_proof ["c"]
3169 `m_lin_approx (\x. c * f x) y bounds d_bounds_list ==>
3170 second_bounded (\x. c * f x) domain dd_bounds_list ==>
3171 m_taylor_interval (\x. c * f x) domain y w bounds d_bounds_list dd_bounds_list`
3172 [
3173 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_scale", [diff2c_domain_scale]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3174 ];;
3175 (Sections.add_section_hyp "d2g" (`diff2c_domain domain g`));;
3176
3177 (* Lemma m_taylor_add *)
3178 let m_taylor_add = Sections.section_proof []
3179 `m_lin_approx (\x. f x + g x) y bounds d_bounds_list ==>
3180 second_bounded (\x. f x + g x) domain dd_bounds_list ==>
3181 m_taylor_interval (\x. f x + g x) domain y w bounds d_bounds_list dd_bounds_list`
3182 [
3183 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_add", [diff2c_domain_add]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3184 ];;
3185
3186 (* Lemma m_taylor_sub *)
3187 let m_taylor_sub = Sections.section_proof []
3188 `m_lin_approx (\x. f x - g x) y bounds d_bounds_list ==>
3189 second_bounded (\x. f x - g x) domain dd_bounds_list ==>
3190 m_taylor_interval (\x. f x - g x) domain y w bounds d_bounds_list dd_bounds_list`
3191 [
3192 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_sub", [diff2c_domain_sub]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3193 ];;
3194
3195 (* Lemma m_taylor_mul *)
3196 let m_taylor_mul = Sections.section_proof []
3197 `m_lin_approx (\x. f x * g x) y bounds d_bounds_list ==>
3198 second_bounded (\x. f x * g x) domain dd_bounds_list ==>
3199 m_taylor_interval (\x. f x * g x) domain y w bounds d_bounds_list dd_bounds_list`
3200 [
3201 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_mul", [diff2c_domain_mul]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3202 ];;
3203
3204 (* Finalization of the section M_TaylorIntervalArith *)
3205 let m_taylor_inv_compose = Sections.finalize_theorem m_taylor_inv_compose;;
3206 let m_taylor_sqrt_compose = Sections.finalize_theorem m_taylor_sqrt_compose;;
3207 let m_taylor_abs_pos_compose = Sections.finalize_theorem m_taylor_abs_pos_compose;;
3208 let m_taylor_abs_neg_compose = Sections.finalize_theorem m_taylor_abs_neg_compose;;
3209 let m_taylor_pow_compose = Sections.finalize_theorem m_taylor_pow_compose;;
3210 let m_taylor_atn_compose = Sections.finalize_theorem m_taylor_atn_compose;;
3211 let m_taylor_cos_compose = Sections.finalize_theorem m_taylor_cos_compose;;
3212 let m_taylor_sin_compose = Sections.finalize_theorem m_taylor_sin_compose;;
3213 let m_taylor_exp_compose = Sections.finalize_theorem m_taylor_exp_compose;;
3214 let m_taylor_log_compose = Sections.finalize_theorem m_taylor_log_compose;;
3215 let m_taylor_acs_compose = Sections.finalize_theorem m_taylor_acs_compose;;
3216 let m_taylor_asn_compose = Sections.finalize_theorem m_taylor_asn_compose;;
3217 let m_taylor_matan_compose = Sections.finalize_theorem m_taylor_matan_compose;;
3218 let m_taylor_neg = Sections.finalize_theorem m_taylor_neg;;
3219 let m_taylor_scale = Sections.finalize_theorem m_taylor_scale;;
3220 let m_taylor_add = Sections.finalize_theorem m_taylor_add;;
3221 let m_taylor_sub = Sections.finalize_theorem m_taylor_sub;;
3222 let m_taylor_mul = Sections.finalize_theorem m_taylor_mul;;
3223 Sections.end_section "M_TaylorIntervalArith";;
3224
3225 (* Section PartialConvex *)
3226 Sections.begin_section "PartialConvex";;
3227 (Sections.add_section_type (mk_var ("f", (`:real^N->real`))));;
3228
3229 (* Lemma REAL_LE_DIV_1 *)
3230 let REAL_LE_DIV_1 = Sections.section_proof ["a";"b"]
3231 `&0 < b ==> (a / b <= &1 <=> a <= b)`
3232 [
3233 ((BETA_TAC THEN (move ["b_gt"])) THEN ((((use_arg_then2 ("REAL_LE_LDIV_EQ", [REAL_LE_LDIV_EQ]))(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));
3234 ];;
3235
3236 (* Lemma partial_convex_max *)
3237 let partial_convex_max = Sections.section_proof ["f";"j";"x";"z";"u";"v";"hi"]
3238 `(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i /\ v$i = x$i) ==>
3239 u$j = x$j ==> v$j = z$j ==>
3240 diff2_domain (x,z) f ==>
3241 (!y. y IN interval [x,z] ==> &0 <= partial2 j j f y) ==>
3242 (!y. y IN interval [x,u] ==> f y <= hi) ==>
3243 (!y. y IN interval [v,z] ==> f y <= hi) ==>
3244 (!y. y IN interval [x,z] ==> f y <= hi)`
3245 [
3246 ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["uv_eq"]) THEN (move ["ux_eq"]) THEN (move ["vz_eq"]));
3247 ((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (move ["diff2_f"]) THEN (move ["partial2_pos"]) THEN (move ["bound1"]) THEN (move ["bound2"]) THEN (move ["y"]) THEN (move ["y_in"]));
3248 ((fun arg_tac -> arg_tac (Arg_term (`(lambda i. if i = j then x$j else y$i):real^N`))) (term_tac (set_tac "y1")));
3249 ((fun arg_tac -> arg_tac (Arg_term (`(lambda i. if i = j then z$j else y$i):real^N`))) (term_tac (set_tac "y2")));
3250 ((((use_arg_then2 ("y_in", [])) (disch_tac [])) THEN (clear_assumption "y_in") THEN BETA_TAC) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] [])))) THEN (move ["y_in"])));
3251 ((fun arg_tac -> arg_tac (Arg_term (`y1 IN interval [x,u] /\ y2 IN interval [v,z]`))) (term_tac (have_gen_tac [](case THEN ((move ["y1_in"]) THEN (move ["y2_in"]))))));
3252 ((((use_arg_then2 ("y1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] []))))));
3253 (((split_tac) THEN (move ["i"]) THEN (move ["i_ineq"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"])) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("ux_eq", []))(fun tmp_arg1 -> (use_arg_then2 ("vz_eq", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN ((((use_arg_then2 ("uv_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
3254 (((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`j IN 1..dimindex (:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case)) THEN ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["j_in"])));
3255 ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`y1 = y`))) (term_tac (have_gen_tac []ALL_TAC)))) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("bound1", [])) (disch_tac [])) THEN (clear_assumption "bound1") THEN (DISCH_THEN apply_tac)) THEN (done_tac)));
3256 ((((use_arg_then2 ("CART_EQ", [CART_EQ]))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["i_in"]));
3257 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(i = j)`))) (term_tac (have_gen_tac [](move ["inj"])))) ((((use_arg_then2 ("i_in", [])) (disch_tac [])) THEN (clear_assumption "i_in") THEN ((use_arg_then2 ("j_in", [])) (disch_tac [])) THEN (clear_assumption "j_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
3258 (((((use_arg_then2 ("y1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3259 (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`f y <= max (f y1) (f y2)`))) (term_tac (have_gen_tac []ALL_TAC))));
3260 (BETA_TAC THEN (move ["cond"]));
3261 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then2 ("cond", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
3262 ((((fun arg_tac -> (use_arg_then2 ("bound2", [])) (fun fst_arg -> (use_arg_then2 ("y2_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("bound1", [])) (fun fst_arg -> (use_arg_then2 ("y1_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
3263 ((fun arg_tac -> arg_tac (Arg_term (`f o (\t. y1 + t % basis j)`))) (term_tac (set_tac "g")));
3264 ((fun arg_tac -> arg_tac (Arg_term (`f y1 = g (&0)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
3265 (((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3266 ((fun arg_tac -> arg_tac (Arg_term (`y = y1 + (y$j - x$j) % basis j /\ y2 = y1 + (z$j - x$j) % basis j`))) (term_tac (have_gen_tac [](move ["y_eq"]))));
3267 ((repeat_tactic 1 9 (((use_arg_then2 ("CART_EQ", [CART_EQ]))(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN (move ["i"]) THEN (move ["i_in"])) THEN ((((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"])) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("y1_def", []))(fun tmp_arg1 -> (use_arg_then2 ("y2_def", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_SUB_ADD2", [REAL_SUB_ADD2]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
3268 (((((use_arg_then2 ("ij", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac));
3269 (((((use_arg_then2 ("ij", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac));
3270 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`f y = g (y$j - x$j)`))) (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 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("y_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)));
3271 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`f y2 = g (z$j - x$j)`))) (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 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("y_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)));
3272 (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`z$j = x$j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["zx_j"]));
3273 ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`y$j = x$j`))) (term_tac (have_gen_tac []ALL_TAC)))) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("zx_j", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_SUB_REFL", [REAL_SUB_REFL]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)));
3274 ((((fun arg_tac -> (use_arg_then2 ("y_in", [])) (fun fst_arg -> (use_arg_then2 ("j_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("zx_j", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac));
3275 ((fun arg_tac -> arg_tac (Arg_term (`(y$j - x$j) / (z$j - x$j)`))) (term_tac (set_tac "t")));
3276 ((fun arg_tac -> arg_tac (Arg_term (`&0 < z$j - x$j`))) (term_tac (have_gen_tac [](move ["zx_pos"]))));
3277 ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b. &0 < a - b <=> ~(a = b) /\ b <= a`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("zx_j", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
3278 ((((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 (`y$j`))) (term_tac exists_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3279 ((fun arg_tac -> arg_tac (Arg_term (`&0 <= t /\ t <= &1 /\ y$j - x$j = (&1 - t) * &0 + t * (z$j - x$j)`))) (term_tac (have_gen_tac [](move ["t_props"]))));
3280 ((((use_arg_then2 ("t_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_DIV_1", [REAL_LE_DIV_1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_LID", [REAL_ADD_LID]))(thm_tac (new_rewrite [] [])))));
3281 ((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_MUL_ASSOC)))(gsym_then (thm_tac (new_rewrite [] []))))));
3282 ((((use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_SUB_0", [REAL_SUB_0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
3283 ((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_RADD", [REAL_LE_RADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] [])))))));
3284 ((THENL_FIRST) ((((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_INV", [REAL_LE_INV]))(thm_tac (new_rewrite [] []))))) ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. &0 < a ==> &0 <= a`)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
3285 (((((use_arg_then2 ("REAL_SUB_LE", [REAL_SUB_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3286 ((((use_arg_then2 ("t_props", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONVEX_LOWER))) (disch_tac [])) THEN (DISCH_THEN apply_tac)));
3287 ((fun arg_tac -> arg_tac (Arg_term (`real_interval [&0, z$j - x$j]`))) (term_tac exists_tac));
3288 ((((use_arg_then2 ("REAL_SUB_ADD", [REAL_SUB_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_SUB_LE", [REAL_SUB_LE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("t_props", []))(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 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac));
3289 ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. &0 < a ==> &0 <= a`)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))));
3290 (((fun arg_tac -> arg_tac (Arg_term (`real_interval _`))) (term_tac (set_tac "s"))) THEN (((use_arg_then2 ("t_props", [])) (disch_tac [])) THEN (clear_assumption "t_props") THEN ((use_arg_then2 ("t_def", [])) (disch_tac [])) THEN (clear_assumption "t_def") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"])));
3291 ((fun arg_tac -> arg_tac (Arg_term (`!t. t IN s ==> y1 + t % basis j IN interval [x,z]`))) (term_tac (have_gen_tac [](move ["in_s"]))));
3292 (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] []))))) THEN (move ["t"]) THEN (move ["t_ineq"]) THEN (move ["i"]) THEN (move ["i_ineq"]));
3293 ((repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
3294 ((((use_arg_then2 ("y1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
3295 ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"])));
3296 (((((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
3297 ((((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((fun arg_tac -> (use_arg_then2 ("y_in", [])) (fun fst_arg -> (use_arg_then2 ("i_ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("ij", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac));
3298 ((fun arg_tac -> arg_tac (Arg_term (`!t. t IN s ==> nth_diff_strong 2 g t`))) (term_tac (have_gen_tac [](move ["diff2_g"]))));
3299 ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("diff2_dir", [diff2_dir]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3300 ((fun arg_tac -> arg_tac (Arg_term (`!t. t IN s ==> derivative g t = partial j f (y1 + t % basis j)`))) (term_tac (have_gen_tac [](move ["dg"]))));
3301 ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] [])))));
3302 ((((fun arg_tac -> (use_arg_then2 ("in_s", [])) (fun fst_arg -> (use_arg_then2 ("ts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["p_in"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`f o _`))) (term_tac (set_tac "h"))));
3303 ((fun arg_tac -> arg_tac (Arg_term (`h = g o (\t'. t + t')`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
3304 ((((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["r"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)));
3305 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3306 ((((use_arg_then2 ("derivative_translation", [derivative_translation]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
3307 ((((fun arg_tac -> (use_arg_then2 ("diff2_g", [])) (fun fst_arg -> (use_arg_then2 ("ts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) 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 ["e"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["te"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3308 ((fun arg_tac -> arg_tac (Arg_term (`!t. t IN s ==> nth_derivative 2 g t = partial2 j j f (y1 + t % basis j)`))) (term_tac (have_gen_tac [](move ["d2g"]))));
3309 ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN ((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("diff2_dir_derivative2", [diff2_dir_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
3310 ((fun arg_tac -> arg_tac (Arg_term (`1..dimindex (:N) = ((1..dimindex (:N)) DELETE j) UNION {j}`))) (term_tac (have_gen_tac [](move ["s_eq"]))));
3311 ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"])) THEN (split_tac));
3312 ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orNb", [orNb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3313 ((case THEN (simp_tac)) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
3314 ((fun arg_tac -> arg_tac (Arg_term (`DISJOINT ((1..dimindex (:N)) DELETE j) {j}`))) (term_tac (have_gen_tac [](move ["disj"]))));
3315 (((((use_arg_then2 ("DISJOINT", [DISJOINT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]));
3316 (((((use_arg_then2 ("andbA", [andbA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andNb", [andNb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbF", [andbF]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3317 ((((use_arg_then2 ("s_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("SUM_UNION", [SUM_UNION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_DELETE", [FINITE_DELETE]))(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 ("FINITE_SING", [FINITE_SING]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SUM_SING", [SUM_SING]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
3318 ((((use_arg_then2 ("SUM_EQ_0", [SUM_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_ADD_LID", [REAL_ADD_LID]))(thm_tac (new_rewrite [] []))))));
3319 ((BETA_TAC THEN (move ["i"]) THEN (move ["i_in"])) THEN (((use_arg_then2 ("SUM_EQ_0", [SUM_EQ_0])) (thm_tac apply_tac)) THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac)));
3320 (((((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("i_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3321 ((((use_arg_then2 ("s_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_UNION", [SUM_UNION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_DELETE", [FINITE_DELETE]))(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 ("FINITE_SING", [FINITE_SING]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SUM_SING", [SUM_SING]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
3322 ((((use_arg_then2 ("SUM_EQ_0", [SUM_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_ADD_LID", [REAL_ADD_LID]))(thm_tac (new_rewrite [] []))))));
3323 ((BETA_TAC THEN (move ["i"]) THEN (move ["i_in"]) THEN (simp_tac)) THEN (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))) THEN (DISJ2_TAC));
3324 (((((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("i_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3325 (((((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("j_in", []))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3326 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_CONVEX_ON_SECOND_DERIVATIVE", [REAL_CONVEX_ON_SECOND_DERIVATIVE])) (fun fst_arg -> (use_arg_then2 ("g", [])) (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 (`nth_derivative 2 g`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
3327 ((THENL_ROT (-1)) (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [1; 2] []))))) THEN (((use_arg_then2 ("IS_REALINTERVAL_INTERVAL", [IS_REALINTERVAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))));
3328 ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN ((((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("partial2_pos", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3329 (split_tac);
3330 ((BETA_TAC THEN (move ["t"])) THEN (((use_arg_then2 ("contraT", [contraT])) (disch_tac [])) THEN (clear_assumption "contraT") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["eq"])));
3331 ((((use_arg_then2 ("zx_pos", [])) (disch_tac [])) THEN (clear_assumption "zx_pos") THEN ((fun arg_tac -> (use_arg_then2 ("eq", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`z$j - x$j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("eq", [])) (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 ((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 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))))));
3332 ((arith_tac) THEN (done_tac));
3333 ((split_tac) THEN (move ["t"]) THEN (move ["ts"]));
3334 ((((fun arg_tac -> (use_arg_then2 ("diff2_g", [])) (fun fst_arg -> (use_arg_then2 ("ts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("nth_diff_strong2_eq_alt", [nth_diff_strong2_eq_alt]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["e"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["te"])) THEN (move ["H"])));
3335 (((((use_arg_then2 ("HAS_REAL_DERIVATIVE_ATREAL_WITHIN", [HAS_REAL_DERIVATIVE_ATREAL_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3336 ((((fun arg_tac -> (use_arg_then2 ("diff2_g", [])) (fun fst_arg -> (use_arg_then2 ("ts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("nth_diff_strong2_eq_alt", [nth_diff_strong2_eq_alt]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["e"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["te"])) THEN (move ["H"])));
3337 (((((use_arg_then2 ("HAS_REAL_DERIVATIVE_ATREAL_WITHIN", [HAS_REAL_DERIVATIVE_ATREAL_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3338 ];;
3339
3340 (* Finalization of the section PartialConvex *)
3341 let REAL_LE_DIV_1 = Sections.finalize_theorem REAL_LE_DIV_1;;
3342 let partial_convex_max = Sections.finalize_theorem partial_convex_max;;
3343 Sections.end_section "PartialConvex";;
3344
3345 (* Section ElementaryFunctions *)
3346 Sections.begin_section "ElementaryFunctions";;
3347
3348 (* Lemma f_lift_const *)
3349 let f_lift_const = Sections.section_proof ["c"]
3350 `lift o (\x. c) = (\x. lift c)`
3351 [
3352 (((((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 (done_tac));
3353 ];;
3354
3355 (* Lemma f_lift_unary *)
3356 let f_lift_unary = Sections.section_proof ["f"]
3357 `lift o (\x. f x) = (\x. lift (f x))`
3358 [
3359 (((((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 (done_tac));
3360 ];;
3361
3362 (* Lemma diff2_const *)
3363 let diff2_const = Sections.section_proof ["c";"x"]
3364 `diff2 (\x:real^N. c) x`
3365 [
3366 ((((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real^N)`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("OPEN_UNIV", [OPEN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (((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 ["y"]) THEN (move ["_"])));
3367 (((((use_arg_then2 ("partial_const", [partial_const]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_lift_const", [f_lift_const]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
3368 ];;
3369
3370 (* Lemma diff2_domain_const *)
3371 let diff2_domain_const = Sections.section_proof ["c";"domain"]
3372 `diff2_domain domain (\x:real^N. c)`
3373 [
3374 (((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_const", [diff2_const]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3375 ];;
3376
3377 (* Lemma partial2_const *)
3378 let partial2_const = Sections.section_proof ["i";"j";"c"]
3379 `partial2 i j (\x:real^N. c) = (\x. &0)`
3380 [
3381 (((((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("partial_const", [partial_const]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
3382 ];;
3383
3384 (* Lemma diff2c_const *)
3385 let diff2c_const = Sections.section_proof ["c";"x"]
3386 `diff2c (\x:real^N. c) x`
3387 [
3388 (((((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_const", [diff2_const]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("partial2_const", [partial2_const]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3389 ];;
3390
3391 (* Lemma diff2c_domain_const *)
3392 let diff2c_domain_const = Sections.section_proof ["c";"domain"]
3393 `diff2c_domain domain (\x:real^N. c)`
3394 [
3395 (((((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_const", [diff2c_const]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3396 ];;
3397
3398 (* Lemma partial_x_lemma *)
3399 let partial_x_lemma = Sections.section_proof ["k";"i"]
3400 `partial i (\x:real^N. x$k) = (\x. (basis i:real^N)$k)`
3401 [
3402 (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac));
3403 ((fun arg_tac -> arg_tac (Arg_term (`(\x. x$k) o (\t. x + t % basis i) = (\t. x$k + t * (basis i:real^N)$k)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
3404 (((((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 (((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3405 ((((use_arg_then2 ("derivative_add", [derivative_add]))(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 (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
3406 (((((use_arg_then2 ("REAL_DIFFERENTIABLE_ID", [REAL_DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3407 ((((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("derivative_mul", [derivative_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_ID", [REAL_DIFFERENTIABLE_ID]))(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)));
3408 (((((use_arg_then2 ("derivative_x", [derivative_x]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
3409 ];;
3410
3411 (* Lemma partial_x *)
3412 let partial_x = Sections.section_proof ["k";"i"]
3413 `k IN 1..dimindex (:N) ==>
3414 partial i (\x:real^N. x$k) = (\x. if i = k then &1 else &0)`
3415 [
3416 ((BETA_TAC THEN (move ["k_ineq"])) THEN ((((use_arg_then2 ("partial_x_lemma", [partial_x_lemma]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac));
3417 ];;
3418
3419 (* Lemma partial2_x *)
3420 let partial2_x = Sections.section_proof ["k";"i";"j"]
3421 `partial2 i j (\x:real^N. x$k) = (\x. &0)`
3422 [
3423 (((((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("partial_x_lemma", [partial_x_lemma]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("partial_const", [partial_const]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3424 ];;
3425
3426 (* Lemma diff2_x *)
3427 let diff2_x = Sections.section_proof ["k";"x"]
3428 `k IN 1..dimindex (:N) ==> diff2 (\x:real^N. x$k) x`
3429 [
3430 ((BETA_TAC THEN (move ["k_ineq"])) THEN (((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real^N)`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("OPEN_UNIV", [OPEN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (((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 ["y"]) THEN (move ["_"])));
3431 (((((use_arg_then2 ("projection_diff", [projection_diff]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("partial_x_lemma", [partial_x_lemma]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_lift_unary", [f_lift_unary]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3432 ];;
3433
3434 (* Lemma diff2_domain_x *)
3435 let diff2_domain_x = Sections.section_proof ["k";"domain"]
3436 `k IN 1..dimindex (:N) ==> diff2_domain domain (\x:real^N. x$k)`
3437 [
3438 (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_x", [diff2_x])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3439 ];;
3440
3441 (* Lemma diff2c_x *)
3442 let diff2c_x = Sections.section_proof ["k";"x"]
3443 `k IN 1..dimindex (:N) ==> diff2c (\x:real^N. x$k) x`
3444 [
3445 ((BETA_TAC THEN (move ["k_ineq"])) THEN ((((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_x", [diff2_x]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
3446 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial2_x", [partial2_x]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3447 ];;
3448
3449 (* Lemma diff2c_domain_x *)
3450 let diff2c_domain_x = Sections.section_proof ["k";"domain"]
3451 `k IN 1..dimindex (:N) ==> diff2c_domain domain (\x:real^N. x$k)`
3452 [
3453 (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2c_x", [diff2c_x])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
3454 ];;
3455
3456 (* Finalization of the section ElementaryFunctions *)
3457 let f_lift_const = Sections.finalize_theorem f_lift_const;;
3458 let f_lift_unary = Sections.finalize_theorem f_lift_unary;;
3459 let diff2_const = Sections.finalize_theorem diff2_const;;
3460 let diff2_domain_const = Sections.finalize_theorem diff2_domain_const;;
3461 let partial2_const = Sections.finalize_theorem partial2_const;;
3462 let diff2c_const = Sections.finalize_theorem diff2c_const;;
3463 let diff2c_domain_const = Sections.finalize_theorem diff2c_domain_const;;
3464 let partial_x_lemma = Sections.finalize_theorem partial_x_lemma;;
3465 let partial_x = Sections.finalize_theorem partial_x;;
3466 let partial2_x = Sections.finalize_theorem partial2_x;;
3467 let diff2_x = Sections.finalize_theorem diff2_x;;
3468 let diff2_domain_x = Sections.finalize_theorem diff2_domain_x;;
3469 let diff2c_x = Sections.finalize_theorem diff2c_x;;
3470 let diff2c_domain_x = Sections.finalize_theorem diff2c_domain_x;;
3471 Sections.end_section "ElementaryFunctions";;
3472
3473 (* Close the module *)
3474 end;;