needs "Formal_ineqs/lib/ssrbool.hl";; needs "Formal_ineqs/lib/ssrnat.hl";; needs "Formal_ineqs/taylor/theory/taylor_interval-compiled.hl";; (* Module Multivariate_taylor*) module Multivariate_taylor = struct open Ssreflect;; open Ssrfun;; open Ssrbool;; open Ssrnat;; open Taylor_interval;; open Interval_arith;; prioritize_overload `:real^N`;; prioritize_real();; let IMAGE_DELETE_INJ_COMPAT = prove (`!f s a. (!x. f(x) = f(a) ==> x = a) ==> (IMAGE f (s DELETE a) = (IMAGE f s) DELETE (f a))`, SET_TAC[]);; let partial = new_definition `partial i f x = derivative (f o (\t. (x:real^N) + t % basis i)) (&0)`;; 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)`;; let m_lin_approx = new_definition `m_lin_approx (f:real^N->real) x f_bounds df_bounds_list <=> (lift o f) differentiable at x /\ interval_arith (f x) f_bounds /\ all_n 1 df_bounds_list (\i int. interval_arith (partial i f x) int)`;; (* Section Misc *) Sections.begin_section "Misc";; (* Lemma f_lift_neg *) let f_lift_neg = Sections.section_proof ["f"] `lift o (\x. --f x) = (\x. --(lift o f) x)` [ (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("LIFT_NEG", [LIFT_NEG]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma f_lift_scale *) let f_lift_scale = Sections.section_proof ["f";"c"] `lift o (\x. c * f x) = (\x. c % (lift o f) x)` [ (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("LIFT_CMUL", [LIFT_CMUL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma f_lift_add *) let f_lift_add = Sections.section_proof ["f";"g"] `lift o (\x. f x + g x) = (\x. (lift o f) x + (lift o g) x)` [ (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("LIFT_ADD", [LIFT_ADD]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma f_lift_sub *) let f_lift_sub = Sections.section_proof ["f";"g"] `lift o (\x. f x - g x) = (\x. (lift o f) x - (lift o g) x)` [ (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("LIFT_SUB", [LIFT_SUB]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma f_binary_drop *) let f_binary_drop = Sections.section_proof ["op";"f";"g"] `(\t. op (f t) (g t)) o drop = (\x. op (f (drop x)) (g (drop x)))` [ (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma f_unary_drop *) let f_unary_drop = Sections.section_proof ["op";"f"] `(\t. op (f t)) o drop = (\x. op (f (drop x)))` [ (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Section MoreFrechet *) Sections.begin_section "MoreFrechet";; (Sections.add_section_var (mk_var ("f", (`:real^N -> real^M`))); Sections.add_section_var (mk_var ("g", (`:real^N -> real^M`))));; (Sections.add_section_var (mk_var ("x", (`:real^N`))); Sections.add_section_var (mk_var ("y", (`:real^N`))));; (* Lemma frechet_compose *) let frechet_compose = Sections.section_proof ["f";"g";"x"] `f differentiable at (g x) ==> g differentiable at x ==> frechet_derivative (f o g) (at x) = frechet_derivative f (at (g x)) o frechet_derivative g (at x)` [ ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac))); (((use_arg_then2 ("DIFF_CHAIN_AT", [DIFF_CHAIN_AT])) (thm_tac apply_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma frechet_const *) let frechet_const = Sections.section_proof ["z"] `frechet_derivative (\x. y) (at z) = (\x. vec 0)` [ ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("HAS_DERIVATIVE_CONST", [HAS_DERIVATIVE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma frechet_id *) let frechet_id = Sections.section_proof [] `frechet_derivative (\x. x) (at y) = (\x. x)` [ ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("HAS_DERIVATIVE_ID", [HAS_DERIVATIVE_ID]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma frechet_vmul *) let frechet_vmul = Sections.section_proof ["z"] `frechet_derivative (\x. drop x % y) (at z) = (\x. drop x % y)` [ ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("HAS_DERIVATIVE_VMUL_DROP", [HAS_DERIVATIVE_VMUL_DROP])) (thm_tac apply_tac))); (((use_arg_then2 ("HAS_DERIVATIVE_ID", [HAS_DERIVATIVE_ID]))(thm_tac (new_rewrite [] [])))); ];; (Sections.add_section_hyp "df" (`f differentiable at x`));; (* Lemma frechet_neg *) let frechet_neg = Sections.section_proof [] `frechet_derivative (\x. --f x) (at x) = (\y. --frechet_derivative f (at x) y)` [ ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("HAS_DERIVATIVE_NEG", [HAS_DERIVATIVE_NEG])) (thm_tac apply_tac))); ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma frechet_scale *) let frechet_scale = Sections.section_proof ["c"] `frechet_derivative (\x. c % f x) (at x) = (\y. c % frechet_derivative f (at x) y)` [ ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("HAS_DERIVATIVE_CMUL", [HAS_DERIVATIVE_CMUL])) (thm_tac apply_tac))); ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (Sections.add_section_hyp "dg" (`g differentiable at x`));; (* Lemma frechet_add *) let frechet_add = Sections.section_proof [] `frechet_derivative (\x. f x + g x) (at x) = (\y. frechet_derivative f (at x) y + frechet_derivative g (at x) y)` [ ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("HAS_DERIVATIVE_ADD", [HAS_DERIVATIVE_ADD])) (thm_tac apply_tac))); ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma frechet_sub *) let frechet_sub = Sections.section_proof [] `frechet_derivative (\x. f x - g x) (at x) = (\y. frechet_derivative f (at x) y - frechet_derivative g (at x) y)` [ ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("HAS_DERIVATIVE_SUB", [HAS_DERIVATIVE_SUB])) (thm_tac apply_tac))); ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Finalization of the section MoreFrechet *) let frechet_compose = Sections.finalize_theorem frechet_compose;; let frechet_const = Sections.finalize_theorem frechet_const;; let frechet_id = Sections.finalize_theorem frechet_id;; let frechet_vmul = Sections.finalize_theorem frechet_vmul;; let frechet_neg = Sections.finalize_theorem frechet_neg;; let frechet_scale = Sections.finalize_theorem frechet_scale;; let frechet_add = Sections.finalize_theorem frechet_add;; let frechet_sub = Sections.finalize_theorem frechet_sub;; Sections.end_section "MoreFrechet";; (* Lemma differentiable_compose_at *) let differentiable_compose_at = Sections.section_proof ["f";"g";"x"] `f differentiable at (g x) ==> g differentiable at x ==> (f o g) differentiable at x` [ ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])) THEN (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(thm_tac (new_rewrite [] []))))); (((((use_arg_then2 ("frechet_compose", [frechet_compose]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((use_arg_then2 ("DIFF_CHAIN_AT", [DIFF_CHAIN_AT])) (thm_tac apply_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma jacobian_compose *) let jacobian_compose = Sections.section_proof ["f";"g";"x"] `f differentiable at (g x) ==> g differentiable at x ==> jacobian (f o g) (at x) = jacobian f (at (g x)) ** jacobian g (at x)` [ (BETA_TAC THEN (move ["df"]) THEN (move ["dg"])); (((repeat_tactic 1 9 (((use_arg_then2 ("jacobian", [jacobian]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("frechet_compose", [frechet_compose]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("MATRIX_COMPOSE", [MATRIX_COMPOSE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LINEAR_FRECHET_DERIVATIVE", [LINEAR_FRECHET_DERIVATIVE]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma frechet_eq_jacobian *) let frechet_eq_jacobian = Sections.section_proof ["f";"x"] `f differentiable at x ==> frechet_derivative f (at x) = (\h. jacobian f (at x) ** h)` [ (BETA_TAC THEN (move ["df"])); (((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("JACOBIAN_WORKS", [JACOBIAN_WORKS]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Section Product *) Sections.begin_section "Product";; (* Lemma REAL_LET_MUL2 *) let REAL_LET_MUL2 = Sections.section_proof ["w";"x";"y";"z"] `&0 < w /\ w <= x /\ &0 <= y /\ y < z ==> w * y < x * z` [ (BETA_TAC THEN (move ["ineq"])); ((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`w = x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(move ["w_eq_x"]); (move ["wnx"])]); (((((use_arg_then2 ("w_eq_x", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LT_LMUL", [REAL_LT_LMUL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("REAL_LT_MUL2", [REAL_LT_MUL2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("wnx", [])) (disch_tac [])) THEN (clear_assumption "wnx") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ];; (* Lemma has_derivative_x12 *) let has_derivative_x12 = Sections.section_proof ["y"] `(lift o (\x:real^2. x$1 * x$2) has_derivative lift o (\x. y$2 * x$1 + y$1 * x$2)) (at y)` [ ((((use_arg_then2 ("has_derivative_at", [has_derivative_at]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)); ((((use_arg_then2 ("linear", [linear]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_ADD", [LIFT_ADD]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_CMUL", [LIFT_CMUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_ADD", [LIFT_ADD]))(thm_tac (new_rewrite [] [])))))); ((VECTOR_ARITH_TAC) THEN (done_tac)); ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("LIFT_ADD", [LIFT_ADD]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LIFT_SUB", [LIFT_SUB]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LIFT_CMUL", [LIFT_CMUL]))(gsym_then (thm_tac (new_rewrite [] [])))))); (((((use_arg_then2 ("LIM_AT", [LIM_AT]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_RZERO)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_LIFT", [NORM_LIFT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] [])))))) THEN (move ["e"]) THEN (move ["e0"])); (((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)) = (x$2 - y$2) * (x$1 - y$1)`)))(thm_tac (new_rewrite [] [])))); (((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("e0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN ((move ["norm0"]) THEN (move ["norm_e"]))))); ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_ABS_MUL", [REAL_ABS_MUL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ABS_INV", [REAL_ABS_INV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_NORM", [REAL_ABS_NORM]))(thm_tac (new_rewrite [] []))))); ((repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`x - y:real^2`))) (term_tac (set_tac "p")))); ((fun arg_tac -> (use_arg_then2 ("NORM_BOUND_COMPONENT_LT", [NORM_BOUND_COMPONENT_LT])) (fun fst_arg -> (use_arg_then2 ("norm_e", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["ineq"]))); ((((use_arg_then2 ("REAL_LTE_TRANS", [REAL_LTE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LTE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`inv (infnorm p) * infnorm p * e`))) (term_tac exists_tac))); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < infnorm p`))) (term_tac (have_gen_tac [](move ["infnorm_0"])))) (((((use_arg_then2 ("INFNORM_POS_LT", [INFNORM_POS_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_POS_LT", [NORM_POS_LT]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); ((THENL_ROT (-1)) (split_tac)); (((((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("INFNORM_EQ_0", [INFNORM_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_POS_LT", [NORM_POS_LT]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((((use_arg_then2 ("REAL_LET_MUL2", [REAL_LET_MUL2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_INV", [REAL_LT_INV]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LE_INV2", [REAL_LE_INV2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("INFNORM_LE_NORM", [INFNORM_LE_NORM]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); ((fun arg_tac -> arg_tac (Arg_term (`infnorm p = abs (p$1) \/ infnorm p = abs (p$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)); (((THENL_FIRST) (case THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("REAL_LT_LMUL", [REAL_LT_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DIMINDEX_2", [DIMINDEX_2]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); ];; (* Lemma lambda_eq_vsum *) let lambda_eq_vsum = Sections.section_proof ["f"] `(\x:A. lambda i. f i x) = (\x. vsum (1..dimindex (:N)) (\i. f i x % (basis i:real^N)))` [ (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["x"])); (((((use_arg_then2 ("CART_EQ", [CART_EQ]))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["ineq"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("VSUM_COMPONENT", [VSUM_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); (((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")))); ((fun arg_tac -> arg_tac (Arg_term (`DISJOINT B {i} /\ A = B UNION {i}`))) (term_tac (have_gen_tac [](move ["cond"])))); ((((use_arg_then2 ("DISJOINT", [DISJOINT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("B_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("A_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); ((THENL_FIRST) ((split_tac) THEN (move ["x"])) (((repeat_tactic 1 9 (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbA", [orbA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); ((((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x = i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((simp_tac) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("cond", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_UNION", [SUM_UNION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("cond", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("B_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_DIFF", [FINITE_DIFF]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("A_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_SING", [FINITE_SING]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); ((((use_arg_then2 ("SUM_SING", [SUM_SING]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); (((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b. a = b + a * &1 <=> b = &0`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_EQ_0", [SUM_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["j"])); ((((((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["ineq_j"]) THEN (simp_tac)) THEN ((((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))); (((((use_arg_then2 ("ineq_j", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma has_derivative_lambda *) let has_derivative_lambda = Sections.section_proof ["f";"f'";"y"] `(!i. i IN 1..dimindex (:M) ==> (lift o (f i) has_derivative lift o (f' i)) (at (y:real^N))) ==> (((\x. lambda i. f i x):real^N->real^M) has_derivative (\x. lambda i. f' i x) ) (at y)` [ ((BETA_TAC THEN (move ["df"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("lambda_eq_vsum", [lambda_eq_vsum]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("HAS_DERIVATIVE_VSUM", [HAS_DERIVATIVE_VSUM])) (thm_tac apply_tac))); (((((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac)); ((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"])))); ((BETA_TAC THEN (move ["g"])) THEN ((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((((fun arg_tac -> (use_arg_then2 ("eq", [])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq", [])) (fun fst_arg -> (use_arg_then2 ("f'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_DERIVATIVE_VMUL_DROP)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma vector2_eq_lambda *) let vector2_eq_lambda = Sections.section_proof ["x";"y"] `(vector [x; y]:real^2) = (lambda i. if i = 1 then x else y)` [ ((((((use_arg_then2 ("CART_EQ", [CART_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIMINDEX_2", [DIMINDEX_2]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`)))(thm_tac (new_rewrite [] []))))); ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [1; 3] []))))) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_2)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_2", [DIMINDEX_2]))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); ];; (* Lemma has_derivative_vector2 *) let has_derivative_vector2 = Sections.section_proof ["f";"g";"f'";"g'";"y"] `(lift o f has_derivative lift o f') (at y) ==> (lift o g has_derivative lift o g') (at y) ==> ((\x. vector [f x; g x]:real^2) has_derivative (\x. vector [f' x; g' x]:real^2)) (at y)` [ ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("vector2_eq_lambda", [vector2_eq_lambda]))(thm_tac (new_rewrite [] [])))))); (((use_arg_then2 ("has_derivative_lambda", [has_derivative_lambda])) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("DIMINDEX_2", [DIMINDEX_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]))); ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`)))(thm_tac (new_rewrite [] [])))) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [2; 4] [])))) THEN (simp_tac)) THEN ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `~(2 = 1)`)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); ];; (* Lemma has_derivative_mul *) let has_derivative_mul = Sections.section_proof ["f";"g";"f'";"g'";"y"] `(lift o f has_derivative lift o f') (at y) ==> (lift o g has_derivative lift o g') (at y) ==> (lift o (\x. f x * g x) has_derivative lift o (\x. f' x * g y + f y * g' x)) (at y)` [ (BETA_TAC THEN (move ["df"]) THEN (move ["dg"])); ((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 [] []))))))); ((((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["x"])) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_2)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((fun arg_tac -> arg_tac (Arg_term (`vector [f y; g y]:real^2`))) (term_tac (set_tac "q"))); ((fun arg_tac -> arg_tac (Arg_term (`lift o (\x. f' x * g y + f y * g' x) = (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 [] []))))))); (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("q_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_2)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("DIFF_CHAIN_AT", [DIFF_CHAIN_AT])) (thm_tac apply_tac)) THEN (simp_tac)) THEN ((((use_arg_then2 ("q_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_derivative_x12", [has_derivative_x12]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_derivative_vector2", [has_derivative_vector2]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma f_eq_lift_drop *) let f_eq_lift_drop = Sections.section_proof ["f"] `f = lift o (drop o f)` [ (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma differentiable_mul *) let differentiable_mul = Sections.section_proof ["f";"g";"y"] `lift o f differentiable (at y) ==> lift o g differentiable (at y) ==> lift o (\x. f x * g x) differentiable (at y)` [ ((repeat_tactic 2 0 (((use_arg_then2 ("differentiable", [differentiable]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["f'"])) THEN (move ["df"]) THEN (case THEN (move ["g'"])) THEN (move ["dg"])); ((((use_arg_then2 ("dg", [])) (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then2 ("df", [])) (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN (((((fun arg_tac -> (use_arg_then2 ("f_eq_lift_drop", [f_eq_lift_drop])) (fun fst_arg -> (use_arg_then2 ("f'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("f_eq_lift_drop", [f_eq_lift_drop])) (fun fst_arg -> (use_arg_then2 ("g'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (move ["df"]) THEN (move ["dg"]))); ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("has_derivative_mul", [has_derivative_mul])) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("dg", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); (((use_arg_then2 ("HAS_DERIVATIVE_IMP_DIFFERENTIABLE", [HAS_DERIVATIVE_IMP_DIFFERENTIABLE])) (thm_tac apply_tac)) THEN (done_tac)); ];; (* Lemma frechet_mul *) let frechet_mul = Sections.section_proof ["f";"g";"y"] `lift o f differentiable at y ==> lift o g differentiable at y ==> frechet_derivative (lift o (\x. f x * g x)) (at y) = (\x. g y % frechet_derivative (lift o f) (at y) x + f y % frechet_derivative (lift o g) (at y) x)` [ (((repeat_tactic 1 9 (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq_lift_drop", [f_eq_lift_drop]))(thm_tac (new_rewrite [] [(`frechet_derivative _1 _2`)]))))) THEN (move ["df"])); ((((use_arg_then2 ("f_eq_lift_drop", [f_eq_lift_drop]))(thm_tac (new_rewrite [] [(`frechet_derivative _1 _2`)])))) THEN (move ["dg"])); (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("has_derivative_mul", [has_derivative_mul])) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("dg", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))); (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] [])))))) THEN (move ["x"])); (((((use_arg_then2 ("LIFT_ADD", [LIFT_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_CMUL", [LIFT_CMUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Finalization of the section Product *) let REAL_LET_MUL2 = Sections.finalize_theorem REAL_LET_MUL2;; let has_derivative_x12 = Sections.finalize_theorem has_derivative_x12;; let lambda_eq_vsum = Sections.finalize_theorem lambda_eq_vsum;; let has_derivative_lambda = Sections.finalize_theorem has_derivative_lambda;; let vector2_eq_lambda = Sections.finalize_theorem vector2_eq_lambda;; let has_derivative_vector2 = Sections.finalize_theorem has_derivative_vector2;; let has_derivative_mul = Sections.finalize_theorem has_derivative_mul;; let f_eq_lift_drop = Sections.finalize_theorem f_eq_lift_drop;; let differentiable_mul = Sections.finalize_theorem differentiable_mul;; let frechet_mul = Sections.finalize_theorem frechet_mul;; Sections.end_section "Product";; (* Finalization of the section Misc *) let f_lift_neg = Sections.finalize_theorem f_lift_neg;; let f_lift_scale = Sections.finalize_theorem f_lift_scale;; let f_lift_add = Sections.finalize_theorem f_lift_add;; let f_lift_sub = Sections.finalize_theorem f_lift_sub;; let f_binary_drop = Sections.finalize_theorem f_binary_drop;; let f_unary_drop = Sections.finalize_theorem f_unary_drop;; let frechet_compose = Sections.finalize_theorem frechet_compose;; let frechet_const = Sections.finalize_theorem frechet_const;; let frechet_id = Sections.finalize_theorem frechet_id;; let frechet_vmul = Sections.finalize_theorem frechet_vmul;; let frechet_neg = Sections.finalize_theorem frechet_neg;; let frechet_scale = Sections.finalize_theorem frechet_scale;; let frechet_add = Sections.finalize_theorem frechet_add;; let frechet_sub = Sections.finalize_theorem frechet_sub;; let differentiable_compose_at = Sections.finalize_theorem differentiable_compose_at;; let jacobian_compose = Sections.finalize_theorem jacobian_compose;; let frechet_eq_jacobian = Sections.finalize_theorem frechet_eq_jacobian;; let REAL_LET_MUL2 = Sections.finalize_theorem REAL_LET_MUL2;; let has_derivative_x12 = Sections.finalize_theorem has_derivative_x12;; let lambda_eq_vsum = Sections.finalize_theorem lambda_eq_vsum;; let has_derivative_lambda = Sections.finalize_theorem has_derivative_lambda;; let vector2_eq_lambda = Sections.finalize_theorem vector2_eq_lambda;; let has_derivative_vector2 = Sections.finalize_theorem has_derivative_vector2;; let has_derivative_mul = Sections.finalize_theorem has_derivative_mul;; let f_eq_lift_drop = Sections.finalize_theorem f_eq_lift_drop;; let differentiable_mul = Sections.finalize_theorem differentiable_mul;; let frechet_mul = Sections.finalize_theorem frechet_mul;; Sections.end_section "Misc";; (* Section Partial *) Sections.begin_section "Partial";; (* Lemma real_derivative_compose_frechet *) let real_derivative_compose_frechet = Sections.section_proof ["f";"h";"t"] `(lift o f) differentiable at (h t) ==> (h o drop) differentiable at (lift t) ==> ((f o h) has_real_derivative (drop o (frechet_derivative (lift o f) (at (h t)) o frechet_derivative (h o drop) (at (lift t))) o lift) (&1)) (atreal t)` [ (BETA_TAC THEN (move ["diff_f"]) THEN (move ["diff_h"])); ((((use_arg_then2 ("diff_h", [])) (disch_tac [])) THEN ((use_arg_then2 ("diff_f", [])) (disch_tac [])) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FRECHET_DERIVATIVE_WORKS", [FRECHET_DERIVATIVE_WORKS]))(thm_tac (new_rewrite [] [])))))); ((fun arg_tac -> arg_tac (Arg_term (`frechet_derivative _1 _2`))) (term_tac (set_tac "f'"))); ((fun arg_tac -> arg_tac (Arg_term (`frechet_derivative _1 _2`))) (term_tac (set_tac "h'"))); (BETA_TAC THEN (move ["df"]) THEN (move ["dh"])); (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_REAL_FRECHET_DERIVATIVE_AT)))(thm_tac (new_rewrite [] [])))); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`lift o (f o h) o drop = (lift o f) o (h o drop)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((repeat_tactic 1 9 (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); (((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 [] [])))))))); (((((use_arg_then2 ("DIFF_CHAIN_AT", [DIFF_CHAIN_AT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dh", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (move ["x"]) THEN (simp_tac)); ((fun arg_tac -> arg_tac (Arg_term (`linear f' /\ linear h'`))) (term_tac (have_gen_tac [](move ["lin"])))); (((((use_arg_then2 ("h'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LINEAR_FRECHET_DERIVATIVE", [LINEAR_FRECHET_DERIVATIVE]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((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] []))))))); (((((use_arg_then2 ("DROP_EQ", [DROP_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DROP_CMUL", [DROP_CMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((repeat_tactic 1 9 (((use_arg_then2 ("LINEAR_CMUL", [LINEAR_CMUL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DROP_EQ", [DROP_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DROP_CMUL", [DROP_CMUL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma real_derivative_compose_jacobian *) let real_derivative_compose_jacobian = Sections.section_proof ["f";"h";"t"] `(lift o f) differentiable at (h t) ==> (h o drop) differentiable at (lift t) ==> ((f o h) has_real_derivative (jacobian (lift o f) (at (h t)) ** jacobian (h o drop) (at (lift t)))$1$1) (atreal t)` [ (BETA_TAC THEN (move ["df"]) THEN (move ["dh"])); (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_derivative_compose_frechet", [real_derivative_compose_frechet])) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("dh", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); ((repeat_tactic 1 9 (((use_arg_then2 ("frechet_eq_jacobian", [frechet_eq_jacobian]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); ((((use_arg_then2 ("MATRIX_VECTOR_MUL_ASSOC", [MATRIX_VECTOR_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("matrix_vector_mul", [matrix_vector_mul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DROP_LAMBDA", [DROP_LAMBDA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIMINDEX_1", [DIMINDEX_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_SING_NUMSEG", [SUM_SING_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); (((((use_arg_then2 ("LIFT_COMPONENT", [LIFT_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff_imp_real_diff *) let diff_imp_real_diff = Sections.section_proof ["f";"h";"t"] `(lift o f) differentiable at (h t) ==> (h o drop) differentiable at (lift t) ==> (f o h) real_differentiable atreal t` [ (BETA_TAC THEN (move ["diff_f"]) THEN (move ["diff_h"])); (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_derivative_compose_frechet", [real_derivative_compose_frechet])) (fun fst_arg -> (use_arg_then2 ("diff_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("diff_h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); ((fun arg_tac -> arg_tac (Arg_term (`(drop o _ o lift) (&1)`))) (term_tac (set_tac "fh'"))); (((((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] [])))) THEN (move ["dfh"])) THEN ((use_arg_then2 ("fh'", [])) (term_tac exists_tac)) THEN (done_tac)); ];; (* Lemma diff_direction *) let diff_direction = Sections.section_proof ["y";"e";"net"] `((\t. y + t % e) o drop) differentiable net` [ ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(\t. y + t % e) o drop = (\x. y + drop x % e)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); ((((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); ((use_arg_then2 ("HAS_DERIVATIVE_IMP_DIFFERENTIABLE", [HAS_DERIVATIVE_IMP_DIFFERENTIABLE])) (thm_tac apply_tac)); (((fun arg_tac -> arg_tac (Arg_term (`\x. drop x % e`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("HAS_DERIVATIVE_VMUL_DROP", [HAS_DERIVATIVE_VMUL_DROP])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("HAS_DERIVATIVE_ID", [HAS_DERIVATIVE_ID]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma frechet_direction *) let frechet_direction = Sections.section_proof ["y";"e";"t"] `frechet_derivative ((\t. y + t % e) o drop) (at (lift t)) = (\x. drop x % e)` [ ((((use_arg_then2 ("f_unary_drop", [f_unary_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("frechet_add", [frechet_add]))(thm_tac (new_rewrite [] []))))); (((((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("HAS_DERIVATIVE_IMP_DIFFERENTIABLE", [HAS_DERIVATIVE_IMP_DIFFERENTIABLE])) (thm_tac apply_tac))); (((fun arg_tac -> arg_tac (Arg_term (`\x. drop x % e`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("HAS_DERIVATIVE_VMUL_DROP", [HAS_DERIVATIVE_VMUL_DROP])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("HAS_DERIVATIVE_ID", [HAS_DERIVATIVE_ID]))(thm_tac (new_rewrite [] []))))); (((((use_arg_then2 ("frechet_vmul", [frechet_vmul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("frechet_const", [frechet_const]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_ADD_LID", [VECTOR_ADD_LID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma real_dir_derivative_frechet *) let real_dir_derivative_frechet = Sections.section_proof ["f";"y";"e";"t"] `(lift o f) differentiable at (y + t % e) ==> ((f o (\t. y + t % e)) has_real_derivative (drop (frechet_derivative (lift o f) (at (y + t % e)) e))) (atreal t)` [ (BETA_TAC THEN (move ["df"])); (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_derivative_compose_frechet", [real_derivative_compose_frechet])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\t. y + t % e`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); (((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff_direction", [diff_direction]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("frechet_direction", [frechet_direction]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_LID", [VECTOR_MUL_LID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma real_dir_derivative_jacobian *) let real_dir_derivative_jacobian = Sections.section_proof ["f";"y";"e";"t"] `(lift o f) differentiable at (y + t % e) ==> ((f o (\t. y + t % e)) has_real_derivative drop (jacobian (lift o f) (at (y + t % e)) ** e)) (atreal t)` [ (BETA_TAC THEN (move ["df"])); (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_dir_derivative_frechet", [real_dir_derivative_frechet])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); ((((use_arg_then2 ("frechet_eq_jacobian", [frechet_eq_jacobian]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma partial_eq_frechet *) let partial_eq_frechet = Sections.section_proof ["f";"y";"i"] `(lift o f) differentiable at (y:real^N) ==> partial i f y = drop (frechet_derivative (lift o f) (at y) (basis i))` [ ((BETA_TAC THEN (move ["df"])) THEN (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_dir_derivative_frechet", [real_dir_derivative_frechet])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`basis i:real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))))); ((BETA_TAC THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("derivative_unique", [derivative_unique])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); ];; (* Lemma partial_eq_jacobian *) let partial_eq_jacobian = Sections.section_proof ["f";"y";"i"] `(lift o f) differentiable at y ==> partial i f y = drop (jacobian (lift o f) (at y) ** basis i)` [ (BETA_TAC THEN (move ["df"])); ((((use_arg_then2 ("df", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("JACOBIAN_WORKS", [JACOBIAN_WORKS]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma partial_eq_jacobian_column *) let partial_eq_jacobian_column = Sections.section_proof ["f";"y";"i"] `(lift o (f:real^N->real)) differentiable at y ==> i IN 1..dimindex (:N) ==> partial i f y = drop (column i (jacobian (lift o f) (at y)))` [ ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["df"]) THEN (move ["ineq"])); (((((use_arg_then2 ("partial_eq_jacobian", [partial_eq_jacobian]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("MATRIX_VECTOR_MUL_BASIS", [MATRIX_VECTOR_MUL_BASIS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma partial_eq_jacobian_entry *) let partial_eq_jacobian_entry = Sections.section_proof ["f";"y";"i"] `(lift o (f:real^N->real)) differentiable at y ==> i IN 1..dimindex (:N) ==> partial i f y = (jacobian (lift o f) (at y))$1$i` [ ((BETA_TAC THEN (move ["df"]) THEN (move ["ineq"])) THEN ((((use_arg_then2 ("partial_eq_jacobian_column", [partial_eq_jacobian_column]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("column", [column]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DROP_LAMBDA", [DROP_LAMBDA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (Sections.add_section_var (mk_var ("y", (`:real^N`))));; (Sections.add_section_var (mk_var ("i", (`:num`))));; (* Lemma partial_eq0 *) let partial_eq0 = Sections.section_proof ["f"] `~(i IN 1..dimindex (:N)) ==> partial i f y = &0` [ ((BETA_TAC THEN (move ["ineq"])) THEN (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] []))))); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`basis i = (vec 0):real^N`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("BASIS_EQ_0", [BASIS_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); ((((use_arg_then2 ("VECTOR_MUL_RZERO", [VECTOR_MUL_RZERO]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); ((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 [] []))))))); ((AP_TERM_TAC) THEN ((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma derivative_compose *) let derivative_compose = Sections.section_proof ["f";"g";"x"] `f real_differentiable atreal (g x) ==> g real_differentiable atreal x ==> derivative (f o g) x = derivative f (g x) * derivative g x` [ (BETA_TAC THEN (move ["df"]) THEN (move ["dg"])); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`f o g = \x. f (g x)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); (((((use_arg_then2 ("derivative_composition", [derivative_composition]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma projection_has_derivative *) let projection_has_derivative = Sections.section_proof ["i";"net"] `i IN 1..dimindex (:N) ==> (lift o (\x:real^N. x$i) has_derivative lift o (\x. x$i)) net` [ ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["ineq"])); ((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 [] []))))))); ((((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"])) THEN ((((use_arg_then2 ("DROP_EQ", [DROP_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DROP_CMUL", [DROP_CMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DROP_VEC", [DROP_VEC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_DERIVATIVE_VMUL_COMPONENT)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_DERIVATIVE_ID", [HAS_DERIVATIVE_ID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma projection_diff *) let projection_diff = Sections.section_proof ["i";"net"] `i IN 1..dimindex (:N) ==> (lift o (\x:real^N. x$i)) differentiable net` [ ((((use_arg_then2 ("differentiable", [differentiable]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("projection_has_derivative", [projection_has_derivative])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("net", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"])); (((fun arg_tac -> arg_tac (Arg_term (`lift o \x:real^N. x$i`))) (term_tac exists_tac)) THEN (done_tac)); ];; (* Lemma frechet_projection *) let frechet_projection = Sections.section_proof ["i";"x"] `i IN 1..dimindex (:N) ==> frechet_derivative (lift o (\x:real^N. x$i)) (at x) = lift o (\x:real^N. x$i)` [ ((BETA_TAC THEN (move ["ineq"])) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("FRECHET_DERIVATIVE_AT", [FRECHET_DERIVATIVE_AT])) (thm_tac apply_tac))); ((((use_arg_then2 ("projection_has_derivative", [projection_has_derivative]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma has_derivative_vector_frechet *) let has_derivative_vector_frechet = Sections.section_proof ["h";"t";"i"] `i IN 1..dimindex (:N) ==> (h o drop) differentiable at (lift t) ==> ((\s. (h:real->real^N) s$i) has_real_derivative (frechet_derivative (h o drop) (at (lift t)) (lift (&1)))$i) (atreal t)` [ (BETA_TAC THEN (move ["ineq"]) THEN (move ["dh"])); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(\s. h s$i) = (\x. x$i) o h`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_derivative_compose_frechet", [real_derivative_compose_frechet])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\x:real^N. x$i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); ((((use_arg_then2 ("dh", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("projection_diff", [projection_diff]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); ((fun arg_tac -> arg_tac (Arg_term (`(drop o _ o lift) (&1)`))) (term_tac (set_tac "lhs"))); ((fun arg_tac -> arg_tac (Arg_term (`(frechet_derivative _1 _2 _3)$i`))) (term_tac (set_tac "rhs"))); ((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))); (((((use_arg_then2 ("lhs_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("frechet_projection", [frechet_projection]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("rhs_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma has_derivative_vector_jacobian *) let has_derivative_vector_jacobian = Sections.section_proof ["h";"t";"i"] `i IN 1..dimindex (:N) ==> (h o drop) differentiable at (lift t) ==> ((\s. (h:real->real^N) s$i) has_real_derivative (jacobian (h o drop) (at (lift t)))$i$1) (atreal t)` [ (BETA_TAC THEN (move ["ineq"]) THEN (move ["dh"])); (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("has_derivative_vector_frechet", [has_derivative_vector_frechet])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("dh", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); ((fun arg_tac -> arg_tac (Arg_term (`(frechet_derivative _1 _2 _3)$i`))) (term_tac (set_tac "lhs"))); ((fun arg_tac -> arg_tac (Arg_term (`jacobian _1 _2$i$1`))) (term_tac (set_tac "rhs"))); ((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))); ((((use_arg_then2 ("lhs_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("frechet_eq_jacobian", [frechet_eq_jacobian]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); ((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 [] []))))))); (((((use_arg_then2 ("DROP_EQ", [DROP_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("basis", [basis]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DROP_LAMBDA", [DROP_LAMBDA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((((use_arg_then2 ("MATRIX_VECTOR_MUL_BASIS", [MATRIX_VECTOR_MUL_BASIS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_GE_1", [DIMINDEX_GE_1]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("column", [column]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); ];; (* Lemma derivative_vector_jacobian *) let derivative_vector_jacobian = Sections.section_proof ["h";"t";"i"] `i IN 1..dimindex (:N) ==> ((h:real->real^N) o drop) differentiable at (lift t) ==> derivative (\s. h s$i) t = jacobian (h o drop) (at (lift t))$i$1` [ ((BETA_TAC THEN (move ["ineq"]) THEN (move ["dh"])) THEN ((use_arg_then2 ("derivative_unique", [derivative_unique])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("has_derivative_vector_jacobian", [has_derivative_vector_jacobian]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma real_derivative_compose_partial *) let real_derivative_compose_partial = Sections.section_proof ["f";"h";"t"] `(lift o (f:real^N -> real)) differentiable at (h t) ==> (h o drop) differentiable at (lift t) ==> ((f o h) has_real_derivative sum (1..dimindex (:N)) (\i. partial i f (h t) * derivative (\s. h s$i) t)) (atreal t)` [ (BETA_TAC THEN (move ["df"]) THEN (move ["dh"])); (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_derivative_compose_jacobian", [real_derivative_compose_jacobian])) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("dh", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); (((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")))); ((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))); (((use_arg_then2 ("lhs_def", []))(gsym_then (thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("matrix_mul", [matrix_mul]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_GE_1", [DIMINDEX_GE_1]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))); ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_GE_1", [DIMINDEX_GE_1]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("rhs_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))); (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac)); (((((use_arg_then2 ("partial_eq_jacobian_entry", [partial_eq_jacobian_entry]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_EQ_MUL_LCANCEL", [REAL_EQ_MUL_LCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_vector_jacobian", [derivative_vector_jacobian]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma real_dir_derivative_partial *) let real_dir_derivative_partial = Sections.section_proof ["f";"e";"t"] `(lift o f) differentiable at (y + t % e) ==> ((f o (\t. y + t % e)) has_real_derivative sum (1..dimindex (:N)) (\i. e$i * (partial i f o (\t. y + t % e)) t)) (atreal t)` [ (BETA_TAC THEN (move ["df"])); (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_dir_derivative_jacobian", [real_dir_derivative_jacobian])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); ((((use_arg_then2 ("matrix_vector_mul", [matrix_vector_mul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DROP_LAMBDA", [DROP_LAMBDA]))(thm_tac (new_rewrite [] []))))); (((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")))); ((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))); (((((use_arg_then2 ("lhs_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rhs_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac))); (((((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("partial_eq_jacobian_entry", [partial_eq_jacobian_entry]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (Sections.add_section_var (mk_var ("f", (`:real^N -> real`))); Sections.add_section_var (mk_var ("g", (`:real^N -> real`))));; (Sections.add_section_hyp "df" (`(lift o f) differentiable at y`));; (* Lemma partial_uni_compose *) let partial_uni_compose = Sections.section_proof ["u"] `u real_differentiable atreal (f y) ==> partial i (u o f) y = derivative u (f y) * partial i f y` [ ((BETA_TAC THEN (move ["du"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("derivative_compose", [derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); (((((use_arg_then2 ("diff_imp_real_diff", [diff_imp_real_diff]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff_direction", [diff_direction]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma partial_neg *) let partial_neg = Sections.section_proof [] `partial i (\x. --f x) y = --partial i f y` [ (((repeat_tactic 1 9 (((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_lift_neg", [f_lift_neg]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_NEG", [DIFFERENTIABLE_NEG]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("frechet_neg", [frechet_neg]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DROP_NEG", [DROP_NEG]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); ];; (* Lemma partial_scale *) let partial_scale = Sections.section_proof ["c"] `partial i (\x. c * f x) y = c * partial i f y` [ (((repeat_tactic 1 9 (((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_lift_scale", [f_lift_scale]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_CMUL", [DIFFERENTIABLE_CMUL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("frechet_scale", [frechet_scale]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)))); ((((use_arg_then2 ("DROP_CMUL", [DROP_CMUL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (Sections.add_section_hyp "dg" (`(lift o g) differentiable at y`));; (* Lemma partial_add *) let partial_add = Sections.section_proof [] `partial i (\x. f x + g x) y = partial i f y + partial i g y` [ (((repeat_tactic 1 9 (((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_lift_add", [f_lift_add]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("frechet_add", [frechet_add]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)))); ((((use_arg_then2 ("DROP_ADD", [DROP_ADD]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma partial_sub *) let partial_sub = Sections.section_proof [] `partial i (\x. f x - g x) y = partial i f y - partial i g y` [ (((repeat_tactic 1 9 (((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_lift_sub", [f_lift_sub]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_SUB", [DIFFERENTIABLE_SUB]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("frechet_sub", [frechet_sub]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)))); ((((use_arg_then2 ("DROP_SUB", [DROP_SUB]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma partial_mul *) let partial_mul = Sections.section_proof [] `partial i (\x. f x * g x) y = partial i f y * g y + f y * partial i g y` [ ((repeat_tactic 1 9 (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`\t. y + t % basis i`))) (term_tac (set_tac "h")))); ((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 [] []))))))); (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((THENL_ROT (-1)) (((use_arg_then2 ("derivative_mul", [derivative_mul]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [1; 4] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (use_arg_then2 ("g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`h (&0) = y`))) (term_tac (have_gen_tac [](move ["h0"])))) (((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(h o drop) differentiable at (lift (&0))`))) (term_tac (have_gen_tac [](move ["dh"])))) (((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("diff_direction", [diff_direction]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff_imp_real_diff", [diff_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("h0", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Finalization of the section Partial *) let real_derivative_compose_frechet = Sections.finalize_theorem real_derivative_compose_frechet;; let real_derivative_compose_jacobian = Sections.finalize_theorem real_derivative_compose_jacobian;; let diff_imp_real_diff = Sections.finalize_theorem diff_imp_real_diff;; let diff_direction = Sections.finalize_theorem diff_direction;; let frechet_direction = Sections.finalize_theorem frechet_direction;; let real_dir_derivative_frechet = Sections.finalize_theorem real_dir_derivative_frechet;; let real_dir_derivative_jacobian = Sections.finalize_theorem real_dir_derivative_jacobian;; let partial_eq_frechet = Sections.finalize_theorem partial_eq_frechet;; let partial_eq_jacobian = Sections.finalize_theorem partial_eq_jacobian;; let partial_eq_jacobian_column = Sections.finalize_theorem partial_eq_jacobian_column;; let partial_eq_jacobian_entry = Sections.finalize_theorem partial_eq_jacobian_entry;; let partial_eq0 = Sections.finalize_theorem partial_eq0;; let derivative_compose = Sections.finalize_theorem derivative_compose;; let projection_has_derivative = Sections.finalize_theorem projection_has_derivative;; let projection_diff = Sections.finalize_theorem projection_diff;; let frechet_projection = Sections.finalize_theorem frechet_projection;; let has_derivative_vector_frechet = Sections.finalize_theorem has_derivative_vector_frechet;; let has_derivative_vector_jacobian = Sections.finalize_theorem has_derivative_vector_jacobian;; let derivative_vector_jacobian = Sections.finalize_theorem derivative_vector_jacobian;; let real_derivative_compose_partial = Sections.finalize_theorem real_derivative_compose_partial;; let real_dir_derivative_partial = Sections.finalize_theorem real_dir_derivative_partial;; let partial_uni_compose = Sections.finalize_theorem partial_uni_compose;; let partial_neg = Sections.finalize_theorem partial_neg;; let partial_scale = Sections.finalize_theorem partial_scale;; let partial_add = Sections.finalize_theorem partial_add;; let partial_sub = Sections.finalize_theorem partial_sub;; let partial_mul = Sections.finalize_theorem partial_mul;; Sections.end_section "Partial";; (* Section PartialMonotone *) Sections.begin_section "PartialMonotone";; (* Lemma derivative_translation *) let derivative_translation = Sections.section_proof ["f";"x"] `f real_differentiable atreal x ==> derivative f x = derivative (f o (\t. x + t)) (&0)` [ (BETA_TAC THEN (move ["diff_f"])); ((((use_arg_then2 ("derivative_compose", [derivative_compose]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff_f", []))(thm_tac (new_rewrite [] [])))))); (((((use_arg_then2 ("REAL_DIFFERENTIABLE_ADD", [REAL_DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_ID", [REAL_DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((((use_arg_then2 ("derivative_add", [derivative_add]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_ID", [REAL_DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); (((((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_x", [derivative_x]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); ];; (Sections.add_section_type (mk_var ("f", (`:real^N->real`))));; (* Lemma partial_increasing_left *) let partial_increasing_left = Sections.section_proof ["f";"j";"u";"x";"z";"lo"] `(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i) ==> u$j = x$j ==> (!y. y IN interval [x,z] ==> (lift o f) differentiable at y) ==> (!y. y IN interval [x,z] ==> &0 <= partial j f y) ==> (!y. y IN interval [x,u] ==> lo <= f y) ==> (!y. y IN interval [x,z] ==> lo <= f y)` [ (((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] [])))))) THEN (move ["uz_eq"]) THEN (move ["ux_eq"]) THEN (move ["diff_f"]) THEN (move ["partial_pos"]) THEN (move ["f_bound"]) THEN (move ["y"]) THEN (move ["y_in"])); ((((use_arg_then2 ("partial_pos", [])) (disch_tac [])) THEN (clear_assumption "partial_pos") THEN ((use_arg_then2 ("diff_f", [])) (disch_tac [])) THEN (clear_assumption "diff_f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["diff_f"]) THEN (move ["partial_pos"]))); ((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'"))); (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`f y' <= f y`))) (term_tac (have_gen_tac []ALL_TAC)))); ((((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("f_bound", [])) (disch_tac [])) THEN (clear_assumption "f_bound") THEN (DISCH_THEN apply_tac) THEN (move ["i"]) THEN (move ["i_in"]))); ((((use_arg_then2 ("y'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); ((THENL_FIRST) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"])) (((((use_arg_then2 ("ux_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); (((((use_arg_then2 ("uz_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); (((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`j IN 1..dimindex (:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case)) THEN ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["j_in"]))); ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`y' = y`))) (term_tac (have_gen_tac []ALL_TAC)))) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); ((((use_arg_then2 ("CART_EQ", [CART_EQ]))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["i_in"])); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(i = j)`))) (term_tac (have_gen_tac [](move ["inj"])))) ((((use_arg_then2 ("i_in", [])) (disch_tac [])) THEN (clear_assumption "i_in") THEN ((use_arg_then2 ("j_in", [])) (disch_tac [])) THEN (clear_assumption "j_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); (((((use_arg_then2 ("y'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((fun arg_tac -> arg_tac (Arg_term (`f o (\t. y' + t % basis j)`))) (term_tac (set_tac "g"))); ((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 [] []))))))); (((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((fun arg_tac -> arg_tac (Arg_term (`f y = g (y$j - x$j)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); (((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (AP_TERM_TAC)); ((((use_arg_then2 ("CART_EQ", [CART_EQ]))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["i_in"])); ((((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"])) THEN ((((use_arg_then2 ("y'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); ((arith_tac) THEN (done_tac)); (((simp_tac) THEN (((use_arg_then2 ("ij", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); ((fun arg_tac -> arg_tac (Arg_term (`real_interval [&0, y$j - x$j]`))) (term_tac (set_tac "s"))); ((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"])))); (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] []))))) THEN (move ["t"]) THEN (move ["t_ineq"]) THEN (move ["i"]) THEN (move ["i_ineq"])); ((repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); ((((use_arg_then2 ("y'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"]))); (((((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((fun arg_tac -> (use_arg_then2 ("y_in", [])) (fun fst_arg -> (use_arg_then2 ("i_ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("ij", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); ((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"])))); ((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("in_s", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["p_in"])) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_ATREAL_WITHIN", [HAS_REAL_DERIVATIVE_ATREAL_WITHIN])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_ATREAL_WITHIN") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] []))))); ((fun arg_tac -> arg_tac (Arg_term (`f o _`))) (term_tac (set_tac "h"))); ((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 [] []))))))); ((((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["r"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); (((((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)); (((((use_arg_then2 ("derivative_translation", [derivative_translation]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("diff_imp_real_diff", [diff_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("diff_f", []))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("diff_direction", [diff_direction]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 <= y$j - x$j`))) (term_tac (have_gen_tac [](move ["pos"])))) ((((fun arg_tac -> (use_arg_then2 ("y_in", [])) (fun fst_arg -> (use_arg_then2 ("j_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("HAS_REAL_DERIVATIVE_INCREASING_IMP", [HAS_REAL_DERIVATIVE_INCREASING_IMP])) (fun fst_arg -> (use_arg_then2 ("g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\t. partial j f (y' + t % basis j)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y$j - x$j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("IS_REALINTERVAL_INTERVAL", [IS_REALINTERVAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((((use_arg_then2 ("ds", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (DISCH_THEN apply_tac)); ((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [2; 3] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("pos", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); ((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("in_s", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("partial_pos", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); ];; (* Lemma partial_decreasing_left *) let partial_decreasing_left = Sections.section_proof ["f";"j";"u";"x";"z";"hi"] `(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i) ==> u$j = x$j ==> (!y. y IN interval [x,z] ==> (lift o f) differentiable at y) ==> (!y. y IN interval [x,z] ==> partial j f y <= &0) ==> (!y. y IN interval [x,u] ==> f y <= hi) ==> (!y. y IN interval [x,z] ==> f y <= hi)` [ (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"])); ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("partial_increasing_left", [partial_increasing_left])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(\p. -- f p)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("u", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("z", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`--hi`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("u_eq_i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("u_eq_j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); ((THENL_FIRST) (ANTS_TAC) ((BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff_f", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("DIFFERENTIABLE_NEG", [DIFFERENTIABLE_NEG])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("f_lift_neg", [f_lift_neg]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); (ANTS_TAC); ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then2 ("partial_neg", [partial_neg]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff_f", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_NEG_GE0", [REAL_NEG_GE0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("partial_f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((THENL_FIRST) (ANTS_TAC) ((BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("f_bound", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (arith_tac) THEN (done_tac))); ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("y_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ];; (* Lemma partial_translation *) let partial_translation = Sections.section_proof ["f";"i";"p";"y"] `lift o f differentiable at (p + y) ==> partial i (f o (\x. p + x)) y = partial i f (p + y)` [ (BETA_TAC THEN (move ["diff"])); ((fun arg_tac -> arg_tac (Arg_term (`!net. (\x. p + x) differentiable net`))) (term_tac (have_gen_tac [](move ["diff_p"])))); ((BETA_TAC THEN (move ["net"])) THEN ((((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ID", [DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_CHAIN_AT", [DIFFERENTIABLE_CHAIN_AT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); ((((use_arg_then2 ("frechet_compose", [frechet_compose]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("frechet_add", [frechet_add]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_ID", [DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); ((((use_arg_then2 ("frechet_const", [frechet_const]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("frechet_id", [frechet_id]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_ADD_LID", [VECTOR_ADD_LID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_DEF", [I_DEF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("I_O_ID", [I_O_ID]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma partial_rev_translation *) let partial_rev_translation = Sections.section_proof ["f";"i";"p";"y"] `lift o f differentiable at (p - y) ==> partial i (f o (\x. p - x)) y = --partial i f (p - y)` [ (BETA_TAC THEN (move ["diff"])); ((fun arg_tac -> arg_tac (Arg_term (`!net. (\x. p - x) differentiable net`))) (term_tac (have_gen_tac [](move ["diff_p"])))); ((BETA_TAC THEN (move ["net"])) THEN ((((use_arg_then2 ("DIFFERENTIABLE_SUB", [DIFFERENTIABLE_SUB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ID", [DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_CHAIN_AT", [DIFFERENTIABLE_CHAIN_AT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); ((((use_arg_then2 ("frechet_compose", [frechet_compose]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("frechet_sub", [frechet_sub]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_ID", [DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); ((((use_arg_then2 ("frechet_const", [frechet_const]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("frechet_id", [frechet_id]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_LZERO)))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("partial_eq_frechet", [partial_eq_frechet]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); (((((use_arg_then2 ("LINEAR_NEG", [LINEAR_NEG]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("LINEAR_FRECHET_DERIVATIVE", [LINEAR_FRECHET_DERIVATIVE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DROP_NEG", [DROP_NEG]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma partial_increasing_right *) let partial_increasing_right = Sections.section_proof ["f";"j";"u";"x";"z";"hi"] `(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = x$i) ==> u$j = z$j ==> (!y. y IN interval [x,z] ==> (lift o f) differentiable at y) ==> (!y. y IN interval [x,z] ==> &0 <= partial j f y) ==> (!y. y IN interval [u,z] ==> f y <= hi) ==> (!y. y IN interval [x,z] ==> f y <= hi)` [ (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"])); (((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`j IN 1..dimindex (:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case)) THEN ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["j_in"]))); ((((use_arg_then2 ("f_bound", [])) (disch_tac [])) THEN (clear_assumption "f_bound") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("y_in", [])) (disch_tac [])) THEN (clear_assumption "y_in") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] []))))) THEN (move ["y_ineq"]) THEN (move ["i"]) THEN (move ["i_in"]))); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(i = j)`))) (term_tac (have_gen_tac [](move ["inj"])))) ((((use_arg_then2 ("i_in", [])) (disch_tac [])) THEN (clear_assumption "i_in") THEN ((use_arg_then2 ("j_in", [])) (disch_tac [])) THEN (clear_assumption "j_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); (((((use_arg_then2 ("u_eq_i", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_ineq", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("partial_decreasing_left", [partial_decreasing_left])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f o (\p:real^N. x + (z - p))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x + (z - u):real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("z", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("hi", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); (ANTS_TAC); ((BETA_TAC THEN (move ["i"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("u_eq_i", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["eq1"]) THEN (move ["inj"])) THEN ((((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] [])))))); (((((use_arg_then2 ("eq1", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); ((THENL_FIRST) (ANTS_TAC) (((((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("u_eq_j", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); ((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"])))); ((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"]))); ((((fun arg_tac -> (use_arg_then2 ("p_in", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); ((fun arg_tac -> arg_tac (Arg_term (`!y. _ y`))) (term_tac (set_tac "dP"))); ((fun arg_tac -> arg_tac (Arg_term (`dP`))) (term_tac (have_gen_tac [](move ["P"])))); ((((use_arg_then2 ("dP_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (BETA_TAC THEN (move ["p"]) THEN (move ["p_in"]))); (((((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CHAIN_AT", [DIFFERENTIABLE_CHAIN_AT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_SUB", [DIFFERENTIABLE_SUB]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_ID", [DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("diff_f", []))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("Hp", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("P", [])) (disch_tac [])) THEN (clear_assumption "P") THEN BETA_TAC THEN (simp_tac)) THEN ((((use_arg_then2 ("dP_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["diff"]))); (ANTS_TAC); (BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])); ((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"]))); ((((use_arg_then2 ("assoc", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("partial_rev_translation", [partial_rev_translation]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("assoc", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff_f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Hp", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); (((((use_arg_then2 ("REAL_NEG_LE0", [REAL_NEG_LE0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("partial_f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hp", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (ANTS_TAC); ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_bound", []))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("p_in", [])) (disch_tac [])) THEN (clear_assumption "p_in") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"]) THEN (move ["i"]) THEN (move ["i_ineq"]))); ((((fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("i_ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x + z - y:real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN ((((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); ((((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)); ((((use_arg_then2 ("Hp", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Finalization of the section PartialMonotone *) let derivative_translation = Sections.finalize_theorem derivative_translation;; let partial_increasing_left = Sections.finalize_theorem partial_increasing_left;; let partial_decreasing_left = Sections.finalize_theorem partial_decreasing_left;; let partial_translation = Sections.finalize_theorem partial_translation;; let partial_rev_translation = Sections.finalize_theorem partial_rev_translation;; let partial_increasing_right = Sections.finalize_theorem partial_increasing_right;; Sections.end_section "PartialMonotone";; (* Section Taylor *) Sections.begin_section "Taylor";; (* Lemma real_taylor2_bound *) let real_taylor2_bound = Sections.section_proof ["f";"dd_bound"] `nth_diff_strong_int 2 (&0, &1) f ==> (!t. interval_arith t (&0, &1) ==> abs (nth_derivative 2 f t) <= dd_bound) ==> abs (f (&1) - (f (&0) + derivative f (&0))) <= dd_bound / &2` [ (((((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_diff_strong2_eq_alt", [nth_diff_strong2_eq_alt]))(thm_tac (new_rewrite [] []))))) THEN (move ["df"]) THEN (move ["dd"])); ((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"))); ((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"]))); ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_TAYLOR", [REAL_TAYLOR])) (fun fst_arg -> (use_arg_then2 ("R", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`real_interval [&0, &1]`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("dd_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)); (((((use_arg_then2 ("IS_REALINTERVAL_INTERVAL", [IS_REALINTERVAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); ((BETA_TAC THEN (move ["i"]) THEN (move ["x"])) THEN ((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `i <= 1 <=> i = 0 \/ i = 1`)))(thm_tac (new_rewrite [] [])))))); (BETA_TAC THEN (case THEN ALL_TAC) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("df", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["s"])) THEN (move ["d_f"])); ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ((use_arg_then2 ("HAS_REAL_DERIVATIVE_ATREAL_WITHIN", [HAS_REAL_DERIVATIVE_ATREAL_WITHIN])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("d_f", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ((BETA_TAC THEN (move ["x"])) THEN (((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"]))); ((((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["d_f"])) THEN ((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("dd", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_01", [REAL_LE_01]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); ((((use_arg_then2 ("REAL_SUB_RZERO", [REAL_SUB_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_1", [REAL_ABS_1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_ONE", [REAL_POW_ONE]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `FACT (1 + 1) = 2`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [2] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL SUM_CLAUSES_NUMSEG)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_SING_NUMSEG", [SUM_SING_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 <= 1`)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `FACT 0 = 1 /\ FACT 1 = 1`)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_INV_1", [REAL_INV_1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))))); (((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma real_taylor1_bound *) let real_taylor1_bound = Sections.section_proof ["f";"d_bound"] `(!t. interval_arith t (&0, &1) ==> f real_differentiable atreal t /\ abs (derivative f t) <= d_bound) ==> abs (f (&1) - f (&0)) <= d_bound` [ (BETA_TAC THEN (move ["df"])); ((fun arg_tac -> arg_tac (Arg_term (`\i. if i = 0 then f else derivative f`))) (term_tac (set_tac "R"))); ((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 + 1 = 1 /\ ~(1 = 0)`))) (fun arg -> thm_tac MP_TAC arg THEN (move ["arithH"]))); ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_TAYLOR", [REAL_TAYLOR])) (fun fst_arg -> (use_arg_then2 ("R", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`real_interval [&0, &1]`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)); (((((use_arg_then2 ("IS_REALINTERVAL_INTERVAL", [IS_REALINTERVAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); ((BETA_TAC THEN (move ["i"]) THEN (move ["x"])) THEN ((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leqn0", [leqn0]))(thm_tac (new_rewrite [] [])))))); (BETA_TAC THEN (case THEN ALL_TAC) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("df", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN ((move ["diff_f"]) THEN (move ["df_bound"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); (((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ((use_arg_then2 ("HAS_REAL_DERIVATIVE_ATREAL_WITHIN", [HAS_REAL_DERIVATIVE_ATREAL_WITHIN])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ((BETA_TAC THEN (move ["x"])) THEN (((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"]))); ((((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["d_f"])) THEN ((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_01", [REAL_LE_01]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); ((((use_arg_then2 ("SUM_SING_NUMSEG", [SUM_SING_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_SUB_RZERO", [REAL_SUB_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_1", [REAL_ABS_1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_ONE", [REAL_POW_ONE]))(thm_tac (new_rewrite [] [])))))); ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `FACT 1 = 1 /\ FACT 0 = 1`)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_DIV_1", [REAL_DIV_1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))))); (((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("arithH", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; let m_taylor_error = new_definition `m_taylor_error f domain (w:real^N) error <=> !x:real^N. x IN interval [domain] ==> sum (1..dimindex (:N)) (\i. w$i * sum (1..dimindex (:N)) (\j. w$j * abs (partial j (partial i f) x))) <= error`;; let m_taylor_partial_error = new_definition `m_taylor_partial_error f i domain (w:real^N) error <=> (!x:real^N. x IN interval[domain] ==> sum (1..dimindex (:N)) (\j. w$j * abs (partial j (partial i f) x)) <= error)`;; (* Lemma taylor_error_eq_sum_partial_errors *) let taylor_error_eq_sum_partial_errors = Sections.section_proof ["f";"domain";"w";"p_error";"error"] `(!i. i IN 1..dimindex (:N) ==> m_taylor_partial_error f i domain w (p_error i) /\ &0 <= w$i) ==> sum (1..dimindex (:N)) (\i. w$i * p_error i) <= error ==> m_taylor_error f domain (w:real^N) error` [ (((((use_arg_then2 ("m_taylor_partial_error", [m_taylor_partial_error]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("m_taylor_error", [m_taylor_error]))(thm_tac (new_rewrite [] []))))) THEN (move ["partialH"]) THEN (move ["ineq"]) THEN (move ["p"]) THEN (move ["p_in"])); (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); (((use_arg_then2 ("SUM_LE", [SUM_LE])) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac))); (((((use_arg_then2 ("REAL_LE_LMUL", [REAL_LE_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("partialH", [])) (fun fst_arg -> (use_arg_then2 ("i_ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; let partial2 = new_definition `partial2 j i f = partial j (partial i f)`;; let diff2 = new_definition `diff2 f x <=> ?s. open s /\ x IN s /\ (!y. y IN s ==> (lift o f) differentiable at y /\ (!i. (lift o partial i f) differentiable at y))`;; let diff2c = new_definition `diff2c f x <=> diff2 f x /\ (!i j. (lift o partial2 j i f) continuous at x)`;; (* Lemma diff2c_imp_diff2 *) let diff2c_imp_diff2 = Sections.section_proof ["f";"x"] `diff2c f x ==> diff2 f x` [ (((((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); ];; (* Lemma diff2_eq_diff2_on_open *) let diff2_eq_diff2_on_open = Sections.section_proof ["f";"x"] `diff2 f x <=> ?s. open s /\ x IN s /\ (!y. y IN s ==> diff2 f y)` [ ((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]))); (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["ys"])) THEN ((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (done_tac)); ((((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["df2"])) THEN (((use_arg_then2 ("df", [])) (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC THEN (move ["_"]))); (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (done_tac)); ];; (* Lemma diff2_imp_real_diff *) let diff2_imp_real_diff = Sections.section_proof ["f";"x";"e";"t"] `diff2 f (x + t % e) ==> f o (\t. x + t % e) real_differentiable atreal t` [ ((((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); (((use_arg_then2 ("diff_imp_real_diff", [diff_imp_real_diff])) (thm_tac apply_tac)) THEN ((simp_tac) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("diff_direction", [diff_direction]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_dir_derivative *) let diff2_dir_derivative = Sections.section_proof ["f";"x";"e";"t"] `diff2 f (x + t % e:real^N) ==> derivative (f o (\t. x + t % e)) t = sum (1..dimindex (:N)) (\i. e$i * (partial i f o (\t. x + t % e)) t)` [ ((((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("real_dir_derivative_partial", [real_dir_derivative_partial]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_partial_real_diff *) let diff2_partial_real_diff = Sections.section_proof ["f";"i";"x";"e";"t"] `diff2 f (x + t % e:real^N) ==> partial i f o (\t. x + t % e) real_differentiable atreal t` [ ((((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); (((((use_arg_then2 ("diff_imp_real_diff", [diff_imp_real_diff]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("diff_direction", [diff_direction]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma in_trans *) let in_trans = Sections.section_proof ["x";"s";"t"] `t SUBSET s ==> x IN t ==> x IN s` [ ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["sub"]) THEN (move ["xt"])); (((use_arg_then2 ("sub", [])) (disch_tac [])) THEN (clear_assumption "sub") THEN (exact_tac)); ];; (* Lemma open_contains_open_interval *) let open_contains_open_interval = Sections.section_proof ["e";"s";"x"] `open s ==> x IN s ==> ?a b. &0 IN real_interval (a, b) /\ IMAGE (\t. x + t % e) (real_interval (a, b)) SUBSET s` [ ((((use_arg_then2 ("OPEN_CONTAINS_BALL", [OPEN_CONTAINS_BALL]))(thm_tac (new_rewrite [] [])))) THEN (move ["open_s"])); (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("open_s", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["ball_s"])) THEN (((use_arg_then2 ("open_s", [])) (disch_tac [])) THEN (clear_assumption "open_s") THEN BETA_TAC THEN (move ["_"]))); ((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`norm e = &0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [ALL_TAC; (move ["n0"])]); (((((use_arg_then2 ("NORM_EQ_0", [NORM_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_term (`--d`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("d", [])) (term_tac exists_tac)))); ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); ((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (case THEN (move ["t"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_MUL_RZERO)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))))); (((((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("ball_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CENTRE_IN_BALL", [CENTRE_IN_BALL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((fun arg_tac -> arg_tac (Arg_term (`((d / &2) * inv(norm e)) % e`))) (term_tac (set_tac "y"))); ((fun arg_tac -> arg_tac (Arg_term (`norm y = d / &2`))) (term_tac (have_gen_tac [](move ["norm_y"])))); ((((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("VECTOR_MUL_ASSOC", [VECTOR_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ABS_INV", [REAL_ABS_INV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_NORM", [REAL_ABS_NORM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); ((((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((((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)); ((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_LT0", [REAL_NEG_LT0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbb", [andbb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_INV", [REAL_LT_INV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("NORM_POS_LT", [NORM_POS_LT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("NORM_EQ_0", [NORM_EQ_0]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); ((((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (((use_arg_then2 ("SUBSET_TRANS", [SUBSET_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`ball (x, d)`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("ball_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["p"]) THEN (case THEN (move ["t"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["t_in"]) THEN (simp_tac))); ((((use_arg_then2 ("IN_BALL", [IN_BALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_RADD", [VECTOR_SUB_RADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_NEG", [NORM_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] []))))); ((THENL_LAST) ((((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`d / &2`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); ((((fun arg_tac -> (use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`d / &2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_RMUL", [REAL_LE_RMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_POS_LE", [NORM_POS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("t_in", [])) (disch_tac [])) THEN (clear_assumption "t_in") THEN BETA_TAC) THEN (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); ];; (* Lemma diff2_dir *) let diff2_dir = Sections.section_proof ["f";"x";"e";"t"] `diff2 f (x + t % e:real^N) ==> nth_diff_strong 2 (f o (\t. x + t % e)) t` [ (((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("open_contains_open_interval", [open_contains_open_interval])) (fun fst_arg -> (use_arg_then2 ("e", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("open_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["in0"])) THEN (move ["sub"])); (((fun arg_tac -> arg_tac (Arg_term (`real_interval (a + t, b + t)`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); ((((use_arg_then2 ("in0", [])) (disch_tac [])) THEN (clear_assumption "in0") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (move ["p"]) THEN (move ["p_int"])); ((fun arg_tac -> arg_tac (Arg_term (`x + p % e IN s`))) (term_tac (have_gen_tac [](move ["xp_in"])))); ((((use_arg_then2 ("sub", [])) (disch_tac [])) THEN (clear_assumption "sub") THEN BETA_TAC) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN ((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`p - t`))) (term_tac exists_tac))); (((THENL) (split_tac) [(VECTOR_ARITH_TAC); ((((use_arg_then2 ("p_int", [])) (disch_tac [])) THEN (clear_assumption "p_int") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac))]) THEN (done_tac)); ((((use_arg_then2 ("diff2_imp_real_diff", [diff2_imp_real_diff]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); ((use_arg_then2 ("differentiable_local", [differentiable_local])) (thm_tac apply_tac)); ((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)); ((fun arg_tac -> arg_tac (Arg_term (`min (p - (a + t)) (b + t - p)`))) (term_tac (set_tac "d"))); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < d`))) (term_tac (have_gen_tac [](move ["d0"])))) ((((use_arg_then2 ("p_int", [])) (disch_tac [])) THEN (clear_assumption "p_int") THEN BETA_TAC) THEN ((((use_arg_then2 ("d_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); (((fun arg_tac -> arg_tac (Arg_term (`real_interval (p - d, p + d)`))) (term_tac exists_tac)) THEN (split_tac)); ((((use_arg_then2 ("differentiable_sum_numseg", [differentiable_sum_numseg]))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac)); (((((use_arg_then2 ("REAL_DIFFERENTIABLE_MUL_ATREAL", [REAL_DIFFERENTIABLE_MUL_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); (((((use_arg_then2 ("diff2_partial_real_diff", [diff2_partial_real_diff]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); ((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((BETA_TAC THEN (move ["y"]) THEN (move ["y_in"])) THEN ((((use_arg_then2 ("diff2_dir_derivative", [diff2_dir_derivative]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("sub", [])) (disch_tac [])) THEN (clear_assumption "sub") THEN BETA_TAC) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN ((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`y - t`))) (term_tac exists_tac))); ((THENL_FIRST) (split_tac) ((VECTOR_ARITH_TAC) THEN (done_tac))); ((((use_arg_then2 ("p_int", [])) (disch_tac [])) THEN (clear_assumption "p_int") THEN ((use_arg_then2 ("d_def", [])) (disch_tac [])) THEN (clear_assumption "d_def") THEN ((use_arg_then2 ("y_in", [])) (disch_tac [])) THEN (clear_assumption "y_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); ];; (* Lemma diff2_dir_derivative2 *) let diff2_dir_derivative2 = Sections.section_proof ["f";"x";"e";"t"] `diff2 f (x + t % e:real^N) ==> nth_derivative 2 (f o (\t. x + t % e)) t = sum (1..dimindex (:N)) (\i. sum (1..dimindex (:N)) (\j. e$i * e$j * (partial j (partial i f) o (\t. x + t % e)) t))` [ ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); ((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac))); (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)); (((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)); (((use_arg_then2 ("HAS_REAL_DERIVATIVE_SUM", [HAS_REAL_DERIVATIVE_SUM])) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac))); (((((use_arg_then2 ("SUM_LMUL", [SUM_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LMUL_ATREAL", [HAS_REAL_DERIVATIVE_LMUL_ATREAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); (((use_arg_then2 ("real_dir_derivative_partial", [real_dir_derivative_partial]))(thm_tac (new_rewrite [] [])))); ((((fun arg_tac -> (use_arg_then2 ("df", [])) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["r"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xr"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("open_contains_open_interval", [open_contains_open_interval])) (fun fst_arg -> (use_arg_then2 ("e", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("open_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["in0"])) THEN (move ["sub"])); (((fun arg_tac -> arg_tac (Arg_term (`real_interval (a + t, b + t)`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); ((((use_arg_then2 ("in0", [])) (disch_tac [])) THEN (clear_assumption "in0") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then2 ("diff2_dir_derivative", [diff2_dir_derivative]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("sub", [])) (disch_tac [])) THEN (clear_assumption "sub") THEN BETA_TAC) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN ((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`p - t`))) (term_tac exists_tac))); ((THENL_FIRST) (split_tac) ((VECTOR_ARITH_TAC) THEN (done_tac))); ((((use_arg_then2 ("p_in", [])) (disch_tac [])) THEN (clear_assumption "p_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); ];; (* Lemma diff2_has_derivative_partial *) let diff2_has_derivative_partial = Sections.section_proof ["f";"i";"x";"e";"t"] `diff2 f (x + t % e:real^N) ==> (partial i f o (\t. x + t % e) has_real_derivative sum (1..dimindex (:N)) (\j. e$j * (partial j (partial i f) o (\t. x + t % e)) t)) (atreal t)` [ ((((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); (((((use_arg_then2 ("real_dir_derivative_partial", [real_dir_derivative_partial]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_derivative_partial *) let diff2_derivative_partial = Sections.section_proof ["f";"i";"x";"e";"t"] `diff2 f (x + t % e:real^N) ==> derivative (partial i f o (\t. x + t % e)) t = sum (1..dimindex (:N)) (\j. e$j * (partial j (partial i f) o (\t. x + t % e)) t)` [ ((BETA_TAC THEN (move ["df"])) THEN (((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("diff2_has_derivative_partial", [diff2_has_derivative_partial])) (disch_tac [])) THEN (clear_assumption "diff2_has_derivative_partial") THEN (exact_tac)) THEN (done_tac)); ];; (* Lemma diff2_real_diff_partial *) let diff2_real_diff_partial = Sections.section_proof ["f";"i";"x";"e";"t"] `diff2 f (x + t % e:real^N) ==> partial i f o (\t. x + t % e) real_differentiable atreal t` [ (BETA_TAC THEN (move ["df2"])); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2_has_derivative_partial", [diff2_has_derivative_partial])) (fun fst_arg -> (use_arg_then2 ("df2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s")))); (((((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] [])))) THEN (move ["df"])) THEN ((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (done_tac)); ];; (* Lemma partial_const *) let partial_const = Sections.section_proof ["i";"c"] `partial i (\x:real^N. c) = (\x. &0)` [ (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac)); (((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 [] [])))))))); ((((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma partial_eq0_alt *) let partial_eq0_alt = Sections.section_proof ["i";"f"] `~(i IN 1..dimindex (:N)) ==> partial i f = (\x:real^N. &0)` [ ((BETA_TAC THEN (move ["ih"])) THEN ((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (move ["x"])) THEN (((use_arg_then2 ("partial_eq0", [partial_eq0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma real_mvt0 *) let real_mvt0 = Sections.section_proof [] `!f f' a. (!x. abs x <= abs a ==> (f has_real_derivative f' x) (atreal x)) ==> (?t. abs t <= abs a /\ f a - f (&0) = f' t * a)` [ (BETA_TAC THEN (move ["f"]) THEN (move ["f'"]) THEN (move ["a"]) THEN (move ["h"])); (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0 <= a`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["a_ineq"])); ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_MVT_VERY_SIMPLE", [REAL_MVT_VERY_SIMPLE])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); (((((use_arg_then2 ("a_ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))))) THEN (ANTS_TAC)); (BETA_TAC THEN (move ["x"]) THEN (move ["x_ineq"])); (((((use_arg_then2 ("HAS_REAL_DERIVATIVE_ATREAL_WITHIN", [HAS_REAL_DERIVATIVE_ATREAL_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["t_ineq"])) THEN (move ["eq"])); (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_MVT_VERY_SIMPLE", [REAL_MVT_VERY_SIMPLE])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); ((repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (ANTS_TAC)); ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("a_ineq", [])) (disch_tac [])) THEN (clear_assumption "a_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); ((BETA_TAC THEN (move ["x"]) THEN (move ["x_ineq"])) THEN ((((use_arg_then2 ("HAS_REAL_DERIVATIVE_ATREAL_WITHIN", [HAS_REAL_DERIVATIVE_ATREAL_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["t_ineq"])) THEN (move ["eq"])); (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("REAL_NEG_SUB", [REAL_NEG_SUB]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_RMUL", [REAL_NEG_RMUL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ];; (* Lemma mixed_second_partials *) let mixed_second_partials = Sections.section_proof ["f";"x";"i";"j"] `diff2c f x ==> partial2 i j f x = partial2 j i f (x:real^N)` [ (((((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["pc"])))); ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i IN 1..dimindex (:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["ih"]))); (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("partial_eq0_alt", [partial_eq0_alt])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("partial_const", [partial_const]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`j IN 1..dimindex (:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["jh"]))); (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("partial_eq0_alt", [partial_eq0_alt])) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("partial_const", [partial_const]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("jh", [])) (disch_tac [])) THEN (clear_assumption "jh") THEN ((use_arg_then2 ("ih", [])) (disch_tac [])) THEN (clear_assumption "ih") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (move ["ih"]) THEN (move ["jh"]))); ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["d2f"]))); ((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"))); ((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"))); ((fun arg_tac -> arg_tac (Arg_term (`\h k. F1 h k - F1 h (&0)`))) (term_tac (set_tac "G"))); ((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))); ((fun arg_tac -> arg_tac (Arg_term (`G = \h k. F2 k h - F2 k (&0)`))) (term_tac (have_gen_tac [](move ["G_eq"])))); ((repeat_tactic 2 0 (((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["h"]) THEN (move ["k"])); (((((use_arg_then2 ("G_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("F2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("F1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); ((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"])))))))); ((((use_arg_then2 ("open_s", [])) (disch_tac [])) THEN (clear_assumption "open_s") THEN BETA_TAC) THEN (((((use_arg_then2 ("OPEN_CONTAINS_BALL", [OPEN_CONTAINS_BALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_BALL", [IN_BALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (case THEN (move ["e"])) THEN (case THEN ((move ["e0"]) THEN (move ["de"]))))); ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`e / &3`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then2 ("e0", [])) (disch_tac [])) THEN (clear_assumption "e0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); (BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])); ((((use_arg_then2 ("de", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("VECTOR_SUB_RADD", [VECTOR_SUB_RADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_NEG", [NORM_NEG]))(thm_tac (new_rewrite [] []))))); ((THENL_LAST) ((((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`e / &3 + e / &3`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then2 ("e0", [])) (disch_tac [])) THEN (clear_assumption "e0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); ((THENL_LAST) ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`abs h + abs k`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("NORM_TRIANGLE", [NORM_TRIANGLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`h % basis i:real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`k % basis j:real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); (((repeat_tactic 1 9 (((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NORM_BASIS", [NORM_BASIS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((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"])))); ((THENL) (split_tac) [((move ["h"]) THEN (move ["h_ineq"])); ((move ["k"]) THEN (move ["k_ineq"]))]); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("rs", [])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h_ineq", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("r0", [])) (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("rs", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("k_ineq", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("r0", [])) (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((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"])))); (((((use_arg_then2 ("F1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((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"])))); (BETA_TAC THEN (move ["h"]) THEN (move ["h_ineq"]) THEN (move ["k"]) THEN (move ["k_ineq"])); (((((use_arg_then2 ("F1h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_SUB", [REAL_DIFFERENTIABLE_SUB]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); (((repeat_tactic 1 9 (((use_arg_then2 ("diff2_imp_real_diff", [diff2_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==> 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"])))); ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then2 ("F1h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_sub", [derivative_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("diff2_imp_real_diff", [diff2_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); (((((use_arg_then2 ("derivative_translation", [derivative_translation]))(thm_tac (new_rewrite [] [(`derivative (f o (\k. x + k % basis j)) k`)])))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("derivative_translation", [derivative_translation]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("diff2_imp_real_diff", [diff2_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); ((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"])))); (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("partial", [partial]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==> (?t1. G h k = k * derivative (F1 h) t1 /\ abs t1 <= abs k)`))) (term_tac (have_gen_tac [](move ["Gh"])))); ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then2 ("G_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac))); ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_mvt0", [real_mvt0])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`F1 h`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative (F1 h)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); (ANTS_TAC); ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN ((((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dF1", []))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (case THEN (move ["t1"])) THEN (case THEN (move ["t1_ineq"])) THEN (move ["eq"])); (((use_arg_then2 ("t1", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t1_ineq", [])) (disch_tac [])) THEN (clear_assumption "t1_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==> (?t1 t2. G h k = h * k * partial i (partial j f) (x + t1 % basis j + t2 % basis i) /\ abs t1 <= abs k /\ abs t2 <= abs h)`))) (term_tac (have_gen_tac [](move ["Ghk"])))); (BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Gh", [])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t1"])) THEN (case THEN ((move ["eq"]) THEN (move ["t1k"]))))); ((THENL) ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (((use_arg_then2 ("F1_der", []))(thm_tac (new_rewrite [] []))))) [((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t1k", [])) (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (move ["eq"]))]); ((fun arg_tac -> arg_tac (Arg_term (`partial j f o (\h. (x + t1 % basis j) + h % basis i)`))) (term_tac (set_tac "g"))); ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_mvt0", [real_mvt0])) (fun fst_arg -> (use_arg_then2 ("g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative g`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); (ANTS_TAC); ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("diff2_partial_real_diff", [diff2_partial_real_diff]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then2 ("t1k", [])) (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (case THEN (move ["t2"])) THEN (case THEN (move ["t2_ineq"])) THEN (move ["g_eq"])); ((THENL_LAST) ((((use_arg_then2 ("t1", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("t2", [])) (term_tac exists_tac))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t2_ineq", [])) (disch_tac [])) THEN (clear_assumption "t2_ineq") THEN ((use_arg_then2 ("t1k", [])) (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); ((fun arg_tac -> arg_tac (Arg_term (`_1 - _2`))) (term_tac (set_tac "p"))); ((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 [] []))))))); (((((use_arg_then2 ("p_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. k * a * h = h * k * a`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))))); (((((use_arg_then2 ("REAL_EQ_MUL_LCANCEL", [REAL_EQ_MUL_LCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISJ2_TAC)); (((use_arg_then2 ("derivative_translation", [derivative_translation]))(thm_tac (new_rewrite [] [])))); (((((use_arg_then2 ("diff2_partial_real_diff", [diff2_partial_real_diff]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t2_ineq", [])) (disch_tac [])) THEN (clear_assumption "t2_ineq") THEN ((use_arg_then2 ("t1k", [])) (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] [])))) THEN (AP_THM_TAC) THEN (AP_TERM_TAC)); (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); (((use_arg_then2 ("F1_def", [])) (disch_tac [])) THEN (clear_assumption "F1_def") THEN ((use_arg_then2 ("G_def", [])) (disch_tac [])) THEN (clear_assumption "G_def") THEN ((use_arg_then2 ("F1h", [])) (disch_tac [])) THEN (clear_assumption "F1h") THEN ((use_arg_then2 ("dF1", [])) (disch_tac [])) THEN (clear_assumption "dF1") THEN ((use_arg_then2 ("F1_der", [])) (disch_tac [])) THEN (clear_assumption "F1_der") THEN ((use_arg_then2 ("Gh", [])) (disch_tac [])) THEN (clear_assumption "Gh") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"])); ((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"])))); (((((use_arg_then2 ("F2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((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"])))); (BETA_TAC THEN (move ["k"]) THEN (move ["k_ineq"]) THEN (move ["h"]) THEN (move ["h_ineq"])); (((((use_arg_then2 ("F2h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_SUB", [REAL_DIFFERENTIABLE_SUB]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); (((repeat_tactic 1 9 (((use_arg_then2 ("diff2_imp_real_diff", [diff2_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==> 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"])))); ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then2 ("F2h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_sub", [derivative_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("diff2_imp_real_diff", [diff2_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); (((((use_arg_then2 ("v_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("derivative_translation", [derivative_translation]))(thm_tac (new_rewrite [] [(`derivative (f o (\h. x + h % basis i)) h`)])))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("derivative_translation", [derivative_translation]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("diff2_imp_real_diff", [diff2_imp_real_diff]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("v_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))))); ((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"])))); (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("partial", [partial]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==> (?t3. G h k = h * derivative (F2 k) t3 /\ abs t3 <= abs h)`))) (term_tac (have_gen_tac [](move ["Gk"])))); ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then2 ("G_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_mvt0", [real_mvt0])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`F2 k`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative (F2 k)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); (ANTS_TAC); ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN ((((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dF2", []))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (case THEN (move ["t3"])) THEN (case THEN (move ["t3_ineq"])) THEN (move ["eq"])); (((use_arg_then2 ("t3", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t3_ineq", [])) (disch_tac [])) THEN (clear_assumption "t3_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==> (?t3 t4. G h k = h * k * partial j (partial i f) (x + t4 % basis j + t3 % basis i) /\ abs t3 <= abs h /\ abs t4 <= abs k)`))) (term_tac (have_gen_tac [](move ["Gkh"])))); (BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Gk", [])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t3"])) THEN (case THEN ((move ["eq"]) THEN (move ["t3h"]))))); ((THENL) ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (((use_arg_then2 ("F2_der", []))(thm_tac (new_rewrite [] []))))) [((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t3h", [])) (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (move ["eq"]))]); ((fun arg_tac -> arg_tac (Arg_term (`partial i f o (\k. (x + t3 % basis i) + k % basis j)`))) (term_tac (set_tac "g"))); ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_mvt0", [real_mvt0])) (fun fst_arg -> (use_arg_then2 ("g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative g`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); (ANTS_TAC); ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN (((use_arg_then2 ("has_derivative_alt", [has_derivative_alt]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("diff2_partial_real_diff", [diff2_partial_real_diff]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then2 ("t3h", [])) (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (case THEN (move ["t4"])) THEN (case THEN (move ["t4_ineq"])) THEN (move ["g_eq"])); ((THENL_LAST) ((((use_arg_then2 ("t3", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("t4", [])) (term_tac exists_tac))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t4_ineq", [])) (disch_tac [])) THEN (clear_assumption "t4_ineq") THEN ((use_arg_then2 ("t3h", [])) (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); ((fun arg_tac -> arg_tac (Arg_term (`_1 - _2`))) (term_tac (set_tac "p"))); ((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 [] []))))))); (((((use_arg_then2 ("p_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. h * a * k = h * k * a`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))))); (((((use_arg_then2 ("REAL_EQ_MUL_LCANCEL", [REAL_EQ_MUL_LCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISJ2_TAC)); (((use_arg_then2 ("derivative_translation", [derivative_translation]))(thm_tac (new_rewrite [] [])))); (((((use_arg_then2 ("diff2_partial_real_diff", [diff2_partial_real_diff]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then2 ("t4_ineq", [])) (disch_tac [])) THEN (clear_assumption "t4_ineq") THEN ((use_arg_then2 ("t3h", [])) (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] [])))) THEN (AP_THM_TAC) THEN (AP_TERM_TAC)); (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (move ["y"])); ((AP_TERM_TAC) THEN (VECTOR_ARITH_TAC) THEN (done_tac)); (((use_arg_then2 ("F2_def", [])) (disch_tac [])) THEN (clear_assumption "F2_def") THEN ((use_arg_then2 ("G_eq", [])) (disch_tac [])) THEN (clear_assumption "G_eq") THEN ((use_arg_then2 ("F2h", [])) (disch_tac [])) THEN (clear_assumption "F2h") THEN ((use_arg_then2 ("dF2", [])) (disch_tac [])) THEN (clear_assumption "dF2") THEN ((use_arg_then2 ("F2_der", [])) (disch_tac [])) THEN (clear_assumption "F2_der") THEN ((use_arg_then2 ("Gk", [])) (disch_tac [])) THEN (clear_assumption "Gk") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"])); ((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"])))); (((((use_arg_then2 ("limit_point_of", [limit_point_of]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("OPEN_CONTAINS_BALL", [OPEN_CONTAINS_BALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_BALL", [IN_BALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN (move ["t"]) THEN (case THEN (move ["v0t"]))); (((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("v0t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC THEN (case THEN (move ["e"])) THEN (case THEN (move ["e0"])) THEN (move ["in_t"])); ((fun arg_tac -> arg_tac (Arg_term (`e / &2 % (vec 1:real^2)`))) (term_tac (set_tac "y"))); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`!i. y$i = e / (&2)`))) (term_tac (have_gen_tac [](move ["yc"])))) (((((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VEC_COMPONENT", [VEC_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < e / (&2)`))) (term_tac (have_gen_tac [](move ["ineq"])))) (((((use_arg_then2 ("REAL_LT_DIV", [REAL_LT_DIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e0", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); ((fun arg_tac -> arg_tac (Arg_term (`infnorm y = e / &2`))) (term_tac (have_gen_tac [](move ["inf_y"])))); (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL INFNORM_2)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("yc", []))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL (CONJUNCT2 REAL_MAX_ACI))))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_REFL", [REAL_ABS_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_LT", [REAL_LE_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((THENL_FIRST) (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (split_tac)) (((((use_arg_then2 ("INFNORM_EQ_0", [INFNORM_EQ_0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inf_y", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); ((THENL_FIRST) (split_tac) (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("yc", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); ((((use_arg_then2 ("in_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`e * inv(&2) * sqrt(&2)`))) (term_tac exists_tac)) THEN (split_tac)); ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`infnorm y * sqrt (&2)`))) (term_tac exists_tac)) THEN (split_tac)); (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_MUL_AC)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_SUB", [NORM_SUB]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_RZERO)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIMINDEX_2", [DIMINDEX_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NORM_LE_INFNORM", [NORM_LE_INFNORM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((((use_arg_then2 ("inf_y", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((fun arg_tac -> (use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID])) (fun fst_arg -> (use_arg_then2 ("e", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("REAL_LT_LMUL", [REAL_LT_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); (((((fun arg_tac -> (use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_LMUL", [REAL_LT_LMUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_INV", [REAL_LT_INV]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (TRY ((arith_tac)))); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&2 = sqrt (&2 * &2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [2] []))))))) (((((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POW_2_SQRT_ABS", [POW_2_SQRT_ABS]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); ((((use_arg_then2 ("SQRT_MONO_LT", [SQRT_MONO_LT]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); ((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)) (at (vec 0) within {y | &0 < y$1 /\ &0 < y$2})`))) (term_tac (have_gen_tac [](move ["lim_ji"])))); ((((use_arg_then2 ("LIM_WITHIN", [LIM_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (move ["e"]) THEN (move ["e_gt0"])); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("pc", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL continuous_at)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["e_ineq"]))); ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`min r (d / &2)`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("REAL_LT_MIN", [REAL_LT_MIN]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN ((use_arg_then2 ("r0", [])) (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); (((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"])); ((fun arg_tac -> arg_tac (Arg_term (`&0 < abs (y$1) /\ &0 < abs (y$2)`))) (term_tac (have_gen_tac [](move ["y0"])))); ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z_ineq"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["_"]))); ((((use_arg_then2 ("z_ineq", [])) (disch_tac [])) THEN (clear_assumption "z_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((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"])))); ((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))); ((((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`norm y`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("INFNORM_LE_NORM", [INFNORM_LE_NORM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Gkh", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y$1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y$2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); (((repeat_tactic 1 9 (((use_arg_then2 ("yr", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t1"])) THEN (case THEN (move ["t2"])) THEN (case THEN (move ["G_eq"])) THEN (move ["t_ineq"])); ((((use_arg_then2 ("G_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_MUL_AC)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y0", [])) (disch_tac [])) THEN (clear_assumption "y0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((((use_arg_then2 ("e_ineq", [])) (disch_tac [])) THEN (clear_assumption "e_ineq") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_SUB)))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`norm (t2 % basis j:real^N) + norm (t1 % basis i:real^N)`))) (term_tac exists_tac))); ((((use_arg_then2 ("NORM_TRIANGLE", [NORM_TRIANGLE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NORM_BASIS", [NORM_BASIS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("yr", [])) (disch_tac [])) THEN (clear_assumption "yr") THEN ((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((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)) (at (vec 0) within {y | &0 < y$1 /\ &0 < y$2})`))) (term_tac (have_gen_tac [](move ["lim_ij"])))); ((((use_arg_then2 ("LIM_WITHIN", [LIM_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (move ["e"]) THEN (move ["e_gt0"])); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("pc", [])) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL continuous_at)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["e_ineq"]))); ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`min r (d / &2)`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("REAL_LT_MIN", [REAL_LT_MIN]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then2 ("d0", [])) (disch_tac [])) THEN (clear_assumption "d0") THEN ((use_arg_then2 ("r0", [])) (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); (((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"])); ((fun arg_tac -> arg_tac (Arg_term (`&0 < abs (y$1) /\ &0 < abs (y$2)`))) (term_tac (have_gen_tac [](move ["y0"])))); ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z_ineq"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["_"]))); ((((use_arg_then2 ("z_ineq", [])) (disch_tac [])) THEN (clear_assumption "z_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((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"])))); ((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))); ((((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`norm y`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("INFNORM_LE_NORM", [INFNORM_LE_NORM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Ghk", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y$1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y$2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); (((repeat_tactic 1 9 (((use_arg_then2 ("yr", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t1"])) THEN (case THEN (move ["t2"])) THEN (case THEN (move ["G_eq"])) THEN (move ["t_ineq"])); ((((use_arg_then2 ("G_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_MUL_AC)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y0", [])) (disch_tac [])) THEN (clear_assumption "y0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((((use_arg_then2 ("e_ineq", [])) (disch_tac [])) THEN (clear_assumption "e_ineq") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_SUB)))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`norm (t1 % basis j:real^N) + norm (t2 % basis i:real^N)`))) (term_tac exists_tac))); ((((use_arg_then2 ("NORM_TRIANGLE", [NORM_TRIANGLE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NORM_BASIS", [NORM_BASIS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("yr", [])) (disch_tac [])) THEN (clear_assumption "yr") THEN ((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((((use_arg_then2 ("LIFT_EQ", [LIFT_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> (use_arg_then2 ("LIM_UNIQUE", [LIM_UNIQUE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`at (vec 0:real^2) within {y:real^2 | &0 < y$1 /\ &0 < y$2}`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac))); ((fun arg_tac -> arg_tac (Arg_term (`\y:real^2. lift (G (y$1) (y$2) / (y$1 * y$2))`))) (term_tac exists_tac)); (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL TRIVIAL_LIMIT_WITHIN)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lim0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; let m_cell_domain = new_definition `m_cell_domain (x:real^N, z:real^N) (y:real^N) (w:real^N) <=> !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`;; let m_bounded_on_int = new_definition `m_bounded_on_int (f:real^N->real) domain f_bounds <=> !x. x IN interval [domain] ==> interval_arith (f x) f_bounds`;; let diff2_domain = new_definition `diff2_domain domain f <=> !x. x IN interval [domain] ==> diff2 f x`;; let diff2c_domain = new_definition `diff2c_domain domain f <=> !x. x IN interval [domain] ==> diff2c f x`;; (* Lemma diff2c_domain_alt *) let diff2c_domain_alt = Sections.section_proof ["f";"domain"] `diff2c_domain domain f <=> diff2_domain domain f /\ (!x. x IN interval [domain] ==> !i j. (lift o partial2 j i f) continuous at x)` [ (((((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [(move ["h1"]); ((case THEN ((move ["h1"]) THEN (move ["h2"]))) THEN (move ["x"]) THEN (move ["h3"]))])); (((split_tac) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("h1", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (simp_tac)) THEN (done_tac)); ((((fun arg_tac -> (use_arg_then2 ("h1", [])) (fun fst_arg -> (use_arg_then2 ("h3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("h2", [])) (fun fst_arg -> (use_arg_then2 ("h3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac)); ];; (* Lemma y_in_domain *) let y_in_domain = Sections.section_proof ["domain";"y";"w"] `m_cell_domain domain y w ==> y IN interval [domain]` [ ((((use_arg_then2 ("domain", [])) (disch_tac [])) THEN (clear_assumption "domain") THEN case THEN (move ["x"]) THEN (move ["z"])) THEN (((((use_arg_then2 ("m_cell_domain", [m_cell_domain]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (move ["ineqs"]) THEN (move ["i"]))); (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("ineqs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac)); ];; (* Lemma domain_width *) let domain_width = Sections.section_proof ["p";"domain";"y";"w"] `m_cell_domain domain y (w:real^N) ==> p IN interval [domain] ==> !i. i IN 1..dimindex (:N) ==> abs (p$i - y$i) <= w$i` [ ((((use_arg_then2 ("domain", [])) (disch_tac [])) THEN (clear_assumption "domain") THEN case THEN (move ["x"]) THEN (move ["z"])) THEN ((((use_arg_then2 ("m_cell_domain", [m_cell_domain]))(thm_tac (new_rewrite [] [])))) THEN (move ["ineqs"]) THEN (move ["p_in"]) THEN (move ["i"]) THEN (move ["i_in"]))); ((((fun arg_tac -> (use_arg_then2 ("ineqs", [])) (fun fst_arg -> (use_arg_then2 ("i_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("p_in", [])) (disch_tac [])) THEN (clear_assumption "p_in") THEN BETA_TAC) THEN (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("i_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (arith_tac) THEN (done_tac)); ];; (* Lemma sum_swap1 *) let sum_swap1 = Sections.section_proof ["g";"n"] `sum (1..n) (\i. sum (i + 1..n) (\j. g i j)) = sum (1..n) (\i. sum (1..i - 1) (\j. g j i))` [ ((repeat_tactic 1 9 (((use_arg_then2 ("SUM_SUM_PRODUCT", [SUM_SUM_PRODUCT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))))); ((fun arg_tac -> arg_tac (Arg_term (`{i, j | (1 <= i /\ i <= n) /\ i + 1 <= j /\ j <= n}`))) (term_tac (set_tac "s1"))); ((fun arg_tac -> arg_tac (Arg_term (`{i, j | (1 <= i /\ i <= n) /\ 1 <= j /\ j <= i - 1}`))) (term_tac (set_tac "s2"))); ((fun arg_tac -> arg_tac (Arg_term (`\(i,j):num#num. j, i`))) (term_tac (set_tac "f"))); ((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 [] []))))))); ((((((use_arg_then2 ("s1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["p"])) THEN (split_tac)); (BETA_TAC THEN (case THEN (move ["i"])) THEN (case THEN (move ["j"])) THEN (case THEN (move ["ineq"])) THEN (move ["p_eq"])); (((fun arg_tac -> arg_tac (Arg_term (`j, i`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("p_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("j", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("i", [])) (term_tac exists_tac))) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (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"])); ((((use_arg_then2 ("j", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("i", [])) (term_tac exists_tac))) THEN ((((use_arg_then2 ("p_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("p1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((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 [] []))))))); (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN case THEN (done_tac)); (((use_arg_then2 ("SUM_IMAGE", [SUM_IMAGE])) (thm_tac apply_tac)) THEN (case THEN (move ["i1"]) THEN (move ["j1"])) THEN (case THEN (move ["i2"]) THEN (move ["j2"]))); ((((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); ];; (* Lemma m_taylor_error_eq *) let m_taylor_error_eq = Sections.section_proof ["f";"domain";"w";"error"] `diff2c_domain domain f ==> (m_taylor_error f domain (w:real^N) error <=> (!x. x IN interval [domain] ==> sum (1..dimindex (:N)) (\i. w$i * (w$i * abs (partial2 i i f x) + &2 * sum (1..i - 1) (\j. w$j * abs (partial2 j i f x)))) <= error))` [ (((((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("m_taylor_error", [m_taylor_error]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"])); ((fun arg_tac -> arg_tac (Arg_term (`!g1 g2. (!x. x IN interval [domain] ==> g1 x = g2 x) ==> ((!x. x IN interval [domain] ==> g1 x <= error) <=> (!x. x IN interval [domain] ==> g2 x <= error))`))) (term_tac (have_gen_tac [](move ["eq"])))); ((BETA_TAC THEN (move ["g1"]) THEN (move ["g2"]) THEN (move ["eq"])) THEN ((split_tac) THEN (move ["cond"]) THEN (move ["x"]) THEN (move ["Px"]))); (((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("cond", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("cond", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN (DISCH_THEN apply_tac) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("d2f", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["d2fx"])); ((fun arg_tac -> arg_tac (Arg_term (`\i j. w$i * w$j * abs (partial2 j i f x)`))) (term_tac (set_tac "g"))); ((fun arg_tac -> arg_tac (Arg_term (`dimindex (:N)`))) (term_tac (set_tac "n"))); ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s1"))); ((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"])))); ((((use_arg_then2 ("s1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["i"]) THEN (simp_tac) THEN (move ["i_in"]))); (((((use_arg_then2 ("SUM_LMUL", [SUM_LMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (done_tac)); ((((use_arg_then2 ("REAL_MUL_2", [REAL_MUL_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ADD_LDISTRIB", [REAL_ADD_LDISTRIB]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_LMUL", [SUM_LMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_ADD_NUMSEG", [SUM_ADD_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s2"))); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`s2 = sum (1..n) (\i. g i i + sum (1..i - 1) (\j. g i j))`))) (term_tac (have_gen_tac [](move ["s2_eq"])))) (((((use_arg_then2 ("s2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s3"))); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`s3 = sum (1..n) (\i. sum (1..i - 1) (\j. g i j))`))) (term_tac (have_gen_tac [](move ["s3_eq"])))) (((((use_arg_then2 ("s3_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); (((use_arg_then2 ("s3_def", [])) (disch_tac [])) THEN (clear_assumption "s3_def") THEN ((use_arg_then2 ("s2_def", [])) (disch_tac [])) THEN (clear_assumption "s2_def") THEN ((use_arg_then2 ("s1_def", [])) (disch_tac [])) THEN (clear_assumption "s1_def") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"])); (((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 [] [])))))))); (((((use_arg_then2 ("s2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_ADD_NUMSEG", [SUM_ADD_NUMSEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("s1_eq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["i"]) THEN (simp_tac)) THEN ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["i_ineq"]))); (((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c. (a + b) + c = (a + c) + b`)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SUM_SING_NUMSEG", [SUM_SING_NUMSEG])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`g i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); ((THENL_FIRST) ((((use_arg_then2 ("SUM_COMBINE_R", [SUM_COMBINE_R]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_ineq", []))(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_ADD_AC)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_COMBINE_L", [SUM_COMBINE_L]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("i_ineq", [])) (disch_tac [])) THEN (clear_assumption "i_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (((((use_arg_then2 ("s3_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sum_swap1", [sum_swap1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["i"]) THEN (move ["_"]) THEN (simp_tac)) THEN (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["j"]) THEN (move ["_"]) THEN (simp_tac))); (((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c. a * b * c = b * a * c`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_EQ_MUL_LCANCEL", [REAL_EQ_MUL_LCANCEL]))(thm_tac (new_rewrite [] [])))))) THEN (DISJ2_TAC) THEN (DISJ2_TAC)); ((((use_arg_then2 ("mixed_second_partials", [mixed_second_partials]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma diff2_derivative2_bound *) let diff2_derivative2_bound = Sections.section_proof ["domain";"y";"w";"p";"f";"dd_bound"] `m_cell_domain domain y (w:real^N) ==> p IN interval [domain] ==> diff2_domain domain f ==> m_taylor_error f domain w dd_bound ==> (!t. interval_arith t (&0, &1) ==> abs (nth_derivative 2 (f o (\t. y + t % (p - y))) t) <= dd_bound)` [ (((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("m_taylor_error", [m_taylor_error]))(thm_tac (new_rewrite [] []))))) THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["boundedH"]) THEN (move ["t"]) THEN (move ["t_in"])); ((fun arg_tac -> arg_tac (Arg_term (`y + t % (p - y) IN interval [domain]`))) (term_tac (have_gen_tac [](move ["pt_in"])))); ((((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_CONVEX_SET", [IN_CONVEX_SET]))(thm_tac (new_rewrite [] []))))); (((((fun arg_tac -> (use_arg_then2 ("y_in_domain", [y_in_domain])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("p_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("t_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONVEX_INTERVAL", [CONVEX_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("diff2_dir_derivative2", [diff2_dir_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); (((((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("boundedH", [])) (fun fst_arg -> (use_arg_then2 ("pt_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC)); (((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"]))); ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("s1", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("i1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))))); (((((use_arg_then2 ("SUM_ABS_LE", [SUM_ABS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac)); (((((use_arg_then2 ("SUM_LMUL", [SUM_LMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_ABS_LE", [SUM_ABS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["j_ineq"]) THEN (simp_tac)); (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_ABS_MUL", [REAL_ABS_MUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_MUL2", [REAL_LE_MUL2]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("domain_width", [domain_width])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma m_taylor_error_lemma *) let m_taylor_error_lemma = Sections.section_proof ["domain";"y";"w";"p";"f";"dd_bound"] `m_cell_domain domain y (w:real^N) ==> p IN interval [domain] ==> diff2_domain domain f ==> m_taylor_error f domain w dd_bound ==> abs (f p - (f y + sum (1..dimindex (:N)) (\i. (p - y)$i * partial i f y))) <= dd_bound / &2` [ ((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (BETA_TAC THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["taylor_error"]))); ((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"])))); ((BETA_TAC THEN (move ["t"]) THEN (move ["t_in"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_CONVEX_SET", [IN_CONVEX_SET]))(thm_tac (new_rewrite [] [])))))); (((((fun arg_tac -> (use_arg_then2 ("y_in_domain", [y_in_domain])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("p_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("t_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONVEX_INTERVAL", [CONVEX_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_taylor2_bound", [real_taylor2_bound])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f o (\t. y + t % (p - y))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("dd_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); ((THENL_FIRST) (ANTS_TAC) (((((use_arg_then2 ("nth_diff_strong_int", [nth_diff_strong_int]))(thm_tac (new_rewrite [] [])))) THEN (move ["t"]) THEN (move ["t_in"])) THEN ((((use_arg_then2 ("diff2_dir", [diff2_dir]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pt_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); ((THENL_FIRST) (ANTS_TAC) ((((fun arg_tac -> (use_arg_then2 ("diff2_derivative2_bound", [diff2_derivative2_bound])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LID", [VECTOR_MUL_LID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_ADD2)))(thm_tac (new_rewrite [] []))))); ((THENL_FIRST) ((((use_arg_then2 ("diff2_dir_derivative", [diff2_dir_derivative]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("pt_in", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); (((((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma m_taylor_upper_bound *) let m_taylor_upper_bound = Sections.section_proof ["domain";"y";"w";"f";"dd_bound";"hi";"hi_bound"] `m_cell_domain domain y (w:real^N) ==> diff2_domain domain f ==> m_taylor_error f domain w dd_bound ==> f y <= hi ==> hi + sum(1..dimindex (:N)) (\i. w$i * abs (partial i f y)) + dd_bound / &2 <= hi_bound ==> !p. p IN interval [domain] ==> f p <= hi_bound` [ (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"])); (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_error_lemma", [m_taylor_error_lemma])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); ((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); (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s"))) THEN (move ["ineq"])); ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`(f y + s) + dd_bound / &2`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); (((use_arg_then2 ("total_bound", [])) (disch_tac [])) THEN (clear_assumption "total_bound") THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); ((((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_RADD", [REAL_LE_RADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_bound", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`abs s`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("REAL_ABS_LE", [REAL_ABS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_ABS_LE", [SUM_ABS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac)); (((((use_arg_then2 ("REAL_ABS_MUL", [REAL_ABS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_MUL2", [REAL_LE_MUL2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("domain_width", [domain_width])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma m_taylor_lower_bound *) let m_taylor_lower_bound = Sections.section_proof ["domain";"y";"w";"f";"dd_bound";"lo";"lo_bound"] `m_cell_domain domain y (w:real^N) ==> diff2_domain domain f ==> m_taylor_error f domain w dd_bound ==> lo <= f y ==> lo_bound <= lo - (sum(1..dimindex (:N)) (\i. w$i * abs (partial i f y)) + dd_bound / &2) ==> !p. p IN interval [domain] ==> lo_bound <= f p` [ (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"])); (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_error_lemma", [m_taylor_error_lemma])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); ((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); (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s"))) THEN (move ["ineq"])); ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`(f y + s) - dd_bound / &2`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then2 ("total_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); ((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_NEG_ADD", [REAL_NEG_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_RADD", [REAL_LE_RADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_bound", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); ((THENL_LAST) ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`--abs s`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("REAL_LE_NEG2", [REAL_LE_NEG2]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((arith_tac) THEN (done_tac))); (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_ABS_LE", [SUM_ABS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac)); (((((use_arg_then2 ("REAL_ABS_MUL", [REAL_ABS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_MUL2", [REAL_LE_MUL2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("domain_width", [domain_width])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma m_taylor_bounds *) let m_taylor_bounds = Sections.section_proof ["domain";"y";"w";"f";"dd_bound";"lo";"hi";"err_bound";"lo_bound";"hi_bound"] `m_cell_domain domain y (w:real^N) ==> diff2_domain domain f ==> m_taylor_error f domain w dd_bound ==> interval_arith (f y) (lo, hi) ==> sum(1..dimindex (:N)) (\i. w$i * abs(partial i f y)) + dd_bound / &2 <= err_bound ==> lo_bound <= lo - err_bound ==> hi + err_bound <= hi_bound ==> m_bounded_on_int f domain (lo_bound, hi_bound)` [ (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))))) THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (case THEN ((move ["f_lo"]) THEN (move ["f_hi"]))) THEN (move ["err"]) THEN (move ["lo_ineq"]) THEN (move ["hi_ineq"]) THEN (move ["p"]) THEN (move ["p_in"])); (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_lower_bound", [m_taylor_lower_bound])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_lo", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("lo_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); (((((use_arg_then2 ("p_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`lo - err_bound`))) (term_tac exists_tac))); (((((use_arg_then2 ("lo_ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_NEG2", [REAL_LE_NEG2]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_upper_bound", [m_taylor_upper_bound])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_hi", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("hi_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); (((((use_arg_then2 ("p_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`hi + err_bound`))) (term_tac exists_tac))); (((((use_arg_then2 ("hi_ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_LADD", [REAL_LE_LADD]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_derivative_partial_bound *) let diff2_derivative_partial_bound = Sections.section_proof ["domain";"y";"w";"p";"f";"i";"d_bound"] `m_cell_domain domain y (w:real^N) ==> p IN interval [domain] ==> diff2_domain domain f ==> m_taylor_partial_error f i domain w d_bound ==> (!t. interval_arith t (&0, &1) ==> abs (derivative (partial i f o (\t. y + t % (p - y))) t) <= d_bound)` [ (((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("m_taylor_partial_error", [m_taylor_partial_error]))(thm_tac (new_rewrite [] []))))) THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["boundedH"]) THEN (move ["t"]) THEN (move ["t_in"])); ((fun arg_tac -> arg_tac (Arg_term (`y + t % (p - y) IN interval [domain]`))) (term_tac (have_gen_tac [](move ["pt_in"])))); ((((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_CONVEX_SET", [IN_CONVEX_SET]))(thm_tac (new_rewrite [] []))))); (((((fun arg_tac -> (use_arg_then2 ("y_in_domain", [y_in_domain])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("p_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("t_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONVEX_INTERVAL", [CONVEX_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("diff2_derivative_partial", [diff2_derivative_partial]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); (((fun arg_tac -> (use_arg_then2 ("boundedH", [])) (fun fst_arg -> (use_arg_then2 ("pt_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); (((((use_arg_then2 ("SUM_ABS_LE", [SUM_ABS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["j_ineq"]) THEN (simp_tac)); ((((use_arg_then2 ("REAL_ABS_MUL", [REAL_ABS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_LE_MUL2", [REAL_LE_MUL2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (use_arg_then2 ("domain_width", [domain_width])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma m_taylor_partial_error_lemma *) let m_taylor_partial_error_lemma = Sections.section_proof ["domain";"y";"w";"p";"f";"i";"dd_bound"] `m_cell_domain domain y (w:real^N) ==> p IN interval [domain] ==> diff2_domain domain f ==> m_taylor_partial_error f i domain w dd_bound ==> abs (partial i f p - partial i f y) <= dd_bound` [ ((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (BETA_TAC THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["partial_error"]))); ((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"])))); ((BETA_TAC THEN (move ["t"]) THEN (move ["t_in"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_CONVEX_SET", [IN_CONVEX_SET]))(thm_tac (new_rewrite [] [])))))); (((((fun arg_tac -> (use_arg_then2 ("y_in_domain", [y_in_domain])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("p_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("interval_arith", [interval_arith]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("t_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_eq", [pair_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONVEX_INTERVAL", [CONVEX_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_taylor1_bound", [real_taylor1_bound])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`partial i f o (\t. y + t % (p - y))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("dd_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); (ANTS_TAC); ((BETA_TAC THEN (move ["t"]) THEN (move ["t_in"])) THEN ((((use_arg_then2 ("diff2_real_diff_partial", [diff2_real_diff_partial]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("pt_in", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("diff2_derivative_partial_bound", [diff2_derivative_partial_bound])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); ((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); (((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LID", [VECTOR_MUL_LID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_ADD2)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma m_taylor_upper_partial_bound *) let m_taylor_upper_partial_bound = Sections.section_proof ["domain";"y";"w";"f";"i";"dd_bound";"hi";"hi_bound"] `m_cell_domain domain y (w:real^N) ==> diff2_domain domain f ==> m_taylor_partial_error f i domain w dd_bound ==> partial i f y <= hi ==> hi + dd_bound <= hi_bound ==> !p. p IN interval [domain] ==> partial i f p <= hi_bound` [ (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"])); (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_partial_error_lemma", [m_taylor_partial_error_lemma])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); ((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"])); (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); (((use_arg_then2 ("total_bound", [])) (disch_tac [])) THEN (clear_assumption "total_bound") THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); (((((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma m_taylor_lower_partial_bound *) let m_taylor_lower_partial_bound = Sections.section_proof ["domain";"y";"w";"f";"i";"dd_bound";"lo";"lo_bound"] `m_cell_domain domain y (w:real^N) ==> diff2_domain domain f ==> m_taylor_partial_error f i domain w dd_bound ==> lo <= partial i f y ==> lo_bound <= lo - dd_bound ==> !p. p IN interval [domain] ==> lo_bound <= partial i f p` [ (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"])); (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_partial_error_lemma", [m_taylor_partial_error_lemma])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); ((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"])); (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then2 ("total_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); (((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma m_taylor_partial_bounds *) let m_taylor_partial_bounds = Sections.section_proof ["domain";"y";"w";"f";"i";"dd_bound";"lo";"hi";"lo_bound";"hi_bound"] `m_cell_domain domain y (w:real^N) ==> diff2_domain domain f ==> m_taylor_partial_error f i domain w dd_bound ==> interval_arith (partial i f y) (lo, hi) ==> lo_bound <= lo - dd_bound ==> hi + dd_bound <= hi_bound ==> m_bounded_on_int (partial i f) domain (lo_bound, hi_bound)` [ (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))))) THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (case THEN ((move ["df_lo"]) THEN (move ["df_hi"]))) THEN (move ["lo_ineq"]) THEN (move ["hi_ineq"]) THEN (move ["p"]) THEN (move ["p_in"])); (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_lower_partial_bound", [m_taylor_lower_partial_bound])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("df_lo", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("lo_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("m_taylor_upper_partial_bound", [m_taylor_upper_partial_bound])) (fun fst_arg -> (use_arg_then2 ("domainH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("df", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("errorH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("df_hi", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("hi_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Finalization of the section Taylor *) let real_taylor2_bound = Sections.finalize_theorem real_taylor2_bound;; let real_taylor1_bound = Sections.finalize_theorem real_taylor1_bound;; let taylor_error_eq_sum_partial_errors = Sections.finalize_theorem taylor_error_eq_sum_partial_errors;; let diff2c_imp_diff2 = Sections.finalize_theorem diff2c_imp_diff2;; let diff2_eq_diff2_on_open = Sections.finalize_theorem diff2_eq_diff2_on_open;; let diff2_imp_real_diff = Sections.finalize_theorem diff2_imp_real_diff;; let diff2_dir_derivative = Sections.finalize_theorem diff2_dir_derivative;; let diff2_partial_real_diff = Sections.finalize_theorem diff2_partial_real_diff;; let in_trans = Sections.finalize_theorem in_trans;; let open_contains_open_interval = Sections.finalize_theorem open_contains_open_interval;; let diff2_dir = Sections.finalize_theorem diff2_dir;; let diff2_dir_derivative2 = Sections.finalize_theorem diff2_dir_derivative2;; let diff2_has_derivative_partial = Sections.finalize_theorem diff2_has_derivative_partial;; let diff2_derivative_partial = Sections.finalize_theorem diff2_derivative_partial;; let diff2_real_diff_partial = Sections.finalize_theorem diff2_real_diff_partial;; let partial_const = Sections.finalize_theorem partial_const;; let partial_eq0_alt = Sections.finalize_theorem partial_eq0_alt;; let real_mvt0 = Sections.finalize_theorem real_mvt0;; let mixed_second_partials = Sections.finalize_theorem mixed_second_partials;; let diff2c_domain_alt = Sections.finalize_theorem diff2c_domain_alt;; let y_in_domain = Sections.finalize_theorem y_in_domain;; let domain_width = Sections.finalize_theorem domain_width;; let sum_swap1 = Sections.finalize_theorem sum_swap1;; let m_taylor_error_eq = Sections.finalize_theorem m_taylor_error_eq;; let diff2_derivative2_bound = Sections.finalize_theorem diff2_derivative2_bound;; let m_taylor_error_lemma = Sections.finalize_theorem m_taylor_error_lemma;; let m_taylor_upper_bound = Sections.finalize_theorem m_taylor_upper_bound;; let m_taylor_lower_bound = Sections.finalize_theorem m_taylor_lower_bound;; let m_taylor_bounds = Sections.finalize_theorem m_taylor_bounds;; let diff2_derivative_partial_bound = Sections.finalize_theorem diff2_derivative_partial_bound;; let m_taylor_partial_error_lemma = Sections.finalize_theorem m_taylor_partial_error_lemma;; let m_taylor_upper_partial_bound = Sections.finalize_theorem m_taylor_upper_partial_bound;; let m_taylor_lower_partial_bound = Sections.finalize_theorem m_taylor_lower_partial_bound;; let m_taylor_partial_bounds = Sections.finalize_theorem m_taylor_partial_bounds;; Sections.end_section "Taylor";; (* Section Diff2Arith *) Sections.begin_section "Diff2Arith";; (Sections.add_section_var (mk_var ("f", (`:real^N -> real`))); Sections.add_section_var (mk_var ("g", (`:real^N -> real`))));; (Sections.add_section_var (mk_var ("x", (`:real^N`))));; (Sections.add_section_var (mk_var ("domain", (`:real^N#real^N`))));; (* Lemma differentiable_local_at *) let differentiable_local_at = Sections.section_proof ["s";"f";"g";"x"] `f differentiable at x ==> open s ==> x IN s ==> (!y. y IN s ==> g y = f y) ==> g differentiable at x` [ ((((use_arg_then2 ("OPEN_CONTAINS_BALL", [OPEN_CONTAINS_BALL]))(thm_tac (new_rewrite [] [])))) THEN (move ["df"]) THEN (move ["open_s"]) THEN (move ["xs"]) THEN (move ["eq"])); ((((fun arg_tac -> (use_arg_then2 ("open_s", [])) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"]))) THEN (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_BALL", [IN_BALL]))(thm_tac (new_rewrite [] []))))) THEN (move ["in_ball"]))); ((((fun arg_tac -> (use_arg_then2 ("DIFFERENTIABLE_TRANSFORM_AT", [DIFFERENTIABLE_TRANSFORM_AT])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); (((use_arg_then2 ("d", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("d0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["z"]) THEN (move ["dzx"])) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("in_ball", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Section Point *) Sections.begin_section "Point";; (* Lemma diff2_scale *) let diff2_scale = Sections.section_proof ["f";"c"] `diff2 f x ==> diff2 (\x. c * f x) x` [ ((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (move ["zs"]))); ((THENL_FIRST) ((((use_arg_then2 ("f_lift_scale", [f_lift_scale]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CMUL", [DIFFERENTIABLE_CMUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); ((BETA_TAC THEN (move ["i"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("differentiable_local_at", [differentiable_local_at])) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`lift o (\x. c * partial i f x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); ((THENL_FIRST) ((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("zs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_lift_scale", [f_lift_scale]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CMUL", [DIFFERENTIABLE_CMUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); ((BETA_TAC THEN (move ["y"]) THEN (move ["ys"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial_scale", [partial_scale]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("LIFT_CMUL", [LIFT_CMUL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_neg *) let diff2_neg = Sections.section_proof ["f"] `diff2 f x ==> diff2 (\x. --f x) x` [ (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2_scale", [diff2_scale])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`--(&1)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("REAL_NEG_MINUS1", [REAL_NEG_MINUS1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Section Composite *) Sections.begin_section "Composite";; (* Lemma has_derivative_uni_compose *) let has_derivative_uni_compose = Sections.section_proof ["u";"f";"u'";"f'";"x"] `(lift o f has_derivative f') (at x) ==> (u has_real_derivative u') (atreal (f x)) ==> (lift o u o f has_derivative (\x. u' % f' x)) (at x)` [ (BETA_TAC THEN (move ["df"]) THEN (move ["du"])); ((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 [] []))))))); (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LIFT_DROP", [LIFT_DROP]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(\x. u' % f' x) = (\x. u' % x) o f'`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac))); (((((use_arg_then2 ("DIFF_CHAIN_AT", [DIFF_CHAIN_AT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_REAL_FRECHET_DERIVATIVE_AT)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma diff_uni_compose *) let diff_uni_compose = Sections.section_proof ["u";"f";"x"] `lift o f differentiable at x ==> u real_differentiable atreal (f x) ==> lift o u o f differentiable at x` [ (((repeat_tactic 1 9 (((use_arg_then2 ("differentiable", [differentiable]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_differentiable", [real_differentiable]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["f'"])) THEN (move ["df"]) THEN (case THEN (move ["u'"])) THEN (move ["du"])); (((fun arg_tac -> arg_tac (Arg_term (`\x. u' % f' x`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("has_derivative_uni_compose", [has_derivative_uni_compose])) (thm_tac apply_tac)) THEN (done_tac)); ];; (* Lemma diff2_uni_compose *) let diff2_uni_compose = Sections.section_proof ["u";"f"] `diff2 f x ==> nth_diff_strong 2 u (f x) ==> diff2 (u o f) x` [ (((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["fxt"])) THEN (move ["du"])); ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN s /\ (lift o f) z IN (IMAGE lift t)}`))) (term_tac (set_tac "r"))); ((fun arg_tac -> arg_tac (Arg_term (`open r`))) (term_tac (have_gen_tac [](move ["open_r"])))); ((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CONTINUOUS_OPEN_PREIMAGE", [CONTINUOUS_OPEN_PREIMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OPEN", [REAL_OPEN]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("open_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); (((use_arg_then2 ("DIFFERENTIABLE_IMP_CONTINUOUS_ON", [DIFFERENTIABLE_IMP_CONTINUOUS_ON])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("differentiable_on", [differentiable_on]))(thm_tac (new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["ys"])) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); (((((use_arg_then2 ("DIFFERENTIABLE_AT_WITHIN", [DIFFERENTIABLE_AT_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((THENL_FIRST) (((use_arg_then2 ("r", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("open_r", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LIFT_IN_IMAGE_LIFT", [LIFT_IN_IMAGE_LIFT]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)) (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac))); (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 [] []))))); (((((use_arg_then2 ("diff_uni_compose", [diff_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("du", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"])); (((use_arg_then2 ("differentiable_local_at", [differentiable_local_at])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("r", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`lift o (\y. derivative u (f y) * partial i f y)`))) (term_tac exists_tac)))); ((((use_arg_then2 ("open_r", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("differentiable_mul", [differentiable_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative u`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then2 ("diff_uni_compose", [diff_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("du", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((THENL_FIRST) (((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_IN_IMAGE_LIFT", [LIFT_IN_IMAGE_LIFT]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)) (((use_arg_then2 ("z", [])) (term_tac exists_tac)) THEN (done_tac))); (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 [] []))))); (((((use_arg_then2 ("partial_uni_compose", [partial_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("du", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma diff2_abs_pos_compose *) let diff2_abs_pos_compose = Sections.section_proof [] `&0 < f x ==> diff2 f x ==> diff2 (abs o f) x` [ ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_abs_pos", [diff2_abs_pos])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma diff2_abs_neg_compose *) let diff2_abs_neg_compose = Sections.section_proof [] `f x < &0 ==> diff2 f x ==> diff2 (abs o f) x` [ ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_abs_neg", [diff2_abs_neg])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma diff2_pow_compose *) let diff2_pow_compose = Sections.section_proof ["n"] `diff2 f x ==> diff2 ((\x. x pow n) o f) x` [ ((BETA_TAC THEN (move ["df"])) THEN ((((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_pow_x", [diff2_pow_x]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_inv_compose *) let diff2_inv_compose = Sections.section_proof [] `~(f x = &0) ==> diff2 f x ==> diff2 (inv o f) x` [ ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_inv", [diff2_inv])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma diff2_sqrt_compose *) let diff2_sqrt_compose = Sections.section_proof [] `&0 < f x ==> diff2 f x ==> diff2 (sqrt o f) x` [ ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_sqrt", [diff2_sqrt])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma diff2_atn_compose *) let diff2_atn_compose = Sections.section_proof [] `diff2 f x ==> diff2 (atn o f) x` [ ((BETA_TAC THEN (move ["df"])) THEN ((((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_atn", [diff2_atn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_cos_compose *) let diff2_cos_compose = Sections.section_proof [] `diff2 f x ==> diff2 (cos o f) x` [ ((BETA_TAC THEN (move ["df"])) THEN ((((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_cos", [diff2_cos]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_sin_compose *) let diff2_sin_compose = Sections.section_proof [] `diff2 f x ==> diff2 (sin o f) x` [ ((BETA_TAC THEN (move ["df"])) THEN ((((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_sin", [diff2_sin]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_exp_compose *) let diff2_exp_compose = Sections.section_proof [] `diff2 f x ==> diff2 (exp o f) x` [ ((BETA_TAC THEN (move ["df"])) THEN ((((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_exp", [diff2_exp]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_log_compose *) let diff2_log_compose = Sections.section_proof [] `&0 < f x ==> diff2 f x ==> diff2 (log o f) x` [ ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_log", [diff2_log])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma diff2_acs_compose *) let diff2_acs_compose = Sections.section_proof [] `abs (f x) < &1 ==> diff2 f x ==> diff2 (acs o f) x` [ ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_acs", [diff2_acs])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma diff2_asn_compose *) let diff2_asn_compose = Sections.section_proof [] `abs (f x) < &1 ==> diff2 f x ==> diff2 (asn o f) x` [ ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_asn", [diff2_asn])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma diff2_matan_compose *) let diff2_matan_compose = Sections.section_proof [] `-- &1 < f x ==> diff2 f x ==> diff2 (matan o f) x` [ ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_matan", [diff2_matan])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Finalization of the section Composite *) let has_derivative_uni_compose = Sections.finalize_theorem has_derivative_uni_compose;; let diff_uni_compose = Sections.finalize_theorem diff_uni_compose;; let diff2_uni_compose = Sections.finalize_theorem diff2_uni_compose;; let diff2_abs_pos_compose = Sections.finalize_theorem diff2_abs_pos_compose;; let diff2_abs_neg_compose = Sections.finalize_theorem diff2_abs_neg_compose;; let diff2_pow_compose = Sections.finalize_theorem diff2_pow_compose;; let diff2_inv_compose = Sections.finalize_theorem diff2_inv_compose;; let diff2_sqrt_compose = Sections.finalize_theorem diff2_sqrt_compose;; let diff2_atn_compose = Sections.finalize_theorem diff2_atn_compose;; let diff2_cos_compose = Sections.finalize_theorem diff2_cos_compose;; let diff2_sin_compose = Sections.finalize_theorem diff2_sin_compose;; let diff2_exp_compose = Sections.finalize_theorem diff2_exp_compose;; let diff2_log_compose = Sections.finalize_theorem diff2_log_compose;; let diff2_acs_compose = Sections.finalize_theorem diff2_acs_compose;; let diff2_asn_compose = Sections.finalize_theorem diff2_asn_compose;; let diff2_matan_compose = Sections.finalize_theorem diff2_matan_compose;; Sections.end_section "Composite";; (* Lemma diff2_add *) let diff2_add = Sections.section_proof ["f";"g"] `diff2 f x ==> diff2 g x ==> diff2 (\x. f x + g x) x` [ ((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"])); (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("OPEN_INTER", [OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"]))))); ((((use_arg_then2 ("f_lift_add", [f_lift_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((BETA_TAC THEN (move ["i"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("differentiable_local_at", [differentiable_local_at])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`lift o (\x. partial i f x + partial i g x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); ((((use_arg_then2 ("OPEN_INTER", [OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("zt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("zs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_lift_add", [f_lift_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial_add", [partial_add]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("LIFT_ADD", [LIFT_ADD]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_sub *) let diff2_sub = Sections.section_proof ["f";"g"] `diff2 f x ==> diff2 g x ==> diff2 (\x. f x - g x) x` [ ((BETA_TAC THEN (move ["d2f"]) THEN (move ["d2g"])) THEN ((((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_add", [diff2_add]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("diff2_neg", [diff2_neg]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_mul *) let diff2_mul = Sections.section_proof ["f";"g"] `diff2 f x ==> diff2 g x ==> diff2 (\x. f x * g x) x` [ ((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"])); (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("OPEN_INTER", [OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"]))))); (((((use_arg_then2 ("differentiable_mul", [differentiable_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"])); (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("differentiable_local_at", [differentiable_local_at])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`lift o (\x. partial i f x * g x + f x * partial i g x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); ((((use_arg_then2 ("OPEN_INTER", [OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("zt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("zs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_lift_add", [f_lift_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("differentiable_mul", [differentiable_mul]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial_mul", [partial_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("LIFT_ADD", [LIFT_ADD]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Finalization of the section Point *) let diff2_scale = Sections.finalize_theorem diff2_scale;; let diff2_neg = Sections.finalize_theorem diff2_neg;; let has_derivative_uni_compose = Sections.finalize_theorem has_derivative_uni_compose;; let diff_uni_compose = Sections.finalize_theorem diff_uni_compose;; let diff2_uni_compose = Sections.finalize_theorem diff2_uni_compose;; let diff2_abs_pos_compose = Sections.finalize_theorem diff2_abs_pos_compose;; let diff2_abs_neg_compose = Sections.finalize_theorem diff2_abs_neg_compose;; let diff2_pow_compose = Sections.finalize_theorem diff2_pow_compose;; let diff2_inv_compose = Sections.finalize_theorem diff2_inv_compose;; let diff2_sqrt_compose = Sections.finalize_theorem diff2_sqrt_compose;; let diff2_atn_compose = Sections.finalize_theorem diff2_atn_compose;; let diff2_cos_compose = Sections.finalize_theorem diff2_cos_compose;; let diff2_sin_compose = Sections.finalize_theorem diff2_sin_compose;; let diff2_exp_compose = Sections.finalize_theorem diff2_exp_compose;; let diff2_log_compose = Sections.finalize_theorem diff2_log_compose;; let diff2_acs_compose = Sections.finalize_theorem diff2_acs_compose;; let diff2_asn_compose = Sections.finalize_theorem diff2_asn_compose;; let diff2_matan_compose = Sections.finalize_theorem diff2_matan_compose;; let diff2_add = Sections.finalize_theorem diff2_add;; let diff2_sub = Sections.finalize_theorem diff2_sub;; let diff2_mul = Sections.finalize_theorem diff2_mul;; Sections.end_section "Point";; (* Section Domain *) Sections.begin_section "Domain";; (Sections.add_section_hyp "d2f" (`diff2_domain domain f`));; (* Lemma diff2_domain_scale *) let diff2_domain_scale = Sections.section_proof ["c"] `diff2_domain domain (\x. c * f x)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_scale", [diff2_scale]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_domain_neg *) let diff2_domain_neg = Sections.section_proof [] `diff2_domain domain (\x. --f x)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_neg", [diff2_neg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (Sections.add_section_var (mk_var ("bounds", (`:real#real`))));; (* Lemma diff2_domain_inv_compose *) let diff2_domain_inv_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> interval_not_zero bounds ==> diff2_domain domain (inv o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2_inv_compose", [diff2_inv_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_not_zero", [interval_arith_not_zero])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_domain_sqrt_compose *) let diff2_domain_sqrt_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> interval_pos bounds ==> diff2_domain domain (sqrt o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2_sqrt_compose", [diff2_sqrt_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_domain_abs_pos_compose *) let diff2_domain_abs_pos_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> interval_pos bounds ==> diff2_domain domain (abs o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2_abs_pos_compose", [diff2_abs_pos_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_domain_abs_neg_compose *) let diff2_domain_abs_neg_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> interval_neg bounds ==> diff2_domain domain (abs o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2_abs_neg_compose", [diff2_abs_neg_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_neg", [interval_arith_neg])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_domain_pow_compose *) let diff2_domain_pow_compose = Sections.section_proof ["n"] `diff2_domain domain ((\x. x pow n) o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_pow_compose", [diff2_pow_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_domain_atn_compose *) let diff2_domain_atn_compose = Sections.section_proof [] `diff2_domain domain (atn o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_atn_compose", [diff2_atn_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_domain_cos_compose *) let diff2_domain_cos_compose = Sections.section_proof [] `diff2_domain domain (cos o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_cos_compose", [diff2_cos_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_domain_sin_compose *) let diff2_domain_sin_compose = Sections.section_proof [] `diff2_domain domain (sin o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_sin_compose", [diff2_sin_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_domain_exp_compose *) let diff2_domain_exp_compose = Sections.section_proof [] `diff2_domain domain (exp o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_exp_compose", [diff2_exp_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_domain_log_compose *) let diff2_domain_log_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> interval_pos bounds ==> diff2_domain domain (log o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2_log_compose", [diff2_log_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_domain_acs_compose *) let diff2_domain_acs_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> iabs bounds < &1 ==> diff2_domain domain (acs o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2_acs_compose", [diff2_acs_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_domain_asn_compose *) let diff2_domain_asn_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> iabs bounds < &1 ==> diff2_domain domain (asn o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2_asn_compose", [diff2_asn_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_domain_matan_compose *) let diff2_domain_matan_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> interval_gt (-- &1) bounds ==> diff2_domain domain (matan o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2_matan_compose", [diff2_matan_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_gt", [interval_arith_gt])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (Sections.add_section_hyp "d2g" (`diff2_domain domain g`));; (* Lemma diff2_domain_add *) let diff2_domain_add = Sections.section_proof [] `diff2_domain domain (\x. f x + g x)` [ ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_add", [diff2_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma diff2_domain_sub *) let diff2_domain_sub = Sections.section_proof [] `diff2_domain domain (\x. f x - g x)` [ ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_sub", [diff2_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma diff2_domain_mul *) let diff2_domain_mul = Sections.section_proof [] `diff2_domain domain (\x. f x * g x)` [ ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2_mul", [diff2_mul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Finalization of the section Domain *) let diff2_domain_scale = Sections.finalize_theorem diff2_domain_scale;; let diff2_domain_neg = Sections.finalize_theorem diff2_domain_neg;; let diff2_domain_inv_compose = Sections.finalize_theorem diff2_domain_inv_compose;; let diff2_domain_sqrt_compose = Sections.finalize_theorem diff2_domain_sqrt_compose;; let diff2_domain_abs_pos_compose = Sections.finalize_theorem diff2_domain_abs_pos_compose;; let diff2_domain_abs_neg_compose = Sections.finalize_theorem diff2_domain_abs_neg_compose;; let diff2_domain_pow_compose = Sections.finalize_theorem diff2_domain_pow_compose;; let diff2_domain_atn_compose = Sections.finalize_theorem diff2_domain_atn_compose;; let diff2_domain_cos_compose = Sections.finalize_theorem diff2_domain_cos_compose;; let diff2_domain_sin_compose = Sections.finalize_theorem diff2_domain_sin_compose;; let diff2_domain_exp_compose = Sections.finalize_theorem diff2_domain_exp_compose;; let diff2_domain_log_compose = Sections.finalize_theorem diff2_domain_log_compose;; let diff2_domain_acs_compose = Sections.finalize_theorem diff2_domain_acs_compose;; let diff2_domain_asn_compose = Sections.finalize_theorem diff2_domain_asn_compose;; let diff2_domain_matan_compose = Sections.finalize_theorem diff2_domain_matan_compose;; let diff2_domain_add = Sections.finalize_theorem diff2_domain_add;; let diff2_domain_sub = Sections.finalize_theorem diff2_domain_sub;; let diff2_domain_mul = Sections.finalize_theorem diff2_domain_mul;; Sections.end_section "Domain";; (* Section SecondPartial *) Sections.begin_section "SecondPartial";; (* Lemma diff2_imp_diff *) let diff2_imp_diff = Sections.section_proof ["f";"x"] `diff2 f x ==> (lift o f) differentiable at x` [ (((((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_imp_partial_diff *) let diff2_imp_partial_diff = Sections.section_proof ["f";"i";"x"] `diff2 f x ==> (lift o partial i f) differentiable at x` [ (((((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma partial_local *) let partial_local = Sections.section_proof ["s";"f";"g";"i";"x"] `(lift o f) differentiable at x ==> open s ==> x IN s ==> (!y:real^N. y IN s ==> f y = g y) ==> partial i f x = partial i g x` [ ((BETA_TAC THEN (move ["df"]) THEN (move ["open_s"]) THEN (move ["xs"]) THEN (move ["eq"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("derivative_unique", [derivative_unique])) (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("HAS_REAL_DERIVATIVE_LOCAL", [HAS_REAL_DERIVATIVE_LOCAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac))); (((fun arg_tac -> arg_tac (Arg_term (`g o (\t. x + t % basis i)`))) (term_tac exists_tac)) THEN (split_tac)); ((((use_arg_then2 ("has_derivative_alt", [has_derivative_alt])) (disch_tac [])) THEN (clear_assumption "has_derivative_alt") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("diff_imp_real_diff", [diff_imp_real_diff])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("diff_direction", [diff_direction]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("differentiable_local_at", [differentiable_local_at])) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`lift o f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)); (((simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["ys"])); (((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("open_contains_open_interval", [open_contains_open_interval])) (fun fst_arg -> (use_arg_then2 ("open_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`basis i:real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["ab0"]))) THEN ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["sub"]))); (((fun arg_tac -> arg_tac (Arg_term (`real_interval (a, b)`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("ab0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["y_in"]))); (((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sub", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (done_tac)); ];; (Sections.add_section_var (mk_var ("i", (`:num`))); Sections.add_section_var (mk_var ("j", (`:num`))));; (* Lemma second_partial_scale *) let second_partial_scale = Sections.section_proof ["f";"c"] `diff2 f x ==> partial2 i j (\x. c * f x) x = c * partial2 i j f x` [ ((BETA_TAC THEN (move ["d2f"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial_scale", [partial_scale]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_imp_partial_diff", [diff2_imp_partial_diff]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]))); (((use_arg_then2 ("partial_local", [partial_local])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_lift_scale", [f_lift_scale]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CMUL", [DIFFERENTIABLE_CMUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))))); ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ((BETA_TAC THEN (move ["y"]) THEN (move ["ys"])) THEN ((((use_arg_then2 ("partial_scale", [partial_scale]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma second_partial_neg *) let second_partial_neg = Sections.section_proof ["f"] `diff2 f x ==> partial2 i j (\x. --f x) x = --partial2 i j f x` [ (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("second_partial_scale", [second_partial_scale])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`--(&1)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_NEG_MINUS1", [REAL_NEG_MINUS1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma second_partial_add *) let second_partial_add = Sections.section_proof ["f";"g"] `diff2 f x ==> diff2 g x ==> partial2 i j (\x. f x + g x) x = partial2 i j f x + partial2 i j g x` [ ((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"])); (((repeat_tactic 1 9 (((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial_add", [partial_add]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("partial_local", [partial_local])) (thm_tac apply_tac))); (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("OPEN_INTER", [OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("f_lift_add", [f_lift_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((BETA_TAC THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"])))) THEN ((((use_arg_then2 ("partial_add", [partial_add]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma second_partial_sub *) let second_partial_sub = Sections.section_proof ["f";"g"] `diff2 f x ==> diff2 g x ==> partial2 i j (\x. f x - g x) x = partial2 i j f x - partial2 i j g x` [ ((BETA_TAC THEN (move ["d2f"]) THEN (move ["d2g"])) THEN ((((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("second_partial_add", [second_partial_add]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_neg", [diff2_neg]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("second_partial_neg", [second_partial_neg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma second_partial_mul *) let second_partial_mul = Sections.section_proof ["f";"g"] `diff2 f x ==> diff2 g x ==> partial2 i j (\x. f x * g x) x = (partial2 i j f x * g x + partial j f x * partial i g x) + (partial i f x * partial j g x + f x * partial2 i j g x)` [ ((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"])); ((repeat_tactic 1 9 (((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("partial_mul", [partial_mul]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("partial_add", [partial_add]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 1 (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))))); ((repeat_tactic 1 9 (((use_arg_then2 ("differentiable_mul", [differentiable_mul]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((use_arg_then2 ("partial_local", [partial_local])) (thm_tac apply_tac)); (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("OPEN_INTER", [OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("f_lift_add", [f_lift_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("differentiable_mul", [differentiable_mul]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((BETA_TAC THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"])))) THEN ((((use_arg_then2 ("partial_mul", [partial_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dg", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma second_partial_uni_compose *) let second_partial_uni_compose = Sections.section_proof ["f";"u"] `diff2 f x ==> nth_diff_strong 2 u (f x) ==> partial2 i j (u o f) x = (nth_derivative 2 u (f x) * partial i f x) * partial j f x + derivative u (f x) * partial2 i j f x` [ (((repeat_tactic 1 9 (((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["fxt"])) THEN (move ["du"])); ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN s /\ (lift o f) z IN (IMAGE lift t)}`))) (term_tac (set_tac "r"))); ((fun arg_tac -> arg_tac (Arg_term (`open r`))) (term_tac (have_gen_tac [](move ["open_r"])))); ((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CONTINUOUS_OPEN_PREIMAGE", [CONTINUOUS_OPEN_PREIMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OPEN", [REAL_OPEN]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("open_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); (((use_arg_then2 ("DIFFERENTIABLE_IMP_CONTINUOUS_ON", [DIFFERENTIABLE_IMP_CONTINUOUS_ON])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("differentiable_on", [differentiable_on]))(thm_tac (new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["ys"])) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); (((((use_arg_then2 ("DIFFERENTIABLE_AT_WITHIN", [DIFFERENTIABLE_AT_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((repeat_tactic 1 9 (((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("partial_uni_compose", [partial_uni_compose]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("du", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative u`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial_mul", [partial_mul]))(gsym_then (thm_tac (new_rewrite [] [])))))); (((((use_arg_then2 ("diff_uni_compose", [diff_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("du", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); (((use_arg_then2 ("partial_local", [partial_local])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("r", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("open_r", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); ((THENL_ROT (-1)) (((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LIFT_IN_IMAGE_LIFT", [LIFT_IN_IMAGE_LIFT]))(thm_tac (new_rewrite [] []))))) THEN (split_tac))); ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN ((case THEN (move ["zs"])) THEN (move ["fpz"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("partial_uni_compose", [partial_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("du", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((THENL_LAST) (split_tac) (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac))); (((use_arg_then2 ("differentiable_local_at", [differentiable_local_at])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("r", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`lift o (\y. derivative u (f y) * partial j f y)`))) (term_tac exists_tac)))); ((((use_arg_then2 ("open_r", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("differentiable_mul", [differentiable_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative u`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then2 ("diff_uni_compose", [diff_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("du", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((THENL_FIRST) (((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIFT_IN_IMAGE_LIFT", [LIFT_IN_IMAGE_LIFT]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)) (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac))); ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["p"])) THEN (case THEN ((case THEN (move ["ps"])) THEN (move ["fpt"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("partial_uni_compose", [partial_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("du", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Finalization of the section SecondPartial *) let diff2_imp_diff = Sections.finalize_theorem diff2_imp_diff;; let diff2_imp_partial_diff = Sections.finalize_theorem diff2_imp_partial_diff;; let partial_local = Sections.finalize_theorem partial_local;; let second_partial_scale = Sections.finalize_theorem second_partial_scale;; let second_partial_neg = Sections.finalize_theorem second_partial_neg;; let second_partial_add = Sections.finalize_theorem second_partial_add;; let second_partial_sub = Sections.finalize_theorem second_partial_sub;; let second_partial_mul = Sections.finalize_theorem second_partial_mul;; let second_partial_uni_compose = Sections.finalize_theorem second_partial_uni_compose;; Sections.end_section "SecondPartial";; (* Finalization of the section Diff2Arith *) let differentiable_local_at = Sections.finalize_theorem differentiable_local_at;; let diff2_scale = Sections.finalize_theorem diff2_scale;; let diff2_neg = Sections.finalize_theorem diff2_neg;; let has_derivative_uni_compose = Sections.finalize_theorem has_derivative_uni_compose;; let diff_uni_compose = Sections.finalize_theorem diff_uni_compose;; let diff2_uni_compose = Sections.finalize_theorem diff2_uni_compose;; let diff2_abs_pos_compose = Sections.finalize_theorem diff2_abs_pos_compose;; let diff2_abs_neg_compose = Sections.finalize_theorem diff2_abs_neg_compose;; let diff2_pow_compose = Sections.finalize_theorem diff2_pow_compose;; let diff2_inv_compose = Sections.finalize_theorem diff2_inv_compose;; let diff2_sqrt_compose = Sections.finalize_theorem diff2_sqrt_compose;; let diff2_atn_compose = Sections.finalize_theorem diff2_atn_compose;; let diff2_cos_compose = Sections.finalize_theorem diff2_cos_compose;; let diff2_sin_compose = Sections.finalize_theorem diff2_sin_compose;; let diff2_exp_compose = Sections.finalize_theorem diff2_exp_compose;; let diff2_log_compose = Sections.finalize_theorem diff2_log_compose;; let diff2_acs_compose = Sections.finalize_theorem diff2_acs_compose;; let diff2_asn_compose = Sections.finalize_theorem diff2_asn_compose;; let diff2_matan_compose = Sections.finalize_theorem diff2_matan_compose;; let diff2_add = Sections.finalize_theorem diff2_add;; let diff2_sub = Sections.finalize_theorem diff2_sub;; let diff2_mul = Sections.finalize_theorem diff2_mul;; let diff2_domain_scale = Sections.finalize_theorem diff2_domain_scale;; let diff2_domain_neg = Sections.finalize_theorem diff2_domain_neg;; let diff2_domain_inv_compose = Sections.finalize_theorem diff2_domain_inv_compose;; let diff2_domain_sqrt_compose = Sections.finalize_theorem diff2_domain_sqrt_compose;; let diff2_domain_abs_pos_compose = Sections.finalize_theorem diff2_domain_abs_pos_compose;; let diff2_domain_abs_neg_compose = Sections.finalize_theorem diff2_domain_abs_neg_compose;; let diff2_domain_pow_compose = Sections.finalize_theorem diff2_domain_pow_compose;; let diff2_domain_atn_compose = Sections.finalize_theorem diff2_domain_atn_compose;; let diff2_domain_cos_compose = Sections.finalize_theorem diff2_domain_cos_compose;; let diff2_domain_sin_compose = Sections.finalize_theorem diff2_domain_sin_compose;; let diff2_domain_exp_compose = Sections.finalize_theorem diff2_domain_exp_compose;; let diff2_domain_log_compose = Sections.finalize_theorem diff2_domain_log_compose;; let diff2_domain_acs_compose = Sections.finalize_theorem diff2_domain_acs_compose;; let diff2_domain_asn_compose = Sections.finalize_theorem diff2_domain_asn_compose;; let diff2_domain_matan_compose = Sections.finalize_theorem diff2_domain_matan_compose;; let diff2_domain_add = Sections.finalize_theorem diff2_domain_add;; let diff2_domain_sub = Sections.finalize_theorem diff2_domain_sub;; let diff2_domain_mul = Sections.finalize_theorem diff2_domain_mul;; let diff2_imp_diff = Sections.finalize_theorem diff2_imp_diff;; let diff2_imp_partial_diff = Sections.finalize_theorem diff2_imp_partial_diff;; let partial_local = Sections.finalize_theorem partial_local;; let second_partial_scale = Sections.finalize_theorem second_partial_scale;; let second_partial_neg = Sections.finalize_theorem second_partial_neg;; let second_partial_add = Sections.finalize_theorem second_partial_add;; let second_partial_sub = Sections.finalize_theorem second_partial_sub;; let second_partial_mul = Sections.finalize_theorem second_partial_mul;; let second_partial_uni_compose = Sections.finalize_theorem second_partial_uni_compose;; Sections.end_section "Diff2Arith";; (* Section Diff2c *) Sections.begin_section "Diff2c";; (* Lemma real_cont_at_local *) let real_cont_at_local = Sections.section_proof ["f";"g";"x";"s"] `g real_continuous at x ==> open s ==> x IN s ==> (!y. y IN s ==> f y = g y) ==> f real_continuous at x` [ ((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"])); (((fun arg_tac -> (use_arg_then2 ("OPEN_CONTAINS_BALL", [OPEN_CONTAINS_BALL])) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("ball", [ball]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); (((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC THEN (case THEN (move ["d0"])) THEN (case THEN (move ["d0_gt0"])) THEN (move ["sub_s"])); (((fun arg_tac -> (use_arg_then2 ("g_cont", [])) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["d1"])) THEN (case THEN (move ["d1_gt0"])) THEN (move ["dist_cond"])); ((fun arg_tac -> arg_tac (Arg_term (`min d0 d1`))) (term_tac exists_tac)); (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_LT_MIN", [REAL_LT_MIN]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d1_gt0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d0_gt0", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"]) THEN (case THEN ((move ["yd0"]) THEN (move ["yd1"])))); ((repeat_tactic 1 9 (((use_arg_then2 ("f_eq_g", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); (((((use_arg_then2 ("sub_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (done_tac)); (((use_arg_then2 ("dist_cond", [])) (disch_tac [])) THEN (clear_assumption "dist_cond") THEN (exact_tac)); ];; (* Lemma real_cont_atreal_local *) let real_cont_atreal_local = Sections.section_proof ["v";"u";"t";"x"] `v real_continuous atreal x ==> real_open t ==> x IN t ==> (!y. y IN t ==> u y = v y) ==> u real_continuous atreal x` [ (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS_ATREAL)))(thm_tac (new_rewrite [] []))))); (((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("REAL_OPEN", [REAL_OPEN]))(thm_tac (new_rewrite [] []))))) THEN (move ["vc"]) THEN (move ["open_t"]) THEN (move ["xt"]) THEN (move ["v_eq_u"])); ((use_arg_then2 ("real_cont_at_local", [real_cont_at_local])) (thm_tac apply_tac)); (((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))); ((((((use_arg_then2 ("open_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vc", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("LIFT_IN_IMAGE_LIFT", [LIFT_IN_IMAGE_LIFT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xt", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_IMAGE_LIFT_DROP", [IN_IMAGE_LIFT_DROP]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("v_eq_u", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); ];; (Sections.add_section_type (mk_var ("f", (`:real^N -> real`))); Sections.add_section_type (mk_var ("g", (`:real^N -> real`))));; (Sections.add_section_var (mk_var ("x", (`:real^N`))));; (Sections.add_section_var (mk_var ("domain", (`:real^N#real^N`))));; (* Section Point *) Sections.begin_section "Point";; (* Lemma diff2c_scale *) let diff2c_scale = Sections.section_proof ["f";"c"] `diff2c f x ==> diff2c (\x. c * f x) x` [ (((repeat_tactic 1 9 (((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["p2c"])))) THEN (((((use_arg_then2 ("diff2_scale", [diff2_scale]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"]))); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("p2c", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["p2ij"]))); ((use_arg_then2 ("real_cont_at_local", [real_cont_at_local])) (thm_tac apply_tac)); ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["d2s"]))); (((fun arg_tac -> arg_tac (Arg_term (`(\x. c * partial2 j i f x)`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("s", [])) (term_tac exists_tac))); ((THENL_FIRST) (((use_arg_then2 ("REAL_CONTINUOUS_LMUL", [REAL_CONTINUOUS_LMUL]))(thm_tac (new_rewrite [] [])))) ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac))); (((((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("d2s", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["d2y"])); ((((use_arg_then2 ("second_partial_scale", [second_partial_scale]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma diff2c_neg *) let diff2c_neg = Sections.section_proof ["f"] `diff2c f x ==> diff2c (\x. --f x) x` [ (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_scale", [diff2c_scale])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`--(&1)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("REAL_NEG_MINUS1", [REAL_NEG_MINUS1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Section Composite *) Sections.begin_section "Composite";; (* Lemma nth_diff_strong_eq_on_open *) let nth_diff_strong_eq_on_open = Sections.section_proof ["n";"u";"x"] `nth_diff_strong n u x ==> ?s. real_open s /\ x IN s /\ (!y. y IN s ==> nth_diff_strong n u y)` [ ((repeat_tactic 1 9 (((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["dt"])); (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("xt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("open_t", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"]) THEN (move ["yt"]))); (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (done_tac)); ];; (* Lemma diff2_imp_cont *) let diff2_imp_cont = Sections.section_proof ["f";"x"] `diff2 f x ==> f real_continuous at x` [ ((((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_IMP_CONTINUOUS_AT", [DIFFERENTIABLE_IMP_CONTINUOUS_AT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_imp_partial_cont *) let diff2_imp_partial_cont = Sections.section_proof ["f";"i";"x"] `diff2 f x ==> (partial i f) real_continuous at x` [ ((((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_IMP_CONTINUOUS_AT", [DIFFERENTIABLE_IMP_CONTINUOUS_AT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("df", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_uni_compose *) let diff2c_uni_compose = Sections.section_proof ["u";"f";"x"] `diff2c f x ==> nth_diff_strong 2 u (f x) ==> (nth_derivative 2 u) real_continuous atreal (f x) ==> diff2c (u o f) x` [ ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d2f"])) THEN (move ["p2c"]) THEN (move ["d2u"]) THEN (move ["u2c"])); (((((use_arg_then2 ("diff2_uni_compose", [diff2_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2u", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"])); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("p2c", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["p2ij"]))); ((use_arg_then2 ("real_cont_at_local", [real_cont_at_local])) (thm_tac apply_tac)); ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["d2s"]))); (((fun arg_tac -> (use_arg_then2 ("nth_diff_strong_eq_on_open", [nth_diff_strong_eq_on_open])) (fun fst_arg -> (use_arg_then2 ("d2u", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["fxt"])) THEN (move ["d2t"])); ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN s /\ (lift o f) z IN (IMAGE lift t)}`))) (term_tac (set_tac "r"))); ((fun arg_tac -> arg_tac (Arg_term (`open r`))) (term_tac (have_gen_tac [](move ["open_r"])))); ((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CONTINUOUS_OPEN_PREIMAGE", [CONTINUOUS_OPEN_PREIMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OPEN", [REAL_OPEN]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("open_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("open_s", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); (((use_arg_then2 ("DIFFERENTIABLE_IMP_CONTINUOUS_ON", [DIFFERENTIABLE_IMP_CONTINUOUS_ON])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("differentiable_on", [differentiable_on]))(thm_tac (new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["ys"])) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); (((use_arg_then2 ("DIFFERENTIABLE_AT_WITHIN", [DIFFERENTIABLE_AT_WITHIN]))(thm_tac (new_rewrite [] [])))); ((((fun arg_tac -> (use_arg_then2 ("d2s", [])) (fun fst_arg -> (use_arg_then2 ("ys", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s'"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["ys'"])))); ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("ys'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac)); (((fun arg_tac -> arg_tac (Arg_term (`(\x. (nth_derivative 2 u (f x) * partial j f x) * partial i f x + derivative u (f x) * partial2 j i f x)`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("r", [])) (term_tac exists_tac))); ((THENL_ROT (-1)) (((((use_arg_then2 ("open_r", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LIFT_IN_IMAGE_LIFT", [LIFT_IN_IMAGE_LIFT]))(thm_tac (new_rewrite [] []))))) THEN (split_tac))); (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"])); (((((use_arg_then2 ("second_partial_uni_compose", [second_partial_uni_compose]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("yz", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2s", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("d2t", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((THENL_LAST) (split_tac) (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac))); (((((use_arg_then2 ("REAL_CONTINUOUS_ADD", [REAL_CONTINUOUS_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("diff2_imp_partial_cont", [diff2_imp_partial_cont]))(fun tmp_arg1 -> (use_arg_then2 ("d2s", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); (((((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(gsym_then (thm_tac (new_rewrite [] [(`nth_derivative 2 u _1`)])))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] [])))); ((((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONTINUOUS_REAL_CONTINUOUS_AT_COMPOSE", [CONTINUOUS_REAL_CONTINUOUS_AT_COMPOSE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_imp_cont", [diff2_imp_cont]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2s", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ATREAL_WITHINREAL", [REAL_CONTINUOUS_ATREAL_WITHINREAL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((((use_arg_then2 ("p2ij", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(gsym_then (thm_tac (new_rewrite [] [(`derivative u _`)])))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] [])))); ((((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONTINUOUS_REAL_CONTINUOUS_AT_COMPOSE", [CONTINUOUS_REAL_CONTINUOUS_AT_COMPOSE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_imp_cont", [diff2_imp_cont]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2s", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ATREAL_WITHINREAL", [REAL_CONTINUOUS_ATREAL_WITHINREAL]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("nth_derivative1", [nth_derivative1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("nth_derivative_continuous", [nth_derivative_continuous])) (thm_tac apply_tac))); ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`2`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); ((((fun arg_tac -> (use_arg_then2 ("d2t", [])) (fun fst_arg -> (use_arg_then2 ("fxt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("nth_diff_strong", [nth_diff_strong]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_differentiable_on", [nth_differentiable_on]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["t'"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["fxt'"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma real_open_delete *) let real_open_delete = Sections.section_proof ["s";"x"] `real_open s ==> real_open (s DELETE x)` [ ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_OPEN", [REAL_OPEN]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("OPEN_DELETE", [OPEN_DELETE])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`lift x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))); (((((use_arg_then2 ("IMAGE_DELETE_INJ_COMPAT", [IMAGE_DELETE_INJ_COMPAT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("LIFT_EQ", [LIFT_EQ]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma diff2c_inv_compose *) let diff2c_inv_compose = Sections.section_proof ["f"] `~(f x = &0) ==> diff2c f x ==> diff2c (inv o f) x` [ ((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (use_arg_then2 ("diff2_inv", [diff2_inv])) (fun fst_arg -> (use_arg_then2 ("fn0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); (((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac)); (((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))); ((THENL_ROT (-1)) (((((use_arg_then2 ("real_open_delete", [real_open_delete]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_OPEN_UNIV", [REAL_OPEN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fn0", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac))); ((BETA_TAC THEN (move ["y"]) THEN (move ["yn0"])) THEN (((use_arg_then2 ("second_derivative_inv", [second_derivative_inv]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ((((use_arg_then2 ("REAL_CONTINUOUS_LMUL", [REAL_CONTINUOUS_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_INV_ATREAL", [REAL_CONTINUOUS_INV_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("REAL_POW_NZ", [REAL_POW_NZ]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma diff2c_sqrt_compose *) let diff2c_sqrt_compose = Sections.section_proof ["f"] `&0 < f x ==> diff2c f x ==> diff2c (sqrt o f) x` [ ((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (use_arg_then2 ("diff2_sqrt", [diff2_sqrt])) (fun fst_arg -> (use_arg_then2 ("fn0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); (((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac)); (((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))); ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_OPEN_HALFSPACE_GT", [REAL_OPEN_HALFSPACE_GT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac))); ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z0"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("second_derivative_sqrt", [second_derivative_sqrt]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ((THENL_LAST) (split_tac) (((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (done_tac))); ((THENL_ROT (-1)) ((((use_arg_then2 ("REAL_CONTINUOUS_NEG", [REAL_CONTINUOUS_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_INV_ATREAL", [REAL_CONTINUOUS_INV_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_LMUL", [REAL_CONTINUOUS_LMUL]))(thm_tac (new_rewrite [] [])))))); ((THENL_FIRST) (((((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)) ((arith_tac) THEN (done_tac))); (((((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_POW_NZ", [REAL_POW_NZ]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_IMP_NZ", [REAL_LT_IMP_NZ]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((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 [] []))))))); (((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("REAL_CONTINUOUS_ATREAL_COMPOSE", [REAL_CONTINUOUS_ATREAL_COMPOSE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); (((((use_arg_then2 ("REAL_CONTINUOUS_AT_SQRT", [REAL_CONTINUOUS_AT_SQRT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POW_LT", [REAL_POW_LT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_abs_pos_compose *) let diff2c_abs_pos_compose = Sections.section_proof ["f"] `&0 < f x ==> diff2c f x ==> diff2c (abs o f) x` [ ((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (use_arg_then2 ("diff2_abs_pos", [diff2_abs_pos])) (fun fst_arg -> (use_arg_then2 ("fn0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); (((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac)); (((fun arg_tac -> arg_tac (Arg_term (`\x. &0`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`{x | x > &0}`))) (term_tac exists_tac))); ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_OPEN_HALFSPACE_GT", [REAL_OPEN_HALFSPACE_GT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac))); ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z0"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("second_derivative_abs_pos", [second_derivative_abs_pos]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ((((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); (((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (done_tac)); ];; (* Lemma diff2c_abs_neg_compose *) let diff2c_abs_neg_compose = Sections.section_proof ["f"] `f x < &0 ==> diff2c f x ==> diff2c (abs o f) x` [ ((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (use_arg_then2 ("diff2_abs_neg", [diff2_abs_neg])) (fun fst_arg -> (use_arg_then2 ("fn0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); (((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac)); (((fun arg_tac -> arg_tac (Arg_term (`\x. &0`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`{x | x < &0}`))) (term_tac exists_tac))); ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_OPEN_HALFSPACE_LT", [REAL_OPEN_HALFSPACE_LT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (split_tac))); ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z0"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("second_derivative_abs_neg", [second_derivative_abs_neg]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ((((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); (((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (done_tac)); ];; (* Lemma diff2c_pow_compose *) let diff2c_pow_compose = Sections.section_proof ["n";"f"] `diff2c f x ==> diff2c ((\x. x pow n) o f) x` [ ((BETA_TAC THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("diff2_pow_x", [diff2_pow_x]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("second_derivative_pow_x", [second_derivative_pow_x]))(thm_tac (new_rewrite [] []))))); (((((use_arg_then2 ("REAL_CONTINUOUS_LMUL", [REAL_CONTINUOUS_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_atn_compose *) let diff2c_atn_compose = Sections.section_proof ["f"] `diff2c f x ==> diff2c (atn o f) x` [ ((BETA_TAC THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("diff2_atn", [diff2_atn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("second_derivative_atn", [second_derivative_atn]))(thm_tac (new_rewrite [] []))))); ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))); ((((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_INV_ATREAL", [REAL_CONTINUOUS_INV_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ADD", [REAL_CONTINUOUS_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); (((((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); (((use_arg_then2 ("REAL_RNEG_UNIQ", [REAL_RNEG_UNIQ]))(thm_tac (new_rewrite [] [])))); ((fun arg_tac -> (use_arg_then2 ("REAL_LE_POW_2", [REAL_LE_POW_2])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); ((arith_tac) THEN (done_tac)); ];; (* Lemma diff2c_cos_compose *) let diff2c_cos_compose = Sections.section_proof ["f"] `diff2c f x ==> diff2c (cos o f) x` [ ((BETA_TAC THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("diff2_cos", [diff2_cos]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("second_derivative_cos", [second_derivative_cos]))(thm_tac (new_rewrite [] []))))); (((((use_arg_then2 ("REAL_CONTINUOUS_NEG", [REAL_CONTINUOUS_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_COS", [REAL_CONTINUOUS_AT_COS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_sin_compose *) let diff2c_sin_compose = Sections.section_proof ["f"] `diff2c f x ==> diff2c (sin o f) x` [ ((BETA_TAC THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("diff2_sin", [diff2_sin]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("second_derivative_sin", [second_derivative_sin]))(thm_tac (new_rewrite [] []))))); (((((use_arg_then2 ("REAL_CONTINUOUS_NEG", [REAL_CONTINUOUS_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_SIN", [REAL_CONTINUOUS_AT_SIN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_exp_compose *) let diff2c_exp_compose = Sections.section_proof ["f"] `diff2c f x ==> diff2c (exp o f) x` [ ((BETA_TAC THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("diff2_exp", [diff2_exp]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("second_derivative_exp", [second_derivative_exp]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("REAL_CONTINUOUS_AT_EXP", [REAL_CONTINUOUS_AT_EXP]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma diff2c_log_compose *) let diff2c_log_compose = Sections.section_proof ["f"] `&0 < f x ==> diff2c f x ==> diff2c (log o f) x` [ ((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (use_arg_then2 ("diff2_log", [diff2_log])) (fun fst_arg -> (use_arg_then2 ("fn0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); (((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac)); (((fun arg_tac -> arg_tac (Arg_term (`\x. -- inv (x pow 2)`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`{x | x > &0}`))) (term_tac exists_tac))); ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_OPEN_HALFSPACE_GT", [REAL_OPEN_HALFSPACE_GT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac))); ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z0"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("second_derivative_log", [second_derivative_log]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ((THENL_LAST) (split_tac) (((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (done_tac))); ((((use_arg_then2 ("REAL_CONTINUOUS_NEG", [REAL_CONTINUOUS_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_INV_ATREAL", [REAL_CONTINUOUS_INV_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] [])))))); (((((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fn0", [])) (disch_tac [])) THEN (clear_assumption "fn0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ];; (* Lemma diff2c_acs_compose *) let diff2c_acs_compose = Sections.section_proof ["f"] `abs (f x) < &1 ==> diff2c f x ==> diff2c (acs o f) x` [ ((BETA_TAC THEN (move ["fn1"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (use_arg_then2 ("diff2_acs", [diff2_acs])) (fun fst_arg -> (use_arg_then2 ("fn1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); (((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac)); (((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))); ((((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_OPEN_HALFSPACE_GT", [REAL_OPEN_HALFSPACE_GT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_OPEN_HALFSPACE_LT", [REAL_OPEN_HALFSPACE_LT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); ((THENL_ROT (-1)) (((repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac))); ((BETA_TAC THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["a"])) THEN (case THEN (move ["a1"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (case THEN (move ["b"])) THEN (case THEN (move ["b1"])) THEN (move ["ab"])) THEN ((((use_arg_then2 ("second_derivative_acs", [second_derivative_acs]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); ((((use_arg_then2 ("a1", [])) (disch_tac [])) THEN (clear_assumption "a1") THEN ((use_arg_then2 ("b1", [])) (disch_tac [])) THEN (clear_assumption "b1") THEN ((use_arg_then2 ("ab", [])) (disch_tac [])) THEN (clear_assumption "ab") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((THENL_LAST) (split_tac) ((split_tac) THEN ((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("fn1", [])) (disch_tac [])) THEN (clear_assumption "fn1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); (((use_arg_then2 ("REAL_CONTINUOUS_NEG", [REAL_CONTINUOUS_NEG]))(thm_tac (new_rewrite [] [])))); ((use_arg_then2 ("REAL_CONTINUOUS_DIV_ATREAL", [REAL_CONTINUOUS_DIV_ATREAL])) (thm_tac apply_tac)); ((fun arg_tac -> arg_tac (Arg_term (`&0 < (&1 - f x * f x) pow 3`))) (term_tac (have_gen_tac [](move ["h"])))); (((use_arg_then2 ("REAL_POW_LT", [REAL_POW_LT]))(thm_tac (new_rewrite [] [])))); ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. &1 - a * a = (&1 - a) * (&1 + a)`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("fn1", [])) (disch_tac [])) THEN (clear_assumption "fn1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac))); (((((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_LT", [REAL_LE_LT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LT_IMP_NZ", [REAL_LT_IMP_NZ]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((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 [] []))))))); (((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("REAL_CONTINUOUS_ATREAL_COMPOSE", [REAL_CONTINUOUS_ATREAL_COMPOSE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_SQRT", [REAL_CONTINUOUS_AT_SQRT]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); ((((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_SUB", [REAL_CONTINUOUS_SUB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] []))))); (((((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma diff2c_asn_compose *) let diff2c_asn_compose = Sections.section_proof ["f"] `abs (f x) < &1 ==> diff2c f x ==> diff2c (asn o f) x` [ ((BETA_TAC THEN (move ["fn1"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (use_arg_then2 ("diff2_asn", [diff2_asn])) (fun fst_arg -> (use_arg_then2 ("fn1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); (((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac)); (((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))); ((((use_arg_then2 ("REAL_OPEN_INTER", [REAL_OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_OPEN_HALFSPACE_GT", [REAL_OPEN_HALFSPACE_GT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_OPEN_HALFSPACE_LT", [REAL_OPEN_HALFSPACE_LT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); ((THENL_ROT (-1)) (((repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac))); ((BETA_TAC THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["a"])) THEN (case THEN (move ["a1"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (case THEN (move ["b"])) THEN (case THEN (move ["b1"])) THEN (move ["ab"])) THEN ((((use_arg_then2 ("second_derivative_asn", [second_derivative_asn]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); ((((use_arg_then2 ("a1", [])) (disch_tac [])) THEN (clear_assumption "a1") THEN ((use_arg_then2 ("b1", [])) (disch_tac [])) THEN (clear_assumption "b1") THEN ((use_arg_then2 ("ab", [])) (disch_tac [])) THEN (clear_assumption "ab") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((THENL_LAST) (split_tac) ((split_tac) THEN ((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("fn1", [])) (disch_tac [])) THEN (clear_assumption "fn1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); ((use_arg_then2 ("REAL_CONTINUOUS_DIV_ATREAL", [REAL_CONTINUOUS_DIV_ATREAL])) (thm_tac apply_tac)); ((fun arg_tac -> arg_tac (Arg_term (`&0 < (&1 - f x * f x) pow 3`))) (term_tac (have_gen_tac [](move ["h"])))); (((use_arg_then2 ("REAL_POW_LT", [REAL_POW_LT]))(thm_tac (new_rewrite [] [])))); ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. &1 - a * a = (&1 - a) * (&1 + a)`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("fn1", [])) (disch_tac [])) THEN (clear_assumption "fn1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac))); (((((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_LT", [REAL_LE_LT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LT_IMP_NZ", [REAL_LT_IMP_NZ]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((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 [] []))))))); (((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("REAL_CONTINUOUS_ATREAL_COMPOSE", [REAL_CONTINUOUS_ATREAL_COMPOSE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_SQRT", [REAL_CONTINUOUS_AT_SQRT]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); ((((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_SUB", [REAL_CONTINUOUS_SUB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] []))))); (((((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma diff2c_matan_compose *) let diff2c_matan_compose = Sections.section_proof ["f"] `-- &1 < f x ==> diff2c f x ==> diff2c (matan o f) x` [ ((BETA_TAC THEN (move ["fn1"]) THEN (move ["d2f"])) THEN (((use_arg_then2 ("diff2c_uni_compose", [diff2c_uni_compose]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (use_arg_then2 ("diff2_matan", [diff2_matan])) (fun fst_arg -> (use_arg_then2 ("fn1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x < &1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["fn2"]))); ((((use_arg_then2 ("real_cont_atreal_local", [real_cont_atreal_local])) (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_eq_real_derivative", [derivative_eq_real_derivative]))(thm_tac (new_rewrite [] [])))))); ((fun arg_tac -> arg_tac (Arg_term (`\x. (&3 / &4 * atn (sqrt x) / (x pow 2 * sqrt x) - &3 / &4 * inv (x pow 2 * (x + &1))) - &1 / &2 * inv (x * (x + &1) pow 2)`))) (term_tac (set_tac "g"))); (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval (&0, f x + &1)`))) (term_tac exists_tac))); ((THENL_ROT (-1)) (((((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (split_tac))); ((BETA_TAC THEN (move ["y"]) THEN (move ["y_ineq"])) THEN ((((use_arg_then2 ("Matan.matan_second_derivative_gt0", [Matan.matan_second_derivative_gt0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((THENL_LAST) (split_tac) ((((use_arg_then2 ("fn2", [])) (disch_tac [])) THEN (clear_assumption "fn2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); ((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_SUB", [REAL_CONTINUOUS_SUB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_LMUL", [REAL_CONTINUOUS_LMUL]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("REAL_CONTINUOUS_INV_ATREAL", [REAL_CONTINUOUS_INV_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); (((((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ADD", [REAL_CONTINUOUS_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("fn2", [])) (disch_tac [])) THEN (clear_assumption "fn2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((((use_arg_then2 ("REAL_CONTINUOUS_SUB", [REAL_CONTINUOUS_SUB]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_CONTINUOUS_LMUL", [REAL_CONTINUOUS_LMUL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_DIV_ATREAL)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] []))))); (((((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_SQRT", [REAL_CONTINUOUS_AT_SQRT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((THENL_LAST) (((((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)) ((((use_arg_then2 ("fn2", [])) (disch_tac [])) THEN (clear_assumption "fn2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`atn`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ATREAL_COMPOSE", [REAL_CONTINUOUS_ATREAL_COMPOSE]))(thm_tac (new_rewrite [] []))))); (((((use_arg_then2 ("REAL_CONTINUOUS_AT_ATN", [REAL_CONTINUOUS_AT_ATN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_AT_SQRT", [REAL_CONTINUOUS_AT_SQRT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("fn2", [])) (disch_tac [])) THEN (clear_assumption "fn2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((((use_arg_then2 ("REAL_CONTINUOUS_INV_ATREAL", [REAL_CONTINUOUS_INV_ATREAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); (((((use_arg_then2 ("REAL_CONTINUOUS_POW", [REAL_CONTINUOUS_POW]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_ADD", [REAL_CONTINUOUS_ADD]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_AT_ID", [REAL_CONTINUOUS_AT_ID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); (((((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("fn2", [])) (disch_tac [])) THEN (clear_assumption "fn2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((((use_arg_then2 ("nth_derivative2", [nth_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_eq_real_derivative", [derivative_eq_real_derivative]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Matan.ddmatan", [Matan.ddmatan]))(gsym_then (thm_tac (new_rewrite [] [])))))); (((use_arg_then2 ("HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL", [HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL])) (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL") THEN (DISCH_THEN apply_tac)); (((use_arg_then2 ("Matan.matan_second_derivative_abs1", [Matan.matan_second_derivative_abs1])) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((((use_arg_then2 ("Matan.ddmatan", [Matan.ddmatan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["d2"]))); ((fun arg_tac -> arg_tac (Arg_term (`\i. -- &1 pow (i + 2) * &((i + 1) * (i + 2)) / &(2 * i + 5)`))) (term_tac (set_tac "a"))); (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Series.power_series_has_derivative", [Series.power_series_has_derivative])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`ddmatan`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`from 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN ((((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("d2", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (BETA_TAC THEN (case THEN (move ["h"])) THEN (move ["h_diff"])); (((fun arg_tac -> arg_tac (Arg_term (`h (f x)`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("h_diff", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fn1", [])) (disch_tac [])) THEN (clear_assumption "fn1") THEN ((use_arg_then2 ("fn2", [])) (disch_tac [])) THEN (clear_assumption "fn2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ];; (* Finalization of the section Composite *) let nth_diff_strong_eq_on_open = Sections.finalize_theorem nth_diff_strong_eq_on_open;; let diff2_imp_cont = Sections.finalize_theorem diff2_imp_cont;; let diff2_imp_partial_cont = Sections.finalize_theorem diff2_imp_partial_cont;; let diff2c_uni_compose = Sections.finalize_theorem diff2c_uni_compose;; let real_open_delete = Sections.finalize_theorem real_open_delete;; let diff2c_inv_compose = Sections.finalize_theorem diff2c_inv_compose;; let diff2c_sqrt_compose = Sections.finalize_theorem diff2c_sqrt_compose;; let diff2c_abs_pos_compose = Sections.finalize_theorem diff2c_abs_pos_compose;; let diff2c_abs_neg_compose = Sections.finalize_theorem diff2c_abs_neg_compose;; let diff2c_pow_compose = Sections.finalize_theorem diff2c_pow_compose;; let diff2c_atn_compose = Sections.finalize_theorem diff2c_atn_compose;; let diff2c_cos_compose = Sections.finalize_theorem diff2c_cos_compose;; let diff2c_sin_compose = Sections.finalize_theorem diff2c_sin_compose;; let diff2c_exp_compose = Sections.finalize_theorem diff2c_exp_compose;; let diff2c_log_compose = Sections.finalize_theorem diff2c_log_compose;; let diff2c_acs_compose = Sections.finalize_theorem diff2c_acs_compose;; let diff2c_asn_compose = Sections.finalize_theorem diff2c_asn_compose;; let diff2c_matan_compose = Sections.finalize_theorem diff2c_matan_compose;; Sections.end_section "Composite";; (* Lemma diff2c_add *) let diff2c_add = Sections.section_proof ["f";"g"] `diff2c f x ==> diff2c g x ==> diff2c (\x. f x + g x) x` [ (((repeat_tactic 1 9 (((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["p2f"]))) THEN (case THEN ((move ["d2g"]) THEN (move ["p2g"])))) THEN (((((use_arg_then2 ("diff2_add", [diff2_add]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"]))); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("p2g", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("p2f", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["p2fij"]) THEN (move ["p2gij"]))); ((use_arg_then2 ("real_cont_at_local", [real_cont_at_local])) (thm_tac apply_tac)); ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["d2f"]))); ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["d2g"])); (((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))); ((THENL_FIRST) ((repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("OPEN_INTER", [OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ADD", [REAL_CONTINUOUS_ADD]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac))); ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((((use_arg_then2 ("second_partial_add", [second_partial_add]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma diff2c_sub *) let diff2c_sub = Sections.section_proof ["f";"g"] `diff2c f x ==> diff2c g x ==> diff2c (\x. f x - g x) x` [ ((BETA_TAC THEN (move ["d2f"]) THEN (move ["d2g"])) THEN ((((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_add", [diff2c_add]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("diff2c_neg", [diff2c_neg]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_mul *) let diff2c_mul = Sections.section_proof ["f";"g"] `diff2c f x ==> diff2c g x ==> diff2c (\x. f x * g x) x` [ (((repeat_tactic 1 9 (((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["p2f"]))) THEN (case THEN ((move ["d2g"]) THEN (move ["p2g"])))) THEN (((((use_arg_then2 ("diff2_mul", [diff2_mul]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"]))); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("p2g", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("p2f", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["p2fij"]) THEN (move ["p2gij"]))); ((use_arg_then2 ("real_cont_at_local", [real_cont_at_local])) (thm_tac apply_tac)); ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["d2f"]))); ((((use_arg_then2 ("diff2_eq_diff2_on_open", [diff2_eq_diff2_on_open]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["d2g"])); (((fun arg_tac -> arg_tac (Arg_term (`(\x. (partial2 j i f x * g x + partial i f x * partial j g x) + 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))); ((THENL_ROT (-1)) (((repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("OPEN_INTER", [OPEN_INTER]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN (split_tac))); ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((((use_arg_then2 ("second_partial_mul", [second_partial_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_CONTINUOUS_ADD", [REAL_CONTINUOUS_ADD]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_CONTINUOUS_MUL", [REAL_CONTINUOUS_MUL]))(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("p2gij", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("p2fij", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_imp_partial_cont", [diff2_imp_partial_cont]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_imp_cont", [diff2_imp_cont]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Finalization of the section Point *) let diff2c_scale = Sections.finalize_theorem diff2c_scale;; let diff2c_neg = Sections.finalize_theorem diff2c_neg;; let nth_diff_strong_eq_on_open = Sections.finalize_theorem nth_diff_strong_eq_on_open;; let diff2_imp_cont = Sections.finalize_theorem diff2_imp_cont;; let diff2_imp_partial_cont = Sections.finalize_theorem diff2_imp_partial_cont;; let diff2c_uni_compose = Sections.finalize_theorem diff2c_uni_compose;; let real_open_delete = Sections.finalize_theorem real_open_delete;; let diff2c_inv_compose = Sections.finalize_theorem diff2c_inv_compose;; let diff2c_sqrt_compose = Sections.finalize_theorem diff2c_sqrt_compose;; let diff2c_abs_pos_compose = Sections.finalize_theorem diff2c_abs_pos_compose;; let diff2c_abs_neg_compose = Sections.finalize_theorem diff2c_abs_neg_compose;; let diff2c_pow_compose = Sections.finalize_theorem diff2c_pow_compose;; let diff2c_atn_compose = Sections.finalize_theorem diff2c_atn_compose;; let diff2c_cos_compose = Sections.finalize_theorem diff2c_cos_compose;; let diff2c_sin_compose = Sections.finalize_theorem diff2c_sin_compose;; let diff2c_exp_compose = Sections.finalize_theorem diff2c_exp_compose;; let diff2c_log_compose = Sections.finalize_theorem diff2c_log_compose;; let diff2c_acs_compose = Sections.finalize_theorem diff2c_acs_compose;; let diff2c_asn_compose = Sections.finalize_theorem diff2c_asn_compose;; let diff2c_matan_compose = Sections.finalize_theorem diff2c_matan_compose;; let diff2c_add = Sections.finalize_theorem diff2c_add;; let diff2c_sub = Sections.finalize_theorem diff2c_sub;; let diff2c_mul = Sections.finalize_theorem diff2c_mul;; Sections.end_section "Point";; (* Section Domain *) Sections.begin_section "Domain";; (Sections.add_section_var (mk_var ("f", (`:real^N -> real`))); Sections.add_section_var (mk_var ("g", (`:real^N -> real`))));; (Sections.add_section_hyp "d2f" (`diff2c_domain domain f`));; (* Lemma diff2c_domain_scale *) let diff2c_domain_scale = Sections.section_proof ["c"] `diff2c_domain domain (\x. c * f x)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_scale", [diff2c_scale]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_neg *) let diff2c_domain_neg = Sections.section_proof [] `diff2c_domain domain (\x. --f x)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_neg", [diff2c_neg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (Sections.add_section_var (mk_var ("bounds", (`:real#real`))));; (* Lemma diff2c_domain_inv_compose *) let diff2c_domain_inv_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> interval_not_zero bounds ==> diff2c_domain domain (inv o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2c_inv_compose", [diff2c_inv_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_not_zero", [interval_arith_not_zero])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_sqrt_compose *) let diff2c_domain_sqrt_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> interval_pos bounds ==> diff2c_domain domain (sqrt o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2c_sqrt_compose", [diff2c_sqrt_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_abs_pos_compose *) let diff2c_domain_abs_pos_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> interval_pos bounds ==> diff2c_domain domain (abs o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2c_abs_pos_compose", [diff2c_abs_pos_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_abs_neg_compose *) let diff2c_domain_abs_neg_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> interval_neg bounds ==> diff2c_domain domain (abs o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2c_abs_neg_compose", [diff2c_abs_neg_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_neg", [interval_arith_neg])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_pow_compose *) let diff2c_domain_pow_compose = Sections.section_proof ["n"] `diff2c_domain domain ((\x. x pow n) o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_pow_compose", [diff2c_pow_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_atn_compose *) let diff2c_domain_atn_compose = Sections.section_proof [] `diff2c_domain domain (atn o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_atn_compose", [diff2c_atn_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_cos_compose *) let diff2c_domain_cos_compose = Sections.section_proof [] `diff2c_domain domain (cos o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_cos_compose", [diff2c_cos_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_sin_compose *) let diff2c_domain_sin_compose = Sections.section_proof [] `diff2c_domain domain (sin o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_sin_compose", [diff2c_sin_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_exp_compose *) let diff2c_domain_exp_compose = Sections.section_proof [] `diff2c_domain domain (exp o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_exp_compose", [diff2c_exp_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_log_compose *) let diff2c_domain_log_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> interval_pos bounds ==> diff2c_domain domain (log o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2c_log_compose", [diff2c_log_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_pos", [interval_arith_pos])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_acs_compose *) let diff2c_domain_acs_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> iabs bounds < &1 ==> diff2c_domain domain (acs o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2c_acs_compose", [diff2c_acs_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_asn_compose *) let diff2c_domain_asn_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> iabs bounds < &1 ==> diff2c_domain domain (asn o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2c_asn_compose", [diff2c_asn_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_abs", [interval_arith_abs])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_matan_compose *) let diff2c_domain_matan_compose = Sections.section_proof [] `m_bounded_on_int f domain bounds ==> interval_gt (-- &1) bounds ==> diff2c_domain domain (matan o f)` [ ((((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then2 ("m_bounded_on_int", [m_bounded_on_int]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); (((((use_arg_then2 ("diff2c_matan_compose", [diff2c_matan_compose]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("interval_arith_gt", [interval_arith_gt])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (Sections.add_section_hyp "d2g" (`diff2c_domain domain g`));; (* Lemma diff2c_domain_add *) let diff2c_domain_add = Sections.section_proof [] `diff2c_domain domain (\x. f x + g x)` [ ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_add", [diff2c_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_sub *) let diff2c_domain_sub = Sections.section_proof [] `diff2c_domain domain (\x. f x - g x)` [ ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_sub", [diff2c_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_mul *) let diff2c_domain_mul = Sections.section_proof [] `diff2c_domain domain (\x. f x * g x)` [ ((((use_arg_then2 ("d2g", [])) (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then2 ("d2f", [])) (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("diff2c_mul", [diff2c_mul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Finalization of the section Domain *) let diff2c_domain_scale = Sections.finalize_theorem diff2c_domain_scale;; let diff2c_domain_neg = Sections.finalize_theorem diff2c_domain_neg;; let diff2c_domain_inv_compose = Sections.finalize_theorem diff2c_domain_inv_compose;; let diff2c_domain_sqrt_compose = Sections.finalize_theorem diff2c_domain_sqrt_compose;; let diff2c_domain_abs_pos_compose = Sections.finalize_theorem diff2c_domain_abs_pos_compose;; let diff2c_domain_abs_neg_compose = Sections.finalize_theorem diff2c_domain_abs_neg_compose;; let diff2c_domain_pow_compose = Sections.finalize_theorem diff2c_domain_pow_compose;; let diff2c_domain_atn_compose = Sections.finalize_theorem diff2c_domain_atn_compose;; let diff2c_domain_cos_compose = Sections.finalize_theorem diff2c_domain_cos_compose;; let diff2c_domain_sin_compose = Sections.finalize_theorem diff2c_domain_sin_compose;; let diff2c_domain_exp_compose = Sections.finalize_theorem diff2c_domain_exp_compose;; let diff2c_domain_log_compose = Sections.finalize_theorem diff2c_domain_log_compose;; let diff2c_domain_acs_compose = Sections.finalize_theorem diff2c_domain_acs_compose;; let diff2c_domain_asn_compose = Sections.finalize_theorem diff2c_domain_asn_compose;; let diff2c_domain_matan_compose = Sections.finalize_theorem diff2c_domain_matan_compose;; let diff2c_domain_add = Sections.finalize_theorem diff2c_domain_add;; let diff2c_domain_sub = Sections.finalize_theorem diff2c_domain_sub;; let diff2c_domain_mul = Sections.finalize_theorem diff2c_domain_mul;; Sections.end_section "Domain";; (* Finalization of the section Diff2c *) let real_cont_at_local = Sections.finalize_theorem real_cont_at_local;; let real_cont_atreal_local = Sections.finalize_theorem real_cont_atreal_local;; let diff2c_scale = Sections.finalize_theorem diff2c_scale;; let diff2c_neg = Sections.finalize_theorem diff2c_neg;; let nth_diff_strong_eq_on_open = Sections.finalize_theorem nth_diff_strong_eq_on_open;; let diff2_imp_cont = Sections.finalize_theorem diff2_imp_cont;; let diff2_imp_partial_cont = Sections.finalize_theorem diff2_imp_partial_cont;; let diff2c_uni_compose = Sections.finalize_theorem diff2c_uni_compose;; let real_open_delete = Sections.finalize_theorem real_open_delete;; let diff2c_inv_compose = Sections.finalize_theorem diff2c_inv_compose;; let diff2c_sqrt_compose = Sections.finalize_theorem diff2c_sqrt_compose;; let diff2c_abs_pos_compose = Sections.finalize_theorem diff2c_abs_pos_compose;; let diff2c_abs_neg_compose = Sections.finalize_theorem diff2c_abs_neg_compose;; let diff2c_pow_compose = Sections.finalize_theorem diff2c_pow_compose;; let diff2c_atn_compose = Sections.finalize_theorem diff2c_atn_compose;; let diff2c_cos_compose = Sections.finalize_theorem diff2c_cos_compose;; let diff2c_sin_compose = Sections.finalize_theorem diff2c_sin_compose;; let diff2c_exp_compose = Sections.finalize_theorem diff2c_exp_compose;; let diff2c_log_compose = Sections.finalize_theorem diff2c_log_compose;; let diff2c_acs_compose = Sections.finalize_theorem diff2c_acs_compose;; let diff2c_asn_compose = Sections.finalize_theorem diff2c_asn_compose;; let diff2c_matan_compose = Sections.finalize_theorem diff2c_matan_compose;; let diff2c_add = Sections.finalize_theorem diff2c_add;; let diff2c_sub = Sections.finalize_theorem diff2c_sub;; let diff2c_mul = Sections.finalize_theorem diff2c_mul;; let diff2c_domain_scale = Sections.finalize_theorem diff2c_domain_scale;; let diff2c_domain_neg = Sections.finalize_theorem diff2c_domain_neg;; let diff2c_domain_inv_compose = Sections.finalize_theorem diff2c_domain_inv_compose;; let diff2c_domain_sqrt_compose = Sections.finalize_theorem diff2c_domain_sqrt_compose;; let diff2c_domain_abs_pos_compose = Sections.finalize_theorem diff2c_domain_abs_pos_compose;; let diff2c_domain_abs_neg_compose = Sections.finalize_theorem diff2c_domain_abs_neg_compose;; let diff2c_domain_pow_compose = Sections.finalize_theorem diff2c_domain_pow_compose;; let diff2c_domain_atn_compose = Sections.finalize_theorem diff2c_domain_atn_compose;; let diff2c_domain_cos_compose = Sections.finalize_theorem diff2c_domain_cos_compose;; let diff2c_domain_sin_compose = Sections.finalize_theorem diff2c_domain_sin_compose;; let diff2c_domain_exp_compose = Sections.finalize_theorem diff2c_domain_exp_compose;; let diff2c_domain_log_compose = Sections.finalize_theorem diff2c_domain_log_compose;; let diff2c_domain_acs_compose = Sections.finalize_theorem diff2c_domain_acs_compose;; let diff2c_domain_asn_compose = Sections.finalize_theorem diff2c_domain_asn_compose;; let diff2c_domain_matan_compose = Sections.finalize_theorem diff2c_domain_matan_compose;; let diff2c_domain_add = Sections.finalize_theorem diff2c_domain_add;; let diff2c_domain_sub = Sections.finalize_theorem diff2c_domain_sub;; let diff2c_domain_mul = Sections.finalize_theorem diff2c_domain_mul;; Sections.end_section "Diff2c";; (* Section M_LinApprox *) Sections.begin_section "M_LinApprox";; (Sections.add_section_var (mk_var ("f", (`:real^N -> real`))); Sections.add_section_var (mk_var ("g", (`:real^N -> real`))));; (Sections.add_section_var (mk_var ("bounds", (`:real#real`))));; (Sections.add_section_var (mk_var ("d_bounds_list", (`:(real#real)list`))));; (Sections.add_section_var (mk_var ("x", (`:real^N`))));; (* Lemma m_lin_approx_neg *) let m_lin_approx_neg = Sections.section_proof [] `(lift o f) differentiable at x ==> interval_arith (--f x) bounds ==> all_n 1 d_bounds_list (\i int. interval_arith (--partial i f x) int) ==> m_lin_approx (\x. --f x) x bounds d_bounds_list` [ (BETA_TAC THEN (move ["df"]) THEN (move ["b"]) THEN (move ["db"])); ((THENL_FIRST) ((((use_arg_then2 ("m_lin_approx", [m_lin_approx]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("b", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_lift_neg", [f_lift_neg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_NEG", [DIFFERENTIABLE_NEG]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac))); ((ASM_SIMP_TAC[partial_neg]) THEN (done_tac)); ];; (* Lemma m_lin_approx_scale *) let m_lin_approx_scale = Sections.section_proof ["c"] `(lift o f) differentiable at x ==> interval_arith (c * f x) bounds ==> all_n 1 d_bounds_list (\i int. interval_arith (c * partial i f x) int) ==> m_lin_approx (\x. c * f x) x bounds d_bounds_list` [ (BETA_TAC THEN (move ["df"]) THEN (move ["bH"]) THEN (move ["dbH"])); ((THENL_FIRST) ((((use_arg_then2 ("m_lin_approx", [m_lin_approx]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("bH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_lift_scale", [f_lift_scale]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CMUL", [DIFFERENTIABLE_CMUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac))); ((ASM_SIMP_TAC[partial_scale]) THEN (done_tac)); ];; (* Lemma m_lin_approx_add *) let m_lin_approx_add = Sections.section_proof [] `(lift o f) differentiable at x ==> (lift o g) differentiable at x ==> interval_arith (f x + g x) bounds ==> all_n 1 d_bounds_list (\i int. interval_arith (partial i f x + partial i g x) int) ==> m_lin_approx (\x. f x + g x) x bounds d_bounds_list` [ (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["bH"]) THEN (move ["dbH"])); ((THENL_FIRST) ((((use_arg_then2 ("m_lin_approx", [m_lin_approx]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("bH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_lift_add", [f_lift_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_ADD", [DIFFERENTIABLE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac))); ((ASM_SIMP_TAC[partial_add]) THEN (done_tac)); ];; (* Lemma m_lin_approx_sub *) let m_lin_approx_sub = Sections.section_proof [] `(lift o f) differentiable at x ==> (lift o g) differentiable at x ==> interval_arith (f x - g x) bounds ==> all_n 1 d_bounds_list (\i int. interval_arith (partial i f x - partial i g x) int) ==> m_lin_approx (\x. f x - g x) x bounds d_bounds_list` [ (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["bH"]) THEN (move ["dbH"])); ((THENL_FIRST) ((((use_arg_then2 ("m_lin_approx", [m_lin_approx]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("bH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_lift_sub", [f_lift_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIFFERENTIABLE_SUB", [DIFFERENTIABLE_SUB]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac))); ((ASM_SIMP_TAC[partial_sub]) THEN (done_tac)); ];; (* Lemma m_lin_approx_mul *) let m_lin_approx_mul = Sections.section_proof [] `(lift o f) differentiable at x ==> (lift o g) differentiable at x ==> interval_arith (f x * g x) bounds ==> all_n 1 d_bounds_list (\i int. interval_arith (partial i f x * g x + f x * partial i g x) int) ==> m_lin_approx (\x. f x * g x) x bounds d_bounds_list` [ (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["bH"]) THEN (move ["dbH"])); ((((use_arg_then2 ("m_lin_approx", [m_lin_approx]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("bH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("differentiable_mul", [differentiable_mul]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); ((ASM_SIMP_TAC[partial_mul]) THEN (done_tac)); ];; (* Finalization of the section M_LinApprox *) let m_lin_approx_neg = Sections.finalize_theorem m_lin_approx_neg;; let m_lin_approx_scale = Sections.finalize_theorem m_lin_approx_scale;; let m_lin_approx_add = Sections.finalize_theorem m_lin_approx_add;; let m_lin_approx_sub = Sections.finalize_theorem m_lin_approx_sub;; let m_lin_approx_mul = Sections.finalize_theorem m_lin_approx_mul;; Sections.end_section "M_LinApprox";; let second_bounded = new_definition `second_bounded f domain dd_bounds_list <=> !x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i (\j int. interval_arith (partial2 j i f x) int))`;; let m_taylor_interval = new_definition `m_taylor_interval f domain y w f_bounds d_bounds_list dd_bounds_list <=> m_cell_domain domain y w /\ diff2c_domain domain f /\ m_lin_approx f y f_bounds d_bounds_list /\ second_bounded f domain dd_bounds_list`;; (* Section M_TaylorIntervalArith *) Sections.begin_section "M_TaylorIntervalArith";; (Sections.add_section_var (mk_var ("f", (`:real^N -> real`))); Sections.add_section_var (mk_var ("g", (`:real^N -> real`))));; (Sections.add_section_var (mk_var ("x", (`:real^N`))); Sections.add_section_var (mk_var ("z", (`:real^N`))); Sections.add_section_var (mk_var ("y", (`:real^N`))); Sections.add_section_var (mk_var ("w", (`:real^N`))));; (Sections.add_section_var (mk_var ("domain", (`:real^N#real^N`))));; (Sections.add_section_var (mk_var ("f_bounds", (`:real#real`))); Sections.add_section_var (mk_var ("g_bounds", (`:real#real`))); Sections.add_section_var (mk_var ("bounds", (`:real#real`))));; (Sections.add_section_var (mk_var ("df_bounds_list", (`:(real#real)list`))); Sections.add_section_var (mk_var ("dg_bounds_list", (`:(real#real)list`))); Sections.add_section_var (mk_var ("d_bounds_list", (`:(real#real)list`))));; (Sections.add_section_var (mk_var ("ddf_bounds_list", (`:((real#real)list)list`))); Sections.add_section_var (mk_var ("ddg_bounds_list", (`:((real#real)list)list`))); Sections.add_section_var (mk_var ("dd_bounds_list", (`:((real#real)list)list`))));; (Sections.add_section_hyp "domainH" (`m_cell_domain domain y w`));; (Sections.add_section_hyp "d2f" (`diff2c_domain domain f`));; (* Lemma m_taylor_inv_compose *) let m_taylor_inv_compose = Sections.section_proof [] `m_bounded_on_int f domain f_bounds ==> interval_not_zero f_bounds ==> m_lin_approx (inv o f) y bounds d_bounds_list ==> second_bounded (inv o f) domain dd_bounds_list ==> m_taylor_interval (inv o f) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_inv_compose", [diff2c_domain_inv_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma m_taylor_sqrt_compose *) let m_taylor_sqrt_compose = Sections.section_proof [] `m_bounded_on_int f domain f_bounds ==> interval_pos f_bounds ==> m_lin_approx (sqrt o f) y bounds d_bounds_list ==> second_bounded (sqrt o f) domain dd_bounds_list ==> m_taylor_interval (sqrt o f) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_sqrt_compose", [diff2c_domain_sqrt_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma m_taylor_abs_pos_compose *) let m_taylor_abs_pos_compose = Sections.section_proof [] `m_bounded_on_int f domain f_bounds ==> interval_pos f_bounds ==> m_lin_approx (abs o f) y bounds d_bounds_list ==> second_bounded (abs o f) domain dd_bounds_list ==> m_taylor_interval (abs o f) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_abs_pos_compose", [diff2c_domain_abs_pos_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma m_taylor_abs_neg_compose *) let m_taylor_abs_neg_compose = Sections.section_proof [] `m_bounded_on_int f domain f_bounds ==> interval_neg f_bounds ==> m_lin_approx (abs o f) y bounds d_bounds_list ==> second_bounded (abs o f) domain dd_bounds_list ==> m_taylor_interval (abs o f) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_abs_neg_compose", [diff2c_domain_abs_neg_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma m_taylor_pow_compose *) let m_taylor_pow_compose = Sections.section_proof ["n"] `m_lin_approx ((\x. x pow n) o f) y bounds d_bounds_list ==> second_bounded ((\x. x pow n) o f) domain dd_bounds_list ==> m_taylor_interval ((\x. x pow n) o f) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_pow_compose", [diff2c_domain_pow_compose]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma m_taylor_atn_compose *) let m_taylor_atn_compose = Sections.section_proof [] `m_lin_approx (atn o f) y bounds d_bounds_list ==> second_bounded (atn o f) domain dd_bounds_list ==> m_taylor_interval (atn o f) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_atn_compose", [diff2c_domain_atn_compose]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma m_taylor_cos_compose *) let m_taylor_cos_compose = Sections.section_proof [] `m_lin_approx (cos o f) y bounds d_bounds_list ==> second_bounded (cos o f) domain dd_bounds_list ==> m_taylor_interval (cos o f) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_cos_compose", [diff2c_domain_cos_compose]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma m_taylor_sin_compose *) let m_taylor_sin_compose = Sections.section_proof [] `m_lin_approx (sin o f) y bounds d_bounds_list ==> second_bounded (sin o f) domain dd_bounds_list ==> m_taylor_interval (sin o f) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_sin_compose", [diff2c_domain_sin_compose]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma m_taylor_exp_compose *) let m_taylor_exp_compose = Sections.section_proof [] `m_lin_approx (exp o f) y bounds d_bounds_list ==> second_bounded (exp o f) domain dd_bounds_list ==> m_taylor_interval (exp o f) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_exp_compose", [diff2c_domain_exp_compose]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma m_taylor_log_compose *) let m_taylor_log_compose = Sections.section_proof [] `m_bounded_on_int f domain f_bounds ==> interval_pos f_bounds ==> m_lin_approx (log o f) y bounds d_bounds_list ==> second_bounded (log o f) domain dd_bounds_list ==> m_taylor_interval (log o f) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_log_compose", [diff2c_domain_log_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma m_taylor_acs_compose *) let m_taylor_acs_compose = Sections.section_proof [] `m_bounded_on_int f domain f_bounds ==> iabs f_bounds < &1 ==> m_lin_approx (acs o f) y bounds d_bounds_list ==> second_bounded (acs o f) domain dd_bounds_list ==> m_taylor_interval (acs o f) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_acs_compose", [diff2c_domain_acs_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma m_taylor_asn_compose *) let m_taylor_asn_compose = Sections.section_proof [] `m_bounded_on_int f domain f_bounds ==> iabs f_bounds < &1 ==> m_lin_approx (asn o f) y bounds d_bounds_list ==> second_bounded (asn o f) domain dd_bounds_list ==> m_taylor_interval (asn o f) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_asn_compose", [diff2c_domain_asn_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma m_taylor_matan_compose *) let m_taylor_matan_compose = Sections.section_proof [] `m_bounded_on_int f domain f_bounds ==> interval_gt (-- &1) f_bounds ==> m_lin_approx (matan o f) y bounds d_bounds_list ==> second_bounded (matan o f) domain dd_bounds_list ==> m_taylor_interval (matan o f) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diff2c_domain_matan_compose", [diff2c_domain_matan_compose])) (fun fst_arg -> (use_arg_then2 ("d2f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bf", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ];; (* Lemma m_taylor_neg *) let m_taylor_neg = Sections.section_proof [] `m_lin_approx (\x. --f x) y bounds d_bounds_list ==> second_bounded (\x. --f x) domain dd_bounds_list ==> m_taylor_interval (\x. --f x) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_neg", [diff2c_domain_neg]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma m_taylor_scale *) let m_taylor_scale = Sections.section_proof ["c"] `m_lin_approx (\x. c * f x) y bounds d_bounds_list ==> second_bounded (\x. c * f x) domain dd_bounds_list ==> m_taylor_interval (\x. c * f x) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_scale", [diff2c_domain_scale]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (Sections.add_section_hyp "d2g" (`diff2c_domain domain g`));; (* Lemma m_taylor_add *) let m_taylor_add = Sections.section_proof [] `m_lin_approx (\x. f x + g x) y bounds d_bounds_list ==> second_bounded (\x. f x + g x) domain dd_bounds_list ==> m_taylor_interval (\x. f x + g x) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_add", [diff2c_domain_add]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma m_taylor_sub *) let m_taylor_sub = Sections.section_proof [] `m_lin_approx (\x. f x - g x) y bounds d_bounds_list ==> second_bounded (\x. f x - g x) domain dd_bounds_list ==> m_taylor_interval (\x. f x - g x) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_sub", [diff2c_domain_sub]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma m_taylor_mul *) let m_taylor_mul = Sections.section_proof [] `m_lin_approx (\x. f x * g x) y bounds d_bounds_list ==> second_bounded (\x. f x * g x) domain dd_bounds_list ==> m_taylor_interval (\x. f x * g x) domain y w bounds d_bounds_list dd_bounds_list` [ ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then2 ("m_taylor_interval", [m_taylor_interval]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_domain_mul", [diff2c_domain_mul]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Finalization of the section M_TaylorIntervalArith *) let m_taylor_inv_compose = Sections.finalize_theorem m_taylor_inv_compose;; let m_taylor_sqrt_compose = Sections.finalize_theorem m_taylor_sqrt_compose;; let m_taylor_abs_pos_compose = Sections.finalize_theorem m_taylor_abs_pos_compose;; let m_taylor_abs_neg_compose = Sections.finalize_theorem m_taylor_abs_neg_compose;; let m_taylor_pow_compose = Sections.finalize_theorem m_taylor_pow_compose;; let m_taylor_atn_compose = Sections.finalize_theorem m_taylor_atn_compose;; let m_taylor_cos_compose = Sections.finalize_theorem m_taylor_cos_compose;; let m_taylor_sin_compose = Sections.finalize_theorem m_taylor_sin_compose;; let m_taylor_exp_compose = Sections.finalize_theorem m_taylor_exp_compose;; let m_taylor_log_compose = Sections.finalize_theorem m_taylor_log_compose;; let m_taylor_acs_compose = Sections.finalize_theorem m_taylor_acs_compose;; let m_taylor_asn_compose = Sections.finalize_theorem m_taylor_asn_compose;; let m_taylor_matan_compose = Sections.finalize_theorem m_taylor_matan_compose;; let m_taylor_neg = Sections.finalize_theorem m_taylor_neg;; let m_taylor_scale = Sections.finalize_theorem m_taylor_scale;; let m_taylor_add = Sections.finalize_theorem m_taylor_add;; let m_taylor_sub = Sections.finalize_theorem m_taylor_sub;; let m_taylor_mul = Sections.finalize_theorem m_taylor_mul;; Sections.end_section "M_TaylorIntervalArith";; (* Section PartialConvex *) Sections.begin_section "PartialConvex";; (Sections.add_section_type (mk_var ("f", (`:real^N->real`))));; (* Lemma REAL_LE_DIV_1 *) let REAL_LE_DIV_1 = Sections.section_proof ["a";"b"] `&0 < b ==> (a / b <= &1 <=> a <= b)` [ ((BETA_TAC THEN (move ["b_gt"])) THEN ((((use_arg_then2 ("REAL_LE_LDIV_EQ", [REAL_LE_LDIV_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma partial_convex_max *) let partial_convex_max = Sections.section_proof ["f";"j";"x";"z";"u";"v";"hi"] `(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i /\ v$i = x$i) ==> u$j = x$j ==> v$j = z$j ==> diff2_domain (x,z) f ==> (!y. y IN interval [x,z] ==> &0 <= partial2 j j f y) ==> (!y. y IN interval [x,u] ==> f y <= hi) ==> (!y. y IN interval [v,z] ==> f y <= hi) ==> (!y. y IN interval [x,z] ==> f y <= hi)` [ ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["uv_eq"]) THEN (move ["ux_eq"]) THEN (move ["vz_eq"])); ((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (move ["diff2_f"]) THEN (move ["partial2_pos"]) THEN (move ["bound1"]) THEN (move ["bound2"]) THEN (move ["y"]) THEN (move ["y_in"])); ((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"))); ((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"))); ((((use_arg_then2 ("y_in", [])) (disch_tac [])) THEN (clear_assumption "y_in") THEN BETA_TAC) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] [])))) THEN (move ["y_in"]))); ((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"])))))); ((((use_arg_then2 ("y1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] [])))))); (((split_tac) THEN (move ["i"]) THEN (move ["i_ineq"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"])) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("ux_eq", []))(fun tmp_arg1 -> (use_arg_then2 ("vz_eq", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN ((((use_arg_then2 ("uv_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); (((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`j IN 1..dimindex (:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case)) THEN ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["j_in"]))); ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`y1 = y`))) (term_tac (have_gen_tac []ALL_TAC)))) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("bound1", [])) (disch_tac [])) THEN (clear_assumption "bound1") THEN (DISCH_THEN apply_tac)) THEN (done_tac))); ((((use_arg_then2 ("CART_EQ", [CART_EQ]))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["i_in"])); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(i = j)`))) (term_tac (have_gen_tac [](move ["inj"])))) ((((use_arg_then2 ("i_in", [])) (disch_tac [])) THEN (clear_assumption "i_in") THEN ((use_arg_then2 ("j_in", [])) (disch_tac [])) THEN (clear_assumption "j_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); (((((use_arg_then2 ("y1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`f y <= max (f y1) (f y2)`))) (term_tac (have_gen_tac []ALL_TAC)))); (BETA_TAC THEN (move ["cond"])); (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then2 ("cond", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); ((((fun arg_tac -> (use_arg_then2 ("bound2", [])) (fun fst_arg -> (use_arg_then2 ("y2_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("bound1", [])) (fun fst_arg -> (use_arg_then2 ("y1_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); ((fun arg_tac -> arg_tac (Arg_term (`f o (\t. y1 + t % basis j)`))) (term_tac (set_tac "g"))); ((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 [] []))))))); (((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_ADD_RID", [VECTOR_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((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"])))); ((repeat_tactic 1 9 (((use_arg_then2 ("CART_EQ", [CART_EQ]))(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN (move ["i"]) THEN (move ["i_in"])) THEN ((((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"])) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("y1_def", []))(fun tmp_arg1 -> (use_arg_then2 ("y2_def", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_SUB_ADD2", [REAL_SUB_ADD2]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); (((((use_arg_then2 ("ij", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); (((((use_arg_then2 ("ij", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`f y = g (y$j - x$j)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("y_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`f y2 = g (z$j - x$j)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("y_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`z$j = x$j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["zx_j"])); ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`y$j = x$j`))) (term_tac (have_gen_tac []ALL_TAC)))) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("zx_j", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_SUB_REFL", [REAL_SUB_REFL]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); ((((fun arg_tac -> (use_arg_then2 ("y_in", [])) (fun fst_arg -> (use_arg_then2 ("j_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("zx_j", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); ((fun arg_tac -> arg_tac (Arg_term (`(y$j - x$j) / (z$j - x$j)`))) (term_tac (set_tac "t"))); ((fun arg_tac -> arg_tac (Arg_term (`&0 < z$j - x$j`))) (term_tac (have_gen_tac [](move ["zx_pos"])))); ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b. &0 < a - b <=> ~(a = b) /\ b <= a`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("zx_j", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`y$j`))) (term_tac exists_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((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"])))); ((((use_arg_then2 ("t_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_DIV_1", [REAL_LE_DIV_1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_LID", [REAL_ADD_LID]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_MUL_ASSOC)))(gsym_then (thm_tac (new_rewrite [] [])))))); ((((use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_SUB_0", [REAL_SUB_0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); ((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_RADD", [REAL_LE_RADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] []))))))); ((THENL_FIRST) ((((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_INV", [REAL_LE_INV]))(thm_tac (new_rewrite [] []))))) ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. &0 < a ==> &0 <= a`)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); (((((use_arg_then2 ("REAL_SUB_LE", [REAL_SUB_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("t_props", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONVEX_LOWER))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); ((fun arg_tac -> arg_tac (Arg_term (`real_interval [&0, z$j - x$j]`))) (term_tac exists_tac)); ((((use_arg_then2 ("REAL_SUB_ADD", [REAL_SUB_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_SUB_LE", [REAL_SUB_LE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("t_props", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. &0 < a ==> &0 <= a`)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); (((fun arg_tac -> arg_tac (Arg_term (`real_interval _`))) (term_tac (set_tac "s"))) THEN (((use_arg_then2 ("t_props", [])) (disch_tac [])) THEN (clear_assumption "t_props") THEN ((use_arg_then2 ("t_def", [])) (disch_tac [])) THEN (clear_assumption "t_def") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]))); ((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"])))); (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] []))))) THEN (move ["t"]) THEN (move ["t_ineq"]) THEN (move ["i"]) THEN (move ["i_ineq"])); ((repeat_tactic 1 9 (((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); ((((use_arg_then2 ("y1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"]))); (((((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ((((use_arg_then2 ("t_ineq", [])) (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((fun arg_tac -> (use_arg_then2 ("y_in", [])) (fun fst_arg -> (use_arg_then2 ("i_ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("ij", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); ((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"])))); ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("diff2_dir", [diff2_dir]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((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"])))); ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] []))))); ((((fun arg_tac -> (use_arg_then2 ("in_s", [])) (fun fst_arg -> (use_arg_then2 ("ts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["p_in"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`f o _`))) (term_tac (set_tac "h")))); ((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 [] []))))))); ((((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["r"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); (((((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)); ((((use_arg_then2 ("derivative_translation", [derivative_translation]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); ((((fun arg_tac -> (use_arg_then2 ("diff2_g", [])) (fun fst_arg -> (use_arg_then2 ("ts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("nth_diff_strong2_eq", [nth_diff_strong2_eq]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["e"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["te"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((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"])))); ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN ((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("diff2_dir_derivative2", [diff2_dir_derivative2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("diff2_f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); ((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"])))); ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"])) THEN (split_tac)); ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orNb", [orNb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((case THEN (simp_tac)) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); ((fun arg_tac -> arg_tac (Arg_term (`DISJOINT ((1..dimindex (:N)) DELETE j) {j}`))) (term_tac (have_gen_tac [](move ["disj"])))); (((((use_arg_then2 ("DISJOINT", [DISJOINT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"])); (((((use_arg_then2 ("andbA", [andbA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andNb", [andNb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbF", [andbF]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("s_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("SUM_UNION", [SUM_UNION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_DELETE", [FINITE_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_SING", [FINITE_SING]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SUM_SING", [SUM_SING]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); ((((use_arg_then2 ("SUM_EQ_0", [SUM_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_ADD_LID", [REAL_ADD_LID]))(thm_tac (new_rewrite [] [])))))); ((BETA_TAC THEN (move ["i"]) THEN (move ["i_in"])) THEN (((use_arg_then2 ("SUM_EQ_0", [SUM_EQ_0])) (thm_tac apply_tac)) THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac))); (((((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("i_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("s_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_UNION", [SUM_UNION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_DELETE", [FINITE_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_SING", [FINITE_SING]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SUM_SING", [SUM_SING]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); ((((use_arg_then2 ("SUM_EQ_0", [SUM_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_ADD_LID", [REAL_ADD_LID]))(thm_tac (new_rewrite [] [])))))); ((BETA_TAC THEN (move ["i"]) THEN (move ["i_in"]) THEN (simp_tac)) THEN (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))) THEN (DISJ2_TAC)); (((((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("i_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (((((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("j_in", []))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_CONVEX_ON_SECOND_DERIVATIVE", [REAL_CONVEX_ON_SECOND_DERIVATIVE])) (fun fst_arg -> (use_arg_then2 ("g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative g`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`nth_derivative 2 g`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); ((THENL_ROT (-1)) (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [1; 2] []))))) THEN (((use_arg_then2 ("IS_REALINTERVAL_INTERVAL", [IS_REALINTERVAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN ((((use_arg_then2 ("d2g", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("partial2_pos", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_s", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); (split_tac); ((BETA_TAC THEN (move ["t"])) THEN (((use_arg_then2 ("contraT", [contraT])) (disch_tac [])) THEN (clear_assumption "contraT") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["eq"]))); ((((use_arg_then2 ("zx_pos", [])) (disch_tac [])) THEN (clear_assumption "zx_pos") THEN ((fun arg_tac -> (use_arg_then2 ("eq", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`z$j - x$j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("eq", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))))); ((arith_tac) THEN (done_tac)); ((split_tac) THEN (move ["t"]) THEN (move ["ts"])); ((((fun arg_tac -> (use_arg_then2 ("diff2_g", [])) (fun fst_arg -> (use_arg_then2 ("ts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("nth_diff_strong2_eq_alt", [nth_diff_strong2_eq_alt]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["e"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["te"])) THEN (move ["H"]))); (((((use_arg_then2 ("HAS_REAL_DERIVATIVE_ATREAL_WITHIN", [HAS_REAL_DERIVATIVE_ATREAL_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((fun arg_tac -> (use_arg_then2 ("diff2_g", [])) (fun fst_arg -> (use_arg_then2 ("ts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("nth_diff_strong2_eq_alt", [nth_diff_strong2_eq_alt]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["e"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["te"])) THEN (move ["H"]))); (((((use_arg_then2 ("HAS_REAL_DERIVATIVE_ATREAL_WITHIN", [HAS_REAL_DERIVATIVE_ATREAL_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Finalization of the section PartialConvex *) let REAL_LE_DIV_1 = Sections.finalize_theorem REAL_LE_DIV_1;; let partial_convex_max = Sections.finalize_theorem partial_convex_max;; Sections.end_section "PartialConvex";; (* Section ElementaryFunctions *) Sections.begin_section "ElementaryFunctions";; (* Lemma f_lift_const *) let f_lift_const = Sections.section_proof ["c"] `lift o (\x. c) = (\x. lift c)` [ (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma f_lift_unary *) let f_lift_unary = Sections.section_proof ["f"] `lift o (\x. f x) = (\x. lift (f x))` [ (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_const *) let diff2_const = Sections.section_proof ["c";"x"] `diff2 (\x:real^N. c) x` [ ((((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real^N)`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("OPEN_UNIV", [OPEN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["_"]))); (((((use_arg_then2 ("partial_const", [partial_const]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_lift_const", [f_lift_const]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma diff2_domain_const *) let diff2_domain_const = Sections.section_proof ["c";"domain"] `diff2_domain domain (\x:real^N. c)` [ (((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_const", [diff2_const]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma partial2_const *) let partial2_const = Sections.section_proof ["i";"j";"c"] `partial2 i j (\x:real^N. c) = (\x. &0)` [ (((((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("partial_const", [partial_const]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); ];; (* Lemma diff2c_const *) let diff2c_const = Sections.section_proof ["c";"x"] `diff2c (\x:real^N. c) x` [ (((((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_const", [diff2_const]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("partial2_const", [partial2_const]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_const *) let diff2c_domain_const = Sections.section_proof ["c";"domain"] `diff2c_domain domain (\x:real^N. c)` [ (((((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2c_const", [diff2c_const]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma partial_x_lemma *) let partial_x_lemma = Sections.section_proof ["k";"i"] `partial i (\x:real^N. x$k) = (\x. (basis i:real^N)$k)` [ (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial", [partial]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac)); ((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 [] []))))))); (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("VECTOR_ADD_COMPONENT", [VECTOR_ADD_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_COMPONENT", [VECTOR_MUL_COMPONENT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("derivative_add", [derivative_add]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_MUL_ATREAL", [REAL_DIFFERENTIABLE_MUL_ATREAL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); (((((use_arg_then2 ("REAL_DIFFERENTIABLE_ID", [REAL_DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("derivative_mul", [derivative_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_ID", [REAL_DIFFERENTIABLE_ID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_DIFFERENTIABLE_CONST", [REAL_DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); (((((use_arg_then2 ("derivative_x", [derivative_x]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("derivative_const", [derivative_const]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); ];; (* Lemma partial_x *) let partial_x = Sections.section_proof ["k";"i"] `k IN 1..dimindex (:N) ==> partial i (\x:real^N. x$k) = (\x. if i = k then &1 else &0)` [ ((BETA_TAC THEN (move ["k_ineq"])) THEN ((((use_arg_then2 ("partial_x_lemma", [partial_x_lemma]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("BASIS_COMPONENT", [BASIS_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); ];; (* Lemma partial2_x *) let partial2_x = Sections.section_proof ["k";"i";"j"] `partial2 i j (\x:real^N. x$k) = (\x. &0)` [ (((((use_arg_then2 ("partial2", [partial2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("partial_x_lemma", [partial_x_lemma]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("partial_const", [partial_const]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_x *) let diff2_x = Sections.section_proof ["k";"x"] `k IN 1..dimindex (:N) ==> diff2 (\x:real^N. x$k) x` [ ((BETA_TAC THEN (move ["k_ineq"])) THEN (((use_arg_then2 ("diff2", [diff2]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real^N)`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("OPEN_UNIV", [OPEN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["_"]))); (((((use_arg_then2 ("projection_diff", [projection_diff]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("partial_x_lemma", [partial_x_lemma]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_lift_unary", [f_lift_unary]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DIFFERENTIABLE_CONST", [DIFFERENTIABLE_CONST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2_domain_x *) let diff2_domain_x = Sections.section_proof ["k";"domain"] `k IN 1..dimindex (:N) ==> diff2_domain domain (\x:real^N. x$k)` [ (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2_x", [diff2_x])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2_domain", [diff2_domain]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_x *) let diff2c_x = Sections.section_proof ["k";"x"] `k IN 1..dimindex (:N) ==> diff2c (\x:real^N. x$k) x` [ ((BETA_TAC THEN (move ["k_ineq"])) THEN ((((use_arg_then2 ("diff2c", [diff2c]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("diff2_x", [diff2_x]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("partial2_x", [partial2_x]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Lemma diff2c_domain_x *) let diff2c_domain_x = Sections.section_proof ["k";"domain"] `k IN 1..dimindex (:N) ==> diff2c_domain domain (\x:real^N. x$k)` [ (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("diff2c_x", [diff2c_x])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("diff2c_domain", [diff2c_domain]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ];; (* Finalization of the section ElementaryFunctions *) let f_lift_const = Sections.finalize_theorem f_lift_const;; let f_lift_unary = Sections.finalize_theorem f_lift_unary;; let diff2_const = Sections.finalize_theorem diff2_const;; let diff2_domain_const = Sections.finalize_theorem diff2_domain_const;; let partial2_const = Sections.finalize_theorem partial2_const;; let diff2c_const = Sections.finalize_theorem diff2c_const;; let diff2c_domain_const = Sections.finalize_theorem diff2c_domain_const;; let partial_x_lemma = Sections.finalize_theorem partial_x_lemma;; let partial_x = Sections.finalize_theorem partial_x;; let partial2_x = Sections.finalize_theorem partial2_x;; let diff2_x = Sections.finalize_theorem diff2_x;; let diff2_domain_x = Sections.finalize_theorem diff2_domain_x;; let diff2c_x = Sections.finalize_theorem diff2c_x;; let diff2c_domain_x = Sections.finalize_theorem diff2c_domain_x;; Sections.end_section "ElementaryFunctions";; (* Close the module *) end;;