1 needs "lib/ssrbool-compiled.hl";;
2 needs "lib/ssrnat-compiled.hl";;
3 needs "taylor/theory/taylor_interval-compiled.hl";;
4 prioritize_overload `:real^N`;;
6 let partial = new_definition `partial i f x = derivative (f o (\t. (x:real^N) + t % basis i)) (&0)`;;
7 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)`;;
8 let m_lin_approx = new_definition `m_lin_approx (f:real^N->real) x f_bounds df_bounds_list <=>
9 (lift o f) differentiable at x /\
10 interval_arith (f x) f_bounds /\
11 all_n 1 df_bounds_list (\i int. interval_arith (partial i f x) int)`;;
14 begin_section "Misc";;
16 (* Lemma f_lift_neg *)
17 let f_lift_neg = section_proof ["f"]
18 `lift o (\x. --f x) = (\x. --(lift o f) x)`
20 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "LIFT_NEG")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
23 (* Lemma f_lift_scale *)
24 let f_lift_scale = section_proof ["f";"c"]
25 `lift o (\x. c * f x) = (\x. c % (lift o f) x)`
27 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "LIFT_CMUL")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
30 (* Lemma f_lift_add *)
31 let f_lift_add = section_proof ["f";"g"]
32 `lift o (\x. f x + g x) = (\x. (lift o f) x + (lift o g) x)`
34 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "LIFT_ADD")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
37 (* Lemma f_lift_sub *)
38 let f_lift_sub = section_proof ["f";"g"]
39 `lift o (\x. f x - g x) = (\x. (lift o f) x - (lift o g) x)`
41 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "LIFT_SUB")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
44 (* Lemma f_binary_drop *)
45 let f_binary_drop = section_proof ["op";"f";"g"]
46 `(\t. op (f t) (g t)) o drop = (\x. op (f (drop x)) (g (drop x)))`
48 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
51 (* Lemma f_unary_drop *)
52 let f_unary_drop = section_proof ["op";"f"]
53 `(\t. op (f t)) o drop = (\x. op (f (drop x)))`
55 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
58 (* Section MoreFrechet *)
59 begin_section "MoreFrechet";;
60 (add_section_var (mk_var ("f", (`:real^N -> real^M`))); add_section_var (mk_var ("g", (`:real^N -> real^M`))));;
61 (add_section_var (mk_var ("x", (`:real^N`))); add_section_var (mk_var ("y", (`:real^N`))));;
63 (* Lemma frechet_compose *)
64 let frechet_compose = section_proof ["f";"g";"x"]
65 `f differentiable at (g x) ==>
66 g differentiable at x ==>
67 frechet_derivative (f o g) (at x) = frechet_derivative f (at (g x)) o frechet_derivative g (at x)`
69 ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])) THEN (((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)));
70 (((use_arg_then "DIFF_CHAIN_AT") (thm_tac apply_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
73 (* Lemma frechet_const *)
74 let frechet_const = section_proof ["z"]
75 `frechet_derivative (\x. y) (at z) = (\x. vec 0)`
77 ((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)) THEN (((use_arg_then "HAS_DERIVATIVE_CONST")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
80 (* Lemma frechet_id *)
81 let frechet_id = section_proof []
82 `frechet_derivative (\x. x) (at y) = (\x. x)`
84 ((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)) THEN (((use_arg_then "HAS_DERIVATIVE_ID")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
87 (* Lemma frechet_vmul *)
88 let frechet_vmul = section_proof ["z"]
89 `frechet_derivative (\x. drop x % y) (at z) = (\x. drop x % y)`
91 ((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)) THEN ((use_arg_then "HAS_DERIVATIVE_VMUL_DROP") (thm_tac apply_tac)));
92 (((use_arg_then "HAS_DERIVATIVE_ID")(thm_tac (new_rewrite [] []))));
94 (add_section_hyp "df" (`f differentiable at x`));;
96 (* Lemma frechet_neg *)
97 let frechet_neg = section_proof []
98 `frechet_derivative (\x. --f x) (at x) = (\y. --frechet_derivative f (at x) y)`
100 ((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)) THEN ((use_arg_then "HAS_DERIVATIVE_NEG") (thm_tac apply_tac)));
101 ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac));
104 (* Lemma frechet_scale *)
105 let frechet_scale = section_proof ["c"]
106 `frechet_derivative (\x. c % f x) (at x) = (\y. c % frechet_derivative f (at x) y)`
108 ((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)) THEN ((use_arg_then "HAS_DERIVATIVE_CMUL") (thm_tac apply_tac)));
109 ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac));
111 (add_section_hyp "dg" (`g differentiable at x`));;
113 (* Lemma frechet_add *)
114 let frechet_add = section_proof []
115 `frechet_derivative (\x. f x + g x) (at x) =
116 (\y. frechet_derivative f (at x) y + frechet_derivative g (at x) y)`
118 ((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)) THEN ((use_arg_then "HAS_DERIVATIVE_ADD") (thm_tac apply_tac)));
119 ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
122 (* Lemma frechet_sub *)
123 let frechet_sub = section_proof []
124 `frechet_derivative (\x. f x - g x) (at x) =
125 (\y. frechet_derivative f (at x) y - frechet_derivative g (at x) y)`
127 ((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)) THEN ((use_arg_then "HAS_DERIVATIVE_SUB") (thm_tac apply_tac)));
128 ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
131 (* Finalization of the section MoreFrechet *)
132 let frechet_compose = finalize_theorem frechet_compose;;
133 let frechet_const = finalize_theorem frechet_const;;
134 let frechet_id = finalize_theorem frechet_id;;
135 let frechet_vmul = finalize_theorem frechet_vmul;;
136 let frechet_neg = finalize_theorem frechet_neg;;
137 let frechet_scale = finalize_theorem frechet_scale;;
138 let frechet_add = finalize_theorem frechet_add;;
139 let frechet_sub = finalize_theorem frechet_sub;;
140 end_section "MoreFrechet";;
142 (* Lemma differentiable_compose_at *)
143 let differentiable_compose_at = section_proof ["f";"g";"x"]
144 `f differentiable at (g x) ==>
145 g differentiable at x ==>
146 (f o g) differentiable at x`
148 ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])) THEN (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(thm_tac (new_rewrite [] [])))));
149 (((((use_arg_then "frechet_compose")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((use_arg_then "DIFF_CHAIN_AT") (thm_tac apply_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
152 (* Lemma jacobian_compose *)
153 let jacobian_compose = section_proof ["f";"g";"x"]
154 `f differentiable at (g x) ==>
155 g differentiable at x ==>
156 jacobian (f o g) (at x) = jacobian f (at (g x)) ** jacobian g (at x)`
158 (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]));
159 (((repeat_tactic 1 9 (((use_arg_then "jacobian")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "frechet_compose")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "MATRIX_COMPOSE")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "LINEAR_FRECHET_DERIVATIVE")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
162 (* Lemma frechet_eq_jacobian *)
163 let frechet_eq_jacobian = section_proof ["f";"x"]
164 `f differentiable at x ==>
165 frechet_derivative f (at x) = (\h. jacobian f (at x) ** h)`
167 (BETA_TAC THEN (move ["df"]));
168 (((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "FRECHET_DERIVATIVE_AT")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "JACOBIAN_WORKS")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
171 (* Section Product *)
172 begin_section "Product";;
174 (* Lemma REAL_LET_MUL2 *)
175 let REAL_LET_MUL2 = section_proof ["w";"x";"y";"z"]
176 `&0 < w /\ w <= x /\ &0 <= y /\ y < z ==> w * y < x * z`
178 (BETA_TAC THEN (move ["ineq"]));
179 ((THENL) (((fun arg_tac -> (use_arg_then "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"])]);
180 (((((use_arg_then "w_eq_x")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LT_LMUL")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
181 ((((use_arg_then "REAL_LT_MUL2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "wnx") (disch_tac [])) THEN (clear_assumption "wnx") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
184 (* Lemma has_derivative_x12 *)
185 let has_derivative_x12 = section_proof ["y"]
186 `(lift o (\x:real^2. x$1 * x$2) has_derivative lift o (\x. y$2 * x$1 + y$1 * x$2)) (at y)`
188 ((((use_arg_then "has_derivative_at")(thm_tac (new_rewrite [] [])))) THEN (split_tac));
189 ((((use_arg_then "linear")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_ADD")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_CMUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_ADD")(thm_tac (new_rewrite [] []))))));
190 ((VECTOR_ARITH_TAC) THEN (done_tac));
191 ((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "LIFT_ADD")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_SUB")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_CMUL")(gsym_then (thm_tac (new_rewrite [] []))))));
192 (((((use_arg_then "LIM_AT")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "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_then "NORM_LIFT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] [])))))) THEN (move ["e"]) THEN (move ["e0"]));
193 (((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)) =
194 (x$2 - y$2) * (x$1 - y$1)`)))(thm_tac (new_rewrite [] []))));
195 (((use_arg_then "e") (term_tac exists_tac)) THEN (((((use_arg_then "e0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN ((move ["norm0"]) THEN (move ["norm_e"])))));
196 ((repeat_tactic 1 9 (((use_arg_then "REAL_ABS_MUL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_ABS_INV")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ABS_NORM")(thm_tac (new_rewrite [] [])))));
197 ((repeat_tactic 1 9 (((use_arg_then "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"))));
198 ((fun arg_tac -> (use_arg_then "NORM_BOUND_COMPONENT_LT") (fun fst_arg -> (use_arg_then "norm_e") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["ineq"])));
199 ((((use_arg_then "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)));
200 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < infnorm p`))) (term_tac (have_gen_tac [](move ["infnorm_0"])))) (((((use_arg_then "INFNORM_POS_LT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NORM_POS_LT")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)));
201 ((THENL_ROT (-1)) (split_tac));
202 (((((use_arg_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_LINV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "INFNORM_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NORM_POS_LT")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
203 ((((use_arg_then "REAL_LET_MUL2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LT_INV")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_LE_INV2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "INFNORM_LE_NORM")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))));
204 ((((use_arg_then "REAL_LE_MUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_ABS_POS")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))));
205 ((fun arg_tac -> arg_tac (Arg_term (`infnorm p = abs (p$1) \/ infnorm p = abs (p$2)`))) (term_tac (have_gen_tac []ALL_TAC)));
206 ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL INFNORM_2)))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac));
207 (((THENL_FIRST) (case THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "REAL_LT_LMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ineq")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "DIMINDEX_2")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
210 (* Lemma lambda_eq_vsum *)
211 let lambda_eq_vsum = section_proof ["f"]
212 `(\x:A. lambda i. f i x) =
213 (\x. vsum (1..dimindex (:N)) (\i. f i x % (basis i:real^N)))`
215 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["x"]));
216 (((((use_arg_then "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_then "VSUM_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))));
217 (((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"))));
218 ((fun arg_tac -> arg_tac (Arg_term (`DISJOINT B {i} /\ A = B UNION {i}`))) (term_tac (have_gen_tac [](move ["cond"]))));
219 ((((use_arg_then "DISJOINT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "EXTENSION")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "B_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "A_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_DIFF")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_SING")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NOT_IN_EMPTY")(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
220 ((THENL_FIRST) ((split_tac) THEN (move ["x"])) (((repeat_tactic 1 9 (((use_arg_then "negb_and")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "negbK")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "orbA")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "EXCLUDED_MIDDLE")(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
221 ((((use_arg_then "IN_UNION")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_DIFF")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_SING")(thm_tac (new_rewrite [] [])))));
222 ((((fun arg_tac -> (use_arg_then "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_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
223 ((((use_arg_then "cond")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_UNION")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "cond")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "B_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_DIFF")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "A_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_SING")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
224 ((((use_arg_then "SUM_SING")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then "BASIS_COMPONENT") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
225 (((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b. a = b + a * &1 <=> b = &0`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_EQ_0")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["j"]));
226 ((((((use_arg_then "IN_DIFF")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_SING")(thm_tac (new_rewrite [] []))))) THEN (move ["ineq_j"]) THEN (simp_tac)) THEN ((((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then "EQ_SYM_EQ") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))));
227 (((((use_arg_then "ineq_j")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "REAL_MUL_RZERO")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
230 (* Lemma has_derivative_lambda *)
231 let has_derivative_lambda = section_proof ["f";"f'";"y"]
232 `(!i. i IN 1..dimindex (:M) ==> (lift o (f i) has_derivative lift o (f' i)) (at (y:real^N))) ==>
233 (((\x. lambda i. f i x):real^N->real^M) has_derivative (\x. lambda i. f' i x) ) (at y)`
235 ((BETA_TAC THEN (move ["df"])) THEN (repeat_tactic 1 9 (((use_arg_then "lambda_eq_vsum")(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "HAS_DERIVATIVE_VSUM") (thm_tac apply_tac)));
236 (((((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac));
237 ((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"]))));
238 ((BETA_TAC THEN (move ["g"])) THEN ((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
239 (((((fun arg_tac -> (use_arg_then "eq") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "eq") (fun fst_arg -> (use_arg_then "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_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
242 (* Lemma vector2_eq_lambda *)
243 let vector2_eq_lambda = section_proof ["x";"y"]
244 `(vector [x; y]:real^2) = (lambda i. if i = 1 then x else y)`
246 ((((((use_arg_then "CART_EQ")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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 [] [])))));
247 ((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_then "DIMINDEX_2")(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac));
250 (* Lemma has_derivative_vector2 *)
251 let has_derivative_vector2 = section_proof ["f";"g";"f'";"g'";"y"]
252 `(lift o f has_derivative lift o f') (at y) ==>
253 (lift o g has_derivative lift o g') (at y) ==>
254 ((\x. vector [f x; g x]:real^2) has_derivative (\x. vector [f' x; g' x]:real^2)) (at y)`
256 ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])) THEN (repeat_tactic 1 9 (((use_arg_then "vector2_eq_lambda")(thm_tac (new_rewrite [] []))))));
257 (((use_arg_then "has_derivative_lambda") (thm_tac apply_tac)) THEN (((((use_arg_then "DIMINDEX_2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (move ["i"])));
258 ((((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_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))));
259 (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `~(2 = 1)`)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac));
262 (* Lemma has_derivative_mul *)
263 let has_derivative_mul = section_proof ["f";"g";"f'";"g'";"y"]
264 `(lift o f has_derivative lift o f') (at y) ==>
265 (lift o g has_derivative lift o g') (at y) ==>
266 (lift o (\x. f x * g x) has_derivative lift o (\x. f' x * g y + f y * g' x)) (at y)`
268 (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]));
269 ((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 [] [])))))));
270 ((((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "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));
271 ((fun arg_tac -> arg_tac (Arg_term (`vector [f y; g y]:real^2`))) (term_tac (set_tac "q")));
272 ((fun arg_tac -> arg_tac (Arg_term (`lift o (\x. f' x * g y + f y * g' x) =
273 (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 [] [])))))));
274 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "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_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
275 ((((use_arg_then "DIFF_CHAIN_AT") (thm_tac apply_tac)) THEN (simp_tac)) THEN ((((use_arg_then "q_def")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "has_derivative_x12")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "has_derivative_vector2")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
278 (* Lemma f_eq_lift_drop *)
279 let f_eq_lift_drop = section_proof ["f"]
280 `f = lift o (drop o f)`
282 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
285 (* Lemma differentiable_mul *)
286 let differentiable_mul = section_proof ["f";"g";"y"]
287 `lift o f differentiable (at y) ==>
288 lift o g differentiable (at y) ==>
289 lift o (\x. f x * g x) differentiable (at y)`
291 ((repeat_tactic 2 0 (((use_arg_then "differentiable")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["f'"])) THEN (move ["df"]) THEN (case THEN (move ["g'"])) THEN (move ["dg"]));
292 ((((use_arg_then "dg") (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN (((((fun arg_tac -> (use_arg_then "f_eq_lift_drop") (fun fst_arg -> (use_arg_then "f'") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "f_eq_lift_drop") (fun fst_arg -> (use_arg_then "g'") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (move ["df"]) THEN (move ["dg"])));
293 ((fun arg_tac -> (fun arg_tac -> (use_arg_then "has_derivative_mul") (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dg") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
294 (((use_arg_then "HAS_DERIVATIVE_IMP_DIFFERENTIABLE") (thm_tac apply_tac)) THEN (done_tac));
297 (* Lemma frechet_mul *)
298 let frechet_mul = section_proof ["f";"g";"y"]
299 `lift o f differentiable at y ==>
300 lift o g differentiable at y ==>
301 frechet_derivative (lift o (\x. f x * g x)) (at y) =
302 (\x. g y % frechet_derivative (lift o f) (at y) x +
303 f y % frechet_derivative (lift o g) (at y) x)`
305 (((repeat_tactic 1 9 (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "f_eq_lift_drop")(thm_tac (new_rewrite [] [(`frechet_derivative _1 _2`)]))))) THEN (move ["df"]));
306 ((((use_arg_then "f_eq_lift_drop")(thm_tac (new_rewrite [] [(`frechet_derivative _1 _2`)])))) THEN (move ["dg"]));
307 (((fun arg_tac -> (fun arg_tac -> (use_arg_then "has_derivative_mul") (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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_then "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 [] [])))))));
308 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] [])))))) THEN (move ["x"]));
309 (((((use_arg_then "LIFT_ADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_CMUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
312 (* Finalization of the section Product *)
313 let REAL_LET_MUL2 = finalize_theorem REAL_LET_MUL2;;
314 let has_derivative_x12 = finalize_theorem has_derivative_x12;;
315 let lambda_eq_vsum = finalize_theorem lambda_eq_vsum;;
316 let has_derivative_lambda = finalize_theorem has_derivative_lambda;;
317 let vector2_eq_lambda = finalize_theorem vector2_eq_lambda;;
318 let has_derivative_vector2 = finalize_theorem has_derivative_vector2;;
319 let has_derivative_mul = finalize_theorem has_derivative_mul;;
320 let f_eq_lift_drop = finalize_theorem f_eq_lift_drop;;
321 let differentiable_mul = finalize_theorem differentiable_mul;;
322 let frechet_mul = finalize_theorem frechet_mul;;
323 end_section "Product";;
325 (* Finalization of the section Misc *)
326 let f_lift_neg = finalize_theorem f_lift_neg;;
327 let f_lift_scale = finalize_theorem f_lift_scale;;
328 let f_lift_add = finalize_theorem f_lift_add;;
329 let f_lift_sub = finalize_theorem f_lift_sub;;
330 let f_binary_drop = finalize_theorem f_binary_drop;;
331 let f_unary_drop = finalize_theorem f_unary_drop;;
332 let frechet_compose = finalize_theorem frechet_compose;;
333 let frechet_const = finalize_theorem frechet_const;;
334 let frechet_id = finalize_theorem frechet_id;;
335 let frechet_vmul = finalize_theorem frechet_vmul;;
336 let frechet_neg = finalize_theorem frechet_neg;;
337 let frechet_scale = finalize_theorem frechet_scale;;
338 let frechet_add = finalize_theorem frechet_add;;
339 let frechet_sub = finalize_theorem frechet_sub;;
340 let differentiable_compose_at = finalize_theorem differentiable_compose_at;;
341 let jacobian_compose = finalize_theorem jacobian_compose;;
342 let frechet_eq_jacobian = finalize_theorem frechet_eq_jacobian;;
343 let REAL_LET_MUL2 = finalize_theorem REAL_LET_MUL2;;
344 let has_derivative_x12 = finalize_theorem has_derivative_x12;;
345 let lambda_eq_vsum = finalize_theorem lambda_eq_vsum;;
346 let has_derivative_lambda = finalize_theorem has_derivative_lambda;;
347 let vector2_eq_lambda = finalize_theorem vector2_eq_lambda;;
348 let has_derivative_vector2 = finalize_theorem has_derivative_vector2;;
349 let has_derivative_mul = finalize_theorem has_derivative_mul;;
350 let f_eq_lift_drop = finalize_theorem f_eq_lift_drop;;
351 let differentiable_mul = finalize_theorem differentiable_mul;;
352 let frechet_mul = finalize_theorem frechet_mul;;
355 (* Section Partial *)
356 begin_section "Partial";;
358 (* Lemma real_derivative_compose_frechet *)
359 let real_derivative_compose_frechet = section_proof ["f";"h";"t"]
360 `(lift o f) differentiable at (h t) ==>
361 (h o drop) differentiable at (lift t) ==>
362 ((f o h) has_real_derivative (drop o (frechet_derivative (lift o f) (at (h t)) o
363 frechet_derivative (h o drop) (at (lift t))) o lift) (&1)) (atreal t)`
365 (BETA_TAC THEN (move ["diff_f"]) THEN (move ["diff_h"]));
366 ((((use_arg_then "diff_h") (disch_tac [])) THEN ((use_arg_then "diff_f") (disch_tac [])) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(thm_tac (new_rewrite [] []))))));
367 ((fun arg_tac -> arg_tac (Arg_term (`frechet_derivative _1 _2`))) (term_tac (set_tac "f'")));
368 ((fun arg_tac -> arg_tac (Arg_term (`frechet_derivative _1 _2`))) (term_tac (set_tac "h'")));
369 (BETA_TAC THEN (move ["df"]) THEN (move ["dh"]));
370 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_REAL_FRECHET_DERIVATIVE_AT)))(thm_tac (new_rewrite [] []))));
371 ((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_then "o_ASSOC")(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
372 (((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 [] []))))))));
373 (((((use_arg_then "DIFF_CHAIN_AT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dh")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
374 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN (move ["x"]) THEN (simp_tac));
375 ((fun arg_tac -> arg_tac (Arg_term (`linear f' /\ linear h'`))) (term_tac (have_gen_tac [](move ["lin"]))));
376 (((((use_arg_then "h'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "f'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "LINEAR_FRECHET_DERIVATIVE")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
377 ((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] [])))))));
378 (((((use_arg_then "DROP_EQ")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "DROP_CMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
379 (((repeat_tactic 1 9 (((use_arg_then "LINEAR_CMUL")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "DROP_EQ")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "DROP_CMUL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
382 (* Lemma real_derivative_compose_jacobian *)
383 let real_derivative_compose_jacobian = section_proof ["f";"h";"t"]
384 `(lift o f) differentiable at (h t) ==>
385 (h o drop) differentiable at (lift t) ==>
386 ((f o h) has_real_derivative (jacobian (lift o f) (at (h t)) **
387 jacobian (h o drop) (at (lift t)))$1$1) (atreal t)`
389 (BETA_TAC THEN (move ["df"]) THEN (move ["dh"]));
390 (((fun arg_tac -> (fun arg_tac -> (use_arg_then "real_derivative_compose_frechet") (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dh") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
391 ((repeat_tactic 1 9 (((use_arg_then "frechet_eq_jacobian")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac));
392 ((((use_arg_then "MATRIX_VECTOR_MUL_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "matrix_vector_mul")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DROP_LAMBDA")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIMINDEX_1")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_SING_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
393 (((((use_arg_then "LIFT_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
396 (* Lemma diff_imp_real_diff *)
397 let diff_imp_real_diff = 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) real_differentiable atreal t`
402 (BETA_TAC THEN (move ["diff_f"]) THEN (move ["diff_h"]));
403 (((fun arg_tac -> (fun arg_tac -> (use_arg_then "real_derivative_compose_frechet") (fun fst_arg -> (use_arg_then "diff_f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "diff_h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
404 ((fun arg_tac -> arg_tac (Arg_term (`(drop o _ o lift) (&1)`))) (term_tac (set_tac "fh'")));
405 (((((use_arg_then "real_differentiable")(thm_tac (new_rewrite [] [])))) THEN (move ["dfh"])) THEN ((use_arg_then "fh'") (term_tac exists_tac)) THEN (done_tac));
408 (* Lemma diff_direction *)
409 let diff_direction = section_proof ["y";"e";"net"]
410 `((\t. y + t % e) o drop) differentiable net`
412 ((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_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
413 ((((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))));
414 ((use_arg_then "HAS_DERIVATIVE_IMP_DIFFERENTIABLE") (thm_tac apply_tac));
415 (((fun arg_tac -> arg_tac (Arg_term (`\x. drop x % e`))) (term_tac exists_tac)) THEN ((use_arg_then "HAS_DERIVATIVE_VMUL_DROP") (thm_tac apply_tac)) THEN (((use_arg_then "HAS_DERIVATIVE_ID")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
418 (* Lemma frechet_direction *)
419 let frechet_direction = section_proof ["y";"e";"t"]
420 `frechet_derivative ((\t. y + t % e) o drop) (at (lift t)) = (\x. drop x % e)`
422 ((((use_arg_then "f_unary_drop")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "frechet_add")(thm_tac (new_rewrite [] [])))));
423 (((((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "HAS_DERIVATIVE_IMP_DIFFERENTIABLE") (thm_tac apply_tac)));
424 (((fun arg_tac -> arg_tac (Arg_term (`\x. drop x % e`))) (term_tac exists_tac)) THEN ((use_arg_then "HAS_DERIVATIVE_VMUL_DROP") (thm_tac apply_tac)) THEN (((use_arg_then "HAS_DERIVATIVE_ID")(thm_tac (new_rewrite [] [])))));
425 (((((use_arg_then "frechet_vmul")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "frechet_const")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_ADD_LID")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
428 (* Lemma real_dir_derivative_frechet *)
429 let real_dir_derivative_frechet = section_proof ["f";"y";"e";"t"]
430 `(lift o f) differentiable at (y + t % e) ==>
431 ((f o (\t. y + t % e)) has_real_derivative
432 (drop (frechet_derivative (lift o f) (at (y + t % e)) e))) (atreal t)`
434 (BETA_TAC THEN (move ["df"]));
435 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "real_derivative_compose_frechet") (fun fst_arg -> (use_arg_then "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_then "t") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
436 (((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff_direction")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "frechet_direction")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_MUL_LID")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
439 (* Lemma real_dir_derivative_jacobian *)
440 let real_dir_derivative_jacobian = section_proof ["f";"y";"e";"t"]
441 `(lift o f) differentiable at (y + t % e) ==>
442 ((f o (\t. y + t % e)) has_real_derivative
443 drop (jacobian (lift o f) (at (y + t % e)) ** e)) (atreal t)`
445 (BETA_TAC THEN (move ["df"]));
446 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "real_dir_derivative_frechet") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "e") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
447 ((((use_arg_then "frechet_eq_jacobian")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
450 (* Lemma partial_eq_frechet *)
451 let partial_eq_frechet = section_proof ["f";"y";"i"]
452 `(lift o f) differentiable at (y:real^N) ==>
453 partial i f y = drop (frechet_derivative (lift o f) (at y) (basis i))`
455 ((BETA_TAC THEN (move ["df"])) THEN (((use_arg_then "partial")(thm_tac (new_rewrite [] [])))));
456 ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "real_dir_derivative_frechet") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] []))))));
457 ((BETA_TAC THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "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_then "derivative_unique") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac));
460 (* Lemma partial_eq_jacobian *)
461 let partial_eq_jacobian = section_proof ["f";"y";"i"]
462 `(lift o f) differentiable at y ==>
463 partial i f y = drop (jacobian (lift o f) (at y) ** basis i)`
465 (BETA_TAC THEN (move ["df"]));
466 ((((use_arg_then "df") (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "JACOBIAN_WORKS")(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "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));
469 (* Lemma partial_eq_jacobian_column *)
470 let partial_eq_jacobian_column = section_proof ["f";"y";"i"]
471 `(lift o (f:real^N->real)) differentiable at y ==>
472 i IN 1..dimindex (:N) ==>
473 partial i f y = drop (column i (jacobian (lift o f) (at y)))`
475 ((((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (move ["df"]) THEN (move ["ineq"]));
476 (((((use_arg_then "partial_eq_jacobian")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "MATRIX_VECTOR_MUL_BASIS")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
479 (* Lemma partial_eq_jacobian_entry *)
480 let partial_eq_jacobian_entry = section_proof ["f";"y";"i"]
481 `(lift o (f:real^N->real)) differentiable at y ==>
482 i IN 1..dimindex (:N) ==>
483 partial i f y = (jacobian (lift o f) (at y))$1$i`
485 ((BETA_TAC THEN (move ["df"]) THEN (move ["ineq"])) THEN ((((use_arg_then "partial_eq_jacobian_column")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "column")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DROP_LAMBDA")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
487 (add_section_var (mk_var ("y", (`:real^N`))));;
488 (add_section_var (mk_var ("i", (`:num`))));;
490 (* Lemma partial_eq0 *)
491 let partial_eq0 = section_proof ["f"]
492 `~(i IN 1..dimindex (:N)) ==>
495 ((BETA_TAC THEN (move ["ineq"])) THEN (((use_arg_then "partial")(thm_tac (new_rewrite [] [])))));
496 ((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_then "BASIS_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
497 ((((use_arg_then "VECTOR_MUL_RZERO")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "VECTOR_ADD_RID")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
498 ((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 [] [])))))));
499 ((AP_TERM_TAC) THEN ((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
500 ((((use_arg_then "derivative_const")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
503 (* Lemma derivative_compose *)
504 let derivative_compose = section_proof ["f";"g";"x"]
505 `f real_differentiable atreal (g x) ==>
506 g real_differentiable atreal x ==>
507 derivative (f o g) x = derivative f (g x) * derivative g x`
509 (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]));
510 ((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_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
511 (((((use_arg_then "derivative_composition")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
514 (* Lemma projection_has_derivative *)
515 let projection_has_derivative = section_proof ["i";"net"]
516 `i IN 1..dimindex (:N) ==>
517 (lift o (\x:real^N. x$i) has_derivative lift o (\x. x$i)) net`
519 ((((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (move ["ineq"]));
520 ((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 [] [])))))));
521 ((((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"])) THEN ((((use_arg_then "DROP_EQ")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DROP_CMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DROP_VEC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
522 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_DERIVATIVE_VMUL_COMPONENT)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "HAS_DERIVATIVE_ID")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
525 (* Lemma projection_diff *)
526 let projection_diff = section_proof ["i";"net"]
527 `i IN 1..dimindex (:N) ==>
528 (lift o (\x:real^N. x$i)) differentiable net`
530 ((((use_arg_then "differentiable")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "projection_has_derivative") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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"]));
531 (((fun arg_tac -> arg_tac (Arg_term (`lift o \x:real^N. x$i`))) (term_tac exists_tac)) THEN (done_tac));
534 (* Lemma frechet_projection *)
535 let frechet_projection = section_proof ["i";"x"]
536 `i IN 1..dimindex (:N) ==>
537 frechet_derivative (lift o (\x:real^N. x$i)) (at x) = lift o (\x:real^N. x$i)`
539 ((BETA_TAC THEN (move ["ineq"])) THEN (((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)));
540 ((((use_arg_then "projection_has_derivative")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
543 (* Lemma has_derivative_vector_frechet *)
544 let has_derivative_vector_frechet = section_proof ["h";"t";"i"]
545 `i IN 1..dimindex (:N) ==>
546 (h o drop) differentiable at (lift t) ==>
547 ((\s. (h:real->real^N) s$i) has_real_derivative
548 (frechet_derivative (h o drop) (at (lift t)) (lift (&1)))$i) (atreal t)`
550 (BETA_TAC THEN (move ["ineq"]) THEN (move ["dh"]));
551 ((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_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
552 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "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_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "t") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
553 ((((use_arg_then "dh")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "projection_diff")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
554 ((fun arg_tac -> arg_tac (Arg_term (`(drop o _ o lift) (&1)`))) (term_tac (set_tac "lhs")));
555 ((fun arg_tac -> arg_tac (Arg_term (`(frechet_derivative _1 _2 _3)$i`))) (term_tac (set_tac "rhs")));
556 ((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)));
557 (((((use_arg_then "lhs_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "frechet_projection")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "rhs_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
560 (* Lemma has_derivative_vector_jacobian *)
561 let has_derivative_vector_jacobian = section_proof ["h";"t";"i"]
562 `i IN 1..dimindex (:N) ==>
563 (h o drop) differentiable at (lift t) ==>
564 ((\s. (h:real->real^N) s$i) has_real_derivative (jacobian (h o drop) (at (lift t)))$i$1) (atreal t)`
566 (BETA_TAC THEN (move ["ineq"]) THEN (move ["dh"]));
567 (((fun arg_tac -> (fun arg_tac -> (use_arg_then "has_derivative_vector_frechet") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dh") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
568 ((fun arg_tac -> arg_tac (Arg_term (`(frechet_derivative _1 _2 _3)$i`))) (term_tac (set_tac "lhs")));
569 ((fun arg_tac -> arg_tac (Arg_term (`jacobian _1 _2$i$1`))) (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_then "lhs_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "frechet_eq_jacobian")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
572 ((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 [] [])))))));
573 (((((use_arg_then "DROP_EQ")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "basis")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DROP_LAMBDA")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
574 (((((use_arg_then "MATRIX_VECTOR_MUL_BASIS")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "DIMINDEX_GE_1")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "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_then "IN_NUMSEG")(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac));
577 (* Lemma derivative_vector_jacobian *)
578 let derivative_vector_jacobian = section_proof ["h";"t";"i"]
579 `i IN 1..dimindex (:N) ==>
580 ((h:real->real^N) o drop) differentiable at (lift t) ==>
581 derivative (\s. h s$i) t = jacobian (h o drop) (at (lift t))$i$1`
583 ((BETA_TAC THEN (move ["ineq"]) THEN (move ["dh"])) THEN ((use_arg_then "derivative_unique") (thm_tac apply_tac)) THEN (((use_arg_then "has_derivative_vector_jacobian")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
586 (* Lemma real_derivative_compose_partial *)
587 let real_derivative_compose_partial = section_proof ["f";"h";"t"]
588 `(lift o (f:real^N -> real)) differentiable at (h t) ==>
589 (h o drop) differentiable at (lift t) ==>
590 ((f o h) has_real_derivative
591 sum (1..dimindex (:N)) (\i. partial i f (h t) * derivative (\s. h s$i) t)) (atreal t)`
593 (BETA_TAC THEN (move ["df"]) THEN (move ["dh"]));
594 (((fun arg_tac -> (fun arg_tac -> (use_arg_then "real_derivative_compose_jacobian") (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dh") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
595 (((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"))));
596 ((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)));
597 (((use_arg_then "lhs_def")(gsym_then (thm_tac (new_rewrite [] [])))));
598 ((((use_arg_then "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_then "DIMINDEX_GE_1")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)));
599 ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "DIMINDEX_GE_1")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then "rhs_def")(gsym_then (thm_tac (new_rewrite [] []))))));
600 (((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac));
601 (((((use_arg_then "partial_eq_jacobian_entry")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_EQ_MUL_LCANCEL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_vector_jacobian")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
604 (* Lemma real_dir_derivative_partial *)
605 let real_dir_derivative_partial = section_proof ["f";"e";"t"]
606 `(lift o f) differentiable at (y + t % e) ==>
607 ((f o (\t. y + t % e)) has_real_derivative
608 sum (1..dimindex (:N)) (\i. e$i * (partial i f o (\t. y + t % e)) t)) (atreal t)`
610 (BETA_TAC THEN (move ["df"]));
611 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "real_dir_derivative_jacobian") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "y") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "e") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
612 ((((use_arg_then "matrix_vector_mul")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DROP_LAMBDA")(thm_tac (new_rewrite [] [])))));
613 (((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"))));
614 ((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)));
615 (((((use_arg_then "lhs_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "rhs_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac)));
616 (((((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "partial_eq_jacobian_entry")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
618 (add_section_var (mk_var ("f", (`:real^N -> real`))); add_section_var (mk_var ("g", (`:real^N -> real`))));;
619 (add_section_hyp "df" (`(lift o f) differentiable at y`));;
621 (* Lemma partial_uni_compose *)
622 let partial_uni_compose = section_proof ["u"]
623 `u real_differentiable atreal (f y) ==>
624 partial i (u o f) y = derivative u (f y) * partial i f y`
626 ((BETA_TAC THEN (move ["du"])) THEN ((repeat_tactic 1 9 (((use_arg_then "partial")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_ASSOC")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "derivative_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)));
627 (((((use_arg_then "diff_imp_real_diff")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff_direction")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
628 (((((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
631 (* Lemma partial_neg *)
632 let partial_neg = section_proof []
633 `partial i (\x. --f x) y = --partial i f y`
635 (((repeat_tactic 1 9 (((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "f_lift_neg")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_NEG")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then "frechet_neg")(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)) THEN (((use_arg_then "DROP_NEG")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac));
638 (* Lemma partial_scale *)
639 let partial_scale = section_proof ["c"]
640 `partial i (\x. c * f x) y = c * partial i f y`
642 (((repeat_tactic 1 9 (((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "f_lift_scale")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_CMUL")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then "frechet_scale")(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac))));
643 ((((use_arg_then "DROP_CMUL")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
645 (add_section_hyp "dg" (`(lift o g) differentiable at y`));;
647 (* Lemma partial_add *)
648 let partial_add = section_proof []
649 `partial i (\x. f x + g x) y = partial i f y + partial i g y`
651 (((repeat_tactic 1 9 (((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "f_lift_add")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then "frechet_add")(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac))));
652 ((((use_arg_then "DROP_ADD")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
655 (* Lemma partial_sub *)
656 let partial_sub = section_proof []
657 `partial i (\x. f x - g x) y = partial i f y - partial i g y`
659 (((repeat_tactic 1 9 (((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "f_lift_sub")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_SUB")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then "frechet_sub")(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac))));
660 ((((use_arg_then "DROP_SUB")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
663 (* Lemma partial_mul *)
664 let partial_mul = section_proof []
665 `partial i (\x. f x * g x) y = partial i f y * g y + f y * partial i g y`
667 ((repeat_tactic 1 9 (((use_arg_then "partial")(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`\t. y + t % basis i`))) (term_tac (set_tac "h"))));
668 ((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 [] [])))))));
669 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
670 ((THENL_ROT (-1)) (((use_arg_then "derivative_mul")(thm_tac (new_rewrite [] [])))));
671 ((((use_arg_then "h_def")(gsym_then (thm_tac (new_rewrite [1; 4] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "o_THM") (fun fst_arg -> (use_arg_then "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_then "o_THM") (fun fst_arg -> (use_arg_then "g") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))));
672 ((((use_arg_then "REAL_ADD_SYM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac));
673 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`h (&0) = y`))) (term_tac (have_gen_tac [](move ["h0"])))) (((((use_arg_then "h_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
674 ((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_then "h_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "diff_direction")(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
675 ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 1 9 (((use_arg_then "diff_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "h0")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
678 (* Finalization of the section Partial *)
679 let real_derivative_compose_frechet = finalize_theorem real_derivative_compose_frechet;;
680 let real_derivative_compose_jacobian = finalize_theorem real_derivative_compose_jacobian;;
681 let diff_imp_real_diff = finalize_theorem diff_imp_real_diff;;
682 let diff_direction = finalize_theorem diff_direction;;
683 let frechet_direction = finalize_theorem frechet_direction;;
684 let real_dir_derivative_frechet = finalize_theorem real_dir_derivative_frechet;;
685 let real_dir_derivative_jacobian = finalize_theorem real_dir_derivative_jacobian;;
686 let partial_eq_frechet = finalize_theorem partial_eq_frechet;;
687 let partial_eq_jacobian = finalize_theorem partial_eq_jacobian;;
688 let partial_eq_jacobian_column = finalize_theorem partial_eq_jacobian_column;;
689 let partial_eq_jacobian_entry = finalize_theorem partial_eq_jacobian_entry;;
690 let partial_eq0 = finalize_theorem partial_eq0;;
691 let derivative_compose = finalize_theorem derivative_compose;;
692 let projection_has_derivative = finalize_theorem projection_has_derivative;;
693 let projection_diff = finalize_theorem projection_diff;;
694 let frechet_projection = finalize_theorem frechet_projection;;
695 let has_derivative_vector_frechet = finalize_theorem has_derivative_vector_frechet;;
696 let has_derivative_vector_jacobian = finalize_theorem has_derivative_vector_jacobian;;
697 let derivative_vector_jacobian = finalize_theorem derivative_vector_jacobian;;
698 let real_derivative_compose_partial = finalize_theorem real_derivative_compose_partial;;
699 let real_dir_derivative_partial = finalize_theorem real_dir_derivative_partial;;
700 let partial_uni_compose = finalize_theorem partial_uni_compose;;
701 let partial_neg = finalize_theorem partial_neg;;
702 let partial_scale = finalize_theorem partial_scale;;
703 let partial_add = finalize_theorem partial_add;;
704 let partial_sub = finalize_theorem partial_sub;;
705 let partial_mul = finalize_theorem partial_mul;;
706 end_section "Partial";;
708 (* Section PartialMonotone *)
709 begin_section "PartialMonotone";;
711 (* Lemma derivative_translation *)
712 let derivative_translation = section_proof ["f";"x"]
713 `f real_differentiable atreal x ==>
714 derivative f x = derivative (f o (\t. x + t)) (&0)`
716 (BETA_TAC THEN (move ["diff_f"]));
717 ((((use_arg_then "derivative_compose")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_ADD_RID")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "diff_f")(thm_tac (new_rewrite [] []))))));
718 (((((use_arg_then "REAL_DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
719 ((((use_arg_then "derivative_add")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
720 (((((use_arg_then "derivative_const")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_x")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac));
722 (add_section_type (mk_var ("f", (`:real^N->real`))));;
724 (* Lemma partial_increasing_left *)
725 let partial_increasing_left = section_proof ["f";"j";"u";"x";"z";"lo"]
726 `(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i) ==>
728 (!y. y IN interval [x,z] ==> (lift o f) differentiable at y) ==>
729 (!y. y IN interval [x,z] ==> &0 <= partial j f y) ==>
730 (!y. y IN interval [x,u] ==> lo <= f y) ==>
731 (!y. y IN interval [x,z] ==> lo <= f y)`
733 (((((use_arg_then "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"]));
734 ((((use_arg_then "partial_pos") (disch_tac [])) THEN (clear_assumption "partial_pos") THEN ((use_arg_then "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"])));
735 ((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'")));
736 (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`f y' <= f y`))) (term_tac (have_gen_tac []ALL_TAC))));
737 ((((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_then "f_bound") (disch_tac [])) THEN (clear_assumption "f_bound") THEN (DISCH_THEN apply_tac) THEN (move ["i"]) THEN (move ["i_in"])));
738 ((((use_arg_then "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)));
739 ((THENL_FIRST) (((fun arg_tac -> (use_arg_then "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_then "ux_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
740 (((((use_arg_then "uz_eq")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "y_in")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
741 (((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "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_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (move ["j_in"])));
742 ((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_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
743 ((((use_arg_then "CART_EQ")(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["i_in"]));
744 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(i = j)`))) (term_tac (have_gen_tac [](move ["inj"])))) ((((use_arg_then "i_in") (disch_tac [])) THEN (clear_assumption "i_in") THEN ((use_arg_then "j_in") (disch_tac [])) THEN (clear_assumption "j_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
745 (((((use_arg_then "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));
746 ((fun arg_tac -> arg_tac (Arg_term (`f o (\t. y' + t % basis j)`))) (term_tac (set_tac "g")));
747 ((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 [] [])))))));
748 (((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
749 ((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 [] [])))))));
750 (((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (AP_TERM_TAC));
751 ((((use_arg_then "CART_EQ")(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["i_in"]));
752 ((((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
753 ((((fun arg_tac -> (use_arg_then "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_then "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))));
754 ((arith_tac) THEN (done_tac));
755 (((simp_tac) THEN (((use_arg_then "ij")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac));
756 ((fun arg_tac -> arg_tac (Arg_term (`real_interval [&0, y$j - x$j]`))) (term_tac (set_tac "s")));
757 ((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"]))));
758 (((((use_arg_then "s_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "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"]));
759 ((repeat_tactic 1 9 (((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
760 ((((use_arg_then "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)));
761 ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "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"])));
762 (((((use_arg_then "REAL_MUL_RZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "y_in")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
763 ((((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((fun arg_tac -> (use_arg_then "y_in") (fun fst_arg -> (use_arg_then "i_ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then "ij")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac));
764 ((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"]))));
765 ((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "in_s") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["p_in"])) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_ATREAL_WITHIN") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "partial")(thm_tac (new_rewrite [] [])))));
766 ((fun arg_tac -> arg_tac (Arg_term (`f o _`))) (term_tac (set_tac "h")));
767 ((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 [] [])))))));
768 ((((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "h_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["r"])) THEN ((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)));
769 (((((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));
770 (((((use_arg_then "derivative_translation")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "diff_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "diff_f")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then "diff_direction")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
771 ((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_then "y_in") (fun fst_arg -> (use_arg_then "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)));
772 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "HAS_REAL_DERIVATIVE_INCREASING_IMP") (fun fst_arg -> (use_arg_then "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_then "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));
773 (((((use_arg_then "s_def")(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then "IS_REALINTERVAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((((use_arg_then "ds")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (DISCH_THEN apply_tac));
774 ((((use_arg_then "s_def")(gsym_then (thm_tac (new_rewrite [2; 3] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "pos")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (simp_tac));
775 ((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "in_s") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "partial_pos") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac));
778 (* Lemma partial_decreasing_left *)
779 let partial_decreasing_left = section_proof ["f";"j";"u";"x";"z";"hi"]
780 `(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i) ==>
782 (!y. y IN interval [x,z] ==> (lift o f) differentiable at y) ==>
783 (!y. y IN interval [x,z] ==> partial j f y <= &0) ==>
784 (!y. y IN interval [x,u] ==> f y <= hi) ==>
785 (!y. y IN interval [x,z] ==> f y <= hi)`
787 (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"]));
788 ((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_then "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_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "u") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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_then "u_eq_i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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));
789 ((THENL_FIRST) (ANTS_TAC) ((BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "diff_f") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "DIFFERENTIABLE_NEG") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then "f_lift_neg")(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
791 ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then "partial_neg")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "diff_f")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_NEG_GE0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "partial_f")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
792 ((THENL_FIRST) (ANTS_TAC) ((BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "f_bound") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (arith_tac) THEN (done_tac)));
793 ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "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));
796 (* Lemma partial_translation *)
797 let partial_translation = section_proof ["f";"i";"p";"y"]
798 `lift o f differentiable at (p + y) ==>
799 partial i (f o (\x. p + x)) y = partial i f (p + y)`
801 (BETA_TAC THEN (move ["diff"]));
802 ((fun arg_tac -> arg_tac (Arg_term (`!net. (\x. p + x) differentiable net`))) (term_tac (have_gen_tac [](move ["diff_p"]))));
803 ((BETA_TAC THEN (move ["net"])) THEN ((((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
804 ((((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 1 (((use_arg_then "o_ASSOC")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_CHAIN_AT")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
805 ((((use_arg_then "frechet_compose")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "frechet_add")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
806 ((((use_arg_then "frechet_const")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "frechet_id")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_ADD_LID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "I_DEF")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "I_O_ID")(thm_tac (new_rewrite [] [])))));
807 ((((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
810 (* Lemma partial_rev_translation *)
811 let partial_rev_translation = 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)`
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_then "DIFFERENTIABLE_SUB")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
818 ((((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 1 (((use_arg_then "o_ASSOC")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_CHAIN_AT")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
819 ((((use_arg_then "frechet_compose")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "frechet_sub")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
820 ((((use_arg_then "frechet_const")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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 [] [])))));
821 ((((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac));
822 (((((use_arg_then "LINEAR_NEG")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "LINEAR_FRECHET_DERIVATIVE")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "DROP_NEG")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
825 (* Lemma partial_increasing_right *)
826 let partial_increasing_right = section_proof ["f";"j";"u";"x";"z";"hi"]
827 `(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = x$i) ==>
829 (!y. y IN interval [x,z] ==> (lift o f) differentiable at y) ==>
830 (!y. y IN interval [x,z] ==> &0 <= partial j f y) ==>
831 (!y. y IN interval [u,z] ==> f y <= hi) ==>
832 (!y. y IN interval [x,z] ==> f y <= hi)`
834 (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"]));
835 (((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "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_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (move ["j_in"])));
836 ((((use_arg_then "f_bound") (disch_tac [])) THEN (clear_assumption "f_bound") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "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"])));
837 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(i = j)`))) (term_tac (have_gen_tac [](move ["inj"])))) ((((use_arg_then "i_in") (disch_tac [])) THEN (clear_assumption "i_in") THEN ((use_arg_then "j_in") (disch_tac [])) THEN (clear_assumption "j_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
838 (((((use_arg_then "u_eq_i")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "y_ineq")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
839 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "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_then "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_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "z") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "hi") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
841 ((BETA_TAC THEN (move ["i"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "u_eq_i") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["eq1"]) THEN (move ["inj"])) THEN ((((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] []))))));
842 (((((use_arg_then "eq1")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac));
843 ((THENL_FIRST) (ANTS_TAC) (((((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "u_eq_j")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)));
844 ((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"]))));
845 ((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"])));
846 ((((fun arg_tac -> (use_arg_then "p_in") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
847 ((fun arg_tac -> arg_tac (Arg_term (`!y. _ y`))) (term_tac (set_tac "dP")));
848 ((fun arg_tac -> arg_tac (Arg_term (`dP`))) (term_tac (have_gen_tac [](move ["P"]))));
849 ((((use_arg_then "dP_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])));
850 (((((use_arg_then "o_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CHAIN_AT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_SUB")(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "diff_f")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then "Hp")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
851 ((((use_arg_then "P") (disch_tac [])) THEN (clear_assumption "P") THEN BETA_TAC THEN (simp_tac)) THEN ((((use_arg_then "dP_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["diff"])));
853 (BETA_TAC THEN (move ["p"]) THEN (move ["p_in"]));
854 ((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"])));
855 ((((use_arg_then "assoc")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "partial_rev_translation")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "assoc")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "diff_f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "Hp")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
856 (((((use_arg_then "REAL_NEG_LE0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "partial_f")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "Hp")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
858 ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "f_bound")(thm_tac (new_rewrite [] []))))));
859 ((((use_arg_then "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"])));
860 ((((fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "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_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac));
861 ((((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_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)));
862 ((((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));
863 ((((use_arg_then "Hp")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
866 (* Finalization of the section PartialMonotone *)
867 let derivative_translation = finalize_theorem derivative_translation;;
868 let partial_increasing_left = finalize_theorem partial_increasing_left;;
869 let partial_decreasing_left = finalize_theorem partial_decreasing_left;;
870 let partial_translation = finalize_theorem partial_translation;;
871 let partial_rev_translation = finalize_theorem partial_rev_translation;;
872 let partial_increasing_right = finalize_theorem partial_increasing_right;;
873 end_section "PartialMonotone";;
876 begin_section "Taylor";;
878 (* Lemma real_taylor2_bound *)
879 let real_taylor2_bound = section_proof ["f";"dd_bound"]
880 `nth_diff_strong_int 2 (&0, &1) f ==>
881 (!t. interval_arith t (&0, &1) ==> abs (nth_derivative 2 f t) <= dd_bound) ==>
882 abs (f (&1) - (f (&0) + derivative f (&0))) <= dd_bound / &2`
884 (((((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_diff_strong2_eq_alt")(thm_tac (new_rewrite [] []))))) THEN (move ["df"]) THEN (move ["dd"]));
885 ((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")));
886 ((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"])));
887 ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_TAYLOR") (fun fst_arg -> (use_arg_then "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_then "dd_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC));
888 (((((use_arg_then "IS_REALINTERVAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac));
889 ((BETA_TAC THEN (move ["i"]) THEN (move ["x"])) THEN ((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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 [] []))))));
890 (BETA_TAC THEN (case THEN ALL_TAC) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "df") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["s"])) THEN (move ["d_f"]));
891 ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "R_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "arithH")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN") (thm_tac apply_tac)) THEN (((use_arg_then "d_f")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
892 ((BETA_TAC THEN (move ["x"])) THEN (((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "arithH")(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"])));
893 ((((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "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_then "R_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "arithH")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "dd")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
894 ((((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_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_01")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)));
895 ((((use_arg_then "REAL_SUB_RZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ABS_1")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "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_then "real_div")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] []))))));
896 ((((use_arg_then "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_then "SUM_SING_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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));
897 ((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_then "REAL_INV_1")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))));
898 (((((use_arg_then "R_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "arithH")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
901 (* Lemma real_taylor1_bound *)
902 let real_taylor1_bound = section_proof ["f";"d_bound"]
903 `(!t. interval_arith t (&0, &1) ==> f real_differentiable atreal t /\
904 abs (derivative f t) <= d_bound) ==>
905 abs (f (&1) - f (&0)) <= d_bound`
907 (BETA_TAC THEN (move ["df"]));
908 ((fun arg_tac -> arg_tac (Arg_term (`\i. if i = 0 then f else derivative f`))) (term_tac (set_tac "R")));
909 ((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 + 1 = 1 /\ ~(1 = 0)`))) (fun arg -> thm_tac MP_TAC arg THEN (move ["arithH"])));
910 ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_TAYLOR") (fun fst_arg -> (use_arg_then "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_then "d_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC));
911 (((((use_arg_then "IS_REALINTERVAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac));
912 ((BETA_TAC THEN (move ["i"]) THEN (move ["x"])) THEN ((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leqn0")(thm_tac (new_rewrite [] []))))));
913 (BETA_TAC THEN (case THEN ALL_TAC) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "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 [] [])))));
914 (((((use_arg_then "R_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "arithH")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN") (thm_tac apply_tac)) THEN (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
915 ((BETA_TAC THEN (move ["x"])) THEN (((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "arithH")(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"])));
916 ((((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "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_then "R_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "arithH")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
917 ((((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_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_01")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)));
918 ((((use_arg_then "SUM_SING_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "REAL_SUB_RZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "arithH")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ABS_1")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_POW_ONE")(thm_tac (new_rewrite [] []))))));
919 ((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_then "REAL_DIV_1")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))));
920 (((((use_arg_then "R_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "arithH")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
922 let m_taylor_error = new_definition `m_taylor_error f domain (w:real^N) error <=>
923 !x:real^N. x IN interval [domain] ==> sum (1..dimindex (:N)) (\i. w$i * sum (1..dimindex (:N))
924 (\j. w$j * abs (partial j (partial i f) x))) <= error`;;
925 let m_taylor_partial_error = new_definition `m_taylor_partial_error f i domain (w:real^N) error <=>
926 (!x:real^N. x IN interval[domain] ==>
927 sum (1..dimindex (:N)) (\j. w$j * abs (partial j (partial i f) x)) <= error)`;;
929 (* Lemma taylor_error_eq_sum_partial_errors *)
930 let taylor_error_eq_sum_partial_errors = section_proof ["f";"domain";"w";"p_error";"error"]
931 `(!i. i IN 1..dimindex (:N) ==> m_taylor_partial_error f i domain w (p_error i) /\ &0 <= w$i) ==>
932 sum (1..dimindex (:N)) (\i. w$i * p_error i) <= error ==>
933 m_taylor_error f domain (w:real^N) error`
935 (((((use_arg_then "m_taylor_partial_error")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "m_taylor_error")(thm_tac (new_rewrite [] []))))) THEN (move ["partialH"]) THEN (move ["ineq"]) THEN (move ["p"]) THEN (move ["p_in"]));
936 (((use_arg_then "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));
937 (((use_arg_then "SUM_LE") (thm_tac apply_tac)) THEN (((((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac)));
938 (((((use_arg_then "REAL_LE_LMUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "partialH") (fun fst_arg -> (use_arg_then "i_ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
940 let partial2 = new_definition `partial2 j i f = partial j (partial i f)`;;
941 let diff2 = new_definition `diff2 f x <=>
942 ?s. open s /\ x IN s /\ (!y. y IN s ==> (lift o f) differentiable at y /\
943 (!i. (lift o partial i f) differentiable at y))`;;
944 let diff2c = new_definition `diff2c f x <=> diff2 f x /\
945 (!i j. (lift o partial2 j i f) continuous at x)`;;
947 (* Lemma diff2c_imp_diff2 *)
948 let diff2c_imp_diff2 = section_proof ["f";"x"]
949 `diff2c f x ==> diff2 f x`
951 (((((use_arg_then "diff2c")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
954 (* Lemma diff2_eq_diff2_on_open *)
955 let diff2_eq_diff2_on_open = section_proof ["f";"x"]
957 ?s. open s /\ x IN s /\ (!y. y IN s ==> diff2 f y)`
959 ((repeat_tactic 1 9 (((use_arg_then "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"])));
960 (((use_arg_then "s") (term_tac exists_tac)) THEN (((((use_arg_then "open_s")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["ys"])) THEN ((use_arg_then "s") (term_tac exists_tac)) THEN (done_tac));
961 ((((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "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_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC THEN (move ["_"])));
962 (((use_arg_then "t") (term_tac exists_tac)) THEN (done_tac));
965 (* Lemma diff2_imp_real_diff *)
966 let diff2_imp_real_diff = section_proof ["f";"x";"e";"t"]
967 `diff2 f (x + t % e) ==>
968 f o (\t. x + t % e) real_differentiable atreal t`
970 ((((use_arg_then "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"]));
971 (((use_arg_then "diff_imp_real_diff") (thm_tac apply_tac)) THEN ((simp_tac) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "diff_direction")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
974 (* Lemma diff2_dir_derivative *)
975 let diff2_dir_derivative = section_proof ["f";"x";"e";"t"]
976 `diff2 f (x + t % e:real^N) ==>
977 derivative (f o (\t. x + t % e)) t =
978 sum (1..dimindex (:N)) (\i. e$i * (partial i f o (\t. x + t % e)) t)`
980 ((((use_arg_then "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"]));
981 ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "real_dir_derivative_partial")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
984 (* Lemma diff2_partial_real_diff *)
985 let diff2_partial_real_diff = section_proof ["f";"i";"x";"e";"t"]
986 `diff2 f (x + t % e:real^N) ==>
987 partial i f o (\t. x + t % e) real_differentiable atreal t`
989 ((((use_arg_then "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"]));
990 (((((use_arg_then "diff_imp_real_diff")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "diff_direction")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
994 let in_trans = section_proof ["x";"s";"t"]
995 `t SUBSET s ==> x IN t ==> x IN s`
997 ((((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (move ["sub"]) THEN (move ["xt"]));
998 (((use_arg_then "sub") (disch_tac [])) THEN (clear_assumption "sub") THEN (exact_tac));
1001 (* Lemma open_contains_open_interval *)
1002 let open_contains_open_interval = section_proof ["e";"s";"x"]
1003 `open s ==> x IN s ==>
1004 ?a b. &0 IN real_interval (a, b) /\ IMAGE (\t. x + t % e) (real_interval (a, b)) SUBSET s`
1006 ((((use_arg_then "OPEN_CONTAINS_BALL")(thm_tac (new_rewrite [] [])))) THEN (move ["open_s"]));
1007 (((DISCH_THEN (fun snd_th -> (use_arg_then "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_then "open_s") (disch_tac [])) THEN (clear_assumption "open_s") THEN BETA_TAC THEN (move ["_"])));
1008 ((THENL) (((fun arg_tac -> (use_arg_then "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"])]);
1009 (((((use_arg_then "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_then "d") (term_tac exists_tac))));
1010 ((THENL_FIRST) (split_tac) ((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1011 ((((((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] []))))));
1012 (((((fun arg_tac -> (use_arg_then "in_trans") (fun fst_arg -> (use_arg_then "ball_s") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "CENTRE_IN_BALL")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1013 ((fun arg_tac -> arg_tac (Arg_term (`((d / &2) * inv(norm e)) % e`))) (term_tac (set_tac "y")));
1014 ((fun arg_tac -> arg_tac (Arg_term (`norm y = d / &2`))) (term_tac (have_gen_tac [](move ["norm_y"]))));
1015 ((((use_arg_then "y_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "VECTOR_MUL_ASSOC")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "NORM_MUL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_ABS_INV")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ABS_NORM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_LINV")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
1016 ((((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1017 ((((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));
1018 ((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_NEG_LT0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbb")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LT_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LT_INV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "NORM_POS_LT")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "NORM_EQ_0")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)));
1019 ((((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1020 (((use_arg_then "SUBSET_TRANS") (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`ball (x, d)`))) (term_tac exists_tac)) THEN (((((use_arg_then "ball_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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)));
1021 ((((use_arg_then "IN_BALL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dist")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_SUB_RADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NORM_NEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NORM_MUL")(thm_tac (new_rewrite [] [])))));
1022 ((THENL_LAST) ((((use_arg_then "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_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1023 ((((fun arg_tac -> (use_arg_then "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_then "REAL_MUL_LINV") (fun fst_arg -> (use_arg_then "n0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_RMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NORM_POS_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))));
1024 ((((use_arg_then "t_in") (disch_tac [])) THEN (clear_assumption "t_in") THEN BETA_TAC) THEN (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac));
1027 (* Lemma diff2_dir *)
1028 let diff2_dir = section_proof ["f";"x";"e";"t"]
1029 `diff2 f (x + t % e:real^N) ==>
1030 nth_diff_strong 2 (f o (\t. x + t % e)) t`
1032 (((((use_arg_then "diff2_eq_diff2_on_open")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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"]));
1033 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "open_contains_open_interval") (fun fst_arg -> (use_arg_then "e") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "open_s") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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"]));
1034 (((fun arg_tac -> arg_tac (Arg_term (`real_interval (a + t, b + t)`))) (term_tac exists_tac)) THEN ((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac));
1035 ((((use_arg_then "in0") (disch_tac [])) THEN (clear_assumption "in0") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1036 (BETA_TAC THEN (move ["p"]) THEN (move ["p_int"]));
1037 ((fun arg_tac -> arg_tac (Arg_term (`x + p % e IN s`))) (term_tac (have_gen_tac [](move ["xp_in"]))));
1038 ((((use_arg_then "sub") (disch_tac [])) THEN (clear_assumption "sub") THEN BETA_TAC) THEN (((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN ((((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`p - t`))) (term_tac exists_tac)));
1039 (((THENL) (split_tac) [(VECTOR_ARITH_TAC); ((((use_arg_then "p_int") (disch_tac [])) THEN (clear_assumption "p_int") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (arith_tac))]) THEN (done_tac));
1040 ((((use_arg_then "diff2_imp_real_diff")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))));
1041 ((use_arg_then "differentiable_local") (thm_tac apply_tac));
1042 ((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));
1043 ((fun arg_tac -> arg_tac (Arg_term (`min (p - (a + t)) (b + t - p)`))) (term_tac (set_tac "d")));
1044 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < d`))) (term_tac (have_gen_tac [](move ["d0"])))) ((((use_arg_then "p_int") (disch_tac [])) THEN (clear_assumption "p_int") THEN BETA_TAC) THEN ((((use_arg_then "d_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)));
1045 (((fun arg_tac -> arg_tac (Arg_term (`real_interval (p - d, p + d)`))) (term_tac exists_tac)) THEN (split_tac));
1046 ((((use_arg_then "differentiable_sum_numseg")(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac));
1047 (((((use_arg_then "REAL_DIFFERENTIABLE_MUL_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
1048 (((((use_arg_then "diff2_partial_real_diff")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1049 (((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac));
1050 ((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1051 ((BETA_TAC THEN (move ["y"]) THEN (move ["y_in"])) THEN ((((use_arg_then "diff2_dir_derivative")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))));
1052 ((((use_arg_then "sub") (disch_tac [])) THEN (clear_assumption "sub") THEN BETA_TAC) THEN (((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN ((((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`y - t`))) (term_tac exists_tac)));
1053 ((THENL_FIRST) (split_tac) ((VECTOR_ARITH_TAC) THEN (done_tac)));
1054 ((((use_arg_then "p_int") (disch_tac [])) THEN (clear_assumption "p_int") THEN ((use_arg_then "d_def") (disch_tac [])) THEN (clear_assumption "d_def") THEN ((use_arg_then "y_in") (disch_tac [])) THEN (clear_assumption "y_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1057 (* Lemma diff2_dir_derivative2 *)
1058 let diff2_dir_derivative2 = section_proof ["f";"x";"e";"t"]
1059 `diff2 f (x + t % e:real^N) ==>
1060 nth_derivative 2 (f o (\t. x + t % e)) t =
1061 sum (1..dimindex (:N)) (\i. sum (1..dimindex (:N))
1062 (\j. e$i * e$j * (partial j (partial i f) o (\t. x + t % e)) t))`
1064 ((((use_arg_then "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"]));
1065 ((((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)));
1066 (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac));
1067 (((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));
1068 (((use_arg_then "HAS_REAL_DERIVATIVE_SUM") (thm_tac apply_tac)) THEN (((((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac)));
1069 (((((use_arg_then "SUM_LMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_LMUL_ATREAL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
1070 (((use_arg_then "real_dir_derivative_partial")(thm_tac (new_rewrite [] []))));
1071 ((((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "xs") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "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));
1072 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "open_contains_open_interval") (fun fst_arg -> (use_arg_then "e") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "open_s") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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"]));
1073 (((fun arg_tac -> arg_tac (Arg_term (`real_interval (a + t, b + t)`))) (term_tac exists_tac)) THEN ((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac));
1074 ((((use_arg_then "in0") (disch_tac [])) THEN (clear_assumption "in0") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1075 ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then "diff2_dir_derivative")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))));
1076 ((((use_arg_then "sub") (disch_tac [])) THEN (clear_assumption "sub") THEN BETA_TAC) THEN (((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN ((((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`p - t`))) (term_tac exists_tac)));
1077 ((THENL_FIRST) (split_tac) ((VECTOR_ARITH_TAC) THEN (done_tac)));
1078 ((((use_arg_then "p_in") (disch_tac [])) THEN (clear_assumption "p_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1081 (* Lemma diff2_has_derivative_partial *)
1082 let diff2_has_derivative_partial = section_proof ["f";"i";"x";"e";"t"]
1083 `diff2 f (x + t % e:real^N) ==>
1084 (partial i f o (\t. x + t % e) has_real_derivative
1085 sum (1..dimindex (:N)) (\j. e$j * (partial j (partial i f) o (\t. x + t % e)) t)) (atreal t)`
1087 ((((use_arg_then "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"]));
1088 (((((use_arg_then "real_dir_derivative_partial")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1091 (* Lemma diff2_derivative_partial *)
1092 let diff2_derivative_partial = section_proof ["f";"i";"x";"e";"t"]
1093 `diff2 f (x + t % e:real^N) ==>
1094 derivative (partial i f o (\t. x + t % e)) t =
1095 sum (1..dimindex (:N)) (\j. e$j * (partial j (partial i f) o (\t. x + t % e)) t)`
1097 ((BETA_TAC THEN (move ["df"])) THEN (((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "diff2_has_derivative_partial") (disch_tac [])) THEN (clear_assumption "diff2_has_derivative_partial") THEN (exact_tac)) THEN (done_tac));
1100 (* Lemma diff2_real_diff_partial *)
1101 let diff2_real_diff_partial = section_proof ["f";"i";"x";"e";"t"]
1102 `diff2 f (x + t % e:real^N) ==>
1103 partial i f o (\t. x + t % e) real_differentiable atreal t`
1105 (BETA_TAC THEN (move ["df2"]));
1106 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "diff2_has_derivative_partial") (fun fst_arg -> (use_arg_then "df2") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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"))));
1107 (((((use_arg_then "real_differentiable")(thm_tac (new_rewrite [] [])))) THEN (move ["df"])) THEN ((use_arg_then "s") (term_tac exists_tac)) THEN (done_tac));
1110 (* Lemma partial_const *)
1111 let partial_const = section_proof ["i";"c"]
1112 `partial i (\x:real^N. c) = (\x. &0)`
1114 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial")(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac));
1115 (((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 [] []))))))));
1116 ((((use_arg_then "derivative_const")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1117 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1120 (* Lemma partial_eq0_alt *)
1121 let partial_eq0_alt = section_proof ["i";"f"]
1122 `~(i IN 1..dimindex (:N)) ==> partial i f = (\x:real^N. &0)`
1124 ((BETA_TAC THEN (move ["ih"])) THEN ((((use_arg_then "FUN_EQ_THM")(thm_tac (new_rewrite [] [])))) THEN (move ["x"])) THEN (((use_arg_then "partial_eq0")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1127 (* Lemma real_mvt0 *)
1128 let real_mvt0 = section_proof []
1129 `!f f' a. (!x. abs x <= abs a ==> (f has_real_derivative f' x) (atreal x)) ==>
1130 (?t. abs t <= abs a /\ f a - f (&0) = f' t * a)`
1132 (BETA_TAC THEN (move ["f"]) THEN (move ["f'"]) THEN (move ["a"]) THEN (move ["h"]));
1133 (((fun arg_tac -> (use_arg_then "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"]));
1134 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_MVT_VERY_SIMPLE") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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_then "a") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1135 (((((use_arg_then "a_ineq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))))) THEN (ANTS_TAC));
1136 (BETA_TAC THEN (move ["x"]) THEN (move ["x_ineq"]));
1137 (((((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "h")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "x_ineq") (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1138 (BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["t_ineq"])) THEN (move ["eq"]));
1139 (((use_arg_then "t") (term_tac exists_tac)) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1140 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_MVT_VERY_SIMPLE") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f'") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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));
1141 ((repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (ANTS_TAC));
1142 ((THENL_FIRST) (split_tac) ((((use_arg_then "a_ineq") (disch_tac [])) THEN (clear_assumption "a_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1143 ((BETA_TAC THEN (move ["x"]) THEN (move ["x_ineq"])) THEN ((((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "h")(thm_tac (new_rewrite [] []))))));
1144 ((((use_arg_then "x_ineq") (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1145 (BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["t_ineq"])) THEN (move ["eq"]));
1146 (((use_arg_then "t") (term_tac exists_tac)) THEN ((((use_arg_then "REAL_NEG_SUB")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_NEG_RMUL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1149 (* Lemma mixed_second_partials *)
1150 let mixed_second_partials = section_proof ["f";"x";"i";"j"]
1151 `diff2c f x ==> partial2 i j f x = partial2 j i f (x:real^N)`
1153 (((((use_arg_then "diff2c")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "partial2")(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["pc"]))));
1154 ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "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"])));
1155 (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "partial_eq0_alt") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "partial_const")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1156 ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "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"])));
1157 (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "partial_eq0_alt") (fun fst_arg -> (use_arg_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "partial_const")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1158 ((((use_arg_then "jh") (disch_tac [])) THEN (clear_assumption "jh") THEN ((use_arg_then "ih") (disch_tac [])) THEN (clear_assumption "ih") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (move ["ih"]) THEN (move ["jh"])));
1159 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then "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"])));
1160 ((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")));
1161 ((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")));
1162 ((fun arg_tac -> arg_tac (Arg_term (`\h k. F1 h k - F1 h (&0)`))) (term_tac (set_tac "G")));
1163 ((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)));
1164 ((fun arg_tac -> arg_tac (Arg_term (`G = \h k. F2 k h - F2 k (&0)`))) (term_tac (have_gen_tac [](move ["G_eq"]))));
1165 ((repeat_tactic 2 0 (((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["h"]) THEN (move ["k"]));
1166 (((((use_arg_then "G_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "F2_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "F1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
1167 ((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"]))))))));
1168 ((((use_arg_then "open_s") (disch_tac [])) THEN (clear_assumption "open_s") THEN BETA_TAC) THEN (((((use_arg_then "OPEN_CONTAINS_BALL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_BALL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dist")(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "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"])))));
1169 ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`e / &3`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then "e0") (disch_tac [])) THEN (clear_assumption "e0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1170 (BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"]));
1171 ((((use_arg_then "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_then "VECTOR_SUB_RADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NORM_NEG")(thm_tac (new_rewrite [] [])))));
1172 ((THENL_LAST) ((((use_arg_then "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_then "e0") (disch_tac [])) THEN (clear_assumption "e0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1173 ((THENL_LAST) ((((use_arg_then "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_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1174 ((fun arg_tac -> (fun arg_tac -> (use_arg_then "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));
1175 (((repeat_tactic 1 9 (((use_arg_then "NORM_MUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "NORM_BASIS")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1176 ((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"]))));
1177 ((THENL) (split_tac) [((move ["h"]) THEN (move ["h_ineq"])); ((move ["k"]) THEN (move ["k_ineq"]))]);
1178 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "rs") (fun fst_arg -> (use_arg_then "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_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "h_ineq")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "r0") (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1179 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "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_then "k") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "k_ineq")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "r0") (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1180 ((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"]))));
1181 (((((use_arg_then "F1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1182 ((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"]))));
1183 (BETA_TAC THEN (move ["h"]) THEN (move ["h_ineq"]) THEN (move ["k"]) THEN (move ["k_ineq"]));
1184 (((((use_arg_then "F1h")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_SUB")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
1185 (((repeat_tactic 1 9 (((use_arg_then "diff2_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "in_s")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1186 ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==>
1187 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"]))));
1188 ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then "F1h")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_sub")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then "diff2_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "in_s")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
1189 (((((use_arg_then "derivative_translation")(thm_tac (new_rewrite [] [(`derivative (f o (\k. x + k % basis j)) k`)])))) THEN (repeat_tactic 0 1 (((use_arg_then "derivative_translation")(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 0 10 (((use_arg_then "diff2_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "in_s")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
1190 ((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"]))));
1191 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "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));
1192 (((repeat_tactic 1 9 (((use_arg_then "eq")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "partial")(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac));
1193 ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==>
1194 (?t1. G h k = k * derivative (F1 h) t1 /\ abs t1 <= abs k)`))) (term_tac (have_gen_tac [](move ["Gh"]))));
1195 ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then "G_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)));
1196 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "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_then "k") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1198 ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN ((((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dF1")(thm_tac (new_rewrite [] []))))));
1199 ((((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1200 (BETA_TAC THEN (case THEN (move ["t1"])) THEN (case THEN (move ["t1_ineq"])) THEN (move ["eq"]));
1201 (((use_arg_then "t1") (term_tac exists_tac)) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t1_ineq") (disch_tac [])) THEN (clear_assumption "t1_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1202 ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==>
1203 (?t1 t2. G h k = h * k * partial i (partial j f) (x + t1 % basis j + t2 % basis i)
1204 /\ abs t1 <= abs k /\ abs t2 <= abs h)`))) (term_tac (have_gen_tac [](move ["Ghk"]))));
1205 (BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"]));
1206 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "Gh") (fun fst_arg -> (use_arg_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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_then "ineq")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t1"])) THEN (case THEN ((move ["eq"]) THEN (move ["t1k"])))));
1207 ((THENL) ((((use_arg_then "eq") (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (((use_arg_then "F1_der")(thm_tac (new_rewrite [] []))))) [((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t1k") (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (move ["eq"]))]);
1208 ((fun arg_tac -> arg_tac (Arg_term (`partial j f o (\h. (x + t1 % basis j) + h % basis i)`))) (term_tac (set_tac "g")));
1209 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "real_mvt0") (fun fst_arg -> (use_arg_then "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_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1211 ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] [])))));
1212 ((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "diff2_partial_real_diff")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "v_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "rs")(thm_tac (new_rewrite [] [])))));
1213 ((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then "t1k") (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1214 (BETA_TAC THEN (case THEN (move ["t2"])) THEN (case THEN (move ["t2_ineq"])) THEN (move ["g_eq"]));
1215 ((THENL_LAST) ((((use_arg_then "t1") (term_tac exists_tac)) THEN ((use_arg_then "t2") (term_tac exists_tac))) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t2_ineq") (disch_tac [])) THEN (clear_assumption "t2_ineq") THEN ((use_arg_then "t1k") (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1216 ((fun arg_tac -> arg_tac (Arg_term (`_1 - _2`))) (term_tac (set_tac "p")));
1217 ((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 [] [])))))));
1218 (((((use_arg_then "p_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1219 ((((use_arg_then "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_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] []))))));
1220 (((((use_arg_then "REAL_EQ_MUL_LCANCEL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISJ2_TAC));
1221 (((use_arg_then "derivative_translation")(thm_tac (new_rewrite [] []))));
1222 (((((use_arg_then "diff2_partial_real_diff")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "v_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t2_ineq") (disch_tac [])) THEN (clear_assumption "t2_ineq") THEN ((use_arg_then "t1k") (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1223 ((((use_arg_then "partial")(thm_tac (new_rewrite [] [])))) THEN (AP_THM_TAC) THEN (AP_TERM_TAC));
1224 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "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));
1225 (((use_arg_then "F1_def") (disch_tac [])) THEN (clear_assumption "F1_def") THEN ((use_arg_then "G_def") (disch_tac [])) THEN (clear_assumption "G_def") THEN ((use_arg_then "F1h") (disch_tac [])) THEN (clear_assumption "F1h") THEN ((use_arg_then "dF1") (disch_tac [])) THEN (clear_assumption "dF1") THEN ((use_arg_then "F1_der") (disch_tac [])) THEN (clear_assumption "F1_der") THEN ((use_arg_then "Gh") (disch_tac [])) THEN (clear_assumption "Gh") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]));
1226 ((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"]))));
1227 (((((use_arg_then "F2_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1228 ((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"]))));
1229 (BETA_TAC THEN (move ["k"]) THEN (move ["k_ineq"]) THEN (move ["h"]) THEN (move ["h_ineq"]));
1230 (((((use_arg_then "F2h")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_SUB")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
1231 (((repeat_tactic 1 9 (((use_arg_then "diff2_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "in_s")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1232 ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==>
1233 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"]))));
1234 ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then "F2h")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_sub")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then "diff2_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "in_s")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
1235 (((((use_arg_then "v_eq")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "derivative_translation")(thm_tac (new_rewrite [] [(`derivative (f o (\h. x + h % basis i)) h`)])))) THEN (repeat_tactic 0 1 (((use_arg_then "derivative_translation")(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 0 10 (((use_arg_then "diff2_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "in_s")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "v_eq")(gsym_then (thm_tac (new_rewrite [] [])))))));
1236 ((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"]))));
1237 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "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));
1238 (((repeat_tactic 1 9 (((use_arg_then "eq")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "partial")(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac));
1239 ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==>
1240 (?t3. G h k = h * derivative (F2 k) t3 /\ abs t3 <= abs h)`))) (term_tac (have_gen_tac [](move ["Gk"]))));
1241 ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then "G_eq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)));
1242 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "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_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1244 ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN ((((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dF2")(thm_tac (new_rewrite [] []))))));
1245 ((((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1246 (BETA_TAC THEN (case THEN (move ["t3"])) THEN (case THEN (move ["t3_ineq"])) THEN (move ["eq"]));
1247 (((use_arg_then "t3") (term_tac exists_tac)) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t3_ineq") (disch_tac [])) THEN (clear_assumption "t3_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1248 ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==>
1249 (?t3 t4. G h k = h * k * partial j (partial i f) (x + t4 % basis j + t3 % basis i)
1250 /\ abs t3 <= abs h /\ abs t4 <= abs k)`))) (term_tac (have_gen_tac [](move ["Gkh"]))));
1251 (BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"]));
1252 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "Gk") (fun fst_arg -> (use_arg_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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_then "ineq")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t3"])) THEN (case THEN ((move ["eq"]) THEN (move ["t3h"])))));
1253 ((THENL) ((((use_arg_then "eq") (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (((use_arg_then "F2_der")(thm_tac (new_rewrite [] []))))) [((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t3h") (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (move ["eq"]))]);
1254 ((fun arg_tac -> arg_tac (Arg_term (`partial i f o (\k. (x + t3 % basis i) + k % basis j)`))) (term_tac (set_tac "g")));
1255 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "real_mvt0") (fun fst_arg -> (use_arg_then "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_then "k") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
1257 ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] [])))));
1258 ((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "diff2_partial_real_diff")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "rs")(thm_tac (new_rewrite [] [])))));
1259 ((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then "t3h") (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1260 (BETA_TAC THEN (case THEN (move ["t4"])) THEN (case THEN (move ["t4_ineq"])) THEN (move ["g_eq"]));
1261 ((THENL_LAST) ((((use_arg_then "t3") (term_tac exists_tac)) THEN ((use_arg_then "t4") (term_tac exists_tac))) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t4_ineq") (disch_tac [])) THEN (clear_assumption "t4_ineq") THEN ((use_arg_then "t3h") (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1262 ((fun arg_tac -> arg_tac (Arg_term (`_1 - _2`))) (term_tac (set_tac "p")));
1263 ((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 [] [])))))));
1264 (((((use_arg_then "p_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1265 ((((use_arg_then "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_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] []))))));
1266 (((((use_arg_then "REAL_EQ_MUL_LCANCEL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISJ2_TAC));
1267 (((use_arg_then "derivative_translation")(thm_tac (new_rewrite [] []))));
1268 (((((use_arg_then "diff2_partial_real_diff")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t4_ineq") (disch_tac [])) THEN (clear_assumption "t4_ineq") THEN ((use_arg_then "t3h") (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1269 ((((use_arg_then "partial")(thm_tac (new_rewrite [] [])))) THEN (AP_THM_TAC) THEN (AP_TERM_TAC));
1270 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "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"]));
1271 ((AP_TERM_TAC) THEN (VECTOR_ARITH_TAC) THEN (done_tac));
1272 (((use_arg_then "F2_def") (disch_tac [])) THEN (clear_assumption "F2_def") THEN ((use_arg_then "G_eq") (disch_tac [])) THEN (clear_assumption "G_eq") THEN ((use_arg_then "F2h") (disch_tac [])) THEN (clear_assumption "F2h") THEN ((use_arg_then "dF2") (disch_tac [])) THEN (clear_assumption "dF2") THEN ((use_arg_then "F2_der") (disch_tac [])) THEN (clear_assumption "F2_der") THEN ((use_arg_then "Gk") (disch_tac [])) THEN (clear_assumption "Gk") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]));
1273 ((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"]))));
1274 (((((use_arg_then "limit_point_of")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "OPEN_CONTAINS_BALL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_BALL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dist")(thm_tac (new_rewrite [] []))))) THEN (move ["t"]) THEN (case THEN (move ["v0t"])));
1275 (((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "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"]));
1276 ((fun arg_tac -> arg_tac (Arg_term (`e / &2 % (vec 1:real^2)`))) (term_tac (set_tac "y")));
1277 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`!i. y$i = e / (&2)`))) (term_tac (have_gen_tac [](move ["yc"])))) (((((use_arg_then "y_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VEC_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
1278 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < e / (&2)`))) (term_tac (have_gen_tac [](move ["ineq"])))) (((((use_arg_then "REAL_LT_DIV")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "e0")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)));
1279 ((fun arg_tac -> arg_tac (Arg_term (`infnorm y = e / &2`))) (term_tac (have_gen_tac [](move ["inf_y"]))));
1280 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL INFNORM_2)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "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_then "REAL_ABS_REFL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_LT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ineq")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1281 ((THENL_FIRST) (((use_arg_then "y") (term_tac exists_tac)) THEN (split_tac)) (((((use_arg_then "INFNORM_EQ_0")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "inf_y")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1282 ((THENL_FIRST) (split_tac) (((((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then "y") (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then "yc")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ineq")(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
1283 ((((use_arg_then "in_t")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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));
1284 ((((use_arg_then "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));
1285 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_MUL_AC)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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_then "DIMINDEX_2")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "NORM_LE_INFNORM")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1286 (((((use_arg_then "inf_y")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "real_div")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_ASSOC")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1287 ((((fun arg_tac -> (use_arg_then "REAL_MUL_RID") (fun fst_arg -> (use_arg_then "e") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then "REAL_LT_LMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "e0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))));
1288 (((((fun arg_tac -> (use_arg_then "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_then "REAL_LT_LMUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LT_INV")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (TRY ((arith_tac))));
1289 ((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_then "REAL_POW_2")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "POW_2_SQRT_ABS")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)));
1290 ((((use_arg_then "SQRT_MONO_LT")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac));
1291 ((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))
1292 (at (vec 0) within {y | &0 < y$1 /\ &0 < y$2})`))) (term_tac (have_gen_tac [](move ["lim_ji"]))));
1293 ((((use_arg_then "LIM_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (move ["e"]) THEN (move ["e_gt0"]));
1294 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "pc") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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_then "dist")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "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"])));
1295 ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`min r (d / &2)`))) (term_tac exists_tac)) THEN (((use_arg_then "REAL_LT_MIN")(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN ((use_arg_then "r0") (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1296 (((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"]));
1297 ((fun arg_tac -> arg_tac (Arg_term (`&0 < abs (y$1) /\ &0 < abs (y$2)`))) (term_tac (have_gen_tac [](move ["y0"]))));
1298 ((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (((((use_arg_then "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 ["_"])));
1299 ((((use_arg_then "z_ineq") (disch_tac [])) THEN (clear_assumption "z_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1300 ((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"]))));
1301 ((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)));
1302 ((((use_arg_then "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_then "INFNORM_LE_NORM")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1303 ((fun arg_tac -> (fun arg_tac -> (use_arg_then "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));
1304 (((repeat_tactic 1 9 (((use_arg_then "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"]));
1305 ((((use_arg_then "G_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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_then "real_div")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_ASSOC")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_MUL_RINV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))));
1306 ((((use_arg_then "REAL_ENTIRE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "y0") (disch_tac [])) THEN (clear_assumption "y0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1307 ((((use_arg_then "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 [] [])))));
1308 ((((use_arg_then "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)));
1309 ((((use_arg_then "NORM_TRIANGLE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "NORM_MUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "NORM_BASIS")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))));
1310 ((((use_arg_then "yr") (disch_tac [])) THEN (clear_assumption "yr") THEN ((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1311 ((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))
1312 (at (vec 0) within {y | &0 < y$1 /\ &0 < y$2})`))) (term_tac (have_gen_tac [](move ["lim_ij"]))));
1313 ((((use_arg_then "LIM_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (move ["e"]) THEN (move ["e_gt0"]));
1314 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "pc") (fun fst_arg -> (use_arg_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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_then "dist")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "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"])));
1315 ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`min r (d / &2)`))) (term_tac exists_tac)) THEN (((use_arg_then "REAL_LT_MIN")(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN ((use_arg_then "r0") (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
1316 (((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"]));
1317 ((fun arg_tac -> arg_tac (Arg_term (`&0 < abs (y$1) /\ &0 < abs (y$2)`))) (term_tac (have_gen_tac [](move ["y0"]))));
1318 ((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (((((use_arg_then "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 ["_"])));
1319 ((((use_arg_then "z_ineq") (disch_tac [])) THEN (clear_assumption "z_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1320 ((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"]))));
1321 ((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)));
1322 ((((use_arg_then "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_then "INFNORM_LE_NORM")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1323 ((fun arg_tac -> (fun arg_tac -> (use_arg_then "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));
1324 (((repeat_tactic 1 9 (((use_arg_then "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"]));
1325 ((((use_arg_then "G_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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_then "real_div")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_ASSOC")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_MUL_RINV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))));
1326 ((((use_arg_then "REAL_ENTIRE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "y0") (disch_tac [])) THEN (clear_assumption "y0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1327 ((((use_arg_then "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 [] [])))));
1328 ((((use_arg_then "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)));
1329 ((((use_arg_then "NORM_TRIANGLE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "NORM_MUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "NORM_BASIS")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))));
1330 ((((use_arg_then "yr") (disch_tac [])) THEN (clear_assumption "yr") THEN ((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1331 ((((use_arg_then "LIFT_EQ")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> (use_arg_then "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)));
1332 ((fun arg_tac -> arg_tac (Arg_term (`\y:real^2. lift (G (y$1) (y$2) / (y$1 * y$2))`))) (term_tac exists_tac));
1333 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL TRIVIAL_LIMIT_WITHIN)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "negbK")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "lim0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1335 let m_cell_domain = new_definition `m_cell_domain (x:real^N, z:real^N) (y:real^N) (w:real^N) <=>
1336 !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`;;
1337 let m_bounded_on_int = new_definition `m_bounded_on_int (f:real^N->real) domain f_bounds <=>
1338 !x. x IN interval [domain] ==> interval_arith (f x) f_bounds`;;
1339 let diff2_domain = new_definition `diff2_domain domain f <=>
1340 !x. x IN interval [domain] ==> diff2 f x`;;
1341 let diff2c_domain = new_definition `diff2c_domain domain f <=>
1342 !x. x IN interval [domain] ==> diff2c f x`;;
1344 (* Lemma diff2c_domain_alt *)
1345 let diff2c_domain_alt = section_proof ["f";"domain"]
1346 `diff2c_domain domain f <=> diff2_domain domain f /\
1347 (!x. x IN interval [domain] ==> !i j. (lift o partial2 j i f) continuous at x)`
1349 (((((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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"]))]));
1350 (((split_tac) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "h1") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (simp_tac)) THEN (done_tac));
1351 ((((fun arg_tac -> (use_arg_then "h1") (fun fst_arg -> (use_arg_then "h3") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then "h2") (fun fst_arg -> (use_arg_then "h3") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac));
1354 (* Lemma y_in_domain *)
1355 let y_in_domain = section_proof ["domain";"y";"w"]
1356 `m_cell_domain domain y w ==> y IN interval [domain]`
1358 ((((use_arg_then "domain") (disch_tac [])) THEN (clear_assumption "domain") THEN case THEN (move ["x"]) THEN (move ["z"])) THEN (((((use_arg_then "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_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (move ["ineqs"]) THEN (move ["i"])));
1359 (((DISCH_THEN (fun snd_th -> (use_arg_then "ineqs") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac));
1362 (* Lemma domain_width *)
1363 let domain_width = section_proof ["p";"domain";"y";"w"]
1364 `m_cell_domain domain y (w:real^N) ==>
1365 p IN interval [domain] ==>
1366 !i. i IN 1..dimindex (:N) ==> abs (p$i - y$i) <= w$i`
1368 ((((use_arg_then "domain") (disch_tac [])) THEN (clear_assumption "domain") THEN case THEN (move ["x"]) THEN (move ["z"])) THEN ((((use_arg_then "m_cell_domain")(thm_tac (new_rewrite [] [])))) THEN (move ["ineqs"]) THEN (move ["p_in"]) THEN (move ["i"]) THEN (move ["i_in"])));
1369 ((((fun arg_tac -> (use_arg_then "ineqs") (fun fst_arg -> (use_arg_then "i_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then "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_then "IN_NUMSEG")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "i_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (arith_tac) THEN (done_tac));
1372 (* Lemma sum_swap1 *)
1373 let sum_swap1 = section_proof ["g";"n"]
1374 `sum (1..n) (\i. sum (i + 1..n) (\j. g i j)) =
1375 sum (1..n) (\i. sum (1..i - 1) (\j. g j i))`
1377 ((repeat_tactic 1 9 (((use_arg_then "SUM_SUM_PRODUCT")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))));
1378 ((fun arg_tac -> arg_tac (Arg_term (`{i, j | (1 <= i /\ i <= n) /\ i + 1 <= j /\ j <= n}`))) (term_tac (set_tac "s1")));
1379 ((fun arg_tac -> arg_tac (Arg_term (`{i, j | (1 <= i /\ i <= n) /\ 1 <= j /\ j <= i - 1}`))) (term_tac (set_tac "s2")));
1380 ((fun arg_tac -> arg_tac (Arg_term (`\(i,j):num#num. j, i`))) (term_tac (set_tac "f")));
1381 ((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 [] [])))))));
1382 ((((((use_arg_then "s1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "s2_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "f_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "EXTENSION")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["p"])) THEN (split_tac));
1383 (BETA_TAC THEN (case THEN (move ["i"])) THEN (case THEN (move ["j"])) THEN (case THEN (move ["ineq"])) THEN (move ["p_eq"]));
1384 (((fun arg_tac -> arg_tac (Arg_term (`j, i`))) (term_tac exists_tac)) THEN ((((use_arg_then "p_eq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then "j") (term_tac exists_tac)) THEN ((use_arg_then "i") (term_tac exists_tac))) THEN (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1385 (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"]));
1386 ((((use_arg_then "j") (term_tac exists_tac)) THEN ((use_arg_then "i") (term_tac exists_tac))) THEN ((((use_arg_then "p_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "p1_eq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1387 ((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 [] [])))))));
1388 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN case THEN (done_tac));
1389 (((use_arg_then "SUM_IMAGE") (thm_tac apply_tac)) THEN (case THEN (move ["i1"]) THEN (move ["j1"])) THEN (case THEN (move ["i2"]) THEN (move ["j2"])));
1390 ((((((use_arg_then "f_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "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));
1393 (* Lemma m_taylor_error_eq *)
1394 let m_taylor_error_eq = section_proof ["f";"domain";"w";"error"]
1395 `diff2c_domain domain f ==>
1396 (m_taylor_error f domain (w:real^N) error <=>
1397 (!x. x IN interval [domain] ==>
1398 sum (1..dimindex (:N)) (\i. w$i * (w$i * abs (partial2 i i f x)
1399 + &2 * sum (1..i - 1) (\j. w$j * abs (partial2 j i f x)))) <= error))`
1401 (((((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "m_taylor_error")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]));
1402 ((fun arg_tac -> arg_tac (Arg_term (`!g1 g2. (!x. x IN interval [domain] ==> g1 x = g2 x) ==>
1403 ((!x. x IN interval [domain] ==> g1 x <= error) <=> (!x. x IN interval [domain] ==> g2 x <= error))`))) (term_tac (have_gen_tac [](move ["eq"]))));
1404 ((BETA_TAC THEN (move ["g1"]) THEN (move ["g2"]) THEN (move ["eq"])) THEN ((split_tac) THEN (move ["cond"]) THEN (move ["x"]) THEN (move ["Px"])));
1405 (((((use_arg_then "eq")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "cond")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1406 (((((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "cond")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1407 (((use_arg_then "eq") (disch_tac [])) THEN (clear_assumption "eq") THEN (DISCH_THEN apply_tac) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "d2f") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["d2fx"]));
1408 ((fun arg_tac -> arg_tac (Arg_term (`\i j. w$i * w$j * abs (partial2 j i f x)`))) (term_tac (set_tac "g")));
1409 ((fun arg_tac -> arg_tac (Arg_term (`dimindex (:N)`))) (term_tac (set_tac "n")));
1410 ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s1")));
1411 ((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"]))));
1412 ((((use_arg_then "s1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (move ["i"]) THEN (simp_tac) THEN (move ["i_in"])));
1413 (((((use_arg_then "SUM_LMUL")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial2")(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (done_tac));
1414 ((((use_arg_then "REAL_MUL_2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_ADD_LDISTRIB")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_LMUL")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_ADD_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_ADD_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
1415 ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s2")));
1416 ((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_then "s2_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)));
1417 ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s3")));
1418 ((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_then "s3_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)));
1419 (((use_arg_then "s3_def") (disch_tac [])) THEN (clear_assumption "s3_def") THEN ((use_arg_then "s2_def") (disch_tac [])) THEN (clear_assumption "s2_def") THEN ((use_arg_then "s1_def") (disch_tac [])) THEN (clear_assumption "s1_def") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]));
1420 (((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 [] []))))))));
1421 (((((use_arg_then "s2_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_ADD_NUMSEG")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "s1_eq")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (move ["i"]) THEN (simp_tac)) THEN ((((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (move ["i_ineq"])));
1422 (((((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_then "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_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
1423 ((THENL_FIRST) ((((use_arg_then "SUM_COMBINE_R")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "i_ineq")(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac)));
1424 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_ADD_AC)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_COMBINE_L")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then "i_ineq") (disch_tac [])) THEN (clear_assumption "i_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
1425 (((((use_arg_then "s3_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "sum_swap1")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (move ["i"]) THEN (move ["_"]) THEN (simp_tac)) THEN (((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (move ["j"]) THEN (move ["_"]) THEN (simp_tac)));
1426 (((((use_arg_then "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_then "REAL_EQ_MUL_LCANCEL")(thm_tac (new_rewrite [] [])))))) THEN (DISJ2_TAC) THEN (DISJ2_TAC));
1427 ((((use_arg_then "mixed_second_partials")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1430 (* Lemma diff2_derivative2_bound *)
1431 let diff2_derivative2_bound = section_proof ["domain";"y";"w";"p";"f";"dd_bound"]
1432 `m_cell_domain domain y (w:real^N) ==>
1433 p IN interval [domain] ==>
1434 diff2_domain domain f ==>
1435 m_taylor_error f domain w dd_bound ==>
1436 (!t. interval_arith t (&0, &1) ==>
1437 abs (nth_derivative 2 (f o (\t. y + t % (p - y))) t) <= dd_bound)`
1439 (((((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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"]));
1440 ((fun arg_tac -> arg_tac (Arg_term (`y + t % (p - y) IN interval [domain]`))) (term_tac (have_gen_tac [](move ["pt_in"]))));
1441 ((((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_then "IN_CONVEX_SET")(thm_tac (new_rewrite [] [])))));
1442 (((((fun arg_tac -> (use_arg_then "y_in_domain") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "p_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "t_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "CONVEX_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1443 ((((use_arg_then "diff2_dir_derivative2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
1444 (((((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((fun arg_tac -> (use_arg_then "boundedH") (fun fst_arg -> (use_arg_then "pt_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC));
1445 (((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"])));
1446 ((((use_arg_then "REAL_LE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then "s1") (term_tac exists_tac)) THEN ((((use_arg_then "i1")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "s1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "s2_def")(gsym_then (thm_tac (new_rewrite [] [])))))));
1447 (((((use_arg_then "SUM_ABS_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac));
1448 (((((use_arg_then "SUM_LMUL")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_ABS_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["j_ineq"]) THEN (simp_tac));
1449 (((repeat_tactic 1 9 (((use_arg_then "REAL_ABS_MUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_LE_MUL2")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LE_MUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_ABS_POS")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "domain_width") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1452 (* Lemma m_taylor_error_lemma *)
1453 let m_taylor_error_lemma = section_proof ["domain";"y";"w";"p";"f";"dd_bound"]
1454 `m_cell_domain domain y (w:real^N) ==>
1455 p IN interval [domain] ==>
1456 diff2_domain domain f ==>
1457 m_taylor_error f domain w dd_bound ==>
1458 abs (f p - (f y + sum (1..dimindex (:N)) (\i. (p - y)$i * partial i f y))) <= dd_bound / &2`
1460 ((((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (BETA_TAC THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["taylor_error"])));
1461 ((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"]))));
1462 ((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_then "IN_CONVEX_SET")(thm_tac (new_rewrite [] []))))));
1463 (((((fun arg_tac -> (use_arg_then "y_in_domain") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "p_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "t_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "CONVEX_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1464 (((fun arg_tac -> (fun arg_tac -> (use_arg_then "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_then "dd_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
1465 ((THENL_FIRST) (ANTS_TAC) (((((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] [])))) THEN (move ["t"]) THEN (move ["t_in"])) THEN ((((use_arg_then "diff2_dir")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "pt_in")(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
1466 ((THENL_FIRST) (ANTS_TAC) ((((fun arg_tac -> (use_arg_then "diff2_derivative2_bound") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
1467 ((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_ADD2)))(thm_tac (new_rewrite [] [])))));
1468 ((THENL_FIRST) ((((use_arg_then "diff2_dir_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "pt_in")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac)));
1469 (((((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1472 (* Lemma m_taylor_upper_bound *)
1473 let m_taylor_upper_bound = section_proof ["domain";"y";"w";"f";"dd_bound";"hi";"hi_bound"]
1474 `m_cell_domain domain y (w:real^N) ==>
1475 diff2_domain domain f ==>
1476 m_taylor_error f domain w dd_bound ==>
1478 hi + sum(1..dimindex (:N)) (\i. w$i * abs (partial i f y)) + dd_bound / &2 <= hi_bound ==>
1479 !p. p IN interval [domain] ==> f p <= hi_bound`
1481 (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"]));
1482 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_error_lemma") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "p_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
1483 ((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);
1484 (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s"))) THEN (move ["ineq"]));
1485 ((((use_arg_then "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_then "ineq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))));
1486 (((use_arg_then "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));
1487 ((((use_arg_then "REAL_ADD_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_RADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_ADD2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_bound")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))));
1488 ((((use_arg_then "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_then "REAL_ABS_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))));
1489 (((((use_arg_then "s_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_ABS_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac));
1490 (((((use_arg_then "REAL_ABS_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_MUL2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_ABS_POS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "domain_width") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1493 (* Lemma m_taylor_lower_bound *)
1494 let m_taylor_lower_bound = section_proof ["domain";"y";"w";"f";"dd_bound";"lo";"lo_bound"]
1495 `m_cell_domain domain y (w:real^N) ==>
1496 diff2_domain domain f ==>
1497 m_taylor_error f domain w dd_bound ==>
1499 lo_bound <= lo - (sum(1..dimindex (:N)) (\i. w$i * abs (partial i f y)) + dd_bound / &2) ==>
1500 !p. p IN interval [domain] ==> lo_bound <= f p`
1502 (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"]));
1503 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_error_lemma") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "p_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
1504 ((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);
1505 (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s"))) THEN (move ["ineq"]));
1506 ((((use_arg_then "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_then "ineq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))));
1507 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then "total_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
1508 ((repeat_tactic 1 9 (((use_arg_then "real_sub")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_NEG_ADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ADD_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_RADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_ADD2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_bound")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))));
1509 ((THENL_LAST) ((((use_arg_then "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_then "REAL_LE_NEG")(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((arith_tac) THEN (done_tac)));
1510 (((((use_arg_then "s_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_ABS_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac));
1511 (((((use_arg_then "REAL_ABS_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_MUL2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_ABS_POS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "domain_width") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1514 (* Lemma m_taylor_bounds *)
1515 let m_taylor_bounds = section_proof ["domain";"y";"w";"f";"dd_bound";"lo";"hi";"err_bound";"lo_bound";"hi_bound"]
1516 `m_cell_domain domain y (w:real^N) ==>
1517 diff2_domain domain f ==>
1518 m_taylor_error f domain w dd_bound ==>
1519 interval_arith (f y) (lo, hi) ==>
1520 sum(1..dimindex (:N)) (\i. w$i * abs(partial i f y)) + dd_bound / &2 <= err_bound ==>
1521 lo_bound <= lo - err_bound ==>
1522 hi + err_bound <= hi_bound ==>
1523 m_bounded_on_int f domain (lo_bound, hi_bound)`
1525 (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "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"]));
1526 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_lower_bound") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f_lo") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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 [] [])))));
1527 (((((use_arg_then "p_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "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)));
1528 (((((use_arg_then "lo_ineq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "real_sub")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_ADD2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_NEG")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1529 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_upper_bound") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f_hi") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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)));
1530 (((((use_arg_then "p_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "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)));
1531 (((((use_arg_then "hi_ineq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_LADD")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1534 (* Lemma diff2_derivative_partial_bound *)
1535 let diff2_derivative_partial_bound = section_proof ["domain";"y";"w";"p";"f";"i";"d_bound"]
1536 `m_cell_domain domain y (w:real^N) ==>
1537 p IN interval [domain] ==>
1538 diff2_domain domain f ==>
1539 m_taylor_partial_error f i domain w d_bound ==>
1540 (!t. interval_arith t (&0, &1) ==>
1541 abs (derivative (partial i f o (\t. y + t % (p - y))) t) <= d_bound)`
1543 (((((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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"]));
1544 ((fun arg_tac -> arg_tac (Arg_term (`y + t % (p - y) IN interval [domain]`))) (term_tac (have_gen_tac [](move ["pt_in"]))));
1545 ((((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_then "IN_CONVEX_SET")(thm_tac (new_rewrite [] [])))));
1546 (((((fun arg_tac -> (use_arg_then "y_in_domain") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "p_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "t_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "CONVEX_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1547 ((((use_arg_then "diff2_derivative_partial")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
1548 (((fun arg_tac -> (use_arg_then "boundedH") (fun fst_arg -> (use_arg_then "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));
1549 (((((use_arg_then "SUM_ABS_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["j_ineq"]) THEN (simp_tac));
1550 ((((use_arg_then "REAL_ABS_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "REAL_LE_MUL2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_ABS_POS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] [])))));
1551 ((((fun arg_tac -> (use_arg_then "domain_width") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1554 (* Lemma m_taylor_partial_error_lemma *)
1555 let m_taylor_partial_error_lemma = section_proof ["domain";"y";"w";"p";"f";"i";"dd_bound"]
1556 `m_cell_domain domain y (w:real^N) ==>
1557 p IN interval [domain] ==>
1558 diff2_domain domain f ==>
1559 m_taylor_partial_error f i domain w dd_bound ==>
1560 abs (partial i f p - partial i f y) <= dd_bound`
1562 ((((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (BETA_TAC THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["partial_error"])));
1563 ((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"]))));
1564 ((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_then "IN_CONVEX_SET")(thm_tac (new_rewrite [] []))))));
1565 (((((fun arg_tac -> (use_arg_then "y_in_domain") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "p_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "t_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "CONVEX_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1566 (((fun arg_tac -> (fun arg_tac -> (use_arg_then "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_then "dd_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
1568 ((BETA_TAC THEN (move ["t"]) THEN (move ["t_in"])) THEN ((((use_arg_then "diff2_real_diff_partial")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "pt_in")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then "diff2_derivative_partial_bound") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
1569 ((((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1570 (((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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));
1573 (* Lemma m_taylor_upper_partial_bound *)
1574 let m_taylor_upper_partial_bound = section_proof ["domain";"y";"w";"f";"i";"dd_bound";"hi";"hi_bound"]
1575 `m_cell_domain domain y (w:real^N) ==>
1576 diff2_domain domain f ==>
1577 m_taylor_partial_error f i domain w dd_bound ==>
1578 partial i f y <= hi ==>
1579 hi + dd_bound <= hi_bound ==>
1580 !p. p IN interval [domain] ==> partial i f p <= hi_bound`
1582 (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"]));
1583 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_partial_error_lemma") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "p_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
1584 ((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"]));
1585 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
1586 (((use_arg_then "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));
1587 (((((use_arg_then "REAL_LE_ADD2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1590 (* Lemma m_taylor_lower_partial_bound *)
1591 let m_taylor_lower_partial_bound = section_proof ["domain";"y";"w";"f";"i";"dd_bound";"lo";"lo_bound"]
1592 `m_cell_domain domain y (w:real^N) ==>
1593 diff2_domain domain f ==>
1594 m_taylor_partial_error f i domain w dd_bound ==>
1595 lo <= partial i f y ==>
1596 lo_bound <= lo - dd_bound ==>
1597 !p. p IN interval [domain] ==> lo_bound <= partial i f p`
1599 (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"]));
1600 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_partial_error_lemma") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "p_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
1601 ((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"]));
1602 (((use_arg_then "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));
1603 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then "total_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
1604 (((repeat_tactic 1 9 (((use_arg_then "real_sub")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_ADD2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1607 (* Lemma m_taylor_partial_bounds *)
1608 let m_taylor_partial_bounds = section_proof ["domain";"y";"w";"f";"i";"dd_bound";"lo";"hi";"lo_bound";"hi_bound"]
1609 `m_cell_domain domain y (w:real^N) ==>
1610 diff2_domain domain f ==>
1611 m_taylor_partial_error f i domain w dd_bound ==>
1612 interval_arith (partial i f y) (lo, hi) ==>
1613 lo_bound <= lo - dd_bound ==>
1614 hi + dd_bound <= hi_bound ==>
1615 m_bounded_on_int (partial i f) domain (lo_bound, hi_bound)`
1617 (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "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"]));
1618 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_lower_partial_bound") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df_lo") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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)));
1619 ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_upper_partial_bound") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df_hi") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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));
1622 (* Finalization of the section Taylor *)
1623 let real_taylor2_bound = finalize_theorem real_taylor2_bound;;
1624 let real_taylor1_bound = finalize_theorem real_taylor1_bound;;
1625 let taylor_error_eq_sum_partial_errors = finalize_theorem taylor_error_eq_sum_partial_errors;;
1626 let diff2c_imp_diff2 = finalize_theorem diff2c_imp_diff2;;
1627 let diff2_eq_diff2_on_open = finalize_theorem diff2_eq_diff2_on_open;;
1628 let diff2_imp_real_diff = finalize_theorem diff2_imp_real_diff;;
1629 let diff2_dir_derivative = finalize_theorem diff2_dir_derivative;;
1630 let diff2_partial_real_diff = finalize_theorem diff2_partial_real_diff;;
1631 let in_trans = finalize_theorem in_trans;;
1632 let open_contains_open_interval = finalize_theorem open_contains_open_interval;;
1633 let diff2_dir = finalize_theorem diff2_dir;;
1634 let diff2_dir_derivative2 = finalize_theorem diff2_dir_derivative2;;
1635 let diff2_has_derivative_partial = finalize_theorem diff2_has_derivative_partial;;
1636 let diff2_derivative_partial = finalize_theorem diff2_derivative_partial;;
1637 let diff2_real_diff_partial = finalize_theorem diff2_real_diff_partial;;
1638 let partial_const = finalize_theorem partial_const;;
1639 let partial_eq0_alt = finalize_theorem partial_eq0_alt;;
1640 let real_mvt0 = finalize_theorem real_mvt0;;
1641 let mixed_second_partials = finalize_theorem mixed_second_partials;;
1642 let diff2c_domain_alt = finalize_theorem diff2c_domain_alt;;
1643 let y_in_domain = finalize_theorem y_in_domain;;
1644 let domain_width = finalize_theorem domain_width;;
1645 let sum_swap1 = finalize_theorem sum_swap1;;
1646 let m_taylor_error_eq = finalize_theorem m_taylor_error_eq;;
1647 let diff2_derivative2_bound = finalize_theorem diff2_derivative2_bound;;
1648 let m_taylor_error_lemma = finalize_theorem m_taylor_error_lemma;;
1649 let m_taylor_upper_bound = finalize_theorem m_taylor_upper_bound;;
1650 let m_taylor_lower_bound = finalize_theorem m_taylor_lower_bound;;
1651 let m_taylor_bounds = finalize_theorem m_taylor_bounds;;
1652 let diff2_derivative_partial_bound = finalize_theorem diff2_derivative_partial_bound;;
1653 let m_taylor_partial_error_lemma = finalize_theorem m_taylor_partial_error_lemma;;
1654 let m_taylor_upper_partial_bound = finalize_theorem m_taylor_upper_partial_bound;;
1655 let m_taylor_lower_partial_bound = finalize_theorem m_taylor_lower_partial_bound;;
1656 let m_taylor_partial_bounds = finalize_theorem m_taylor_partial_bounds;;
1657 end_section "Taylor";;
1659 (* Section Diff2Arith *)
1660 begin_section "Diff2Arith";;
1661 (add_section_var (mk_var ("f", (`:real^N -> real`))); add_section_var (mk_var ("g", (`:real^N -> real`))));;
1662 (add_section_var (mk_var ("x", (`:real^N`))));;
1663 (add_section_var (mk_var ("domain", (`:real^N#real^N`))));;
1665 (* Lemma differentiable_local_at *)
1666 let differentiable_local_at = section_proof ["s";"f";"g";"x"]
1667 `f differentiable at x ==> open s ==> x IN s ==> (!y. y IN s ==> g y = f y) ==>
1668 g differentiable at x`
1670 ((((use_arg_then "OPEN_CONTAINS_BALL")(thm_tac (new_rewrite [] [])))) THEN (move ["df"]) THEN (move ["open_s"]) THEN (move ["xs"]) THEN (move ["eq"]));
1671 ((((fun arg_tac -> (use_arg_then "open_s") (fun fst_arg -> (use_arg_then "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_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_BALL")(thm_tac (new_rewrite [] []))))) THEN (move ["in_ball"])));
1672 ((((fun arg_tac -> (use_arg_then "DIFFERENTIABLE_TRANSFORM_AT") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))));
1673 (((use_arg_then "d") (term_tac exists_tac)) THEN (((((use_arg_then "d0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["z"]) THEN (move ["dzx"])) THEN ((((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "in_ball")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIST_SYM")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1677 begin_section "Point";;
1679 (* Lemma diff2_scale *)
1680 let diff2_scale = section_proof ["f";"c"]
1681 `diff2 f x ==> diff2 (\x. c * f x) x`
1683 ((repeat_tactic 1 9 (((use_arg_then "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"]));
1684 (((use_arg_then "s") (term_tac exists_tac)) THEN (((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (move ["zs"])));
1685 ((THENL_FIRST) ((((use_arg_then "f_lift_scale")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CMUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
1686 ((BETA_TAC THEN (move ["i"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then "differentiable_local_at") (fun fst_arg -> (use_arg_then "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)));
1687 ((THENL_FIRST) ((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "zs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_scale")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CMUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
1688 ((BETA_TAC THEN (move ["y"]) THEN (move ["ys"])) THEN ((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial_scale")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "LIFT_CMUL")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1691 (* Lemma diff2_neg *)
1692 let diff2_neg = section_proof ["f"]
1693 `diff2 f x ==> diff2 (\x. --f x) x`
1695 (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "diff2_scale") (fun fst_arg -> (use_arg_then "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_then "REAL_NEG_MINUS1")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac));
1698 (* Section Composite *)
1699 begin_section "Composite";;
1701 (* Lemma has_derivative_uni_compose *)
1702 let has_derivative_uni_compose = section_proof ["u";"f";"u'";"f'";"x"]
1703 `(lift o f has_derivative f') (at x) ==>
1704 (u has_real_derivative u') (atreal (f x)) ==>
1705 (lift o u o f has_derivative (\x. u' % f' x)) (at x)`
1707 (BETA_TAC THEN (move ["df"]) THEN (move ["du"]));
1708 ((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 [] [])))))));
1709 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1710 ((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_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)));
1711 (((((use_arg_then "DIFF_CHAIN_AT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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));
1714 (* Lemma diff_uni_compose *)
1715 let diff_uni_compose = section_proof ["u";"f";"x"]
1716 `lift o f differentiable at x ==>
1717 u real_differentiable atreal (f x) ==>
1718 lift o u o f differentiable at x`
1720 (((repeat_tactic 1 9 (((use_arg_then "differentiable")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "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"]));
1721 (((fun arg_tac -> arg_tac (Arg_term (`\x. u' % f' x`))) (term_tac exists_tac)) THEN ((use_arg_then "has_derivative_uni_compose") (thm_tac apply_tac)) THEN (done_tac));
1724 (* Lemma diff2_uni_compose *)
1725 let diff2_uni_compose = section_proof ["u";"f"]
1726 `diff2 f x ==> nth_diff_strong 2 u (f x) ==> diff2 (u o f) x`
1728 (((repeat_tactic 1 9 (((use_arg_then "diff2")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "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"]));
1729 ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN s /\ (lift o f) z IN (IMAGE lift t)}`))) (term_tac (set_tac "r")));
1730 ((fun arg_tac -> arg_tac (Arg_term (`open r`))) (term_tac (have_gen_tac [](move ["open_r"]))));
1731 ((((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "CONTINUOUS_OPEN_PREIMAGE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_OPEN")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "open_t")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))));
1732 (((use_arg_then "DIFFERENTIABLE_IMP_CONTINUOUS_ON") (thm_tac apply_tac)) THEN ((((use_arg_then "differentiable_on")(thm_tac (new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["ys"])) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
1733 (((((use_arg_then "DIFFERENTIABLE_AT_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1734 ((THENL_FIRST) (((use_arg_then "r") (term_tac exists_tac)) THEN ((((use_arg_then "open_r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "LIFT_IN_IMAGE_LIFT")(thm_tac (new_rewrite [] []))))) THEN (split_tac)) (((use_arg_then "x") (term_tac exists_tac)) THEN (done_tac)));
1735 (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 [] [])))));
1736 (((((use_arg_then "diff_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "du")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]));
1737 (((use_arg_then "differentiable_local_at") (thm_tac apply_tac)) THEN (((use_arg_then "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))));
1738 ((((use_arg_then "open_r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "differentiable_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))));
1739 ((((fun arg_tac -> (use_arg_then "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_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then "diff_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "du")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1740 ((THENL_FIRST) (((((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_IN_IMAGE_LIFT")(thm_tac (new_rewrite [] [])))))) THEN (split_tac)) (((use_arg_then "z") (term_tac exists_tac)) THEN (done_tac)));
1741 (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 [] [])))));
1742 (((((use_arg_then "partial_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "du")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1745 (* Lemma diff2_inv_compose *)
1746 let diff2_inv_compose = section_proof []
1747 `~(f x = &0) ==> diff2 f x ==> diff2 (inv o f) x`
1749 ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then "diff2_inv") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then "diff2_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1752 (* Lemma diff2_sqrt_compose *)
1753 let diff2_sqrt_compose = section_proof []
1754 `&0 < f x ==> diff2 f x ==> diff2 (sqrt o f) x`
1756 ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then "diff2_sqrt") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then "diff2_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1759 (* Lemma diff2_atn_compose *)
1760 let diff2_atn_compose = section_proof []
1761 `diff2 f x ==> diff2 (atn o f) x`
1763 ((BETA_TAC THEN (move ["df"])) THEN ((((use_arg_then "diff2_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_atn")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1766 (* Lemma diff2_acs_compose *)
1767 let diff2_acs_compose = section_proof []
1768 `abs (f x) < &1 ==> diff2 f x ==> diff2 (acs o f) x`
1770 ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then "diff2_acs") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then "diff2_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1773 (* Finalization of the section Composite *)
1774 let has_derivative_uni_compose = finalize_theorem has_derivative_uni_compose;;
1775 let diff_uni_compose = finalize_theorem diff_uni_compose;;
1776 let diff2_uni_compose = finalize_theorem diff2_uni_compose;;
1777 let diff2_inv_compose = finalize_theorem diff2_inv_compose;;
1778 let diff2_sqrt_compose = finalize_theorem diff2_sqrt_compose;;
1779 let diff2_atn_compose = finalize_theorem diff2_atn_compose;;
1780 let diff2_acs_compose = finalize_theorem diff2_acs_compose;;
1781 end_section "Composite";;
1783 (* Lemma diff2_add *)
1784 let diff2_add = section_proof ["f";"g"]
1785 `diff2 f x ==> diff2 g x ==> diff2 (\x. f x + g x) x`
1787 ((repeat_tactic 1 9 (((use_arg_then "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"]));
1788 (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN (((((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ys")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"])))));
1789 ((((use_arg_then "f_lift_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))));
1790 ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1791 ((BETA_TAC THEN (move ["i"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then "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)));
1792 ((((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "zt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "zs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))));
1793 ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1794 ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial_add")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "LIFT_ADD")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1797 (* Lemma diff2_sub *)
1798 let diff2_sub = section_proof ["f";"g"]
1799 `diff2 f x ==> diff2 g x ==> diff2 (\x. f x - g x) x`
1801 ((BETA_TAC THEN (move ["d2f"]) THEN (move ["d2g"])) THEN ((((use_arg_then "real_sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_add")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "diff2_neg")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1804 (* Lemma diff2_mul *)
1805 let diff2_mul = section_proof ["f";"g"]
1806 `diff2 f x ==> diff2 g x ==> diff2 (\x. f x * g x) x`
1808 ((repeat_tactic 1 9 (((use_arg_then "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"]));
1809 (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN (((((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ys")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"])))));
1810 (((((use_arg_then "differentiable_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]));
1811 (((fun arg_tac -> (fun arg_tac -> (use_arg_then "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));
1812 ((((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "zt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "zs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))));
1813 ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 1 9 (((use_arg_then "differentiable_mul")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1814 ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "LIFT_ADD")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1817 (* Finalization of the section Point *)
1818 let diff2_scale = finalize_theorem diff2_scale;;
1819 let diff2_neg = finalize_theorem diff2_neg;;
1820 let has_derivative_uni_compose = finalize_theorem has_derivative_uni_compose;;
1821 let diff_uni_compose = finalize_theorem diff_uni_compose;;
1822 let diff2_uni_compose = finalize_theorem diff2_uni_compose;;
1823 let diff2_inv_compose = finalize_theorem diff2_inv_compose;;
1824 let diff2_sqrt_compose = finalize_theorem diff2_sqrt_compose;;
1825 let diff2_atn_compose = finalize_theorem diff2_atn_compose;;
1826 let diff2_acs_compose = finalize_theorem diff2_acs_compose;;
1827 let diff2_add = finalize_theorem diff2_add;;
1828 let diff2_sub = finalize_theorem diff2_sub;;
1829 let diff2_mul = finalize_theorem diff2_mul;;
1830 end_section "Point";;
1832 (* Section Domain *)
1833 begin_section "Domain";;
1834 (add_section_hyp "d2f" (`diff2_domain domain f`));;
1836 (* Lemma diff2_domain_scale *)
1837 let diff2_domain_scale = section_proof ["c"]
1838 `diff2_domain domain (\x. c * f x)`
1840 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2_scale")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1843 (* Lemma diff2_domain_neg *)
1844 let diff2_domain_neg = section_proof []
1845 `diff2_domain domain (\x. --f x)`
1847 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2_neg")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1849 (add_section_var (mk_var ("bounds", (`:real#real`))));;
1851 (* Lemma diff2_domain_inv_compose *)
1852 let diff2_domain_inv_compose = section_proof []
1853 `m_bounded_on_int f domain bounds ==>
1854 interval_not_zero bounds ==> diff2_domain domain (inv o f)`
1856 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
1857 (((((use_arg_then "diff2_inv_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "interval_arith_not_zero") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "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));
1860 (* Lemma diff2_domain_sqrt_compose *)
1861 let diff2_domain_sqrt_compose = section_proof []
1862 `m_bounded_on_int f domain bounds ==>
1863 interval_pos bounds ==> diff2_domain domain (sqrt o f)`
1865 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
1866 (((((use_arg_then "diff2_sqrt_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "interval_arith_pos") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "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));
1869 (* Lemma diff2_domain_atn_compose *)
1870 let diff2_domain_atn_compose = section_proof []
1871 `diff2_domain domain (atn o f)`
1873 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2_atn_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1876 (* Lemma diff2_domain_acs_compose *)
1877 let diff2_domain_acs_compose = section_proof []
1878 `m_bounded_on_int f domain bounds ==>
1879 iabs bounds < &1 ==> diff2_domain domain (acs o f)`
1881 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
1882 (((((use_arg_then "diff2_acs_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "interval_arith_abs") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "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));
1884 (add_section_hyp "d2g" (`diff2_domain domain g`));;
1886 (* Lemma diff2_domain_add *)
1887 let diff2_domain_add = section_proof []
1888 `diff2_domain domain (\x. f x + g x)`
1890 ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1893 (* Lemma diff2_domain_sub *)
1894 let diff2_domain_sub = section_proof []
1895 `diff2_domain domain (\x. f x - g x)`
1897 ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2_sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1900 (* Lemma diff2_domain_mul *)
1901 let diff2_domain_mul = section_proof []
1902 `diff2_domain domain (\x. f x * g x)`
1904 ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2_mul")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1907 (* Finalization of the section Domain *)
1908 let diff2_domain_scale = finalize_theorem diff2_domain_scale;;
1909 let diff2_domain_neg = finalize_theorem diff2_domain_neg;;
1910 let diff2_domain_inv_compose = finalize_theorem diff2_domain_inv_compose;;
1911 let diff2_domain_sqrt_compose = finalize_theorem diff2_domain_sqrt_compose;;
1912 let diff2_domain_atn_compose = finalize_theorem diff2_domain_atn_compose;;
1913 let diff2_domain_acs_compose = finalize_theorem diff2_domain_acs_compose;;
1914 let diff2_domain_add = finalize_theorem diff2_domain_add;;
1915 let diff2_domain_sub = finalize_theorem diff2_domain_sub;;
1916 let diff2_domain_mul = finalize_theorem diff2_domain_mul;;
1917 end_section "Domain";;
1919 (* Section SecondPartial *)
1920 begin_section "SecondPartial";;
1922 (* Lemma diff2_imp_diff *)
1923 let diff2_imp_diff = section_proof ["f";"x"]
1924 `diff2 f x ==> (lift o f) differentiable at x`
1926 (((((use_arg_then "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));
1929 (* Lemma diff2_imp_partial_diff *)
1930 let diff2_imp_partial_diff = section_proof ["f";"i";"x"]
1931 `diff2 f x ==> (lift o partial i f) differentiable at x`
1933 (((((use_arg_then "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));
1936 (* Lemma partial_local *)
1937 let partial_local = section_proof ["s";"f";"g";"i";"x"]
1938 `(lift o f) differentiable at x ==>
1939 open s ==> x IN s ==> (!y:real^N. y IN s ==> f y = g y) ==>
1940 partial i f x = partial i g x`
1942 ((BETA_TAC THEN (move ["df"]) THEN (move ["open_s"]) THEN (move ["xs"]) THEN (move ["eq"])) THEN (repeat_tactic 1 9 (((use_arg_then "partial")(thm_tac (new_rewrite [] []))))));
1943 ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)));
1944 (((fun arg_tac -> arg_tac (Arg_term (`g o (\t. x + t % basis i)`))) (term_tac exists_tac)) THEN (split_tac));
1945 ((((use_arg_then "has_derivative_alt") (disch_tac [])) THEN (clear_assumption "has_derivative_alt") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then "diff_imp_real_diff") (thm_tac apply_tac)) THEN ((((use_arg_then "diff_direction")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))));
1946 ((fun arg_tac -> (fun arg_tac -> (use_arg_then "differentiable_local_at") (fun fst_arg -> (use_arg_then "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));
1947 (((simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["ys"]));
1948 (((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
1949 ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "open_contains_open_interval") (fun fst_arg -> (use_arg_then "open_s") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (move ["sub"])));
1950 (((fun arg_tac -> arg_tac (Arg_term (`real_interval (a, b)`))) (term_tac exists_tac)) THEN (((((use_arg_then "ab0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["y_in"])));
1951 (((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then "y") (term_tac exists_tac)) THEN (done_tac));
1953 (add_section_var (mk_var ("i", (`:num`))); add_section_var (mk_var ("j", (`:num`))));;
1955 (* Lemma second_partial_scale *)
1956 let second_partial_scale = section_proof ["f";"c"]
1957 `diff2 f x ==> partial2 i j (\x. c * f x) x = c * partial2 i j f x`
1959 ((BETA_TAC THEN (move ["d2f"])) THEN ((repeat_tactic 1 9 (((use_arg_then "partial2")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial_scale")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "diff2_imp_partial_diff")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] []))))));
1960 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then "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"])));
1961 (((use_arg_then "partial_local") (thm_tac apply_tac)) THEN ((use_arg_then "s") (term_tac exists_tac)) THEN ((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_scale")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CMUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))));
1962 ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
1963 ((BETA_TAC THEN (move ["y"]) THEN (move ["ys"])) THEN ((((use_arg_then "partial_scale")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1966 (* Lemma second_partial_neg *)
1967 let second_partial_neg = section_proof ["f"]
1968 `diff2 f x ==> partial2 i j (\x. --f x) x = --partial2 i j f x`
1970 (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "second_partial_scale") (fun fst_arg -> (use_arg_then "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_then "REAL_NEG_MINUS1")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1973 (* Lemma second_partial_add *)
1974 let second_partial_add = section_proof ["f";"g"]
1975 `diff2 f x ==> diff2 g x ==>
1976 partial2 i j (\x. f x + g x) x = partial2 i j f x + partial2 i j g x`
1978 ((repeat_tactic 1 9 (((use_arg_then "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"]));
1979 (((repeat_tactic 1 9 (((use_arg_then "partial2")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial_add")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "partial_local") (thm_tac apply_tac)));
1980 (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN ((((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ys")(thm_tac (new_rewrite [] []))))));
1981 ((((use_arg_then "f_lift_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))));
1982 ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1983 ((BETA_TAC THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"])))) THEN ((((use_arg_then "partial_add")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1986 (* Lemma second_partial_sub *)
1987 let second_partial_sub = section_proof ["f";"g"]
1988 `diff2 f x ==> diff2 g x ==>
1989 partial2 i j (\x. f x - g x) x = partial2 i j f x - partial2 i j g x`
1991 ((BETA_TAC THEN (move ["d2f"]) THEN (move ["d2g"])) THEN ((((use_arg_then "real_sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "second_partial_add")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "diff2_neg")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "second_partial_neg")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "real_sub")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
1994 (* Lemma second_partial_mul *)
1995 let second_partial_mul = section_proof ["f";"g"]
1996 `diff2 f x ==> diff2 g x ==>
1997 partial2 i j (\x. f x * g x) x = (partial2 i j f x * g x + partial j f x * partial i g x) +
1998 (partial i f x * partial j g x + f x * partial2 i j g x)`
2000 ((repeat_tactic 1 9 (((use_arg_then "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"]));
2001 ((repeat_tactic 1 9 (((use_arg_then "partial2")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "partial_mul")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then "partial_add")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 1 (((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] []))))));
2002 ((repeat_tactic 1 9 (((use_arg_then "differentiable_mul")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2003 ((use_arg_then "partial_local") (thm_tac apply_tac));
2004 (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN ((((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ys")(thm_tac (new_rewrite [] []))))));
2005 ((((use_arg_then "f_lift_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))));
2006 ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 1 9 (((use_arg_then "differentiable_mul")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2007 ((BETA_TAC THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"])))) THEN ((((use_arg_then "partial_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2010 (* Lemma second_partial_uni_compose *)
2011 let second_partial_uni_compose = section_proof ["f";"u"]
2012 `diff2 f x ==> nth_diff_strong 2 u (f x) ==>
2013 partial2 i j (u o f) x = (nth_derivative 2 u (f x) * partial i f x) * partial j f x +
2014 derivative u (f x) * partial2 i j f x`
2016 (((repeat_tactic 1 9 (((use_arg_then "diff2")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "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"]));
2017 ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN s /\ (lift o f) z IN (IMAGE lift t)}`))) (term_tac (set_tac "r")));
2018 ((fun arg_tac -> arg_tac (Arg_term (`open r`))) (term_tac (have_gen_tac [](move ["open_r"]))));
2019 ((((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "CONTINUOUS_OPEN_PREIMAGE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_OPEN")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "open_t")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))));
2020 (((use_arg_then "DIFFERENTIABLE_IMP_CONTINUOUS_ON") (thm_tac apply_tac)) THEN ((((use_arg_then "differentiable_on")(thm_tac (new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["ys"])) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
2021 (((((use_arg_then "DIFFERENTIABLE_AT_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2022 ((repeat_tactic 1 9 (((use_arg_then "partial2")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))));
2023 ((((use_arg_then "partial_uni_compose")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "du")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then "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_then "partial_mul")(gsym_then (thm_tac (new_rewrite [] []))))));
2024 (((((use_arg_then "diff_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "du")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2025 (((use_arg_then "partial_local") (thm_tac apply_tac)) THEN ((use_arg_then "r") (term_tac exists_tac)) THEN ((((use_arg_then "open_r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))));
2026 ((THENL_ROT (-1)) (((((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "LIFT_IN_IMAGE_LIFT")(thm_tac (new_rewrite [] []))))) THEN (split_tac)));
2027 ((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_then "partial_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "du")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2028 ((THENL_LAST) (split_tac) (((use_arg_then "x") (term_tac exists_tac)) THEN (done_tac)));
2029 (((use_arg_then "differentiable_local_at") (thm_tac apply_tac)) THEN (((use_arg_then "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))));
2030 ((((use_arg_then "open_r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "differentiable_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))));
2031 ((((fun arg_tac -> (use_arg_then "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_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then "diff_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "du")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2032 ((THENL_FIRST) (((((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_IN_IMAGE_LIFT")(thm_tac (new_rewrite [] [])))))) THEN (split_tac)) (((use_arg_then "x") (term_tac exists_tac)) THEN (done_tac)));
2033 ((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_then "partial_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "du")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2036 (* Finalization of the section SecondPartial *)
2037 let diff2_imp_diff = finalize_theorem diff2_imp_diff;;
2038 let diff2_imp_partial_diff = finalize_theorem diff2_imp_partial_diff;;
2039 let partial_local = finalize_theorem partial_local;;
2040 let second_partial_scale = finalize_theorem second_partial_scale;;
2041 let second_partial_neg = finalize_theorem second_partial_neg;;
2042 let second_partial_add = finalize_theorem second_partial_add;;
2043 let second_partial_sub = finalize_theorem second_partial_sub;;
2044 let second_partial_mul = finalize_theorem second_partial_mul;;
2045 let second_partial_uni_compose = finalize_theorem second_partial_uni_compose;;
2046 end_section "SecondPartial";;
2048 (* Finalization of the section Diff2Arith *)
2049 let differentiable_local_at = finalize_theorem differentiable_local_at;;
2050 let diff2_scale = finalize_theorem diff2_scale;;
2051 let diff2_neg = finalize_theorem diff2_neg;;
2052 let has_derivative_uni_compose = finalize_theorem has_derivative_uni_compose;;
2053 let diff_uni_compose = finalize_theorem diff_uni_compose;;
2054 let diff2_uni_compose = finalize_theorem diff2_uni_compose;;
2055 let diff2_inv_compose = finalize_theorem diff2_inv_compose;;
2056 let diff2_sqrt_compose = finalize_theorem diff2_sqrt_compose;;
2057 let diff2_atn_compose = finalize_theorem diff2_atn_compose;;
2058 let diff2_acs_compose = finalize_theorem diff2_acs_compose;;
2059 let diff2_add = finalize_theorem diff2_add;;
2060 let diff2_sub = finalize_theorem diff2_sub;;
2061 let diff2_mul = finalize_theorem diff2_mul;;
2062 let diff2_domain_scale = finalize_theorem diff2_domain_scale;;
2063 let diff2_domain_neg = finalize_theorem diff2_domain_neg;;
2064 let diff2_domain_inv_compose = finalize_theorem diff2_domain_inv_compose;;
2065 let diff2_domain_sqrt_compose = finalize_theorem diff2_domain_sqrt_compose;;
2066 let diff2_domain_atn_compose = finalize_theorem diff2_domain_atn_compose;;
2067 let diff2_domain_acs_compose = finalize_theorem diff2_domain_acs_compose;;
2068 let diff2_domain_add = finalize_theorem diff2_domain_add;;
2069 let diff2_domain_sub = finalize_theorem diff2_domain_sub;;
2070 let diff2_domain_mul = finalize_theorem diff2_domain_mul;;
2071 let diff2_imp_diff = finalize_theorem diff2_imp_diff;;
2072 let diff2_imp_partial_diff = finalize_theorem diff2_imp_partial_diff;;
2073 let partial_local = finalize_theorem partial_local;;
2074 let second_partial_scale = finalize_theorem second_partial_scale;;
2075 let second_partial_neg = finalize_theorem second_partial_neg;;
2076 let second_partial_add = finalize_theorem second_partial_add;;
2077 let second_partial_sub = finalize_theorem second_partial_sub;;
2078 let second_partial_mul = finalize_theorem second_partial_mul;;
2079 let second_partial_uni_compose = finalize_theorem second_partial_uni_compose;;
2080 end_section "Diff2Arith";;
2082 (* Section Diff2c *)
2083 begin_section "Diff2c";;
2085 (* Lemma real_cont_at_local *)
2086 let real_cont_at_local = section_proof ["f";"g";"x";"s"]
2087 `g real_continuous at x ==> open s ==> x IN s ==>
2088 (!y. y IN s ==> f y = g y) ==> f real_continuous at x`
2090 ((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"]));
2091 (((fun arg_tac -> (use_arg_then "OPEN_CONTAINS_BALL") (fun fst_arg -> (use_arg_then "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_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "ball")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)));
2092 (((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "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"]));
2093 (((fun arg_tac -> (use_arg_then "g_cont") (fun fst_arg -> (use_arg_then "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"]));
2094 ((fun arg_tac -> arg_tac (Arg_term (`min d0 d1`))) (term_tac exists_tac));
2095 (((repeat_tactic 1 9 (((use_arg_then "REAL_LT_MIN")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "d1_gt0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d0_gt0")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"]) THEN (case THEN ((move ["yd0"]) THEN (move ["yd1"]))));
2096 ((repeat_tactic 1 9 (((use_arg_then "f_eq_g")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
2097 (((((use_arg_then "sub_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIST_SYM")(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "y") (term_tac exists_tac)) THEN (done_tac));
2098 (((use_arg_then "dist_cond") (disch_tac [])) THEN (clear_assumption "dist_cond") THEN (exact_tac));
2101 (* Lemma real_cont_atreal_local *)
2102 let real_cont_atreal_local = section_proof ["v";"u";"t";"x"]
2103 `v real_continuous atreal x ==> real_open t ==> x IN t ==>
2104 (!y. y IN t ==> u y = v y) ==> u real_continuous atreal x`
2106 (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS_ATREAL)))(thm_tac (new_rewrite [] [])))));
2107 (((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_then "REAL_OPEN")(thm_tac (new_rewrite [] []))))) THEN (move ["vc"]) THEN (move ["open_t"]) THEN (move ["xt"]) THEN (move ["v_eq_u"]));
2108 ((use_arg_then "real_cont_at_local") (thm_tac apply_tac));
2109 (((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)));
2110 ((((((use_arg_then "open_t")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "vc")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "LIFT_IN_IMAGE_LIFT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xt")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "IN_IMAGE_LIFT_DROP")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "v_eq_u") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac));
2112 (add_section_type (mk_var ("f", (`:real^N -> real`))); add_section_type (mk_var ("g", (`:real^N -> real`))));;
2113 (add_section_var (mk_var ("x", (`:real^N`))));;
2114 (add_section_var (mk_var ("domain", (`:real^N#real^N`))));;
2117 begin_section "Point";;
2119 (* Lemma diff2c_scale *)
2120 let diff2c_scale = section_proof ["f";"c"]
2121 `diff2c f x ==> diff2c (\x. c * f x) x`
2123 (((repeat_tactic 1 9 (((use_arg_then "diff2c")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["p2c"])))) THEN (((((use_arg_then "diff2_scale")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"])));
2124 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "p2c") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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"])));
2125 ((use_arg_then "real_cont_at_local") (thm_tac apply_tac));
2126 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then "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"])));
2127 (((fun arg_tac -> arg_tac (Arg_term (`(\x. c * partial2 j i f x)`))) (term_tac exists_tac)) THEN ((use_arg_then "s") (term_tac exists_tac)));
2128 ((THENL_FIRST) (((use_arg_then "REAL_CONTINUOUS_LMUL")(thm_tac (new_rewrite [] [])))) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)));
2129 (((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "d2s") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["d2y"]));
2130 ((((use_arg_then "second_partial_scale")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2133 (* Lemma diff2c_neg *)
2134 let diff2c_neg = section_proof ["f"]
2135 `diff2c f x ==> diff2c (\x. --f x) x`
2137 (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "diff2c_scale") (fun fst_arg -> (use_arg_then "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_then "REAL_NEG_MINUS1")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac));
2140 (* Section Composite *)
2141 begin_section "Composite";;
2143 (* Lemma nth_diff_strong_eq_on_open *)
2144 let nth_diff_strong_eq_on_open = section_proof ["n";"u";"x"]
2145 `nth_diff_strong n u x ==>
2146 ?s. real_open s /\ x IN s /\ (!y. y IN s ==> nth_diff_strong n u y)`
2148 ((repeat_tactic 1 9 (((use_arg_then "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"]));
2149 (((use_arg_then "t") (term_tac exists_tac)) THEN (((((use_arg_then "xt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "open_t")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"]) THEN (move ["yt"])));
2150 (((use_arg_then "t") (term_tac exists_tac)) THEN (done_tac));
2153 (* Lemma diff2_imp_cont *)
2154 let diff2_imp_cont = section_proof ["f";"x"]
2155 `diff2 f x ==> f real_continuous at x`
2157 ((((use_arg_then "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"]));
2158 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_IMP_CONTINUOUS_AT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2161 (* Lemma diff2_imp_partial_cont *)
2162 let diff2_imp_partial_cont = section_proof ["f";"i";"x"]
2163 `diff2 f x ==> (partial i f) real_continuous at x`
2165 ((((use_arg_then "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"]));
2166 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_IMP_CONTINUOUS_AT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2169 (* Lemma diff2c_uni_compose *)
2170 let diff2c_uni_compose = section_proof ["u";"f";"x"]
2171 `diff2c f x ==> nth_diff_strong 2 u (f x) ==>
2172 (nth_derivative 2 u) real_continuous atreal (f x) ==> diff2c (u o f) x`
2174 ((repeat_tactic 1 9 (((use_arg_then "diff2c")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d2f"])) THEN (move ["p2c"]) THEN (move ["d2u"]) THEN (move ["u2c"]));
2175 (((((use_arg_then "diff2_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2u")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"]));
2176 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "p2c") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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"])));
2177 ((use_arg_then "real_cont_at_local") (thm_tac apply_tac));
2178 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then "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"])));
2179 (((fun arg_tac -> (use_arg_then "nth_diff_strong_eq_on_open") (fun fst_arg -> (use_arg_then "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"]));
2180 ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN s /\ (lift o f) z IN (IMAGE lift t)}`))) (term_tac (set_tac "r")));
2181 ((fun arg_tac -> arg_tac (Arg_term (`open r`))) (term_tac (have_gen_tac [](move ["open_r"]))));
2182 ((((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "CONTINUOUS_OPEN_PREIMAGE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_OPEN")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "open_t")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))));
2183 (((use_arg_then "DIFFERENTIABLE_IMP_CONTINUOUS_ON") (thm_tac apply_tac)) THEN ((((use_arg_then "differentiable_on")(thm_tac (new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["ys"])) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
2184 (((use_arg_then "DIFFERENTIABLE_AT_WITHIN")(thm_tac (new_rewrite [] []))));
2185 ((((fun arg_tac -> (use_arg_then "d2s") (fun fst_arg -> (use_arg_then "ys") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s'"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["ys'"]))));
2186 ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "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));
2187 (((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_then "r") (term_tac exists_tac)));
2188 ((THENL_ROT (-1)) (((((use_arg_then "open_r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "LIFT_IN_IMAGE_LIFT")(thm_tac (new_rewrite [] []))))) THEN (split_tac)));
2189 (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"]));
2190 (((((use_arg_then "second_partial_uni_compose")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "yz")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2s")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "d2t")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2191 ((THENL_LAST) (split_tac) (((use_arg_then "x") (term_tac exists_tac)) THEN (done_tac)));
2192 (((((use_arg_then "REAL_CONTINUOUS_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_CONTINUOUS_MUL")(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then "diff2_imp_partial_cont")(fun tmp_arg1 -> (use_arg_then "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))));
2193 (((((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(gsym_then (thm_tac (new_rewrite [] [(`nth_derivative 2 u _1`)])))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
2194 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] []))));
2195 ((((use_arg_then "o_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "CONTINUOUS_REAL_CONTINUOUS_AT_COMPOSE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_imp_cont")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2s")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))));
2196 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_CONTINUOUS_ATREAL_WITHINREAL")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2197 (((((use_arg_then "p2ij")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(gsym_then (thm_tac (new_rewrite [] [(`derivative u _`)])))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))));
2198 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] []))));
2199 ((((use_arg_then "o_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "CONTINUOUS_REAL_CONTINUOUS_AT_COMPOSE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_imp_cont")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2s")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))));
2200 ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_CONTINUOUS_ATREAL_WITHINREAL")(thm_tac (new_rewrite [] [])))));
2201 ((((use_arg_then "nth_derivative1")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "nth_derivative_continuous") (thm_tac apply_tac)));
2202 ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`2`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac)));
2203 ((((fun arg_tac -> (use_arg_then "d2t") (fun fst_arg -> (use_arg_then "fxt") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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));
2206 (* Lemma real_open_delete *)
2207 let real_open_delete = section_proof ["s";"x"]
2208 `real_open s ==> real_open (s DELETE x)`
2210 ((repeat_tactic 1 9 (((use_arg_then "REAL_OPEN")(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "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)));
2211 (((((use_arg_then "IMAGE_DELETE_INJ")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "LIFT_EQ")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2214 (* Lemma diff2c_inv_compose *)
2215 let diff2c_inv_compose = section_proof ["f"]
2216 `~(f x = &0) ==> diff2c f x ==> diff2c (inv o f) x`
2218 ((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN (((use_arg_then "diff2c_uni_compose")(thm_tac (new_rewrite [] [])))));
2219 ((((fun arg_tac -> (use_arg_then "diff2_inv") (fun fst_arg -> (use_arg_then "fn0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2220 (((use_arg_then "real_cont_atreal_local") (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac));
2221 (((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)));
2222 ((THENL_ROT (-1)) (((((use_arg_then "real_open_delete")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_OPEN_UNIV")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "IN_DELETE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_UNIV")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "fn0")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)));
2223 ((BETA_TAC THEN (move ["y"]) THEN (move ["yn0"])) THEN (((use_arg_then "second_derivative_inv")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2224 ((((use_arg_then "REAL_CONTINUOUS_LMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_INV_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_POW")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_CONTINUOUS_AT_ID")(thm_tac (new_rewrite [] []))))));
2225 ((((use_arg_then "REAL_POW_NZ")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2228 (* Lemma diff2c_sqrt_compose *)
2229 let diff2c_sqrt_compose = section_proof ["f"]
2230 `&0 < f x ==> diff2c f x ==> diff2c (sqrt o f) x`
2232 ((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN (((use_arg_then "diff2c_uni_compose")(thm_tac (new_rewrite [] [])))));
2233 ((((fun arg_tac -> (use_arg_then "diff2_sqrt") (fun fst_arg -> (use_arg_then "fn0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2234 (((use_arg_then "real_cont_atreal_local") (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac));
2235 (((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)));
2236 ((THENL_ROT (-1)) (((((use_arg_then "REAL_OPEN_HALFSPACE_GT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "real_gt")(thm_tac (new_rewrite [] [])))))) THEN (split_tac)));
2237 ((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_then "second_derivative_sqrt")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2238 ((THENL_LAST) (split_tac) (((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (done_tac)));
2239 ((THENL_ROT (-1)) ((((use_arg_then "REAL_CONTINUOUS_NEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_INV_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_LMUL")(thm_tac (new_rewrite [] []))))));
2240 ((THENL_FIRST) (((((use_arg_then "REAL_ENTIRE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "negb_or")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac)) ((arith_tac) THEN (done_tac)));
2241 ((((use_arg_then "SQRT_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_POW_NZ")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_POS_NZ")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_POW_LE")(thm_tac (new_rewrite [] [])))));
2242 ((((use_arg_then "fn0") (disch_tac [])) THEN (clear_assumption "fn0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2243 ((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 [] [])))))));
2244 (((((use_arg_then "FUN_EQ_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2245 ((((use_arg_then "REAL_CONTINUOUS_ATREAL_COMPOSE")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "REAL_CONTINUOUS_POW")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_CONTINUOUS_AT_ID")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))));
2246 (((((use_arg_then "REAL_CONTINUOUS_AT_SQRT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_POW_LT")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2249 (* Lemma diff2c_atn_compose *)
2250 let diff2c_atn_compose = section_proof ["f"]
2251 `diff2c f x ==> diff2c (atn o f) x`
2253 ((BETA_TAC THEN (move ["d2f"])) THEN (((use_arg_then "diff2c_uni_compose")(thm_tac (new_rewrite [] [])))));
2254 ((((use_arg_then "diff2_atn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "second_derivative_atn")(thm_tac (new_rewrite [] [])))));
2255 ((repeat_tactic 1 9 (((use_arg_then "REAL_CONTINUOUS_MUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_CONTINUOUS_CONST")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_CONTINUOUS_AT_ID")(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)));
2256 ((((use_arg_then "REAL_CONTINUOUS_POW")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_INV_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))));
2257 (((((use_arg_then "REAL_CONTINUOUS_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_POW")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_CONTINUOUS_AT_ID")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2258 (((use_arg_then "REAL_RNEG_UNIQ")(thm_tac (new_rewrite [] []))));
2259 ((fun arg_tac -> (use_arg_then "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));
2260 ((arith_tac) THEN (done_tac));
2263 (* Lemma diff2c_acs_compose *)
2264 let diff2c_acs_compose = section_proof ["f"]
2265 `abs (f x) < &1 ==> diff2c f x ==> diff2c (acs o f) x`
2267 ((BETA_TAC THEN (move ["fn1"]) THEN (move ["d2f"])) THEN (((use_arg_then "diff2c_uni_compose")(thm_tac (new_rewrite [] [])))));
2268 ((((fun arg_tac -> (use_arg_then "diff2_acs") (fun fst_arg -> (use_arg_then "fn1") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2269 (((use_arg_then "real_cont_atreal_local") (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac));
2270 (((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)));
2271 ((((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_OPEN_HALFSPACE_GT")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_OPEN_HALFSPACE_LT")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
2272 ((THENL_ROT (-1)) (((repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "real_gt")(thm_tac (new_rewrite [] [])))))) THEN (split_tac)));
2273 ((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_then "second_derivative_acs")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
2274 ((((use_arg_then "a1") (disch_tac [])) THEN (clear_assumption "a1") THEN ((use_arg_then "b1") (disch_tac [])) THEN (clear_assumption "b1") THEN ((use_arg_then "ab") (disch_tac [])) THEN (clear_assumption "ab") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2275 ((THENL_LAST) (split_tac) ((split_tac) THEN ((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (((use_arg_then "fn1") (disch_tac [])) THEN (clear_assumption "fn1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2276 (((use_arg_then "REAL_CONTINUOUS_NEG")(thm_tac (new_rewrite [] []))));
2277 ((use_arg_then "REAL_CONTINUOUS_DIV_ATREAL") (thm_tac apply_tac));
2278 ((fun arg_tac -> arg_tac (Arg_term (`&0 < (&1 - f x * f x) pow 3`))) (term_tac (have_gen_tac [](move ["h"]))));
2279 (((use_arg_then "REAL_POW_LT")(thm_tac (new_rewrite [] []))));
2280 ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. &1 - a * a = (&1 - a) * (&1 + a)`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LT_MUL")(thm_tac (new_rewrite [] [])))));
2281 ((((use_arg_then "fn1") (disch_tac [])) THEN (clear_assumption "fn1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
2282 ((THENL_ROT (-1)) (((((use_arg_then "REAL_CONTINUOUS_AT_ID")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)));
2283 (((((use_arg_then "SQRT_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LE_LT")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_LT_IMP_NZ")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2284 ((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 [] [])))))));
2285 (((((use_arg_then "FUN_EQ_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2286 ((((use_arg_then "REAL_CONTINUOUS_ATREAL_COMPOSE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_AT_SQRT")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)));
2287 ((((use_arg_then "REAL_CONTINUOUS_POW")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_SUB")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_CONST")(thm_tac (new_rewrite [] [])))));
2288 (((((use_arg_then "REAL_CONTINUOUS_MUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_CONTINUOUS_AT_ID")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2291 (* Finalization of the section Composite *)
2292 let nth_diff_strong_eq_on_open = finalize_theorem nth_diff_strong_eq_on_open;;
2293 let diff2_imp_cont = finalize_theorem diff2_imp_cont;;
2294 let diff2_imp_partial_cont = finalize_theorem diff2_imp_partial_cont;;
2295 let diff2c_uni_compose = finalize_theorem diff2c_uni_compose;;
2296 let real_open_delete = finalize_theorem real_open_delete;;
2297 let diff2c_inv_compose = finalize_theorem diff2c_inv_compose;;
2298 let diff2c_sqrt_compose = finalize_theorem diff2c_sqrt_compose;;
2299 let diff2c_atn_compose = finalize_theorem diff2c_atn_compose;;
2300 let diff2c_acs_compose = finalize_theorem diff2c_acs_compose;;
2301 end_section "Composite";;
2303 (* Lemma diff2c_add *)
2304 let diff2c_add = section_proof ["f";"g"]
2305 `diff2c f x ==> diff2c g x ==> diff2c (\x. f x + g x) x`
2307 (((repeat_tactic 1 9 (((use_arg_then "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_then "diff2_add")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"])));
2308 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "p2g") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then "p2f") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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"])));
2309 ((use_arg_then "real_cont_at_local") (thm_tac apply_tac));
2310 ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then "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"])));
2311 ((((use_arg_then "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"]));
2312 (((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)));
2313 ((THENL_FIRST) ((repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then "REAL_CONTINUOUS_ADD")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)));
2314 ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((((use_arg_then "second_partial_add")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2317 (* Lemma diff2c_sub *)
2318 let diff2c_sub = section_proof ["f";"g"]
2319 `diff2c f x ==> diff2c g x ==> diff2c (\x. f x - g x) x`
2321 ((BETA_TAC THEN (move ["d2f"]) THEN (move ["d2g"])) THEN ((((use_arg_then "real_sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_add")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "diff2c_neg")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2324 (* Lemma diff2c_mul *)
2325 let diff2c_mul = section_proof ["f";"g"]
2326 `diff2c f x ==> diff2c g x ==> diff2c (\x. f x * g x) x`
2328 (((repeat_tactic 1 9 (((use_arg_then "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_then "diff2_mul")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"])));
2329 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "p2g") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then "p2f") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "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"])));
2330 ((use_arg_then "real_cont_at_local") (thm_tac apply_tac));
2331 ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then "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"])));
2332 ((((use_arg_then "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"]));
2333 (((fun arg_tac -> arg_tac (Arg_term (`(\x. (partial2 j i f x * g x + partial i f x * partial j g x) +
2334 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)));
2335 ((THENL_ROT (-1)) (((repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN (split_tac)));
2336 ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((((use_arg_then "second_partial_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2337 (((repeat_tactic 1 9 (((use_arg_then "REAL_CONTINUOUS_ADD")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_CONTINUOUS_MUL")(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN ((repeat_tactic 0 10 (((use_arg_then "p2gij")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "p2fij")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then "diff2_imp_partial_cont")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "diff2_imp_cont")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2340 (* Finalization of the section Point *)
2341 let diff2c_scale = finalize_theorem diff2c_scale;;
2342 let diff2c_neg = finalize_theorem diff2c_neg;;
2343 let nth_diff_strong_eq_on_open = finalize_theorem nth_diff_strong_eq_on_open;;
2344 let diff2_imp_cont = finalize_theorem diff2_imp_cont;;
2345 let diff2_imp_partial_cont = finalize_theorem diff2_imp_partial_cont;;
2346 let diff2c_uni_compose = finalize_theorem diff2c_uni_compose;;
2347 let real_open_delete = finalize_theorem real_open_delete;;
2348 let diff2c_inv_compose = finalize_theorem diff2c_inv_compose;;
2349 let diff2c_sqrt_compose = finalize_theorem diff2c_sqrt_compose;;
2350 let diff2c_atn_compose = finalize_theorem diff2c_atn_compose;;
2351 let diff2c_acs_compose = finalize_theorem diff2c_acs_compose;;
2352 let diff2c_add = finalize_theorem diff2c_add;;
2353 let diff2c_sub = finalize_theorem diff2c_sub;;
2354 let diff2c_mul = finalize_theorem diff2c_mul;;
2355 end_section "Point";;
2357 (* Section Domain *)
2358 begin_section "Domain";;
2359 (add_section_var (mk_var ("f", (`:real^N -> real`))); add_section_var (mk_var ("g", (`:real^N -> real`))));;
2360 (add_section_hyp "d2f" (`diff2c_domain domain f`));;
2362 (* Lemma diff2c_domain_scale *)
2363 let diff2c_domain_scale = section_proof ["c"]
2364 `diff2c_domain domain (\x. c * f x)`
2366 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2c_scale")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2369 (* Lemma diff2c_domain_neg *)
2370 let diff2c_domain_neg = section_proof []
2371 `diff2c_domain domain (\x. --f x)`
2373 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2c_neg")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2375 (add_section_var (mk_var ("bounds", (`:real#real`))));;
2377 (* Lemma diff2c_domain_inv_compose *)
2378 let diff2c_domain_inv_compose = section_proof []
2379 `m_bounded_on_int f domain bounds ==>
2380 interval_not_zero bounds ==> diff2c_domain domain (inv o f)`
2382 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
2383 (((((use_arg_then "diff2c_inv_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "interval_arith_not_zero") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "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));
2386 (* Lemma diff2c_domain_sqrt_compose *)
2387 let diff2c_domain_sqrt_compose = section_proof []
2388 `m_bounded_on_int f domain bounds ==>
2389 interval_pos bounds ==> diff2c_domain domain (sqrt o f)`
2391 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
2392 (((((use_arg_then "diff2c_sqrt_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "interval_arith_pos") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "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));
2395 (* Lemma diff2c_domain_atn_compose *)
2396 let diff2c_domain_atn_compose = section_proof []
2397 `diff2c_domain domain (atn o f)`
2399 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2c_atn_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2402 (* Lemma diff2c_domain_acs_compose *)
2403 let diff2c_domain_acs_compose = section_proof []
2404 `m_bounded_on_int f domain bounds ==>
2405 iabs bounds < &1 ==> diff2c_domain domain (acs o f)`
2407 ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"])));
2408 (((((use_arg_then "diff2c_acs_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "interval_arith_abs") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "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));
2410 (add_section_hyp "d2g" (`diff2c_domain domain g`));;
2412 (* Lemma diff2c_domain_add *)
2413 let diff2c_domain_add = section_proof []
2414 `diff2c_domain domain (\x. f x + g x)`
2416 ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2c_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2419 (* Lemma diff2c_domain_sub *)
2420 let diff2c_domain_sub = section_proof []
2421 `diff2c_domain domain (\x. f x - g x)`
2423 ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2c_sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2426 (* Lemma diff2c_domain_mul *)
2427 let diff2c_domain_mul = section_proof []
2428 `diff2c_domain domain (\x. f x * g x)`
2430 ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2c_mul")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2433 (* Finalization of the section Domain *)
2434 let diff2c_domain_scale = finalize_theorem diff2c_domain_scale;;
2435 let diff2c_domain_neg = finalize_theorem diff2c_domain_neg;;
2436 let diff2c_domain_inv_compose = finalize_theorem diff2c_domain_inv_compose;;
2437 let diff2c_domain_sqrt_compose = finalize_theorem diff2c_domain_sqrt_compose;;
2438 let diff2c_domain_atn_compose = finalize_theorem diff2c_domain_atn_compose;;
2439 let diff2c_domain_acs_compose = finalize_theorem diff2c_domain_acs_compose;;
2440 let diff2c_domain_add = finalize_theorem diff2c_domain_add;;
2441 let diff2c_domain_sub = finalize_theorem diff2c_domain_sub;;
2442 let diff2c_domain_mul = finalize_theorem diff2c_domain_mul;;
2443 end_section "Domain";;
2445 (* Finalization of the section Diff2c *)
2446 let real_cont_at_local = finalize_theorem real_cont_at_local;;
2447 let real_cont_atreal_local = finalize_theorem real_cont_atreal_local;;
2448 let diff2c_scale = finalize_theorem diff2c_scale;;
2449 let diff2c_neg = finalize_theorem diff2c_neg;;
2450 let nth_diff_strong_eq_on_open = finalize_theorem nth_diff_strong_eq_on_open;;
2451 let diff2_imp_cont = finalize_theorem diff2_imp_cont;;
2452 let diff2_imp_partial_cont = finalize_theorem diff2_imp_partial_cont;;
2453 let diff2c_uni_compose = finalize_theorem diff2c_uni_compose;;
2454 let real_open_delete = finalize_theorem real_open_delete;;
2455 let diff2c_inv_compose = finalize_theorem diff2c_inv_compose;;
2456 let diff2c_sqrt_compose = finalize_theorem diff2c_sqrt_compose;;
2457 let diff2c_atn_compose = finalize_theorem diff2c_atn_compose;;
2458 let diff2c_acs_compose = finalize_theorem diff2c_acs_compose;;
2459 let diff2c_add = finalize_theorem diff2c_add;;
2460 let diff2c_sub = finalize_theorem diff2c_sub;;
2461 let diff2c_mul = finalize_theorem diff2c_mul;;
2462 let diff2c_domain_scale = finalize_theorem diff2c_domain_scale;;
2463 let diff2c_domain_neg = finalize_theorem diff2c_domain_neg;;
2464 let diff2c_domain_inv_compose = finalize_theorem diff2c_domain_inv_compose;;
2465 let diff2c_domain_sqrt_compose = finalize_theorem diff2c_domain_sqrt_compose;;
2466 let diff2c_domain_atn_compose = finalize_theorem diff2c_domain_atn_compose;;
2467 let diff2c_domain_acs_compose = finalize_theorem diff2c_domain_acs_compose;;
2468 let diff2c_domain_add = finalize_theorem diff2c_domain_add;;
2469 let diff2c_domain_sub = finalize_theorem diff2c_domain_sub;;
2470 let diff2c_domain_mul = finalize_theorem diff2c_domain_mul;;
2471 end_section "Diff2c";;
2473 (* Section M_LinApprox *)
2474 begin_section "M_LinApprox";;
2475 (add_section_var (mk_var ("f", (`:real^N -> real`))); add_section_var (mk_var ("g", (`:real^N -> real`))));;
2476 (add_section_var (mk_var ("bounds", (`:real#real`))));;
2477 (add_section_var (mk_var ("d_bounds_list", (`:(real#real)list`))));;
2478 (add_section_var (mk_var ("x", (`:real^N`))));;
2480 (* Lemma m_lin_approx_neg *)
2481 let m_lin_approx_neg = section_proof []
2482 `(lift o f) differentiable at x ==>
2483 interval_arith (--f x) bounds ==>
2484 all_n 1 d_bounds_list (\i int. interval_arith (--partial i f x) int) ==>
2485 m_lin_approx (\x. --f x) x bounds d_bounds_list`
2487 (BETA_TAC THEN (move ["df"]) THEN (move ["b"]) THEN (move ["db"]));
2488 ((THENL_FIRST) ((((use_arg_then "m_lin_approx")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "b")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_neg")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_NEG")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)));
2489 ((ASM_SIMP_TAC[partial_neg]) THEN (done_tac));
2492 (* Lemma m_lin_approx_scale *)
2493 let m_lin_approx_scale = section_proof ["c"]
2494 `(lift o f) differentiable at x ==>
2495 interval_arith (c * f x) bounds ==>
2496 all_n 1 d_bounds_list (\i int. interval_arith (c * partial i f x) int) ==>
2497 m_lin_approx (\x. c * f x) x bounds d_bounds_list`
2499 (BETA_TAC THEN (move ["df"]) THEN (move ["bH"]) THEN (move ["dbH"]));
2500 ((THENL_FIRST) ((((use_arg_then "m_lin_approx")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "bH")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_scale")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CMUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)));
2501 ((ASM_SIMP_TAC[partial_scale]) THEN (done_tac));
2504 (* Lemma m_lin_approx_add *)
2505 let m_lin_approx_add = section_proof []
2506 `(lift o f) differentiable at x ==>
2507 (lift o g) differentiable at x ==>
2508 interval_arith (f x + g x) bounds ==>
2509 all_n 1 d_bounds_list (\i int. interval_arith (partial i f x + partial i g x) int) ==>
2510 m_lin_approx (\x. f x + g x) x bounds d_bounds_list`
2512 (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["bH"]) THEN (move ["dbH"]));
2513 ((THENL_FIRST) ((((use_arg_then "m_lin_approx")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "bH")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)));
2514 ((ASM_SIMP_TAC[partial_add]) THEN (done_tac));
2517 (* Lemma m_lin_approx_sub *)
2518 let m_lin_approx_sub = section_proof []
2519 `(lift o f) differentiable at x ==>
2520 (lift o g) differentiable at x ==>
2521 interval_arith (f x - g x) bounds ==>
2522 all_n 1 d_bounds_list (\i int. interval_arith (partial i f x - partial i g x) int) ==>
2523 m_lin_approx (\x. f x - g x) x bounds d_bounds_list`
2525 (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["bH"]) THEN (move ["dbH"]));
2526 ((THENL_FIRST) ((((use_arg_then "m_lin_approx")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "bH")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_SUB")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)));
2527 ((ASM_SIMP_TAC[partial_sub]) THEN (done_tac));
2530 (* Lemma m_lin_approx_mul *)
2531 let m_lin_approx_mul = section_proof []
2532 `(lift o f) differentiable at x ==>
2533 (lift o g) differentiable at x ==>
2534 interval_arith (f x * g x) bounds ==>
2535 all_n 1 d_bounds_list (\i int. interval_arith (partial i f x * g x + f x * partial i g x) int) ==>
2536 m_lin_approx (\x. f x * g x) x bounds d_bounds_list`
2538 (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["bH"]) THEN (move ["dbH"]));
2539 ((((use_arg_then "m_lin_approx")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "bH")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "differentiable_mul")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))));
2540 ((ASM_SIMP_TAC[partial_mul]) THEN (done_tac));
2543 (* Finalization of the section M_LinApprox *)
2544 let m_lin_approx_neg = finalize_theorem m_lin_approx_neg;;
2545 let m_lin_approx_scale = finalize_theorem m_lin_approx_scale;;
2546 let m_lin_approx_add = finalize_theorem m_lin_approx_add;;
2547 let m_lin_approx_sub = finalize_theorem m_lin_approx_sub;;
2548 let m_lin_approx_mul = finalize_theorem m_lin_approx_mul;;
2549 end_section "M_LinApprox";;
2550 let second_bounded = new_definition `second_bounded f domain dd_bounds_list <=>
2551 !x. x IN interval [domain] ==> all_n 1 dd_bounds_list
2552 (\i list_i. all_n 1 list_i (\j int. interval_arith (partial2 j i f x) int))`;;
2553 let m_taylor_interval =
2554 new_definition `m_taylor_interval f domain y w f_bounds d_bounds_list dd_bounds_list <=>
2555 m_cell_domain domain y w /\
2556 diff2c_domain domain f /\
2557 m_lin_approx f y f_bounds d_bounds_list /\
2558 second_bounded f domain dd_bounds_list`;;
2560 (* Section M_TaylorIntervalArith *)
2561 begin_section "M_TaylorIntervalArith";;
2562 (add_section_var (mk_var ("f", (`:real^N -> real`))); add_section_var (mk_var ("g", (`:real^N -> real`))));;
2563 (add_section_var (mk_var ("x", (`:real^N`))); add_section_var (mk_var ("z", (`:real^N`))); add_section_var (mk_var ("y", (`:real^N`))); add_section_var (mk_var ("w", (`:real^N`))));;
2564 (add_section_var (mk_var ("domain", (`:real^N#real^N`))));;
2565 (add_section_var (mk_var ("f_bounds", (`:real#real`))); add_section_var (mk_var ("g_bounds", (`:real#real`))); add_section_var (mk_var ("bounds", (`:real#real`))));;
2566 (add_section_var (mk_var ("df_bounds_list", (`:(real#real)list`))); add_section_var (mk_var ("dg_bounds_list", (`:(real#real)list`))); add_section_var (mk_var ("d_bounds_list", (`:(real#real)list`))));;
2567 (add_section_var (mk_var ("ddf_bounds_list", (`:((real#real)list)list`))); add_section_var (mk_var ("ddg_bounds_list", (`:((real#real)list)list`))); add_section_var (mk_var ("dd_bounds_list", (`:((real#real)list)list`))));;
2568 (add_section_hyp "domainH" (`m_cell_domain domain y w`));;
2569 (add_section_hyp "d2f" (`diff2c_domain domain f`));;
2571 (* Lemma m_taylor_inv_compose *)
2572 let m_taylor_inv_compose = section_proof []
2573 `m_bounded_on_int f domain f_bounds ==> interval_not_zero f_bounds ==>
2574 m_lin_approx (inv o f) y bounds d_bounds_list ==>
2575 second_bounded (inv o f) domain dd_bounds_list ==>
2576 m_taylor_interval (inv o f) domain y w bounds d_bounds_list dd_bounds_list`
2578 ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] [])))));
2579 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "diff2c_domain_inv_compose") (fun fst_arg -> (use_arg_then "d2f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "bf") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2582 (* Lemma m_taylor_sqrt_compose *)
2583 let m_taylor_sqrt_compose = section_proof []
2584 `m_bounded_on_int f domain f_bounds ==> interval_pos f_bounds ==>
2585 m_lin_approx (sqrt o f) y bounds d_bounds_list ==>
2586 second_bounded (sqrt o f) domain dd_bounds_list ==>
2587 m_taylor_interval (sqrt o f) domain y w bounds d_bounds_list dd_bounds_list`
2589 ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] [])))));
2590 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "diff2c_domain_sqrt_compose") (fun fst_arg -> (use_arg_then "d2f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "bf") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2593 (* Lemma m_taylor_atn_compose *)
2594 let m_taylor_atn_compose = section_proof []
2595 `m_lin_approx (atn o f) y bounds d_bounds_list ==>
2596 second_bounded (atn o f) domain dd_bounds_list ==>
2597 m_taylor_interval (atn o f) domain y w bounds d_bounds_list dd_bounds_list`
2599 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_domain_atn_compose")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2602 (* Lemma m_taylor_acs_compose *)
2603 let m_taylor_acs_compose = section_proof []
2604 `m_bounded_on_int f domain f_bounds ==> iabs f_bounds < &1 ==>
2605 m_lin_approx (acs o f) y bounds d_bounds_list ==>
2606 second_bounded (acs o f) domain dd_bounds_list ==>
2607 m_taylor_interval (acs o f) domain y w bounds d_bounds_list dd_bounds_list`
2609 ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] [])))));
2610 ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "diff2c_domain_acs_compose") (fun fst_arg -> (use_arg_then "d2f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "bf") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2613 (* Lemma m_taylor_neg *)
2614 let m_taylor_neg = section_proof []
2615 `m_lin_approx (\x. --f x) y bounds d_bounds_list ==>
2616 second_bounded (\x. --f x) domain dd_bounds_list ==>
2617 m_taylor_interval (\x. --f x) domain y w bounds d_bounds_list dd_bounds_list`
2619 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_domain_neg")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2622 (* Lemma m_taylor_scale *)
2623 let m_taylor_scale = section_proof ["c"]
2624 `m_lin_approx (\x. c * f x) y bounds d_bounds_list ==>
2625 second_bounded (\x. c * f x) domain dd_bounds_list ==>
2626 m_taylor_interval (\x. c * f x) domain y w bounds d_bounds_list dd_bounds_list`
2628 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_domain_scale")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2630 (add_section_hyp "d2g" (`diff2c_domain domain g`));;
2632 (* Lemma m_taylor_add *)
2633 let m_taylor_add = section_proof []
2634 `m_lin_approx (\x. f x + g x) y bounds d_bounds_list ==>
2635 second_bounded (\x. f x + g x) domain dd_bounds_list ==>
2636 m_taylor_interval (\x. f x + g x) domain y w bounds d_bounds_list dd_bounds_list`
2638 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_domain_add")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2641 (* Lemma m_taylor_sub *)
2642 let m_taylor_sub = section_proof []
2643 `m_lin_approx (\x. f x - g x) y bounds d_bounds_list ==>
2644 second_bounded (\x. f x - g x) domain dd_bounds_list ==>
2645 m_taylor_interval (\x. f x - g x) domain y w bounds d_bounds_list dd_bounds_list`
2647 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_domain_sub")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2650 (* Lemma m_taylor_mul *)
2651 let m_taylor_mul = section_proof []
2652 `m_lin_approx (\x. f x * g x) y bounds d_bounds_list ==>
2653 second_bounded (\x. f x * g x) domain dd_bounds_list ==>
2654 m_taylor_interval (\x. f x * g x) domain y w bounds d_bounds_list dd_bounds_list`
2656 ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_domain_mul")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2659 (* Finalization of the section M_TaylorIntervalArith *)
2660 let m_taylor_inv_compose = finalize_theorem m_taylor_inv_compose;;
2661 let m_taylor_sqrt_compose = finalize_theorem m_taylor_sqrt_compose;;
2662 let m_taylor_atn_compose = finalize_theorem m_taylor_atn_compose;;
2663 let m_taylor_acs_compose = finalize_theorem m_taylor_acs_compose;;
2664 let m_taylor_neg = finalize_theorem m_taylor_neg;;
2665 let m_taylor_scale = finalize_theorem m_taylor_scale;;
2666 let m_taylor_add = finalize_theorem m_taylor_add;;
2667 let m_taylor_sub = finalize_theorem m_taylor_sub;;
2668 let m_taylor_mul = finalize_theorem m_taylor_mul;;
2669 end_section "M_TaylorIntervalArith";;
2671 (* Section PartialConvex *)
2672 begin_section "PartialConvex";;
2673 (add_section_type (mk_var ("f", (`:real^N->real`))));;
2675 (* Lemma REAL_LE_DIV_1 *)
2676 let REAL_LE_DIV_1 = section_proof ["a";"b"]
2677 `&0 < b ==> (a / b <= &1 <=> a <= b)`
2679 ((BETA_TAC THEN (move ["b_gt"])) THEN ((((use_arg_then "REAL_LE_LDIV_EQ")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2682 (* Lemma partial_convex_max *)
2683 let partial_convex_max = section_proof ["f";"j";"x";"z";"u";"v";"hi"]
2684 `(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i /\ v$i = x$i) ==>
2685 u$j = x$j ==> v$j = z$j ==>
2686 diff2_domain (x,z) f ==>
2687 (!y. y IN interval [x,z] ==> &0 <= partial2 j j f y) ==>
2688 (!y. y IN interval [x,u] ==> f y <= hi) ==>
2689 (!y. y IN interval [v,z] ==> f y <= hi) ==>
2690 (!y. y IN interval [x,z] ==> f y <= hi)`
2692 ((((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (move ["uv_eq"]) THEN (move ["ux_eq"]) THEN (move ["vz_eq"]));
2693 ((((use_arg_then "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"]));
2694 ((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")));
2695 ((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")));
2696 ((((use_arg_then "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"])));
2697 ((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"]))))));
2698 ((((use_arg_then "y1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "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 [] []))))));
2699 (((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_then "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_then "ux_eq")(fun tmp_arg1 -> (use_arg_then "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_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN ((((use_arg_then "uv_eq")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "y_in")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2700 (((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "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_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (move ["j_in"])));
2701 ((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_then "bound1") (disch_tac [])) THEN (clear_assumption "bound1") THEN (DISCH_THEN apply_tac)) THEN (done_tac)));
2702 ((((use_arg_then "CART_EQ")(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["i_in"]));
2703 ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(i = j)`))) (term_tac (have_gen_tac [](move ["inj"])))) ((((use_arg_then "i_in") (disch_tac [])) THEN (clear_assumption "i_in") THEN ((use_arg_then "j_in") (disch_tac [])) THEN (clear_assumption "j_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
2704 (((((use_arg_then "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));
2705 (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`f y <= max (f y1) (f y2)`))) (term_tac (have_gen_tac []ALL_TAC))));
2706 (BETA_TAC THEN (move ["cond"]));
2707 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then "cond") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
2708 ((((fun arg_tac -> (use_arg_then "bound2") (fun fst_arg -> (use_arg_then "y2_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then "bound1") (fun fst_arg -> (use_arg_then "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));
2709 ((fun arg_tac -> arg_tac (Arg_term (`f o (\t. y1 + t % basis j)`))) (term_tac (set_tac "g")));
2710 ((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 [] [])))))));
2711 (((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2712 ((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"]))));
2713 ((repeat_tactic 1 9 (((use_arg_then "CART_EQ")(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN (move ["i"]) THEN (move ["i_in"])) THEN ((((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((fun arg_tac -> (use_arg_then "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_then "y1_def")(fun tmp_arg1 -> (use_arg_then "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_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_SUB_ADD2")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
2714 (((((use_arg_then "ij")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac));
2715 (((((use_arg_then "ij")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac));
2716 ((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_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "y_eq")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)));
2717 ((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_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "y_eq")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)));
2718 (((fun arg_tac -> (use_arg_then "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"]));
2719 ((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_then "zx_j")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_SUB_REFL")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)));
2720 ((((fun arg_tac -> (use_arg_then "y_in") (fun fst_arg -> (use_arg_then "j_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then "zx_j")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac));
2721 ((fun arg_tac -> arg_tac (Arg_term (`(y$j - x$j) / (z$j - x$j)`))) (term_tac (set_tac "t")));
2722 ((fun arg_tac -> arg_tac (Arg_term (`&0 < z$j - x$j`))) (term_tac (have_gen_tac [](move ["zx_pos"]))));
2723 ((((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_then "zx_j")(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2724 ((((use_arg_then "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_then "y_in")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2725 ((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"]))));
2726 ((((use_arg_then "t_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_DIV_1")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_MUL_RZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ADD_LID")(thm_tac (new_rewrite [] [])))));
2727 ((((use_arg_then "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 [] []))))));
2728 ((((use_arg_then "REAL_MUL_LINV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_SUB_0")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2729 ((repeat_tactic 1 9 (((use_arg_then "real_sub")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_RADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "y_in")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "real_sub")(gsym_then (thm_tac (new_rewrite [] [])))))));
2730 ((THENL_FIRST) ((((use_arg_then "REAL_LE_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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)));
2731 (((((use_arg_then "REAL_SUB_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "y_in")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2732 ((((use_arg_then "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)));
2733 ((fun arg_tac -> arg_tac (Arg_term (`real_interval [&0, z$j - x$j]`))) (term_tac exists_tac));
2734 ((((use_arg_then "REAL_SUB_ADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_SUB_LE")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "t_props")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (simp_tac));
2735 ((((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_then "andbT")(thm_tac (new_rewrite [] [])))));
2736 (((fun arg_tac -> arg_tac (Arg_term (`real_interval _`))) (term_tac (set_tac "s"))) THEN (((use_arg_then "t_props") (disch_tac [])) THEN (clear_assumption "t_props") THEN ((use_arg_then "t_def") (disch_tac [])) THEN (clear_assumption "t_def") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"])));
2737 ((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"]))));
2738 (((((use_arg_then "s_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "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"]));
2739 ((repeat_tactic 1 9 (((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
2740 ((((use_arg_then "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)));
2741 ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "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"])));
2742 (((((use_arg_then "REAL_MUL_RZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "y_in")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2743 ((((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((fun arg_tac -> (use_arg_then "y_in") (fun fst_arg -> (use_arg_then "i_ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then "ij")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac));
2744 ((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"]))));
2745 ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "diff2_dir")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_f")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "in_s")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2746 ((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"]))));
2747 ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN (((use_arg_then "partial")(thm_tac (new_rewrite [] [])))));
2748 ((((fun arg_tac -> (use_arg_then "in_s") (fun fst_arg -> (use_arg_then "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"))));
2749 ((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 [] [])))))));
2750 ((((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "h_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["r"])) THEN ((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)));
2751 (((((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));
2752 ((((use_arg_then "derivative_translation")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
2753 ((((fun arg_tac -> (use_arg_then "diff2_g") (fun fst_arg -> (use_arg_then "ts") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "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));
2754 ((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"]))));
2755 ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN ((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "diff2_dir_derivative2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "diff2_f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "in_s")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
2756 ((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"]))));
2757 ((((((use_arg_then "EXTENSION")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_UNION")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_SING")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_DELETE")(thm_tac (new_rewrite [] []))))) THEN (move ["i"])) THEN (split_tac));
2758 ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "orNb")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2759 ((case THEN (simp_tac)) THEN (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (done_tac));
2760 ((fun arg_tac -> arg_tac (Arg_term (`DISJOINT ((1..dimindex (:N)) DELETE j) {j}`))) (term_tac (have_gen_tac [](move ["disj"]))));
2761 (((((use_arg_then "DISJOINT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "EXTENSION")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_SING")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NOT_IN_EMPTY")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_DELETE")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]));
2762 (((((use_arg_then "andbA")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "andNb")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbF")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2763 ((((use_arg_then "s_eq")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "SUM_UNION")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_DELETE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_SING")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "SUM_SING")(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2764 ((((use_arg_then "SUM_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_DELETE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_ADD_LID")(thm_tac (new_rewrite [] []))))));
2765 ((BETA_TAC THEN (move ["i"]) THEN (move ["i_in"])) THEN (((use_arg_then "SUM_EQ_0") (thm_tac apply_tac)) THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac)));
2766 (((((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_NUMSEG")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then "i_in")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "REAL_MUL_LZERO")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2767 ((((use_arg_then "s_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_UNION")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_DELETE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_SING")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "SUM_SING")(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
2768 ((((use_arg_then "SUM_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_DELETE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_ADD_LID")(thm_tac (new_rewrite [] []))))));
2769 ((BETA_TAC THEN (move ["i"]) THEN (move ["i_in"]) THEN (simp_tac)) THEN (((use_arg_then "REAL_ENTIRE")(thm_tac (new_rewrite [] [])))) THEN (DISJ2_TAC));
2770 (((((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_NUMSEG")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then "i_in")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "REAL_MUL_LZERO")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2771 (((((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "j_in")(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2772 ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_CONVEX_ON_SECOND_DERIVATIVE") (fun fst_arg -> (use_arg_then "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_then "s") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
2773 ((THENL_ROT (-1)) (((((use_arg_then "s_def")(gsym_then (thm_tac (new_rewrite [1; 2] []))))) THEN (((use_arg_then "IS_REALINTERVAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NOT_EXISTS_THM")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))));
2774 ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN ((((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "partial2_pos")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "in_s")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2776 ((BETA_TAC THEN (move ["t"])) THEN (((use_arg_then "contraT") (disch_tac [])) THEN (clear_assumption "contraT") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then "negbK")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "EXTENSION")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_SING")(thm_tac (new_rewrite [] []))))) THEN (move ["eq"])));
2777 ((((use_arg_then "zx_pos") (disch_tac [])) THEN (clear_assumption "zx_pos") THEN ((fun arg_tac -> (use_arg_then "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_then "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_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))))));
2778 ((arith_tac) THEN (done_tac));
2779 ((split_tac) THEN (move ["t"]) THEN (move ["ts"]));
2780 ((((fun arg_tac -> (use_arg_then "diff2_g") (fun fst_arg -> (use_arg_then "ts") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "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"])));
2781 (((((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "H")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2782 ((((fun arg_tac -> (use_arg_then "diff2_g") (fun fst_arg -> (use_arg_then "ts") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "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"])));
2783 (((((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "H")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2786 (* Finalization of the section PartialConvex *)
2787 let REAL_LE_DIV_1 = finalize_theorem REAL_LE_DIV_1;;
2788 let partial_convex_max = finalize_theorem partial_convex_max;;
2789 end_section "PartialConvex";;
2791 (* Section ElementaryFunctions *)
2792 begin_section "ElementaryFunctions";;
2794 (* Lemma f_lift_const *)
2795 let f_lift_const = section_proof ["c"]
2796 `lift o (\x. c) = (\x. lift c)`
2798 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2801 (* Lemma f_lift_unary *)
2802 let f_lift_unary = section_proof ["f"]
2803 `lift o (\x. f x) = (\x. lift (f x))`
2805 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2808 (* Lemma diff2_const *)
2809 let diff2_const = section_proof ["c";"x"]
2810 `diff2 (\x:real^N. c) x`
2812 ((((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real^N)`))) (term_tac exists_tac)) THEN (((((use_arg_then "OPEN_UNIV")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_UNIV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["_"])));
2813 (((((use_arg_then "partial_const")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "f_lift_const")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2816 (* Lemma diff2_domain_const *)
2817 let diff2_domain_const = section_proof ["c";"domain"]
2818 `diff2_domain domain (\x:real^N. c)`
2820 (((((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_const")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2823 (* Lemma partial2_const *)
2824 let partial2_const = section_proof ["i";"j";"c"]
2825 `partial2 i j (\x:real^N. c) = (\x. &0)`
2827 (((((use_arg_then "partial2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "partial_const")(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
2830 (* Lemma diff2c_const *)
2831 let diff2c_const = section_proof ["c";"x"]
2832 `diff2c (\x:real^N. c) x`
2834 (((((use_arg_then "diff2c")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_const")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "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_then "REAL_CONTINUOUS_CONST")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2837 (* Lemma diff2c_domain_const *)
2838 let diff2c_domain_const = section_proof ["c";"domain"]
2839 `diff2c_domain domain (\x:real^N. c)`
2841 (((((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_const")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2844 (* Lemma partial_x_lemma *)
2845 let partial_x_lemma = section_proof ["k";"i"]
2846 `partial i (\x:real^N. x$k) = (\x. (basis i:real^N)$k)`
2848 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial")(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac));
2849 ((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 [] [])))))));
2850 (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2851 ((((use_arg_then "derivative_add")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_MUL_ATREAL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
2852 (((((use_arg_then "REAL_DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2853 ((((use_arg_then "derivative_const")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "derivative_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
2854 (((((use_arg_then "derivative_x")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_const")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac));
2857 (* Lemma partial_x *)
2858 let partial_x = section_proof ["k";"i"]
2859 `k IN 1..dimindex (:N) ==>
2860 partial i (\x:real^N. x$k) = (\x. if i = k then &1 else &0)`
2862 ((BETA_TAC THEN (move ["k_ineq"])) THEN ((((use_arg_then "partial_x_lemma")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_NUMSEG")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac));
2865 (* Lemma partial2_x *)
2866 let partial2_x = section_proof ["k";"i";"j"]
2867 `partial2 i j (\x:real^N. x$k) = (\x. &0)`
2869 (((((use_arg_then "partial2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "partial_x_lemma")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "partial_const")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2873 let diff2_x = section_proof ["k";"x"]
2874 `k IN 1..dimindex (:N) ==> diff2 (\x:real^N. x$k) x`
2876 ((BETA_TAC THEN (move ["k_ineq"])) THEN (((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real^N)`))) (term_tac exists_tac)) THEN (((((use_arg_then "OPEN_UNIV")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_UNIV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["_"])));
2877 (((((use_arg_then "projection_diff")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "partial_x_lemma")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "f_lift_unary")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2880 (* Lemma diff2_domain_x *)
2881 let diff2_domain_x = section_proof ["k";"domain"]
2882 `k IN 1..dimindex (:N) ==> diff2_domain domain (\x:real^N. x$k)`
2884 (((DISCH_THEN (fun snd_th -> (use_arg_then "diff2_x") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2887 (* Lemma diff2c_x *)
2888 let diff2c_x = section_proof ["k";"x"]
2889 `k IN 1..dimindex (:N) ==> diff2c (\x:real^N. x$k) x`
2891 ((BETA_TAC THEN (move ["k_ineq"])) THEN ((((use_arg_then "diff2c")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_x")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
2892 (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial2_x")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_CONST")(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2895 (* Lemma diff2c_domain_x *)
2896 let diff2c_domain_x = section_proof ["k";"domain"]
2897 `k IN 1..dimindex (:N) ==> diff2c_domain domain (\x:real^N. x$k)`
2899 (((DISCH_THEN (fun snd_th -> (use_arg_then "diff2c_x") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
2902 (* Finalization of the section ElementaryFunctions *)
2903 let f_lift_const = finalize_theorem f_lift_const;;
2904 let f_lift_unary = finalize_theorem f_lift_unary;;
2905 let diff2_const = finalize_theorem diff2_const;;
2906 let diff2_domain_const = finalize_theorem diff2_domain_const;;
2907 let partial2_const = finalize_theorem partial2_const;;
2908 let diff2c_const = finalize_theorem diff2c_const;;
2909 let diff2c_domain_const = finalize_theorem diff2c_domain_const;;
2910 let partial_x_lemma = finalize_theorem partial_x_lemma;;
2911 let partial_x = finalize_theorem partial_x;;
2912 let partial2_x = finalize_theorem partial2_x;;
2913 let diff2_x = finalize_theorem diff2_x;;
2914 let diff2_domain_x = finalize_theorem diff2_domain_x;;
2915 let diff2c_x = finalize_theorem diff2c_x;;
2916 let diff2c_domain_x = finalize_theorem diff2c_domain_x;;
2917 end_section "ElementaryFunctions";;