module Jotswix = struct

  open Hales_tactic;;


let LET_THM = CONJ LET_DEF LET_END_DEF;;
let UNDISCH2 = repeat UNDISCH;;


(*
let get_work = 
  let is_main = function 
    | Main_estimate -> true
    | _ -> false in
  let has_main ind = 
    exists (is_main) ind.tags in
  let main_ineq_data1 = 
    filter has_main (!Ineq.ineqs) in
  let id = map (fun t-> t.idv) main_ineq_data1 in
    (* debug 
  let id = nonlinear_ineq_terminal in *)
  let main_ineq_data = map (fun t -> hd(Ineq.getexact t)) id in
  let ineql = map (fun ind -> ind.ineq) main_ineq_data in
  let sl = map (fun ind -> ind.idv) main_ineq_data in
  let main_ineq_conj = end_itlist (curry mk_conj) ineql in
  
let th = new_definition (mk_eq (`main_work4:bool`,main_ineq_conj)) in
  let th1 = UNDISCH (MATCH_MP (TAUT `(a <=> b) ==> (a ==> b)`) th) in
  let co1 thm = if (is_conj (concl thm)) then CONJUNCT1 thm else thm in
  let tryindex s sl = try index s sl with  _ -> report s; failwith s in
    fun s ->
      let i = tryindex s sl in
      let th2 = funpow i CONJUNCT2 th1 in
	co1 th2;;
*)
let taum_attains_inf = prove_by_refinement(
  (* main_work4 ==> *) `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6. &2 <= y1 /\ y1 <= &2 * h0 /\
	&2 <= y2 /\ y2 <= &2 * h0 /\
	&2 <= y3 /\ y3 <= &2 * h0 /\
	&2 <= y4 /\ y4 <= &2 * h0 /\
	&2 <= y5 /\ y5 <= &2 * h0 /\
	&2 <= y6 /\ y6 <= &2 * h0 
	==>
	(?y4'. &2 <= y4' /\ y4' <= &2 * h0 /\ (!y4. &2 <= y4 /\ y4 <= &2 * h0 ==>
	   taum y1 y2 y3 y4' y5 y6 <= taum y1 y2 y3 y4 y5 y6)))`,
  (* {{{ proof *)
  [
  REPEAT WEAKER_STRIP_TAC;
  INTRO_TAC REAL_CONTINUOUS_ATTAINS_INF [`\q. taum y1 y2 y3 q y5 y6`;`real_interval [&2, &2 * h0]`];
  ANTS_TAC;
    REWRITE_TAC[REAL_COMPACT_INTERVAL];
    CONJ_TAC;
      REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_REAL_INTERVAL;NOT_FORALL_THM;Sphere.h0];
      TYPIFY `&2` EXISTS_TAC;
      BY(REAL_ARITH_TAC);
    REWRITE_TAC[REAL_CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN];
    REWRITE_TAC[IN_REAL_INTERVAL];
    REPEAT WEAKER_STRIP_TAC;
    MATCH_MP_TAC REAL_CONTINUOUS_ATREAL_WITHINREAL;
    MATCH_MP_TAC Bkossge.real_continuous_taum;
    ASM_SIMP_TAC[arith `&2 <= y ==> &0 < y`];
    CONJ_TAC;
      INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "4717061266") [`y1`;`y2`;`y3`;`x`;`y5`;`y6`];
      REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`];
      REWRITE_TAC[arith `x > &0 <=> &0 < x`] THEN DISCH_THEN MATCH_MP_TAC;
      BY(ASM_REWRITE_TAC[]);
    BY(REPEAT CONJ_TAC THEN MATCH_MP_TAC Ysskqoy.TRI_UPS_X_STRICT_POS THEN ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC);
  REWRITE_TAC[IN_REAL_INTERVAL];
  REPEAT WEAKER_STRIP_TAC;
  TYPIFY `x` EXISTS_TAC;
  BY(ASM_MESON_TAC[])
  ]);;
(* }}} *)
let TAUM_EXTREMAL = prove_by_refinement(
  (* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6.
	&2 <= y1 /\ y1 <= &2 * h0 /\
	&2 <= y2 /\ y2 <= &2 * h0 /\
	&2 <= y3 /\ y3 <= &2 * h0 /\
	&2 <= y4 /\ y4 <= &2 * h0 /\
	&2 <= y5 /\ y5 <= &2 * h0 /\
	&2 <= y6 /\ y6 <= &2 * h0 
	==>
	(?y4'. (y4' = &2 * h0 \/ y4' = &2) /\
	   taum y1 y2 y3 y4' y5 y6 <= taum y1 y2 y3 y4 y5 y6)
				  )`,
  (* {{{ proof *)
  [
  REPEAT WEAKER_STRIP_TAC;
  INTRO_TAC (UNDISCH2 taum_attains_inf) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`];
  ASM_REWRITE_TAC[];
  REPEAT WEAKER_STRIP_TAC;
  TYPIFY `y4'` EXISTS_TAC;
  CONJ2_TAC;
    FIRST_X_ASSUM MATCH_MP_TAC;
    BY(ASM_REWRITE_TAC[]);
  PROOF_BY_CONTR_TAC;
  TYPIFY `&2 < y4' /\ y4' < &2 * h0` (C SUBGOAL_THEN ASSUME_TAC);
    BY(ASM_TAC THEN REAL_ARITH_TAC);
  INTRO_TAC (UNDISCH Ocbicby.LEMMA_1834976363) [`y1`;`y2`;`y3`;`y4'`;`y5`;`y6`;`&2`;`&2 * h0`];
  ANTS_TAC;
    ASM_REWRITE_TAC[SUBSET;IN_REAL_INTERVAL;IN_ELIM_THM];
    ASM_SIMP_TAC [arith `&2 <= y ==> &0 < y`];
    INTRO_TAC Ocbicby.xrr_simple_lower_bound [`y2`;`y3`;`y4'`;`&2`];
    INTRO_TAC Ocbicby.xrr_simple_lower_bound [`y1`;`y3`;`y5`;`&2`];
    INTRO_TAC Ocbicby.xrr_simple_lower_bound [`y1`;`y2`;`y6`;`&2`];
    ASM_REWRITE_TAC[arith `x <= x`];
    REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[];
    CONJ_TAC;
      INTRO_TAC Ocbicby.xrr_simple_upper_bound [`y2`;`y3`;`y4'`;`&2 * h0`];
      ANTS_TAC;
        BY(ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC);
      BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC);
    CONJ2_TAC;
      BY(CONJ_TAC THEN MATCH_MP_TAC Bkossge.UPS_X_STD_POS THEN ASM_REWRITE_TAC[]);
    REPEAT WEAKER_STRIP_TAC;
    ASM_SIMP_TAC[arith `&2 < x ==> &0 < x`];
    CONJ2_TAC;
      MATCH_MP_TAC Bkossge.UPS_X_STD_POS THEN ASM_REWRITE_TAC[];
      BY(ASM_TAC THEN REAL_ARITH_TAC);
    INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "4717061266") [`y1`;`y2`;`y3`;`x`;`y5`;`y6`];
    REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`];
    REWRITE_TAC[arith `x > &0 <=> &0 < x`] THEN DISCH_THEN MATCH_MP_TAC;
    (ASM_REWRITE_TAC[]);
    BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
  REWRITE_TAC[IN_REAL_INTERVAL];
  REPEAT WEAKER_STRIP_TAC;
  FIRST_X_ASSUM (C INTRO_TAC [`y4''`]);
  ANTS_TAC;
    BY(ASM_TAC THEN REAL_ARITH_TAC);
  BY(ASM_REWRITE_TAC[arith `~(x <= y) <=> (y < x)`])
  ]);;
(* }}} *)
let TAUM_STD_POS = prove_by_refinement(
  (* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6.
	&2 <= y1 /\ y1 <= &2 * h0 /\
	&2 <= y2 /\ y2 <= &2 * h0 /\
	&2 <= y3 /\ y3 <= &2 * h0 /\
	&2 <= y4 /\ y4 <= &2 * h0 /\
	&2 <= y5 /\ y5 <= &2 * h0 /\
	&2 <= y6 /\ y6 <= &2 * h0 
	==>
	(&0 <= taum y1 y2 y3 y4 y5 y6))`,
  (* {{{ proof *)
  [
  REPEAT WEAKER_STRIP_TAC;
  REWRITE_TAC[arith `x <= y <=> ~(y < x)`];
  DISCH_TAC;
  TYPIFY `&2 * h0 <= sqrt8 /\ #2.52 = &2 * h0 /\ &2 <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC);
    BY(REWRITE_TAC[Sphere.h0] THEN MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC);
  COMMENT "y4";
INTRO_TAC (UNDISCH2 TAUM_EXTREMAL) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (DISJ_CASES_TAC); REPEAT (FIRST_X_ASSUM_ST `taum` MP_TAC) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; INTRO_TAC ( Terminal.get_main_nonlinear "5541487347") [`y2`;`y3`;`y1`;`y5`;`y6`;`y4'`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; DISCH_THEN MP_TAC THEN ANTS_TAC; BY(ASM_REWRITE_TAC[arith `x <= x`]); TYPIFY `taum y2 y3 y1 y5 y6 y4' = taum y1 y2 y3 y4' y5 y6` (C SUBGOAL_THEN SUBST1_TAC); BY(MESON_TAC[Terminal.taum_sym]); ASM_REWRITE_TAC[]; BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); TYPIFY `taum y1 y2 y3 (&2) y5 y6 < &0` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `taum` MP_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC); FIRST_X_ASSUM MP_TAC; POP_ASSUM kill; REPEAT (FIRST_X_ASSUM_ST `taum` kill); DISCH_TAC; COMMENT "y5"; INTRO_TAC (UNDISCH2 TAUM_EXTREMAL) [`y2`;`y3`;`y1`;`y5`;`y6`;`(&2)`]; ASM_REWRITE_TAC[arith `x <= x`]; REPEAT WEAKER_STRIP_TAC; TYPIFY `taum y1 y2 y3 (&2) y5 y6 = taum y2 y3 y1 y5 y6 (&2) /\ taum y3 y1 y2 y6 (&2) y4' = taum y2 y3 y1 y4' y6 (&2)` (C SUBGOAL_THEN ASSUME_TAC); BY(MESON_TAC[Terminal.taum_sym]); FIRST_X_ASSUM (DISJ_CASES_TAC); REPEAT (FIRST_X_ASSUM_ST `taum` MP_TAC) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; INTRO_TAC ( Terminal.get_main_nonlinear "5541487347") [`y3`;`y1`;`y2`;`y6`;`&2`;`y4'`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; DISCH_THEN MP_TAC THEN ANTS_TAC; BY(ASM_REWRITE_TAC[arith `x <= x`]); ASM_REWRITE_TAC[]; BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); TYPIFY `taum y1 y2 y3 (&2) (&2) y6 < &0` (C SUBGOAL_THEN ASSUME_TAC); TYPIFY `taum y1 y2 y3 (&2) (&2) y6 = taum y2 y3 y1 (&2) y6 (&2)` (C SUBGOAL_THEN SUBST1_TAC); BY(MESON_TAC[Terminal.taum_sym]); BY(REPEAT (FIRST_X_ASSUM_ST `taum` MP_TAC) THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC); FIRST_X_ASSUM MP_TAC; POP_ASSUM kill; REPEAT (FIRST_X_ASSUM_ST `taum` kill); DISCH_TAC; COMMENT "y6"; INTRO_TAC (UNDISCH2 TAUM_EXTREMAL) [`y3`;`y1`;`y2`;`y6`;`(&2)`;`(&2)`]; ASM_REWRITE_TAC[arith `x <= x`]; REPEAT WEAKER_STRIP_TAC; POP_ASSUM MP_TAC; TYPIFY_GOAL_THEN `!z1 z2 z3. taum y3 y1 y2 z3 z1 z2 = taum y1 y2 y3 z1 z2 z3` (unlist REWRITE_TAC); BY(MESON_TAC[Terminal.taum_sym]); DISCH_TAC; FIRST_X_ASSUM (DISJ_CASES_TAC); REPEAT (FIRST_X_ASSUM_ST `taum` MP_TAC) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; INTRO_TAC ( Terminal.get_main_nonlinear "5541487347") [`y1`;`y2`;`y3`;`&2`;`&2`;`&2 * h0`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; DISCH_THEN MP_TAC THEN ANTS_TAC; BY(ASM_REWRITE_TAC[arith `x <= x`]); BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); TYPIFY `taum y1 y2 y3 (&2) (&2) (&2) < &0` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM_ST `taum` MP_TAC) THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC); INTRO_TAC ( Terminal.get_main_nonlinear "OMKYNLT 3336871894") [`y1`;`y2`;`y3`;`&2`;`&2`;`&2`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; ASM_REWRITE_TAC[arith `#2.0 = &2`]; BY(POP_ASSUM MP_TAC THEN REAL_ARITH_TAC) ]);; (* }}} *)
let LFLACKU = prove_by_refinement(
  (* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==>
   scs_arrow_v39 {scs_3I1} {}`,
  (* {{{ proof *)
  [
  REPEAT WEAKER_STRIP_TAC;
  REPEAT (GMATCH_SIMP_TAC Ocbicby.pos_imp_scs_arrow_empty);
  REWRITE_TAC[Appendix.scs_3I1;Appendix.mk_unadorned_v39];
  MATCH_MP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Terminal.taustar_taum_dfun);
  REWRITE_TAC[Terminal.FUNLIST_EXPLICIT];
  REWRITE_TAC[Appendix.is_ear_v39;Appendix.scs_v39_explicit;EMPTY_GSPEC;NOT_INSERT_EMPTY];
  REWRITE_TAC[Appendix.d_tame];
  REWRITE_TAC[Appendix.cs_adj;Terminal.FUNLIST_EXPLICIT];
  NUM_REDUCE_TAC;
  REWRITE_TAC[arith `x <= x`];
  TYPIFY_GOAL_THEN `&2 * h0 <= #3.62` (unlist REWRITE_TAC);
    BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC);
  REPEAT WEAKER_STRIP_TAC;
  REWRITE_TAC[arith `&0 +  #0.1 * -- &1 * (&0 + &0 + &0 + &0) = &0`];
  MATCH_MP_TAC (UNDISCH2 TAUM_STD_POS);
  BY(ASM_REWRITE_TAC[])
  ]);;
(* }}} *)
let s_init_list_alt = 
prove_by_refinement( `s_init_list_v39 = [scs_6I1;scs_5I1;scs_4I1;scs_3I1;scs_5I2;scs_4I2;scs_5I3;scs_4I3]`,
(* {{{ proof *) [ REWRITE_TAC[Appendix.s_init_list_v39]; REPEAT LET_TAC; ASM_REWRITE_TAC[CONS_11;Appendix.scs_6I1;Appendix.scs_5I1;Appendix.scs_4I1;Appendix.scs_3T1;Appendix.scs_5I2;Appendix.scs_5I3;Appendix.scs_4I3;Appendix.scs_3I1;Appendix.scs_4I2]; TYPIFY `(!a1 a2 a3. (a_pro 5 a1 a2 a3 = (funlist_v39 [(0,1),a1; (0,2),a3; (0,3),a3; (1,3),a3; (1,4),a3; (2,4), a3] a2 5))) /\ (!a1 a2 a3. a_pro 4 a1 a2 a3 = (funlist_v39 [(0,1),a1; (0,2),a3; (1,3),a3] a2 4))` ENOUGH_TO_SHOW_TAC; BY(DISCH_THEN (unlist REWRITE_TAC)); CONJ_TAC; REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[FUN_EQ_THM]; MATCH_MP_TAC Terminal.periodic2_mod_reduce; TYPIFY `5` EXISTS_TAC; REWRITE_TAC[arith `~(5 =0)`]; CONJ_TAC; REWRITE_TAC[Appendix.periodic2]; EXPAND_TAC "a_pro";
ASM_REWRITE_TAC[Oxl_2012.MOD_ADD_CANCEL;arith `SUC (j+5) = (SUC j) + 5`]; BY(MESON_TAC[Terminal.periodic2_funlist;Appendix.periodic2]); REWRITE_TAC[arith `x < 5 <=> x = 0 \/ x = 1 \/ x = 2 \/ x = 3 \/ x = 4`]; REWRITE_TAC[TAUT ` ((a \/ b) /\ c) <=> ((a /\ c) \/ (b /\ c))`;TAUT `(a /\ (b \/ c)) <=> ((a /\ b) \/ (a /\ c))`]; EXPAND_TAC "a_pro"; REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Hexagons.PSORT_5_EXPLICIT] THEN NUM_REDUCE_TAC); REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[FUN_EQ_THM]; MATCH_MP_TAC Terminal.periodic2_mod_reduce; TYPIFY `4` EXISTS_TAC; REWRITE_TAC[arith `~(4 =0)`]; CONJ_TAC; REWRITE_TAC[Appendix.periodic2]; EXPAND_TAC "a_pro"; ASM_REWRITE_TAC[Oxl_2012.MOD_ADD_CANCEL;arith `SUC (j+4) = (SUC j) + 4`]; BY(MESON_TAC[Terminal.periodic2_funlist;Appendix.periodic2]); REWRITE_TAC[arith `x < 4 <=> x = 0 \/ x = 1 \/ x = 2 \/ x = 3`]; REWRITE_TAC[TAUT ` ((a \/ b) /\ c) <=> ((a /\ c) \/ (b /\ c))`;TAUT `(a /\ (b \/ c)) <=> ((a /\ b) \/ (a /\ c))`]; EXPAND_TAC "a_pro"; REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] THEN NUM_REDUCE_TAC) ]);; (* }}} *) (* moved to JEJTVGB.hl let JEJTVGB_case_breakdown = prove_by_refinement( (* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> ( scs_arrow_v39 { scs_6I1 } { scs_6T1, scs_5M1, scs_4M2, scs_3T1 } /\ // OEHDBEN scs_arrow_v39 { scs_5I1 } { scs_stab_diag_v39 scs_5I1 0 2 , scs_5M2 } /\ // OTMTOTJ1 scs_arrow_v39 { scs_5I2 } { scs_stab_diag_v39 scs_5I2 0 2 , scs_5M2 } /\ // scs_arrow_v39 { scs_5I3 } { scs_stab_diag_v39 scs_5M1 0 2 , scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_5M2 } /\ // OTMTOTJ3 scs_arrow_v39 { scs_5M1 } { scs_stab_diag_v39 scs_5M1 0 2 , scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_5M2 } /\ // OTMTOTJ4 scs_arrow_v39 { scs_5M2 } { scs_3T1,scs_3T4,scs_4M6',scs_4M7,scs_4M8, scs_5T1, scs_stab_diag_v39 scs_5I2 0 2 , scs_stab_diag_v39 scs_5M1 0 2 , scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4 } /\ // HIJQAHA scs_arrow_v39 { scs_stab_diag_v39 scs_5I1 0 2 } {scs_4M2, scs_3M1 } /\ // CNICGSF1 .. scs_arrow_v39 { scs_stab_diag_v39 scs_5I2 0 2 } {scs_4M3', scs_3T1 } /\ // CNICGSF2 scs_arrow_v39 { scs_stab_diag_v39 scs_5M1 0 2 } {scs_4M2, scs_3T4 } /\ // CNICGSF3 scs_arrow_v39 { scs_stab_diag_v39 scs_5M1 0 3 } {scs_4M4', scs_3M1 } /\ // CNICGSF4 scs_arrow_v39 { scs_stab_diag_v39 scs_5M1 2 4 } {scs_4M5', scs_3M1 } /\ // CNICGSF5 .. scs_arrow_v39 { scs_4I1 } {scs_4I2, scs_stab_diag_v39 scs_4I1 0 2 } /\ // FYSSVEV scs_arrow_v39 { scs_4I2 } { scs_4T1, scs_4T2 } /\ // ARDBZYE scs_arrow_v39 { scs_stab_diag_v39 scs_4I1 0 2 } { scs_3M1 } /\ // AUEAHEH // scs_arrow_v39 { scs_stab_diag_v39 scs_4I3 0 2 } { scs_4T4 } /\ // ZNLLLDL (internal) scs_arrow_v39 { scs_4I3 } { scs_4T4, scs_4M6' } /\ // VQFYMZY .. // scs_arrow_v39 { scs_4M1 } { scs_4M2, scs_4M6' } /\ // unused. scs_arrow_v39 { scs_4M2 } { scs_3M1, scs_3T4, scs_4M6' } /\ // BNAWVNH scs_arrow_v39 { scs_4M3' } { scs_3T1, scs_3T6', scs_4M6' } /\ // RAWZDIB scs_arrow_v39 { scs_4M4' } { scs_3M1, scs_3T4, scs_3T3, scs_4M7 } /\ // MFKLVDK scs_arrow_v39 { scs_4M5' } { scs_3T4, scs_4M8 } /\ // RYPDIXT scs_arrow_v39 {scs_4M6'} {scs_4T3,scs_4T5} /\ // NWDGKXH scs_arrow_v39 {scs_4M7} {scs_3M1,scs_3T3,scs_3T4} /\ // YOBIMPP scs_arrow_v39 {scs_4M8} {scs_4M6',scs_3T7,scs_3T4} /\ // MIQMCSN scs_arrow_v39 {scs_3M1} {scs_3T1,scs_3T5} // BKOSSGE ==> JEJTVGB_assume_v39) `, (* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC (UNDISCH Ocbicby.OCBICBY) []; REPEAT WEAKER_STRIP_TAC; TYPIFY `scs_arrow_v39 {scs_3M1} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_3T1, scs_3T5}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_4M6'} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_4T3, scs_4T5}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_4M7} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_3M1, scs_3T3, scs_3T4}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_4M8} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_4M6', scs_3T7, scs_3T4}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_4M5'} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_3T4, scs_4M8}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_4M4'} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{ scs_3M1, scs_3T4, scs_3T3, scs_4M7 }` EXISTS_TAC; (* revised *) ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_4M3'} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_3T1, scs_3T6', scs_4M6'}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_4M2} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{ scs_3M1, scs_3T4, scs_4M6' }` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_4I3} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_4T4, scs_4M6'}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_4I1 0 2} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_3M1}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_4I2} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_4T1, scs_4T2}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_4I1} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_4I2, scs_stab_diag_v39 scs_4I1 0 2}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_5M1 2 4} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_4M5', scs_3M1}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_5M1 0 3} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_4M4', scs_3M1}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_5M1 0 2} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY ` {scs_4M2, scs_3T4}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_5I2 0 2} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_4M3', scs_3T1}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_5I1 0 2} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY ` {scs_4M2, scs_3M1}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_5M2} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY ` {scs_3T1, scs_3T4, scs_4M6', scs_4M7, scs_4M8, scs_5T1, scs_stab_diag_v39 scs_5I2 0 2, scs_stab_diag_v39 scs_5M1 0 2, scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_5M1} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_stab_diag_v39 scs_5M1 0 2, scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_5M2}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_5I3} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_stab_diag_v39 scs_5M1 0 2, scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_5M2}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_5I2} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_stab_diag_v39 scs_5I2 0 2, scs_5M2}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_5I1} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY ` {scs_stab_diag_v39 scs_5I1 0 2, scs_5M2}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `scs_arrow_v39 {scs_6I1} {}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SCS_ARROW_TRANS_SING; TYPIFY `{scs_6T1, scs_5M1, scs_4M2, scs_3T1}` EXISTS_TAC; ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); COMMENT "final kill"; MATCH_MP_TAC Ayqjtmd.EAPGLE; REWRITE_TAC[GSYM Ocbicby.scs_arrow_sing_empty]; REWRITE_TAC[s_init_list_alt;MEM]; REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; BY(REWRITE_TAC[UNDISCH2 LFLACKU]) ]);; (* }}} *) *)
let MOD_4_CASES = 
prove_by_refinement( `!j p. j < 4 ==> j = (p+0) MOD 4 \/ j = (p+1) MOD 4 \/ j = (p+2) MOD 4 \/ j = (p+3) MOD 4`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `p MOD 4 < 4` (C SUBGOAL_THEN ASSUME_TAC); BY(MESON_TAC[DIVISION;arith `~(4 = 0)`]); TYPED_ABBREV_TAC `i = p MOD 4`; TYPIFY `(j = 0 \/ j = 1 \/ j = 2 \/ j = 3) /\ (i = 0 \/ i = 1 \/ i = 2 \/ i = 3)` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_TAC THEN ARITH_TAC); TYPIFY_GOAL_THEN `!k. (p + k) MOD 4 = (i + k) MOD 4` (unlist REWRITE_TAC); GEN_TAC; ONCE_REWRITE_TAC[arith `(i:num) + j = j + i`]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; EXPAND_TAC "i";
GMATCH_SIMP_TAC MOD_MOD_REFL; BY(ARITH_TAC); POP_ASSUM MP_TAC THEN REWRITE_TAC[TAUT ` ((a \/ b) /\ c) <=> ((a /\ c) \/ (b /\ c))`;TAUT `(a /\ (b \/ c)) <=> ((a /\ b) \/ (a /\ c))`]; BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.MOD_4_EXPLICIT]) ]);; (* }}} *)
let ab4_assumption_reduction = 
prove_by_refinement( `!s p f v e. is_scs_v39 s /\ scs_k_v39 s = 4 /\ BBs_v39 s v /\ (!i j. scs_diag 4 i j ==> scs_a_v39 s i j < dist(v i,v j) /\ &4 * h0 < scs_b_v39 s i j) /\ deformation f (IMAGE v (:num)) (--e,e) /\ &0 < e /\ (!w t. ~(w = v p) ==> (f w t = w)) /\ (!t. abs t < e ==> dist (v (p + 3),f (v p) t) = dist (v (p + 3),v p)) /\ scs_a_v39 s p (p + 1) < dist (v p,v (p + 1)) /\ dist (v p,v (p + 1)) < scs_b_v39 s p (p + 1) ==> (!i j. ?e1. &0 < e1 /\ (scs_a_v39 s i j = dist(v i,v j) ==> (!t. abs t < e1 ==> scs_a_v39 s i j <= dist(f (v i) t,f (v j) t)))) /\ (!i j. ?e2. &0 < e2 /\ (dist (v i,v j) = scs_b_v39 s i j ==> (!t. abs t < e2 ==> dist (f (v i) t,f (v j) t) <= scs_b_v39 s i j))) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; ASSUME_TAC (arith `~(4 = 0)`); TYPIFY `!i j.scs_a_v39 s (i MOD 4) (j MOD 4) = scs_a_v39 s i j /\ scs_b_v39 s (i MOD 4) (j MOD 4) = scs_b_v39 s i j ` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; ASM_REWRITE_TAC[Appendix.is_scs_v39]; BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[Cuxvzoz.periodic2_MOD]); TYPIFY `!i. i MOD 4 < 4` (C SUBGOAL_THEN ASSUME_TAC); BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION]); TYPIFY `periodic v 4` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); BY(ASM_REWRITE_TAC[]); INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; ASM_REWRITE_TAC[]; DISCH_TAC; TYPIFY `!j. j < 4 ==> (j MOD 4 = j)` (C SUBGOAL_THEN ASSUME_TAC); BY(REWRITE_TAC[MOD_LT]); COMMENT "scs_a_v39";
CONJ_TAC; MATCH_MP_TAC Terminal.periodic2_mod_reduce; TYPIFY `4` EXISTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; MATCH_MP_TAC Cuxvzoz.MOD_periodic2; BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[] THEN MESON_TAC[]); TYPIFY `!j. j < 4 ==> (?e1. &0 < e1 /\ (scs_a_v39 s p j = dist (v p,v j) ==> (!t. abs t < e1 ==> scs_a_v39 s p j <= dist (f (v p) t,f (v j) t))))` ENOUGH_TO_SHOW_TAC; REPEAT WEAKER_STRIP_TAC; TYPIFY `i = ( p MOD 4)` ASM_CASES_TAC; FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`j`]); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; TYPIFY `e1` EXISTS_TAC; ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `scs_a_v39 s (p MOD 4) j = scs_a_v39 s p j ` (unlist REWRITE_TAC); BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); TYPIFY `j = p MOD 4` ASM_CASES_TAC; FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`]); ASM_REWRITE_TAC[DIST_SYM]; REPEAT WEAKER_STRIP_TAC; TYPIFY `e1` EXISTS_TAC; ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `scs_a_v39 s i (p MOD 4) = scs_a_v39 s i p ` (unlist REWRITE_TAC); BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN MESON_TAC[]); TYPIFY `&1` EXISTS_TAC; REWRITE_TAC[arith `&0 < &1`]; REPEAT WEAKER_STRIP_TAC; TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_ASSUM_ST GMATCH_SIMP_TAC)); TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_X_ASSUM_ST GMATCH_SIMP_TAC)); FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; nCONJ_TAC 2; BY(FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]) THEN MESON_TAC[]); ASM_REWRITE_TAC[]; BY(REPLICATE_TAC 20 (POP_ASSUM MP_TAC) THEN MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC MOD_4_CASES [`j`;`p`]; ASM_REWRITE_TAC[arith `p + 0 = p`] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[DIST_REFL]; BY(TYPIFY `&1` EXISTS_TAC THEN MESON_TAC[arith `&0 <= &0 /\ &0 < &1`]); TYPIFY `&1` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`p`;`p+2`]); TYPIFY `scs_diag 4 p (p+2)` ENOUGH_TO_SHOW_TAC; DISCH_THEN (unlist REWRITE_TAC); REPEAT WEAKER_STRIP_TAC; TYPIFY `&1` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); REWRITE_TAC[arith `p+2 = SUC(SUC p)`]; MATCH_MP_TAC Tfitskc.SCS_DIAG_2; BY(NUM_REDUCE_TAC); TYPIFY `e` EXISTS_TAC; ASM_REWRITE_TAC[]; DISCH_TAC; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; REPEAT (FIRST_X_ASSUM_ST `abs` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[DIST_SYM]; DISCH_THEN (SUBST1_TAC o GSYM); MATCH_MP_TAC (arith `(x = y) ==> x <= y`); REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); ONCE_REWRITE_TAC[EQ_SYM_EQ]; FIRST_X_ASSUM MATCH_MP_TAC; FIRST_X_ASSUM_ST `v (i MOD 4) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); TYPIFY_GOAL_THEN `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` MATCH_MP_TAC; BY(ASM_MESON_TAC[]); nCONJ_TAC 2; TYPIFY `~((p + 3) MOD 4 = (p+0) MOD 4)` ENOUGH_TO_SHOW_TAC; BY(REWRITE_TAC[arith `p+0=p`]); GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.MOD_4_EXPLICIT]); BY(ASM_REWRITE_TAC[]); COMMENT "now the b end"; MATCH_MP_TAC Terminal.periodic2_mod_reduce; TYPIFY `4` EXISTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; MATCH_MP_TAC Cuxvzoz.MOD_periodic2; BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[] THEN MESON_TAC[]); TYPIFY `!j. j < 4 ==> (?e1. &0 < e1 /\ (dist (v p,v j) = scs_b_v39 s p j ==> (!t. abs t < e1 ==> dist (f (v p) t,f (v j) t) <= scs_b_v39 s p j)))` ENOUGH_TO_SHOW_TAC; REPEAT WEAKER_STRIP_TAC; TYPIFY `i = ( p MOD 4)` ASM_CASES_TAC; FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`j`]); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; TYPIFY `e1` EXISTS_TAC; ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `scs_b_v39 s (p MOD 4) j = scs_b_v39 s p j ` (unlist REWRITE_TAC); BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); TYPIFY `j = p MOD 4` ASM_CASES_TAC; FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`]); ASM_REWRITE_TAC[DIST_SYM]; REPEAT WEAKER_STRIP_TAC; TYPIFY `e1` EXISTS_TAC; ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `scs_b_v39 s i (p MOD 4) = scs_b_v39 s i p ` (unlist REWRITE_TAC); BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN MESON_TAC[]); TYPIFY `&1` EXISTS_TAC; REWRITE_TAC[arith `&0 < &1`]; REPEAT WEAKER_STRIP_TAC; TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_ASSUM_ST GMATCH_SIMP_TAC)); TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_X_ASSUM_ST GMATCH_SIMP_TAC)); FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; nCONJ_TAC 2; BY(FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]) THEN MESON_TAC[]); ASM_REWRITE_TAC[]; BY(REPLICATE_TAC 20 (POP_ASSUM MP_TAC) THEN MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC MOD_4_CASES [`j`;`p`]; ASM_REWRITE_TAC[arith `p + 0 = p`] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[DIST_REFL]; BY(TYPIFY `&1` EXISTS_TAC THEN MESON_TAC[arith `&0 <= &0 /\ &0 < &1`]); TYPIFY `&1` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`p`;`p+2`]); TYPIFY_GOAL_THEN `scs_diag 4 p (p+2)` (unlist REWRITE_TAC); REWRITE_TAC[arith `p+2 = SUC(SUC p)`]; MATCH_MP_TAC Tfitskc.SCS_DIAG_2; BY(NUM_REDUCE_TAC); TYPIFY `dist(v p,v (p+2)) <= &4 * h0` ENOUGH_TO_SHOW_TAC; BY(ASM_MESON_TAC[arith `x <= y /\ y < z ==> ~(x = z)`]); INTRO_TAC DIST_TRIANGLE [`v p`;`(vec 0):real^3`;`v (p+2)`]; REWRITE_TAC[DIST_0]; TYPIFY `!i. norm (v i) <= &2 * h0` ENOUGH_TO_SHOW_TAC; BY(DISCH_TAC THEN FIRST_ASSUM (C INTRO_TAC [`p`]) THEN FIRST_X_ASSUM (C INTRO_TAC [`p+2`]) THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; BY(FIRST_X_ASSUM_ST `ball_annulus` MP_TAC THEN REWRITE_TAC[Terminal.IMAGE_SUBSET_IN;IN_UNIV] THEN MESON_TAC[Fnjlbxs.in_ball_annulus]); TYPIFY `e` EXISTS_TAC; ASM_REWRITE_TAC[]; DISCH_TAC; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; REPEAT (FIRST_X_ASSUM_ST `abs` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[DIST_SYM]; DISCH_THEN (SUBST1_TAC o GSYM); MATCH_MP_TAC (arith `(x = y) ==> x <= y`); REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); FIRST_X_ASSUM MATCH_MP_TAC; FIRST_X_ASSUM_ST `v (i MOD 4) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); TYPIFY_GOAL_THEN `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` MATCH_MP_TAC; BY(ASM_MESON_TAC[]); nCONJ_TAC 2; TYPIFY `~((p + 3) MOD 4 = (p+0) MOD 4)` ENOUGH_TO_SHOW_TAC; BY(REWRITE_TAC[arith `p+0=p`]); GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.MOD_4_EXPLICIT]); BY(ASM_REWRITE_TAC[]) ]);; (* }}} *)
let PERIODIC_INJ_MOD = 
prove_by_refinement( `!v k i j. ~(k= 0) /\ periodic (v:num->A) k /\ (!i j. i < k /\ j < k /\ v i = v j ==> i = j) ==> ((v i = v j) <=> (i MOD k = j MOD k))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `!i. v (i MOD k) = v i` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); BY(ASM_REWRITE_TAC[]); TYPIFY ` (!i j. i < (k:num) /\ j < k /\ ~(i = j) ==> ~(v i = v j))` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[]); MATCH_MP_TAC (TAUT `((~b ==> ~a ) /\ (b ==> a)) ==> (a = b)`); CONJ_TAC; DISCH_TAC; FIRST_X_ASSUM_ST `v (i MOD k) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); FIRST_X_ASSUM MATCH_MP_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[DIVISION]); BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let ab4_assumption_reduction2 = 
prove_by_refinement( `!s p f v e. is_scs_v39 s /\ scs_k_v39 s = 4 /\ BBs_v39 s v /\ (!i j. scs_diag 4 i j ==> scs_a_v39 s i j < dist(v i,v j) /\ &4 * h0 < scs_b_v39 s i j) /\ deformation f (IMAGE v (:num)) (--e,e) /\ &0 < e /\ (!w t. ~(w = v p) ==> (f w t = w)) /\ (!t. abs t < e ==> dist (v (p + 3),f (v p) t) = dist (v (p + 3),v p)) /\ scs_a_v39 s p (p + 1) < dist (v p,v (p + 1)) /\ (?e3. &0 < e3 /\ (!t. abs t < e3 ==> dist (f (v p) t,v (p + 1)) <= scs_b_v39 s p (p + 1))) ==> (!i j. ?e1. &0 < e1 /\ (scs_a_v39 s i j = dist(v i,v j) ==> (!t. abs t < e1 ==> scs_a_v39 s i j <= dist(f (v i) t,f (v j) t)))) /\ (!i j. ?e2. &0 < e2 /\ (dist (v i,v j) = scs_b_v39 s i j ==> (!t. abs t < e2 ==> dist (f (v i) t,f (v j) t) <= scs_b_v39 s i j))) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC; ASSUME_TAC (arith `~(4 = 0)`); TYPIFY `!i j.scs_a_v39 s (i MOD 4) (j MOD 4) = scs_a_v39 s i j /\ scs_b_v39 s (i MOD 4) (j MOD 4) = scs_b_v39 s i j ` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; ASM_REWRITE_TAC[Appendix.is_scs_v39]; BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[Cuxvzoz.periodic2_MOD]); TYPIFY `!i. i MOD 4 < 4` (C SUBGOAL_THEN ASSUME_TAC); BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION]); TYPIFY `periodic v 4` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); BY(ASM_REWRITE_TAC[]); INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; ASM_REWRITE_TAC[]; DISCH_TAC; TYPIFY `!j. j < 4 ==> (j MOD 4 = j)` (C SUBGOAL_THEN ASSUME_TAC); BY(REWRITE_TAC[MOD_LT]); COMMENT "scs_a_v39";
CONJ_TAC; MATCH_MP_TAC Terminal.periodic2_mod_reduce; TYPIFY `4` EXISTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; MATCH_MP_TAC Cuxvzoz.MOD_periodic2; BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[] THEN MESON_TAC[]); TYPIFY `!j. j < 4 ==> (?e1. &0 < e1 /\ (scs_a_v39 s p j = dist (v p,v j) ==> (!t. abs t < e1 ==> scs_a_v39 s p j <= dist (f (v p) t,f (v j) t))))` ENOUGH_TO_SHOW_TAC; REPEAT WEAKER_STRIP_TAC; TYPIFY `i = ( p MOD 4)` ASM_CASES_TAC; FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`j`]); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; TYPIFY `e1` EXISTS_TAC; ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `scs_a_v39 s (p MOD 4) j = scs_a_v39 s p j ` (unlist REWRITE_TAC); BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); TYPIFY `j = p MOD 4` ASM_CASES_TAC; FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`]); ASM_REWRITE_TAC[DIST_SYM]; REPEAT WEAKER_STRIP_TAC; TYPIFY `e1` EXISTS_TAC; ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `scs_a_v39 s i (p MOD 4) = scs_a_v39 s i p ` (unlist REWRITE_TAC); BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN MESON_TAC[]); TYPIFY `&1` EXISTS_TAC; REWRITE_TAC[arith `&0 < &1`]; REPEAT WEAKER_STRIP_TAC; TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_ASSUM_ST GMATCH_SIMP_TAC)); TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_X_ASSUM_ST GMATCH_SIMP_TAC)); FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; nCONJ_TAC 2; BY(FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]) THEN MESON_TAC[]); ASM_REWRITE_TAC[]; BY(REPLICATE_TAC 20 (POP_ASSUM MP_TAC) THEN MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC MOD_4_CASES [`j`;`p`]; ASM_REWRITE_TAC[arith `p + 0 = p`] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[DIST_REFL]; BY(TYPIFY `&1` EXISTS_TAC THEN MESON_TAC[arith `&0 <= &0 /\ &0 < &1`]); TYPIFY `&1` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`p`;`p+2`]); TYPIFY `scs_diag 4 p (p+2)` ENOUGH_TO_SHOW_TAC; DISCH_THEN (unlist REWRITE_TAC); REPEAT WEAKER_STRIP_TAC; TYPIFY `&1` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); REWRITE_TAC[arith `p+2 = SUC(SUC p)`]; MATCH_MP_TAC Tfitskc.SCS_DIAG_2; BY(NUM_REDUCE_TAC); TYPIFY `e` EXISTS_TAC; ASM_REWRITE_TAC[]; DISCH_TAC; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; REPEAT (FIRST_X_ASSUM_ST `abs` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[DIST_SYM]; DISCH_TAC; DISCH_THEN (SUBST1_TAC o GSYM); MATCH_MP_TAC (arith `(x = y) ==> x <= y`); REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); ONCE_REWRITE_TAC[EQ_SYM_EQ]; FIRST_X_ASSUM MATCH_MP_TAC; FIRST_X_ASSUM_ST `v (i MOD 4) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); TYPIFY_GOAL_THEN `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` MATCH_MP_TAC; BY(ASM_MESON_TAC[]); nCONJ_TAC 2; TYPIFY `~((p + 3) MOD 4 = (p+0) MOD 4)` ENOUGH_TO_SHOW_TAC; BY(REWRITE_TAC[arith `p+0=p`]); GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.MOD_4_EXPLICIT]); BY(ASM_REWRITE_TAC[]); COMMENT "now the b end"; MATCH_MP_TAC Terminal.periodic2_mod_reduce; TYPIFY `4` EXISTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; MATCH_MP_TAC Cuxvzoz.MOD_periodic2; BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[] THEN MESON_TAC[]); TYPIFY `!j. j < 4 ==> (?e1. &0 < e1 /\ (dist (v p,v j) = scs_b_v39 s p j ==> (!t. abs t < e1 ==> dist (f (v p) t,f (v j) t) <= scs_b_v39 s p j)))` ENOUGH_TO_SHOW_TAC; REPEAT WEAKER_STRIP_TAC; TYPIFY `i = ( p MOD 4)` ASM_CASES_TAC; FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`j`]); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; TYPIFY `e1` EXISTS_TAC; ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `scs_b_v39 s (p MOD 4) j = scs_b_v39 s p j ` (unlist REWRITE_TAC); BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); TYPIFY `j = p MOD 4` ASM_CASES_TAC; FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`]); ASM_REWRITE_TAC[DIST_SYM]; REPEAT WEAKER_STRIP_TAC; TYPIFY `e1` EXISTS_TAC; ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `scs_b_v39 s i (p MOD 4) = scs_b_v39 s i p ` (unlist REWRITE_TAC); BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN MESON_TAC[]); TYPIFY `&1` EXISTS_TAC; REWRITE_TAC[arith `&0 < &1`]; REPEAT WEAKER_STRIP_TAC; TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_ASSUM_ST GMATCH_SIMP_TAC)); TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_X_ASSUM_ST GMATCH_SIMP_TAC)); FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; nCONJ_TAC 2; BY(FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]) THEN MESON_TAC[]); ASM_REWRITE_TAC[]; BY(REPLICATE_TAC 20 (POP_ASSUM MP_TAC) THEN MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC MOD_4_CASES [`j`;`p`]; ASM_REWRITE_TAC[arith `p + 0 = p`] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[DIST_REFL]; BY(TYPIFY `&1` EXISTS_TAC THEN MESON_TAC[arith `&0 <= &0 /\ &0 < &1`]); TYPIFY `e3` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; TYPIFY_GOAL_THEN `scs_b_v39 s p ((p + 1) MOD 4) = scs_b_v39 s p ((p + 1))` (unlist REWRITE_TAC); BY(ASM_MESON_TAC[]); TYPIFY `f (v(p+1)) t = v (p+1)` (C SUBGOAL_THEN SUBST1_TAC); FIRST_X_ASSUM MATCH_MP_TAC; GMATCH_SIMP_TAC PERIODIC_INJ_MOD; TYPIFY `4` EXISTS_TAC THEN ASM_REWRITE_TAC[]; GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p + 0`]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.MOD_4_EXPLICIT]); FIRST_X_ASSUM MATCH_MP_TAC; BY(ASM_REWRITE_TAC[]); FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`p`;`p+2`]); TYPIFY_GOAL_THEN `scs_diag 4 p (p+2)` (unlist REWRITE_TAC); REWRITE_TAC[arith `p+2 = SUC(SUC p)`]; MATCH_MP_TAC Tfitskc.SCS_DIAG_2; BY(NUM_REDUCE_TAC); TYPIFY `dist(v p,v (p+2)) <= &4 * h0` ENOUGH_TO_SHOW_TAC; BY(ASM_MESON_TAC[arith `x <= y /\ y < z ==> ~(x = z)`]); INTRO_TAC DIST_TRIANGLE [`v p`;`(vec 0):real^3`;`v (p+2)`]; REWRITE_TAC[DIST_0]; TYPIFY `!i. norm (v i) <= &2 * h0` ENOUGH_TO_SHOW_TAC; BY(DISCH_TAC THEN FIRST_ASSUM (C INTRO_TAC [`p`]) THEN FIRST_X_ASSUM (C INTRO_TAC [`p+2`]) THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; BY(FIRST_X_ASSUM_ST `ball_annulus` MP_TAC THEN REWRITE_TAC[Terminal.IMAGE_SUBSET_IN;IN_UNIV] THEN MESON_TAC[Fnjlbxs.in_ball_annulus]); TYPIFY `e` EXISTS_TAC; ASM_REWRITE_TAC[]; DISCH_TAC; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; REPEAT (FIRST_X_ASSUM_ST `abs` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[DIST_SYM]; DISCH_TAC; DISCH_THEN (SUBST1_TAC o GSYM); MATCH_MP_TAC (arith `(x = y) ==> x <= y`); REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); FIRST_X_ASSUM MATCH_MP_TAC; FIRST_X_ASSUM_ST `v (i MOD 4) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); TYPIFY_GOAL_THEN `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` MATCH_MP_TAC; BY(ASM_MESON_TAC[]); nCONJ_TAC 2; TYPIFY `~((p + 3) MOD 4 = (p+0) MOD 4)` ENOUGH_TO_SHOW_TAC; BY(REWRITE_TAC[arith `p+0=p`]); GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.MOD_4_EXPLICIT]); BY(ASM_REWRITE_TAC[]) ]);; (* }}} *)
let ab4_assumption_reduction_sym = 
prove_by_refinement( `!s p f v e. is_scs_v39 s /\ scs_k_v39 s = 4 /\ BBs_v39 s v /\ (!i j. scs_diag 4 i j ==> scs_a_v39 s i j < dist(v i,v j) /\ &4 * h0 < scs_b_v39 s i j) /\ deformation f (IMAGE v (:num)) (--e,e) /\ &0 < e /\ (!w t. ~(w = v (p+1)) ==> (f w t = w)) /\ (!t. abs t < e ==> dist (f (v (p + 1)) t ,(v (p+2))) = dist (v (p + 1),v (p+2))) /\ scs_a_v39 s p (p + 1) < dist (v p,v (p + 1)) /\ dist (v p,v (p + 1)) < scs_b_v39 s p (p + 1) ==> (!i j. ?e1. &0 < e1 /\ (scs_a_v39 s i j = dist(v i,v j) ==> (!t. abs t < e1 ==> scs_a_v39 s i j <= dist(f (v i) t,f (v j) t)))) /\ (!i j. ?e2. &0 < e2 /\ (dist (v i,v j) = scs_b_v39 s i j ==> (!t. abs t < e2 ==> dist (f (v i) t,f (v j) t) <= scs_b_v39 s i j))) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; ASSUME_TAC (arith `~(4 = 0)`); TYPIFY `!i j.scs_a_v39 s (i MOD 4) (j MOD 4) = scs_a_v39 s i j /\ scs_b_v39 s (i MOD 4) (j MOD 4) = scs_b_v39 s i j ` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; ASM_REWRITE_TAC[Appendix.is_scs_v39]; BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[Cuxvzoz.periodic2_MOD]); TYPIFY `!i. i MOD 4 < 4` (C SUBGOAL_THEN ASSUME_TAC); BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION]); TYPIFY `periodic v 4` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); BY(ASM_REWRITE_TAC[]); INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; ASM_REWRITE_TAC[]; DISCH_TAC; TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[]); TYPIFY `!j. j < 4 ==> (j MOD 4 = j)` (C SUBGOAL_THEN ASSUME_TAC); BY(REWRITE_TAC[MOD_LT]); TYPIFY `!t. f (v (p+0)) t = v(p+0) /\ f (v (p+2)) t = v(p+2) /\ f (v (p+3)) t = v(p+3)` (C SUBGOAL_THEN MP_TAC); GEN_TAC THEN (FIRST_X_ASSUM_ST `~(w = v (p+1)) ==> a` (REPEAT o GMATCH_SIMP_TAC)); INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; ASM_REWRITE_TAC[arith `~(4=0)`]; DISCH_TAC THEN ASM_REWRITE_TAC[]; REPEAT ( GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT); BY(NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.MOD_4_EXPLICIT]); DISCH_TAC; COMMENT "scs_a_v39";
CONJ_TAC; MATCH_MP_TAC Terminal.periodic2_mod_reduce; TYPIFY `4` EXISTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; MATCH_MP_TAC Cuxvzoz.MOD_periodic2; BY(ASM_REWRITE_TAC[]); TYPIFY `!j. j < 4 ==> (?e1. &0 < e1 /\ (scs_a_v39 s (p+1) j = dist (v (p+1),v j) ==> (!t. abs t < e1 ==> scs_a_v39 s (p+1) j <= dist (f (v (p+1)) t,f (v j) t))))` ENOUGH_TO_SHOW_TAC; REPEAT WEAKER_STRIP_TAC; TYPIFY `i = ( (p+1) MOD 4)` ASM_CASES_TAC; FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`j`]); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; TYPIFY `e1` EXISTS_TAC; ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `scs_a_v39 s ((p+1) MOD 4) j = scs_a_v39 s (p+1) j ` (unlist REWRITE_TAC); BY(REPLICATE_TAC 14 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); TYPIFY `j = (p+1) MOD 4` ASM_CASES_TAC; FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`]); ASM_REWRITE_TAC[DIST_SYM]; REPEAT WEAKER_STRIP_TAC; TYPIFY `e1` EXISTS_TAC; ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `scs_a_v39 s i ((p+1) MOD 4) = scs_a_v39 s i (p+1) ` (unlist REWRITE_TAC); BY(REPLICATE_TAC 14 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN MESON_TAC[]); TYPIFY `&1` EXISTS_TAC; REWRITE_TAC[arith `&0 < &1`]; REPEAT WEAKER_STRIP_TAC; TYPIFY `!w t. ~(w = v (p+1)) ==> f w t = w` ( (C FIRST_ASSUM_ST GMATCH_SIMP_TAC)); TYPIFY `!w t. ~(w = v (p+1)) ==> f w t = w` ( (C FIRST_X_ASSUM_ST GMATCH_SIMP_TAC)); FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; nCONJ_TAC 2; BY(FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]) THEN MESON_TAC[]); ASM_REWRITE_TAC[]; BY(REPLICATE_TAC 20 (POP_ASSUM MP_TAC) THEN MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC MOD_4_CASES [`j`;`(p+1)`]; ASM_REWRITE_TAC[arith `p + 0 = p /\ (p+1)+j = p+(1+j)`] THEN NUM_REDUCE_TAC; TYPIFY `(p+4) MOD 4 = p MOD 4` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[Oxl_2012.MOD_ADD_CANCEL]); REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[DIST_REFL]; BY(TYPIFY `&1` EXISTS_TAC THEN MESON_TAC[arith `&0 <= &0 /\ &0 < &1`]); TYPIFY `e` EXISTS_TAC THEN REWRITE_TAC[]; ASM_REWRITE_TAC[]; DISCH_THEN SUBST1_TAC; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`t`]); BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`p+1`;`p+3`]); TYPIFY `scs_diag 4 (p+1) (p+3)` ENOUGH_TO_SHOW_TAC; DISCH_THEN (unlist REWRITE_TAC); REPEAT WEAKER_STRIP_TAC; TYPIFY `&1` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); REWRITE_TAC[arith `p+3 = SUC(SUC (p+1))`]; MATCH_MP_TAC Tfitskc.SCS_DIAG_2; BY(NUM_REDUCE_TAC); TYPIFY `&1` EXISTS_TAC; TYPIFY `scs_a_v39 s (p+1) (p MOD 4) = scs_a_v39 s p (p+1)` ENOUGH_TO_SHOW_TAC; DISCH_THEN (unlist REWRITE_TAC); REWRITE_TAC[arith `&0 < &1`]; BY(FIRST_X_ASSUM_ST `scs_a_v39 s p (p+1) < d` MP_TAC THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); BY(FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN ASM_MESON_TAC[]); COMMENT "now the b end"; MATCH_MP_TAC Terminal.periodic2_mod_reduce; TYPIFY `4` EXISTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; MATCH_MP_TAC Cuxvzoz.MOD_periodic2; BY(ASM_REWRITE_TAC[]); TYPIFY `!j. j < 4 ==> (?e1. &0 < e1 /\ (dist (v (p+1),v j) = scs_b_v39 s (p+1) j ==> (!t. abs t < e1 ==> dist (f (v (p+1)) t,f (v j) t) <= scs_b_v39 s (p+1) j)))` ENOUGH_TO_SHOW_TAC; (REPEAT WEAKER_STRIP_TAC); TYPIFY `i = ( (p+1) MOD 4)` ASM_CASES_TAC; FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`j`]); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; TYPIFY `e1` EXISTS_TAC; ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `scs_b_v39 s ((p+1) MOD 4) j = scs_b_v39 s (p+1) j ` (unlist REWRITE_TAC); BY(REPLICATE_TAC 14 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); TYPIFY `j = (p+1) MOD 4` ASM_CASES_TAC; FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`]); ASM_REWRITE_TAC[DIST_SYM]; REPEAT WEAKER_STRIP_TAC; TYPIFY `e1` EXISTS_TAC; ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `scs_b_v39 s i ((p+1) MOD 4) = scs_b_v39 s i (p+1) ` (unlist REWRITE_TAC); BY(REPLICATE_TAC 14 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN MESON_TAC[]); TYPIFY `&1` EXISTS_TAC; REWRITE_TAC[arith `&0 < &1`]; REPEAT WEAKER_STRIP_TAC; TYPIFY `!w t. ~(w = v (p+1)) ==> f w t = w` ( (C FIRST_ASSUM_ST GMATCH_SIMP_TAC)); TYPIFY `!w t. ~(w = v (p+1)) ==> f w t = w` ( (C FIRST_X_ASSUM_ST GMATCH_SIMP_TAC)); FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; nCONJ_TAC 2; BY(FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]) THEN MESON_TAC[]); ASM_REWRITE_TAC[]; BY(REPLICATE_TAC 20 (POP_ASSUM MP_TAC) THEN MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC MOD_4_CASES [`j`;`p+1`]; ASM_REWRITE_TAC[arith `p + 0 = p /\ (p+1)+j = p+(1+j)`] THEN NUM_REDUCE_TAC; TYPIFY `(p+4) MOD 4 = p MOD 4` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[Oxl_2012.MOD_ADD_CANCEL]); ASM_REWRITE_TAC[arith `p + 0 = p`] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[DIST_REFL]; BY(TYPIFY `&1` EXISTS_TAC THEN MESON_TAC[arith `&0 <= &0 /\ &0 < &1`]); TYPIFY `e` EXISTS_TAC THEN ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[arith `x = y ==> x <= y`]); FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`p+1`;`p+3`]); TYPIFY_GOAL_THEN `scs_diag 4 (p+1) (p+3)` (unlist REWRITE_TAC); REWRITE_TAC[arith `p+3 = SUC(SUC (p+1))`]; MATCH_MP_TAC Tfitskc.SCS_DIAG_2; BY(NUM_REDUCE_TAC); TYPIFY `dist(v (p+1),v (p+3)) <= &4 * h0` ENOUGH_TO_SHOW_TAC; BY(ASM_MESON_TAC[arith `x <= y /\ y < z ==> ~(x = z)`]); INTRO_TAC DIST_TRIANGLE [`v (p+1)`;`(vec 0):real^3`;`v (p+3)`]; REWRITE_TAC[DIST_0]; TYPIFY `!i. norm (v i) <= &2 * h0` ENOUGH_TO_SHOW_TAC; BY(DISCH_TAC THEN FIRST_ASSUM (C INTRO_TAC [`p+1`]) THEN FIRST_X_ASSUM (C INTRO_TAC [`p+3`]) THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; BY(FIRST_X_ASSUM_ST `ball_annulus` MP_TAC THEN REWRITE_TAC[Terminal.IMAGE_SUBSET_IN;IN_UNIV] THEN MESON_TAC[Fnjlbxs.in_ball_annulus]); TYPIFY `&1` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; FIRST_X_ASSUM_ST `dist (v p,v (p + 1)) < scs_b_v39 s p (p + 1)` MP_TAC THEN REWRITE_TAC[DIST_SYM]; TYPIFY `scs_b_v39 s (p + 1) (p MOD 4) = scs_b_v39 s p (p+1)` ENOUGH_TO_SHOW_TAC; BY(REAL_ARITH_TAC); BY(FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN ASM_MESON_TAC[]) ]);; (* }}} *)
let deform_azim_sum = 
prove_by_refinement( `!v1 v2 v3 v4 f e. deformation f {v1,v2,v3,v4} (--e,e) /\ &0 < azim (vec 0) v1 v2 v4 /\ azim (vec 0) v1 v2 v4 < pi /\ ~collinear {vec 0,v1,v2} /\ ~collinear {vec 0,v1,v3} /\ ~collinear {vec 0,v1,v4} /\ azim (vec 0) v1 v2 v3 + azim (vec 0) v1 v3 v4 = azim (vec 0) v1 v2 v4 /\ (((!t. (azim (vec 0) (f v1 t) (f v2 t) (f v3 t) = azim (vec 0) v1 v2 v3)) /\ (&0 < azim (vec 0) v1 v3 v4 /\ azim (vec 0) v1 v3 v4 < pi)) \/ ((!t. (azim (vec 0) (f v1 t) (f v3 t) (f v4 t) = azim (vec 0) v1 v3 v4)) /\ (&0 < azim (vec 0) v1 v2 v3 /\ azim (vec 0) v1 v2 v3 < pi))) ==> (?e1. &0 < e1 /\ (!t. abs t < e1 ==> ~collinear {vec 0,(f v1 t),(f v2 t)} /\ ~collinear {vec 0,(f v1 t),(f v3 t)} /\ ~collinear {vec 0,(f v1 t),(f v4 t)} /\ azim (vec 0) (f v1 t) (f v2 t) (f v3 t) + azim (vec 0) (f v1 t) (f v3 t) (f v4 t) = azim (vec 0) (f v1 t) (f v2 t) (f v4 t))) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC (GEN_ALL Local_lemmas1.CONTINUOUS_PRESERVE_COLLINEAR) [`&0`;`(vec 0):real^3`;`f v1`]; DISCH_TAC; FIRST_ASSUM (C INTRO_TAC [`f v2`]); FIRST_ASSUM (C INTRO_TAC [`f v3`]); FIRST_X_ASSUM (C INTRO_TAC [`f v4`]); FIRST_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation;IN_INSERT;NOT_IN_EMPTY]; REPEAT WEAKER_STRIP_TAC; TYPIFY `f v1 continuous atreal (&0) /\ f v2 continuous atreal (&0) /\ f v3 continuous atreal (&0) /\ f v4 continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[]); TYPIFY `f v1 (&0) = v1 /\ f v2 (&0) = v2 /\ f v4 (&0) = v4 /\ f v3 (&0) = v3` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[]); REPLICATE_TAC 3 (FIRST_X_ASSUM_ST `collinear` MP_TAC) THEN ASM_REWRITE_TAC[]; REWRITE_TAC[arith `abs(&0 - r) = abs r`]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC Cuxvzoz.epsilon_triple [`e'`;`e''`;`e'''`]; ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; INTRO_TAC Cuxvzoz.WNWSHJT_ALT [`v4`;`v1`;`v2`;`f`;`-- e`;`e`;`pi`]; ASM_REWRITE_TAC[]; ANTS_TAC; MATCH_MP_TAC Zlzthic.deformation_subset; BY(TYPIFY `{v1,v2,v3,v4}` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); REPEAT WEAKER_STRIP_TAC; TYPIFY `?e1. &0 < e1 /\ (!t. abs t < e1 ==> azim (vec 0) (f v1 t) (f v2 t) (f v3 t) + azim (vec 0) (f v1 t) (f v3 t) (f v4 t) < &2 * pi)` (C SUBGOAL_THEN MP_TAC); TYPIFY `(!t. azim (vec 0) (f v1 t) (f v2 t) (f v3 t) = azim (vec 0) v1 v2 v3) /\ &0 < azim (vec 0) v1 v3 v4 /\ azim (vec 0) v1 v3 v4 < pi` ASM_CASES_TAC; INTRO_TAC Cuxvzoz.WNWSHJT_ALT [`v4`;`v1`;`v3`;`f`;`-- e`;`e`;`pi - azim (vec 0) v1 v2 v3`]; ASM_REWRITE_TAC[]; ANTS_TAC; CONJ_TAC; MATCH_MP_TAC Zlzthic.deformation_subset; BY(TYPIFY `{v1,v2,v3,v4}` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); BY(ASM_REWRITE_TAC[arith `a < p - b <=> b + a < p`]); REPEAT WEAKER_STRIP_TAC; TYPIFY `e''''''` EXISTS_TAC; ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (C INTRO_TAC [`t`]); ASM_REWRITE_TAC[]; BY(MP_TAC PI_POS THEN REAL_ARITH_TAC); TYPIFY `(!t. azim (vec 0) (f v1 t) (f v3 t) (f v4 t) = azim (vec 0) v1 v3 v4) /\ &0 < azim (vec 0) v1 v2 v3 /\ azim (vec 0) v1 v2 v3 < pi` (C SUBGOAL_THEN MP_TAC); BY(ASM_MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Cuxvzoz.WNWSHJT_ALT [`v3`;`v1`;`v2`;`f`;`-- e`;`e`;`pi - azim (vec 0) v1 v3 v4`]; ASM_REWRITE_TAC[]; ANTS_TAC; CONJ_TAC; MATCH_MP_TAC Zlzthic.deformation_subset; BY(TYPIFY `{v1,v2,v3,v4}` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); BY(ASM_REWRITE_TAC[arith `a < p - b <=> a + b < p`]); REPEAT WEAKER_STRIP_TAC; TYPIFY `e''''''` EXISTS_TAC; ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (C INTRO_TAC [`t`]); ASM_REWRITE_TAC[]; BY(MP_TAC PI_POS THEN REAL_ARITH_TAC); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Cuxvzoz.epsilon_triple [`e''''`;`e'''''`;`e1`]; ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; TYPIFY `e''''''` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; ONCE_REWRITE_TAC[EQ_SYM_EQ]; REWRITE_TAC[CONJ_ASSOC] THEN CONJ_TAC; BY(REPEAT CONJ_TAC THEN (REPEAT (FIRST_X_ASSUM MATCH_MP_TAC)) THEN ASM_REWRITE_TAC[]); MATCH_MP_TAC Fan.sum3_azim_fan; CONJ_TAC; BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); BY(REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]) ]);;
(* }}} *)
let NEHXMWH = 
prove_by_refinement( `main_nonlinear_terminal_v11 ==> (!s FF v p. IMAGE (\i. (v i,v (SUC i))) (:num) = FF /\ is_scs_v39 s /\ scs_k_v39 s = 4 /\ MMs_v39 s v /\ scs_basic_v39 s /\ scs_generic v /\ (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4 * h0 < scs_b_v39 s i j) /\ (!i. ~(i MOD 4 = (p+2) MOD 4) ==> interior_angle1 (vec 0) FF (v i) < pi) ==> (dist(v p,v(p+1)) = scs_a_v39 s p (p+1) \/ dist(v p,v(p+1)) = scs_b_v39 s p (p+1)))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs]); TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Appendix.BBprime2_v39]); TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Appendix.BBprime_v39]); INTRO_TAC Appendix.BBs_v39 [`s`;`v`]; ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV;arith `~(4 <= 3)`]; REPEAT WEAKER_STRIP_TAC; TYPED_ABBREV_TAC `V = IMAGE v (:num)`; TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; BY(ASM_REWRITE_TAC[]); TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; EXPAND_TAC "V";
REWRITE_TAC[IN_IMAGE;IN_UNIV]; BY(MESON_TAC[]); INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; ASM_REWRITE_TAC[]; DISCH_TAC; TYPIFY `!i. interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i+1)) (v (i+3))` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; EXPAND_TAC "FF"; GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM)); TYPIFY `s` EXISTS_TAC; BY(ASM_REWRITE_TAC[IN;arith `4 - 1 = 3`;arith `3 < 4`;arith `SUC i = i+1`]); INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`]; ASM_REWRITE_TAC[LET_THM;IN;arith `4-1 = 3`;arith `SUC i = i+1`]; DISCH_TAC; TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); BY(ASM_REWRITE_TAC[arith `~(0=4)`]); TYPIFY `v 4 = v 0 /\ v 5 = v 1 /\ v 6 = v 2 /\ v 7 = v 3 /\ v 8 = v 4` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); BY(REWRITE_TAC[Terminal.MOD_4_EXPLICIT;arith `7 = 1*4 + 3`;arith `8 = 2*4 + 0`;MOD_MULT_ADD]); TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN ASM_REWRITE_TAC[Appendix.scs_generic]); TYPIFY `v (p+4) = v p /\ v (p+5) = v (p+1) /\ v (p+6) = v (p+2) /\ v (p+7) = v (p+3) /\ v (p+8) = v (p)` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `MOD` ((unlist ONCE_REWRITE_TAC) o GSYM); BY(REWRITE_TAC[arith `p+4 = 1*4 + p /\ p+5 = 1*4+(p+1) /\ p+6=1*4+(p+2) /\ p+7 = 1*4 + (p+3) /\ p+8 = 2*4 + p`;MOD_MULT_ADD]); INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p+3`;`2`;`3`]; REWRITE_TAC[arith `SUC (x+k) = (x+k)+1`;arith `((p:num)+i)+j = p+(i+j)`]; NUM_REDUCE_TAC; ASM_REWRITE_TAC[LET_THM]; DISCH_TAC; INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p+1`;`2`;`3`]; REWRITE_TAC[arith `SUC (x+k) = (x+k)+1`;arith `((p:num)+i)+j = p+(i+j)`]; NUM_REDUCE_TAC; ASM_REWRITE_TAC[LET_THM]; DISCH_TAC; COMMENT "collinearity"; TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); REPEAT GEN_TAC THEN DISCH_TAC; MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; GEXISTL_TAC [`V`;`E`;`FF`]; BY(ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]); TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; ASM_REWRITE_TAC[arith `~(4 = 0)`]; DISCH_TAC; TYPIFY `azim (vec 0) (v p) (v (p+1)) (v (p+3)) < pi` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); FIRST_X_ASSUM MATCH_MP_TAC; GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[arith`p = p+0`]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(NUM_REDUCE_TAC); TYPIFY `~coplanar {vec 0,v p,v (p+1),v (p+3)}` (C SUBGOAL_THEN ASSUME_TAC); REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; MATCH_MP_TAC (arith `&0 < x /\ x < pi ==> ~ ((x = &0) \/ (x = pi))`); BY(ASM_REWRITE_TAC[]); TYPIFY `!i a b. a < 4 /\ b < 4 /\ ~(a = b) ==> ~collinear {vec 0,v(i+a),v(i+b)}` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[]; FIRST_X_ASSUM_ST `v (i MOD 4) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); REPEAT (FIRST_X_ASSUM MATCH_MP_TAC); nCONJ_TAC 2; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; NUM_REDUCE_TAC; BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION;MOD_LT;arith `~(4=0)`]); ASM_REWRITE_TAC[]; BY(MESON_TAC[DIVISION;arith `~(4=0)`]); COMMENT "introduce deformation"; INTRO_TAC Cuxvzoz.deform_simplex_edge_exists [`V`;`(\ (t:real). &0)`;`(\(t:real). t)`;`v (p +3)`;`v p`;`v (p +1)`;`&1`]; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC; ANTS_TAC; REWRITE_TAC[arith `&0 < &1`]; SUBCONJ_TAC; ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d}={a,c,d,b}`]; BY(ASM_REWRITE_TAC[]); DISCH_TAC; CONJ_TAC; INTRO_TAC Planarity.cross_dot_fully_surrounded_fan [`(vec 0):real^3`;`v p`;`v (p+3)`;`v(p+1)`]; ASM_REWRITE_TAC[]; ANTS_TAC; INTRO_TAC Planarity.notcoplanar_imp_notcollinear_fan [`(vec 0):real^3`;`v p`;`v (p+1)`;`v(p+3)`]; BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); MATCH_MP_TAC (arith `x = y ==> (&0 < x ==> y > &0)`); BY(VEC3_TAC); REPEAT ( GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL]; BY(REWRITE_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_ID]); REPEAT WEAKER_STRIP_TAC; TYPIFY `~(scs_a_v39 s p (p+1) < dist(v p,v (p+1)) /\ dist(v p,v (p+1)) < scs_b_v39 s p (p+1))` ENOUGH_TO_SHOW_TAC; FIRST_X_ASSUM_ST `scs_a_v39` (C INTRO_TAC [`p`;`(p+1)`]); BY(REAL_ARITH_TAC); REPEAT WEAKER_STRIP_TAC; TYPIFY `(!i t. abs t < e' ==> norm (f (v i) t) = norm (v i))` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; TYPIFY `v i = v p` ASM_CASES_TAC; ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); BY(ASM_REWRITE_TAC[] THEN MESON_TAC[]); FIRST_X_ASSUM GMATCH_SIMP_TAC; BY(ASM_REWRITE_TAC[]); TYPIFY `!i. 0 < i /\ i < 4 ==> ~(v (p + i) = v p)` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC; ASM_REWRITE_TAC[]; GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; NUM_REDUCE_TAC; BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION;MOD_LT;arith `~(4=0)`;arith `0 < i ==> ~(i=0)`]); TYPIFY `!i j (k:num). v i = v j ==> v (i+k) = v (j+k)` (C SUBGOAL_THEN ASSUME_TAC); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; ONCE_REWRITE_TAC[arith `(i:num) + k = k + i`]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(ASM_REWRITE_TAC[arith `~(4 = 0)`]); TYPIFY `!t. azim (vec 0) (f (v (p+2)) t) (f (v (p+3)) t) (f (v (p+1)) t) = azim(vec 0) (v(p+2)) (v(p+3)) (v(p+1))` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); TYPIFY `!i. azim (vec 0) (v i) (v (i+1)) (v (i+3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); MATCH_MP_TAC Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI; BY(ASM_REWRITE_TAC[]); TYPIFY `(!i. ?e0. &0 < e0 /\ (azim (vec 0) (v i) (v (i + 1)) (v (i + 3)) = pi ==> (!t. abs t < e0 ==> azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + 3)) t) <= pi)))` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; TYPIFY `v i = v (p+2)` ASM_CASES_TAC; FIRST_ASSUM (fun t -> FIRST_X_ASSUM (ASSUME_TAC o (C MATCH_MP t))); TYPIFY `&1` EXISTS_TAC; ASM_REWRITE_TAC[arith `&0 < &1`;arith `(p+2)+k = p + (2+k)`]; NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC); TYPIFY `azim (vec 0) (v i) (v (i + 1)) (v (i + 3)) < pi` ENOUGH_TO_SHOW_TAC; BY(MESON_TAC[arith `x < pi ==> ~(x = pi)`;arith `&0 < &1`]); BY(ASM_MESON_TAC[]); (COMMENT "deformation in BBs"); INTRO_TAC Cuxvzoz.deformation_BBs_ALT [`s`;`4`;`f`;`v`;`e'`]; ANTS_TAC; NUM_REDUCE_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC ab4_assumption_reduction; GEXISTL_TAC [`p`;`e'`]; ASM_REWRITE_TAC[]; CONJ_TAC; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`i`;`j`]); BY(ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); REPEAT WEAKER_STRIP_TAC; (FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`])); BY(ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); (REPEAT WEAKER_STRIP_TAC); COMMENT "azim sums"; INTRO_TAC deform_azim_sum [`v (p+3)`;`v p`;`v (p+1)`;`v(p+2)`;`f`;`e'`]; ANTS_TAC; REPEAT (FIRST_X_ASSUM_ST `c = a + b` MP_TAC) THEN ASM_REWRITE_TAC[]; REPLICATE_TAC 3 DISCH_TAC; CONJ_TAC; MATCH_MP_TAC Zlzthic.deformation_subset; (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `~collinear {vec 0, v (p + 3), v (p+0)} /\ ~collinear {vec 0, v (p + 3), v (p + 1)} /\ ~collinear {vec 0, v (p + 3), v (p + 2)}` (C SUBGOAL_THEN MP_TAC); BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN (unlist REWRITE_TAC); nCONJ_TAC 2; BY(ASM_REWRITE_TAC[]); FIRST_X_ASSUM (SUBST1_TAC) THEN REWRITE_TAC[]; REPLICATE_TAC 4 (FIRST_X_ASSUM kill); ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `&0 < azim (vec 0) (v (p + 3)) (v p) (v (p + 2)) /\ azim (vec 0) (v (p + 3)) (v p) (v (p + 2)) < pi` (unlist REWRITE_TAC); FIRST_X_ASSUM_ST `&0 < azim a b c d` (C INTRO_TAC [`p+3`]); TYPIFY `azim (vec 0) (v (p+3)) (v p) (v (p+2)) = azim (vec 0) (v (p + 3)) (v ((p + 3) + 1)) (v ((p + 3) + 3))` (C SUBGOAL_THEN ASSUME_TAC); BY(REWRITE_TAC[arith `((p:num) + i) + j = p + i+j`] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; DISCH_THEN (unlist REWRITE_TAC); FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); ASM_REWRITE_TAC[]; FIRST_X_ASSUM MATCH_MP_TAC; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(NUM_REDUCE_TAC); DISJ2_TAC; CONJ_TAC; GEN_TAC; FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); ASM_REWRITE_TAC[]; BY(REPEAT CONJ_TAC THEN GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`] THEN GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); REWRITE_TAC[Zlzthic.azim_lt_pi_cross]; TYPIFY `(v (p + 3) cross v p) dot v (p + 1) = (v (p) cross (v (p+1))) dot v (p + 3)` (C SUBGOAL_THEN SUBST1_TAC); BY(VEC3_TAC); REWRITE_TAC[GSYM Zlzthic.azim_lt_pi_cross]; BY(ASM_REWRITE_TAC[]); (REPEAT WEAKER_STRIP_TAC); COMMENT "second azim sum"; INTRO_TAC deform_azim_sum [`v (p+1)`;`v (p+2)`;`v (p+3)`;`v(p)`;`f`;`e'`]; ANTS_TAC; REPEAT (FIRST_X_ASSUM_ST `c = a + b` MP_TAC) THEN ASM_REWRITE_TAC[]; REPLICATE_TAC 3 DISCH_TAC; CONJ_TAC; MATCH_MP_TAC Zlzthic.deformation_subset; (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `~collinear {vec 0, v (p + 1), v (p + 2)} /\ ~collinear {vec 0, v (p + 1), v (p + 3)} /\ ~collinear {vec 0, v (p + 1), v (p + 0)}` (C SUBGOAL_THEN MP_TAC); BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN (unlist REWRITE_TAC); nCONJ_TAC 2; BY(ASM_REWRITE_TAC[]); FIRST_X_ASSUM (SUBST1_TAC) THEN REWRITE_TAC[]; REPLICATE_TAC 4 (FIRST_X_ASSUM kill); ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `&0 < azim (vec 0) (v (p + 1)) (v (p + 2)) (v p) /\ azim (vec 0) (v (p + 1)) (v (p + 2)) (v p) < pi` (unlist REWRITE_TAC); FIRST_X_ASSUM_ST `&0 < azim a b c d` (C INTRO_TAC [`p+1`]); TYPIFY `azim (vec 0) (v (p+1)) (v (p+2)) (v (p)) = azim (vec 0) (v (p + 1)) (v ((p + 1) + 1)) (v ((p + 1) + 3))` (C SUBGOAL_THEN ASSUME_TAC); BY(REWRITE_TAC[arith `((p:num) + i) + j = p + i+j`] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; DISCH_THEN (unlist REWRITE_TAC); FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); ASM_REWRITE_TAC[]; FIRST_X_ASSUM MATCH_MP_TAC; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(NUM_REDUCE_TAC); DISJ1_TAC; CONJ_TAC; GEN_TAC; FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); ASM_REWRITE_TAC[]; BY(REPEAT CONJ_TAC THEN GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`] THEN GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); REWRITE_TAC[Zlzthic.azim_lt_pi_cross]; TYPIFY `(v (p + 1) cross v (p+3)) dot v (p) = (v (p) cross (v (p+1))) dot v (p + 3)` (C SUBGOAL_THEN SUBST1_TAC); BY(VEC3_TAC); REWRITE_TAC[GSYM Zlzthic.azim_lt_pi_cross]; BY(ASM_REWRITE_TAC[]); (REPEAT WEAKER_STRIP_TAC); TYPIFY `?e3. &0 < e3 /\ (!t. abs t < e3 ==> dist(v p,v (p+1)) + t IN real_interval(scs_a_v39 s p (p+1),scs_b_v39 s p (p+1)))` (C SUBGOAL_THEN MP_TAC); INTRO_TAC Zlzthic.real_interval_contains_0_ball [`scs_a_v39 s p (p+1)-dist(v p,v (p+1))`;`scs_b_v39 s p (p+1) - dist(v p,v (p+1))`;`&1`]; ASM_REWRITE_TAC[arith `&0 < &1`;arith `a - d < &0 <=> a < d`;arith `&0 < b - d <=> d < b`]; REPEAT WEAKER_STRIP_TAC; TYPIFY `e` EXISTS_TAC; ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (C INTRO_TAC [`t`]); ASM_REWRITE_TAC[IN_REAL_INTERVAL]; BY(REAL_ARITH_TAC); REPEAT WEAKER_STRIP_TAC; COMMENT "coplanar"; INTRO_TAC Zlzthic.NONPLANAR_OPEN [`(\ (t:real). (vec 0):real^3)`;`f (v p)`;`\ (t:real). v (p+1)`;`\ (t:real). v (p+3)`;`&0`]; ASM_REWRITE_TAC[CONTINUOUS_CONST]; DISCH_THEN MP_TAC THEN ANTS_TAC; FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation] THEN REPEAT WEAKER_STRIP_TAC; CONJ2_TAC; BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); POP_ASSUM GMATCH_SIMP_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[arith `abs (&0 - t') = abs t'`] THEN REPEAT WEAKER_STRIP_TAC; INTRO_TAC Zlzthic.WNWSHJT [`v(p+3)`;`v p`;`v (p+1)`;`f`;`-- e'`;`e'`]; ANTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; MATCH_MP_TAC Zlzthic.deformation_subset; (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (REPEAT o GMATCH_SIMP_TAC) THEN ASM_REWRITE_TAC[]; TYPIFY `!i. ~(i=0) /\ i < 4 ==> ~collinear {vec 0,v (p+0),v(p+i)}` ENOUGH_TO_SHOW_TAC; BY(MESON_TAC[arith `p+0=p` ;arith `~(1=0) /\ 1 < 4 /\ ~(3=0) /\ 3 < 4`]); GEN_TAC THEN DISCH_TAC; FIRST_X_ASSUM MATCH_MP_TAC; BY(ASM_REWRITE_TAC[arith `0 < 4`]); REPEAT WEAKER_STRIP_TAC; COMMENT "introduce 1834"; INTRO_TAC Iunbuig.epsilon_hept [`e`;`e'`;`e''`;`e'''`;`e3`;`e1`;`e1'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; FIRST_ASSUM_ST `!i. 0 < i /\ i < 4 ==> ~(v (p + i) = v p)` MP_TAC; FIRST_ASSUM_ST `i MOD 4 = j MOD 4` (unlist REWRITE_TAC); DISCH_TAC; INTRO_TAC (UNDISCH Ocbicby.LEMMA_1834976363) [`norm (v (p+3))`;`norm (v p)`;`norm (v (p+1))`;`dist(v p,v(p+1))`;`dist (v(p+1),v(p+3))`;`dist(v p,v (p+3))`;`dist(v p,v (p+1)) - e7`;`dist(v p,v(p+1)) + e7`]; ANTS_TAC; ASM_REWRITE_TAC[]; (COMMENT "1834 ants"); COMMENT "restart"; TYPIFY `!i. &2 <= norm (v i) /\ norm (v i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; FIRST_X_ASSUM_ST `BBs_v39` kill THEN FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN EXPAND_TAC "V" THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `ball_annulus` MP_TAC; REWRITE_TAC[SUBSET;IN_IMAGE;IN_UNIV]; BY(MESON_TAC[]); ASM_REWRITE_TAC[]; FIRST_ASSUM_ST `collinear` (C INTRO_TAC [`p`;`3`;`0`]); FIRST_X_ASSUM_ST `collinear` (C INTRO_TAC [`p`;`3`;`1`]); NUM_REDUCE_TAC; REWRITE_TAC[arith `p + 0 = p`]; REPEAT WEAKER_STRIP_TAC; TYPIFY_GOAL_THEN `&0 < ups_x (norm (v (p + 3)) * norm (v (p + 3))) (norm (v p) * norm (v p)) (dist (v p,v (p + 3)) * dist (v p,v (p + 3))) /\ &0 < ups_x (norm (v (p + 3)) * norm (v (p + 3))) (norm (v (p + 1)) * norm (v (p + 1))) (dist (v (p + 1),v (p + 3)) * dist (v (p + 1),v (p + 3)))` (unlist REWRITE_TAC); REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_0;DIST_SYM;arith`x pow 2 = x*x`]; BY(MESON_TAC[]); TYPIFY `!i j. &2 <= dist(v i,v j) ==> (&2 / h0) pow 2 <= xrr (norm(v i)) (norm(v (j))) (dist (v i,v j))` ((C SUBGOAL_THEN ASSUME_TAC)); REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC Ocbicby.xrr_simple_lower_bound; BY(ASM_REWRITE_TAC[arith `x <= x`]); CONJ_TAC; POP_ASSUM MATCH_MP_TAC; MATCH_MP_TAC Ocbicby.scs_lb_2; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[]; ONCE_REWRITE_TAC[EQ_SYM_EQ]; FIRST_X_ASSUM MATCH_MP_TAC; BY(NUM_REDUCE_TAC); CONJ_TAC; TYPIFY `#15.53 = sqrt(#15.53) pow 2` (C SUBGOAL_THEN SUBST1_TAC); GMATCH_SIMP_TAC SQRT_POW_2; BY(REAL_ARITH_TAC); MATCH_MP_TAC Ocbicby.xrr_simple_upper_bound; ASM_REWRITE_TAC[]; TYPIFY `&4 = sqrt(&16)` (C SUBGOAL_THEN SUBST1_TAC); REWRITE_TAC[arith `&16 = &4 pow 2`]; REWRITE_TAC[POW_2_SQRT_ABS]; BY(REAL_ARITH_TAC); GMATCH_SIMP_TAC SQRT_MONO_LT_EQ; TYPIFY_GOAL_THEN `&0 <= #15.53 /\ &0 < &16 /\ #15.53 < &16` (unlist REWRITE_TAC); BY(REAL_ARITH_TAC); CONJ_TAC; BY(REAL_ARITH_TAC); CONJ_TAC; MATCH_MP_TAC Ocbicby.scs_lb_2; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[]; ONCE_REWRITE_TAC[EQ_SYM_EQ]; FIRST_X_ASSUM MATCH_MP_TAC; BY(NUM_REDUCE_TAC); MATCH_MP_TAC REAL_LE_TRANS; TYPIFY `cstab` EXISTS_TAC; CONJ_TAC; MATCH_MP_TAC (arith `d <= scs_b_v39 s p (p+1) /\ scs_b_v39 s p (p+1) <= cstab ==> d <= cstab`); CONJ_TAC; FIRST_X_ASSUM_ST `BBs_v39` kill; (FIRST_X_ASSUM_ST `BBs_v39` MP_TAC) THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM]; BY(MESON_TAC[]); FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39]; ASM_REWRITE_TAC[arith `3 < 4`;arith `SUC i = i+1`]; BY(MESON_TAC[]); REWRITE_TAC[Sphere.cstab]; MATCH_MP_TAC REAL_LE_RSQRT; BY(REAL_ARITH_TAC); CONJ_TAC; ONCE_REWRITE_TAC[DIST_SYM]; FIRST_X_ASSUM MATCH_MP_TAC; MATCH_MP_TAC Ocbicby.scs_lb_2; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[]; BY(GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); CONJ_TAC; ONCE_REWRITE_TAC[DIST_SYM]; FIRST_X_ASSUM MATCH_MP_TAC; MATCH_MP_TAC Ocbicby.scs_lb_2; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[]; BY(FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); CONJ_TAC; REWRITE_TAC[IN_REAL_INTERVAL]; BY(FIRST_X_ASSUM_ST `&0 < e` MP_TAC THEN REAL_ARITH_TAC); CONJ_TAC; REWRITE_TAC[SUBSET;IN_REAL_INTERVAL;IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; TYPIFY `?t. abs t < e7 /\ x = dist(v p,v(p+1)) + t` (C SUBGOAL_THEN MP_TAC); TYPIFY `x - dist(v p,v(p+1))` EXISTS_TAC; CONJ2_TAC; BY(REAL_ARITH_TAC); BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `norm (f (v p) t) = norm (v p)` (C INTRO_TAC [`t`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); REWRITE_TAC[DIST_SYM] THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`t`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); DISCH_TAC; FIRST_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`] THEN REWRITE_TAC[Oxlzlez.coplanar_delta_y;DIST_0;DIST_SYM]; RULE_ASSUM_TAC (REWRITE_RULE[arith `d + &0 = d`]); ASM_REWRITE_TAC[]; DISCH_THEN (unlist REWRITE_TAC); REWRITE_TAC[GSYM DIST_NZ]; CONJ_TAC; DISCH_TAC; FIRST_X_ASSUM_ST `coplanar` MP_TAC; BY(ASM_REWRITE_TAC[SET_RULE `{a,b,b,c} = {a,b,c}`;COPLANAR_3]); TYPIFY `~collinear {vec 0,f (v p) t,v (p+1)}` (C SUBGOAL_THEN MP_TAC); BY(POP_ASSUM MP_TAC THEN MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan]); REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS]; BY(REWRITE_TAC[DIST_0;arith `x pow 2 = x*x`;DIST_SYM]); TYPIFY `!i. i < 3 ==> &0 < dist (v (p+i), v (p+3))` ENOUGH_TO_SHOW_TAC; BY(MESON_TAC[arith `p + 0 = (p:num)`;arith `0 < 3`;arith `1 < 3`]); REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC (arith `&2 <= x ==> &0 < x`); MATCH_MP_TAC Ocbicby.scs_lb_2; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC; BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[arith `i < 3 <=> i = 0 \/ i = 1 \/ i = 2`] THEN DISCH_TAC THEN REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC); REPEAT WEAKER_STRIP_TAC; TYPIFY `?t. abs t < e7 /\ y4' = dist(v p,v(p+1)) + t` (C SUBGOAL_THEN MP_TAC); TYPIFY `y4' - dist(v p,v(p+1))` EXISTS_TAC; CONJ2_TAC; BY(REAL_ARITH_TAC); BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REWRITE_TAC[IN_REAL_INTERVAL] THEN REAL_ARITH_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `taum` MP_TAC; ASM_REWRITE_TAC[]; REWRITE_TAC[arith `~(x < y) <=> (y <= x)`]; FIRST_X_ASSUM_ST `norm (f (v p) t) = norm (v p)` (C INTRO_TAC [`t`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); (REWRITE_TAC[DIST_SYM;arith `d + &0 = d`] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]); COMMENT "back to root, next tau"; TYPIFY `sum {i | i < 4} (\i. rho_fun (norm (v i)) * azim (vec 0) (v i) (v (i + 1)) (v (i + 4 - 1))) <= sum {i | i < 4} (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f(v(i+1)) t) (f (v (i + 4 - 1)) t))` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC Cuxvzoz.MMs_minimize_tau_fun; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[arith `3 < 4`]; FIRST_X_ASSUM MATCH_MP_TAC; BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); POP_ASSUM MP_TAC; TYPIFY `{i | i < 4} = 0..(4-1)` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG] THEN ARITH_TAC); REPEAT ( GMATCH_SIMP_TAC (GSYM Oxl_def.periodic_sum)); TYPIFY `p` EXISTS_TAC; CONJ_TAC; NUM_REDUCE_TAC; FIRST_ASSUM_ST `periodic` MP_TAC THEN REWRITE_TAC[Oxl_def.periodic]; REWRITE_TAC[arith `(i+4)+k = (i+k)+4`]; BY(DISCH_THEN (unlist REWRITE_TAC)); TYPIFY `p` EXISTS_TAC; CONJ_TAC; NUM_REDUCE_TAC; FIRST_ASSUM_ST `periodic` MP_TAC THEN REWRITE_TAC[Oxl_def.periodic]; REWRITE_TAC[arith `(i+4)+k = (i+k)+4`]; BY(DISCH_THEN (unlist REWRITE_TAC)); NUM_REDUCE_TAC; REWRITE_TAC[arith `3+p = SUC(SUC(SUC p))`;SUM_CLAUSES_NUMSEG;SUM_SING_NUMSEG;arith `p <= SUC p /\ p <= SUC (SUC p) /\ p <= SUC(SUC(SUC p))`]; REWRITE_TAC[arith `SUC i = i+1`;arith `(i + j) + (k:num) = i+(j+k)`]; NUM_REDUCE_TAC; ASM_REWRITE_TAC[]; REPLICATE_TAC 7 (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `rho_fun` MP_TAC THEN ASM_REWRITE_TAC[Appendix.rho_rho_fun]; TYPIFY `f (v(p+1)) t = v(p+1) /\ f (v (p+2)) t = v(p+2) /\ f(v (p+3)) t = v(p+3)` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); BY(ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); POP_ASSUM (fun t -> ASM_TAC THEN unlist REWRITE_TAC t THEN REPEAT DISCH_TAC THEN ASSUME_TAC t); FIRST_X_ASSUM_ST `azim` MP_TAC; FIRST_X_ASSUM_ST `azim` MP_TAC THEN BURY_MP_TAC; FIRST_ASSUM_ST `azim` ((unlist REWRITE_TAC) o GSYM); FIRST_ASSUM_ST `azim (vec 0) (v (p + 3)) (f (v p) t) (v (p + 2))` ((unlist REWRITE_TAC) o GSYM); REWRITE_TAC[arith `(a+b)+c = a + b + c`]; REWRITE_TAC[arith `r0 * (a013) + r1 * (a123 + a130) + r2 * a231 + r3 * (a301+a312) <= r0 * (f013) + r1 * (a123 + f130) + r2 * a231 + r3 *(f301 +a312) <=> r0 * a013 + r1*a130 + r3* a301 <= r0 * f013 + r1 * f130 + r3 * f301`]; MATCH_MP_TAC (arith `a - (pi+sol0) = a' /\ b - (pi+sol0) = b' ==> (a <= b ==> a' <= b')`); REWRITE_TAC[arith `(a + b+c) - (pi + sol0) = a + b + c - (pi + sol0)`]; CONJ_TAC; GMATCH_SIMP_TAC (GSYM Cuxvzoz.tau3_azim); GMATCH_SIMP_TAC Cuxvzoz.tau3_taum_nonplanar; ASM_REWRITE_TAC[]; REWRITE_TAC[DIST_SYM]; BY(MESON_TAC[Terminal.taum_sym]); FIRST_X_ASSUM_ST `norm a = norm b` (SUBST1_TAC o GSYM); FIRST_X_ASSUM_ST `dist s + t` (SUBST1_TAC o GSYM); GMATCH_SIMP_TAC (GSYM Cuxvzoz.tau3_azim); GMATCH_SIMP_TAC Cuxvzoz.tau3_taum_nonplanar; REWRITE_TAC[DIST_SYM]; REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; ASM_REWRITE_TAC[DIST_SYM]; BY(MESON_TAC[Terminal.taum_sym]); ASM_REWRITE_TAC[]; BY(FIRST_X_ASSUM_ST `azim (vec 0) (f (v p) t) (v (p + 1)) (v (p + 3)) < pi` MP_TAC THEN REAL_ARITH_TAC) ]);; (* }}} *)
let BZQNDMN = 
prove_by_refinement( `main_nonlinear_terminal_v11 ==> (!s FF v p. IMAGE (\i. (v i,v (SUC i))) (:num) = FF /\ is_scs_v39 s /\ scs_k_v39 s = 4 /\ MMs_v39 s v /\ scs_basic_v39 s /\ scs_generic v /\ (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4 * h0 < scs_b_v39 s i j) /\ (!i. ~(i MOD 4 = (p+3) MOD 4) ==> interior_angle1 (vec 0) FF (v i) < pi) ==> (dist(v p,v(p+1)) = scs_a_v39 s p (p+1) \/ dist(v p,v(p+1)) = scs_b_v39 s p (p+1)))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs]); TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Appendix.BBprime2_v39]); TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Appendix.BBprime_v39]); INTRO_TAC Appendix.BBs_v39 [`s`;`v`]; ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV;arith `~(4 <= 3)`]; REPEAT WEAKER_STRIP_TAC; TYPED_ABBREV_TAC `V = IMAGE v (:num)`; TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; BY(ASM_REWRITE_TAC[]); TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; EXPAND_TAC "V";
REWRITE_TAC[IN_IMAGE;IN_UNIV]; BY(MESON_TAC[]); INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; ASM_REWRITE_TAC[]; DISCH_TAC; TYPIFY `!i. interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i+1)) (v (i+3))` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; EXPAND_TAC "FF"; GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM)); TYPIFY `s` EXISTS_TAC; BY(ASM_REWRITE_TAC[IN;arith `4 - 1 = 3`;arith `3 < 4`;arith `SUC i = i+1`]); INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`]; ASM_REWRITE_TAC[LET_THM;IN;arith `4-1 = 3`;arith `SUC i = i+1`]; DISCH_TAC; TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); BY(ASM_REWRITE_TAC[arith `~(0=4)`]); TYPIFY `v 4 = v 0 /\ v 5 = v 1 /\ v 6 = v 2 /\ v 7 = v 3 /\ v 8 = v 4` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); BY(REWRITE_TAC[Terminal.MOD_4_EXPLICIT;arith `7 = 1*4 + 3`;arith `8 = 2*4 + 0`;MOD_MULT_ADD]); TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN ASM_REWRITE_TAC[Appendix.scs_generic]); TYPIFY `v (p+4) = v p /\ v (p+5) = v (p+1) /\ v (p+6) = v (p+2) /\ v (p+7) = v (p+3) /\ v (p+8) = v (p)` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `MOD` ((unlist ONCE_REWRITE_TAC) o GSYM); BY(REWRITE_TAC[arith `p+4 = 1*4 + p /\ p+5 = 1*4+(p+1) /\ p+6=1*4+(p+2) /\ p+7 = 1*4 + (p+3) /\ p+8 = 2*4 + p`;MOD_MULT_ADD]); COMMENT "change here"; INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p`;`2`;`3`]; REWRITE_TAC[arith `SUC (x+k) = (x+k)+1`;arith `((p:num)+i)+j = p+(i+j)`]; NUM_REDUCE_TAC; ASM_REWRITE_TAC[LET_THM]; DISCH_TAC; INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p+2`;`2`;`3`]; REWRITE_TAC[arith `SUC (x+k) = (x+k)+1`;arith `((p:num)+i)+j = p+(i+j)`]; NUM_REDUCE_TAC; ASM_REWRITE_TAC[LET_THM]; DISCH_TAC; COMMENT "collinearity"; TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); REPEAT GEN_TAC THEN DISCH_TAC; MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; GEXISTL_TAC [`V`;`E`;`FF`]; BY(ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]); TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; ASM_REWRITE_TAC[arith `~(4 = 0)`]; DISCH_TAC; TYPIFY `azim (vec 0) (v (p+1)) (v((p+1)+1)) (v ((p+1)+3)) = azim (vec 0) (v (p+1)) (v (p+2)) (v p)` (C SUBGOAL_THEN ASSUME_TAC); BY(REWRITE_TAC[arith `(p+1)+i = p+(1+i)`] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC); TYPIFY `azim (vec 0) (v (p+1)) (v ((p+1)+1)) (v ((p+1)+3)) < pi` (C SUBGOAL_THEN MP_TAC); FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); FIRST_X_ASSUM MATCH_MP_TAC; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(NUM_REDUCE_TAC); ASM_REWRITE_TAC[] THEN DISCH_TAC; TYPIFY `&0 < azim (vec 0) (v (p+1)) (v ((p+1)+1)) (v ((p+1)+3))` (C SUBGOAL_THEN MP_TAC); BY(ASM_REWRITE_TAC[]); FIRST_X_ASSUM SUBST1_TAC THEN DISCH_TAC; TYPIFY `~coplanar {vec 0,v p,v (p+1),v (p+2)}` (C SUBGOAL_THEN ASSUME_TAC); ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,c,d,b}`]; REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; MATCH_MP_TAC (arith `&0 < x /\ x < pi ==> ~ ((x = &0) \/ (x = pi))`); BY((ASM_REWRITE_TAC[])); TYPIFY `!i a b. a < 4 /\ b < 4 /\ ~(a = b) ==> ~collinear {vec 0,v(i+a),v(i+b)}` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[]; FIRST_X_ASSUM_ST `v (i MOD 4) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); REPEAT (FIRST_X_ASSUM MATCH_MP_TAC); nCONJ_TAC 2; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; NUM_REDUCE_TAC; BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION;MOD_LT;arith `~(4=0)`]); ASM_REWRITE_TAC[]; BY(MESON_TAC[DIVISION;arith `~(4=0)`]); COMMENT "introduce deformation"; INTRO_TAC Cuxvzoz.deform_simplex_edge_exists [`V`;`(\ (t:real). t)`;`(\(t:real). &0)`;`v (p)`;`v (p+1)`;`v (p +2)`;`&1`]; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC; ANTS_TAC; REWRITE_TAC[arith `&0 < &1`]; CONJ_TAC; INTRO_TAC Planarity.cross_dot_fully_surrounded_fan [`(vec 0):real^3`;`v (p+1)`;`v (p)`;`v(p+2)`]; ASM_REWRITE_TAC[]; ANTS_TAC; INTRO_TAC Planarity.notcoplanar_imp_notcollinear_fan [`(vec 0):real^3`;`v p`;`v (p+1)`;`v(p+2)`]; BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[SET_RULE `{a,b,c}={a,c,b}`]); MATCH_MP_TAC (arith `x = y ==> (&0 < x ==> y > &0)`); BY(VEC3_TAC); REPEAT ( GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL]; BY(REWRITE_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_ID]); REPEAT WEAKER_STRIP_TAC; COMMENT "A"; TYPIFY `~(scs_a_v39 s p (p+1) < dist(v p,v (p+1)) /\ dist(v p,v (p+1)) < scs_b_v39 s p (p+1))` ENOUGH_TO_SHOW_TAC; FIRST_X_ASSUM_ST `scs_a_v39` (C INTRO_TAC [`p`;`(p+1)`]); BY(REAL_ARITH_TAC); REPEAT WEAKER_STRIP_TAC; TYPIFY `(!i t. abs t < e' ==> norm (f (v i) t) = norm (v i))` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; TYPIFY `v i = v (p+1)` ASM_CASES_TAC; ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); BY(ASM_REWRITE_TAC[] THEN MESON_TAC[]); FIRST_X_ASSUM GMATCH_SIMP_TAC; BY(ASM_REWRITE_TAC[]); TYPIFY `!i. 0 < i /\ i < 4 ==> ~(v (p + i) = v p)` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC; ASM_REWRITE_TAC[]; GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; NUM_REDUCE_TAC; BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION;MOD_LT;arith `~(4=0)`;arith `0 < i ==> ~(i=0)`]); TYPIFY `!i. i=0 \/ i = 2 \/ i = 3 ==> ~(v (p + i) = v (p+1))` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT STRIP_TAC THEN FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); TYPIFY `!i j (k:num). v i = v j ==> v (i+k) = v (j+k)` (C SUBGOAL_THEN ASSUME_TAC); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; ONCE_REWRITE_TAC[arith `(i:num) + k = k + i`]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(ASM_REWRITE_TAC[arith `~(4 = 0)`]); TYPIFY `!t. azim (vec 0) (f (v (p+3)) t) (f (v (p)) t) (f (v (p+2)) t) = azim(vec 0) (v(p+3)) (v(p)) (v(p+2))` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; FIRST_X_ASSUM_ST `~(w = v (p+1)) ==> a` (REPEAT o GMATCH_SIMP_TAC); ONCE_REWRITE_TAC[arith `(v p = (v:num->real^3) (p+1)) <=> (v(p+1) = v p)`]; BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); TYPIFY `!i. azim (vec 0) (v i) (v (i+1)) (v (i+3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); MATCH_MP_TAC Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI; BY(ASM_REWRITE_TAC[]); TYPIFY `(!i. ?e0. &0 < e0 /\ (azim (vec 0) (v i) (v (i + 1)) (v (i + 3)) = pi ==> (!t. abs t < e0 ==> azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + 3)) t) <= pi)))` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; TYPIFY `v i = v (p+3)` ASM_CASES_TAC; FIRST_ASSUM (fun t -> FIRST_X_ASSUM (ASSUME_TAC o (C MATCH_MP t))); TYPIFY `&1` EXISTS_TAC; ASM_REWRITE_TAC[arith `&0 < &1`;arith `(p+3)+k = p + (3+k)`]; NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC); TYPIFY `azim (vec 0) (v i) (v (i + 1)) (v (i + 3)) < pi` ENOUGH_TO_SHOW_TAC; BY(MESON_TAC[arith `x < pi ==> ~(x = pi)`;arith `&0 < &1`]); BY(ASM_MESON_TAC[]); (COMMENT "deformation in BBs"); INTRO_TAC Cuxvzoz.deformation_BBs_ALT [`s`;`4`;`f`;`v`;`e'`]; ANTS_TAC; NUM_REDUCE_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC ab4_assumption_reduction_sym; GEXISTL_TAC [`p`;`e'`]; ASM_REWRITE_TAC[]; CONJ_TAC; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`i`;`j`]); BY(ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); REPEAT WEAKER_STRIP_TAC; (FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`])); BY(ASM_REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); (REPEAT WEAKER_STRIP_TAC); COMMENT "azim sums"; INTRO_TAC deform_azim_sum [`v (p)`;`v (p+1)`;`v (p+2)`;`v(p+3)`;`f`;`e'`]; ANTS_TAC; REPEAT (FIRST_X_ASSUM_ST `c = a + b` MP_TAC) THEN ASM_REWRITE_TAC[]; REPLICATE_TAC 3 DISCH_TAC; CONJ_TAC; MATCH_MP_TAC Zlzthic.deformation_subset; (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `~collinear {vec 0, v (p + 0), v (p+1)} /\ ~collinear {vec 0, v (p + 0), v (p + 2)} /\ ~collinear {vec 0, v (p + 0), v (p + 3)}` (C SUBGOAL_THEN MP_TAC); BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN (unlist REWRITE_TAC); nCONJ_TAC 1; BY(FIRST_X_ASSUM_ST `SUC` MP_TAC THEN REWRITE_TAC[arith `SUC p = p+1`] THEN DISCH_THEN (unlist REWRITE_TAC)); FIRST_X_ASSUM (SUBST1_TAC) THEN REWRITE_TAC[]; REPLICATE_TAC 3 (FIRST_X_ASSUM kill); ASM_REWRITE_TAC[]; CONJ_TAC; FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); ASM_REWRITE_TAC[]; FIRST_X_ASSUM MATCH_MP_TAC; GEN_REWRITE_TAC (RAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(NUM_REDUCE_TAC); DISJ2_TAC; CONJ_TAC; GEN_TAC; FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); ASM_REWRITE_TAC[]; TYPIFY `p MOD 4 = (p+0) MOD 4` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[arith `p+0 = p`]); BY(REPEAT CONJ_TAC THEN GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); REWRITE_TAC[Zlzthic.azim_lt_pi_cross]; TYPIFY `(v (p) cross v (p+1)) dot v (p + 2) = (v (p+1) cross (v (p+2))) dot v (p)` (C SUBGOAL_THEN SUBST1_TAC); BY(VEC3_TAC); REWRITE_TAC[GSYM Zlzthic.azim_lt_pi_cross]; BY(ASM_REWRITE_TAC[]); (REPEAT WEAKER_STRIP_TAC); INTRO_TAC deform_azim_sum [`v (p+2)`;`v (p+3)`;`v (p)`;`v(p+1)`;`f`;`e'`]; ANTS_TAC; REPEAT (FIRST_X_ASSUM_ST `c = a + b` MP_TAC) THEN ASM_REWRITE_TAC[]; REPLICATE_TAC 3 DISCH_TAC; CONJ_TAC; MATCH_MP_TAC Zlzthic.deformation_subset; (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `~collinear {vec 0, v (p + 2), v (p + 3)} /\ ~collinear {vec 0, v (p + 2), v (p + 0)} /\ ~collinear {vec 0, v (p + 2), v (p + 1)}` (C SUBGOAL_THEN MP_TAC); BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN (unlist REWRITE_TAC); nCONJ_TAC 2; BY(ASM_REWRITE_TAC[]); FIRST_X_ASSUM (SUBST1_TAC) THEN REWRITE_TAC[]; REPLICATE_TAC 4 (FIRST_X_ASSUM kill); ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `&0 < azim (vec 0) (v (p + 2)) (v (p + 3)) (v (p+1)) /\ azim (vec 0) (v (p + 2)) (v (p + 3)) (v (p+1)) < pi` (unlist REWRITE_TAC); FIRST_X_ASSUM_ST `&0 < azim a b c d` (C INTRO_TAC [`p+2`]); TYPIFY `azim (vec 0) (v (p+2)) (v (p+3)) (v (p+1)) = azim (vec 0) (v (p + 2)) (v ((p + 2) + 1)) (v ((p + 2) + 3))` (C SUBGOAL_THEN ASSUME_TAC); BY(REWRITE_TAC[arith `((p:num) + i) + j = p + i+j`] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; DISCH_THEN (unlist REWRITE_TAC); FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); ASM_REWRITE_TAC[]; FIRST_X_ASSUM MATCH_MP_TAC; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(NUM_REDUCE_TAC); DISJ1_TAC; CONJ_TAC; GEN_TAC; FIRST_X_ASSUM_ST `~(w = v (p+1)) ==> a` (REPEAT o GMATCH_SIMP_TAC); ASM_REWRITE_TAC[]; TYPIFY `p MOD 4 = (p+0) MOD 4` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[arith `p + 0 = p`]); BY(REPEAT CONJ_TAC THEN GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); REWRITE_TAC[Zlzthic.azim_lt_pi_cross]; TYPIFY `(v (p + 2) cross v (p)) dot v (p+1) = (v (p+1) cross (v (p+2))) dot v (p)` (C SUBGOAL_THEN SUBST1_TAC); BY(VEC3_TAC); REWRITE_TAC[GSYM Zlzthic.azim_lt_pi_cross]; BY(ASM_REWRITE_TAC[]); (REPEAT WEAKER_STRIP_TAC); TYPIFY `?e3. &0 < e3 /\ (!t. abs t < e3 ==> dist(v p,v (p+1)) + t IN real_interval(scs_a_v39 s p (p+1),scs_b_v39 s p (p+1)))` (C SUBGOAL_THEN MP_TAC); INTRO_TAC Zlzthic.real_interval_contains_0_ball [`scs_a_v39 s p (p+1)-dist(v p,v (p+1))`;`scs_b_v39 s p (p+1) - dist(v p,v (p+1))`;`&1`]; ASM_REWRITE_TAC[arith `&0 < &1`;arith `a - d < &0 <=> a < d`;arith `&0 < b - d <=> d < b`]; REPEAT WEAKER_STRIP_TAC; TYPIFY `e` EXISTS_TAC; ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (C INTRO_TAC [`t`]); ASM_REWRITE_TAC[IN_REAL_INTERVAL]; BY(REAL_ARITH_TAC); REPEAT WEAKER_STRIP_TAC; (COMMENT "coplanar"); INTRO_TAC Zlzthic.NONPLANAR_OPEN [`(\ (t:real). (vec 0):real^3)`;`\ (t:real). (v p)`;`f( v (p+1))`;`\ (t:real). v (p+2)`;`&0`]; ASM_REWRITE_TAC[CONTINUOUS_CONST]; DISCH_THEN MP_TAC THEN ANTS_TAC; FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation] THEN REPEAT WEAKER_STRIP_TAC; CONJ2_TAC; BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); POP_ASSUM GMATCH_SIMP_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[arith `abs (&0 - t') = abs t'`] THEN REPEAT WEAKER_STRIP_TAC; INTRO_TAC Zlzthic.WNWSHJT [`v(p)`;`v (p+1)`;`v (p+2)`;`f`;`-- e'`;`e'`]; ANTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; MATCH_MP_TAC Zlzthic.deformation_subset; (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (REPEAT o GMATCH_SIMP_TAC) THEN ASM_REWRITE_TAC[]; TYPIFY `!i. ~(i=1) /\ i < 3 ==> ~collinear {vec 0,v (p+1),v(p+i)}` ENOUGH_TO_SHOW_TAC; BY(MESON_TAC[arith `p+0=p` ;arith `~(0=1) /\ 0 < 3 /\ ~(2=1) /\ 2 < 3`]); GEN_TAC THEN DISCH_TAC; FIRST_X_ASSUM MATCH_MP_TAC; BY(POP_ASSUM MP_TAC THEN ARITH_TAC); REPEAT WEAKER_STRIP_TAC; COMMENT "introduce 1834"; INTRO_TAC Iunbuig.epsilon_hept [`e`;`e'`;`e''`;`e'''`;`e3`;`e1`;`e1'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; FIRST_ASSUM_ST `i = 0 \/ i = 2 \/ i = 3` MP_TAC; FIRST_ASSUM_ST `i MOD 4 = j MOD 4` (unlist REWRITE_TAC); DISCH_TAC; INTRO_TAC (UNDISCH Ocbicby.LEMMA_1834976363) [`norm (v (p+2))`;`norm (v (p))`;`norm (v (p+1))`;`dist(v (p),v(p+1))`;`dist (v(p+2),v(p+1))`;`dist(v (p+2),v (p))`;`dist(v (p),v (p+1)) - e7`;`dist(v (p),v(p+1)) + e7`]; ANTS_TAC; ASM_REWRITE_TAC[]; (COMMENT "1834 ants"); TYPIFY `!i. &2 <= norm (v i) /\ norm (v i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; FIRST_X_ASSUM_ST `BBs_v39` kill THEN FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN EXPAND_TAC "V" THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `ball_annulus` MP_TAC; REWRITE_TAC[SUBSET;IN_IMAGE;IN_UNIV]; BY(MESON_TAC[]); ASM_REWRITE_TAC[]; FIRST_ASSUM_ST `collinear` (C INTRO_TAC [`p`;`2`;`0`]); FIRST_X_ASSUM_ST `collinear` (C INTRO_TAC [`p`;`2`;`1`]); NUM_REDUCE_TAC; REWRITE_TAC[arith `p + 0 = p`]; REPEAT WEAKER_STRIP_TAC; TYPIFY_GOAL_THEN `&0 < ups_x (norm (v (p + 2)) * norm (v (p + 2))) (norm (v p) * norm (v p)) (dist (v (p + 2),v p) * dist (v (p + 2),v p)) /\ &0 < ups_x (norm (v (p + 2)) * norm (v (p + 2))) (norm (v (p + 1)) * norm (v (p + 1))) (dist (v (p + 2),v (p + 1)) * dist (v (p + 2),v (p + 1)))` (unlist REWRITE_TAC); REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_0;DIST_SYM;arith`x pow 2 = x*x`]; BY(MESON_TAC[]); TYPIFY `!i j. &2 <= dist(v i,v j) ==> (&2 / h0) pow 2 <= xrr (norm(v i)) (norm(v (j))) (dist (v i,v j))` ((C SUBGOAL_THEN ASSUME_TAC)); REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC Ocbicby.xrr_simple_lower_bound; BY(ASM_REWRITE_TAC[arith `x <= x`]); CONJ_TAC; POP_ASSUM MATCH_MP_TAC; MATCH_MP_TAC Ocbicby.scs_lb_2; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[]; GEN_REWRITE_TAC (RAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`]; FIRST_X_ASSUM MATCH_MP_TAC; BY(NUM_REDUCE_TAC); CONJ_TAC; TYPIFY `#15.53 = sqrt(#15.53) pow 2` (C SUBGOAL_THEN SUBST1_TAC); GMATCH_SIMP_TAC SQRT_POW_2; BY(REAL_ARITH_TAC); MATCH_MP_TAC Ocbicby.xrr_simple_upper_bound; ASM_REWRITE_TAC[]; TYPIFY `&4 = sqrt(&16)` (C SUBGOAL_THEN SUBST1_TAC); REWRITE_TAC[arith `&16 = &4 pow 2`]; REWRITE_TAC[POW_2_SQRT_ABS]; BY(REAL_ARITH_TAC); GMATCH_SIMP_TAC SQRT_MONO_LT_EQ; TYPIFY_GOAL_THEN `&0 <= #15.53 /\ &0 < &16 /\ #15.53 < &16` (unlist REWRITE_TAC); BY(REAL_ARITH_TAC); CONJ_TAC; BY(REAL_ARITH_TAC); CONJ_TAC; MATCH_MP_TAC Ocbicby.scs_lb_2; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[]; GEN_REWRITE_TAC (RAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`]; FIRST_X_ASSUM MATCH_MP_TAC; BY(NUM_REDUCE_TAC); MATCH_MP_TAC REAL_LE_TRANS; TYPIFY `cstab` EXISTS_TAC; CONJ_TAC; MATCH_MP_TAC (arith `d <= scs_b_v39 s p (p+1) /\ scs_b_v39 s p (p+1) <= cstab ==> d <= cstab`); CONJ_TAC; FIRST_X_ASSUM_ST `BBs_v39` kill; (FIRST_X_ASSUM_ST `BBs_v39` MP_TAC) THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM]; BY(MESON_TAC[]); FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39]; ASM_REWRITE_TAC[arith `3 < 4`;arith `SUC i = i+1`]; BY(MESON_TAC[]); REWRITE_TAC[Sphere.cstab]; MATCH_MP_TAC REAL_LE_RSQRT; BY(REAL_ARITH_TAC); CONJ_TAC; FIRST_X_ASSUM MATCH_MP_TAC; MATCH_MP_TAC Ocbicby.scs_lb_2; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[]; BY(GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); CONJ_TAC; FIRST_X_ASSUM MATCH_MP_TAC; MATCH_MP_TAC Ocbicby.scs_lb_2; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[]; GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`]; BY(GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); CONJ_TAC; REWRITE_TAC[IN_REAL_INTERVAL]; BY(FIRST_X_ASSUM_ST `&0 < e` MP_TAC THEN REAL_ARITH_TAC); COMMENT "subset constraints"; CONJ_TAC; REWRITE_TAC[SUBSET;IN_REAL_INTERVAL;IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; TYPIFY `?t. abs t < e7 /\ x = dist(v p,v(p+1)) + t` (C SUBGOAL_THEN MP_TAC); TYPIFY `x - dist(v p,v(p+1))` EXISTS_TAC; CONJ2_TAC; BY(REAL_ARITH_TAC); BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `norm (f (v (p+1)) t) = norm (v (p+1))` (C INTRO_TAC [`t`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); REWRITE_TAC[DIST_SYM] THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`t`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); DISCH_TAC; FIRST_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`] THEN REWRITE_TAC[Oxlzlez.coplanar_delta_y;DIST_0;DIST_SYM]; RULE_ASSUM_TAC (REWRITE_RULE[arith `d + &0 = d`]); ASM_REWRITE_TAC[]; DISCH_THEN (unlist REWRITE_TAC); REWRITE_TAC[GSYM DIST_NZ]; CONJ_TAC; DISCH_TAC; FIRST_X_ASSUM_ST `coplanar` MP_TAC; BY(ASM_REWRITE_TAC[SET_RULE `{a,b,b,c} = {a,b,c}`;COPLANAR_3]); TYPIFY `~collinear {vec 0, (v p) ,f (v (p+1)) t}` (C SUBGOAL_THEN MP_TAC); BY(POP_ASSUM MP_TAC THEN MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan]); REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS]; BY(REWRITE_TAC[DIST_0;arith `x pow 2 = x*x`;DIST_SYM]); TYPIFY `!i. i < 2 ==> &0 < dist ( v (p+2),v (p+i))` ENOUGH_TO_SHOW_TAC; BY(MESON_TAC[arith `p + 0 = (p:num)`;arith `0 < 2`;arith `1 < 2`]); REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC (arith `&2 <= x ==> &0 < x`); MATCH_MP_TAC Ocbicby.scs_lb_2; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC; BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[arith `i < 2 <=> i = 0 \/ i = 1`] THEN DISCH_TAC THEN REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC); REPEAT WEAKER_STRIP_TAC; COMMENT "root"; TYPIFY `?t. abs t < e7 /\ y4' = dist(v p,v(p+1)) + t` (C SUBGOAL_THEN MP_TAC); TYPIFY `y4' - dist(v p,v(p+1))` EXISTS_TAC; CONJ2_TAC; BY(REAL_ARITH_TAC); BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REWRITE_TAC[IN_REAL_INTERVAL] THEN REAL_ARITH_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `taum` MP_TAC; ASM_REWRITE_TAC[]; REWRITE_TAC[arith `~(x < y) <=> (y <= x)`]; FIRST_X_ASSUM_ST `norm (f (v p) t) = norm (v p)` (C INTRO_TAC [`t`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); (REWRITE_TAC[DIST_SYM;arith `d + &0 = d`] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]); COMMENT "back to root, next tau"; TYPIFY `sum {i | i < 4} (\i. rho_fun (norm (v i)) * azim (vec 0) (v i) (v (i + 1)) (v (i + 4 - 1))) <= sum {i | i < 4} (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f(v(i+1)) t) (f (v (i + 4 - 1)) t))` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC Cuxvzoz.MMs_minimize_tau_fun; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[arith `3 < 4`]; FIRST_X_ASSUM MATCH_MP_TAC; BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); POP_ASSUM MP_TAC; TYPIFY `{i | i < 4} = 0..(4-1)` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG] THEN ARITH_TAC); REPEAT ( GMATCH_SIMP_TAC (GSYM Oxl_def.periodic_sum)); TYPIFY `p` EXISTS_TAC; CONJ_TAC; NUM_REDUCE_TAC; FIRST_ASSUM_ST `periodic` MP_TAC THEN REWRITE_TAC[Oxl_def.periodic]; REWRITE_TAC[arith `(i+4)+k = (i+k)+4`]; BY(DISCH_THEN (unlist REWRITE_TAC)); TYPIFY `p` EXISTS_TAC; CONJ_TAC; NUM_REDUCE_TAC; FIRST_ASSUM_ST `periodic` MP_TAC THEN REWRITE_TAC[Oxl_def.periodic]; REWRITE_TAC[arith `(i+4)+k = (i+k)+4`]; BY(DISCH_THEN (unlist REWRITE_TAC)); NUM_REDUCE_TAC; REWRITE_TAC[arith `3+p = SUC(SUC(SUC p))`;SUM_CLAUSES_NUMSEG;SUM_SING_NUMSEG;arith `p <= SUC p /\ p <= SUC (SUC p) /\ p <= SUC(SUC(SUC p))`]; REWRITE_TAC[arith `SUC i = i+1`;arith `(i + j) + (k:num) = i+(j+k)`]; NUM_REDUCE_TAC; ASM_REWRITE_TAC[]; REPLICATE_TAC 7 (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `rho_fun` MP_TAC THEN ASM_REWRITE_TAC[Appendix.rho_rho_fun]; TYPIFY `f (v(p+0)) t = v(p+0) /\ f (v (p+2)) t = v(p+2) /\ f(v (p+3)) t = v(p+3)` (C SUBGOAL_THEN MP_TAC); FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); BY(ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); REWRITE_TAC[arith `p + 0 = p`] THEN DISCH_TAC; POP_ASSUM (fun t -> ASM_TAC THEN unlist REWRITE_TAC t THEN REPEAT DISCH_TAC THEN ASSUME_TAC t); FIRST_X_ASSUM_ST `azim` MP_TAC; FIRST_X_ASSUM_ST `azim` MP_TAC THEN BURY_MP_TAC; FIRST_ASSUM_ST `azim` ((unlist REWRITE_TAC) o GSYM); FIRST_ASSUM_ST ` azim (vec 0) (v p) (f (v (p + 1)) t) (v (p + 3))` ((unlist REWRITE_TAC) o GSYM); REWRITE_TAC[arith `(a+b)+c = a + b + c`]; FIRST_X_ASSUM_ST `SUC` MP_TAC THEN REWRITE_TAC[arith `SUC p = p+1`]; DISCH_THEN (SUBST1_TAC ); REWRITE_TAC[arith `r0 * (a012+a023) + r1 * (a120) + r2 * (a230+a201) + r3 * (a302) <= r0 * (f012+a023) + r1 * (f120) + r2 * (a230+f201) + r3 *(a302) <=> r0 * a012 + r1*a120 + r2* a201 <= r0 * f012 + r1 * f120 + r2 * f201`]; MATCH_MP_TAC (arith `a - (pi+sol0) = a' /\ b - (pi+sol0) = b' ==> (a <= b ==> a' <= b')`); REWRITE_TAC[arith `(a + b+c) - (pi + sol0) = a + b + c - (pi + sol0)`]; CONJ_TAC; ONCE_REWRITE_TAC[arith `a + b + c - p = b + c + a - p`]; GMATCH_SIMP_TAC (GSYM Cuxvzoz.tau3_azim); GMATCH_SIMP_TAC Cuxvzoz.tau3_taum_nonplanar; ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`]; ASM_REWRITE_TAC[]; CONJ2_TAC; REWRITE_TAC[DIST_SYM]; BY(MESON_TAC[Terminal.taum_sym]); FIRST_X_ASSUM_ST `a <= pi` kill; FIRST_X_ASSUM_ST `a <= pi` (C INTRO_TAC [`p+1`]); BY(REWRITE_TAC[arith `(p+1)+k = p + (1 +k)`] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]); FIRST_X_ASSUM_ST `norm a = norm b` (SUBST1_TAC o GSYM); FIRST_X_ASSUM_ST `dist s + t` (SUBST1_TAC o GSYM); ONCE_REWRITE_TAC[arith `a + b + c - p = b + c + a - p`]; GMATCH_SIMP_TAC (GSYM Cuxvzoz.tau3_azim); GMATCH_SIMP_TAC Cuxvzoz.tau3_taum_nonplanar; REWRITE_TAC[DIST_SYM]; REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; ASM_REWRITE_TAC[DIST_SYM]; BY(MESON_TAC[Terminal.taum_sym]); ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`]; ASM_REWRITE_TAC[]; BY(FIRST_X_ASSUM_ST `azim (vec 0) (f (v (p+1)) t) (v (p + 2)) (v (p)) < pi` MP_TAC THEN REAL_ARITH_TAC) ]);; (* }}} *)
let JOTSWIX = 
prove_by_refinement( `main_nonlinear_terminal_v11 ==> (!s FF v p. IMAGE (\i. (v i,v (SUC i))) (:num) = FF /\ is_scs_v39 s /\ scs_k_v39 s = 4 /\ MMs_v39 s v /\ scs_basic_v39 s /\ scs_generic v /\ scs_a_v39 s p (p+1) < cstab /\ (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4 * h0 < scs_b_v39 s i j) /\ (!i. ~(i MOD 4 = (p+2) MOD 4) ==> interior_angle1 (vec 0) FF (v i) < pi) /\ (xrr (norm (v (p+3))) (norm (v (p+1))) (dist(v (p+3),v(p+1))) <= #15.53) ==> (dist(v p,v(p+1)) < cstab \/ dist(v p,v(p+3)) < cstab))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC (arith `~((cstab <= d) /\ (cstab <= d')) ==> (d < cstab \/ d' < cstab)`); REPEAT WEAKER_STRIP_TAC; TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs]); TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Appendix.BBprime2_v39]); TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Appendix.BBprime_v39]); INTRO_TAC Appendix.BBs_v39 [`s`;`v`]; ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV;arith `~(4 <= 3)`]; REPEAT WEAKER_STRIP_TAC; TYPED_ABBREV_TAC `V = IMAGE v (:num)`; TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; BY(ASM_REWRITE_TAC[]); TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; EXPAND_TAC "V";
REWRITE_TAC[IN_IMAGE;IN_UNIV]; BY(MESON_TAC[]); INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; ASM_REWRITE_TAC[]; DISCH_TAC; TYPIFY `!i. interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i+1)) (v (i+3))` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; EXPAND_TAC "FF"; GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM)); TYPIFY `s` EXISTS_TAC; BY(ASM_REWRITE_TAC[IN;arith `4 - 1 = 3`;arith `3 < 4`;arith `SUC i = i+1`]); INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`]; ASM_REWRITE_TAC[LET_THM;IN;arith `4-1 = 3`;arith `SUC i = i+1`]; DISCH_TAC; TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); BY(ASM_REWRITE_TAC[arith `~(0=4)`]); TYPIFY `v 4 = v 0 /\ v 5 = v 1 /\ v 6 = v 2 /\ v 7 = v 3 /\ v 8 = v 4` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); BY(REWRITE_TAC[Terminal.MOD_4_EXPLICIT;arith `7 = 1*4 + 3`;arith `8 = 2*4 + 0`;MOD_MULT_ADD]); TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN ASM_REWRITE_TAC[Appendix.scs_generic]); TYPIFY `v (p+4) = v p /\ v (p+5) = v (p+1) /\ v (p+6) = v (p+2) /\ v (p+7) = v (p+3) /\ v (p+8) = v (p)` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `MOD` ((unlist ONCE_REWRITE_TAC) o GSYM); BY(REWRITE_TAC[arith `p+4 = 1*4 + p /\ p+5 = 1*4+(p+1) /\ p+6=1*4+(p+2) /\ p+7 = 1*4 + (p+3) /\ p+8 = 2*4 + p`;MOD_MULT_ADD]); INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p+3`;`2`;`3`]; REWRITE_TAC[arith `SUC (x+k) = (x+k)+1`;arith `((p:num)+i)+j = p+(i+j)`]; NUM_REDUCE_TAC; ASM_REWRITE_TAC[LET_THM]; DISCH_TAC; INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p+1`;`2`;`3`]; REWRITE_TAC[arith `SUC (x+k) = (x+k)+1`;arith `((p:num)+i)+j = p+(i+j)`]; NUM_REDUCE_TAC; ASM_REWRITE_TAC[LET_THM]; DISCH_TAC; COMMENT "collinearity"; TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); REPEAT GEN_TAC THEN DISCH_TAC; MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; GEXISTL_TAC [`V`;`E`;`FF`]; BY(ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]); TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; ASM_REWRITE_TAC[arith `~(4 = 0)`]; DISCH_TAC; TYPIFY `azim (vec 0) (v p) (v (p+1)) (v (p+3)) < pi` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); FIRST_X_ASSUM MATCH_MP_TAC; GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[arith`p = p+0`]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(NUM_REDUCE_TAC); TYPIFY `~coplanar {vec 0,v p,v (p+1),v (p+3)}` (C SUBGOAL_THEN ASSUME_TAC); REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; MATCH_MP_TAC (arith `&0 < x /\ x < pi ==> ~ ((x = &0) \/ (x = pi))`); BY(ASM_REWRITE_TAC[]); TYPIFY `!i a b. a < 4 /\ b < 4 /\ ~(a = b) ==> ~collinear {vec 0,v(i+a),v(i+b)}` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[]; FIRST_X_ASSUM_ST `v (i MOD 4) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); REPEAT (FIRST_X_ASSUM MATCH_MP_TAC); nCONJ_TAC 2; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; NUM_REDUCE_TAC; BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION;MOD_LT;arith `~(4=0)`]); ASM_REWRITE_TAC[]; BY(MESON_TAC[DIVISION;arith `~(4=0)`]); COMMENT "introduce deformation"; INTRO_TAC Cuxvzoz.deform_simplex_edge_exists [`V`;`(\ (t:real). &0)`;`(\(t:real). -- abs t)`;`v (p +3)`;`v p`;`v (p +1)`;`&1`]; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC; ANTS_TAC; REWRITE_TAC[arith `&0 < &1`]; SUBCONJ_TAC; ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d}={a,c,d,b}`]; BY(ASM_REWRITE_TAC[]); DISCH_TAC; CONJ_TAC; INTRO_TAC Planarity.cross_dot_fully_surrounded_fan [`(vec 0):real^3`;`v p`;`v (p+3)`;`v(p+1)`]; ASM_REWRITE_TAC[]; ANTS_TAC; INTRO_TAC Planarity.notcoplanar_imp_notcollinear_fan [`(vec 0):real^3`;`v p`;`v (p+1)`;`v(p+3)`]; BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); MATCH_MP_TAC (arith `x = y ==> (&0 < x ==> y > &0)`); BY(VEC3_TAC); REPEAT ( GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL]; (REWRITE_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_ID;arith `-- abs(&0) = &0`]); REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC REAL_CONTINUOUS_NEG; BY(REWRITE_TAC[Cuxvzoz.real_continuous_abs]); REPEAT WEAKER_STRIP_TAC; COMMENT "A"; TYPIFY `!i. dist (v i,v (i+1)) <= cstab` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC REAL_LE_TRANS; TYPIFY `scs_b_v39 s i (i+1)` EXISTS_TAC; CONJ_TAC; BY(ASM_MESON_TAC[]); FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `scs_b_v39 s i j <= cstab` (C INTRO_TAC [`i`]); BY(ASM_REWRITE_TAC[arith `3 < 4`;arith `SUC i = i+1`]); TYPIFY `(!i t. abs t < e' ==> norm (f (v i) t) = norm (v i))` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; TYPIFY `v i = v p` ASM_CASES_TAC; ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); BY(ASM_REWRITE_TAC[] THEN MESON_TAC[]); FIRST_X_ASSUM GMATCH_SIMP_TAC; BY(ASM_REWRITE_TAC[]); TYPIFY `!i. 0 < i /\ i < 4 ==> ~(v (p + i) = v p)` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC; ASM_REWRITE_TAC[]; GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; NUM_REDUCE_TAC; BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION;MOD_LT;arith `~(4=0)`;arith `0 < i ==> ~(i=0)`]); TYPIFY `!i j (k:num). v i = v j ==> v (i+k) = v (j+k)` (C SUBGOAL_THEN ASSUME_TAC); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; ONCE_REWRITE_TAC[arith `(i:num) + k = k + i`]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(ASM_REWRITE_TAC[arith `~(4 = 0)`]); TYPIFY `!t. azim (vec 0) (f (v (p+2)) t) (f (v (p+3)) t) (f (v (p+1)) t) = azim(vec 0) (v(p+2)) (v(p+3)) (v(p+1))` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); TYPIFY `!i. azim (vec 0) (v i) (v (i+1)) (v (i+3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); MATCH_MP_TAC Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI; BY(ASM_REWRITE_TAC[]); TYPIFY `(!i. ?e0. &0 < e0 /\ (azim (vec 0) (v i) (v (i + 1)) (v (i + 3)) = pi ==> (!t. abs t < e0 ==> azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + 3)) t) <= pi)))` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; TYPIFY `v i = v (p+2)` ASM_CASES_TAC; FIRST_ASSUM (fun t -> FIRST_X_ASSUM (ASSUME_TAC o (C MATCH_MP t))); TYPIFY `&1` EXISTS_TAC; ASM_REWRITE_TAC[arith `&0 < &1`;arith `(p+2)+k = p + (2+k)`]; NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC); TYPIFY `azim (vec 0) (v i) (v (i + 1)) (v (i + 3)) < pi` ENOUGH_TO_SHOW_TAC; BY(MESON_TAC[arith `x < pi ==> ~(x = pi)`;arith `&0 < &1`]); BY(ASM_MESON_TAC[]); (COMMENT "deformation in BBs"); INTRO_TAC Cuxvzoz.deformation_BBs_ALT [`s`;`4`;`f`;`v`;`e'`]; ANTS_TAC; NUM_REDUCE_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC ab4_assumption_reduction2; GEXISTL_TAC [`p`;`e'`]; ASM_REWRITE_TAC[]; CONJ_TAC; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`i`;`j`]); BY(ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; TYPIFY `e'` EXISTS_TAC; ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; (FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`])); TYPIFY `dist (v p,v (p+1)) <= scs_b_v39 s p (p+1)` ENOUGH_TO_SHOW_TAC; BY(POP_ASSUM (unlist REWRITE_TAC) THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); BY(ASM_REWRITE_TAC[]); CONJ_TAC; REPEAT WEAKER_STRIP_TAC; (FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`])); BY(ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); MATCH_MP_TAC REAL_LTE_TRANS; TYPIFY `cstab` EXISTS_TAC; BY(ASM_REWRITE_TAC[]); (REPEAT WEAKER_STRIP_TAC); (COMMENT "azim sums"); INTRO_TAC deform_azim_sum [`v (p+3)`;`v p`;`v (p+1)`;`v(p+2)`;`f`;`e'`]; ANTS_TAC; REPEAT (FIRST_X_ASSUM_ST `c = a + b` MP_TAC) THEN ASM_REWRITE_TAC[]; REPLICATE_TAC 3 DISCH_TAC; CONJ_TAC; MATCH_MP_TAC Zlzthic.deformation_subset; (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `~collinear {vec 0, v (p + 3), v (p+0)} /\ ~collinear {vec 0, v (p + 3), v (p + 1)} /\ ~collinear {vec 0, v (p + 3), v (p + 2)}` (C SUBGOAL_THEN MP_TAC); BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN (unlist REWRITE_TAC); nCONJ_TAC 2; BY(ASM_REWRITE_TAC[]); FIRST_X_ASSUM (SUBST1_TAC) THEN REWRITE_TAC[]; REPLICATE_TAC 4 (FIRST_X_ASSUM kill); ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `&0 < azim (vec 0) (v (p + 3)) (v p) (v (p + 2)) /\ azim (vec 0) (v (p + 3)) (v p) (v (p + 2)) < pi` (unlist REWRITE_TAC); FIRST_X_ASSUM_ST `&0 < azim a b c d` (C INTRO_TAC [`p+3`]); TYPIFY `azim (vec 0) (v (p+3)) (v p) (v (p+2)) = azim (vec 0) (v (p + 3)) (v ((p + 3) + 1)) (v ((p + 3) + 3))` (C SUBGOAL_THEN ASSUME_TAC); BY(REWRITE_TAC[arith `((p:num) + i) + j = p + i+j`] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; DISCH_THEN (unlist REWRITE_TAC); FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); ASM_REWRITE_TAC[]; FIRST_X_ASSUM MATCH_MP_TAC; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(NUM_REDUCE_TAC); DISJ2_TAC; CONJ_TAC; GEN_TAC; FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); ASM_REWRITE_TAC[]; BY(REPEAT CONJ_TAC THEN GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`] THEN GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); REWRITE_TAC[Zlzthic.azim_lt_pi_cross]; TYPIFY `(v (p + 3) cross v p) dot v (p + 1) = (v (p) cross (v (p+1))) dot v (p + 3)` (C SUBGOAL_THEN SUBST1_TAC); BY(VEC3_TAC); REWRITE_TAC[GSYM Zlzthic.azim_lt_pi_cross]; BY(ASM_REWRITE_TAC[]); (REPEAT WEAKER_STRIP_TAC); COMMENT "second azim sum"; INTRO_TAC deform_azim_sum [`v (p+1)`;`v (p+2)`;`v (p+3)`;`v(p)`;`f`;`e'`]; ANTS_TAC; REPEAT (FIRST_X_ASSUM_ST `c = a + b` MP_TAC) THEN ASM_REWRITE_TAC[]; REPLICATE_TAC 3 DISCH_TAC; CONJ_TAC; MATCH_MP_TAC Zlzthic.deformation_subset; (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); TYPIFY `~collinear {vec 0, v (p + 1), v (p + 2)} /\ ~collinear {vec 0, v (p + 1), v (p + 3)} /\ ~collinear {vec 0, v (p + 1), v (p + 0)}` (C SUBGOAL_THEN MP_TAC); BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN (unlist REWRITE_TAC); nCONJ_TAC 2; BY(ASM_REWRITE_TAC[]); FIRST_X_ASSUM (SUBST1_TAC) THEN REWRITE_TAC[]; REPLICATE_TAC 4 (FIRST_X_ASSUM kill); ASM_REWRITE_TAC[]; TYPIFY_GOAL_THEN `&0 < azim (vec 0) (v (p + 1)) (v (p + 2)) (v p) /\ azim (vec 0) (v (p + 1)) (v (p + 2)) (v p) < pi` (unlist REWRITE_TAC); FIRST_X_ASSUM_ST `&0 < azim a b c d` (C INTRO_TAC [`p+1`]); TYPIFY `azim (vec 0) (v (p+1)) (v (p+2)) (v (p)) = azim (vec 0) (v (p + 1)) (v ((p + 1) + 1)) (v ((p + 1) + 3))` (C SUBGOAL_THEN ASSUME_TAC); BY(REWRITE_TAC[arith `((p:num) + i) + j = p + i+j`] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; DISCH_THEN (unlist REWRITE_TAC); FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); ASM_REWRITE_TAC[]; FIRST_X_ASSUM MATCH_MP_TAC; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; BY(NUM_REDUCE_TAC); DISJ1_TAC; CONJ_TAC; GEN_TAC; FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); ASM_REWRITE_TAC[]; BY(REPEAT CONJ_TAC THEN GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`] THEN GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); REWRITE_TAC[Zlzthic.azim_lt_pi_cross]; TYPIFY `(v (p + 1) cross v (p+3)) dot v (p) = (v (p) cross (v (p+1))) dot v (p + 3)` (C SUBGOAL_THEN SUBST1_TAC); BY(VEC3_TAC); REWRITE_TAC[GSYM Zlzthic.azim_lt_pi_cross]; BY(ASM_REWRITE_TAC[]); (REPEAT WEAKER_STRIP_TAC); TYPIFY `?e3. &0 < e3 /\ (!t. abs t < e3 /\ t < &0 ==> dist(v p,v (p+1)) + t IN real_interval(scs_a_v39 s p (p+1),scs_b_v39 s p (p+1)))` (C SUBGOAL_THEN MP_TAC); TYPIFY `dist(v p,v(p+1)) - scs_a_v39 s p (p+1)` EXISTS_TAC; ASM_REWRITE_TAC[arith `&0 < &1`;arith `a - d < &0 <=> a < d`;arith `&0 < b - d <=> d < b`]; SUBCONJ_TAC; MATCH_MP_TAC REAL_LTE_TRANS; TYPIFY `cstab` EXISTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[IN_REAL_INTERVAL]; CONJ_TAC; BY(REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); MATCH_MP_TAC (arith `t < &0 /\ d <= b ==> d + t < b`); BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; COMMENT "coplanar"; INTRO_TAC Zlzthic.NONPLANAR_OPEN [`(\ (t:real). (vec 0):real^3)`;`f (v p)`;`\ (t:real). v (p+1)`;`\ (t:real). v (p+3)`;`&0`]; ASM_REWRITE_TAC[CONTINUOUS_CONST]; DISCH_THEN MP_TAC THEN ANTS_TAC; FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation] THEN REPEAT WEAKER_STRIP_TAC; CONJ2_TAC; BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); POP_ASSUM GMATCH_SIMP_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[arith `abs (&0 - t') = abs t'`] THEN REPEAT WEAKER_STRIP_TAC; INTRO_TAC Zlzthic.WNWSHJT [`v(p+3)`;`v p`;`v (p+1)`;`f`;`-- e'`;`e'`]; ANTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; MATCH_MP_TAC Zlzthic.deformation_subset; (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (REPEAT o GMATCH_SIMP_TAC) THEN ASM_REWRITE_TAC[]; TYPIFY `!i. ~(i=0) /\ i < 4 ==> ~collinear {vec 0,v (p+0),v(p+i)}` ENOUGH_TO_SHOW_TAC; BY(MESON_TAC[arith `p+0=p` ;arith `~(1=0) /\ 1 < 4 /\ ~(3=0) /\ 3 < 4`]); GEN_TAC THEN DISCH_TAC; FIRST_X_ASSUM MATCH_MP_TAC; BY(ASM_REWRITE_TAC[arith `0 < 4`]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Iunbuig.epsilon_hept [`e`;`e'`;`e''`;`e'''`;`e3`;`e1`;`e1'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; FIRST_ASSUM_ST `!i. 0 < i /\ i < 4 ==> ~(v (p + i) = v p)` MP_TAC; FIRST_ASSUM_ST `i MOD 4 = j MOD 4` (unlist REWRITE_TAC); DISCH_TAC; COMMENT "introduce 684"; INTRO_TAC (UNDISCH Ocbicby.LEMMA_6843920790) [`norm (v (p+3))`;`norm (v p)`;`norm (v (p+1))`;`dist(v p,v(p+1))`;`dist (v(p+1),v(p+3))`;`dist(v p,v (p+3))`]; ANTS_TAC; ASM_REWRITE_TAC[]; (COMMENT "684 ants"); TYPIFY `!i. &2 <= norm (v i) /\ norm (v i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; FIRST_X_ASSUM_ST `BBs_v39` kill THEN FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN EXPAND_TAC "V" THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `ball_annulus` MP_TAC; REWRITE_TAC[SUBSET;IN_IMAGE;IN_UNIV]; BY(MESON_TAC[]); ASM_REWRITE_TAC[]; REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; FIRST_X_ASSUM_ST `coplanar` kill; FIRST_X_ASSUM_ST `coplanar` MP_TAC; ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d}= {a,d,b,c}`]; BY(REWRITE_TAC[Oxlzlez.coplanar_delta_y;DIST_0;DIST_SYM]); ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]; TYPIFY `!i j. &2 <= dist(v i,v j) /\ dist(v i,v j) <= cstab ==> xrr (norm (v i)) (norm (v j)) (dist (v i,v j)) <= #15.53` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; TYPIFY `#15.53 = sqrt(#15.53) pow 2` (C SUBGOAL_THEN SUBST1_TAC); GMATCH_SIMP_TAC SQRT_POW_2; BY(REAL_ARITH_TAC); MATCH_MP_TAC Ocbicby.xrr_simple_upper_bound; ASM_REWRITE_TAC[]; TYPIFY `&4 = sqrt(&16)` (C SUBGOAL_THEN SUBST1_TAC); REWRITE_TAC[arith `&16 = &4 pow 2`]; REWRITE_TAC[POW_2_SQRT_ABS]; BY(REAL_ARITH_TAC); GMATCH_SIMP_TAC SQRT_MONO_LT_EQ; TYPIFY_GOAL_THEN `&0 <= #15.53 /\ &0 <= &16 /\ #15.53 < &16` (unlist REWRITE_TAC); BY(REAL_ARITH_TAC); MATCH_MP_TAC REAL_LE_TRANS; TYPIFY `cstab` EXISTS_TAC; ASM_REWRITE_TAC[]; REWRITE_TAC[Sphere.cstab]; MATCH_MP_TAC REAL_LE_RSQRT; BY(REAL_ARITH_TAC); FIRST_X_ASSUM ( GMATCH_SIMP_TAC); TYPIFY ` &2 <= dist(v p,v(p+1)) /\ dist(v p,v (p+3)) <= cstab /\ cstab <= dist(v p,v(p+3)) /\ dist(v p,v(p+1)) <= cstab /\ cstab <= dist (v (p+1),v(p+3))` ENOUGH_TO_SHOW_TAC; BY(REWRITE_TAC[Sphere.cstab;DIST_SYM] THEN REAL_ARITH_TAC); CONJ_TAC; MATCH_MP_TAC Ocbicby.scs_lb_2; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[]; ONCE_REWRITE_TAC[EQ_SYM_EQ]; FIRST_X_ASSUM MATCH_MP_TAC; BY(NUM_REDUCE_TAC); ASM_REWRITE_TAC[]; CONJ_TAC; MATCH_MP_TAC REAL_LE_TRANS; TYPIFY `scs_b_v39 s (p+3) (SUC (p+3))` EXISTS_TAC; CONJ2_TAC; FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MATCH_MP_TAC; BY(ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC); ONCE_REWRITE_TAC[DIST_SYM]; TYPIFY `v p = v (SUC (p+3))` ENOUGH_TO_SHOW_TAC; DISCH_THEN SUBST1_TAC; FIRST_X_ASSUM_ST `d <= scs_b_v39 s i j` MP_TAC; BY(MESON_TAC[]); BY(ASM_REWRITE_TAC[arith `SUC (p+3) = p+4`;Oxl_2012.MOD_ADD_CANCEL]); MATCH_MP_TAC (arith `c < d ==> c <= d`); FIRST_X_ASSUM_ST `cstab < d` (C INTRO_TAC [`p+1`;`p+3`]); ANTS_TAC; REWRITE_TAC[arith `p+3 = SUC(SUC (p+1))`]; MATCH_MP_TAC Tfitskc.SCS_DIAG_2; BY(NUM_REDUCE_TAC); BY(DISCH_THEN (unlist REWRITE_TAC)); REPEAT WEAKER_STRIP_TAC; TYPIFY `?e4. &0 < e4 /\ (!t. abs t < e4 ==> dist(v p,v (p+1)) + t IN real_interval(a,b))` (C SUBGOAL_THEN MP_TAC); INTRO_TAC Zlzthic.real_interval_contains_0_ball [`a-dist(v p,v (p+1))`;`b - dist(v p,v (p+1))`;`&1`]; ASM_REWRITE_TAC[arith `&0 < &1`;arith `a - d < &0 <=> a < d`;arith `&0 < b - d <=> d < b`]; ANTS_TAC; BY(FIRST_X_ASSUM_ST `dist s IN real_interval(a,b)` MP_TAC THEN REWRITE_TAC[IN_REAL_INTERVAL]); REPEAT WEAKER_STRIP_TAC; TYPIFY `e''''` EXISTS_TAC; ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (C INTRO_TAC [`t`]); ASM_REWRITE_TAC[IN_REAL_INTERVAL]; BY(REAL_ARITH_TAC); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Cuxvzoz.epsilon_pair [`e4`;`e7`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; TYPIFY `?t. abs t < e'''' /\ t < &0` (C SUBGOAL_THEN MP_TAC); TYPIFY `-- e'''' / &2` EXISTS_TAC; BY(REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); REPEAT WEAKER_STRIP_TAC; REPLICATE_TAC 2 (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; REPLICATE_TAC 7 (FIRST_X_ASSUM_ST `abs t < e ==> a` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (C INTRO_TAC [`dist(v p,v(p+1)) + t`;`dist(v p,v (p+1))`]); ANTS_TAC; ASM_REWRITE_TAC[]; BY(FIRST_X_ASSUM_ST `t < &0` MP_TAC THEN REAL_ARITH_TAC); REWRITE_TAC[arith `~(x < y) <=> y <= x`]; FIRST_X_ASSUM_ST `norm (f (v p) t) = norm (v p)` (C INTRO_TAC [`t`]); ANTS_TAC; BY(ASM_REWRITE_TAC[]); TYPIFY `!d. t < &0 ==> d + -- abs t = d + t` (C SUBGOAL_THEN MP_TAC); BY(REAL_ARITH_TAC); ASM_REWRITE_TAC[]; DISCH_THEN (unlist REWRITE_TAC); (REWRITE_TAC[DIST_SYM;arith `d + &0 = d`] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]); (COMMENT "back to root, next tau"); TYPIFY `sum {i | i < 4} (\i. rho_fun (norm (v i)) * azim (vec 0) (v i) (v (i + 1)) (v (i + 4 - 1))) <= sum {i | i < 4} (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f(v(i+1)) t) (f (v (i + 4 - 1)) t))` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC Cuxvzoz.MMs_minimize_tau_fun; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[arith `3 < 4`]; FIRST_X_ASSUM MATCH_MP_TAC; BY(ASM_REWRITE_TAC[]); POP_ASSUM MP_TAC; TYPIFY `{i | i < 4} = 0..(4-1)` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG] THEN ARITH_TAC); REPEAT ( GMATCH_SIMP_TAC (GSYM Oxl_def.periodic_sum)); TYPIFY `p` EXISTS_TAC; CONJ_TAC; NUM_REDUCE_TAC; FIRST_ASSUM_ST `periodic` MP_TAC THEN REWRITE_TAC[Oxl_def.periodic]; REWRITE_TAC[arith `(i+4)+k = (i+k)+4`]; BY(DISCH_THEN (unlist REWRITE_TAC)); TYPIFY `p` EXISTS_TAC; CONJ_TAC; NUM_REDUCE_TAC; FIRST_ASSUM_ST `periodic` MP_TAC THEN REWRITE_TAC[Oxl_def.periodic]; REWRITE_TAC[arith `(i+4)+k = (i+k)+4`]; BY(DISCH_THEN (unlist REWRITE_TAC)); NUM_REDUCE_TAC; REWRITE_TAC[arith `3+p = SUC(SUC(SUC p))`;SUM_CLAUSES_NUMSEG;SUM_SING_NUMSEG;arith `p <= SUC p /\ p <= SUC (SUC p) /\ p <= SUC(SUC(SUC p))`]; REWRITE_TAC[arith `SUC i = i+1`;arith `(i + j) + (k:num) = i+(j+k)`]; NUM_REDUCE_TAC; ASM_REWRITE_TAC[]; REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `rho_fun` MP_TAC THEN ASM_REWRITE_TAC[Appendix.rho_rho_fun]; TYPIFY `f (v(p+1)) t = v(p+1) /\ f (v (p+2)) t = v(p+2) /\ f(v (p+3)) t = v(p+3)` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); BY(ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); POP_ASSUM (fun t -> ASM_TAC THEN unlist REWRITE_TAC t THEN REPEAT DISCH_TAC THEN ASSUME_TAC t); FIRST_X_ASSUM_ST `azim` MP_TAC; FIRST_X_ASSUM_ST `azim` MP_TAC THEN BURY_MP_TAC; FIRST_ASSUM_ST `azim` ((unlist REWRITE_TAC) o GSYM); FIRST_ASSUM_ST `azim (vec 0) (v (p + 3)) (f (v p) t) (v (p + 2))` ((unlist REWRITE_TAC) o GSYM); REWRITE_TAC[arith `(a+b)+c = a + b + c`]; REWRITE_TAC[arith `r0 * (a013) + r1 * (a123 + a130) + r2 * a231 + r3 * (a301+a312) <= r0 * (f013) + r1 * (a123 + f130) + r2 * a231 + r3 *(f301 +a312) <=> r0 * a013 + r1*a130 + r3* a301 <= r0 * f013 + r1 * f130 + r3 * f301`]; MATCH_MP_TAC (arith `a - (pi+sol0) = a' /\ b - (pi+sol0) = b' ==> (a <= b ==> a' <= b')`); REWRITE_TAC[arith `(a + b+c) - (pi + sol0) = a + b + c - (pi + sol0)`]; CONJ_TAC; GMATCH_SIMP_TAC (GSYM Cuxvzoz.tau3_azim); GMATCH_SIMP_TAC Cuxvzoz.tau3_taum_nonplanar; ASM_REWRITE_TAC[]; REWRITE_TAC[DIST_SYM]; BY(MESON_TAC[Terminal.taum_sym]); FIRST_X_ASSUM_ST `norm a = norm b` (SUBST1_TAC o GSYM); FIRST_X_ASSUM_ST `dist s + t` (SUBST1_TAC o GSYM); GMATCH_SIMP_TAC (GSYM Cuxvzoz.tau3_azim); GMATCH_SIMP_TAC Cuxvzoz.tau3_taum_nonplanar; REWRITE_TAC[DIST_SYM]; REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; ASM_REWRITE_TAC[DIST_SYM]; BY(MESON_TAC[Terminal.taum_sym]); ASM_REWRITE_TAC[]; CONJ_TAC; FIRST_X_ASSUM MATCH_MP_TAC; BY(ASM_REWRITE_TAC[]); BY(FIRST_X_ASSUM_ST `azim (vec 0) (f (v p) t) (v (p + 1)) (v (p + 3)) < pi` MP_TAC THEN REAL_ARITH_TAC) ]);; (* }}} *)
let LEMMA_PWE1 = prove_by_refinement(
(* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> (!s v p.
    is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ 
    (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\
    (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/
       (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\
      scs_generic v /\
    ~scs_is_str s v (p+1) /\ ~scs_is_str s v (p+3) /\
    scs_is_str s v p /\ norm (v p) = &2 /\
    scs_a_v39 s p (p+1) = &2 /\
    scs_a_v39 s (p+3) (p) = &2 /\
    dist(v (p+1),v(p+2)) <= &2 * h0 ==>
    pi / &2 < dihV (vec 0) (v (p+1)) (v (p+2)) (v p))`,
  (* {{{ proof *)
  [
  REPEAT WEAKER_STRIP_TAC;
  REWRITE_TAC[arith `x < y <=> ~(y <= x)`] THEN DISCH_TAC;
  REPEAT WEAKER_STRIP_TAC;
  TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC);
    BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs;IN]);
  TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC);
    BY(ASM_MESON_TAC[Appendix.BBprime2_v39]);
  TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC);
    BY(ASM_MESON_TAC[Appendix.BBprime_v39]);
  INTRO_TAC Appendix.BBs_v39 [`s`;`v`];
  ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV;arith `~(4 <= 3)`];
  REPEAT WEAKER_STRIP_TAC;
  TYPED_ABBREV_TAC `V = IMAGE v (:num)`;
  TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`;
  TYPED_ABBREV_TAC `FF = IMAGE (\i. (v i,v (SUC i))) (:num)`;
  TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC);
    MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO;
    BY(ASM_REWRITE_TAC[]);
  TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC);
    REPEAT WEAKER_STRIP_TAC;
    EXPAND_TAC "V";
REWRITE_TAC[IN_IMAGE;IN_UNIV]; BY(MESON_TAC[]); INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; ASM_REWRITE_TAC[]; DISCH_TAC; TYPIFY `!i. interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i+1)) (v (i+3))` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; EXPAND_TAC "FF"; GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM)); TYPIFY `s` EXISTS_TAC; BY(ASM_REWRITE_TAC[IN;arith `4 - 1 = 3`;arith `3 < 4`;arith `SUC i = i+1`]); INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`]; ASM_REWRITE_TAC[LET_THM;IN;arith `4-1 = 3`;arith `SUC i = i+1`]; DISCH_TAC; TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); BY(ASM_REWRITE_TAC[arith `~(0=4)`]); TYPIFY `v 4 = v 0 /\ v 5 = v 1 /\ v 6 = v 2 /\ v 7 = v 3 /\ v 8 = v 4` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); BY(REWRITE_TAC[Terminal.MOD_4_EXPLICIT;arith `7 = 1*4 + 3`;arith `8 = 2*4 + 0`;MOD_MULT_ADD]); TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN ASM_REWRITE_TAC[Appendix.scs_generic]); TYPIFY `v (p+4) = v p /\ v (p+5) = v (p+1) /\ v (p+6) = v (p+2) /\ v (p+7) = v (p+3) /\ v (p+8) = v (p)` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `MOD` ((unlist ONCE_REWRITE_TAC) o GSYM); BY(REWRITE_TAC[arith `p+4 = 1*4 + p /\ p+5 = 1*4+(p+1) /\ p+6=1*4+(p+2) /\ p+7 = 1*4 + (p+3) /\ p+8 = 2*4 + p`;MOD_MULT_ADD]); TYPIFY `!i. &2 <= norm (v i) /\ norm (v i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; BY(ASM_REWRITE_TAC[]); TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> &2 <= dist(v (p + i),v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC Ocbicby.scs_lb_2; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; (NUM_REDUCE_TAC); REPEAT (GMATCH_SIMP_TAC MOD_LT); BY(ASM_REWRITE_TAC[]); TYPIFY `scs_b_v39 s (p+2) ((p+2)+1) <= cstab /\ scs_b_v39 s p (p+1) = &2 * h0 /\ scs_b_v39 s (p+3) ((p+3)+1) = &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); CONJ2_TAC; TYPIFY `~(&2 = &2 * h0)` (C SUBGOAL_THEN ASSUME_TAC); BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); TYPIFY `scs_a_v39 s (p+3) p = scs_a_v39 s (p+3) ((p+3)+1)` ENOUGH_TO_SHOW_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[arith `((p+3)+1) = p+4`]; FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; BY(ASM_MESON_TAC[Appendix.periodic2;Oxl_def.periodic]); FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `x <= cstab` (C INTRO_TAC [`p+2`]) THEN ASM_REWRITE_TAC[arith `3 < 4`]; BY(REWRITE_TAC[arith `SUC (p+2) = (p+2)+1`]); FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[arith `((p:num) + i ) + j = p + (i+j)`] THEN NUM_REDUCE_TAC; DISCH_TAC; TYPIFY `dist(v (p+2),v(p+3)) <= cstab /\ dist(v p,v(p+1)) <= &2 * h0 /\ dist(v(p+3),v(p+4)) <= &2 * h0` (C SUBGOAL_THEN MP_TAC); FIRST_X_ASSUM MP_TAC; FIRST_X_ASSUM_ST `scs_b_v39` MP_TAC; BY(MESON_TAC[REAL_LE_TRANS]); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; COMMENT "collinear"; TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); REPEAT GEN_TAC THEN DISCH_TAC; MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; GEXISTL_TAC [`V`;`E`;`FF`]; BY(ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]); TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPLICATE_TAC 20 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; ASM_REWRITE_TAC[arith `~(4 = 0)`]; DISCH_TAC; TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i=j) ==> ~(v (p +i) = v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; (NUM_REDUCE_TAC); REPEAT (GMATCH_SIMP_TAC MOD_LT); BY(ASM_REWRITE_TAC[]); TYPIFY `!i. 0 < i /\ i < 4 ==> ~(v (p+i) = v p)` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[arith `p+0 = p`;arith `0< 4`;arith `0 < i ==> ~(i=0)`]); TYPIFY `#3.3 <= dist(v (p+2),v p)` ASM_CASES_TAC; COMMENT "long diag"; INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "6184614449") [`norm (v (p+1))`;`norm(v (p+2))`;`norm(v p)`;`dist(v(p+2),v p)`;`dist(v(p+1),v p)`;`dist(v(p+1),v(p+2))`]; FIRST_X_ASSUM_ST `norm x = &2` kill; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; ASM_REWRITE_TAC[]; DISCH_THEN MP_TAC THEN ANTS_TAC; CONJ_TAC; INTRO_TAC DIST_TRIANGLE [`v (p+2)`;`(vec 0):real^3`;`v (p)`]; REWRITE_TAC[DIST_0]; MATCH_MP_TAC (arith `x <= &2 * h0 /\ y <= &2 * h0 ==> (d <= x + y ==> d <= &4 * h0)`); BY(ASM_REWRITE_TAC[]); nCONJ_TAC 1; BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; TYPIFY `v p = v (p+0)` (C SUBGOAL_THEN SUBST1_TAC); ONCE_REWRITE_TAC[arith `p+0=p`]; BY(REWRITE_TAC[]); BY(CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); DISCH_TAC; FIRST_X_ASSUM_ST `dihV` MP_TAC; REWRITE_TAC[arith `~(x <= y) <=> y < x`]; GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y); ASM_REWRITE_TAC[DIST_0]; CONJ_TAC; BY(CONJ_TAC THEN (REPEAT (FIRST_X_ASSUM MATCH_MP_TAC)) THEN NUM_REDUCE_TAC); MATCH_MP_TAC Ocbicby.delta4_y_imp_obtuse; CONJ_TAC; BY(ASM_MESON_TAC[arith `&2 <= x==> &0 < x`]); CONJ_TAC; BY(REWRITE_TAC[REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos]); BY(ASM_REWRITE_TAC[]); TYPIFY `!i. ~scs_is_str s v i ==> ~coplanar {vec 0, v i, v(i+1), v(i+3)}` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC THEN ASM_REWRITE_TAC[Appendix.scs_is_str;arith `SUC i = i+1`;GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; NUM_REDUCE_TAC; DISCH_THEN (unlist REWRITE_TAC); MATCH_MP_TAC (arith `&0 < a ==> ~(a = &0)`); INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`;`i`]; BY(ASM_REWRITE_TAC[LET_THM;IN;arith `SUC i = i+1`;arith `4 - 1 = 3`]); FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC; COMMENT "short diag"; INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p`;`2`;`3`]; ASM_REWRITE_TAC[arith `SUC p = p+1`;LET_THM]; NUM_REDUCE_TAC; DISCH_TAC; TYPIFY `azim (vec 0) (v p) (v (p+1)) (v (p+3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); MATCH_MP_TAC Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI; BY(ASM_REWRITE_TAC[]); TYPIFY `azim (vec 0) (v p) (v (p + 1)) (v (p + 2)) <= pi /\ azim (vec 0) (v p) (v (p + 2)) (v (p + 3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC (arith `&0 < pi /\ &0 <= a /\ &0 <= b /\ a + b <= pi ==> a <= pi /\ b <= pi`); REWRITE_TAC[PI_POS]; REWRITE_TAC[Counting_spheres.AZIM_NN]; BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `scs_is_str` MP_TAC; REWRITE_TAC[Appendix.scs_is_str]; ASM_REWRITE_TAC[]; NUM_REDUCE_TAC; REWRITE_TAC[arith `SUC p = p+1`]; DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+2)`;`v (p+3)`]; INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+1)`;`v (p+2)`]; FIRST_X_ASSUM_ST `pi = a` (MP_TAC o SYM) THEN DISCH_TAC; ASM_REWRITE_TAC[]; TYPIFY `~collinear {vec 0, v p, v (p + 1)} /\ ~collinear {vec 0, v p, v (p + 2)} /\ ~collinear {vec 0, v p, v (p + 3)}` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; REPEAT (FIRST_X_ASSUM_ST `dihV` MP_TAC) THEN REWRITE_TAC[] THEN REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y)); ASM_REWRITE_TAC[]; CONJ_TAC; BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `+` MP_TAC THEN ASM_REWRITE_TAC[]; (DISCH_TAC); TYPIFY `cstab <= dist(v p,v(p+2))` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `cstab < d` (C INTRO_TAC [`p`;`p+2`]); ANTS_TAC; REWRITE_TAC[arith `p+2 = SUC(SUC (p))`]; MATCH_MP_TAC Tfitskc.SCS_DIAG_2; BY(NUM_REDUCE_TAC); BY(REAL_ARITH_TAC); INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "1348932091 delta") [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`&2 * h0`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 1)) /\ norm (v (p + 1)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ ( #2.52 <= &2 * h0 /\ &2 * h0 <= #2.52) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.3) /\ &2 <= dist (v p,v (p + 1)) /\ dist (v p,v (p + 1)) <= #2.52` (C SUBGOAL_THEN ASSUME_TAC); TYPIFY `#2.52 = &2 * h0` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`]; CONJ2_TAC; FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`0`;`1`]); BY(REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN MATCH_MP_TAC THEN NUM_REDUCE_TAC); CONJ2_TAC; BY(FIRST_X_ASSUM_ST `#3.3` MP_TAC THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); BY(ASM_REWRITE_TAC[GSYM Sphere.cstab]); ASM_REWRITE_TAC[]; DISCH_TAC; INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "1348932091") [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`&2 * h0`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; FIRST_X_ASSUM_ST `#3.01` (unlist REWRITE_TAC); DISCH_TAC; INTRO_TAC Ocbicby.dih_y_mono [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`dist(v (p+1),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`;`&2 * h0`]; ANTS_TAC; ASM_REWRITE_TAC[arith `&0 < &2`]; CONJ_TAC; FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`1`;`2`]); BY(NUM_REDUCE_TAC THEN REAL_ARITH_TAC); CONJ2_TAC; BY(FIRST_X_ASSUM_ST `delta_y` MP_TAC THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `norm (v p) = &2` (SUBST1_TAC o GSYM); FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`p+1`]); ANTS_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[arith `(p+1) +i = p+(1+i)`] THEN NUM_REDUCE_TAC; REWRITE_TAC[Oxlzlez.coplanar_delta_y]; ASM_REWRITE_TAC[DIST_SYM;DIST_0]; MATCH_MP_TAC (arith `a = b ==> &0 < a ==> &0 < b`); BY(MESON_TAC[Merge_ineq.delta_y_sym]); (DISCH_TAC); COMMENT "5557"; INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5557288534 delta") [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 3)) /\ norm (v (p + 3)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ ( #3.01 <= cstab /\ cstab <= #3.01) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.3) /\ &2 <= dist (v p,v (p + 3)) /\ dist (v p,v (p + 3)) <= #2.52` (C SUBGOAL_THEN ASSUME_TAC); TYPIFY `#2.52 = &2 * h0` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`;Sphere.cstab]; CONJ2_TAC; CONJ_TAC; FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`0`;`3`]); BY(REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN MATCH_MP_TAC THEN NUM_REDUCE_TAC); BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); CONJ2_TAC; BY(FIRST_X_ASSUM_ST `#3.3` MP_TAC THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); BY(ASM_REWRITE_TAC[GSYM Sphere.cstab]); FIRST_ASSUM (unlist REWRITE_TAC); DISCH_TAC; INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5557288534") [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; FIRST_X_ASSUM_ST `#3.01` (unlist REWRITE_TAC); DISCH_TAC; INTRO_TAC Ocbicby.dih_y_mono [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`dist(v (p+3),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`;`cstab`]; ANTS_TAC; TYPIFY_GOAL_THEN `&0 < norm (v p)` (unlist REWRITE_TAC); BY(ASM_REWRITE_TAC[arith `&0 < &2`]); FIRST_X_ASSUM_ST `norm (v p) = &2` kill; ASM_REWRITE_TAC[]; CONJ_TAC; BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); CONJ_TAC; FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`3`;`2`]); BY(NUM_REDUCE_TAC THEN REAL_ARITH_TAC); CONJ2_TAC; BY(FIRST_X_ASSUM_ST `delta_y` MP_TAC THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`p+3`]); ANTS_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[arith `(p+3) +i = p+(3+i)`] THEN NUM_REDUCE_TAC; REWRITE_TAC[Oxlzlez.coplanar_delta_y]; ASM_REWRITE_TAC[DIST_SYM;DIST_0]; MATCH_MP_TAC (arith `a = b ==> &0 < a ==> &0 < b`); BY(MESON_TAC[Merge_ineq.delta_y_sym]); (DISCH_TAC); TYPIFY `dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 3),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3))) + dih_y (norm (v p)) (norm (v (p + 1))) (norm (v (p + 2))) (dist (v (p + 1),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 1))) <= #3.1` (C SUBGOAL_THEN ASSUME_TAC); BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); TYPIFY `#3.1 < pi` (C SUBGOAL_THEN ASSUME_TAC); BY(MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `a = pi` MP_TAC THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC); REWRITE_TAC[DIST_0;DIST_SYM]; TYPIFY `dih_y (norm (v p)) (norm (v (p + 2))) (norm (v (p + 3))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 3))) (dist (v p,v (p + 2))) = dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3)))` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[Nonlinear_lemma.dih_y_sym]); BY(REAL_ARITH_TAC) ]);; (* }}} *)
let LEMMA_PWE2 = prove_by_refinement(
(* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> (!s v p.
    is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ 
    (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\
    (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/
       (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\
      scs_generic v /\
    ~scs_is_str s v (p+1) /\ ~scs_is_str s v (p+3) /\
    scs_is_str s v p /\ norm (v p) = &2 /\
    scs_a_v39 s p (p+1) = &2 /\
    scs_a_v39 s (p+3) (p) = &2 /\
    dist(v (p+2),v(p+3)) <= &2 * h0 ==>
    pi / &2 < dihV (vec 0) (v (p+3)) (v (p)) (v (p+2)))`,
  (* {{{ proof *)
  [
  REPEAT WEAKER_STRIP_TAC;
  REWRITE_TAC[arith `x < y <=> ~(y <= x)`] THEN DISCH_TAC;
  REPEAT WEAKER_STRIP_TAC;
  TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC);
    BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs;IN]);
  TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC);
    BY(ASM_MESON_TAC[Appendix.BBprime2_v39]);
  TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC);
    BY(ASM_MESON_TAC[Appendix.BBprime_v39]);
  INTRO_TAC Appendix.BBs_v39 [`s`;`v`];
  ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV;arith `~(4 <= 3)`];
  REPEAT WEAKER_STRIP_TAC;
  TYPED_ABBREV_TAC `V = IMAGE v (:num)`;
  TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`;
  TYPED_ABBREV_TAC `FF = IMAGE (\i. (v i,v (SUC i))) (:num)`;
  TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC);
    MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO;
    BY(ASM_REWRITE_TAC[]);
  TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC);
    REPEAT WEAKER_STRIP_TAC;
    EXPAND_TAC "V";
REWRITE_TAC[IN_IMAGE;IN_UNIV]; BY(MESON_TAC[]); INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; ASM_REWRITE_TAC[]; DISCH_TAC; TYPIFY `!i. interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i+1)) (v (i+3))` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; EXPAND_TAC "FF"; GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM)); TYPIFY `s` EXISTS_TAC; BY(ASM_REWRITE_TAC[IN;arith `4 - 1 = 3`;arith `3 < 4`;arith `SUC i = i+1`]); INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`]; ASM_REWRITE_TAC[LET_THM;IN;arith `4-1 = 3`;arith `SUC i = i+1`]; DISCH_TAC; TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); BY(ASM_REWRITE_TAC[arith `~(0=4)`]); TYPIFY `v 4 = v 0 /\ v 5 = v 1 /\ v 6 = v 2 /\ v 7 = v 3 /\ v 8 = v 4` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); BY(REWRITE_TAC[Terminal.MOD_4_EXPLICIT;arith `7 = 1*4 + 3`;arith `8 = 2*4 + 0`;MOD_MULT_ADD]); TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN ASM_REWRITE_TAC[Appendix.scs_generic]); TYPIFY `v (p+4) = v p /\ v (p+5) = v (p+1) /\ v (p+6) = v (p+2) /\ v (p+7) = v (p+3) /\ v (p+8) = v (p)` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `MOD` ((unlist ONCE_REWRITE_TAC) o GSYM); BY(REWRITE_TAC[arith `p+4 = 1*4 + p /\ p+5 = 1*4+(p+1) /\ p+6=1*4+(p+2) /\ p+7 = 1*4 + (p+3) /\ p+8 = 2*4 + p`;MOD_MULT_ADD]); TYPIFY `!i. &2 <= norm (v i) /\ norm (v i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; BY(ASM_REWRITE_TAC[]); TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> &2 <= dist(v (p + i),v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC Ocbicby.scs_lb_2; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; (NUM_REDUCE_TAC); REPEAT (GMATCH_SIMP_TAC MOD_LT); BY(ASM_REWRITE_TAC[]); COMMENT "edge lengths"; TYPIFY `scs_b_v39 s (p+1) ((p+1)+1) <= cstab /\ scs_b_v39 s p (p+1) = &2 * h0 /\ scs_b_v39 s (p+3) ((p+3)+1) = &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); CONJ2_TAC; TYPIFY `~(&2 = &2 * h0)` (C SUBGOAL_THEN ASSUME_TAC); BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); TYPIFY `scs_a_v39 s (p+3) p = scs_a_v39 s (p+3) ((p+3)+1)` ENOUGH_TO_SHOW_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[arith `((p+3)+1) = p+4`]; FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; BY(ASM_MESON_TAC[Appendix.periodic2;Oxl_def.periodic]); FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `x <= cstab` (C INTRO_TAC [`p+1`]) THEN ASM_REWRITE_TAC[arith `3 < 4`]; BY(REWRITE_TAC[arith `SUC (p+1) = (p+1)+1`]); FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[arith `((p:num) + i ) + j = p + (i+j)`] THEN NUM_REDUCE_TAC; DISCH_TAC; TYPIFY `dist(v (p+1),v(p+2)) <= cstab /\ dist(v p,v(p+1)) <= &2 * h0 /\ dist(v(p+3),v(p+4)) <= &2 * h0` (C SUBGOAL_THEN MP_TAC); FIRST_X_ASSUM MP_TAC; FIRST_X_ASSUM_ST `scs_b_v39` MP_TAC; BY(MESON_TAC[REAL_LE_TRANS]); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; COMMENT "collinear"; TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); REPEAT GEN_TAC THEN DISCH_TAC; MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; GEXISTL_TAC [`V`;`E`;`FF`]; BY(ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]); TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPLICATE_TAC 20 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; ASM_REWRITE_TAC[arith `~(4 = 0)`]; DISCH_TAC; TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i=j) ==> ~(v (p +i) = v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; (NUM_REDUCE_TAC); REPEAT (GMATCH_SIMP_TAC MOD_LT); BY(ASM_REWRITE_TAC[]); TYPIFY `!i. 0 < i /\ i < 4 ==> ~(v (p+i) = v p)` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[arith `p+0 = p`;arith `0< 4`;arith `0 < i ==> ~(i=0)`]); COMMENT "long diag"; TYPIFY `#3.3 <= dist(v (p+2),v p)` ASM_CASES_TAC; COMMENT "long diag"; INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "6184614449") [`norm (v (p+3))`;`norm(v (p+2))`;`norm(v p)`;`dist(v(p+2),v p)`;`dist(v(p+3),v p)`;`dist(v(p+3),v(p+2))`]; FIRST_X_ASSUM_ST `norm x = &2` kill; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; ASM_REWRITE_TAC[]; DISCH_THEN MP_TAC THEN ANTS_TAC; CONJ_TAC; INTRO_TAC DIST_TRIANGLE [`v (p+2)`;`(vec 0):real^3`;`v (p)`]; REWRITE_TAC[DIST_0]; MATCH_MP_TAC (arith `x <= &2 * h0 /\ y <= &2 * h0 ==> (d <= x + y ==> d <= &4 * h0)`); BY(ASM_REWRITE_TAC[]); nCONJ_TAC 2; BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; TYPIFY `v p = v (p+0)` (C SUBGOAL_THEN SUBST1_TAC); ONCE_REWRITE_TAC[arith `p+0=p`]; BY(REWRITE_TAC[]); BY(CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); DISCH_TAC; FIRST_X_ASSUM_ST `dihV` MP_TAC; REWRITE_TAC[arith `~(x <= y) <=> y < x`]; GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y); ASM_REWRITE_TAC[DIST_0]; CONJ_TAC; BY(CONJ_TAC THEN (REPEAT (FIRST_X_ASSUM MATCH_MP_TAC)) THEN NUM_REDUCE_TAC); ONCE_REWRITE_TAC[Nonlinear_lemma.dih_y_sym]; MATCH_MP_TAC Ocbicby.delta4_y_imp_obtuse; CONJ_TAC; BY(ASM_MESON_TAC[arith `&2 <= x==> &0 < x`]); INTRO_TAC DIST_SYM [`v p`;`v (p+2)`]; DISCH_THEN SUBST1_TAC; CONJ_TAC; BY(REWRITE_TAC[REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos]); BY(ASM_REWRITE_TAC[]); TYPIFY `!i. ~scs_is_str s v i ==> ~coplanar {vec 0, v i, v(i+1), v(i+3)}` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC THEN ASM_REWRITE_TAC[Appendix.scs_is_str;arith `SUC i = i+1`;GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; NUM_REDUCE_TAC; DISCH_THEN (unlist REWRITE_TAC); MATCH_MP_TAC (arith `&0 < a ==> ~(a = &0)`); INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`;`i`]; BY(ASM_REWRITE_TAC[LET_THM;IN;arith `SUC i = i+1`;arith `4 - 1 = 3`]); FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC; COMMENT "short diag"; INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p`;`2`;`3`]; ASM_REWRITE_TAC[arith `SUC p = p+1`;LET_THM]; NUM_REDUCE_TAC; DISCH_TAC; TYPIFY `azim (vec 0) (v p) (v (p+1)) (v (p+3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); MATCH_MP_TAC Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI; BY(ASM_REWRITE_TAC[]); TYPIFY `azim (vec 0) (v p) (v (p + 1)) (v (p + 2)) <= pi /\ azim (vec 0) (v p) (v (p + 2)) (v (p + 3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC (arith `&0 < pi /\ &0 <= a /\ &0 <= b /\ a + b <= pi ==> a <= pi /\ b <= pi`); REWRITE_TAC[PI_POS]; REWRITE_TAC[Counting_spheres.AZIM_NN]; BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `scs_is_str` MP_TAC; REWRITE_TAC[Appendix.scs_is_str]; ASM_REWRITE_TAC[]; NUM_REDUCE_TAC; REWRITE_TAC[arith `SUC p = p+1`]; DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+2)`;`v (p+3)`]; INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+1)`;`v (p+2)`]; FIRST_X_ASSUM_ST `pi = a` (MP_TAC o SYM) THEN DISCH_TAC; ASM_REWRITE_TAC[]; TYPIFY `~collinear {vec 0, v p, v (p + 1)} /\ ~collinear {vec 0, v p, v (p + 2)} /\ ~collinear {vec 0, v p, v (p + 3)}` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; REPEAT (FIRST_X_ASSUM_ST `dihV` MP_TAC) THEN REWRITE_TAC[] THEN REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y)); ASM_REWRITE_TAC[]; CONJ_TAC; BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `+` MP_TAC THEN ASM_REWRITE_TAC[]; (DISCH_TAC); TYPIFY `cstab <= dist(v p,v(p+2))` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `cstab < d` (C INTRO_TAC [`p`;`p+2`]); ANTS_TAC; REWRITE_TAC[arith `p+2 = SUC(SUC (p))`]; MATCH_MP_TAC Tfitskc.SCS_DIAG_2; BY(NUM_REDUCE_TAC); BY(REAL_ARITH_TAC); INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "1348932091 delta") [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`&2 * h0`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 3)) /\ norm (v (p + 3)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ ( #2.52 <= &2 * h0 /\ &2 * h0 <= #2.52) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.3) /\ &2 <= dist (v p,v (p + 3)) /\ dist (v p,v (p + 3)) <= #2.52` (C SUBGOAL_THEN ASSUME_TAC); TYPIFY `#2.52 = &2 * h0` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`]; nCONJ_TAC 3; BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; CONJ2_TAC; FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`0`;`3`]); BY(REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN MATCH_MP_TAC THEN NUM_REDUCE_TAC); CONJ2_TAC; BY(FIRST_X_ASSUM_ST `#3.3` MP_TAC THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); BY(ASM_REWRITE_TAC[GSYM Sphere.cstab]); FIRST_X_ASSUM_ST `norm x = &2` MP_TAC; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "1348932091") [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`&2 * h0`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; FIRST_X_ASSUM_ST `#3.01` (unlist REWRITE_TAC); DISCH_TAC; INTRO_TAC Ocbicby.dih_y_mono [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`dist(v (p+3),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`;`&2 * h0`]; ANTS_TAC; nCONJ_TAC 1; BY(FIRST_X_ASSUM_ST `norm x = &2` MP_TAC THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `norm x = &2` kill; ASM_REWRITE_TAC[arith `&0 < &2`]; CONJ_TAC; BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); CONJ_TAC; FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`3`;`2`]); BY(NUM_REDUCE_TAC THEN REAL_ARITH_TAC); CONJ2_TAC; BY(FIRST_X_ASSUM_ST `delta_y` MP_TAC THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`p+3`]); ANTS_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[arith `(p+3) +i = p+(3+i)`] THEN NUM_REDUCE_TAC; REWRITE_TAC[Oxlzlez.coplanar_delta_y]; ASM_REWRITE_TAC[DIST_SYM;DIST_0]; MATCH_MP_TAC (arith `a = b ==> &0 < a ==> &0 < b`); BY(MESON_TAC[Merge_ineq.delta_y_sym]); (DISCH_TAC); COMMENT "5557"; INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5557288534 delta") [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 1)) /\ norm (v (p + 1)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ ( #3.01 <= cstab /\ cstab <= #3.01) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.3) /\ &2 <= dist (v p,v (p + 1)) /\ dist (v p,v (p + 1)) <= #2.52` (C SUBGOAL_THEN ASSUME_TAC); TYPIFY `#2.52 = &2 * h0` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`;Sphere.cstab]; CONJ2_TAC; FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`0`;`1`]); BY(REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN MATCH_MP_TAC THEN NUM_REDUCE_TAC); CONJ2_TAC; BY(FIRST_X_ASSUM_ST `#3.3` MP_TAC THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); BY(ASM_REWRITE_TAC[GSYM Sphere.cstab]); FIRST_ASSUM (unlist REWRITE_TAC); DISCH_TAC; INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5557288534") [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; FIRST_X_ASSUM_ST `#3.01` (unlist REWRITE_TAC); DISCH_TAC; INTRO_TAC Ocbicby.dih_y_mono [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`dist(v (p+1),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`;`cstab`]; ANTS_TAC; TYPIFY_GOAL_THEN `&0 < norm (v p)` (unlist REWRITE_TAC); BY(ASM_REWRITE_TAC[arith `&0 < &2`]); FIRST_X_ASSUM_ST `norm (v p) = &2` kill; ASM_REWRITE_TAC[]; CONJ_TAC; FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`1`;`2`]); BY(NUM_REDUCE_TAC THEN REAL_ARITH_TAC); CONJ2_TAC; BY(FIRST_X_ASSUM_ST `delta_y` MP_TAC THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`p+1`]); ANTS_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[arith `(p+1) +i = p+(1+i)`] THEN NUM_REDUCE_TAC; REWRITE_TAC[Oxlzlez.coplanar_delta_y]; ASM_REWRITE_TAC[DIST_SYM;DIST_0]; MATCH_MP_TAC (arith `a = b ==> &0 < a ==> &0 < b`); BY(MESON_TAC[Merge_ineq.delta_y_sym]); (DISCH_TAC); TYPIFY `dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 3),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3))) + dih_y (norm (v p)) (norm (v (p + 1))) (norm (v (p + 2))) (dist (v (p + 1),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 1))) < #3.1` (C SUBGOAL_THEN ASSUME_TAC); BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); TYPIFY `#3.1 < pi` (C SUBGOAL_THEN ASSUME_TAC); BY(MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `a = pi` MP_TAC THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC); REWRITE_TAC[DIST_0;DIST_SYM]; TYPIFY `dih_y (norm (v p)) (norm (v (p + 2))) (norm (v (p + 3))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 3))) (dist (v p,v (p + 2))) = dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3)))` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[Nonlinear_lemma.dih_y_sym]); BY(REAL_ARITH_TAC) ]);; (* }}} *)
let LINDIH_11 = prove_by_refinement(
    (* main_work4 ==> *) `main_nonlinear_terminal_v11 ==>
    (!y1 y2 y3 y4 y5 y6.
       ineq
      [
	 (&2,y1,&2);
	 (&2,y2,#2.52);
	 (&2,y3,#2.52);
	 (&2,y4,&2);
	 (#3.01,y5,#3.55);
	 (&2 * h0,y6,#3.01)]      
      ((dih_y y1 y2 y3 y4 y5 y6  < #1.1) \/ delta_y y1 y2 y3 y4 y5 y6 < &0))`,
  (* {{{ proof *)
  [
  REPEAT WEAKER_STRIP_TAC;
  REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`];
  REPEAT WEAKER_STRIP_TAC;
  TYPIFY `delta_y y1 y2 y3 y4 y5 y6 < &0` ASM_CASES_TAC;
    BY(ASM_REWRITE_TAC[]);
  ASM_REWRITE_TAC[];
  REWRITE_TAC[Sphere.dih_y;LET_THM];
  GMATCH_SIMP_TAC Merge_ineq.lindih_lt;
  REWRITE_TAC[GSYM CONJ_ASSOC];
  GMATCH_SIMP_TAC REAL_LT_MUL_EQ;
  CONJ_TAC;
    BY(ASM_TAC THEN REAL_ARITH_TAC);
  CONJ_TAC;
    BY(MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC);
  CONJ_TAC;
    BY(ASM_TAC THEN REAL_ARITH_TAC);
  INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "9368433105") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`];
  ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;LET_THM];
  REWRITE_TAC[Sphere.delta4_y;Sphere.y_of_x];
  DISCH_TAC;
  INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "8405387449") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`];
  ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;LET_THM];
  ASM_SIMP_TAC [arith `d > &0 ==> &0 < d`];
  DISCH_TAC;
  TYPIFY `&0 <= (&4 *  (y1 * y1) *  delta_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6))` (C SUBGOAL_THEN ASSUME_TAC);
    REPEAT (GMATCH_SIMP_TAC REAL_LE_MUL);
    FIRST_X_ASSUM_ST `delta_y` MP_TAC THEN REWRITE_TAC[Sphere.delta_y];
    BY(ASM_TAC THEN REAL_ARITH_TAC);
  GMATCH_SIMP_TAC Pack1.bp_bdt;
  GMATCH_SIMP_TAC SQRT_POS_LE;
  ASM_REWRITE_TAC[];
  CONJ_TAC;
    GMATCH_SIMP_TAC REAL_LE_MUL;
    GMATCH_SIMP_TAC TAN_POS_PI2_LE;
    ASM_SIMP_TAC[arith `x > &0 ==> &0 <= x`];
    BY(MP_TAC Flyspeck_constants.bounds THEN ASM_TAC THEN REAL_ARITH_TAC);
  GMATCH_SIMP_TAC SQRT_POW_2;
  ASM_REWRITE_TAC[];
  MATCH_MP_TAC REAL_LT_TRANS;
  TYPIFY `#3.86 * delta4_squared_y y1 y2 y3 y4 y5 y6` EXISTS_TAC;
  CONJ_TAC;
    FIRST_X_ASSUM_ST `x1_delta_y` MP_TAC;
    BY(REWRITE_TAC[Sphere.x1_delta_y;Sphere.delta4_squared_y;Sphere.y_of_x;Sphere.x1_delta_x]);
  REWRITE_TAC[Sphere.delta4_squared_y;Sphere.y_of_x;Sphere.delta4_squared_x];
  REWRITE_TAC[arith `(x * y) pow 2 = x pow 2 * y pow 2`];
  GMATCH_SIMP_TAC REAL_LT_RMUL_EQ;
  CONJ_TAC;
    REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT];
    BY(ASM_TAC THEN REAL_ARITH_TAC);
  TYPIFY `#3.86 = sqrt(#3.86) pow 2` (C SUBGOAL_THEN SUBST1_TAC);
    GMATCH_SIMP_TAC SQRT_POW_2;
    BY(REAL_ARITH_TAC);
  MATCH_MP_TAC Tame_inequalities.REAL_LT_SQUARE_POS;
  GMATCH_SIMP_TAC SQRT_POS_LT;
  CONJ_TAC;
    BY(REAL_ARITH_TAC);
  TYPIFY `atn(sqrt  #3.86) < atn(tan  #1.1)` ENOUGH_TO_SHOW_TAC;
    BY(REWRITE_TAC[ATN_MONO_LT_EQ]);
  GMATCH_SIMP_TAC TAN_ATN;
  CONJ_TAC;
    BY(MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC);
  BY(REWRITE_TAC[Flyspeck_constants.calc `atn (sqrt  #3.86) <  #1.1`])
  ]);;
(* }}} *)
let LEMMA_PWE3 = prove_by_refinement(
(* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> (!s v p.
    is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ 
    (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\
    (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/
       (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\
      scs_generic v /\
    ~scs_is_str s v (p+1) /\ ~scs_is_str s v (p+3) /\
    scs_is_str s v p /\ norm (v p) = &2 /\
    scs_a_v39 s p (p+1) = &2 /\
    scs_a_v39 s (p+3) (p) = &2 * h0 /\
    dist(v (p+2),v(p+3)) =  &2 /\
    &2 * h0 <= dist(v(p+1),v(p+2)) ==>
    pi / &2 < dihV (vec 0) (v (p+1)) (v (p)) (v (p+2)))`,
  (* {{{ proof *)
  [
  REPEAT WEAKER_STRIP_TAC;
  REWRITE_TAC[arith `x < y <=> ~(y <= x)`] THEN DISCH_TAC;
  REPEAT WEAKER_STRIP_TAC;
  TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC);
    BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs;IN]);
  TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC);
    BY(ASM_MESON_TAC[Appendix.BBprime2_v39]);
  TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC);
    BY(ASM_MESON_TAC[Appendix.BBprime_v39]);
  INTRO_TAC Appendix.BBs_v39 [`s`;`v`];
  ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV;arith `~(4 <= 3)`];
  REPEAT WEAKER_STRIP_TAC;
  TYPED_ABBREV_TAC `V = IMAGE v (:num)`;
  TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`;
  TYPED_ABBREV_TAC `FF = IMAGE (\i. (v i,v (SUC i))) (:num)`;
  TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC);
    MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO;
    BY(ASM_REWRITE_TAC[]);
  TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC);
    REPEAT WEAKER_STRIP_TAC;
    EXPAND_TAC "V";
REWRITE_TAC[IN_IMAGE;IN_UNIV]; BY(MESON_TAC[]); INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; ASM_REWRITE_TAC[]; DISCH_TAC; TYPIFY `!i. interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i+1)) (v (i+3))` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; EXPAND_TAC "FF"; GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM)); TYPIFY `s` EXISTS_TAC; BY(ASM_REWRITE_TAC[IN;arith `4 - 1 = 3`;arith `3 < 4`;arith `SUC i = i+1`]); INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`]; ASM_REWRITE_TAC[LET_THM;IN;arith `4-1 = 3`;arith `SUC i = i+1`]; DISCH_TAC; TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); BY(ASM_REWRITE_TAC[arith `~(0=4)`]); TYPIFY `v 4 = v 0 /\ v 5 = v 1 /\ v 6 = v 2 /\ v 7 = v 3 /\ v 8 = v 4` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); BY(REWRITE_TAC[Terminal.MOD_4_EXPLICIT;arith `7 = 1*4 + 3`;arith `8 = 2*4 + 0`;MOD_MULT_ADD]); TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN ASM_REWRITE_TAC[Appendix.scs_generic]); TYPIFY `v (p+4) = v p /\ v (p+5) = v (p+1) /\ v (p+6) = v (p+2) /\ v (p+7) = v (p+3) /\ v (p+8) = v (p)` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `MOD` ((unlist ONCE_REWRITE_TAC) o GSYM); BY(REWRITE_TAC[arith `p+4 = 1*4 + p /\ p+5 = 1*4+(p+1) /\ p+6=1*4+(p+2) /\ p+7 = 1*4 + (p+3) /\ p+8 = 2*4 + p`;MOD_MULT_ADD]); TYPIFY `!i. &2 <= norm (v i) /\ norm (v i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; BY(ASM_REWRITE_TAC[]); TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> &2 <= dist(v (p + i),v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC Ocbicby.scs_lb_2; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; (NUM_REDUCE_TAC); REPEAT (GMATCH_SIMP_TAC MOD_LT); BY(ASM_REWRITE_TAC[]); COMMENT "edge lengths"; TYPIFY `scs_b_v39 s (p+1) ((p+1)+1) <= cstab /\ scs_b_v39 s p (p+1) = &2 * h0 /\ scs_b_v39 s (p+3) ((p+3)+1) = cstab` (C SUBGOAL_THEN ASSUME_TAC); TYPIFY `~(&2 = &2 * h0)` (C SUBGOAL_THEN ASSUME_TAC); BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); CONJ2_TAC; TYPIFY `scs_a_v39 s (p+3) p = scs_a_v39 s (p+3) ((p+3)+1)` ENOUGH_TO_SHOW_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[arith `((p+3)+1) = p+4`]; FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; BY(ASM_MESON_TAC[Appendix.periodic2;Oxl_def.periodic]); FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `x <= cstab` (C INTRO_TAC [`p+1`]) THEN ASM_REWRITE_TAC[arith `3 < 4`]; BY(REWRITE_TAC[arith `SUC (p+1) = (p+1)+1`]); FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[arith `((p:num) + i ) + j = p + (i+j)`] THEN NUM_REDUCE_TAC; DISCH_TAC; TYPIFY `dist(v (p+1),v(p+2)) <= cstab /\ dist(v p,v(p+1)) <= &2 * h0 /\ dist(v(p+3),v(p+4)) <= cstab` (C SUBGOAL_THEN MP_TAC); FIRST_X_ASSUM MP_TAC; FIRST_X_ASSUM_ST `scs_b_v39` MP_TAC; BY(MESON_TAC[REAL_LE_TRANS]); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; COMMENT "collinear"; TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); REPEAT GEN_TAC THEN DISCH_TAC; MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; GEXISTL_TAC [`V`;`E`;`FF`]; BY(ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]); TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPLICATE_TAC 20 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; ASM_REWRITE_TAC[arith `~(4 = 0)`]; DISCH_TAC; TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i=j) ==> ~(v (p +i) = v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; (NUM_REDUCE_TAC); REPEAT (GMATCH_SIMP_TAC MOD_LT); BY(ASM_REWRITE_TAC[]); TYPIFY `!i. 0 < i /\ i < 4 ==> ~(v (p+i) = v p)` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[arith `p+0 = p`;arith `0< 4`;arith `0 < i ==> ~(i=0)`]); COMMENT "long diag"; TYPIFY `#2.52 = &2 * h0 /\ #3.01 = cstab` (C SUBGOAL_THEN ASSUME_TAC); BY(REWRITE_TAC[Sphere.h0;Sphere.cstab] THEN REAL_ARITH_TAC); TYPIFY `#3.55 <= dist(v (p+2),v p)` ASM_CASES_TAC; INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "2073661826") [`norm (v (p+1))`;`norm(v (p+2))`;`norm(v p)`;`dist(v(p+2),v p)`;`dist(v(p+1),v p)`;`dist(v(p+1),v(p+2))`]; FIRST_X_ASSUM_ST `norm x = &2` kill; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; ASM_REWRITE_TAC[]; DISCH_THEN MP_TAC THEN ANTS_TAC; CONJ_TAC; INTRO_TAC DIST_TRIANGLE [`v (p+2)`;`(vec 0):real^3`;`v (p)`]; REWRITE_TAC[DIST_0]; MATCH_MP_TAC (arith `x <= &2 * h0 /\ y <= &2 * h0 ==> (d <= x + y ==> d <= &4 * h0)`); BY(ASM_REWRITE_TAC[]); CONJ2_TAC; BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); TYPIFY `v p = v (p+0)` (C SUBGOAL_THEN SUBST1_TAC); ONCE_REWRITE_TAC[arith `p+0=p`]; BY(REWRITE_TAC[]); BY(FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); DISCH_TAC; FIRST_X_ASSUM_ST `dihV` MP_TAC; REWRITE_TAC[arith `~(x <= y) <=> y < x`]; GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y); ASM_REWRITE_TAC[DIST_0]; CONJ_TAC; BY(CONJ_TAC THEN (REPEAT (FIRST_X_ASSUM MATCH_MP_TAC)) THEN NUM_REDUCE_TAC); ONCE_REWRITE_TAC[Nonlinear_lemma.dih_y_sym]; MATCH_MP_TAC Ocbicby.delta4_y_imp_obtuse; CONJ_TAC; BY(ASM_MESON_TAC[arith `&2 <= x==> &0 < x`]); INTRO_TAC DIST_SYM [`v p`;`v (p+2)`]; DISCH_THEN SUBST1_TAC; CONJ_TAC; BY(REWRITE_TAC[REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos]); BY(ASM_REWRITE_TAC[]); TYPIFY `!i. ~scs_is_str s v i ==> ~coplanar {vec 0, v i, v(i+1), v(i+3)}` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC THEN ASM_REWRITE_TAC[Appendix.scs_is_str;arith `SUC i = i+1`;GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; NUM_REDUCE_TAC; DISCH_THEN (unlist REWRITE_TAC); MATCH_MP_TAC (arith `&0 < a ==> ~(a = &0)`); INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`;`i`]; BY(ASM_REWRITE_TAC[LET_THM;IN;arith `SUC i = i+1`;arith `4 - 1 = 3`]); FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC; COMMENT "short diag"; INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p`;`2`;`3`]; ASM_REWRITE_TAC[arith `SUC p = p+1`;LET_THM]; NUM_REDUCE_TAC; DISCH_TAC; TYPIFY `azim (vec 0) (v p) (v (p+1)) (v (p+3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); MATCH_MP_TAC Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI; BY(ASM_REWRITE_TAC[]); TYPIFY `azim (vec 0) (v p) (v (p + 1)) (v (p + 2)) <= pi /\ azim (vec 0) (v p) (v (p + 2)) (v (p + 3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC (arith `&0 < pi /\ &0 <= a /\ &0 <= b /\ a + b <= pi ==> a <= pi /\ b <= pi`); REWRITE_TAC[PI_POS]; REWRITE_TAC[Counting_spheres.AZIM_NN]; BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `scs_is_str` MP_TAC; REWRITE_TAC[Appendix.scs_is_str]; ASM_REWRITE_TAC[]; NUM_REDUCE_TAC; REWRITE_TAC[arith `SUC p = p+1`]; DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+2)`;`v (p+3)`]; INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+1)`;`v (p+2)`]; FIRST_X_ASSUM_ST `pi = a` (MP_TAC o SYM) THEN DISCH_TAC; ASM_REWRITE_TAC[]; TYPIFY `~collinear {vec 0, v p, v (p + 1)} /\ ~collinear {vec 0, v p, v (p + 2)} /\ ~collinear {vec 0, v p, v (p + 3)}` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; REPEAT (FIRST_X_ASSUM_ST `dihV` MP_TAC) THEN REWRITE_TAC[] THEN REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y)); ASM_REWRITE_TAC[]; CONJ_TAC; BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `+` MP_TAC THEN ASM_REWRITE_TAC[]; (DISCH_TAC); TYPIFY `cstab <= dist(v p,v(p+2))` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `cstab < d` (C INTRO_TAC [`p`;`p+2`]); ANTS_TAC; REWRITE_TAC[arith `p+2 = SUC(SUC (p))`]; MATCH_MP_TAC Tfitskc.SCS_DIAG_2; BY(NUM_REDUCE_TAC); BY(REAL_ARITH_TAC); INTRO_TAC (UNDISCH2 LINDIH_11) [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`dist(v(p+3),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 3)) /\ norm (v (p + 3)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ (&2 <= dist (v (p + 3),v (p + 2)) /\ dist (v (p + 3),v (p + 2)) <= &2) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.55) /\ &2 * h0 <= dist (v p,v (p + 3)) /\ dist (v p,v (p + 3)) <= #3.01` (C SUBGOAL_THEN ASSUME_TAC); ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`]; nCONJ_TAC 3; BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; CONJ_TAC; BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); CONJ_TAC; BY(FIRST_X_ASSUM_ST `#3.55` MP_TAC THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); TYPIFY `scs_a_v39 s (p+3) p <= dist(v(p+3),v p) ` ENOUGH_TO_SHOW_TAC; REWRITE_TAC[DIST_SYM] THEN MATCH_MP_TAC (arith `a = b ==> (a <= d ==> b <= d)`); BY(ASM_REWRITE_TAC[]); BY(ASM_REWRITE_TAC[]); FIRST_ASSUM (unlist REWRITE_TAC); REWRITE_TAC[DE_MORGAN_THM]; CONJ2_TAC; REWRITE_TAC[arith `~(d < &0) <=> &0 <= d`]; FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`p+3`]); ANTS_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[arith `(p+3) +i = p+(3+i)`] THEN NUM_REDUCE_TAC; REWRITE_TAC[Oxlzlez.coplanar_delta_y]; ASM_REWRITE_TAC[DIST_SYM;DIST_0]; MATCH_MP_TAC (arith `a = b ==> &0 < a ==> &0 <= b`); BY(MESON_TAC[Merge_ineq.delta_y_sym]); (DISCH_TAC); COMMENT "5550"; INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5550839403 delta") [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 1)) /\ norm (v (p + 1)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ ( #3.01 <= cstab /\ cstab <= #3.01) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.55) /\ &2 <= dist (v p,v (p + 1)) /\ dist (v p,v (p + 1)) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`]; FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`0`;`1`]); BY(REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN MATCH_MP_TAC THEN NUM_REDUCE_TAC); FIRST_ASSUM (unlist REWRITE_TAC); DISCH_TAC; INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5550839403") [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; FIRST_X_ASSUM_ST `#3.01` (unlist REWRITE_TAC); DISCH_TAC; INTRO_TAC Ocbicby.dih_y_mono [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`dist(v (p+1),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`;`cstab`]; ANTS_TAC; TYPIFY_GOAL_THEN `&0 < norm (v p)` (unlist REWRITE_TAC); BY(ASM_REWRITE_TAC[arith `&0 < &2`]); FIRST_X_ASSUM_ST `norm (v p) = &2` kill; ASM_REWRITE_TAC[]; CONJ_TAC; FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`1`;`2`]); BY(NUM_REDUCE_TAC THEN REAL_ARITH_TAC); CONJ2_TAC; BY(FIRST_X_ASSUM_ST `delta_y` MP_TAC THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`p+1`]); ANTS_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[arith `(p+1) +i = p+(1+i)`] THEN NUM_REDUCE_TAC; REWRITE_TAC[Oxlzlez.coplanar_delta_y]; ASM_REWRITE_TAC[DIST_SYM;DIST_0]; MATCH_MP_TAC (arith `a = b ==> &0 < a ==> &0 < b`); BY(MESON_TAC[Merge_ineq.delta_y_sym]); (DISCH_TAC); TYPIFY `dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 3),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3))) + dih_y (norm (v p)) (norm (v (p + 1))) (norm (v (p + 2))) (dist (v (p + 1),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 1))) < #3.1` (C SUBGOAL_THEN ASSUME_TAC); BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); TYPIFY `#3.1 < pi` (C SUBGOAL_THEN ASSUME_TAC); BY(MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `a = pi` MP_TAC THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC); REWRITE_TAC[DIST_0;DIST_SYM]; FIRST_X_ASSUM_ST `dist s = &2` MP_TAC; DISCH_THEN ((unlist REWRITE_TAC) o GSYM); TYPIFY `dih_y (norm (v p)) (norm (v (p + 2))) (norm (v (p + 3))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 3))) (dist (v p,v (p + 2))) = dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3)))` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[Nonlinear_lemma.dih_y_sym]); BY(REAL_ARITH_TAC) ]);; (* }}} *)
let LEMMA_PWE4 = prove_by_refinement(
(* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> (!s v p.
    is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ 
    (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\
    (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/
       (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\
      scs_generic v /\
    ~scs_is_str s v (p+1) /\ ~scs_is_str s v (p+3) /\
    scs_is_str s v p /\ norm (v p) = &2 /\
    scs_a_v39 s (p+3) p = &2 /\
    scs_a_v39 s p (p+1) = &2 * h0 /\
    dist(v (p+2),v(p+1)) =  &2 /\
    &2 * h0 <= dist(v(p+3),v(p+2)) ==>
    pi / &2 < dihV (vec 0) (v (p+3)) (v (p)) (v (p+2)))`,
  (* {{{ proof *)
  [
  REPEAT WEAKER_STRIP_TAC;
  REWRITE_TAC[arith `x < y <=> ~(y <= x)`] THEN DISCH_TAC;
  REPEAT WEAKER_STRIP_TAC;
  TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC);
    BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs;IN]);
  TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC);
    BY(ASM_MESON_TAC[Appendix.BBprime2_v39]);
  TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC);
    BY(ASM_MESON_TAC[Appendix.BBprime_v39]);
  INTRO_TAC Appendix.BBs_v39 [`s`;`v`];
  ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV;arith `~(4 <= 3)`];
  REPEAT WEAKER_STRIP_TAC;
  TYPED_ABBREV_TAC `V = IMAGE v (:num)`;
  TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`;
  TYPED_ABBREV_TAC `FF = IMAGE (\i. (v i,v (SUC i))) (:num)`;
  TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC);
    MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO;
    BY(ASM_REWRITE_TAC[]);
  TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC);
    REPEAT WEAKER_STRIP_TAC;
    EXPAND_TAC "V";
REWRITE_TAC[IN_IMAGE;IN_UNIV]; BY(MESON_TAC[]); INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; ASM_REWRITE_TAC[]; DISCH_TAC; TYPIFY `!i. interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i+1)) (v (i+3))` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; EXPAND_TAC "FF"; GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM)); TYPIFY `s` EXISTS_TAC; BY(ASM_REWRITE_TAC[IN;arith `4 - 1 = 3`;arith `3 < 4`;arith `SUC i = i+1`]); INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`]; ASM_REWRITE_TAC[LET_THM;IN;arith `4-1 = 3`;arith `SUC i = i+1`]; DISCH_TAC; TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); BY(ASM_REWRITE_TAC[arith `~(0=4)`]); TYPIFY `v 4 = v 0 /\ v 5 = v 1 /\ v 6 = v 2 /\ v 7 = v 3 /\ v 8 = v 4` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); BY(REWRITE_TAC[Terminal.MOD_4_EXPLICIT;arith `7 = 1*4 + 3`;arith `8 = 2*4 + 0`;MOD_MULT_ADD]); TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN ASM_REWRITE_TAC[Appendix.scs_generic]); TYPIFY `v (p+4) = v p /\ v (p+5) = v (p+1) /\ v (p+6) = v (p+2) /\ v (p+7) = v (p+3) /\ v (p+8) = v (p)` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `MOD` ((unlist ONCE_REWRITE_TAC) o GSYM); BY(REWRITE_TAC[arith `p+4 = 1*4 + p /\ p+5 = 1*4+(p+1) /\ p+6=1*4+(p+2) /\ p+7 = 1*4 + (p+3) /\ p+8 = 2*4 + p`;MOD_MULT_ADD]); TYPIFY `!i. &2 <= norm (v i) /\ norm (v i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; BY(ASM_REWRITE_TAC[]); TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> &2 <= dist(v (p + i),v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC Ocbicby.scs_lb_2; TYPIFY `s` EXISTS_TAC; ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; (NUM_REDUCE_TAC); REPEAT (GMATCH_SIMP_TAC MOD_LT); BY(ASM_REWRITE_TAC[]); COMMENT "edge lengths"; TYPIFY `scs_b_v39 s (p+3) ((p+3)+1) = &2 * h0 /\ scs_b_v39 s p (p+1) = cstab /\ scs_b_v39 s (p+2) ((p+2)+1) <= cstab` (C SUBGOAL_THEN ASSUME_TAC); TYPIFY `~(&2 = &2 * h0)` (C SUBGOAL_THEN ASSUME_TAC); BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); CONJ2_TAC; CONJ_TAC; BY(ASM_MESON_TAC[]); FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `scs_b_v39 s i j <= cstab` (C INTRO_TAC [`p+2`]); ASM_REWRITE_TAC[arith `SUC (p+2) = (p+2)+1`]; BY(DISCH_THEN MATCH_MP_TAC THEN NUM_REDUCE_TAC); TYPIFY `scs_a_v39 s (p+3) p = scs_a_v39 s (p+3) ((p+3)+1)` ENOUGH_TO_SHOW_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[arith `((p+3)+1) = p+4`]; FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; BY(ASM_MESON_TAC[Appendix.periodic2;Oxl_def.periodic]); FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[arith `((p:num) + i ) + j = p + (i+j)`] THEN NUM_REDUCE_TAC; DISCH_TAC; TYPIFY `dist(v (p+3),v(p+4)) <= &2 *h0 /\ dist(v p,v(p+1)) <= cstab /\ dist(v(p+2),v(p+3)) <= cstab` (C SUBGOAL_THEN MP_TAC); FIRST_X_ASSUM MP_TAC; FIRST_X_ASSUM_ST `scs_b_v39` MP_TAC; BY(MESON_TAC[REAL_LE_TRANS]); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; COMMENT "collinear"; TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); REPEAT GEN_TAC THEN DISCH_TAC; MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; GEXISTL_TAC [`V`;`E`;`FF`]; BY(ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]); TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPLICATE_TAC 20 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; ASM_REWRITE_TAC[arith `~(4 = 0)`]; DISCH_TAC; TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i=j) ==> ~(v (p +i) = v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; (NUM_REDUCE_TAC); REPEAT (GMATCH_SIMP_TAC MOD_LT); BY(ASM_REWRITE_TAC[]); TYPIFY `!i. 0 < i /\ i < 4 ==> ~(v (p+i) = v p)` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[arith `p+0 = p`;arith `0< 4`;arith `0 < i ==> ~(i=0)`]); COMMENT "long diag"; TYPIFY `#2.52 = &2 * h0 /\ #3.01 = cstab` (C SUBGOAL_THEN ASSUME_TAC); BY(REWRITE_TAC[Sphere.h0;Sphere.cstab] THEN REAL_ARITH_TAC); TYPIFY `#3.55 <= dist(v (p+2),v p)` ASM_CASES_TAC; INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "2073661826") [`norm (v (p+3))`;`norm(v (p+2))`;`norm(v p)`;`dist(v(p+2),v p)`;`dist(v(p+3),v p)`;`dist(v(p+3),v(p+2))`]; FIRST_X_ASSUM_ST `norm x = &2` kill; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; ASM_REWRITE_TAC[]; DISCH_THEN MP_TAC THEN ANTS_TAC; CONJ_TAC; INTRO_TAC DIST_TRIANGLE [`v (p+2)`;`(vec 0):real^3`;`v (p)`]; REWRITE_TAC[DIST_0]; MATCH_MP_TAC (arith `x <= &2 * h0 /\ y <= &2 * h0 ==> (d <= x + y ==> d <= &4 * h0)`); BY(ASM_REWRITE_TAC[]); CONJ2_TAC; BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); TYPIFY `v p = v (p+0)` (C SUBGOAL_THEN SUBST1_TAC); ONCE_REWRITE_TAC[arith `p+0=p`]; BY(REWRITE_TAC[]); BY(FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); DISCH_TAC; FIRST_X_ASSUM_ST `dihV` MP_TAC; REWRITE_TAC[arith `~(x <= y) <=> y < x`]; GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y); ASM_REWRITE_TAC[DIST_0]; CONJ_TAC; BY(CONJ_TAC THEN (REPEAT (FIRST_X_ASSUM MATCH_MP_TAC)) THEN NUM_REDUCE_TAC); ONCE_REWRITE_TAC[Nonlinear_lemma.dih_y_sym]; MATCH_MP_TAC Ocbicby.delta4_y_imp_obtuse; CONJ_TAC; BY(ASM_MESON_TAC[arith `&2 <= x==> &0 < x`]); INTRO_TAC DIST_SYM [`v p`;`v (p+2)`]; DISCH_THEN SUBST1_TAC; CONJ_TAC; BY(REWRITE_TAC[REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos]); BY(ASM_REWRITE_TAC[]); TYPIFY `!i. ~scs_is_str s v i ==> ~coplanar {vec 0, v i, v(i+1), v(i+3)}` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC THEN ASM_REWRITE_TAC[Appendix.scs_is_str;arith `SUC i = i+1`;GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; NUM_REDUCE_TAC; DISCH_THEN (unlist REWRITE_TAC); MATCH_MP_TAC (arith `&0 < a ==> ~(a = &0)`); INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`;`i`]; BY(ASM_REWRITE_TAC[LET_THM;IN;arith `SUC i = i+1`;arith `4 - 1 = 3`]); FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC; COMMENT "short diag"; INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p`;`2`;`3`]; ASM_REWRITE_TAC[arith `SUC p = p+1`;LET_THM]; NUM_REDUCE_TAC; DISCH_TAC; TYPIFY `azim (vec 0) (v p) (v (p+1)) (v (p+3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); MATCH_MP_TAC Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI; BY(ASM_REWRITE_TAC[]); TYPIFY `azim (vec 0) (v p) (v (p + 1)) (v (p + 2)) <= pi /\ azim (vec 0) (v p) (v (p + 2)) (v (p + 3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC (arith `&0 < pi /\ &0 <= a /\ &0 <= b /\ a + b <= pi ==> a <= pi /\ b <= pi`); REWRITE_TAC[PI_POS]; REWRITE_TAC[Counting_spheres.AZIM_NN]; BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `scs_is_str` MP_TAC; REWRITE_TAC[Appendix.scs_is_str]; ASM_REWRITE_TAC[]; NUM_REDUCE_TAC; REWRITE_TAC[arith `SUC p = p+1`]; DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+2)`;`v (p+3)`]; INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+1)`;`v (p+2)`]; FIRST_X_ASSUM_ST `pi = a` (MP_TAC o SYM) THEN DISCH_TAC; ASM_REWRITE_TAC[]; TYPIFY `~collinear {vec 0, v p, v (p + 1)} /\ ~collinear {vec 0, v p, v (p + 2)} /\ ~collinear {vec 0, v p, v (p + 3)}` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; REPEAT (FIRST_X_ASSUM_ST `dihV` MP_TAC) THEN REWRITE_TAC[] THEN REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y)); ASM_REWRITE_TAC[]; CONJ_TAC; BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `+` MP_TAC THEN ASM_REWRITE_TAC[]; (DISCH_TAC); TYPIFY `cstab <= dist(v p,v(p+2))` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `cstab < d` (C INTRO_TAC [`p`;`p+2`]); ANTS_TAC; REWRITE_TAC[arith `p+2 = SUC(SUC (p))`]; MATCH_MP_TAC Tfitskc.SCS_DIAG_2; BY(NUM_REDUCE_TAC); BY(REAL_ARITH_TAC); INTRO_TAC (UNDISCH2 LINDIH_11) [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`dist(v(p+1),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 1)) /\ norm (v (p + 1)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ (&2 <= dist (v (p + 1),v (p + 2)) /\ dist (v (p + 1),v (p + 2)) <= &2) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.55) /\ &2 * h0 <= dist (v p,v (p + 1)) /\ dist (v p,v (p + 1)) <= #3.01` (C SUBGOAL_THEN ASSUME_TAC); ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`]; nCONJ_TAC 2; TYPIFY `scs_a_v39 s p (p+1) <= dist(v p,v(p+1)) ` ENOUGH_TO_SHOW_TAC; MATCH_MP_TAC (arith `a = b ==> (a <= d ==> b <= d)`); BY(ASM_REWRITE_TAC[]); BY(ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; ONCE_REWRITE_TAC[DIST_SYM]; ASM_REWRITE_TAC[]; BY(FIRST_X_ASSUM_ST `#3.55` MP_TAC THEN REAL_ARITH_TAC); FIRST_ASSUM (unlist REWRITE_TAC); REWRITE_TAC[DE_MORGAN_THM]; CONJ2_TAC; REWRITE_TAC[arith `~(d < &0) <=> &0 <= d`]; BY(REWRITE_TAC[REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos]); (DISCH_TAC); COMMENT "5550"; INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5550839403 delta") [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 3)) /\ norm (v (p + 3)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ ( #3.01 <= cstab /\ cstab <= #3.01) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.55) /\ &2 <= dist (v p,v (p + 3)) /\ dist (v p,v (p + 3)) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`]; CONJ_TAC; FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`0`;`3`]); BY(REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN MATCH_MP_TAC THEN NUM_REDUCE_TAC); BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); FIRST_ASSUM (unlist REWRITE_TAC); DISCH_TAC; INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5550839403") [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`]; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; FIRST_X_ASSUM_ST `#3.01` (unlist REWRITE_TAC); DISCH_TAC; INTRO_TAC Ocbicby.dih_y_mono [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`dist(v (p+3),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`;`cstab`]; ANTS_TAC; TYPIFY_GOAL_THEN `&0 < norm (v p)` (unlist REWRITE_TAC); BY(ASM_REWRITE_TAC[arith `&0 < &2`]); FIRST_X_ASSUM_ST `norm (v p) = &2` kill; ASM_REWRITE_TAC[]; CONJ_TAC; BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); CONJ_TAC; FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`3`;`2`]); BY(NUM_REDUCE_TAC THEN REAL_ARITH_TAC); CONJ2_TAC; BY(FIRST_X_ASSUM_ST `delta_y` MP_TAC THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`p+3`]); ANTS_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[arith `(p+3) +i = p+(3+i)`] THEN NUM_REDUCE_TAC; REWRITE_TAC[Oxlzlez.coplanar_delta_y]; ASM_REWRITE_TAC[DIST_SYM;DIST_0]; MATCH_MP_TAC (arith `a = b ==> &0 < a ==> &0 < b`); BY(MESON_TAC[Merge_ineq.delta_y_sym]); (DISCH_TAC); TYPIFY `dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 3),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3))) + dih_y (norm (v p)) (norm (v (p + 1))) (norm (v (p + 2))) (dist (v (p + 1),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 1))) < #3.1` (C SUBGOAL_THEN ASSUME_TAC); BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); TYPIFY `#3.1 < pi` (C SUBGOAL_THEN ASSUME_TAC); BY(MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `a = pi` MP_TAC THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC); REWRITE_TAC[DIST_0;DIST_SYM]; TYPIFY `dih_y (norm (v p)) (norm (v (p + 2))) (norm (v (p + 3))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 3))) (dist (v p,v (p + 2))) = dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3)))` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[Nonlinear_lemma.dih_y_sym]); BY(REAL_ARITH_TAC) ]);; (* }}} *) end;;