(* ========================================================================== *)
(* FLYSPECK - BOOK FORMALIZATION                                              *)
(*                                                                            *)
(* Chapter: Packing                                                           *)
(* Lemma: OXLZLEZ                                                             *)
(* Author: Thomas C. Hales                                                    *)
(* Date: 2012-12-31                                                           *)
(* ========================================================================== *)

(* Combine all the OXLZLEZ lemmas into the final result *)

(*
When NQT finishes the cell cluster inequality section, this needs to be combined
 with CELL_CLUSTER_ESTIMATE_PROPS to give OXLZLEZ

*)

(*
let WELLDEFINED_FUNCTION_3 = prove_by_refinement(
  `!(f:C -> A->B) (s:C->A->bool) b. (!x i j. s x i /\ s x j ==> (f x i = f x j)) ==>
   (?(g:C -> B). (!x. s x = {} ==> g x = b) /\ (!x i. s x i ==> g x = f x i))`,
  (* {{{ proof *)
  [
  REPEAT WEAK_STRIP_TAC;
  TYPED_ABBREV_TAC `(g:C->B) = \x. if (s x = {}) then b else (f x (@i. (s x i)))` ;
  TYPIFY `g` EXISTS_TAC;
  CONJ_TAC;
    REPEAT WEAK_STRIP_TAC;
    EXPAND_TAC "g";
    BY(ASM_REWRITE_TAC[]);
  REPEAT WEAK_STRIP_TAC;
  EXPAND_TAC "g";
  COND_CASES_TAC;
    BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]);
  SELECT_TAC;
    FIRST_X_ASSUM MATCH_MP_TAC;
    BY(ASM_REWRITE_TAC[]);
  BY(ASM_MESON_TAC[])
  ]);;
  (* }}} *)

let S_LEAF_FINITE = `!V ul.  packing V ==> FINITE (s_leaf V ul)`;;

let cc1 = `!V u0 u1 p n. saturated V /\ packing V /\ (n  = CARD (s_leaf V [u0;u1])) ==>
    (?f.  IMAGE f (:num) = s_leaf V [u0;u1] /\ (!i. f (i + n) = f i) /\
	(!i j. (i < j /\ j < n) ==> azim u0 u1 p (f i) < azim u0 u1 p (f j)))`;;

*)

module Oxlzlez = struct


open Hales_tactic;;
open Leaf_cell;;

parse_as_infix("<<",(18,"right"));;

(* DEFINITIONS *)

let s_leaf = new_definition `s_leaf V ul u <=>  
    (leaf V [EL 0 ul;EL 1 ul;u] /\ (cc_ke V [EL 0 ul; EL 1 ul; u] = 4 \/ cc_ke V [EL 1 ul;EL 0 ul;u]  = 4))`;;
let gg_mcell = new_definition `gg_mcell V f u0 u1 i = 
  sum 
 { X | mcell_set V X /\ {u0,u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i))}
  (\X.  gammaX V X lmfun * critical_weight V X + beta_bump_v1 V {u0,u1} X)`;;
let azim_mcell = new_definition `azim_mcell V f u0 u1 i = 
  sum  { X | mcell_set V X /\ {u0,u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i))}
  (\X. dihX V X (u0,u1))`;;
let cc_data_v8 = new_definition `cc_data_v8 V f u0 u1 = 
cc_v11 ([
  (azim_mcell V f u0 u1);
  (gg_mcell V f u0 u1);
  (\i. gammaX V (cc_cell V [u0;u1;f i]) lmfun * critical_weight V (cc_cell V [u0;u1;f i]));
  (\i. gammaX V (cc_cell V [u1;u0;f (SUC i)]) lmfun * critical_weight V (cc_cell V [u1;u0;f (SUC i)]))
],
[
(\i. dist(f i,f(SUC i)) < &2 * hminus);
(\i. &2 * hminus <= dist (f i, f (SUC i)) /\ dist (f i,f(SUC i)) <= &2 * hplus);
(\i. &2 * hplus < dist (f i, f(SUC i)));
(\i. dist(u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus);
(\i. hl [u0;u1;f i] < #1.34);
(\i. ?ul. barV V 3 ul /\ {u0,u1} IN edgeX V (mcell4 V ul) /\ mcell4 V ul SUBSET (wedge_ge u0 u1 (f i) (f (SUC i))))
],
CARD (s_leaf V [u0;u1]))`;;
let leaf_rank = new_definition `!V ul w0 n f. leaf_rank V ul w0 n f = 
   (IMAGE f (:num) = s_leaf V ul /\
                  (!i. f (i + n) = f i) /\
                  (!i j.
                       i < n /\ j < n /\ i < j
                       ==> azim (EL 0 ul) (EL 1 ul) w0 (f i) <
                           azim (EL 0 ul) (EL 1 ul) w0 (f j)))`;;
let cc_4 = new_definition `cc_4 V u0 u1 f i = (?ul. barV V 3 ul /\
            {u0, u1} IN edgeX V (mcell4 V ul) /\
            mcell4 V ul SUBSET wedge_ge u0 u1 (f i) (f (SUC i)))`;;
(* GENERIC RESULTS *)
let CARD_INSERT_INTER = 
prove_by_refinement( `!(a:A) A B. FINITE B ==> CARD((a INSERT A) INTER B) = if (a IN B /\ ~(a IN A)) then SUC(CARD (A INTER B)) else CARD(A INTER B)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; COND_CASES_TAC; ASM_REWRITE_TAC[INSERT_INTER]; GMATCH_SIMP_TAC (CONJUNCT2 CARD_CLAUSES); ASM_REWRITE_TAC[IN_INTER]; BY(ASM_MESON_TAC[FINITE_INTER]); FIRST_X_ASSUM MP_TAC; REWRITE_TAC[DE_MORGAN_THM]; DISCH_THEN DISJ_CASES_TAC; BY(ASM_REWRITE_TAC[INSERT_INTER]); ASM_REWRITE_TAC[INSERT_INTER]; COND_CASES_TAC; GMATCH_SIMP_TAC (CONJUNCT2 CARD_CLAUSES); ASM_REWRITE_TAC[IN_INTER]; BY(ASM_MESON_TAC[FINITE_INTER]); BY(REWRITE_TAC[]) ]);;
(* }}} *)
let CARD_INSERT_INTER_ALT = 
prove_by_refinement( `!(a:A) A B. FINITE B ==> CARD((a INSERT A) INTER B) = (if (a IN B /\ ~(a IN A)) then 1 else 0) + CARD(A INTER B)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; ASM_SIMP_TAC [CARD_INSERT_INTER]; COND_CASES_TAC; BY(REWRITE_TAC[arith `1 + x = SUC x`]); BY(REWRITE_TAC[arith `0 + x = x`]) ]);;
(* }}} *)
let NUMSEG_LT = 
prove_by_refinement( `!r. ~(r = 0) ==> (0.. (r - 1)) = {i | i < r}`,
(* {{{ proof *) [ REWRITE_TAC[EXTENSION;IN_NUMSEG;IN_ELIM_THM]; BY(ARITH_TAC) ]);;
(* }}} *)
let CARD4_IN_PAIRS = 
prove_by_refinement( `!(a:A) b c d e f. CARD {a,b,c,d} = 4 /\ {a,b,c,d} = {a,b,e,f} ==> {c,d} = {e,f}`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; MATCH_MP_TAC Leaf_cell.LENGTH4_SET2; REWRITE_TAC[set_of_list]; BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let initial_sublist_cons = 
prove_by_refinement( `!(a:A) b x y. initial_sublist (CONS a x) (CONS b y) <=> (a = b) /\ initial_sublist x y`,
(* {{{ proof *) [ REWRITE_TAC[Sphere.INITIAL_SUBLIST]; REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[APPEND]; REWRITE_TAC[CONS_11]; BY(MESON_TAC[]) ]);;
(* }}} *)
let COPLANAR_CONVEX_HULL_COPLANAR = 
prove_by_refinement( `!(s:real^A->bool). coplanar (convex hull s) <=> coplanar s`,
(* {{{ proof *) [ ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]; GEN_TAC; BY(REWRITE_TAC[AFFINE_HULL_CONVEX_HULL]) ]);;
(* }}} *) (* let STRICT_TOPOLOGICAL_SORT = prove_by_refinement( `!((<<):(A->A->bool)). (!x y. ~(x << y /\ y << x)) /\ (!x y. ~(x << y) ==> (x = y) \/ (y << x)) /\ (!x y z. x << y /\ y << z ==> x << z) ==> (!n s. s HAS_SIZE n ==> (?f. s = IMAGE f (1..n) /\ (!j k. j IN 1..n /\ k IN 1..n /\ j < k ==> (f j << f k))))`, (* {{{ proof *) [ REPEAT WEAK_STRIP_TAC; INTRO_TAC TOPOLOGICAL_SORT [`\x y. (x = y) \/ ( x << y)`]; BETA_TAC; ANTS_TAC; BY(ASM_MESON_TAC[]); REPEAT WEAK_STRIP_TAC; FIRST_X_ASSUM (C INTRO_TAC [`n`;`s`]); ASM_REWRITE_TAC[]; REPEAT WEAK_STRIP_TAC; TYPIFY `f` EXISTS_TAC; ASM_REWRITE_TAC[]; REPEAT WEAK_STRIP_TAC; BY(ASM_MESON_TAC[]) ]);; (* }}} *) *)
let BARV3_SET_OF_LIST4 = 
prove_by_refinement( `!V ul. packing V /\ barV V 3 ul ==> set_of_list ul = {EL 0 ul,EL 1 ul, EL 2 ul, EL 3 ul}`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC Bump.set_of_list4 [`ul`]; ANTS_TAC; REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; BY(ASM_MESON_TAC[]); BY(MESON_TAC[]) ]);;
(* }}} *)
let STRICT_SORT_FINITE = 
prove_by_refinement( `!((<<):(A->A->bool)) s n. (!x y. x IN s /\ y IN s /\ x << y /\ y << x ==> x = y) /\ (!x y z. x IN s /\ y IN s /\ z IN s /\ x << y /\ y << z ==> x << z) /\ s HAS_SIZE n ==> (?f. s = IMAGE f (1..n) /\ (!j k. j IN 1..n /\ k IN 1..n /\ j < k ==> ~(f k << f j)))`,
(* {{{ proof *) [ REPEAT WEAK_STRIP_TAC; INTRO_TAC TOPOLOGICAL_SORT [`\x y. x IN s /\ y IN s /\ ((x = y) \/ x << y)`]; BETA_TAC; ANTS_TAC; BY(ASM_MESON_TAC[]); REPEAT WEAK_STRIP_TAC; FIRST_X_ASSUM (C INTRO_TAC [`n`;`s`]); ASM_REWRITE_TAC[]; REPEAT WEAK_STRIP_TAC; TYPIFY `f` EXISTS_TAC; ASM_REWRITE_TAC[]; REPEAT WEAK_STRIP_TAC; TYPIFY `f j IN s /\ f k IN s` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `IMAGE` MP_TAC; REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM]; BY(ASM_MESON_TAC[]); BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let MOD_INJ1_ALT = 
prove_by_refinement (`!k n. ~( n = 0) /\ k < n /\ ~( k = 0) ==> (! x. ~( x MOD n = (x + k) MOD n)) `,
[ REPEAT STRIP_TAC; INTRO_TAC Oxl_def.MOD_INJ [`n`;`x`;`x`;`x + (k:num)`]; ANTS_TAC; ASM_REWRITE_TAC[IN_NUMSEG]; REPEAT (FIRST_X_ASSUM MP_TAC); SIMP_TAC[LE_REFL; ARITH_RULE` ~( n = 0) ==> x <= n - 1 + x `; ARITH_RULE` a <= a + x:num `]; BY(ARITH_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC) ]);;
let MOD_PERIOD_BOUNDED_ALT = 
prove_by_refinement ( `!k n. ~( n = 0) /\ ~( k = 0) ==> (! x. (x + k) MOD n = x MOD n ==> n <= k ) `,
[ REPEAT STRIP_TAC; PROOF_BY_CONTR_TAC; INTRO_TAC MOD_INJ1_ALT [`k`;`n`]; ANTS_TAC; BY(ASM_REWRITE_TAC[ARITH_RULE` a < (b:num) <=> ~(b <= a ) `]); BY(ASM_MESON_TAC[]) ]);;
let MOD_REFL_ALT = REWRITE_RULE[MULT_CLAUSES] (SPECL [`m:num `;`1`] MOD_MULT);;
let periodic_o = 
prove_by_refinement( `!(g:A->B) f n. periodic f n ==> periodic (g o f) n`,
(* {{{ proof *) [ REWRITE_TAC[Oxl_def.periodic;o_DEF]; BY(MESON_TAC[]) ]);;
(* }}} *)
let periodic_shift = 
prove_by_refinement( `!k (f:num->A) n. periodic f n ==> (periodic (\i. f (i + k)) n)`,
(* {{{ proof *) [ REWRITE_TAC[Oxl_def.periodic]; REPEAT WEAKER_STRIP_TAC; TYPIFY `(i + n) + (k:num) = (i + k) + n` (C SUBGOAL_THEN SUBST1_TAC); BY(ARITH_TAC); BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let PERIODIC_IMAGE = 
prove_by_refinement( `!f n. ~(n = 0) /\ periodic (f:num->A) n ==> IMAGE f {i | i < n} = IMAGE f (:num)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[EXTENSION;IN_IMAGE;IN_UNIV;IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[Geomdetail.EQ_EXPAND]; CONJ_TAC; REPEAT WEAKER_STRIP_TAC; BY(ASM_MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; TYPIFY `x' MOD n` EXISTS_TAC; ASM_REWRITE_TAC[]; ASM_SIMP_TAC[GSYM Oxl_def.periodic_mod]; BY(ASM_MESON_TAC[DIVISION]) ]);;
(* }}} *)
let PERIODIC_REDUCE_MOD = 
prove_by_refinement( `!(f:num->A) n i. 1 <= n /\ periodic f n ==> (?j. j < n /\ f i = f j /\ f (SUC i) = f (SUC j))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `i MOD n` EXISTS_TAC; TYPIFY `~(n=0)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); ASM_SIMP_TAC[DIVISION]; ASM_SIMP_TAC[GSYM Oxl_def.periodic_mod]; BY(ASM_MESON_TAC[Hypermap.lemma_suc_mod;Oxl_def.periodic_mod]) ]);;
(* }}} *) (* renamed from PERIODIC_INJ *)
let PERIODIC_EQ_IMAGE = 
prove_by_refinement( `!(f:num->A) n i j. ~(n=0) /\ periodic f n /\ (i MOD n = j MOD n) ==> (f i = f j)`,
(* {{{ proof *) [ BY(ASM_MESON_TAC[Oxl_def.periodic_mod]) ]);;
(* }}} *)
let F_SUC_PRE = 
prove_by_refinement( `!(f:num->A) n i. ~(n = 0) /\ periodic f n ==> f (SUC (i + n - 1)) = f i`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC PERIODIC_EQ_IMAGE; EXISTS_TAC `n:num`; ASM_REWRITE_TAC[]; ASM_SIMP_TAC[arith `~(n=0) ==> SUC (i + n - 1) = 1 * n + i`]; BY(REWRITE_TAC[MOD_MULT_ADD]) ]);;
(* }}} *)
let F_DEMOD = 
prove_by_refinement( `!f n i. periodic f n /\ 1 < n ==> f (i MOD n) = f i /\ f (SUC (i MOD n)) = f (SUC i)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; MP_TAC (arith `1 < n ==> ~(n =0)`); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; CONJ_TAC; MATCH_MP_TAC PERIODIC_EQ_IMAGE; TYPIFY `n` EXISTS_TAC; BY(ASM_SIMP_TAC[MOD_MOD_REFL]); MATCH_MP_TAC PERIODIC_EQ_IMAGE; TYPIFY `n` EXISTS_TAC; ASM_REWRITE_TAC[]; REWRITE_TAC[arith `SUC x = x + 1`]; BY(ASM_MESON_TAC[MOD_LT;MOD_ADD_MOD]) ]);;
(* }}} *)
let FM_DEMOD = 
prove_by_refinement( `!f n i. periodic f n /\ 1 < n ==> f (i MOD n) = f i /\ f (i MOD n + n - 1) = f (i + n - 1) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; MP_TAC (arith `1 < n ==> ~(n =0)`); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; CONJ_TAC; MATCH_MP_TAC PERIODIC_EQ_IMAGE; TYPIFY `n` EXISTS_TAC; BY(ASM_SIMP_TAC[MOD_MOD_REFL]); MATCH_MP_TAC PERIODIC_EQ_IMAGE; TYPIFY `n` EXISTS_TAC; ASM_REWRITE_TAC[]; TYPIFY `n - 1 < n` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(ASM_MESON_TAC[MOD_LT;MOD_ADD_MOD]) ]);;
(* }}} *)
let NULLSET_AFF_2_1 = 
prove_by_refinement( `!x y z. NULLSET (aff_ge {x,y} {z})`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC NEGLIGIBLE_SUBSET; TYPIFY `affine hull {x,y,z}` EXISTS_TAC; REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]; TYPIFY `{x,y,z} = {x,y} UNION {z}` (C SUBGOAL_THEN SUBST1_TAC); BY(SET_TAC[]); BY(REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]) ]);;
(* }}} *) (* renamed from coplanar_dih_y -> coplanar_delta_y *)
let coplanar_delta_y = 
prove_by_refinement( `!u0 u1 u2 (u3:real^3). ~coplanar {u0, u1, u2, u3} <=> &0 < delta_y (dist (u0,u1)) (dist (u0,u2)) (dist (u0,u3)) (dist (u2,u3)) (dist (u1,u3)) (dist (u1,u2))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC ( Leaf_cell.coplanar_eq_coplanar_alt); REWRITE_TAC[DIMINDEX_3;arith `2 <= 3`]; REWRITE_TAC[REWRITE_RULE[TAUT `(a <=> ~b) <=> (b <=> ~a)`] (Collect_geom2.POS_EQ_NOT_COPLANANR)]; REWRITE_TAC[Merge_ineq.delta_delta_x]; BY(REWRITE_TAC[arith `x pow 2 = x * x`;GSYM Sphere.delta_y]) ]);;
(* }}} *)
let RADV_ETAY = 
prove_by_refinement( `!u0 u1 (u2:real^3). ~collinear {u0,u1,u2} ==> radV {u0,u1,u2} = eta_y (dist(u0,u1)) (dist(u0,u2)) (dist(u1,u2))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC Collect_geom.RADV_FORMULAR [`u2`;`u1`;`u0`]; ASM_REWRITE_TAC[]; TYPIFY `{u2,u1,u0} = {u0,u1,u2}` (C SUBGOAL_THEN SUBST1_TAC); BY(SET_TAC[]); ASM_REWRITE_TAC[]; DISCH_THEN SUBST1_TAC; REWRITE_TAC[Geomdetail.dist3]; BY(MESON_TAC[DIST_SYM]) ]);;
(* }}} *)
let RADV2 = 
prove_by_refinement( `!u (v:real^3). radV {u,v} = inv(&2) * dist(u,v)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC Pack_defs.HL [`[u;v]`]; REWRITE_TAC[set_of_list;Marchal_cells_3.HL_2]; BY(MESON_TAC[]) ]);;
(* }}} *)
let GDRQXLGv3 = 
prove_by_refinement( `!(v0:real^3) v1 v2 v3. (let s = {v0,v1,v2,v3} in let x1 = dist (v0,v1) pow 2 in let x2 = dist (v0,v2) pow 2 in let x3 = dist (v0,v3) pow 2 in let x4 = dist (v2,v3) pow 2 in let x5 = dist (v1,v3) pow 2 in let x6 = dist (v1,v2) pow 2 in ~coplanar s ==> radV s pow 2 = rad2_x x1 x2 x3 x4 x5 x6)`,
(* {{{ proof *) [ REWRITE_TAC[LET_DEF;LET_END_DEF]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC Merge_ineq.GDRQXLGv2 [`v0`;`v1`;`v2`;`v3`]; REWRITE_TAC[LET_DEF;LET_END_DEF]; DISCH_THEN MATCH_MP_TAC; TYPIFY `coplanar {v0,v1,v2,v3} = coplanar_alt{v0,v1,v2,v3}` (C SUBGOAL_THEN MP_TAC); MATCH_MP_TAC Leaf_cell.coplanar_eq_coplanar_alt; BY(ASM_REWRITE_TAC[DIMINDEX_3;arith `2 <= 3`]); ASM_REWRITE_TAC[]; DISCH_TAC; BY(ASM_MESON_TAC[Collect_geom2.NOT_COPLANAR_IMP_CARD4]) ]);;
(* }}} *)
let DIST_IMP_COLLINEAR = 
prove_by_refinement( `!(u0:real^3) u1 u2. &2 <= dist(u0,u1) /\ &2 <= dist(u0,u2) /\ &2 <= dist(u1,u2) /\ dist(u0,u1) < &4 /\ dist(u0,u2) < &4 /\ dist(u1,u2) < &4 ==> ~collinear{u0,u1,u2}`,
(* {{{ proof *) [ REWRITE_TAC[Collect_geom.COL_EQ_UPS_0;Trigonometry2.UPS_X_AND_HERON]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC; REWRITE_TAC[]; MATCH_MP_TAC (arith `&0 < x ==> ~(x = &0)`); GMATCH_SIMP_TAC REAL_LT_MUL_EQ; GMATCH_SIMP_TAC REAL_LT_MUL_EQ; GMATCH_SIMP_TAC REAL_LT_MUL_EQ; ASM_SIMP_TAC[arith `&2 <= x /\ &2 <= y /\ &2 <= z ==> &0 < x + y + z`]; TYPIFY `!x y z. &2 <= x /\ &2 <= y /\ z < &4 ==> &0 < x + y - z` ENOUGH_TO_SHOW_TAC; BY(ASM_MESON_TAC[]); BY(REAL_ARITH_TAC) ]);;
(* }}} *)
let UPS_X8_POS = 
prove_by_refinement( `!y5 y6. &2 <= y5 /\ y5 < &4 /\ &2 <= y6 /\ y6 < &4 ==> &0 < ups_x (&8) (y5 * y5) (y6 * y6)`,
(* {{{ proof *) [ REWRITE_TAC[GSYM Nonlinear_lemma.sqrt8_2;arith `&8 = #8.0`]; REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC Merge_ineq.TRI_UPS_X_STRICT_POS; MP_TAC Flyspeck_constants.bounds; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) ]);;
(* }}} *)
let DIST_IMP_UPS_X_POS = 
prove_by_refinement( `!(u0:real^3) u1 u2. &2 <= dist(u0,u1) /\ &2 <= dist(u0,u2) /\ &2 <= dist(u1,u2) /\ dist(u0,u1) < &4 /\ dist(u0,u2) < &4 /\ dist(u1,u2) < &4 ==> &0 < ups_x (dist(u0,u1) pow 2) (dist (u0,u2) pow 2) (dist (u1,u2) pow 2)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[GSYM Collect_geom2.NOT_COL_EQ_UPS_X_POS]; MATCH_MP_TAC DIST_IMP_COLLINEAR; BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *)
let INITIAL_SUBLIST_TRUNCATE = 
prove_by_refinement( `!vl (ul:(real^3)list). LENGTH ul = 4 /\ initial_sublist vl ul /\ ~initial_sublist vl (truncate_simplex 2 ul) ==> (vl = ul)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `ul = [EL 0 ul;EL 1 ul;EL 2 ul;EL 3 ul]` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC Bump.LENGTH4; BY(ASM_REWRITE_TAC[]); PROOF_BY_CONTR_TAC; FIRST_X_ASSUM_ST `initial_sublist` MP_TAC; REWRITE_TAC[]; TYPIFY `truncate_simplex 2 ul = [EL 0 ul;EL 1 ul;EL 2 ul]` (C SUBGOAL_THEN SUBST1_TAC); FIRST_X_ASSUM_ST `EL` SUBST1_TAC; BY(REWRITE_TAC[Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2;Bump.EL_EXPLICIT]); FIRST_X_ASSUM_ST `initial_sublist` MP_TAC; INTRO_TAC Packing3.INITIAL_SUBLIST_APPEND_SING [`vl`;`[EL 0 ul;EL 1 ul;EL 2 ul]`;`EL 3 ul`]; TYPIFY `APPEND [EL 0 ul; EL 1 ul; EL 2 ul] [EL 3 ul] = [EL 0 ul; EL 1 ul; EL 2 ul; EL 3 ul]` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[APPEND]); BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let NOT_COPLANAR_AFF_3 = 
prove_by_refinement( `!(s:real^3->bool). ~coplanar s ==> aff_dim s = &3`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[INT_ARITH `x = int_of_num 3 <=> x <= &3 /\ ~(x <= &2)`]; CONJ2_TAC; BY(ASM_MESON_TAC[Rogers.AFF_DIM_LE_2_IMP_COPLANAR]); BY(MESON_TAC[AFF_DIM_LE_UNIV;DIMINDEX_3]) ]);;
(* }}} *)
let AFF_DEP_COPLANAR = 
prove_by_refinement( `!(a:real^3) b c d. CARD {a,b,c,d} = 4 ==> (affine_dependent {a,b,c,d} <=> coplanar {a,b,c,d})`,
(* {{{ proof *) [ ONCE_REWRITE_TAC[TAUT `(a <=> b) <=> (~a <=> ~b)`]; REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD;FINITE_INSERT;FINITE_EMPTY]; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[INT_ARITH `int_of_num 4 - &1 = &3`]; BY(ASM_MESON_TAC[Leaf_cell.COPLANAR_IMP_AFF_DIM;NOT_COPLANAR_AFF_3;INT_ARITH `x = int_of_num 3 ==> ~(x <= &2)`]) ]);;
(* }}} *)
let HL_IMP_BARV = 
prove_by_refinement( `!V ul. packing V /\ saturated V /\ ~coplanar (set_of_list ul) /\ set_of_list ul SUBSET V /\ hl ul < sqrt(&2) /\ barV V 2 (truncate_simplex 2 ul) /\ LENGTH ul = 4 ==> barV V 3 ul`,
(* {{{ proof *) [ REWRITE_TAC[Sphere.BARV;Sphere.VORONOI_NONDG;arith `2 + 1 = 3`;arith `3 + 1 = 4`]; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; COMMENT "preliminaries";
TYPIFY `initial_sublist vl (truncate_simplex 2 ul)` ASM_CASES_TAC; BY(ASM_MESON_TAC[]); TYPIFY `vl = ul` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC INITIAL_SUBLIST_TRUNCATE; BY(ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[arith `4 < 5`;arith `x + &4 = int_of_num 4 <=> x = &0`]; REWRITE_TAC[AFF_DIM_EQ_0]; TYPIFY `circumcenter (set_of_list ul)` EXISTS_TAC; TYPIFY `!x y. x SUBSET {y} /\ y IN x ==> x = {(y:real^3)}` (C SUBGOAL_THEN MATCH_MP_TAC); BY(SET_TAC[]); TYPIFY `set_of_list ul = {EL 0 ul,EL 1 ul,EL 2 ul,EL 3 ul}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC Bump.set_of_list4; BY(ASM_REWRITE_TAC[]); TYPIFY `~coplanar_alt {EL 0 ul,EL 1 ul,EL 2 ul,EL 3 ul}` (C SUBGOAL_THEN ASSUME_TAC); GMATCH_SIMP_TAC (GSYM Leaf_cell.coplanar_eq_coplanar_alt); BY(ASM_MESON_TAC[DIMINDEX_3;arith `2 <= 3`]); TYPIFY `~affine_dependent {EL 0 ul,EL 1 ul,EL 2 ul,EL 3 ul}` (C SUBGOAL_THEN ASSUME_TAC); GMATCH_SIMP_TAC AFF_DEP_COPLANAR; CONJ2_TAC; BY(ASM_MESON_TAC[]); MATCH_MP_TAC Collect_geom2.NOT_COPLANAR_IMP_CARD4; BY(ASM_REWRITE_TAC[]); CONJ2_TAC; INTRO_TAC Rogers.CIRCUMCENTER_IN_VORONOI_SET [`V`;`set_of_list ul`]; ANTS_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[Pack_defs.HL]); BY(REWRITE_TAC[Sphere.VORONOI_LIST]); REWRITE_TAC[SUBSET;IN_SING]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC Rogers.OAPVION3 [`set_of_list ul`]; ANTS_TAC; BY(ASM_MESON_TAC[]); DISCH_THEN (C INTRO_TAC [`x`]); DISCH_THEN MATCH_MP_TAC; GMATCH_SIMP_TAC Tskajxy.NOT_COPLANAR_R3; CONJ_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[IN_UNIV]; FIRST_X_ASSUM MP_TAC; REWRITE_TAC[Sphere.VORONOI_LIST;Sphere.VORONOI_SET]; REWRITE_TAC[IN_INTERS;IN_ELIM_THM]; DISCH_TAC; TYPIFY `!w. w IN set_of_list ul ==> x IN voronoi_closed V w` (C SUBGOAL_THEN MP_TAC); BY(ASM_MESON_TAC[]); REWRITE_TAC[Sphere.voronoi_closed;IN_ELIM_THM]; DISCH_TAC; TYPIFY `dist(x,EL 0 ul)` EXISTS_TAC; REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC (arith `x <= y /\ y <= x ==> x = y`); CONJ_TAC; FIRST_X_ASSUM (C INTRO_TAC [`w`]); ASM_REWRITE_TAC[]; DISCH_THEN MATCH_MP_TAC; BY(ASM_MESON_TAC[SUBSET;IN;IN_INSERT]); FIRST_X_ASSUM (C INTRO_TAC [`EL 0 ul`]); ANTS_TAC; BY(ASM_MESON_TAC[IN_INSERT]); DISCH_THEN MATCH_MP_TAC; BY(ASM_MESON_TAC[SUBSET;IN]) ]);; (* }}} *)
let EDGE_LE_2RAD = 
prove_by_refinement( `!x1 x2 x3 x4 x5 x6. &0 < delta_x x1 x2 x3 x4 x5 x6 /\ &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ &0 < ups_x x4 x5 x6 ==> x4 <= &4 * rad2_x x1 x2 x3 x4 x5 x6`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC REAL_LE_TRANS; TYPIFY `&4 * eta_x x4 x5 x6 pow 2` EXISTS_TAC; CONJ2_TAC; GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP; CONJ_TAC; BY(REAL_ARITH_TAC); MATCH_MP_TAC Merge_ineq.rad2_x_eta_x; BY(ASM_REWRITE_TAC[]); INTRO_TAC Collect_geom.HVXIKHW [`sqrt x4`;`sqrt x5`;`sqrt x6`]; REWRITE_TAC[Collect_geom.ups_x_pow2]; REWRITE_TAC[Sphere.eta_y;LET_DEF;LET_END_DEF]; REPEAT (GMATCH_SIMP_TAC SQRT_POS_LE); REPEAT (GMATCH_SIMP_TAC Merge_ineq.sqrtpow2); ASM_SIMP_TAC [arith `&0 < x ==> &0 <= x`]; GMATCH_SIMP_TAC REAL_LE_LDIV_EQ; CONJ_TAC; BY(REAL_ARITH_TAC); DISCH_TAC; TYPIFY `x4 = sqrt(x4) pow 2` (C SUBGOAL_THEN MP_TAC); GMATCH_SIMP_TAC SQRT_POW_2; BY(ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]); DISCH_TAC; ASM_SIMP_TAC [arith `x = y ==> (x <= &4 * z <=> y <= &4 * z)`]; TYPIFY `sqrt x4 pow 2 <= (&2 * eta_x x4 x5 x6) pow 2` ENOUGH_TO_SHOW_TAC; BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); MATCH_MP_TAC Collect_geom2.POS_IMP_POW2; CONJ_TAC; GMATCH_SIMP_TAC SQRT_POS_LE; BY(ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]); MATCH_MP_TAC REAL_LE_TRANS; TYPIFY `max_real3 (sqrt x4) (sqrt x5) (sqrt x6)` EXISTS_TAC; ASM_SIMP_TAC[arith `&2 * x = x * &2`]; REWRITE_TAC[Collect_geom.max_real3]; REWRITE_TAC[Misc_defs_and_lemmas.max_real]; BY(REPEAT COND_CASES_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) ]);;
(* }}} *)
let RAD2_Y_SQRT8 = 
prove_by_refinement( `!y1 y2 y3 y5 y6. &2 <= y5 /\ &2 <= y6 /\ y5 < &4 /\ y6 < &4 /\ &0 < delta_y y1 y2 y3 (sqrt8) y5 y6 ==> &2 <= rad2_y y1 y2 y3 (sqrt8) y5 y6`,
(* {{{ proof *) [ REWRITE_TAC[Sphere.rad2_y;Sphere.delta_y;Sphere.y_of_x;Nonlinear_lemma.sqrt8_2;arith `#8.0 = &8`]; REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[arith `&2 <= x <=> &8 <= &4 * x`]; MATCH_MP_TAC EDGE_LE_2RAD; REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); ASM_SIMP_TAC[arith `&0 < &8`;arith `&2 <= x ==> &0 < x`]; MATCH_MP_TAC UPS_X8_POS; BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *) (* renamed from DIH_X_LE_PI *)
let DIH_X_LT_PI = 
prove_by_refinement( `!x1 x2 x3 x4 x5 x6. &0 < x1 /\ &0 < delta_x x1 x2 x3 x4 x5 x6 ==> dih_x x1 x2 x3 x4 x5 x6 < pi`,
(* {{{ proof *) [ REWRITE_TAC[Sphere.dih_x;LET_DEF;LET_END_DEF]; REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[arith `pi / &2 + x < pi <=> x < pi / &2`]; MATCH_MP_TAC Merge_ineq.ATN2_LE_PI2; GMATCH_SIMP_TAC REAL_LT_RSQRT; REWRITE_TAC[arith `&0 pow 2 = &0`]; REWRITE_TAC[arith `&0 < &4 * x <=> &0 < x`]; GMATCH_SIMP_TAC REAL_LT_MUL_EQ; BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *)
let DIH_Y_LT_PI = 
prove_by_refinement( `!y1 y2 y3 y4 y5 y6. &0 < y1 /\ &0 < delta_y y1 y2 y3 y4 y5 y6 ==> dih_y y1 y2 y3 y4 y5 y6 < pi`,
(* {{{ proof *) [ REWRITE_TAC[Sphere.delta_y;Sphere.dih_y;LET_DEF;LET_END_DEF]; REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC DIH_X_LT_PI; ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC REAL_LT_MUL_EQ; BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *)
let DIHV_EQ_0_PI_EQ_COPLANAR_ALT = 
prove_by_refinement( `!(v0:real^3) v1 w1 w2. ~coplanar {v0,v1,w1,w2} ==> ~(dihV v0 v1 w1 w2 = &0)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY` ~collinear {v0,v1,w1} /\ ~collinear{v0,v1,w2}` (C SUBGOAL_THEN ASSUME_TAC); CONJ_TAC THEN MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR; BY(ASM_MESON_TAC[]); TYPIFY `w1` EXISTS_TAC; TYPIFY `{v0,v1,w2,w1} = {v0,v1,w1,w2}` (C SUBGOAL_THEN SUBST1_TAC); BY(SET_TAC[]); BY(ASM_REWRITE_TAC[]); INTRO_TAC DIHV_EQ_0_PI_EQ_COPLANAR [`v0`;`v1`;`w1`;`w2`]; BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let AZIM_ZERO_SHIFT = 
prove_by_refinement( `!u0 u1 u2 w w'. ~collinear {u0,u1,u2} /\ ~collinear {u0,u1,w} /\ ~collinear {u0,u1,w'} ==> (azim u0 u1 u2 w = azim u0 u1 u2 w' <=> azim u0 u1 w w' = &0)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC (TAUT `((a ==> b) /\ (b ==> a)) ==> (a = b)`); CONJ_TAC; REPEAT WEAKER_STRIP_TAC; INTRO_TAC Fan.sum4_azim_fan [`u0`;`u1`;`u2`;`w`;`w'`]; ANTS_TAC; ASM_REWRITE_TAC[]; BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC); DISCH_TAC; INTRO_TAC Fan.sum5_azim_fan [`u0`;`u1`;`u2`;`w`;`w'`]; ANTS_TAC; ASM_REWRITE_TAC[]; BY(REWRITE_TAC[Local_lemmas.AZIM_RANGE]); ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC) ]);;
(* }}} *)
let ORDER_AZIM_SUM2Pi0 = 
prove_by_refinement( `!x y z n g. ~collinear {x, y, z} /\ (!i. i < n ==> ~collinear {x, y, g i}) /\ g n = g 0 /\ 1 < n /\ (!j k. j < n /\ k < n /\ j < k ==> azim x y z (g j) < azim x y z (g k)) ==> sum {i | i < n} (\i. azim x y (g i) (g (i + 1))) = &2 * pi`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC Counting_spheres.ORDER_AZIM_SUM2Pi [`x`;`y`;`z`;`n`;`g o PRE`]; ANTS_TAC; ASM_REWRITE_TAC[o_THM]; REWRITE_TAC[IN_NUMSEG]; CONJ_TAC; REPEAT WEAKER_STRIP_TAC; BY(ASM_MESON_TAC[arith `1 <= i /\ i <= n ==> PRE i < n`]); ASM_REWRITE_TAC[arith `PRE (n + 1) = n /\ PRE 1 = 0`]; REPEAT WEAKER_STRIP_TAC; BY(ASM_MESON_TAC[arith `1 <= i /\ i <= n ==> PRE i < n`;arith `j < k /\ 1 <= j ==> PRE j < PRE k`]); DISCH_THEN (SUBST1_TAC o GSYM); TYPIFY `sum (1..n) (\i. azim x y ((g o PRE) i) ((g o PRE) (i + 1))) = sum (1..n) ((\i. azim x y (g i) (g (i + 1))) o PRE)` (C SUBGOAL_THEN SUBST1_TAC); MATCH_MP_TAC SUM_EQ; REWRITE_TAC[IN_NUMSEG;o_THM]; REPEAT WEAKER_STRIP_TAC; BY(ASM_SIMP_TAC[arith `1 <= x' ==> (PRE (x' + 1) = PRE x' + 1)`]); MATCH_MP_TAC (GSYM Bump.BIJ_SUM); REWRITE_TAC[BIJ;SURJ;INJ;IN_NUMSEG;IN_ELIM_THM]; SUBCONJ_TAC; BY(ARITH_TAC); DISCH_THEN (unlist REWRITE_TAC); REPEAT WEAKER_STRIP_TAC; TYPIFY `SUC x'` EXISTS_TAC; BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC) ]);;
(* }}} *) (* MCELL FUNCTIONS *)
let CRITICAL_WEIGHT_POS_LE = 
prove_by_refinement( `!V X. &0 <= critical_weight V X`,
(* {{{ proof *) [ REWRITE_TAC[Pack_defs.critical_weight]; REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[real_div]; GMATCH_SIMP_TAC REAL_LE_MUL; CONJ_TAC; BY(REAL_ARITH_TAC); REWRITE_TAC[REAL_LE_INV_EQ]; REWRITE_TAC[ REAL_OF_NUM_LE]; BY(ARITH_TAC) ]);;
(* }}} *)
let GAMMAX_NO_BETA = 
prove_by_refinement( `!V ul X e k. packing V /\ saturated V /\ barV V 3 ul /\ X = mcell k V ul /\ ~NULLSET X /\ k < 4 /\ e IN critical_edgeX V X /\ gammaX V X lmfun >= &0 ==> gammaX V X lmfun * critical_weight V X + beta_bump_v1 V e X >= &0`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC Bump.MCELL_BUMP_0 [`V`;`ul`;`e`;`k`]; ANTS_TAC; BY(ASM_MESON_TAC[]); ASM_REWRITE_TAC[]; DISCH_THEN SUBST1_TAC; FIRST_X_ASSUM MP_TAC; ASM_REWRITE_TAC[arith `x + &0 = x /\ (x >= &0 <=> &0 <= x)`]; DISCH_TAC; GMATCH_SIMP_TAC REAL_LE_MUL; BY(ASM_REWRITE_TAC[CRITICAL_WEIGHT_POS_LE]) ]);;
(* }}} *) (* LEAF RESULTS *)
let REUHADY = 
prove_by_refinement( `!V u0 u1 v1 v2. saturated V /\ packing V /\ leaf V [u0;u1;v1] /\ leaf V [u0;u1;v2] /\ ~(v1 =v2) ==> sum {X | mcell_set V X /\ {u0,u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 v1 v2} (\t. dihX V t (u0,u1)) = azim u0 u1 v1 v2`,
(* {{{ proof *) [ REPEAT WEAK_STRIP_TAC; MATCH_MP_TAC Reuhady.REUHADY1; GEXISTL_TAC [`[u0;u1;v1]`;`[u0;u1;v2]`]; TYPIFY `EL 2 [u0;u1;v1] = v1 /\ EL 2 [u0;u1;v2] = v2` (C SUBGOAL_THEN (unlist REWRITE_TAC)); BY(REWRITE_TAC[Bump.EL_EXPLICIT]); TYPIFY `(hl [u0;u1;v1] < sqrt2 /\ hl [u0;u1;v2] < sqrt2 /\ [u0;u1;v1] IN barV V 2 /\ [u0;u1;v2] IN barV V 2) /\ hl [u0;u1] < sqrt(&2)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); SUBCONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.leaf;IN]); REPEAT WEAK_STRIP_TAC; INTRO_TAC Rogers.XNHPWAB4 [`V`;`[u0;u1;v1]`;`2`]; ASM_REWRITE_TAC[GSYM Sphere.sqrt2]; DISCH_THEN (C INTRO_TAC [`1`;`2`]); REWRITE_TAC[arith `1 < 2 /\ 2 <= 2`;Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2;Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_1]; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); ASM_REWRITE_TAC[]; TYPIFY `set_of_list (truncate_simplex 1 [u0; u1; v1]) = {u0, u1} /\ set_of_list (truncate_simplex 1 [u0; u1; v2]) = {u0, u1}` (C SUBGOAL_THEN (unlist REWRITE_TAC)); REWRITE_TAC[Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2;Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_1]; BY(REWRITE_TAC[Bump.set_of_list2_explicit]); TYPIFY `~([u0; u1; v1] = [u0; u1; v2])` (C SUBGOAL_THEN (unlist REWRITE_TAC)); BY(ASM_REWRITE_TAC[CONS_11]); TYPIFY `~collinear {u0,u1,v1} /\ ~collinear {u0,u1,v2}` (C SUBGOAL_THEN ASSUME_TAC); REWRITE_TAC[GSYM Bump.set_of_list3_explicit]; BY(ASM_MESON_TAC[GBEWYFX]); ASM_SIMP_TAC[Leaf_cell.WEDGE_GE_ALMOST_DISJOINT]; TYPIFY `~(u0 = u1)` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); TYPIFY `u0 IN V /\ u1 IN V` (C SUBGOAL_THEN (unlist ASM_REWRITE_TAC)); INTRO_TAC Packing3.BARV_SUBSET [`V`;`2`;`[u0;u1;v1]`]; ANTS_TAC; BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV]); REWRITE_TAC[Bump.set_of_list3_explicit]; BY(SET_TAC[]); SUBCONJ_TAC; ASM_SIMP_TAC[Local_lemmas.AZIM_EQ_0_GE_ALT2]; DISCH_TAC; INTRO_TAC Leaf_cell.FCHKUGT [`V`;`u0`;`u1`;`v1`;`v2`]; ANTS_TAC; ASM_REWRITE_TAC[cc_A0;Bump.EL_EXPLICIT]; MATCH_MP_TAC Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; ASM_REWRITE_TAC[]; FIRST_X_ASSUM MP_TAC; GMATCH_SIMP_TAC Collect_geom.IN_AFF_GE_INTERPRET_TO_AFF_GT_AND_AFF; CONJ_TAC; BY(ASM_SIMP_TAC[Fan.th3a]); REWRITE_TAC[Collect_geom.aff]; TYPIFY `v2 IN affine hull {u0,u1}` ASM_CASES_TAC; FIRST_X_ASSUM (MP_TAC o (MATCH_MP AFFINE_HULL_3_IMP_COLLINEAR)); BY(ASM_MESON_TAC[]); BY(ASM_MESON_TAC[]); BY(ASM_REWRITE_TAC[]); DISCH_TAC; REPEAT WEAK_STRIP_TAC; MATCH_MP_TAC Leaf_cell.EWYBJUA; TYPIFY `V` EXISTS_TAC; BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *)
let s_leaf_leaf = 
prove_by_refinement( `!V ul x. x IN s_leaf V ul ==> leaf V [EL 0 ul;EL 1 ul;x]`,
(* {{{ proof *) [ BY(MESON_TAC[IN;s_leaf]) ]);;
(* }}} *)
let s_leaf_collinear = 
prove_by_refinement( `!V ul x. packing V /\ saturated V /\ x IN s_leaf V ul ==> ~(collinear {EL 0 ul,EL 1 ul,x})`,
(* {{{ proof *) [ REPEAT WEAK_STRIP_TAC; FIRST_X_ASSUM (MP_TAC o (MATCH_MP s_leaf_leaf)); DISCH_TAC; INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[EL 0 ul;EL 1 ul;x]`]; REWRITE_TAC[Bump.set_of_list3_explicit]; BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *)
let LEAF_RANKING_LEMMA = 
prove_by_refinement( `!V ul w0 n. 0 < n /\ packing V /\ saturated V /\ s_leaf V ul HAS_SIZE n /\ ~collinear {EL 0 ul,EL 1 ul,w0} ==> (?f. IMAGE f (:num) = s_leaf V ul /\ (!i. f (i + n) = f i) /\ (!i j. i < n /\ j < n /\ i < j ==> azim (EL 0 ul) (EL 1 ul) w0 (f i) < azim (EL 0 ul) (EL 1 ul) w0 (f j)))`,
(* {{{ proof *) [ REPEAT WEAK_STRIP_TAC; TYPED_ABBREV_TAC `(s:real^3->bool) = s_leaf V ul` ; TYPIFY `!x. x IN s ==> ~(collinear {EL 0 ul,EL 1 ul,x})` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[s_leaf_collinear]); INTRO_TAC STRICT_SORT_FINITE [`\v w. (azim (EL 0 ul) (EL 1 ul) w0 v <= azim (EL 0 ul) (EL 1 ul) w0 w)`;`s`;`n` ]; BETA_TAC; ANTS_TAC; ASM_REWRITE_TAC[]; CONJ2_TAC; BY(REAL_ARITH_TAC); REPEAT WEAK_STRIP_TAC; TYPIFY `azim (EL 0 ul) (EL 1 ul) w0 x = azim (EL 0 ul) (EL 1 ul) w0 y ==> (x = y)` ENOUGH_TO_SHOW_TAC; REPEAT WEAK_STRIP_TAC; FIRST_X_ASSUM MATCH_MP_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); DISCH_TAC; MATCH_MP_TAC Leaf_cell.FCHKUGT; GEXISTL_TAC [`V`;`EL 0 ul`;`EL 1 ul`]; REWRITE_TAC[Leaf_cell.cc_A0]; REWRITE_TAC[Bump.EL_EXPLICIT]; FIRST_ASSUM (C INTRO_TAC [`x`]); FIRST_X_ASSUM (C INTRO_TAC [`y`]); ASM_REWRITE_TAC[]; REPEAT WEAK_STRIP_TAC; FIRST_X_ASSUM_ST `azim` MP_TAC; ASM_SIMP_TAC[AZIM_EQ_ALT]; BY(ASM_MESON_TAC[Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ;s_leaf_leaf]); REPEAT WEAK_STRIP_TAC; TYPIFY `\i. f (SUC (i MOD n))` EXISTS_TAC; BETA_TAC; CONJ2_TAC; CONJ_TAC; REPEAT WEAK_STRIP_TAC; INTRO_TAC MOD_MULT_ADD [`1`;`n`;`i`]; REWRITE_TAC[arith `1 * n + i = i + n`]; DISCH_THEN SUBST1_TAC; BY(REWRITE_TAC[]); REPEAT WEAK_STRIP_TAC; ASM_SIMP_TAC[MOD_LT]; FIRST_X_ASSUM (C INTRO_TAC [`SUC i`;`SUC j`]); REWRITE_TAC[arith `~(a <= b) <=> (b <a)`]; DISCH_THEN MATCH_MP_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC); ASM_REWRITE_TAC[]; REWRITE_TAC[EXTENSION;IMAGE;IN_ELIM_THM;IN_UNIV]; GEN_TAC; MATCH_MP_TAC (TAUT `((a==> b) /\ (b ==> a)) ==> (a = b)`); CONJ_TAC; REPEAT WEAK_STRIP_TAC; TYPIFY `SUC (x' MOD n)` EXISTS_TAC; ASM_REWRITE_TAC[IN_NUMSEG]; REWRITE_TAC[arith `1 <= SUC x`]; REWRITE_TAC[arith `SUC x <= n <=> x < n`]; BY(ASM_MESON_TAC[DIVISION;arith `~(n=0) <=> (0 < n)`]); REPEAT WEAK_STRIP_TAC; ASM_REWRITE_TAC[]; TYPIFY `PRE x'` EXISTS_TAC; AP_TERM_TAC; TYPIFY `PRE x' MOD n = PRE x'` (C SUBGOAL_THEN SUBST1_TAC); MATCH_MP_TAC MOD_LT; FIRST_X_ASSUM_ST `IN` MP_TAC; REWRITE_TAC[IN_NUMSEG]; BY(ARITH_TAC); FIRST_X_ASSUM_ST `IN` MP_TAC; REWRITE_TAC[IN_NUMSEG]; BY(ARITH_TAC) ]);;
(* }}} *)
let S_LEAF_SET = 
prove_by_refinement( `!V ul. s_leaf V ul = { u | leaf V [EL 0 ul; EL 1 ul; u] /\ (cc_ke V [EL 0 ul; EL 1 ul; u] = 4 \/ cc_ke V [EL 1 ul; EL 0 ul; u] = 4)}`,
(* {{{ proof *) [ BY(REWRITE_TAC[EXTENSION;IN_ELIM_THM;s_leaf;IN]) ]);;
(* }}} *) (* renamed from LEAF_RANK_COLLINEAR: *)
let LEAF_RANK_COLLINEAR = 
prove_by_refinement( `!V ul w0 n f k. packing V /\ saturated V /\ leaf_rank V ul w0 n f ==> ~collinear {EL 0 ul,EL 1 ul,f k}`,
(* {{{ proof *) [ REWRITE_TAC[leaf_rank;IMAGE;IN_UNIV;EXTENSION;IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[]; MATCH_MP_TAC s_leaf_collinear; BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let S_LEAF_SUBSET_PACKING = 
prove_by_refinement( `!V ul. packing V /\ saturated V ==> s_leaf V ul SUBSET V`,
(* {{{ proof *) [ REPEAT WEAK_STRIP_TAC; REWRITE_TAC[S_LEAF_SET;leaf;SUBSET;IN_ELIM_THM;IN]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (MP_TAC o (MATCH_MP Packing3.BARV_SUBSET)); REWRITE_TAC[set_of_list]; BY(SET_TAC[]) ]);;
(* }}} *)
let S_LEAF_BOUNDED = 
prove_by_refinement( `!V ul. packing V /\ saturated V ==> s_leaf V ul SUBSET (ball(EL 0 ul, &2 * sqrt(&2) ))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[S_LEAF_SET;SUBSET;IN_ELIM_THM;ball;leaf;IN;Sphere.sqrt2]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC Rogers.HL_PROPERTIES [`V`;`[EL 0 ul;EL 1 ul;x]`;`2`]; ASM_REWRITE_TAC[set_of_list;IN_INSERT]; TYPED_ABBREV_TAC `(d:real^3) = circumcenter {EL 0 ul, EL 1 ul, x}` ; REPEAT WEAKER_STRIP_TAC; PROOF_BY_CONTR_TAC; FIRST_ASSUM (C INTRO_TAC [`EL 0 ul`]); REWRITE_TAC[]; ONCE_REWRITE_TAC[DIST_SYM]; FIRST_X_ASSUM (C INTRO_TAC [`x`]); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC DIST_TRIANGLE [`EL 0 ul`;`d`;`x`]; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) ]);;
(* }}} *)
let S_LEAF_FINITE = 
prove_by_refinement( `!V ul. packing V /\ saturated V ==> FINITE (s_leaf V ul)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC FINITE_SUBSET; TYPIFY `V INTER ball(EL 0 ul, &2 * sqrt(&2))` EXISTS_TAC; CONJ_TAC; MATCH_MP_TAC Packing3.KIUMVTC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[SUBSET_INTER]; BY(ASM_MESON_TAC[S_LEAF_SUBSET_PACKING;S_LEAF_BOUNDED]) ]);;
(* }}} *)
let S_LEAF_SYM = 
prove_by_refinement( `!V u0 u1. packing V /\ saturated V ==> s_leaf V [u1;u0] = s_leaf V [u0;u1]`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[EXTENSION;s_leaf;IN;Bump.EL_EXPLICIT]; BY(ASM_MESON_TAC[Leaf_cell.ZASUVOR]) ]);;
(* }}} *)
let S_LEAF_TRUNCATE = 
prove_by_refinement( `!V ul. s_leaf V ul = s_leaf V [EL 0 ul;EL 1 ul]`,
(* {{{ proof *) [ BY(REWRITE_TAC[EXTENSION;s_leaf;IN;Bump.EL_EXPLICIT]) ]);;
(* }}} *)
let MCELL_AVOID_LEAVES = 
prove_by_refinement( `!V ul X. packing V /\ saturated V /\ ~NULLSET X /\ mcell_set V X ==> ?v. v IN X /\ (!u. u IN s_leaf V ul ==> ~(v IN aff_ge {EL 0 ul,EL 1 ul} {u}))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; PROOF_BY_CONTR_TAC; TYPIFY `X SUBSET UNIONS (IMAGE (\u. aff_ge {EL 0 ul, EL 1 ul} {u}) (s_leaf V ul))` (C SUBGOAL_THEN ASSUME_TAC); REWRITE_TAC[SUBSET;IN_UNIONS;IN_IMAGE]; FIRST_X_ASSUM MP_TAC; BY(SET_TAC[]); FIRST_X_ASSUM_ST `NULLSET` MP_TAC; REWRITE_TAC[]; MATCH_MP_TAC NEGLIGIBLE_SUBSET; TYPIFY `UNIONS (IMAGE (\u. aff_ge {EL 0 ul, EL 1 ul} {u}) (s_leaf V ul))` EXISTS_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC NEGLIGIBLE_UNIONS; CONJ_TAC; MATCH_MP_TAC FINITE_IMAGE; MATCH_MP_TAC S_LEAF_FINITE; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[IN_IMAGE]; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; BY(REWRITE_TAC[NULLSET_AFF_2_1]) ]);;
(* }}} *)
let MCELL_WEDGE_UNIQUE = 
prove_by_refinement( `!V ul w0 n f X. packing V /\ saturated V /\ s_leaf V ul HAS_SIZE n /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ leaf_rank V ul w0 n f /\ mcell_set V X /\ ~NULLSET X /\ {EL 0 ul,EL 1 ul} IN edgeX V X ==> (!i j. i < n /\ j < n /\ X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) /\ X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f j) (f (SUC j)) ==> (i = j))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `n <= 1` ASM_CASES_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); PROOF_BY_CONTR_TAC; TYPIFY `!k. ~collinear {EL 0 ul,EL 1 ul, f k}` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[LEAF_RANK_COLLINEAR]); TYPIFY `wedge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) INTER wedge (EL 0 ul) (EL 1 ul) (f j) (f (SUC j)) = {}` ENOUGH_TO_SHOW_TAC; INTRO_TAC Leaf_cell.WEDGE_WEDGE_GE [`EL 0 ul`;`EL 1 ul`;`f i`;`f (SUC i)`]; ANTS_TAC; BY(ASM_MESON_TAC[]); INTRO_TAC Leaf_cell.WEDGE_WEDGE_GE [`EL 0 ul`;`EL 1 ul`;`f j`;`f (SUC j)`]; ANTS_TAC; BY(ASM_MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; TYPIFY `X SUBSET aff_ge {EL 0 ul, EL 1 ul} {f i} UNION aff_ge {EL 0 ul, EL 1 ul} {f (SUC i)} UNION aff_ge {EL 0 ul,EL 1 ul} {f j} UNION aff_ge {EL 0 ul, EL 1 ul} { f (SUC j)}` (C SUBGOAL_THEN ASSUME_TAC); REPEAT (FIRST_X_ASSUM MP_TAC); BY(SET_TAC[]); BY(ASM_MESON_TAC[NEGLIGIBLE_UNION;NEGLIGIBLE_SUBSET;NULLSET_AFF_2_1]); INTRO_TAC Counting_spheres.WEDGE_ORDER_DISJOINT [`EL 0 ul`;`EL 1 ul`;`w0`;`n`;`f o PRE`]; REWRITE_TAC[o_THM]; ANTS_TAC; ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank]; REWRITE_TAC[arith `PRE (n+1) = n /\ PRE 1 = 0`]; REPEAT WEAKER_STRIP_TAC; CONJ_TAC; BY(ASM_MESON_TAC[arith `0 + n = n`]); REWRITE_TAC[IN_NUMSEG]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MATCH_MP_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); DISCH_THEN (C INTRO_TAC [`SUC i`;`SUC j`]); ASM_REWRITE_TAC[IN_NUMSEG;arith `1 <= SUC l`;arith `SUC i = SUC j <=> i = j`;arith `PRE (SUC i) = i`;arith `PRE(SUC i + 1) = SUC i`]; DISCH_THEN MATCH_MP_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC) ]);;
(* }}} *)
let LEAF_RANK_PERIODIC = 
prove_by_refinement( `!V ul w0 n f. leaf_rank V ul w0 n f ==> periodic f n`,
(* {{{ proof *) [ BY(MESON_TAC[leaf_rank;Oxl_def.periodic]) ]);;
(* }}} *)
let LEAF_RANK_AZIM_INJ = 
prove_by_refinement( `!V ul w0 n f i j. saturated V /\ packing V /\ ~(n=0) /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ leaf_rank V ul w0 n f ==> ( azim (EL 0 ul) (EL 1 ul) (f i) (f j) = &0 <=> ((i MOD n) = (j MOD n)))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `!j. f j IN s_leaf V ul` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank;EXTENSION;IN_IMAGE;IN_UNIV]; BY(MESON_TAC[]); TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC s_leaf_leaf; BY(ASM_REWRITE_TAC[]); TYPIFY `!j. ~collinear {EL 0 ul, EL 1 ul, f j}` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[EL 0 ul;EL 1 ul; f j]`]; BY(ASM_REWRITE_TAC[set_of_list]); INTRO_TAC AZIM_ZERO_SHIFT [`EL 0 ul`;`EL 1 ul`;`w0`]; DISCH_THEN ((unlist ASM_SIMP_TAC) o GSYM); TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC LEAF_RANK_PERIODIC; BY(ASM_MESON_TAC[]); TYPIFY `!k. f k = f (k MOD n)` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Oxl_def.periodic_mod]); ONCE_REWRITE_TAC[Geomdetail.EQ_EXPAND]; CONJ2_TAC; BY(ASM_MESON_TAC[]); DISCH_TAC; PROOF_BY_CONTR_TAC; FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank]; REPEAT WEAKER_STRIP_TAC; TYPIFY `!k. k MOD n < n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[DIVISION]); TYPIFY `i MOD n < j MOD n` ASM_CASES_TAC; BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); TYPIFY `j MOD n < i MOD n` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM MP_TAC; REWRITE_TAC[arith `~((i:num) < j) <=> (j < i \/ (i = j))`]; BY(ASM_REWRITE_TAC[]); FIRST_X_ASSUM (C INTRO_TAC [`j MOD n`;`i MOD n`]); ANTS_TAC; BY(ASM_MESON_TAC[]); BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]) ]);;
(* }}} *)
let LEAF_RANK_AZIM_NZ = 
prove_by_refinement( `!V ul w0 n f i. saturated V /\ packing V /\ leaf_rank V ul w0 n f /\ 1 < n /\ ~collinear {EL 0 ul, EL 1 ul,w0} ==> ~(azim (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) = &0)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`ul`;`w0`;`n`;`f`;`i`;`SUC i`]; ASM_REWRITE_TAC[]; ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`]; BY(ASM_MESON_TAC[arith `SUC i = i + 1`;arith `1 < n ==> ~(n = 0)`;arith `~(1 = 0)`;arith `1 < n ==> ~(n <= 1)`;MOD_PERIOD_BOUNDED_ALT]) ]);;
(* }}} *)
let MCELL_IN_WEDGE = 
prove_by_refinement( `!V ul w0 n f X. 1 < n /\ packing V /\ saturated V /\ s_leaf V ul HAS_SIZE n /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ leaf_rank V ul w0 n f /\ mcell_set V X /\ ~NULLSET X /\ {EL 0 ul,EL 1 ul} IN edgeX V X ==> ?i. i < n /\ X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC MCELL_AVOID_LEAVES [`V`;`ul`;`X`]; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; TYPIFY `!j. f j IN s_leaf V ul` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank;EXTENSION;IN_IMAGE;IN_UNIV]; BY(MESON_TAC[]); TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC s_leaf_leaf; BY(ASM_REWRITE_TAC[]); TYPIFY `!j. ~collinear {EL 0 ul, EL 1 ul, f j}` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[EL 0 ul;EL 1 ul; f j]`]; BY(ASM_REWRITE_TAC[set_of_list]); COMMENT "reduce to v in wedge";
TYPIFY `?i. i < n /\ v IN wedge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))` ENOUGH_TO_SHOW_TAC; REPEAT WEAKER_STRIP_TAC; TYPIFY `i` EXISTS_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC Leaf_cell.BDXKHTW; TYPIFY `V` EXISTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; BY(ASM_MESON_TAC[IN]); CONJ2_TAC; REWRITE_TAC[IN_INTER]; BY(ASM_MESON_TAC[]); MATCH_MP_TAC LEAF_RANK_AZIM_NZ; BY(ASM_MESON_TAC[]); COMMENT "try top piece"; TYPIFY `v IN wedge (EL 0 ul) (EL 1 ul) (f (PRE n)) (f 0)` ASM_CASES_TAC; TYPIFY `PRE n` EXISTS_TAC; CONJ_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); TYPIFY `f (SUC (PRE n)) = f 0` ENOUGH_TO_SHOW_TAC; DISCH_THEN SUBST1_TAC; BY(ASM_REWRITE_TAC[]); FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM kill; FIRST_X_ASSUM (C INTRO_TAC [`0`]); TYPIFY `SUC (PRE n) = n` (C SUBGOAL_THEN SUBST1_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REWRITE_TAC[arith `0 + n = n`]); INTRO_TAC Leaf_cell.WEDGE_COMPLEMENT [`EL 0 ul`;`EL 1 ul`;`f (PRE n)`;`f 0`]; ANTS_TAC; GMATCH_SIMP_TAC LEAF_RANK_AZIM_INJ; TYPIFY `n` EXISTS_TAC; CONJ_TAC; BY(ASM_MESON_TAC[arith `1 < n ==> ~(n = 0)`]); ASM_SIMP_TAC[MOD_0;arith `1 < n ==> ~(n=0)`]; TYPIFY `PRE n MOD n = PRE n` (C SUBGOAL_THEN SUBST1_TAC); MATCH_MP_TAC MOD_LT; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); REWRITE_TAC[EXTENSION;IN_UNIV;IN_DIFF]; DISCH_THEN (C INTRO_TAC [`v`]); ASM_REWRITE_TAC[]; REWRITE_TAC[Local_lemmas.WEDGE_GE_AZIM_LE]; DISCH_TAC; TYPED_ABBREV_TAC `(A:num->bool) = {i | i < n /\ azim (EL 0 ul) (EL 1 ul) (f 0) (f i) < azim (EL 0 ul) (EL 1 ul) (f 0) v }` ; TYPIFY `0 IN A` (C SUBGOAL_THEN ASSUME_TAC); EXPAND_TAC "A"; REWRITE_TAC[IN_ELIM_THM;AZIM_REFL]; CONJ_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); PROOF_BY_CONTR_TAC; TYPIFY `azim (EL 0 ul) (EL 1 ul) (f 0) v = &0` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC (arith `~(&0 < x) /\ (&0 <= x) ==> (x = &0)`); BY(ASM_REWRITE_TAC[Local_lemmas.AZIM_RANGE]); BY(ASM_MESON_TAC[Local_lemmas.AZIM_EQ_0_GE_ALT2]); INTRO_TAC num_MAX [`A`]; DISCH_THEN (MP_TAC o MATCH_MP (TAUT `(a <=> b) ==> (a ==> b)`)); ANTS_TAC; CONJ_TAC; BY(ASM_MESON_TAC[IN]); TYPIFY `n` EXISTS_TAC; EXPAND_TAC "A"; REWRITE_TAC[IN_ELIM_THM]; BY(ARITH_TAC); REPEAT WEAKER_STRIP_TAC; TYPIFY `m` EXISTS_TAC; TYPIFY `m < n /\ azim (EL 0 ul) (EL 1 ul) (f 0) (f m) < azim (EL 0 ul) (EL 1 ul) (f 0) v` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM kill; FIRST_X_ASSUM MP_TAC; EXPAND_TAC "A"; BY(REWRITE_TAC[IN_ELIM_THM]); ASM_REWRITE_TAC[]; REWRITE_TAC[Reuhady.WEDGE_SIMPLE;IN_ELIM_THM]; COMMENT "v not collinear"; TYPIFY `~(EL 0 ul= EL 1 ul)` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); TYPIFY `~collinear {EL 0 ul,EL 1 ul,v}` (C SUBGOAL_THEN ASSUME_TAC); ASM_SIMP_TAC[COLLINEAR_3_AFFINE_HULL]; DISCH_TAC; FIRST_X_ASSUM_ST `aff_ge` (C INTRO_TAC [`f 0`]); ASM_SIMP_TAC[]; TYPIFY `affine hull {EL 0 ul,EL 1 ul} SUBSET aff_ge {EL 0 ul,EL 1 ul} {f 0}` ENOUGH_TO_SHOW_TAC; FIRST_X_ASSUM MP_TAC; BY(SET_TAC[]); MATCH_MP_TAC AFFINE_HULL_SUBSET_AFF_GE; MATCH_MP_TAC Fan.th3a; BY(ASM_MESON_TAC[]); COMMENT "do azim shifts"; CONJ_TAC; INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`f 0 `;`f m`;`f m`;`v`]; ANTS_TAC; ASM_SIMP_TAC[]; BY(ASM_SIMP_TAC[arith `x <= x`;arith `x < y ==> x <= y`]); REWRITE_TAC[AZIM_REFL]; BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); COMMENT "second azim ineq"; TYPIFY `SUC m < n` (C SUBGOAL_THEN ASSUME_TAC); TYPIFY `~(m= PRE n)` ENOUGH_TO_SHOW_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); DISCH_TAC; REPEAT (FIRST_X_ASSUM_ST `azim` MP_TAC); ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC); TYPIFY `~(SUC m IN A)` (C SUBGOAL_THEN MP_TAC); BY(ASM_MESON_TAC[IN;arith `~(SUC m <= m)`]); EXPAND_TAC "A"; ASM_REWRITE_TAC[IN_ELIM_THM]; REWRITE_TAC[arith `~(x < y) <=> y <= x`]; DISCH_TAC; INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`f 0 `;`f m`;`v`;`f (SUC m)`]; ANTS_TAC; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0 `;`f 0`;`f m`;`f (SUC m)`]; ANTS_TAC; ASM_SIMP_TAC[]; FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank]; REPEAT WEAKER_STRIP_TAC; CONJ_TAC; TYPIFY `m = 0` ASM_CASES_TAC; ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`0`;`m`]); BY(ASM_MESON_TAC[arith `1 < n ==> 0 < n`;arith `~(m=0) ==> 0 < m`;arith `x < y ==> x <= y`]); FIRST_X_ASSUM (C INTRO_TAC [`0`;`SUC m`]); BY(ASM_MESON_TAC[arith `1 < n ==> 0 < n`;arith ` 0 < SUC m`;arith `x < y ==> x <= y`]); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (C INTRO_TAC [`m`;`SUC m`]); ANTS_TAC; BY(ASM_REWRITE_TAC[arith `m < SUC m`]); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); ONCE_REWRITE_TAC [arith `x < y <=> &0 < y - x`]; DISCH_THEN (SUBST1_TAC o GSYM); MATCH_MP_TAC (arith `~(x = y) /\ (x <= y) ==> &0 < y - x`); ASM_REWRITE_TAC[]; ASM_SIMP_TAC[AZIM_ZERO_SHIFT]; ONCE_REWRITE_TAC[Local_lemmas.AZIM_EQ_0_SYM2]; BY(ASM_SIMP_TAC[AZIM_EQ_0_GE_ALT]) ]);; (* }}} *)
let LEAF_RANK_REUHADY = 
prove_by_refinement( `!V ul w0 n f i. 1 < n /\ packing V /\ saturated V /\ s_leaf V ul HAS_SIZE n /\ ~collinear {EL 0 ul, EL 1 ul, w0 } /\ leaf_rank V ul w0 n f ==> azim_mcell V f (EL 0 ul) (EL 1 ul) i = azim (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC LEAF_RANK_PERIODIC; BY(ASM_MESON_TAC[]); TYPIFY `!k. f (k MOD n) = f k` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Oxl_def.periodic_mod;arith `1 < n ==> ~(n=0)`]); REWRITE_TAC[azim_mcell]; INTRO_TAC REUHADY [`V`;`EL 0 ul`;`EL 1 ul`;`f i`;`f (SUC i)`]; DISCH_THEN MATCH_MP_TAC; TYPIFY `!j. f j IN s_leaf V ul` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank;EXTENSION;IN_IMAGE;IN_UNIV]; BY(MESON_TAC[]); TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC s_leaf_leaf; BY(ASM_REWRITE_TAC[]); ASM_SIMP_TAC[]; DISCH_TAC; INTRO_TAC LEAF_RANK_AZIM_NZ [`V`;`ul`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; BY(REWRITE_TAC[AZIM_REFL]) ]);;
(* }}} *)
let LEAF_RANK_BIJ = 
prove_by_refinement( `!V ul w0 n f. 1 < n /\ packing V /\ saturated V /\ s_leaf V ul HAS_SIZE n /\ EL 0 ul IN V /\ EL 1 ul IN V /\ ~collinear {EL 0 ul, EL 1 ul, w0 } /\ leaf_rank V ul w0 n f ==> BIJ SND {i,X | i < n /\ mcell_set V X /\ {EL 0 ul, EL 1 ul} IN edgeX V X /\ X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))} {X | mcell_set V X /\ {EL 0 ul, EL 1 ul} IN edgeX V X } `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[BIJ;INJ]; SUBCONJ_TAC; SUBCONJ_TAC; REWRITE_TAC[IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; BY(ASM_REWRITE_TAC[SND]); DISCH_TAC; REWRITE_TAC[IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MP_TAC; ASM_REWRITE_TAC[SND]; REWRITE_TAC[PAIR_EQ]; DISCH_TAC; INTRO_TAC MCELL_WEDGE_UNIQUE [`V`;`ul`;`w0`;`n`;`f`;`X`]; ANTS_TAC; ASM_REWRITE_TAC[]; DISCH_TAC; FIRST_X_ASSUM_ST `mcell_set` MP_TAC; REWRITE_TAC[Pack_defs.mcell_set;IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; BY(ASM_MESON_TAC[Bump.RIJRIED;NOT_IN_EMPTY;IN]); ASM_REWRITE_TAC[]; DISCH_THEN MATCH_MP_TAC; BY(ASM_MESON_TAC[]); DISCH_TAC; REWRITE_TAC[SURJ]; ASM_REWRITE_TAC[]; REWRITE_TAC[IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC MCELL_IN_WEDGE [`V`;`ul`;`w0`;`n`;`f`;`x`]; ANTS_TAC; ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `mcell_set` MP_TAC; REWRITE_TAC[Pack_defs.mcell_set;IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; BY(ASM_MESON_TAC[Bump.RIJRIED;NOT_IN_EMPTY;IN]); REPEAT WEAKER_STRIP_TAC; TYPIFY `(i,x)` EXISTS_TAC; BY(ASM_MESON_TAC[SND]) ]);;
(* }}} *)
let LEAF_RANK_GRUTOTI = 
prove_by_refinement( `!V ul w0 n f. 1 < n /\ packing V /\ saturated V /\ s_leaf V ul HAS_SIZE n /\ EL 0 ul IN V /\ EL 1 ul IN V /\ ~collinear {EL 0 ul, EL 1 ul, w0 } /\ leaf_rank V ul w0 n f /\ hl [EL 0 ul;EL 1 ul] < sqrt (&2) ==> sum {i | i < n } (azim_mcell V f (EL 0 ul) (EL 1 ul)) = &2 * pi`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `azim_mcell V f (EL 0 ul) (EL 1 ul) = (\i. azim_mcell V f (EL 0 ul) (EL 1 ul) i)` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[FUN_EQ_THM]); INTRO_TAC LEAF_RANK_REUHADY [`V`;`ul`;`w0`;`n`;`f`]; ASM_REWRITE_TAC[]; DISCH_THEN (unlist REWRITE_TAC); REWRITE_TAC[arith `SUC i = i + 1`]; MATCH_MP_TAC ORDER_AZIM_SUM2Pi0; TYPIFY `w0` EXISTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; BY(ASM_MESON_TAC[LEAF_RANK_COLLINEAR]); FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank]; BY(MESON_TAC[arith `0 + n = n`]) ]);;
(* }}} *) (* let LEAF_RANK_GRUTOTI_DEPRECATED = prove_by_refinement( `!V ul w0 n f. 1 < n /\ packing V /\ saturated V /\ s_leaf V ul HAS_SIZE n /\ EL 0 ul IN V /\ EL 1 ul IN V /\ ~collinear {EL 0 ul, EL 1 ul, w0 } /\ leaf_rank V ul w0 n f /\ hl [EL 0 ul;EL 1 ul] < sqrt (&2) ==> sum {i | i < n } (azim_mcell V f (EL 0 ul) (EL 1 ul)) = &2 * pi `, (* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `azim_mcell V f (EL 0 ul) (EL 1 ul) = (\i. azim_mcell V f (EL 0 ul) (EL 1 ul) i)` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[FUN_EQ_THM]); REWRITE_TAC[azim_mcell]; GMATCH_SIMP_TAC SUM_SUM_PRODUCT; CONJ_TAC; REWRITE_TAC[FINITE_NUMSEG_LT]; REWRITE_TAC[IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC FINITE_SUBSET; TYPIFY `{X | mcell_set V X /\edgeX V X {EL 0 ul, EL 1 ul} }` EXISTS_TAC; CONJ2_TAC; BY(SET_TAC[IN]); MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2; BY(ASM_MESON_TAC[]); REWRITE_TAC[IN_ELIM_THM]; INTRO_TAC LEAF_RANK_BIJ [`V`;`ul`;`w0`;`n`;`f`]; ANTS_TAC; BY(ASM_MESON_TAC[]); TYPIFY` (\ ((i:num),j). dihX V j (EL 0 ul,EL 1 ul)) = (\X. dihX V X (EL 0 ul, EL 1 ul)) o SND` (C SUBGOAL_THEN (unlist REWRITE_TAC)); BY(REWRITE_TAC[FUN_EQ_THM;o_THM;Bump.BETA_ORDERED_PAIR_THM]); DISCH_TAC; GMATCH_SIMP_TAC Bump.BIJ_SUM; TYPIFY `{X | mcell_set V X /\ {EL 0 ul, EL 1 ul} IN edgeX V X}` EXISTS_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC Grutoti.GRUTOTI; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]) ]);; (* }}} *) *)
let LEAF_RANK_GG_SUM = 
prove_by_refinement( `!V ul w0 n f. 1 < n /\ packing V /\ saturated V /\ s_leaf V ul HAS_SIZE n /\ EL 0 ul IN V /\ EL 1 ul IN V /\ ~collinear {EL 0 ul, EL 1 ul, w0 } /\ leaf_rank V ul w0 n f ==> sum {i | i < n } (gg_mcell V f (EL 0 ul) (EL 1 ul)) = sum { X | mcell_set V X /\ {EL 0 ul, EL 1 ul} IN edgeX V X } (\X. gammaX V X lmfun * critical_weight V X + beta_bump_v1 V {EL 0 ul, EL 1 ul} X )`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `gg_mcell V f (EL 0 ul) (EL 1 ul) = (\i. gg_mcell V f (EL 0 ul) (EL 1 ul) i)` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[FUN_EQ_THM]); REWRITE_TAC[gg_mcell]; GMATCH_SIMP_TAC SUM_SUM_PRODUCT; CONJ_TAC; REWRITE_TAC[FINITE_NUMSEG_LT]; REWRITE_TAC[IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC FINITE_SUBSET; TYPIFY `{X | mcell_set V X /\edgeX V X {EL 0 ul, EL 1 ul} }` EXISTS_TAC; CONJ2_TAC; BY(SET_TAC[IN]); MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2; BY(ASM_MESON_TAC[]); REWRITE_TAC[IN_ELIM_THM]; INTRO_TAC LEAF_RANK_BIJ [`V`;`ul`;`w0`;`n`;`f`]; ANTS_TAC; BY(ASM_MESON_TAC[]); TYPIFY` (\ ((i:num),j). gammaX V j lmfun * critical_weight V j + beta_bump_v1 V {EL 0 ul, EL 1 ul} j) = (\X. gammaX V X lmfun * critical_weight V X + beta_bump_v1 V {EL 0 ul, EL 1 ul} X) o SND` (C SUBGOAL_THEN (unlist REWRITE_TAC)); BY(REWRITE_TAC[FUN_EQ_THM;o_THM;Bump.BETA_ORDERED_PAIR_THM]); DISCH_TAC; GMATCH_SIMP_TAC Bump.BIJ_SUM; TYPIFY `{X | mcell_set V X /\ {EL 0 ul, EL 1 ul} IN edgeX V X}` EXISTS_TAC; BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *)
let MCELL2_DIHX_POS = 
prove_by_refinement( `!V X ul. saturated V /\ packing V /\ barV V 3 ul /\ X = mcell2 V ul /\ {EL 0 ul,EL 1 ul} IN edgeX V X ==> &0 < dihX V X (EL 0 ul,EL 1 ul)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `~NULLSET X` (C SUBGOAL_THEN ASSUME_TAC); DISCH_TAC; INTRO_TAC Bump.RIJRIED [`V`;`ul`;`2`]; ANTS_TAC; BY(ASM_MESON_TAC[Bump.MCELL2]); REWRITE_TAC[EXTENSION;NOT_IN_EMPTY]; BY(ASM_MESON_TAC[Bump.MCELL2]); ASM_SIMP_TAC[Tskajxy.MCELL2_DIHX]; MATCH_MP_TAC (arith `~(x = &0) /\ (&0 <= x) ==> &0 < x`); REWRITE_TAC[Upfzbzm_support_lemmas.DIHV_LE_0]; MATCH_MP_TAC DIHV_EQ_0_PI_EQ_COPLANAR_ALT; INTRO_TAC Leaf_cell.MCELL2_SUBSET_AFF_GE [`V`;`ul`]; ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]; REPEAT WEAKER_STRIP_TAC; TYPIFY `mcell2 V ul SUBSET affine hull {EL 0 ul, EL 1 ul, mxi V ul, omega_list_n V ul 3}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SUBSET_TRANS; TYPIFY `aff_ge {HD ul, HD (TL ul)} {mxi V ul, omega_list_n V ul 3}` EXISTS_TAC; ASM_REWRITE_TAC[]; TYPIFY `!a b c (d:real^3). {a,b,c,d} = {a,b} UNION {c,d}` (C SUBGOAL_THEN (unlist REWRITE_TAC)); BY(SET_TAC[]); BY(REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL;EL;arith `1 = SUC 0`]); FIRST_X_ASSUM_ST `NULLSET` MP_TAC; REWRITE_TAC[]; MATCH_MP_TAC NEGLIGIBLE_SUBSET; BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]) ]);;
(* }}} *)
let MCELL3_CONVEX_HULL = 
prove_by_refinement( `!V ul. packing V /\ saturated V /\ ul IN barV V 3 /\ ~NULLSET (mcell3 V ul) ==> mcell3 V ul = convex hull {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul}`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC Pack_defs.mcell3 [`V`;`ul`]; COND_CASES_TAC; DISCH_THEN SUBST1_TAC; AP_TERM_TAC; TYPIFY `set_of_list(truncate_simplex 2 ul) = {EL 0 ul,EL 1 ul,EL 2 ul}` (C SUBGOAL_THEN SUBST1_TAC); MATCH_MP_TAC Bump.SET_OF_LIST_TRUNCATE_2; BY(ASM_MESON_TAC[IN;Sphere.BARV;arith `3 <= 3 + 1`]); BY(SET_TAC[]); BY(ASM_MESON_TAC[NEGLIGIBLE_EMPTY]) ]);;
(* }}} *)
let MCELL3_EXTREME_CARD = 
prove_by_refinement( `!V ul. packing V /\ saturated V /\ ul IN barV V 3 /\ ~NULLSET (mcell3 V ul) ==> CARD {EL 0 ul, EL 1 ul, EL 2 ul,mxi V ul} = 4`,
(* {{{ proof *) [ REPEAT WEAK_STRIP_TAC; MATCH_MP_TAC Collect_geom2.NOT_COPLANAR_IMP_CARD4; GMATCH_SIMP_TAC (GSYM coplanar_eq_coplanar_alt); REWRITE_TAC[DIMINDEX_3;arith `2 <= 3`]; ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; TYPIFY `convex hull {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = mcell3 V ul` ENOUGH_TO_SHOW_TAC; DISCH_THEN SUBST1_TAC; BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]); BY(ASM_MESON_TAC[MCELL3_CONVEX_HULL]) ]);;
(* }}} *)
let MCELL3_DIHX = 
prove_by_refinement( `!V X ul. saturated V /\ packing V /\ barV V 3 ul /\ X = mcell3 V ul /\ {EL 0 ul,EL 1 ul} IN edgeX V X /\ ~NULLSET X ==> dihX V X (EL 0 ul,EL 1 ul) = dihV (EL 0 ul) (EL 1 ul) (EL 2 ul) (mxi V ul)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[Pack_defs.dihX;LET_DEF;LET_END_DEF;Bump.BETA_ORDERED_PAIR_THM]; INTRO_TAC Leaf_cell.MCELL_EDGE_FIRST [`V`;`ul`;`3`;`EL 0 ul`;`EL 1 ul`]; ANTS_TAC; BY(ASM_MESON_TAC[IN;Bump.MCELL3]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Tskajxy.INITIAL_SUBLIST_2 [`vl`]; ANTS_TAC; REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; BY(ASM_MESON_TAC[IN]); DISCH_TAC; INTRO_TAC Tskajxy.MCELL_PARAM_D_UL [`V`;`vl`;`[EL 0 ul;EL 1 ul]`;`SND (cell_params_d V X [EL 0 ul;EL 1 ul])`;`X`;`3`]; ANTS_TAC; BY(ASM_MESON_TAC[IN;arith `3 <= 4`;Bump.MCELL3]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Tskajxy.MCELL_CELL_PARAMETERS_D_EXIST [`V`;`vl`;`[EL 0 ul;EL 1 ul]`;`3`;`X`]; ANTS_TAC; BY(ASM_MESON_TAC[IN;arith `3 <= 4`;Bump.MCELL3]); ASM_REWRITE_TAC[]; DISCH_THEN SUBST1_TAC; REWRITE_TAC[arith `~(3 = 2)`;Pack_defs.dihu3]; REPEAT (FIRST_X_ASSUM_ST `SND` MP_TAC); ASM_REWRITE_TAC[]; TYPED_ABBREV_TAC `(wl:(real^3)list) = (SND (cell_params_d V (mcell3 V ul) [EL 0 vl; EL 1 vl]))` ; FIRST_X_ASSUM kill; REPEAT WEAKER_STRIP_TAC; COMMENT "match wl with vl";
TYPIFY `EL 0 wl = EL 0 vl /\ EL 1 wl = EL 1 vl` (C SUBGOAL_THEN ASSUME_TAC); INTRO_TAC Bump.LENGTH4 [`wl`]; ANTS_TAC; REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; BY(ASM_MESON_TAC[IN]); DISCH_TAC; PROOF_BY_CONTR_TAC; FIRST_X_ASSUM_ST `initial_sublist` MP_TAC; FIRST_X_ASSUM_ST `CONS` SUBST1_TAC; REWRITE_TAC[initial_sublist_cons]; BY(ASM_MESON_TAC[]); COMMENT "mcell3 as convex hull"; INTRO_TAC MCELL3_CONVEX_HULL [`V`;`vl`]; INTRO_TAC MCELL3_CONVEX_HULL [`V`;`wl`]; ASM_REWRITE_TAC[]; ANTS_TAC; BY(ASM_MESON_TAC[Bump.MCELL3]); DISCH_TAC; ANTS_TAC; BY(ASM_MESON_TAC[Bump.MCELL3]); DISCH_TAC; TYPIFY `convex hull {EL 0 vl, EL 1 vl, EL 2 wl, mxi V wl} = convex hull {EL 0 vl, EL 1 vl, EL 2 vl, mxi V vl}` (C SUBGOAL_THEN MP_TAC); BY(ASM_MESON_TAC[Bump.MCELL3]); GMATCH_SIMP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ; REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD;FINITE_INSERT;FINITE_EMPTY]; TYPIFY `CARD {EL 0 vl,EL 1 vl,EL 2 vl,mxi V vl} = 4 /\ CARD {EL 0 vl,EL 1 vl,EL 2 wl,mxi V wl} = 4 ` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[MCELL3_EXTREME_CARD;Bump.MCELL3]); REPEAT WEAKER_STRIP_TAC; TYPIFY `aff_dim {EL 0 vl, EL 1 vl, EL 2 wl, mxi V wl} = &3 /\ aff_dim {EL 0 vl, EL 1 vl, EL 2 vl, mxi V vl} = &3` (C SUBGOAL_THEN (unlist REWRITE_TAC)); REPEAT (GMATCH_SIMP_TAC NOT_COPLANAR_AFF_3); ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE;Bump.MCELL3]); CONJ_TAC; BY(ASM_MESON_TAC[INT_ARITH `&3 = &4 - int_of_num 1`]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Leaf_cell.LENGTH4_SET2 [`EL 0 vl`;`EL 1 vl`;`EL 2 vl`;`mxi V vl`;`EL 2 wl`;`mxi V wl`]; ANTS_TAC; REWRITE_TAC[set_of_list]; BY(ASM_MESON_TAC[]); INTRO_TAC MCELL3_CONVEX_HULL [`V`;`ul`]; ANTS_TAC; BY(ASM_MESON_TAC[Bump.MCELL3;IN]); DISCH_TAC; TYPIFY `convex hull {EL 0 vl, EL 1 vl, EL 2 wl, mxi V wl} = convex hull {EL 0 vl, EL 1 vl, EL 2 ul, mxi V ul}` (C SUBGOAL_THEN MP_TAC); BY(ASM_MESON_TAC[Bump.MCELL3]); GMATCH_SIMP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ; REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD;FINITE_INSERT;FINITE_EMPTY]; TYPIFY `CARD {EL 0 vl,EL 1 vl,EL 2 ul,mxi V ul} = 4` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[IN;MCELL3_EXTREME_CARD;Bump.MCELL3]); REPEAT WEAKER_STRIP_TAC; TYPIFY `aff_dim {EL 0 vl, EL 1 vl, EL 2 wl, mxi V wl} = &3 /\ aff_dim {EL 0 vl, EL 1 vl, EL 2 ul, mxi V ul} = &3` (C SUBGOAL_THEN (unlist REWRITE_TAC)); REPEAT (GMATCH_SIMP_TAC NOT_COPLANAR_AFF_3); ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE;Bump.MCELL3]); CONJ_TAC; BY(ASM_MESON_TAC[INT_ARITH `&3 = &4 - int_of_num 1`]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Leaf_cell.LENGTH4_SET2 [`EL 0 vl`;`EL 1 vl`;`EL 2 ul`;`mxi V ul`;`EL 2 wl`;`mxi V wl`]; ANTS_TAC; REWRITE_TAC[set_of_list]; BY(ASM_MESON_TAC[]); STRIP_TAC; BY(ASM_MESON_TAC[]); ASM_REWRITE_TAC[]; BY(MESON_TAC[Trigonometry2.DIHV_SYM]) ]);; (* }}} *)
let MCELL3_DIHX_POS = 
prove_by_refinement( `!V X ul. saturated V /\ packing V /\ barV V 3 ul /\ X = mcell3 V ul /\ {EL 0 ul,EL 1 ul} IN edgeX V X ==> &0 < dihX V X (EL 0 ul,EL 1 ul)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `~NULLSET X` (C SUBGOAL_THEN ASSUME_TAC); DISCH_TAC; INTRO_TAC Bump.RIJRIED [`V`;`ul`;`3`]; ANTS_TAC; BY(ASM_MESON_TAC[Bump.MCELL3]); REWRITE_TAC[EXTENSION;NOT_IN_EMPTY]; BY(ASM_MESON_TAC[Bump.MCELL3]); ASM_SIMP_TAC[MCELL3_DIHX]; MATCH_MP_TAC (arith `~(x = &0) /\ (&0 <= x) ==> &0 < x`); REWRITE_TAC[Upfzbzm_support_lemmas.DIHV_LE_0]; MATCH_MP_TAC DIHV_EQ_0_PI_EQ_COPLANAR_ALT; ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; GMATCH_SIMP_TAC (GSYM MCELL3_CONVEX_HULL); CONJ_TAC; BY(ASM_MESON_TAC[IN]); BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]) ]);;
(* }}} *)
let MCELL3_DOMAIN = 
prove_by_refinement( `!V ul. saturated V /\ packing V /\ barV V 3 ul /\ ~(NULLSET (mcell3 V ul)) ==> ~collinear {EL 0 ul,EL 1 ul,EL 2 ul} /\ &2 <= dist (EL 1 ul,EL 2 ul) /\ &2 <= dist (EL 0 ul,EL 2 ul) /\ &2 <= dist (EL 0 ul,EL 1 ul) /\ dist (EL 1 ul,EL 2 ul) < &2 * sqrt (&2) /\ dist (EL 0 ul,EL 2 ul) < &2 * sqrt (&2) /\ dist (EL 0 ul,EL 1 ul) < &2 * sqrt (&2) /\ eta_y (dist (EL 0 ul,EL 1 ul)) (dist (EL 0 ul,EL 2 ul)) (dist (EL 1 ul,EL 2 ul)) < sqrt (&2)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC (GSYM RADV_ETAY); TYPIFY `hl (truncate_simplex 2 ul) < sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `mcell3` MP_TAC; REWRITE_TAC[Pack_defs.mcell3]; COND_CASES_TAC; BY(ASM_REWRITE_TAC[]); BY(ASM_MESON_TAC[NEGLIGIBLE_EMPTY]); COMMENT "deal with radV";
TYPIFY `truncate_simplex 2 ul = [EL 0 ul;EL 1 ul;EL 2 ul]` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Leaf_cell.BARV3_TRUNC2;IN]); TYPIFY `radV {EL 0 ul, EL 1 ul, EL 2 ul} < sqrt (&2)` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `hl` MP_TAC THEN ASM_REWRITE_TAC[Pack_defs.HL;set_of_list]); TYPIFY `~collinear {EL 0 ul,EL 1 ul,EL 2 ul}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR; TYPIFY `mxi V ul` EXISTS_TAC; ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; GMATCH_SIMP_TAC (GSYM MCELL3_CONVEX_HULL); BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE;IN]); ASM_REWRITE_TAC[]; TYPIFY `~affine_dependent {EL 0 ul,EL 1 ul,EL 2 ul}` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[AFFINE_DEPENDENT_IMP_COLLINEAR_3]); TYPIFY `!x y. {x,y} SUBSET {EL 0 ul,EL 1 ul,EL 2 ul} ==> dist(x,y) < &2 * sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[arith `x < &2 * y <=> inv(&2) * x < y`]; REWRITE_TAC[GSYM RADV2]; MATCH_MP_TAC REAL_LET_TRANS; TYPIFY `radV {EL 0 ul, EL 1 ul, EL 2 ul}` EXISTS_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC Rogers.RADV_MONO; ASM_REWRITE_TAC[EXTENSION;IN_INSERT;NOT_IN_EMPTY]; BY(MESON_TAC[]); INTRO_TAC Packing3.BARV_SUBSET [`V`;`3`;`ul`]; ASM_REWRITE_TAC[]; DISCH_TAC; TYPIFY `set_of_list ul = {EL 0 ul,EL 1 ul,EL 2 ul,EL 3 ul}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC Bump.set_of_list4; REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; BY(ASM_MESON_TAC[]); TYPIFY `~(EL 0 ul = EL 1 ul) /\ ~(EL 1 ul = EL 2 ul) /\ ~(EL 0 ul = EL 2 ul)` (C SUBGOAL_THEN ASSUME_TAC); TYPIFY `{EL 0 ul,EL 1 ul, EL 2 ul} = {EL 1 ul,EL 2 ul,EL 0 ul}` (C SUBGOAL_THEN ASSUME_TAC); BY(SET_TAC[]); BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); TYPIFY `&2 <= dist (EL 1 ul,EL 2 ul) /\ &2 <= dist (EL 0 ul,EL 2 ul) /\ &2 <= dist (EL 0 ul,EL 1 ul)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); FIRST_X_ASSUM_ST `packing` MP_TAC; REWRITE_TAC[Sphere.packing]; FIRST_X_ASSUM_ST `SUBSET` MP_TAC; ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; REWRITE_TAC[IN]; BY(ASM_MESON_TAC[]); BY(REPEAT (CONJ_TAC THEN (TRY (FIRST_X_ASSUM MATCH_MP_TAC))) THEN SET_TAC[]) ]);; (* }}} *) let TSKAJXY_3 = Prove_by_refinement.prove_by_refinement( `!V X ul. pack_nonlinear_non_ox3q1h /\ saturated V /\ packing V /\ barV V 3 ul /\ X = mcell3 V ul /\ ~(NULLSET X) ==> gammaX V X lmfun >= &0`, (* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC Tskajxy_lemmas.gammaX_gamma3f [`V`;`X`;`ul`;`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`EL 3 ul`;`dist(EL 1 ul,EL 2 ul)`;`dist(EL 0 ul,EL 2 ul)`;`dist(EL 0 ul,EL 1 ul)`]; ANTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; BY(REWRITE_TAC[Bump.MCELL3]); MATCH_MP_TAC Bump.LENGTH4; REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; BY(ASM_MESON_TAC[]); DISCH_THEN (unlist REWRITE_TAC); INTRO_TAC Merge_ineq.cell3_from_ineq_thm_ALT []; ASM_REWRITE_TAC[arith `x >= &0 <=> &0 <= x`]; DISCH_THEN MATCH_MP_TAC; TYPIFY `eta_y (dist (EL 1 ul,EL 2 ul)) (dist (EL 0 ul,EL 2 ul)) (dist (EL 0 ul,EL 1 ul)) = eta_y (dist (EL 0 ul,EL 1 ul)) (dist (EL 0 ul,EL 2 ul)) (dist (EL 1 ul,EL 2 ul))` (C SUBGOAL_THEN SUBST1_TAC); BY(MESON_TAC[Collect_geom.ETA_Y_SYYM]); INTRO_TAC MCELL3_DOMAIN [`V`;`ul`]; ANTS_TAC; BY(ASM_MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) ]);; (* }}} *)
let MCELL4_LEAF2 = 
prove_by_refinement( `!V ul. packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell4 V ul) ==> leaf V [EL 0 ul;EL 1 ul;EL 2 ul]`,
(* {{{ proof *) [ REWRITE_TAC[Leaf_cell.leaf;Pack_defs.mcell4]; REPEAT GEN_TAC; COND_CASES_TAC; REPEAT WEAKER_STRIP_TAC; INTRO_TAC Packing3.TRUNCATE_SIMPLEX_BARV [`V`;`2`;`3`;`ul`]; INTRO_TAC Rogers.HL_DECREASE [`V`;`ul`;`3`;`2`]; ASM_REWRITE_TAC[arith `2 <= 3`;IN]; INTRO_TAC Leaf_cell.BARV3_TRUNC2 [`V`;`ul`]; ANTS_TAC; BY(ASM_MESON_TAC[IN]); DISCH_THEN SUBST1_TAC; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[arith `h < s /\ h' <= h ==> h' < s`;Sphere.sqrt2]); BY(MESON_TAC[NEGLIGIBLE_EMPTY]) ]);;
(* }}} *)
let MCELL4_CONVEX_HULL = 
prove_by_refinement( `!V ul. packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell4 V ul) ==> mcell4 V ul = convex hull {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul}`,
(* {{{ proof *) [ REWRITE_TAC[Pack_defs.mcell4]; REPEAT GEN_TAC; COND_CASES_TAC; BY(MESON_TAC[BARV3_SET_OF_LIST4]); BY(REWRITE_TAC[NEGLIGIBLE_EMPTY]) ]);;
(* }}} *)
let MCELL4_CARD4 = 
prove_by_refinement( `!V ul. packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell4 V ul) ==> CARD ({EL 0 ul,EL 1 ul, EL 2 ul, EL 3 ul}) = 4`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC Collect_geom2.NOT_COPLANAR_IMP_CARD4; GMATCH_SIMP_TAC (GSYM coplanar_eq_coplanar_alt); REWRITE_TAC[DIMINDEX_3;arith `2 <= 3`]; ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; TYPIFY `convex hull {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = mcell4 V ul` ENOUGH_TO_SHOW_TAC; DISCH_THEN SUBST1_TAC; BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]); BY(ASM_MESON_TAC[MCELL4_CONVEX_HULL]) ]);;
(* }}} *)
let MCELL4_LEAF3 = 
prove_by_refinement( `!V ul. packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell4 V ul) ==> leaf V [EL 0 ul;EL 1 ul;EL 3 ul]`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC Marchal_cells_3.LEFT_ACTION_LIST_3_EXISTS [`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`EL 3 ul`;`EL 0 ul`;`EL 1 ul`;`EL 3 ul`;`EL 2 ul`]; ANTS_TAC; CONJ_TAC; MATCH_MP_TAC MCELL4_CARD4; BY(ASM_MESON_TAC[]); BY(SET_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Rvfxzbu.RVFXZBU [`V`;`ul`;`4`;`p`]; ASM_REWRITE_TAC[arith `4 - 1 = 3`]; ANTS_TAC; BY(SET_TAC[]); INTRO_TAC Rogers.YIFVQDV_1 [`V`;`ul`;`3`;`p`]; ASM_REWRITE_TAC[]; ANTS_TAC; CONJ_TAC; BY(ASM_MESON_TAC[IN]); PROOF_BY_CONTR_TAC; FIRST_X_ASSUM_ST `NULLSET` MP_TAC; BY(ASM_REWRITE_TAC[Pack_defs.mcell4;NEGLIGIBLE_EMPTY]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Bump.LENGTH4 [`ul`]; ANTS_TAC; REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; BY(ASM_MESON_TAC[]); DISCH_TAC; PROOF_BY_CONTR_TAC; FIRST_X_ASSUM_ST `left_action_list p (CONS x y)` MP_TAC; FIRST_X_ASSUM (SUBST1_TAC o GSYM); TYPED_ABBREV_TAC `(wl:(real^3) list) = left_action_list p ul` ; FIRST_X_ASSUM kill; DISCH_TAC; INTRO_TAC MCELL4_LEAF2 [`V`;`wl`]; ANTS_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[IN;Bump.MCELL4]); EXPAND_TAC "wl";
BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]) ]);; (* }}} *)
let MCELL4_LEAF_S_LEAF = 
prove_by_refinement( `!V ul u. packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell4 V ul) /\ leaf V [EL 0 ul;EL 1 ul;u] /\ (u IN {EL 2 ul, EL 3 ul} ) ==> s_leaf V [EL 0 ul;EL 1 ul] u`,
(* {{{ proof *) [ REWRITE_TAC[s_leaf;Bump.EL_EXPLICIT;IN_INSERT;NOT_IN_EMPTY]; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; INTRO_TAC Leaf_cell.CFFONNL [`V`;`[EL 0 ul;EL 1 ul;u]`;`mcell4 V ul`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; REWRITE_TAC[TAUT `(a /\ b /\ c /\ ~d ==> e) <=> (a /\ b /\ c ==> (d \/ e))`]; ANTS_TAC; CONJ_TAC; REWRITE_TAC[IN_ELIM_THM;Pack_defs.mcell_set]; BY(ASM_MESON_TAC[IN;Bump.MCELL4]); CONJ_TAC; GMATCH_SIMP_TAC Bump.MCELL4_EDGE; ASM_REWRITE_TAC[]; CONJ_TAC; MATCH_MP_TAC Marchal_cells_2_new.CARD4_IMP_DISTINCT; BY(ASM_MESON_TAC[MCELL4_CARD4]); GMATCH_SIMP_TAC BARV3_SET_OF_LIST4; CONJ_TAC; BY(ASM_MESON_TAC[]); BY(SET_TAC[]); REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_INTER;Leaf_cell.cc_A0;NOT_FORALL_THM;Bump.EL_EXPLICIT]; TYPIFY `u` EXISTS_TAC; CONJ_TAC; GMATCH_SIMP_TAC MCELL4_CONVEX_HULL; ASM_REWRITE_TAC[]; MATCH_MP_TAC Marchal_cells_2_new.IN_SET_IMP_IN_CONVEX_HULL_SET; BY(ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]); MATCH_MP_TAC Local_lemmas.DISJOINT_IMP_Z_IN_AFF_GT; REWRITE_TAC[DISJOINT;EXTENSION;IN_SING;NOT_IN_EMPTY;IN_INTER;IN_INSERT]; INTRO_TAC MCELL4_CARD4 [`V`;`ul`]; ASM_REWRITE_TAC[]; DISCH_THEN (MP_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); BY(ASM_MESON_TAC[]); REWRITE_TAC[Bump.MCELL4;Leaf_cell.cc_cell]; STRIP_TAC; INTRO_TAC Ajripqn.AJRIPQN [`V`;`ul`;`cc_uh V [EL 0 ul;EL 1 ul;u]`;`4`;`cc_ke V [EL 0 ul; EL 1 ul; u]`]; ANTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); CONJ_TAC; BY(SET_TAC[]); REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; CONJ_TAC; BY(MESON_TAC[Leaf_cell.CC_KE_34]); REWRITE_TAC[INTER_IDEMPOT]; BY(ASM_MESON_TAC[Bump.MCELL4]); BY(DISCH_THEN (unlist REWRITE_TAC)); COMMENT "second case";
INTRO_TAC Ajripqn.AJRIPQN [`V`;`ul`;`cc_uh V [EL 1 ul;EL 0 ul;u]`;`4`;`cc_ke V [EL 1 ul; EL 0 ul; u]`]; ANTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; ONCE_REWRITE_TAC[GSYM IN]; GMATCH_SIMP_TAC Leaf_cell.cc_uh; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[Leaf_cell.ZASUVOR]); CONJ_TAC; BY(SET_TAC[]); REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; CONJ_TAC; BY(MESON_TAC[Leaf_cell.CC_KE_34]); REWRITE_TAC[INTER_IDEMPOT]; BY(ASM_MESON_TAC[Bump.MCELL4]); BY(DISCH_THEN (unlist REWRITE_TAC)) ]);; (* }}} *)
let S_LEAF_CARD2 = 
prove_by_refinement( `!V ul. packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell4 V ul) ==> 2 <= CARD(s_leaf V [EL 0 ul;EL 1 ul])`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `2 = CARD {EL 2 ul, EL 3 ul}` ((C SUBGOAL_THEN SUBST1_TAC) ); MATCH_MP_TAC EQ_SYM; MATCH_MP_TAC Hypermap.CARD_TWO_ELEMENTS; INTRO_TAC MCELL4_CARD4 [`V`;`ul`]; ASM_REWRITE_TAC[]; TYPIFY `{EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {EL 2 ul, EL 3 ul, EL 0 ul, EL 1 ul}` (C SUBGOAL_THEN SUBST1_TAC); BY(SET_TAC[]); BY(MESON_TAC[Marchal_cells_2_new.CARD4_IMP_DISTINCT]); MATCH_MP_TAC CARD_SUBSET; ASM_SIMP_TAC[S_LEAF_FINITE]; REWRITE_TAC[SUBSET]; REPEAT WEAKER_STRIP_TAC; ONCE_REWRITE_TAC[IN]; INTRO_TAC MCELL4_LEAF_S_LEAF [`V`;`ul`;`x`]; DISCH_THEN MATCH_MP_TAC; ASM_REWRITE_TAC[]; FIRST_X_ASSUM MP_TAC; REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(ASM_MESON_TAC[MCELL4_LEAF2;MCELL4_LEAF3]) ]);;
(* }}} *)
let LEAF_RANK_ONTO = 
prove_by_refinement( `!V ul w0 n f u. packing V /\ saturated V /\ barV V 3 ul /\ leaf_rank V [EL 0 ul;EL 1 ul] w0 n f /\ ~(n=0) /\ ~NULLSET(mcell4 V ul) /\ (u IN {EL 2 ul,EL 3 ul}) ==> (?i. i < n /\ (u = f i))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC LEAF_RANK_PERIODIC [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`]; ASM_REWRITE_TAC[]; DISCH_TAC; FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank;IMAGE;IN_UNIV;EXTENSION;IN_ELIM_THM;Bump.EL_EXPLICIT]; INTRO_TAC MCELL4_LEAF_S_LEAF [`V`;`ul`;`u`]; ANTS_TAC; ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `IN` MP_TAC; REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(ASM_MESON_TAC[MCELL4_LEAF2;MCELL4_LEAF3]); REPEAT WEAKER_STRIP_TAC; TYPIFY `?j. u = f j` (C SUBGOAL_THEN MP_TAC); BY(ASM_MESON_TAC[IN]); REPEAT WEAKER_STRIP_TAC; TYPIFY `j MOD n` EXISTS_TAC; CONJ_TAC; BY(ASM_MESON_TAC[DIVISION]); BY(ASM_MESON_TAC[Oxl_def.periodic_mod]) ]);;
(* }}} *)
let S_LEAF_IN_WEDGE_GE = 
prove_by_refinement( `!V ul u w0 n f j i'. packing V /\ saturated V /\ leaf_rank V [EL 0 ul;EL 1 ul] w0 n f /\ leaf V [EL 0 ul;EL 1 ul;u] /\ ~collinear {EL 0 ul,EL 1 ul,w0} /\ (1<n) /\ (u = f i') /\ (i' < n) /\ u IN wedge_ge (EL 0 ul) (EL 1 ul) (f j) (f (SUC j)) ==> (u = f j \/ u = f (SUC j))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `?i. (i < n) /\ f j = f i /\ f (SUC j) = f (SUC i)` (C SUBGOAL_THEN MP_TAC); TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); TYPIFY `j MOD n` EXISTS_TAC; BY(ASM_SIMP_TAC[F_DEMOD;DIVISION]); DISCH_THEN (fun t -> REPEAT (FIRST_X_ASSUM MP_TAC) THEN MP_TAC t); STRIP_TAC; ASM_REWRITE_TAC[]; REPLICATE_TAC 2 (FIRST_X_ASSUM kill); REPEAT WEAKER_STRIP_TAC; COMMENT "restart";
MATCH_MP_TAC (TAUT ` (~a /\ ~b ==> F) ==> a \/ b`); REPEAT WEAKER_STRIP_TAC; INTRO_TAC LEAF_RANK_COLLINEAR [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_TAC; COMMENT "deal with i=n-1"; TYPIFY `i = n - 1` ASM_CASES_TAC; FIRST_X_ASSUM_ST `wedge_ge` MP_TAC; REWRITE_TAC[]; GMATCH_SIMP_TAC (GSYM Leaf_cell.WEDGE_COMPLEMENT); REWRITE_TAC[IN_DIFF;IN_UNIV]; CONJ_TAC; ONCE_REWRITE_TAC[arith `(x:real) = y <=> y = x`]; DISCH_TAC; FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (C INTRO_TAC [`0`;`i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); DISCH_TAC; INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f i`]; ANTS_TAC; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); FIRST_X_ASSUM_ST `SUC` MP_TAC; ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_MESON_TAC[arith `0 + n = n`]); FIRST_X_ASSUM MP_TAC; ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC); ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_MESON_TAC[arith `0 + n = n`;leaf_rank]); REWRITE_TAC[Reuhady.WEDGE_SIMPLE;IN_ELIM_THM]; TYPIFY `i' = 0 \/ (0 < i' /\ i' < (n-1)) \/ (i' = (n-1))` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); FIRST_X_ASSUM DISJ_CASES_TAC; FIRST_X_ASSUM_ST `SUC` MP_TAC; ASM_REWRITE_TAC[]; ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_MESON_TAC[arith `0 + n = n`;leaf_rank]); BY(REWRITE_TAC[]); FIRST_X_ASSUM DISJ_CASES_TAC; FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; FIRST_ASSUM (C INTRO_TAC [`0`;`i'`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`i'`;`n-1`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f 0`;`f i'`]; ANTS_TAC; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`;arith `x <= x`]); INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f i'`;`f (n-1)`]; ANTS_TAC; ASM_SIMP_TAC [arith `x < y ==> x <= y`]; BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); REWRITE_TAC[AZIM_REFL]; BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); BY(ASM_MESON_TAC[]); COMMENT "done with i = n-1"; COMMENT "deal with wedge_ge"; FIRST_X_ASSUM_ST `wedge_ge` MP_TAC; REWRITE_TAC[Local_lemmas.WEDGE_GE_AZIM_LE]; DISCH_TAC; FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; MP_TAC (arith `i' = i \/ i' = SUC i \/ SUC i < i' \/ i' < i `); DISCH_THEN DISJ_CASES_TAC; BY(ASM_MESON_TAC[]); FIRST_X_ASSUM DISJ_CASES_TAC; BY(ASM_MESON_TAC[]); FIRST_X_ASSUM DISJ_CASES_TAC; INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f i`;`f (SUC i)`;`f i'`]; ANTS_TAC; ASM_SIMP_TAC[]; CONJ_TAC; FIRST_X_ASSUM (C INTRO_TAC [`i`;`SUC i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`i`;`i'`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`SUC i`;`i'`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); FIRST_X_ASSUM_ST `azim` MP_TAC; ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC); COMMENT "last wedge case"; INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`f i`;`f i'`;`f (SUC i)`]; ANTS_TAC; ASM_SIMP_TAC[]; BY(ASM_MESON_TAC[]); DISCH_TAC; INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`f i'`;`f i`;`f (SUC i)`]; ANTS_TAC; ASM_SIMP_TAC[]; INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f i'`;`f i`;`f (SUC i)`]; ANTS_TAC; ASM_SIMP_TAC[]; CONJ_TAC; FIRST_X_ASSUM (C INTRO_TAC [`i'`;`i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`i'`;`SUC i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`i`;`SUC i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REAL_ARITH_TAC); DISCH_TAC; TYPIFY `azim (EL 0 ul) (EL 1 ul) (f i) (f i') = -- azim (EL 0 ul) (EL 1 ul) (f i') (f i)` (C SUBGOAL_THEN MP_TAC); BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); REWRITE_TAC[arith `x = -- y <=> y + x = &0`]; GMATCH_SIMP_TAC Leaf_cell.AZIM_POS_IMP_SUM_2PI_ALT; CONJ2_TAC; MATCH_MP_TAC (arith `&0 < x ==> ~(x = &0)`); GMATCH_SIMP_TAC REAL_LT_MUL_EQ; REWRITE_TAC[PI_POS]; BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`i'`;`i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); DISCH_TAC; INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`w0`;`f i'`;`f i`]; ANTS_TAC; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) ]);; (* }}} *) (* let S_LEAF_IN_WEDGE_GE = prove_by_refinement( `!V ul u w0 n f i i'. packing V /\ saturated V /\ leaf_rank V [EL 0 ul;EL 1 ul] w0 n f /\ leaf V [EL 0 ul;EL 1 ul;u] /\ ~collinear {EL 0 ul,EL 1 ul,w0} /\ (1<n) /\ (u = f i') /\ (i' < n) /\ (i < n) /\ u IN wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> (u = f i \/ u = f (SUC i))`, (* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC (TAUT ` (~a /\ ~b ==> F) ==> a \/ b`); REPEAT WEAKER_STRIP_TAC; INTRO_TAC LEAF_RANK_COLLINEAR [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_TAC; COMMENT "deal with i=n-1"; TYPIFY `i = n - 1` ASM_CASES_TAC; FIRST_X_ASSUM_ST `wedge_ge` MP_TAC; REWRITE_TAC[]; GMATCH_SIMP_TAC (GSYM Leaf_cell.WEDGE_COMPLEMENT); REWRITE_TAC[IN_DIFF;IN_UNIV]; CONJ_TAC; ONCE_REWRITE_TAC[arith `(x:real) = y <=> y = x`]; DISCH_TAC; FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (C INTRO_TAC [`0`;`i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); DISCH_TAC; INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f i`]; ANTS_TAC; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); FIRST_X_ASSUM_ST `SUC` MP_TAC; ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_MESON_TAC[arith `0 + n = n`]); FIRST_X_ASSUM MP_TAC; ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC); ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_MESON_TAC[arith `0 + n = n`;leaf_rank]); REWRITE_TAC[Reuhady.WEDGE_SIMPLE;IN_ELIM_THM]; TYPIFY `i' = 0 \/ (0 < i' /\ i' < (n-1)) \/ (i' = (n-1))` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); FIRST_X_ASSUM DISJ_CASES_TAC; FIRST_X_ASSUM_ST `SUC` MP_TAC; ASM_REWRITE_TAC[]; ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_MESON_TAC[arith `0 + n = n`;leaf_rank]); BY(REWRITE_TAC[]); FIRST_X_ASSUM DISJ_CASES_TAC; FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; FIRST_ASSUM (C INTRO_TAC [`0`;`i'`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`i'`;`n-1`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f 0`;`f i'`]; ANTS_TAC; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`;arith `x <= x`]); INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f i'`;`f (n-1)`]; ANTS_TAC; ASM_SIMP_TAC [arith `x < y ==> x <= y`]; BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); REWRITE_TAC[AZIM_REFL]; BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); BY(ASM_MESON_TAC[]); COMMENT "done with i = n-1"; COMMENT "deal with wedge_ge"; FIRST_X_ASSUM_ST `wedge_ge` MP_TAC; REWRITE_TAC[Local_lemmas.WEDGE_GE_AZIM_LE]; DISCH_TAC; FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; MP_TAC (arith `i' = i \/ i' = SUC i \/ SUC i < i' \/ i' < i `); DISCH_THEN DISJ_CASES_TAC; BY(ASM_MESON_TAC[]); FIRST_X_ASSUM DISJ_CASES_TAC; BY(ASM_MESON_TAC[]); FIRST_X_ASSUM DISJ_CASES_TAC; INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f i`;`f (SUC i)`;`f i'`]; ANTS_TAC; ASM_SIMP_TAC[]; CONJ_TAC; FIRST_X_ASSUM (C INTRO_TAC [`i`;`SUC i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`i`;`i'`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`SUC i`;`i'`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); FIRST_X_ASSUM_ST `azim` MP_TAC; ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC); COMMENT "last wedge case"; INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`f i`;`f i'`;`f (SUC i)`]; ANTS_TAC; ASM_SIMP_TAC[]; BY(ASM_MESON_TAC[]); DISCH_TAC; INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`f i'`;`f i`;`f (SUC i)`]; ANTS_TAC; ASM_SIMP_TAC[]; INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f i'`;`f i`;`f (SUC i)`]; ANTS_TAC; ASM_SIMP_TAC[]; CONJ_TAC; FIRST_X_ASSUM (C INTRO_TAC [`i'`;`i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`i'`;`SUC i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`i`;`SUC i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REAL_ARITH_TAC); DISCH_TAC; TYPIFY `azim (EL 0 ul) (EL 1 ul) (f i) (f i') = -- azim (EL 0 ul) (EL 1 ul) (f i') (f i)` (C SUBGOAL_THEN MP_TAC); BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); REWRITE_TAC[arith `x = -- y <=> y + x = &0`]; GMATCH_SIMP_TAC Leaf_cell.AZIM_POS_IMP_SUM_2PI_ALT; CONJ2_TAC; MATCH_MP_TAC (arith `&0 < x ==> ~(x = &0)`); GMATCH_SIMP_TAC REAL_LT_MUL_EQ; REWRITE_TAC[PI_POS]; BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`i'`;`i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); DISCH_TAC; INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`w0`;`f i'`;`f i`]; ANTS_TAC; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) ]);; (* }}} *) *)
let LEAF_IN_WEDGE_GE = 
prove_by_refinement( `!V ul u w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul;EL 1 ul] w0 n f /\ leaf V [EL 0 ul;EL 1 ul;u] /\ barV V 3 ul /\ ~collinear {EL 0 ul,EL 1 ul,w0} /\ (1<n) /\ ~NULLSET(mcell4 V ul) /\ (u IN {EL 2 ul,EL 3 ul}) /\ u IN wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> (u = f i \/ u = f (SUC i))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC LEAF_RANK_ONTO [`V`;`ul`;`w0`;`n`;`f`;`u`]; ANTS_TAC; BY(ASM_SIMP_TAC[arith `1 < n==> ~(n=0)`]); REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC S_LEAF_IN_WEDGE_GE; GEXISTL_TAC [`V`;`ul`;`w0`;`n`;`i'`]; BY(ASM_REWRITE_TAC[]) (* REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC (TAUT ` (~a /\ ~b ==> F) ==> a \/ b`); REPEAT WEAKER_STRIP_TAC; INTRO_TAC LEAF_RANK_COLLINEAR [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_TAC; INTRO_TAC LEAF_RANK_ONTO [`V`;`ul`;`w0`;`n`;`f`;`u`]; ANTS_TAC; BY(ASM_SIMP_TAC[arith `1 < n==> ~(n=0)`]); STRIP_TAC; COMMENT "deal with i=n-1"; TYPIFY `i = n - 1` ASM_CASES_TAC; FIRST_X_ASSUM_ST `wedge_ge` MP_TAC; REWRITE_TAC[]; GMATCH_SIMP_TAC (GSYM Leaf_cell.WEDGE_COMPLEMENT); REWRITE_TAC[IN_DIFF;IN_UNIV]; CONJ_TAC; ONCE_REWRITE_TAC[arith `(x:real) = y <=> y = x`]; DISCH_TAC; FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (C INTRO_TAC [`0`;`i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); DISCH_TAC; INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f i`]; ANTS_TAC; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); FIRST_X_ASSUM_ST `SUC` MP_TAC; ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_MESON_TAC[arith `0 + n = n`]); FIRST_X_ASSUM MP_TAC; ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC); ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_MESON_TAC[arith `0 + n = n`;leaf_rank]); REWRITE_TAC[Reuhady.WEDGE_SIMPLE;IN_ELIM_THM]; TYPIFY `i' = 0 \/ (0 < i' /\ i' < (n-1)) \/ (i' = (n-1))` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); FIRST_X_ASSUM DISJ_CASES_TAC; FIRST_X_ASSUM_ST `SUC` MP_TAC; ASM_REWRITE_TAC[]; ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_MESON_TAC[arith `0 + n = n`;leaf_rank]); BY(REWRITE_TAC[]); FIRST_X_ASSUM DISJ_CASES_TAC; FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; FIRST_ASSUM (C INTRO_TAC [`0`;`i'`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`i'`;`n-1`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f 0`;`f i'`]; ANTS_TAC; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`;arith `x <= x`]); INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f i'`;`f (n-1)`]; ANTS_TAC; ASM_SIMP_TAC [arith `x < y ==> x <= y`]; BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); REWRITE_TAC[AZIM_REFL]; BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); BY(ASM_MESON_TAC[]); COMMENT "done with i = n-1"; COMMENT "deal with wedge_ge"; FIRST_X_ASSUM_ST `wedge_ge` MP_TAC; REWRITE_TAC[Local_lemmas.WEDGE_GE_AZIM_LE]; DISCH_TAC; FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; MP_TAC (arith `i' = i \/ i' = SUC i \/ SUC i < i' \/ i' < i `); DISCH_THEN DISJ_CASES_TAC; BY(ASM_MESON_TAC[]); FIRST_X_ASSUM DISJ_CASES_TAC; BY(ASM_MESON_TAC[]); FIRST_X_ASSUM DISJ_CASES_TAC; INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f i`;`f (SUC i)`;`f i'`]; ANTS_TAC; ASM_SIMP_TAC[]; CONJ_TAC; FIRST_X_ASSUM (C INTRO_TAC [`i`;`SUC i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`i`;`i'`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`SUC i`;`i'`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); FIRST_X_ASSUM_ST `azim` MP_TAC; ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC); COMMENT "last wedge case"; INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`f i`;`f i'`;`f (SUC i)`]; ANTS_TAC; ASM_SIMP_TAC[]; BY(ASM_MESON_TAC[]); DISCH_TAC; INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`f i'`;`f i`;`f (SUC i)`]; ANTS_TAC; ASM_SIMP_TAC[]; INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f i'`;`f i`;`f (SUC i)`]; ANTS_TAC; ASM_SIMP_TAC[]; CONJ_TAC; FIRST_X_ASSUM (C INTRO_TAC [`i'`;`i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`i'`;`SUC i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`i`;`SUC i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); BY(REAL_ARITH_TAC); DISCH_TAC; TYPIFY `azim (EL 0 ul) (EL 1 ul) (f i) (f i') = -- azim (EL 0 ul) (EL 1 ul) (f i') (f i)` (C SUBGOAL_THEN MP_TAC); BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); REWRITE_TAC[arith `x = -- y <=> y + x = &0`]; GMATCH_SIMP_TAC Leaf_cell.AZIM_POS_IMP_SUM_2PI_ALT; CONJ2_TAC; MATCH_MP_TAC (arith `&0 < x ==> ~(x = &0)`); GMATCH_SIMP_TAC REAL_LT_MUL_EQ; REWRITE_TAC[PI_POS]; BY(REAL_ARITH_TAC); FIRST_X_ASSUM (C INTRO_TAC [`i'`;`i`]); ANTS_TAC; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); DISCH_TAC; INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`w0`;`f i'`;`f i`]; ANTS_TAC; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) *) ]);;
(* }}} *)
let MCELL4_FI_EL = 
prove_by_refinement( `!V ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ barV V 3 ul /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ ~NULLSET (mcell4 V ul) /\ mcell4 V ul SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> {EL 2 ul, EL 3 ul} = {f i, f (SUC i)}`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC MCELL4_CONVEX_HULL [`V`;`ul`]; ANTS_TAC; BY(ASM_MESON_TAC[]); DISCH_TAC; TYPIFY `!(a:real^3) b c d. ~(a = b) /\ {a,b} SUBSET {c,d} ==> {a,b} = {c,d}` (C SUBGOAL_THEN MATCH_MP_TAC); BY(SET_TAC[]); SUBCONJ_TAC; INTRO_TAC MCELL4_CARD4 [`V`;`ul`]; ASM_REWRITE_TAC[]; BY(MESON_TAC[Leaf_cell.CARD4_ALL_DISTINCT]); DISCH_TAC; REWRITE_TAC[SUBSET]; REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; INTRO_TAC LEAF_IN_WEDGE_GE [`V`;`ul`;`x`;`w0`;`n`;`f`;`i`]; DISCH_THEN MATCH_MP_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; FIRST_X_ASSUM MP_TAC; REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(ASM_MESON_TAC[MCELL4_LEAF2;MCELL4_LEAF3]); FIRST_X_ASSUM_ST `SUBSET` MP_TAC; REWRITE_TAC[SUBSET]; DISCH_THEN MATCH_MP_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC Marchal_cells_2_new.IN_SET_IMP_IN_CONVEX_HULL_SET; FIRST_X_ASSUM MP_TAC; BY(SET_TAC[]) ]);;
(* }}} *)
let MCELL4_FI = 
prove_by_refinement( `!V ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ barV V 3 ul /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ ~NULLSET (mcell4 V ul) /\ (mcell4 V ul) SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> mcell4 V ul = convex hull {EL 0 ul,EL 1 ul, f i, f(SUC i)} `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC MCELL4_CONVEX_HULL [`V`;`ul`]; ANTS_TAC; BY(ASM_MESON_TAC[]); DISCH_TAC; ASM_REWRITE_TAC[]; AP_TERM_TAC; TYPIFY `{EL 2 ul,EL 3 ul} = {f i, f (SUC i)}` ENOUGH_TO_SHOW_TAC; BY(SET_TAC[]); MATCH_MP_TAC MCELL4_FI_EL; BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let MCELL4_BARV_FI = 
prove_by_refinement( `!V ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ barV V 3 ul /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ ~NULLSET (mcell4 V ul) /\ (mcell4 V ul) SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> barV V 3 [EL 0 ul;EL 1 ul; f i; f (SUC i)] /\ mcell4 V ul = mcell4 V [EL 0 ul;EL 1 ul; f i; f (SUC i)]`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC Marchal_cells_3.LEFT_ACTION_LIST_3_EXISTS [`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`EL 3 ul`;`EL 0 ul`;`EL 1 ul`;`f i`;`f (SUC i)`]; ANTS_TAC; CONJ_TAC; MATCH_MP_TAC MCELL4_CARD4; BY(ASM_MESON_TAC[]); INTRO_TAC MCELL4_FI_EL [`V`;`ul`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_MESON_TAC[]); BY(SET_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Rogers.YIFVQDV_1 [`V`;`ul`;`3`;`p`]; ASM_REWRITE_TAC[]; INTRO_TAC Rvfxzbu.RVFXZBU [`V`;`ul`;`4`;`p`]; ASM_REWRITE_TAC[arith `4 - 1 = 3`;IN_INSERT]; FIRST_X_ASSUM MP_TAC; TYPIFY `[EL 0 ul; EL 1 ul; EL 2 ul; EL 3 ul] = ul` (C SUBGOAL_THEN SUBST1_TAC); MATCH_MP_TAC EQ_SYM; MATCH_MP_TAC Bump.LENGTH4; REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; BY(ASM_MESON_TAC[]); DISCH_THEN (SUBST1_TAC o GSYM); REWRITE_TAC[Bump.MCELL4]; DISCH_THEN SUBST1_TAC; ASM_REWRITE_TAC[IN]; DISCH_THEN MATCH_MP_TAC; PROOF_BY_CONTR_TAC; FIRST_X_ASSUM_ST `NULLSET` MP_TAC; REWRITE_TAC[]; REWRITE_TAC[Pack_defs.mcell4]; ASM_REWRITE_TAC[]; BY(REWRITE_TAC[NEGLIGIBLE_EMPTY]) ]);;
(* }}} *)
let MCELL4_AZIM_LT_PI = 
prove_by_refinement( `!V ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ barV V 3 ul /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ ~NULLSET (mcell4 V ul) /\ (mcell4 V ul) SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> azim (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) < pi`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC MCELL4_FI [`V`;`ul`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; DISCH_TAC; INTRO_TAC LEAF_RANK_COLLINEAR [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_TAC; INTRO_TAC Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2 [`EL 0 ul`;`EL 1 ul`;`f i`;`f(SUC i)`]; DISCH_TAC; MATCH_MP_TAC (arith `~(x = pi) /\ ~(pi < x) ==> x < pi`); CONJ_TAC; DISCH_TAC; TYPIFY `coplanar {EL 0 ul,EL 1 ul,f i, f (SUC i)}` (C SUBGOAL_THEN MP_TAC); MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[]; ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]); DISCH_TAC; INTRO_TAC Leaf_cell.AZIM_POS_IMP_SUM_2PI_ALT [`EL 0 ul`;`EL 1 ul`;`f i`;`f (SUC i)`]; ANTS_TAC; FIRST_X_ASSUM MP_TAC; MP_TAC PI_POS; BY(REAL_ARITH_TAC); DISCH_TAC; TYPIFY `azim (EL 0 ul) (EL 1 ul) (f (SUC i)) (f i) < pi` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); FIRST_X_ASSUM_ST `aff_ge` MP_TAC; TYPIFY `{f i,f (SUC i)} = {f (SUC i),f i}` (C SUBGOAL_THEN SUBST1_TAC); BY(SET_TAC[]); REWRITE_TAC[]; GMATCH_SIMP_TAC (GSYM Local_lemmas.WEDGE_GE_EQ_AFF_GE); ASM_SIMP_TAC[]; DISCH_TAC; INTRO_TAC Leaf_cell.WEDGE_GE_ALMOST_DISJOINT [`EL 0 ul`;`EL 1 ul`;`f i`;`f (SUC i)`]; ASM_SIMP_TAC[]; REWRITE_TAC[SUBSET;IN_INTER;IN_UNION]; REPEAT WEAKER_STRIP_TAC; TYPIFY `mcell4 V ul SUBSET aff_ge {EL 0 ul, EL 1 ul} {f i} UNION aff_ge {EL 0 ul, EL 1 ul } {f (SUC i)}` (C SUBGOAL_THEN ASSUME_TAC); REWRITE_TAC[SUBSET;IN_UNION]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM MATCH_MP_TAC; FIRST_X_ASSUM_ST `convex` MP_TAC; TYPIFY `{EL 0 ul, EL 1 ul, f (SUC i), f i} = {EL 0 ul, EL 1 ul, f (i), f (SUC i)}` (C SUBGOAL_THEN SUBST1_TAC); BY(SET_TAC[]); BY(ASM_MESON_TAC[SUBSET]); FIRST_X_ASSUM_ST `NULLSET` MP_TAC; REWRITE_TAC[]; MATCH_MP_TAC NEGLIGIBLE_SUBSET; TYPIFY `aff_ge {EL 0 ul, EL 1 ul} {f i} UNION aff_ge {EL 0 ul, EL 1 ul} {f (SUC i)}` EXISTS_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC NEGLIGIBLE_UNION; BY(REWRITE_TAC[NULLSET_AFF_2_1]) ]);;
(* }}} *)
let MCELL4_DIHX_AZIM = 
prove_by_refinement( `!V ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ barV V 3 ul /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ ~NULLSET (mcell4 V ul) /\ mcell4 V ul SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> dihX V (mcell4 V ul) (EL 0 ul, EL 1 ul) = azim (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC LEAF_RANK_COLLINEAR [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_TAC; INTRO_TAC MCELL4_AZIM_LT_PI [`V`;`ul`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; GMATCH_SIMP_TAC Local_lemmas.AZIM_LE_PI_EQ_DIHV; CONJ_TAC; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); INTRO_TAC Merge_ineq.DIHV_EQ_DIH_Y [`EL 0 ul`;`EL 1 ul`;`f i`;`f (SUC i)`]; REWRITE_TAC[LET_DEF;LET_END_DEF]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_THEN SUBST1_TAC; INTRO_TAC Tskajxy_lemmas.DIHX_DIH_Y_lemma [`V`;`mcell4 V ul`;`[EL 0 ul;EL 1 ul;f i;f (SUC i)]`;`EL 0 ul`;`EL 1 ul`;`f i`;`f (SUC i)`;`4`;`dist(EL 0 ul,EL 1 ul)`;`dist(EL 0 ul,f i)`;`dist(EL 0 ul, f (SUC i))`;`dist(f i, f (SUC i))`;`dist(EL 1 ul,f (SUC i))`;`dist(EL 1 ul,f i)`]; ANTS_TAC; ASM_REWRITE_TAC[arith `4 >= 4`]; INTRO_TAC MCELL4_FI [`V`;`ul`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; INTRO_TAC MCELL4_CONVEX_HULL [`V`;`ul`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; REWRITE_TAC[GSYM Bump.MCELL4]; MATCH_MP_TAC MCELL4_BARV_FI; BY(ASM_MESON_TAC[]); BY(DISCH_THEN (unlist REWRITE_TAC)) ]);;
(* }}} *)
let LEAF_RANK_HAS_SIZE = 
prove_by_refinement( `!V ul w0 n f. ~(n=0) /\ packing V /\ saturated V /\ leaf_rank V ul w0 n f /\ ~collinear {EL 0 ul, EL 1 ul, w0} ==> s_leaf V ul HAS_SIZE n`,
(* {{{ proof *) [ REWRITE_TAC[HAS_SIZE]; REPEAT WEAKER_STRIP_TAC; SUBCONJ_TAC; BY(ASM_MESON_TAC[S_LEAF_FINITE]); DISCH_TAC; INTRO_TAC LEAF_RANK_PERIODIC [`V`;`ul`;`w0`;`n`;`f`]; ASM_REWRITE_TAC[]; DISCH_TAC; INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`ul`;`w0`;`n`;`f`]; ASM_REWRITE_TAC[]; DISCH_TAC; FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank]; GMATCH_SIMP_TAC (GSYM PERIODIC_IMAGE); TYPIFY `n` EXISTS_TAC; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC EQ_SYM; TYPIFY `n = CARD {i | i < n }` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[CARD_NUMSEG_LT]); MATCH_MP_TAC Misc_defs_and_lemmas.BIJ_CARD; TYPIFY `f` EXISTS_TAC; REWRITE_TAC[FINITE_NUMSEG_LT]; REWRITE_TAC[BIJ;INJ]; SUBCONJ_TAC; CONJ_TAC; FIRST_X_ASSUM_ST `IMAGE` MP_TAC; REWRITE_TAC[EXTENSION;IN_IMAGE]; BY(MESON_TAC[]); REWRITE_TAC[IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC (GSYM MOD_LT); TYPIFY `n` EXISTS_TAC; ASM_REWRITE_TAC[]; TYPIFY `y = y MOD n` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_MESON_TAC[MOD_LT]); TYPIFY `azim (EL 0 ul) (EL 1 ul) (f x) (f y) = &0` ENOUGH_TO_SHOW_TAC; BY(ASM_MESON_TAC[]); FIRST_X_ASSUM SUBST1_TAC; BY(REWRITE_TAC[AZIM_REFL]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[SURJ]; FIRST_X_ASSUM_ST `IMAGE` MP_TAC; REWRITE_TAC[EXTENSION;IN_IMAGE]; BY(MESON_TAC[]) ]);;
(* }}} *)
let MCELL4_FULL_WEDGE = 
prove_by_refinement( `!V X ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ barV V 3 ul /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ ~NULLSET (mcell4 V ul) /\ mcell_set V X /\ X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) /\ {EL 0 ul, EL 1 ul} IN edgeX V X /\ mcell4 V ul SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> (X = mcell4 V ul)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `mcell_set` MP_TAC; REWRITE_TAC[Qzyzmjc.mcell_set_2;IN_ELIM_THM]; REWRITE_TAC[IN]; REWRITE_TAC[arith `!i. i <= 4 <=> i <= 1 \/ i = 4 \/ (i = 2 \/ i = 3)`]; REPEAT WEAKER_STRIP_TAC; PROOF_BY_CONTR_TAC; COMMENT "case 1";
FIRST_X_ASSUM DISJ_CASES_TAC; INTRO_TAC Bump.EDGE_IMP_K2 [`V`;`ul'`;`i'`]; ASM_REWRITE_TAC[EXTENSION;NOT_IN_EMPTY]; BY(ASM_MESON_TAC[]); COMMENT "case 4"; FIRST_X_ASSUM DISJ_CASES_TAC; INTRO_TAC MCELL4_FI [`V`;`ul`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_SIMP_TAC[]); DISCH_TAC; INTRO_TAC Leaf_cell.MCELL_EDGE_FIRST [`V`;`ul'`;`4`;`EL 0 ul`;`EL 1 ul`]; ANTS_TAC; BY(ASM_MESON_TAC[IN]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC MCELL4_FI [`V`;`vl`;`w0`;`n`;`f`;`i`]; ANTS_TAC; ASM_SIMP_TAC[]; TYPIFY `~NULLSET (mcell4 V vl)` (C SUBGOAL_THEN ASSUME_TAC); DISCH_TAC; FIRST_X_ASSUM_ST `edgeX` MP_TAC; ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC Bump.RIJRIED; REWRITE_TAC[NOT_IN_EMPTY]; BY(ASM_MESON_TAC[IN;Bump.MCELL4]); BY(ASM_MESON_TAC[IN;Bump.MCELL4]); DISCH_TAC; BY(ASM_MESON_TAC[Bump.MCELL4]); COMMENT "cases 2 and 3"; INTRO_TAC LEAF_RANK_REUHADY [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`i`]; REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN MP_TAC THEN ANTS_TAC; ASM_SIMP_TAC[]; MATCH_MP_TAC LEAF_RANK_HAS_SIZE; REWRITE_TAC[Bump.EL_EXPLICIT]; GEXISTL_TAC [`w0`;`f`]; BY(ASM_MESON_TAC[arith `1 < n ==> ~(n = 0)`]); REWRITE_TAC[azim_mcell]; TYPED_ABBREV_TAC `(A:(real^3->bool)->bool) = {X | mcell_set V X /\ {EL 0 ul, EL 1 ul} IN edgeX V X /\ X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))}` ; INTRO_TAC SUM_SUBSET_SIMPLE [`{X,mcell4 V ul}`;`A`;`(\X. dihX V X (EL 0 ul,EL 1 ul))`]; ANTS_TAC; CONJ_TAC; EXPAND_TAC "A"; MATCH_MP_TAC FINITE_SUBSET; TYPIFY `{X | mcell_set V X /\ edgeX V X {EL 0 ul, EL 1 ul} }` EXISTS_TAC; CONJ_TAC; MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2; BY(ASM_MESON_TAC[]); BY(SET_TAC[IN]); CONJ_TAC; EXPAND_TAC "A"; REWRITE_TAC[SUBSET;IN_INSERT;IN_ELIM_THM;NOT_IN_EMPTY]; GEN_TAC; STRIP_TAC; REWRITE_TAC[Qzyzmjc.mcell_set_2;IN_ELIM_THM]; BY(ASM_MESON_TAC[SUBSET;IN;arith `2 <= 4 /\ 3 <= 4`]); REWRITE_TAC[Qzyzmjc.mcell_set_2;IN_ELIM_THM]; CONJ_TAC; GEXISTL_TAC [`4`;`ul`]; BY(ASM_MESON_TAC[IN;arith `4 <= 4`;Bump.MCELL4]); CONJ_TAC; FIRST_X_ASSUM SUBST1_TAC; GMATCH_SIMP_TAC Bump.MCELL4_EDGE; CONJ_TAC; BY(ASM_MESON_TAC[]); SUBCONJ_TAC; MATCH_MP_TAC Marchal_cells_2_new.CARD4_IMP_DISTINCT; GEXISTL_TAC [`EL 2 ul`;`EL 3 ul`]; MATCH_MP_TAC MCELL4_CARD4; BY(ASM_MESON_TAC[]); DISCH_TAC; GMATCH_SIMP_TAC Bump.set_of_list4; CONJ2_TAC; BY(SET_TAC[]); REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; BY(ASM_MESON_TAC[]); BY(ASM_MESON_TAC[SUBSET]); BY(REWRITE_TAC[Marchal_cells_3.DIHX_RANGE]); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `<=` MP_TAC; ASM_REWRITE_TAC[]; REPLICATE_TAC 2 (FIRST_X_ASSUM kill); REWRITE_TAC[arith `~(x <= y) <=> (y < x)`]; GMATCH_SIMP_TAC Geomdetail.SUM_DIS2; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC MCELL4_DIHX_AZIM; GEXISTL_TAC [`f`;`i`]; CONJ_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[arith `a < d + a <=> &0 < d`]; FIRST_X_ASSUM DISJ_CASES_TAC; INTRO_TAC Leaf_cell.MCELL2_EDGE_FIRST [`V`;`ul'`;`EL 0 ul`;`EL 1 ul`]; ANTS_TAC; BY(ASM_MESON_TAC[Bump.MCELL2;IN]); REWRITE_TAC[IN]; REPEAT WEAKER_STRIP_TAC; TYPIFY `dihX V (mcell i' V ul') (EL 0 ul,EL 1 ul) = dihX V (mcell2 V vl) (EL 0 vl,EL 1 vl)` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_MESON_TAC[Bump.MCELL2]); MATCH_MP_TAC MCELL2_DIHX_POS; REWRITE_TAC[]; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[Bump.MCELL2]); COMMENT "case 3"; INTRO_TAC Leaf_cell.MCELL3_EDGE_FIRST [`V`;`ul'`;`EL 0 ul`;`EL 1 ul`]; ANTS_TAC; BY(ASM_MESON_TAC[Bump.MCELL3;IN]); REWRITE_TAC[IN]; REPEAT WEAKER_STRIP_TAC; TYPIFY `dihX V (mcell i' V ul') (EL 0 ul,EL 1 ul) = dihX V (mcell3 V vl) (EL 0 vl,EL 1 vl)` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_MESON_TAC[Bump.MCELL3]); MATCH_MP_TAC MCELL3_DIHX_POS; REWRITE_TAC[]; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[Bump.MCELL3]) ]);; (* }}} *)
let MCELL4_REPARAM = 
prove_by_refinement( `!V ul vl. packing V /\ saturated V /\ CARD (set_of_list ul) = 4 /\ (set_of_list ul = set_of_list vl) /\ LENGTH vl = 4 /\ ~(NULLSET (mcell4 V ul)) /\ barV V 3 ul ==> mcell4 V ul = mcell4 V vl /\ barV V 3 vl`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC Marchal_cells_3.LEFT_ACTION_LIST_3_EXISTS [`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`EL 3 ul`;`EL 0 vl`;`EL 1 vl`;`EL 2 vl`;`EL 3 vl`]; TYPIFY `set_of_list ul = {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC Bump.set_of_list4; REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; BY(ASM_MESON_TAC[]); TYPIFY `set_of_list vl = {EL 0 vl,EL 1 vl,EL 2 vl,EL 3 vl}` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC Bump.set_of_list4; BY(ASM_REWRITE_TAC[]); ANTS_TAC; BY(ASM_MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; TYPIFY `ul = [EL 0 ul;EL 1 ul;EL 2 ul;EL 3 ul]` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC Bump.LENGTH4; REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; BY(ASM_MESON_TAC[]); TYPIFY `vl = [EL 0 vl;EL 1 vl;EL 2 vl;EL 3 vl]` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC Bump.LENGTH4; BY(ASM_REWRITE_TAC[]); INTRO_TAC Rvfxzbu.RVFXZBU [`V`;`ul`;`4`;`p`]; ASM_REWRITE_TAC[IN_INSERT;arith `4 - 1 = 3`]; DISCH_TAC; SUBCONJ_TAC; BY(ASM_MESON_TAC[Bump.MCELL4]); DISCH_TAC; INTRO_TAC Qzksykg.QZKSYKG1 [`V`;`ul`;`vl`;`4`;`p`]; DISCH_THEN MATCH_MP_TAC; ASM_REWRITE_TAC[IN_INSERT;arith `4 - 1 = 3`]; BY(ASM_MESON_TAC[Bump.MCELL4;NEGLIGIBLE_EMPTY]) ]);;
(* }}} *)
let MCELL4_GG = 
prove_by_refinement( `!V X ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ barV V 3 ul /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ X = mcell4 V ul /\ ~NULLSET X /\ X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> gg_mcell V f (EL 0 ul) (EL 1 ul) i = gammaX V X lmfun * critical_weight V X + beta_bump_v1 V {EL 0 ul,EL 1 ul} X`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[gg_mcell]; TYPIFY `{X | mcell_set V X /\ {EL 0 ul, EL 1 ul} IN edgeX V X /\ X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))} = {X}` ENOUGH_TO_SHOW_TAC; DISCH_THEN SUBST1_TAC; BY(REWRITE_TAC[SUM_SING]); ONCE_REWRITE_TAC[EXTENSION]; REWRITE_TAC[IN_SING;IN_ELIM_THM]; REWRITE_TAC[Geomdetail.EQ_EXPAND]; REPEAT WEAKER_STRIP_TAC; CONJ2_TAC; DISCH_THEN SUBST1_TAC; ASM_SIMP_TAC[]; REWRITE_TAC[Pack_defs.mcell_set]; REWRITE_TAC[Pack_defs.mcell_set;IN_ELIM_THM]; CONJ_TAC; BY(ASM_MESON_TAC[Bump.MCELL4;IN]); GMATCH_SIMP_TAC Bump.MCELL4_EDGE; CONJ_TAC; BY(ASM_MESON_TAC[]); SUBCONJ_TAC; MATCH_MP_TAC Marchal_cells_2_new.CARD4_IMP_DISTINCT; GEXISTL_TAC [`EL 2 ul`;`EL 3 ul`]; MATCH_MP_TAC MCELL4_CARD4; BY(ASM_MESON_TAC[]); DISCH_TAC; GMATCH_SIMP_TAC Bump.set_of_list4; CONJ2_TAC; BY(SET_TAC[]); REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; BY(ASM_MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC MCELL4_FULL_WEDGE; GEXISTL_TAC [`w0`;`n`;`f`;`i`]; ASM_SIMP_TAC[]; BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let LEAF_RANK_TRUNCATE = 
prove_by_refinement( `!V ul w0 n f. leaf_rank V ul w0 n f = leaf_rank V [EL 0 ul;EL 1 ul] w0 n f`,
(* {{{ proof *) [ REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; BY(MESON_TAC[S_LEAF_TRUNCATE]) ]);;
(* }}} *)
let LEAF_RANK_S_LEAF = 
prove_by_refinement( `!V ul w0 n f i. leaf_rank V ul w0 n f ==> s_leaf V ul (f i)`,
(* {{{ proof *) [ REWRITE_TAC[leaf_rank;IMAGE;EXTENSION;IN_ELIM_THM;IN_UNIV]; BY(MESON_TAC[IN]) ]);;
(* }}} *)
let CC_CELL_SUBSET_WEDGE = 
prove_by_refinement( `!V ul u0 u1 w0 n f j. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ (1 < n) /\ {u0,u1} = {EL 0 ul,EL 1 ul} /\ ~collinear {EL 0 ul, EL 1 ul, w0} ==> cc_cell V [u0;u1;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f j) (f (SUC j)) \/ cc_cell V [u0;u1;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f (j+(n-1))) (f j)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `?i. (i < n) /\ f j = f i /\ f(SUC j) = f(SUC i) /\ f(j+(n-1)) = f(i+(n-1))` (C SUBGOAL_THEN MP_TAC); TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); TYPIFY `j MOD n` EXISTS_TAC; BY(ASM_SIMP_TAC[F_DEMOD;FM_DEMOD;DIVISION]); DISCH_THEN (fun t -> REPEAT (FIRST_X_ASSUM MP_TAC) THEN MP_TAC t); STRIP_TAC; ASM_REWRITE_TAC[]; REPLICATE_TAC 3 (FIRST_X_ASSUM kill); REPEAT WEAKER_STRIP_TAC; COMMENT "restart";
TYPIFY `!i. leaf V [EL 0 ul; EL 1 ul; f i]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC s_leaf_leaf; REWRITE_TAC[IN]; MATCH_MP_TAC LEAF_RANK_S_LEAF; BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); TYPIFY `leaf V [u0;u1;f i]` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `=` MP_TAC; REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; DISCH_THEN DISJ_CASES_TAC; BY(ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; INTRO_TAC Leaf_cell.ZASUVOR [`V`;`EL 0 ul`;`EL 1 ul`;`f i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); BY(MESON_TAC[]); COMMENT "f periodic"; TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[LEAF_RANK_PERIODIC]); COMMENT "mcell in wedge"; INTRO_TAC MCELL_IN_WEDGE [`V`;` [EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`cc_cell V [u0;u1;f i]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; ANTS_TAC; CONJ_TAC; MATCH_MP_TAC LEAF_RANK_HAS_SIZE; REWRITE_TAC[Bump.EL_EXPLICIT]; BY(ASM_MESON_TAC[arith `1 < n ==> ~(n=0)`]); CONJ_TAC; ONCE_REWRITE_TAC[GSYM IN]; MATCH_MP_TAC Leaf_cell.CC_CELL_IN_MCELL_SET; BY(ASM_REWRITE_TAC[]); CONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.CC_CELL_NOT_NULLSET]); INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u0;u1; f i]`]; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); REPEAT WEAKER_STRIP_TAC; COMMENT "f i' in wedge"; INTRO_TAC Leaf_cell.U2_IN_CC_CELL [`V`;`[u0;u1;f i]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_TAC; INTRO_TAC S_LEAF_IN_WEDGE_GE [`V`;`[EL 0 ul;EL 1 ul]`;`f i`;`w0`;`n`;`f`;`i'`;`i`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; ANTS_TAC; BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); COMMENT "first case"; DISCH_THEN DISJ_CASES_TAC; INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`i`;`i'`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT;AZIM_REFL]; ASM_SIMP_TAC[arith `1 < n ==> ~(n=0)`]; DISCH_TAC; TYPIFY `f (SUC i') = f (SUC i)` ENOUGH_TO_SHOW_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC Oxl_def.periodic_mod; TYPIFY `n` EXISTS_TAC; GMATCH_SIMP_TAC (GSYM Hypermap.lemma_suc_mod); FIRST_X_ASSUM (SUBST1_TAC o GSYM); BY(ASM_MESON_TAC[Hypermap.lemma_suc_mod;Oxl_def.periodic_mod;arith `1 < n ==> ~(n=0)`]); DISJ2_TAC; COMMENT "second case"; TYPIFY `f i' = f (i + n - 1)` ENOUGH_TO_SHOW_TAC; BY(ASM_MESON_TAC[]); INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`i`;`SUC i'`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT;AZIM_REFL]; ASM_SIMP_TAC[arith `1 < n ==> ~(n=0)`]; DISCH_TAC; TYPIFY `i' MOD n = (i + n - 1) MOD n` ENOUGH_TO_SHOW_TAC; DISCH_TAC; BY(ASM_MESON_TAC [Oxl_def.periodic_mod;arith `1 < n ==> ~(n = 0)`]); GMATCH_SIMP_TAC (GSYM MOD_ADD_MOD); ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC MOD_ADD_MOD; TYPIFY `SUC i' + n - 1 = 1*n + i'` (C SUBGOAL_THEN SUBST1_TAC); BY(FIRST_X_ASSUM_ST `1 < n` MP_TAC THEN ARITH_TAC); REWRITE_TAC[MOD_MULT_ADD]; BY(ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`]) ]);; (* }}} *) (* let CC_CELL_SUBSET_WEDGE = prove_by_refinement( `!V ul u0 u1 w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ (1 < n) /\ (i < n) /\ {u0,u1} = {EL 0 ul,EL 1 ul} /\ ~collinear {EL 0 ul, EL 1 ul, w0} ==> cc_cell V [u0;u1;f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) \/ cc_cell V [u0;u1;f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f (i+(n-1))) (f i)`, (* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `!i. leaf V [EL 0 ul; EL 1 ul; f i]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC s_leaf_leaf; REWRITE_TAC[IN]; MATCH_MP_TAC LEAF_RANK_S_LEAF; BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); TYPIFY `leaf V [u0;u1;f i]` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `=` MP_TAC; REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; DISCH_THEN DISJ_CASES_TAC; BY(ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; INTRO_TAC Leaf_cell.ZASUVOR [`V`;`EL 0 ul`;`EL 1 ul`;`f i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); BY(MESON_TAC[]); COMMENT "f periodic"; TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[LEAF_RANK_PERIODIC]); COMMENT "mcell in wedge"; INTRO_TAC MCELL_IN_WEDGE [`V`;` [EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`cc_cell V [u0;u1;f i]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; ANTS_TAC; CONJ_TAC; MATCH_MP_TAC LEAF_RANK_HAS_SIZE; REWRITE_TAC[Bump.EL_EXPLICIT]; BY(ASM_MESON_TAC[arith `1 < n ==> ~(n=0)`]); CONJ_TAC; ONCE_REWRITE_TAC[GSYM IN]; MATCH_MP_TAC Leaf_cell.CC_CELL_IN_MCELL_SET; BY(ASM_REWRITE_TAC[]); CONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.CC_CELL_NOT_NULLSET]); INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u0;u1; f i]`]; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); REPEAT WEAKER_STRIP_TAC; COMMENT "f i' in wedge"; INTRO_TAC Leaf_cell.U2_IN_CC_CELL [`V`;`[u0;u1;f i]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_TAC; INTRO_TAC S_LEAF_IN_WEDGE_GE [`V`;`[EL 0 ul;EL 1 ul]`;`f i`;`w0`;`n`;`f`;`i'`;`i`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; ANTS_TAC; BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); COMMENT "first case"; DISCH_THEN DISJ_CASES_TAC; INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`i`;`i'`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT;AZIM_REFL]; ASM_SIMP_TAC[arith `1 < n ==> ~(n=0)`]; DISCH_TAC; TYPIFY `f (SUC i') = f (SUC i)` ENOUGH_TO_SHOW_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC Oxl_def.periodic_mod; TYPIFY `n` EXISTS_TAC; GMATCH_SIMP_TAC (GSYM Hypermap.lemma_suc_mod); FIRST_X_ASSUM (SUBST1_TAC o GSYM); BY(ASM_MESON_TAC[Hypermap.lemma_suc_mod;Oxl_def.periodic_mod;arith `1 < n ==> ~(n=0)`]); DISJ2_TAC; COMMENT "second case"; TYPIFY `f i' = f (i + n - 1)` ENOUGH_TO_SHOW_TAC; BY(ASM_MESON_TAC[]); INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`i`;`SUC i'`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT;AZIM_REFL]; ASM_SIMP_TAC[arith `1 < n ==> ~(n=0)`]; DISCH_TAC; TYPIFY `i' MOD n = (i + n - 1) MOD n` ENOUGH_TO_SHOW_TAC; DISCH_TAC; BY(ASM_MESON_TAC [Oxl_def.periodic_mod;arith `1 < n ==> ~(n = 0)`]); GMATCH_SIMP_TAC (GSYM MOD_ADD_MOD); ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC MOD_ADD_MOD; TYPIFY `SUC i' + n - 1 = 1*n + i'` (C SUBGOAL_THEN SUBST1_TAC); BY(FIRST_X_ASSUM_ST `1 < n` MP_TAC THEN ARITH_TAC); REWRITE_TAC[MOD_MULT_ADD]; BY(ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`]) ]);; (* }}} *) *)
let WEDGE_UNIQUE_CC_CELL = 
prove_by_refinement( `!V ul w0 n f i j. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ 1 < n /\ ~collinear {EL 0 ul, EL 1 ul, w0} ==> (~(cc_cell V [EL 0 ul;EL 1 ul;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f(SUC i))) \/ ~(cc_cell V [EL 1 ul;EL 0 ul;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f(SUC i))))`,
(* {{{ proof *) [ REWRITE_TAC[GSYM DE_MORGAN_THM]; REPEAT WEAKER_STRIP_TAC; TYPIFY `cc_ke V [EL 0 ul;EL 1 ul;f j] = 4 \/ cc_ke V [EL 1 ul;EL 0 ul;f j] = 4` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank;IMAGE;EXTENSION;IN_UNIV;IN_ELIM_THM]; REWRITE_TAC[IN;s_leaf;Bump.EL_EXPLICIT]; BY(MESON_TAC[]); COMMENT "do symmetry reduction";
TYPED_ABBREV_TAC `(W:real^3->bool) = wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))` ; TYPIFY `!u0 u1. {u0,u1} = {EL 0 ul,EL 1 ul} /\ cc_ke V [u0;u1;f j] = 4 /\ cc_cell V [u0;u1;f j] SUBSET W /\ cc_cell V [u1;u0;f j] SUBSET W ==> F` ENOUGH_TO_SHOW_TAC; DISCH_THEN MATCH_MP_TAC; FIRST_X_ASSUM DISJ_CASES_TAC; GEXISTL_TAC [`EL 0 ul`;`EL 1 ul`]; BY(ASM_REWRITE_TAC[]); GEXISTL_TAC [`EL 1 ul`;`EL 0 ul`]; ASM_REWRITE_TAC[]; BY(SET_TAC[]); REPEAT WEAKER_STRIP_TAC; COMMENT "basic facts"; TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC s_leaf_leaf; REWRITE_TAC[IN]; MATCH_MP_TAC LEAF_RANK_S_LEAF; BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); TYPIFY `leaf V [u0;u1;f j]` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `{u0,u1} = {v0,v1}` MP_TAC; REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; DISCH_THEN DISJ_CASES_TAC; BY(ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; INTRO_TAC Leaf_cell.ZASUVOR [`V`;`EL 0 ul`;`EL 1 ul`;`f j`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); BY(MESON_TAC[]); TYPIFY `leaf V [u1;u0;f j]` (C SUBGOAL_THEN ASSUME_TAC); INTRO_TAC Leaf_cell.ZASUVOR [`V`;`u0`;`u1`;`f j`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); BY(MESON_TAC[]); COMMENT "show 4-cell has standard form"; INTRO_TAC Leaf_cell.MCELL4_EDGE_FIRST [`V`;`cc_uh V [u0;u1;f j]`;`EL 0 ul`;`EL 1 ul`]; ANTS_TAC; ASM_REWRITE_TAC[]; SUBCONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.cc_uh]); DISCH_TAC; INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u0;u1;f j]`]; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT;Leaf_cell.cc_cell;Bump.MCELL4]); REWRITE_TAC[]; ONCE_REWRITE_TAC[EQ_SYM_EQ]; REPEAT WEAKER_STRIP_TAC; TYPIFY `cc_cell V [u0;u1;f j] = mcell4 V vl` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); INTRO_TAC MCELL4_FI [`V`;`vl`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_MESON_TAC[IN;Leaf_cell.CC_CELL_NOT_NULLSET]); COMMENT "show two cc cells are equal"; DISCH_TAC; INTRO_TAC MCELL4_FULL_WEDGE [`V`;`cc_cell V [u1;u0;f j]`;`vl`;`w0`;`n`;`f`;`i`]; ANTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; BY(ASM_MESON_TAC[IN]); CONJ_TAC; BY(ASM_MESON_TAC[IN;Leaf_cell.CC_CELL_NOT_NULLSET]); CONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.CC_CELL_IN_MCELL_SET;IN]); CONJ_TAC; INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u1;u0;f j]`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; TYPIFY `{u1,u0} = {u0,u1}` (C SUBGOAL_THEN SUBST1_TAC); BY(SET_TAC[]); BY(ASM_REWRITE_TAC[]); BY(ASM_MESON_TAC[]); DISCH_TAC; COMMENT "deal with equality"; TYPIFY `~(EL 0 ul = EL 1 ul)` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); TYPIFY `~(u0 = u1)` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `{u0,u1} = {v0,v1}` MP_TAC; REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; DISCH_THEN DISJ_CASES_TAC; BY(ASM_REWRITE_TAC[]); BY(ASM_REWRITE_TAC[]); INTRO_TAC Leaf_cell.FUEIMOV_4 [`V`;`[u0;u1;f j]`;`[u1;u0;f j]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT;CONS_11]; DISCH_THEN MP_TAC THEN ANTS_TAC; TYPIFY `{u0,u1} = {u1,u0}` (C SUBGOAL_THEN ASSUME_TAC); BY(SET_TAC[]); REPEAT (GMATCH_SIMP_TAC Leaf_cell.STEM_OF_LEAF); REWRITE_TAC[Bump.EL_EXPLICIT]; BY(ASM_MESON_TAC[]); DISCH_TAC; TYPIFY `EL 3 (cc_uh V [u1;u0;f j]) = f j` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM SUBST1_TAC; BY(REWRITE_TAC[Bump.EL_EXPLICIT]); INTRO_TAC Leaf_cell.CC_CELL_NOT_NULLSET [`V`;`[u1;u0;f j]`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[]; PROOF_BY_CONTR_TAC; INTRO_TAC Leaf_cell.CC_CELL4 [`V`;`[u1;u0;f j]`]; ANTS_TAC; ASM_REWRITE_TAC[]; INTRO_TAC Ajripqn.AJRIPQN [`V`;`vl`;`cc_uh V [u1;u0;f j]`;`4`;`cc_ke V [u1;u0;f j]`]; ANTS_TAC; TYPIFY `saturated V /\ packing V /\ barV V 3 vl` (C SUBGOAL_THEN (unlist REWRITE_TAC)); BY(ASM_MESON_TAC[IN]); CONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); CONJ_TAC; BY(SET_TAC[]); REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; CONJ_TAC; BY(MESON_TAC[Leaf_cell.CC_KE_34]); TYPIFY `(mcell 4 V vl INTER mcell (cc_ke V [u1; u0; f j]) V (cc_uh V [u1; u0; f j])) = cc_cell V [u1;u0; f j]` ENOUGH_TO_SHOW_TAC; DISCH_THEN SUBST1_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[GSYM Bump.MCELL4]; BY(ASM_MESON_TAC[INTER_IDEMPOT;Leaf_cell.cc_cell]); BY(MESON_TAC[]); DISCH_TAC; TYPIFY `set_of_list (cc_uh V [u1;u0;f j]) SUBSET affine hull {u1,u0,f j}` ENOUGH_TO_SHOW_TAC; DISCH_TAC; FIRST_X_ASSUM_ST `NULLSET` MP_TAC; REWRITE_TAC[]; MATCH_MP_TAC NEGLIGIBLE_SUBSET; TYPIFY `affine hull {u1,u0,f j}` EXISTS_TAC; REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]; FIRST_X_ASSUM_ST `cc_cell V ul = x` SUBST1_TAC; FIRST_X_ASSUM (MP_TAC o (MATCH_MP Marchal_cells.CONVEX_HULL_SUBSET)); BY(MESON_TAC[CONVEX_HULL_EQ;AFFINE_AFFINE_HULL;AFFINE_IMP_CONVEX]); MATCH_MP_TAC SUBSET_TRANS; TYPIFY `{u1,u0,f j}` EXISTS_TAC; REWRITE_TAC[Counting_spheres.SUBSET_P_HULL]; INTRO_TAC Leaf_cell.EL_CC_UH [`V`;`[u1;u0;f j]`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC Bump.set_of_list4; CONJ_TAC; INTRO_TAC Leaf_cell.cc_uh [`V`;`[u1;u0;f j]`]; ANTS_TAC; BY(ASM_MESON_TAC[]); BY(MESON_TAC[IN;Sphere.BARV;arith `3 + 1 = 4`]); ASM_REWRITE_TAC[]; BY(SET_TAC[]) ]);; (* }}} *) (* let WEDGE_UNIQUE_CC_CELL_ALT = prove_by_refinement( `!V ul w0 n f i j. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ 1 < n /\ ~collinear {EL 0 ul, EL 1 ul, w0} ==> (~(cc_cell V [EL 0 ul;EL 1 ul;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f(SUC i))) \/ ~(cc_cell V [EL 1 ul;EL 0 ul;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f(SUC i))))`, (* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); INTRO_TAC WEDGE_UNIQUE_CC_CELL [`V`;`ul`;`w0`;`n`;`f`;`i MOD n`;`j`]; BY(ASM_SIMP_TAC[DIVISION;F_DEMOD]) ]);; (* }}} *) *)
let LEAF_RANK4_CHI_MSB = 
prove_by_refinement( `!V ul w0 n f i. packing V /\ saturated V /\ barV V 3 ul /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ i < n /\ ~NULLSET (mcell4 V ul) /\ mcell4 V ul SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> &0 < chi_msb [EL 0 ul;EL 1 ul;f i] (f (SUC i))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC MCELL4_AZIM_LT_PI [`V`;`ul`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; REWRITE_TAC[Leaf_cell.chi_msb;GSYM Local_lemmas.SIN_AZIM_MUTUAL_SROSS;Bump.EL_EXPLICIT]; INTRO_TAC (GSYM AZIM_TRANSLATION) [`EL 0 ul`;`(vec 0):real^3`;`(EL 1 ul - EL 0 ul):real^3`;`(f i - EL 0 ul):real^3`;`(f (SUC i) - EL 0 ul):real^3`]; REWRITE_TAC[varith `!(u:real^3) v. v + u - v = u`;varith `!(u:real^3). u + vec 0 = u`]; DISCH_THEN SUBST1_TAC; MATCH_MP_TAC SIN_POS_PI; ASM_REWRITE_TAC[]; MATCH_MP_TAC (arith `~(x = &0) /\ (&0 <= x) ==> &0 < x`); REWRITE_TAC[Local_lemmas.AZIM_RANGE]; GMATCH_SIMP_TAC LEAF_RANK_AZIM_INJ; TYPIFY `n` EXISTS_TAC; CONJ_TAC; GEXISTL_TAC [`V`;`w0`]; ASM_SIMP_TAC[arith `1 < n ==> ~(n=0)`]; BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); ASM_SIMP_TAC[MOD_LT]; TYPIFY `SUC i < n \/ SUC i = n` (C SUBGOAL_THEN DISJ_CASES_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); ASM_SIMP_TAC[MOD_LT]; BY(ARITH_TAC); ASM_SIMP_TAC[MOD_REFL_ALT;arith `1 < n ==> ~(n = 0)`]; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC) ]);;
(* }}} *)
let LEAF_RANK4_CHI_MSB_ALT = 
prove_by_refinement( `!V ul w0 n f i. packing V /\ saturated V /\ barV V 3 ul /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ ~NULLSET (mcell4 V ul) /\ mcell4 V ul SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> &0 < chi_msb [EL 0 ul;EL 1 ul;f i] (f (SUC i))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC PERIODIC_REDUCE_MOD [`f`;`n`;`i`]; ANTS_TAC; ASM_SIMP_TAC[ arith `1 < n ==> 1 <= n`]; BY(ASM_MESON_TAC[LEAF_RANK_PERIODIC]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC LEAF_RANK4_CHI_MSB [`V`;`ul`;`w0`;`n`;`f`;`j`]; ASM_REWRITE_TAC[]; DISCH_THEN MATCH_MP_TAC; BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let CC_CELL_WEDGE_MATCH_UH = 
prove_by_refinement( `!V ul u0 u1 w0 n f i j. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ {u0,u1} = {EL 0 ul,EL 1 ul} /\ cc_cell V [u0;u1;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) /\ cc_ke V [u0;u1;f j] = 4 ==> {f j, EL 3 (cc_uh V [u0;u1;f j])} = {f i, f (SUC i)}`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; COMMENT "basic facts";
TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC s_leaf_leaf; REWRITE_TAC[IN]; MATCH_MP_TAC LEAF_RANK_S_LEAF; BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); TYPIFY `leaf V [u0;u1;f j]` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `{u0,u1} = {v0,v1}` MP_TAC; REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; DISCH_THEN DISJ_CASES_TAC; BY(ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; INTRO_TAC Leaf_cell.ZASUVOR [`V`;`EL 0 ul`;`EL 1 ul`;`f j`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); BY(MESON_TAC[]); TYPIFY `leaf V [u1;u0;f j]` (C SUBGOAL_THEN ASSUME_TAC); INTRO_TAC Leaf_cell.ZASUVOR [`V`;`u0`;`u1`;`f j`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); BY(MESON_TAC[]); INTRO_TAC Leaf_cell.EL_CC_UH [`V`;`[u0;u1;f j]`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; TYPIFY `~(NULLSET (cc_cell V [u0;u1;f j]))` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[IN;Leaf_cell.CC_CELL_NOT_NULLSET]); COMMENT "show 4-cell has standard form"; PROOF_BY_CONTR_TAC; INTRO_TAC Leaf_cell.MCELL4_EDGE_FIRST [`V`;`cc_uh V [u0;u1;f j]`;`EL 0 ul`;`EL 1 ul`]; ANTS_TAC; ASM_REWRITE_TAC[]; SUBCONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.cc_uh]); DISCH_TAC; INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u0;u1;f j]`]; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT;Leaf_cell.cc_cell;Bump.MCELL4]); REWRITE_TAC[]; ONCE_REWRITE_TAC[EQ_SYM_EQ]; REPEAT WEAKER_STRIP_TAC; TYPIFY `cc_cell V [u0;u1;f j] = mcell4 V vl` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); INTRO_TAC MCELL4_FI [`V`;`vl`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_MESON_TAC[IN]); DISCH_TAC; COMMENT "show two cc cells are equal"; INTRO_TAC Leaf_cell.CC_CELL4 [`V`;`[u0;u1;f j]`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; TYPIFY `convex hull {EL 0 vl, EL 1 vl, f i, f (SUC i)} = convex hull set_of_list (cc_uh V [u0; u1; f j])` (C SUBGOAL_THEN MP_TAC); BY(ASM_MESON_TAC[]); DISCH_TAC; TYPIFY `affine hull {EL 0 vl, EL 1 vl, f i, f (SUC i)} = affine hull set_of_list (cc_uh V [u0; u1; f j])` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[AFFINE_HULL_CONVEX_HULL]); TYPIFY `aff_dim {EL 0 vl, EL 1 vl, f i, f (SUC i)} = aff_dim (set_of_list (cc_uh V [u0; u1; f j]))` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[AFF_DIM_AFFINE_HULL]); INTRO_TAC Leaf_cell.SET_OF_LIST_CC_UH [`V`;`[u0;u1;f j]`]; ANTS_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_TAC; TYPIFY `CARD {u0,u1,f j,EL 3 (cc_uh V [u0;u1;f j])} = 4` (C SUBGOAL_THEN ASSUME_TAC); INTRO_TAC MCELL4_CARD4 [`V`;`cc_uh V [u0;u1;f j]`]; ANTS_TAC; BY(ASM_MESON_TAC[IN;Leaf_cell.cc_uh]); BY(ASM_REWRITE_TAC[]); COMMENT "show two lists are equal"; INTRO_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ [`{EL 0 vl, EL 1 vl, f i, f (SUC i)}`;`set_of_list (cc_uh V [u0; u1; f j])`]; TYPIFY `(~affine_dependent {EL 0 vl, EL 1 vl, f i, f (SUC i)} /\ ~affine_dependent (set_of_list (cc_uh V [u0; u1; f j])))` ENOUGH_TO_SHOW_TAC; DISCH_THEN (unlist REWRITE_TAC); ASM_REWRITE_TAC[]; DISCH_TAC; FIRST_X_ASSUM_ST `~` MP_TAC; REWRITE_TAC[]; MATCH_MP_TAC CARD4_IN_PAIRS; GEXISTL_TAC [`u0`;`u1`]; ASM_REWRITE_TAC[]; FIRST_X_ASSUM (SUBST1_TAC o GSYM); FIRST_X_ASSUM_ST `{a,b} = {c,d}` MP_TAC; BY(SET_TAC[]); ASM_REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD]; REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]; TYPIFY `aff_dim {u0, u1, f j, EL 3 (cc_uh V [u0; u1; f j])} = &3` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC NOT_COPLANAR_AFF_3; ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; DISCH_THEN (MP_TAC o (MATCH_MP COPLANAR_IMP_NEGLIGIBLE)); BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]); ASM_REWRITE_TAC[]; REWRITE_TAC[INT_ARITH `!(x:int). &3 = x - &1 <=> x = &4`]; REWRITE_TAC[INT_OF_NUM_EQ]; MATCH_MP_TAC (arith `x <= 4 /\ ~(x <= 3) ==> (x = 4)`); REWRITE_TAC[Geomdetail.CARD4]; DISCH_TAC; INTRO_TAC AFF_DIM_LE_CARD [`{EL 0 ul, EL 1 ul, f i, f (SUC i)}`]; REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]; MATCH_MP_TAC (INT_ARITH `c <= &3 /\ a = int_of_num 3 ==> ~(a <= c - int_of_num 1)`); ASM_REWRITE_TAC[INT_OF_NUM_LE]; BY(ASM_MESON_TAC[]) ]);; (* }}} *) (* let CC_CELL_WEDGE_MATCH_UH_ALT = prove_by_refinement( `!V ul u0 u1 w0 n f i j. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ {u0,u1} = {EL 0 ul,EL 1 ul} /\ cc_cell V [u0;u1;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) /\ cc_ke V [u0;u1;f j] = 4 ==> {f j, EL 3 (cc_uh V [u0;u1;f j])} = {f i, f (SUC i)}`, (* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[LEAF_RANK_PERIODIC]); INTRO_TAC PERIODIC_REDUCE_MOD [`f`;`n`;`i`]; ASM_SIMP_TAC[arith `1 < n ==> 1 <= n`]; DISCH_THEN (fun t -> REPEAT (FIRST_X_ASSUM MP_TAC) THEN MP_TAC ( t)); STRIP_TAC; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_CELL_WEDGE_MATCH_UH [`V`;`ul`;`u0`;`u1`;`w0`;`n`;`f`;`j'`;`j`]; BY(ASM_MESON_TAC[]) ]);; (* }}} *) *)
let K4_CC_WI_ALT = 
prove_by_refinement( `!V ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ cc_ke V [EL 0 ul;EL 1 ul;f i] = 4 ==> cc_cell V [EL 0 ul;EL 1 ul;f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; COMMENT "preliminaries";
TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `1 < n` MP_TAC THEN ARITH_TAC); TYPIFY `f (SUC (i + n - 1)) = f i` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_SIMP_TAC[F_SUC_PRE]); INTRO_TAC CC_CELL_SUBSET_WEDGE [`V`;`ul`;`EL 0 ul`;`EL 1 ul`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_MESON_TAC[]); MATCH_MP_TAC (TAUT `~b ==> (a \/ b ==> a)`); DISCH_TAC; TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC s_leaf_leaf; REWRITE_TAC[IN]; MATCH_MP_TAC LEAF_RANK_S_LEAF; BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); INTRO_TAC Leaf_cell.EL_CC_UH [`V`;`[EL 0 ul;EL 1 ul;f i]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; TYPIFY `&0 < chi_msb [EL 0 (cc_uh V [EL 0 ul;EL 1 ul;f i]); EL 1 (cc_uh V [EL 0 ul;EL 1 ul;f i]); f(i + n - 1)] (f (SUC (i + n - 1)))` (C SUBGOAL_THEN MP_TAC); MATCH_MP_TAC LEAF_RANK4_CHI_MSB_ALT; GEXISTL_TAC [`V`;`w0`;`n`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; CONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); TYPIFY `mcell4 V (cc_uh V [EL 0 ul;EL 1 ul; f i]) = cc_cell V [EL 0 ul;EL 1 ul;f i]` (C SUBGOAL_THEN SUBST1_TAC); REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL4]; BY(ASM_MESON_TAC[]); CONJ_TAC; MATCH_MP_TAC Leaf_cell.CC_CELL_NOT_NULLSET; BY(ASM_MESON_TAC[]); BY(ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; DISCH_TAC; COMMENT "now compute chi a second way via 0 < chi cc_cell"; INTRO_TAC Leaf_cell.K4_CHI_MSB_POS [`V`;`[EL 0 ul;EL 1 ul;f (i)]`]; ASM_REWRITE_TAC[]; ONCE_REWRITE_TAC[Leaf_cell.chi_msb_swap_23]; TYPIFY `EL 3 (cc_uh V [EL 0 ul; EL 1 ul; f i]) = f (i + n - 1)` ENOUGH_TO_SHOW_TAC; DISCH_THEN SUBST1_TAC; BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); INTRO_TAC CC_CELL_WEDGE_MATCH_UH [`V`;`ul`;`EL 0 ul`;`EL 1 ul`;`w0`;`n`;`f`;`(i + n - 1)`;`i`]; ASM_REWRITE_TAC[]; REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; DISCH_THEN DISJ_CASES_TAC; PROOF_BY_CONTR_TAC; FIRST_X_ASSUM_ST `/\` MP_TAC; REPEAT WEAKER_STRIP_TAC; INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[EL 0 ul;EL 1 ul;f i]`;`w0`;`n`;`f`;`i`;`i + n - 1`]; ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`;Bump.EL_EXPLICIT;AZIM_REFL]; DISCH_THEN MP_TAC THEN ANTS_TAC; BY(ASM_MESON_TAC[]); BY(ASM_MESON_TAC[MOD_INJ1_ALT;arith `1 < n ==> ~(n = 0) /\ 1 < n ==> (n - 1) < n /\ 1 < n ==> ~(n - 1 = 0)`]); BY(ASM_MESON_TAC[]) ]);; (* }}} *) (* let K4_CC_WI_ALT = prove_by_refinement( `!V ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ cc_ke V [EL 0 ul;EL 1 ul;f i] = 4 ==> cc_cell V [EL 0 ul;EL 1 ul;f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))`, (* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); INTRO_TAC K4_CC_WI [`V`;`ul`;`w0`;`n`;`f`;`i MOD n`]; BY(ASM_SIMP_TAC[DIVISION;F_DEMOD]) ]);; (* }}} *) *)
let K4_CC_WIM = 
prove_by_refinement( `!V ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ cc_ke V [EL 1 ul;EL 0 ul;f i] = 4 ==> cc_cell V [EL 1 ul;EL 0 ul;f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f (i + n - 1)) (f i)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; COMMENT "preliminaries";
TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `1 < n` MP_TAC THEN ARITH_TAC); TYPIFY `f (SUC (i + n - 1)) = f i` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_SIMP_TAC[F_SUC_PRE]); TYPIFY `{EL 1 ul,EL 0 ul} = {EL 0 ul,EL 1 ul}` (C SUBGOAL_THEN ASSUME_TAC); BY(SET_TAC[]); INTRO_TAC CC_CELL_SUBSET_WEDGE [`V`;`ul`;`EL 1 ul`;`EL 0 ul`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_MESON_TAC[]); MATCH_MP_TAC (TAUT `~a ==> (a \/ b ==> b)`); DISCH_TAC; TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC s_leaf_leaf; REWRITE_TAC[IN]; MATCH_MP_TAC LEAF_RANK_S_LEAF; BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); TYPIFY `!j. leaf V [EL 1 ul;EL 0 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; INTRO_TAC Leaf_cell.ZASUVOR [`V`;`EL 0 ul`;`EL 1 ul`;`f j`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); BY(MESON_TAC[]); INTRO_TAC Leaf_cell.EL_CC_UH [`V`;`[EL 1 ul;EL 0 ul;f i]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC Leaf_cell.CC_CELL_NOT_NULLSET [`V`;`[EL 1 ul; EL 0 ul; f i]`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; COMMENT "reparametrize"; INTRO_TAC MCELL4_REPARAM [`V`;`cc_uh V [EL 1 ul;EL 0 ul;f i]`;`[EL 0 ul;EL 1 ul;f i; EL 3 (cc_uh V [EL 1 ul;EL 0 ul;f i])]`]; COMMENT "long list of ants"; ANTS_TAC; ASM_REWRITE_TAC[LENGTH;arith `SUC(SUC(SUC(SUC 0))) = 4`]; INTRO_TAC Leaf_cell.CC_CELL_EXTREME_CARD [`V`;`[EL 1 ul;EL 0 ul;f i]`;`EL 3 (cc_uh V [EL 1 ul;EL 0 ul;f i])`]; ANTS_TAC; BY(ASM_REWRITE_TAC[arith `~(4 = 3)`]); REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_TAC; TYPIFY `barV V 3 (cc_uh V [EL 1 ul; EL 0 ul; f i])` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); INTRO_TAC BARV3_SET_OF_LIST4 [`V`;`cc_uh V [EL 1 ul; EL 0 ul; f i]`]; ASM_REWRITE_TAC[]; DISCH_TAC; CONJ_TAC; BY(ASM_MESON_TAC[]); CONJ_TAC; ASM_REWRITE_TAC[set_of_list]; BY(SET_TAC[]); BY(ASM_MESON_TAC[Leaf_cell.cc_cell;Bump.MCELL4;IN]); REPEAT WEAKER_STRIP_TAC; TYPED_ABBREV_TAC `(vl:(real^3)list) = [EL 0 ul; EL 1 ul; f i; EL 3 (cc_uh V [EL 1 ul; EL 0 ul; f i])]` ; TYPIFY `EL 0 vl = EL 0 ul /\ EL 1 vl = EL 1 ul` (C SUBGOAL_THEN ASSUME_TAC); EXPAND_TAC "vl"; BY(REWRITE_TAC[Bump.EL_EXPLICIT]); COMMENT "compute chi_msb"; INTRO_TAC LEAF_RANK4_CHI_MSB_ALT [`V`;`vl`;`w0`;`n`;`f`;`i`]; ANTS_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); ASM_REWRITE_TAC[]; DISCH_TAC; COMMENT "now compute chi a second way via 0 < chi cc_cell"; INTRO_TAC Leaf_cell.K4_CHI_MSB_POS [`V`;`[EL 1 ul;EL 0 ul;f (i)]`]; ASM_REWRITE_TAC[]; ONCE_REWRITE_TAC[Leaf_cell.chi_msb_swap_01]; TYPIFY `EL 3 (cc_uh V [EL 1 ul; EL 0 ul; f i]) = f (SUC i)` ENOUGH_TO_SHOW_TAC; DISCH_THEN SUBST1_TAC; BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); INTRO_TAC CC_CELL_WEDGE_MATCH_UH [`V`;`ul`;`EL 1 ul`;`EL 0 ul`;`w0`;`n`;`f`;`i`;`i`]; ASM_REWRITE_TAC[]; REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; DISCH_THEN DISJ_CASES_TAC; BY(ASM_REWRITE_TAC[]); PROOF_BY_CONTR_TAC; FIRST_X_ASSUM_ST `/\` MP_TAC; REPEAT WEAKER_STRIP_TAC; INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`i`;`SUC i`]; ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`;Bump.EL_EXPLICIT;AZIM_REFL]; REWRITE_TAC[arith `SUC i = (i + 1)`]; BY(ASM_MESON_TAC[MOD_INJ1_ALT;arith `1 < n ==> ~(n = 0) /\ ~(1 = 0)`]) ]);; (* }}} *) (* let K4_CC_WIM = prove_by_refinement( `!V ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ cc_ke V [EL 1 ul;EL 0 ul;f i] = 4 ==> cc_cell V [EL 1 ul;EL 0 ul;f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f (i + n - 1)) (f i)`, (* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); INTRO_TAC K4_CC_WI_MINUS [`V`;`ul`;`w0`;`n`;`f`;`i MOD n`]; BY(ASM_SIMP_TAC[DIVISION;FM_DEMOD]) ]);; (* }}} *) *)
let K3_CC_WI_ALT = 
prove_by_refinement( `!V ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ cc_ke V [EL 0 ul; EL 1 ul; f i] = 3 ==> cc_cell V [EL 0 ul; EL 1 ul; f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); INTRO_TAC CC_CELL_SUBSET_WEDGE [`V`;`ul`;`EL 0 ul`;`EL 1 ul`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; DISCH_THEN DISJ_CASES_TAC; BY(ASM_REWRITE_TAC[]); PROOF_BY_CONTR_TAC; TYPIFY `~(n=0)` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `1 < n` MP_TAC THEN ARITH_TAC); TYPIFY `cc_ke V [EL 1 ul;EL 0 ul;f i] = 4` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank]; REWRITE_TAC[IMAGE;EXTENSION;IN_IMAGE;IN_UNIV;IN_ELIM_THM;s_leaf]; REWRITE_TAC[IN;s_leaf;Bump.EL_EXPLICIT]; BY(ASM_MESON_TAC[arith `~(3 = 4)`]); INTRO_TAC K4_CC_WIM [`V`;`ul`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; INTRO_TAC WEDGE_UNIQUE_CC_CELL [`V`;`ul`;`w0`;`n`;`f`;`(i + n - 1) MOD n`;`i`]; ANTS_TAC; BY(ASM_SIMP_TAC[DIVISION]); ASM_SIMP_TAC[F_DEMOD]; REWRITE_TAC[DE_MORGAN_THM]; TYPIFY `f (SUC (i + n - 1)) = f i` ENOUGH_TO_SHOW_TAC; DISCH_THEN SUBST1_TAC; BY(ASM_REWRITE_TAC[]); MATCH_MP_TAC F_SUC_PRE; BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *) (* let K3_CC_WI_ALT = prove_by_refinement( `!V ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ cc_ke V [EL 0 ul; EL 1 ul; f i] = 3 ==> cc_cell V [EL 0 ul; EL 1 ul; f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))`, (* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); INTRO_TAC K3_CC_WI [`V`;`ul`;`w0`;`n`;`f`;`i MOD n`]; BY(ASM_SIMP_TAC[DIVISION;F_DEMOD]) ]);; (* }}} *) *)
let K3_CC_WIM_ALT = 
prove_by_refinement( `!V ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ cc_ke V [EL 1 ul; EL 0 ul; f i] = 3 ==> cc_cell V [EL 1 ul; EL 0 ul; f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f (i + n - 1)) (f i)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); INTRO_TAC CC_CELL_SUBSET_WEDGE [`V`;`ul`;`EL 1 ul`;`EL 0 ul`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; ANTS_TAC; BY(SET_TAC[]); MATCH_MP_TAC (TAUT `~a ==> (a \/ b ==> b)`); DISCH_TAC; TYPIFY `~(n=0)` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM_ST `1 < n` MP_TAC THEN ARITH_TAC); TYPIFY `cc_ke V [EL 0 ul;EL 1 ul;f i] = 4` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank]; REWRITE_TAC[IMAGE;EXTENSION;IN_IMAGE;IN_UNIV;IN_ELIM_THM]; REWRITE_TAC[IN;s_leaf;Bump.EL_EXPLICIT]; BY(ASM_MESON_TAC[arith `~(3 = 4)`]); INTRO_TAC K4_CC_WI_ALT [`V`;`ul`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; INTRO_TAC WEDGE_UNIQUE_CC_CELL [`V`;`ul`;`w0`;`n`;`f`;`i`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); BY(ASM_REWRITE_TAC[DE_MORGAN_THM]) ]);;
(* }}} *) (* let K3_CC_WIM_ALT = prove_by_refinement( `!V ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ 1 < n /\ cc_ke V [EL 1 ul; EL 0 ul; f i] = 3 ==> cc_cell V [EL 1 ul; EL 0 ul; f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f (i + n - 1)) (f i)`, (* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); INTRO_TAC K3_CC_WIM [`V`;`ul`;`w0`;`n`;`f`;`i MOD n`]; BY(ASM_SIMP_TAC[DIVISION;FM_DEMOD]) ]);; (* }}} *) *)
let NO_4CELL_IMP_K3 = 
prove_by_refinement( `!V W ul w0 n f i. packing V /\ saturated V /\ leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ ~collinear {EL 0 ul, EL 1 ul, w0} /\ W = wedge_ge (EL 0 ul) (EL 1 ul) (f i ) (f (SUC i)) /\ 1 < n /\ ~(?vl. barV V 3 vl /\ {EL 0 ul,EL 1 ul} IN edgeX V (mcell4 V vl) /\ mcell4 V vl SUBSET W) ==> cc_ke V [EL 1 ul; EL 0 ul; f (SUC i)] = 3 /\ cc_ke V [EL 0 ul;EL 1 ul; f i ] = 3 /\ cc_cell V [EL 0 ul;EL 1 ul;f i] SUBSET W /\ cc_cell V [EL 1 ul;EL 0 ul; f(SUC i)] SUBSET W /\ ~(cc_cell V [EL 0 ul;EL 1 ul;f i ] = cc_cell V [EL 1 ul;EL 0 ul;f (SUC i)])`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; COMMENT "preliminaries";
TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; MATCH_MP_TAC s_leaf_leaf; REWRITE_TAC[IN]; MATCH_MP_TAC LEAF_RANK_S_LEAF; BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); TYPIFY `!j. leaf V [EL 1 ul;EL 0 ul;f j]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; INTRO_TAC Leaf_cell.ZASUVOR [`V`;`EL 0 ul`;`EL 1 ul`;`f j`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); BY(ASM_MESON_TAC[]); TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); TYPIFY `{EL 0 ul,EL 1 ul} = {EL 1 ul,EL 0 ul}` (C SUBGOAL_THEN ASSUME_TAC); BY(SET_TAC[]); COMMENT "k- = 3"; SUBCONJ_TAC; INTRO_TAC Leaf_cell.CC_KE_34 [`V`;`[EL 1 ul;EL 0 ul;f(SUC i)]`]; DISCH_THEN DISJ_CASES_TAC; BY(ASM_REWRITE_TAC[]); INTRO_TAC K4_CC_WIM [`V`;`ul`;`w0`;`n`;`f`;`SUC i`]; ASM_REWRITE_TAC[]; TYPIFY `f (SUC i + n - 1) = f i` (C SUBGOAL_THEN SUBST1_TAC); MATCH_MP_TAC PERIODIC_EQ_IMAGE; TYPIFY `n` EXISTS_TAC; ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`;arith `1 < n ==> SUC i + n - 1 = 1 *n + i`]; BY(REWRITE_TAC[MOD_MULT_ADD]); REWRITE_TAC[arith `~(4 = 3)`]; DISCH_TAC; FIRST_X_ASSUM_ST `?` MP_TAC; ASM_REWRITE_TAC[]; TYPIFY `cc_uh V [EL 1 ul;EL 0 ul;f(SUC i)]` EXISTS_TAC; SUBCONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); DISCH_TAC; TYPIFY ` mcell4 V (cc_uh V [EL 1 ul;EL 0 ul;f (SUC i)]) = cc_cell V [EL 1 ul;EL 0 ul;f (SUC i)]` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); ASM_REWRITE_TAC[]; INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[EL 1 ul;EL 0 ul;f (SUC i)]`]; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); DISCH_TAC; COMMENT "k+ = 3"; SUBCONJ_TAC; INTRO_TAC Leaf_cell.CC_KE_34 [`V`;`[EL 0 ul;EL 1 ul;f i]`]; DISCH_THEN DISJ_CASES_TAC; BY(ASM_REWRITE_TAC[]); INTRO_TAC K4_CC_WI_ALT [`V`;`ul`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; REWRITE_TAC[arith `~(4 = 3)`]; DISCH_TAC; FIRST_X_ASSUM_ST `?` MP_TAC; ASM_REWRITE_TAC[]; TYPIFY `cc_uh V [EL 0 ul;EL 1 ul;f( i)]` EXISTS_TAC; SUBCONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); DISCH_TAC; TYPIFY ` mcell4 V (cc_uh V [EL 0 ul;EL 1 ul;f ( i)]) = cc_cell V [EL 0 ul;EL 1 ul;f ( i)]` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); ASM_REWRITE_TAC[]; INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[EL 0 ul;EL 1 ul;f ( i)]`]; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); DISCH_TAC; COMMENT "cc_cell3+"; CONJ_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC K3_CC_WI_ALT; BY(ASM_MESON_TAC[]); COMMENT "cc_cell3-"; CONJ_TAC; ASM_REWRITE_TAC[]; INTRO_TAC K3_CC_WIM_ALT [`V`;`ul`;`w0`;`n`;`f`;`SUC i`]; ASM_REWRITE_TAC[]; TYPIFY `f (SUC i + n - 1) = f i` (C SUBGOAL_THEN SUBST1_TAC); MATCH_MP_TAC PERIODIC_EQ_IMAGE; TYPIFY `n` EXISTS_TAC; BY(ASM_SIMP_TAC[arith `1 < n ==> ~(n =0)`;arith `1 < n ==> SUC i + n - 1 = 1*n + i`;MOD_MULT_ADD]); BY(REWRITE_TAC[]); COMMENT "inequality"; DISCH_TAC; INTRO_TAC Leaf_cell.FUEIMOV_3 [`V`;`[EL 0 ul;EL 1 ul;f i]`;`[EL 1 ul;EL 0 ul;f (SUC i)]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; REWRITE_TAC[CONS_11]; BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]) ]);; (* }}} *)
let JSPEVYT_EXPLICIT = 
prove_by_refinement( `!(u0:real^3) u1 u2. pack_nonlinear_non_ox3q1h /\ ~collinear {u0,u1,u2} /\ hl [u0;u1;u2] <= #1.34 /\ &2 * hminus <= dist(u0,u1) /\ &2 <= dist (u0,u2) ==> dist(u1,u2) < &2 * hminus`,
(* {{{ proof *) [ REWRITE_TAC[Pack_defs.HL;set_of_list]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `radV` MP_TAC; ASM_SIMP_TAC[RADV_ETAY]; DISCH_TAC; INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "JSPEVYT") [`&1`;`&1`;`&1`;`dist(u0,u1)`;`dist(u1,u2)`;`dist(u0,u2)`]; REWRITE_TAC[Sphere.ineq;arith `&1 <= &1`]; REPEAT WEAKER_STRIP_TAC; TYPIFY `~affine_dependent {u0,u1,u2}` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[AFFINE_DEPENDENT_IMP_COLLINEAR_3]); INTRO_TAC Rogers.RADV_MONO [`{u0,u1,u2}`;`{u0,u1}`]; INTRO_TAC Rogers.RADV_MONO [`{u0,u1,u2}`;`{u0,u2}`]; INTRO_TAC Rogers.RADV_MONO [`{u0,u1,u2}`;`{u1,u2}`]; ASM_SIMP_TAC[RADV_ETAY]; REWRITE_TAC[RADV2]; REPEAT (ANTS_TAC THENL [SET_TAC[];DISCH_TAC]); TYPIFY `&0 <= ups_x (dist (u0,u1) pow 2) (dist (u1,u2) pow 2) (dist (u0,u2) pow 2)` (C SUBGOAL_THEN MP_TAC); BY(REWRITE_TAC[Collect_geom.TROI_OI_DAT_HOI]); REWRITE_TAC[REAL_POW_2]; DISCH_TAC; REWRITE_TAC[arith `x < y <=> ~(y <= x)`]; DISCH_TAC; FIRST_X_ASSUM_ST `#1.34` MP_TAC; TYPIFY `eta_y (dist (u0,u1)) (dist (u1,u2)) (dist (u0,u2)) = eta_y (dist (u0,u1)) (dist (u0,u2)) (dist (u1,u2))` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_MESON_TAC[Collect_geom.ETA_Y_SYM]); INTRO_TAC Merge_ineq.eta_y_nn [`dist(u0,u1)`;`dist(u0,u2)`;`dist(u1,u2)`]; ANTS_TAC; BY(ASM_MESON_TAC[Collect_geom.UPS_X_SYM]); DISCH_TAC; TYPED_ABBREV_TAC `(eta:real) = eta_y (dist (u0,u1)) (dist (u0,u2)) (dist (u1,u2))` ; ASM_REWRITE_TAC[]; TYPIFY `!x. inv (&2) * x <= eta ==> x <= sqrt8` (C SUBGOAL_THEN (unlist ASM_SIMP_TAC)); GEN_TAC; FIRST_X_ASSUM_ST `#1.34` MP_TAC; MP_TAC Flyspeck_constants.bounds; BY(REAL_ARITH_TAC); MATCH_MP_TAC (arith `x <= y ==> ~(x > y)`); MATCH_MP_TAC Collect_geom2.POS_IMP_POW2; BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *)
let CELL_CLUSTER_ESTIMATE_REDUCE = 
prove_by_refinement( `!V. packing V /\ saturated V /\ (!u0 u1. ~(u0 = u1) /\ hminus <= hl [u0;u1] /\ hl [u0;u1] <= hplus ==> &0 <= sum {X | {u0,u1} IN edgeX V X /\ mcell_set V X} (\X. gammaX V X lmfun * critical_weight V X + beta_bump_v1 V {u0,u1} X)) ==> cell_cluster_estimate_v1 V`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[Pack_defs.cell_cluster_estimate_v1;Pack_defs.cluster_gamma_v1;Pack_defs.cell_cluster]; GEN_TAC; TYPIFY `{X | e IN critical_edgeX V X /\ mcell_set V X} = {}` ASM_CASES_TAC; ASM_REWRITE_TAC[SUM_CLAUSES]; BY(REAL_ARITH_TAC); FIRST_X_ASSUM (MP_TAC o (REWRITE_RULE[EXTENSION;NOT_IN_EMPTY;IN_ELIM_THM;NOT_FORALL_THM])); DISCH_THEN (MP_TAC o (REWRITE_RULE[Pack_defs.critical_edgeX;IN_ELIM_THM])); REPEAT WEAKER_STRIP_TAC; TYPIFY `u = v` ASM_CASES_TAC; PROOF_BY_CONTR_TAC; FIRST_X_ASSUM (MP_TAC o (MATCH_MP Bump.EDGE_MCELL_EL)); REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; ASM_REWRITE_TAC[]; BY(MESON_TAC[]); FIRST_X_ASSUM (C INTRO_TAC [`u`;`v`]); ASM_REWRITE_TAC[arith `x >= &0 <=> &0 <= x`]; TYPIFY `!X. {u, v} IN critical_edgeX V X <=> {u,v} IN edgeX V X` (C SUBGOAL_THEN (unlist REWRITE_TAC)); REWRITE_TAC[Pack_defs.critical_edgeX;IN_ELIM_THM]; BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let cc_card_data = 
prove_by_refinement( `!V f u0 u1. cc_card_v11 (cc_data_v8 V f u0 u1) = CARD(s_leaf V [u0;u1])`,
(* {{{ proof *) [ BY(REWRITE_TAC[Oxl_def.cc_card_v11;cc_data_v8;Oxl_def.cc_v11]) ]);;
(* }}} *)
let cc_real_data = 
prove_by_refinement( `!V f u0 u1. cc_azim_v11 (cc_data_v8 V f u0 u1) = azim_mcell V f u0 u1 /\ cc_gg_v11 (cc_data_v8 V f u0 u1) = gg_mcell V f u0 u1 /\ cc_gg3a_v11 (cc_data_v8 V f u0 u1) = (\i. gammaX V (cc_cell V [u0;u1;f i]) lmfun * critical_weight V (cc_cell V [u0;u1;f i])) /\ cc_gg3b_v11 (cc_data_v8 V f u0 u1) = (\i. gammaX V (cc_cell V [u1;u0;f(SUC i)]) lmfun * critical_weight V (cc_cell V [u1;u0;f (SUC i)]))`,
(* {{{ proof *) [ BY(REWRITE_TAC[FUN_EQ_THM;Oxl_def.cc_azim_v11;Oxl_def.cc_gg_v11;Oxl_def.cc_gg3a_v11;Oxl_def.cc_gg3b_v11;Oxl_def.cc_real_v11;cc_data_v8;Oxl_def.cc_v11;Bump.EL_EXPLICIT]) ]);;
(* }}} *)
let cc_bool_data = 
prove_by_refinement( `!V f u0 u1. cc_subcrit_v11 (cc_data_v8 V f u0 u1) = (\i. dist(f i,f(SUC i)) < &2 * hminus) /\ cc_crit_v11 (cc_data_v8 V f u0 u1) = (\i. &2 * hminus <= dist (f i, f (SUC i)) /\ dist (f i,f(SUC i)) <= &2 *hplus) /\ cc_supercrit_v11 (cc_data_v8 V f u0 u1) = (\i. &2 *hplus < dist (f i, f(SUC i))) /\ cc_small_v11 (cc_data_v8 V f u0 u1) = (\i. dist(u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ cc_small_eta_v11 (cc_data_v8 V f u0 u1) = (\i. hl [u0;u1;f i] < #1.34) /\ cc_4cell_v11 (cc_data_v8 V f u0 u1) = (\i. ?ul. barV V 3 ul /\ {u0,u1} IN edgeX V (mcell4 V ul) /\ mcell4 V ul SUBSET (wedge_ge u0 u1 (f i) (f (SUC i)))) `,
(* {{{ proof *) [ BY(REWRITE_TAC[FUN_EQ_THM;Oxl_def.cc_subcrit_v11;Oxl_def.cc_crit_v11;Oxl_def.cc_supercrit_v11;Oxl_def.cc_small_v11;Oxl_def.cc_small_eta_v11;Oxl_def.cc_4cell_v11;Oxl_def.cc_bool_v11;cc_data_v8;Oxl_def.cc_v11;Bump.EL_EXPLICIT]) ]);;
(* }}} *)
let cc_bool_model_data = 
prove_by_refinement( `!V f w0 n u0 u1. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0;u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ ~collinear {u0, u1, w0 } /\ critical_edge_y (dist(u0,u1)) /\ leaf_rank V [u0;u1] w0 n f ==> cc_bool_model_v11 (cc_data_v8 V f u0 u1)`,
(* {{{ proof *) [ REWRITE_TAC[Oxl_def.cc_bool_model_v11;cc_card_data]; REWRITE_TAC[HAS_SIZE]; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; BY(ASM_SIMP_TAC[arith `1 < n==> ~(n = 0)`]); TYPIFY `(!i. ~(cc_crit_v11 (cc_data_v8 V f u0 u1) i /\ cc_supercrit_v11 (cc_data_v8 V f u0 u1) i)) /\ (!i. ~(cc_crit_v11 (cc_data_v8 V f u0 u1) i /\ cc_subcrit_v11 (cc_data_v8 V f u0 u1) i)) /\ (!i. ~(cc_supercrit_v11 (cc_data_v8 V f u0 u1) i /\ cc_subcrit_v11 (cc_data_v8 V f u0 u1) i))` (C SUBGOAL_THEN (unlist REWRITE_TAC)); REWRITE_TAC[cc_bool_data]; INTRO_TAC Merge_ineq.hminus_lt_hplus []; BY(REAL_ARITH_TAC); TYPIFY `periodic (cc_subcrit_v11 (cc_data_v8 V f u0 u1)) n /\ periodic (cc_crit_v11 (cc_data_v8 V f u0 u1)) n /\ periodic (cc_supercrit_v11 (cc_data_v8 V f u0 u1)) n /\ periodic (cc_small_v11 (cc_data_v8 V f u0 u1)) n /\ periodic (cc_small_eta_v11 (cc_data_v8 V f u0 u1)) n /\ periodic (cc_4cell_v11 (cc_data_v8 V f u0 u1)) n` (C SUBGOAL_THEN (unlist REWRITE_TAC)); REWRITE_TAC[Oxl_def.periodic;cc_bool_data;cc_real_data]; REWRITE_TAC[arith `!i. SUC(i + n) = SUC i + n`]; INTRO_TAC LEAF_RANK_PERIODIC [`V`;`[u0;u1]`;`w0`;`n`;`f`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[Oxl_def.periodic]; BY(MESON_TAC[]); CONJ_TAC; REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[cc_bool_data]; BY(REAL_ARITH_TAC); REWRITE_TAC[cc_bool_data]; REPEAT WEAKER_STRIP_TAC; TYPIFY `f i IN s_leaf V [u0;u1]` (C SUBGOAL_THEN MP_TAC); FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; REWRITE_TAC[leaf_rank;EXTENSION;IN_IMAGE;IN_UNIV]; BY(MESON_TAC[]); REWRITE_TAC[IN;s_leaf;Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; TYPIFY `f i IN V` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `leaf` MP_TAC; REWRITE_TAC[Leaf_cell.leaf;IN]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (MP_TAC o (MATCH_MP Packing3.BARV_SUBSET)); REWRITE_TAC[set_of_list;SUBSET;IN_INSERT;NOT_IN_EMPTY]; BY(MESON_TAC[IN]); TYPIFY `~collinear {u0,u1,f i}` (C SUBGOAL_THEN ASSUME_TAC); INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;f i]`]; BY(ASM_REWRITE_TAC[set_of_list]); COMMENT "symmetry reduction";
TYPIFY `!v0 v1 ff. v0 IN V /\ v1 IN V /\ ~collinear {v0,v1,ff} /\ ff IN V /\ critical_edge_y( dist(v0,v1)) /\ dist(v0,ff) <= dist(v1,ff) /\ hl [v0;v1;ff] < #1.34 ==> dist(v1,ff) < &2 * hminus` ENOUGH_TO_SHOW_TAC; DISCH_TAC; TYPIFY `dist(u0,f i) <= dist(u1,f i)` ASM_CASES_TAC; FIRST_X_ASSUM (C INTRO_TAC [`u0`;`u1`;`f i`]); ANTS_TAC; BY(ASM_REWRITE_TAC[]); BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); COMMENT "second half of symmetry reduction"; FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP (arith `~(x <= y) ==> (y <= x)`))); FIRST_X_ASSUM (C INTRO_TAC [`u1`;`u0`;`f i`]); ANTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; TYPIFY `{u1,u0,f i} = {u0,u1,f i}` (C SUBGOAL_THEN SUBST1_TAC); BY(SET_TAC[]); BY(ASM_REWRITE_TAC[]); CONJ_TAC; BY(ASM_MESON_TAC[DIST_SYM]); FIRST_X_ASSUM_ST `hl` MP_TAC; REWRITE_TAC[Pack_defs.HL;set_of_list]; TYPIFY `{u0,u1,f i } = {u1,u0, f i}` (C SUBGOAL_THEN SUBST1_TAC); BY(SET_TAC[]); BY(REWRITE_TAC[]); BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); COMMENT "symmetry reduction complete"; REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC JSPEVYT_EXPLICIT; TYPIFY `v0` EXISTS_TAC; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; CONJ_TAC; FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; REWRITE_TAC[Sphere.critical_edge_y]; BY(REAL_ARITH_TAC); TYPIFY `~(v0 = ff)` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); FIRST_X_ASSUM_ST `packing` MP_TAC; REWRITE_TAC[Sphere.packing]; DISCH_THEN MATCH_MP_TAC; BY(ASM_MESON_TAC[IN]) ]);; (* }}} *)
let cc_prep_model_data = 
prove_by_refinement( `!V f w0 n u0 u1. 1 < n /\ packing V /\ saturated V /\ ~collinear {u0, u1, w0 } /\ leaf_rank V [u0;u1] w0 n f ==> cc_bool_prep_v11 (cc_data_v8 V f u0 u1)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[Oxl_def.cc_bool_prep_v11;Oxl_def.cc_qy_v11;cc_bool_data]; REPEAT WEAKER_STRIP_TAC; TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); TYPIFY `cc_uh V [u0;u1;f (i + 1)]` EXISTS_TAC; TYPIFY `!j. leaf V [u0; u1; f j]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; INTRO_TAC s_leaf_leaf[`V`;`[u0;u1]`;`f j`]; REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN MATCH_MP_TAC; REWRITE_TAC[IN]; MATCH_MP_TAC LEAF_RANK_S_LEAF; BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); SUBCONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); DISCH_TAC; FIRST_X_ASSUM_ST `?` (MP_TAC o (REWRITE_RULE[NOT_EXISTS_THM])); DISCH_TAC; INTRO_TAC Leaf_cell.CC_KE_34 [`V`;`[u0;u1;f(i+1)]`]; DISCH_THEN (MP_TAC o (MATCH_MP (TAUT `a \/ b ==> b \/ a`))); DISCH_THEN DISJ_CASES_TAC; TYPIFY `mcell4 V (cc_uh V [u0;u1;f(i+1)]) = cc_cell V [u0;u1;f (i + 1)]` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); INTRO_TAC Leaf_cell.EL_CC_UH [`V`;`[u0;u1;f (i+1)]`]; ASM_REWRITE_TAC[]; REWRITE_TAC[Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; SUBCONJ_TAC; INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u0;u1;f(i+1)]`]; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); DISCH_TAC; INTRO_TAC K4_CC_WI_ALT [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i+1`]; REWRITE_TAC[Bump.EL_EXPLICIT]; BY(ASM_REWRITE_TAC[]); COMMENT "now k=3";
TYPIFY `cc_ke V [u1;u0;f (i+1)] = 4` (C SUBGOAL_THEN ASSUME_TAC); TYPIFY `s_leaf V [u0;u1] (f(i+1))` (C SUBGOAL_THEN MP_TAC); BY(ASM_MESON_TAC[LEAF_RANK_S_LEAF]); GMATCH_SIMP_TAC S_LEAF_SYM; ASM_REWRITE_TAC[]; REWRITE_TAC[s_leaf;Bump.EL_EXPLICIT]; BY(ASM_MESON_TAC[arith `~(3=4)`]); INTRO_TAC K4_CC_WIM [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i+1`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; TYPIFY `wedge_ge u0 u1 (f ((i + 1) + n - 1)) (f (i + 1)) = wedge_ge u0 u1 (f i) (f (SUC i))` (C SUBGOAL_THEN SUBST1_TAC); REWRITE_TAC[arith `i + 1 = SUC i`]; ASM_SIMP_TAC[arith `1 < n ==> SUC i + n - 1 = 1*n + i`]; TYPIFY `f (1 * n + i) = f i` ENOUGH_TO_SHOW_TAC; BY(MESON_TAC[]); MATCH_MP_TAC PERIODIC_EQ_IMAGE; TYPIFY `n` EXISTS_TAC; BY(ASM_REWRITE_TAC[MOD_MULT_ADD]); FIRST_X_ASSUM (C INTRO_TAC [`cc_uh V [u1;u0;f (i+1)]`]); TYPIFY `mcell4 V (cc_uh V [u1; u0; f (i + 1)]) = cc_cell V [u1; u0; f (i + 1)]` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); REPEAT WEAKER_STRIP_TAC; PROOF_BY_CONTR_TAC; FIRST_X_ASSUM_ST `barV` MP_TAC; ASM_REWRITE_TAC[]; TYPIFY `leaf V [u1;u0;f (i+1)]` (C SUBGOAL_THEN ASSUME_TAC); INTRO_TAC Leaf_cell.ZASUVOR [`V`;`u0`;`u1`;`f (i+1)`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); BY(MESON_TAC[]); CONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u1;u0;f(i+1)]`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[Bump.EL_EXPLICIT]; TYPIFY `{u1,u0} = {u0,u1}` (C SUBGOAL_THEN SUBST1_TAC); BY(SET_TAC[]); BY(REWRITE_TAC[]) ]);; (* }}} *)
let LEAF_DOMAIN = 
prove_by_refinement( `!V ul. saturated V /\ packing V /\ leaf V ul ==> ~collinear {EL 0 ul,EL 1 ul,EL 2 ul} /\ &2 <= dist (EL 1 ul,EL 2 ul) /\ &2 <= dist (EL 0 ul,EL 2 ul) /\ &2 <= dist (EL 0 ul,EL 1 ul) /\ dist (EL 1 ul,EL 2 ul) < &2 * sqrt (&2) /\ dist (EL 0 ul,EL 2 ul) < &2 * sqrt (&2) /\ dist (EL 0 ul,EL 1 ul) < &2 * sqrt (&2) /\ eta_y (dist (EL 0 ul,EL 1 ul)) (dist (EL 0 ul,EL 2 ul)) (dist (EL 1 ul,EL 2 ul)) < sqrt (&2)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `barV V 2 ul` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM MP_TAC; REWRITE_TAC[Leaf_cell.leaf;IN]; BY(MESON_TAC[]); TYPIFY `ul = [EL 0 ul;EL 1 ul;EL 2 ul]` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC Bump.LENGTH3; REWRITE_TAC[arith `3 = 2 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; BY(ASM_MESON_TAC[]); TYPIFY `truncate_simplex 2 ul = ul` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM SUBST1_TAC; BY(REWRITE_TAC[Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2]); GMATCH_SIMP_TAC (GSYM RADV_ETAY); TYPIFY `hl ( ul) < sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `leaf` MP_TAC; REWRITE_TAC[Leaf_cell.leaf]; BY(MESON_TAC[Sphere.sqrt2]); COMMENT "deal with radV";
TYPIFY `radV {EL 0 ul, EL 1 ul, EL 2 ul} < sqrt (&2)` (C SUBGOAL_THEN ASSUME_TAC); (FIRST_X_ASSUM_ST `hl` MP_TAC THEN ASM_REWRITE_TAC[Pack_defs.HL;set_of_list]); BY(FIRST_X_ASSUM_ST `EL` SUBST1_TAC THEN REWRITE_TAC[set_of_list;Bump.EL_EXPLICIT]); TYPIFY `~collinear {EL 0 ul,EL 1 ul,EL 2 ul}` (C SUBGOAL_THEN ASSUME_TAC); INTRO_TAC Leaf_cell.GBEWYFX [`V`;`ul`]; FIRST_ASSUM_ST `CONS (EL 0 ul)` SUBST1_TAC; REWRITE_TAC[Bump.EL_EXPLICIT;set_of_list]; DISCH_THEN MATCH_MP_TAC; BY(ASM_MESON_TAC[]); ASM_REWRITE_TAC[]; TYPIFY `~affine_dependent {EL 0 ul,EL 1 ul,EL 2 ul}` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[AFFINE_DEPENDENT_IMP_COLLINEAR_3]); TYPIFY `!x y. {x,y} SUBSET {EL 0 ul,EL 1 ul,EL 2 ul} ==> dist(x,y) < &2 * sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[arith `x < &2 * y <=> inv(&2) * x < y`]; REWRITE_TAC[GSYM RADV2]; MATCH_MP_TAC REAL_LET_TRANS; TYPIFY `radV {EL 0 ul, EL 1 ul, EL 2 ul}` EXISTS_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC Rogers.RADV_MONO; ASM_REWRITE_TAC[EXTENSION;IN_INSERT;NOT_IN_EMPTY]; BY(MESON_TAC[]); INTRO_TAC Packing3.BARV_SUBSET [`V`;`2`;`ul`]; ASM_REWRITE_TAC[]; DISCH_TAC; TYPIFY `set_of_list ul = {EL 0 ul,EL 1 ul,EL 2 ul}` (C SUBGOAL_THEN ASSUME_TAC); FIRST_ASSUM_ST `CONS (EL 0 ul)` SUBST1_TAC; BY(REWRITE_TAC[Bump.EL_EXPLICIT;set_of_list]); TYPIFY `~(EL 0 ul = EL 1 ul) /\ ~(EL 1 ul = EL 2 ul) /\ ~(EL 0 ul = EL 2 ul)` (C SUBGOAL_THEN ASSUME_TAC); TYPIFY `{EL 0 ul,EL 1 ul, EL 2 ul} = {EL 1 ul,EL 2 ul,EL 0 ul}` (C SUBGOAL_THEN ASSUME_TAC); BY(SET_TAC[]); BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); TYPIFY `&2 <= dist (EL 1 ul,EL 2 ul) /\ &2 <= dist (EL 0 ul,EL 2 ul) /\ &2 <= dist (EL 0 ul,EL 1 ul)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); FIRST_X_ASSUM_ST `packing` MP_TAC; REWRITE_TAC[Sphere.packing]; FIRST_X_ASSUM_ST `SUBSET` MP_TAC; ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; REWRITE_TAC[IN]; BY(ASM_MESON_TAC[]); BY(REPEAT (CONJ_TAC THEN (TRY (FIRST_X_ASSUM MATCH_MP_TAC))) THEN SET_TAC[]) ]);; (* }}} *)
let CELL_CLUSTER_N_LE_1 = 
prove_by_refinement( `!V u0 u1. pack_nonlinear_non_ox3q1h /\ packing V /\ saturated V /\ hminus <= hl [u0; u1] /\ hl [u0; u1] <= hplus /\ CARD(s_leaf V [u0;u1]) <= 1 ==> &0 <= sum {X | {u0, u1} IN edgeX V X /\ mcell_set V X} (\X. gammaX V X lmfun * critical_weight V X + beta_bump_v1 V {u0, u1} X)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `?ul. {u0,u1} IN edgeX V (mcell4 V ul) /\ barV V 3 ul` ASM_CASES_TAC; FIRST_X_ASSUM MP_TAC; REPEAT WEAKER_STRIP_TAC; INTRO_TAC Leaf_cell.MCELL4_EDGE_FIRST [`V`;`ul`;`u0`;`u1`]; ANTS_TAC; BY(ASM_REWRITE_TAC[IN]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC S_LEAF_CARD2 [`V`;`vl`]; ANTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; BY(ASM_MESON_TAC[IN]); FIRST_X_ASSUM (SUBST1_TAC o GSYM); REWRITE_TAC[Bump.MCELL4]; DISCH_THEN (MP_TAC o (MATCH_MP Bump.RIJRIED)); REWRITE_TAC[EXTENSION;NOT_IN_EMPTY]; BY(ASM_MESON_TAC[Bump.MCELL4]); FIRST_X_ASSUM_ST `CARD` MP_TAC; ASM_REWRITE_TAC[]; BY(ARITH_TAC); COMMENT "now sum over 0--3 sums and use positivity.";
MATCH_MP_TAC SUM_POS_LE; CONJ_TAC; REWRITE_TAC[IN]; ONCE_REWRITE_TAC[TAUT `!a b. a /\ b <=> b /\ a`]; MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2; BY(ASM_MESON_TAC[]); REWRITE_TAC[IN_ELIM_THM;Qzyzmjc.mcell_set_2]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `edgeX` MP_TAC; FIRST_X_ASSUM_ST `mcell` SUBST1_TAC; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `i <= 4` MP_TAC; REWRITE_TAC[arith `i <= 4 <=> (i <= 1) \/ (i = 4) \/ (i = 2) \/ (i = 3)`]; DISCH_THEN DISJ_CASES_TAC; BY(ASM_MESON_TAC[Bump.EDGE_IMP_K2;NOT_IN_EMPTY;IN]); FIRST_X_ASSUM DISJ_CASES_TAC; BY(ASM_MESON_TAC[IN;Bump.MCELL4]); REWRITE_TAC[arith `&0 <= x <=> x >= &0`]; MATCH_MP_TAC GAMMAX_NO_BETA; GEXISTL_TAC [`ul`;`i`]; ASM_SIMP_TAC[arith `i = 2 \/ i = 3 ==> i < 4`]; CONJ_TAC; BY(ASM_MESON_TAC[IN]); CONJ_TAC; BY(ASM_MESON_TAC[Bump.RIJRIED;NOT_IN_EMPTY]); CONJ_TAC; REWRITE_TAC[Pack_defs.critical_edgeX;IN_ELIM_THM]; BY(ASM_MESON_TAC[]); FIRST_X_ASSUM DISJ_CASES_TAC; MATCH_MP_TAC Tskajxy.TSKAJXY_2; BY(ASM_MESON_TAC[IN;Bump.MCELL2]); TYPIFY `~NULLSET (mcell 3 V ul)` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Bump.RIJRIED;NOT_IN_EMPTY]); MATCH_MP_TAC TSKAJXY_3; BY(ASM_MESON_TAC[IN;Bump.MCELL3]) ]);; (* }}} *)
let RAD_PI_IMP_WEDGE4 = 
prove_by_refinement( `!V f w0 n i u0 u1. 1 < n /\ packing V /\ saturated V /\ ~collinear {u0, u1, w0 } /\ leaf_rank V [u0;u1] w0 n f /\ azim u0 u1 (f i) (f (SUC i)) < pi /\ radV {u0,u1,f i,f (SUC i)} < sqrt(&2) ==> (?ul. mcell4 V ul SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ barV V 3 ul /\ {u0,u1} IN edgeX V (mcell4 V ul))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `~coplanar {u0,u1,f i , f (SUC i)}` (C SUBGOAL_THEN ASSUME_TAC); REWRITE_TAC[ (GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR)]; DISCH_THEN DISJ_CASES_TAC; INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`;`SUC i`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`;arith `SUC i = i + 1`]; BY(ASM_MESON_TAC[ MOD_INJ1_ALT;arith `1 < n ==> ~(n = 0) /\ ~(1 = 0)`]); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); TYPIFY `!j. leaf V [u0; u1; f j]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; INTRO_TAC s_leaf_leaf[`V`;`[u0;u1]`;`f j`]; REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN MATCH_MP_TAC; REWRITE_TAC[IN]; MATCH_MP_TAC LEAF_RANK_S_LEAF; BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); INTRO_TAC HL_IMP_BARV [`V`;`[u0;u1;f i;f (SUC i)]`]; ANTS_TAC; ASM_REWRITE_TAC[set_of_list]; REWRITE_TAC[LENGTH;arith `SUC(SUC(SUC(SUC 0))) = 4`]; TYPIFY `set_of_list [u0;u1;f i] SUBSET V` (C SUBGOAL_THEN MP_TAC); MATCH_MP_TAC Packing3.BARV_SUBSET; TYPIFY `2` EXISTS_TAC; FIRST_X_ASSUM (C INTRO_TAC [`i`]); REWRITE_TAC[Leaf_cell.leaf;IN]; BY(MESON_TAC[]); TYPIFY `set_of_list [u0;u1;f (SUC i)] SUBSET V` (C SUBGOAL_THEN MP_TAC); MATCH_MP_TAC Packing3.BARV_SUBSET; TYPIFY `2` EXISTS_TAC; FIRST_X_ASSUM (C INTRO_TAC [`SUC i`]); REWRITE_TAC[Leaf_cell.leaf;IN]; BY(MESON_TAC[]); REWRITE_TAC[set_of_list;SUBSET;IN_INSERT;NOT_IN_EMPTY]; REPEAT WEAKER_STRIP_TAC; CONJ_TAC; BY(ASM_MESON_TAC[]); CONJ_TAC; BY(ASM_REWRITE_TAC[Pack_defs.HL;set_of_list]); REWRITE_TAC[Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2]; FIRST_X_ASSUM (C INTRO_TAC [`i`]); REWRITE_TAC[Leaf_cell.leaf]; BY(MESON_TAC[IN]); DISCH_TAC; COMMENT "now pick ul";
TYPIFY `[u0;u1;f i;f(SUC i)]` EXISTS_TAC; TYPIFY `~NULLSET (mcell4 V [u0; u1; f i; f (SUC i)])` (C SUBGOAL_THEN ASSUME_TAC); ASM_REWRITE_TAC[Pack_defs.mcell4;Pack_defs.HL;set_of_list]; FIRST_X_ASSUM (MP_TAC o (MATCH_MP Leaf_cell.ZWVCBMN)); BY(MESON_TAC[Vol1.VOLUME_PROPS_NULLSET;arith `x = &0 ==> ~(&0 < x)`]); ASM_REWRITE_TAC[]; CONJ2_TAC; GMATCH_SIMP_TAC Bump.MCELL4_EDGE; CONJ_TAC; BY(ASM_REWRITE_TAC[]); CONJ2_TAC; REWRITE_TAC[set_of_list]; BY(SET_TAC[]); BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); (COMMENT "now place it in wedge"); GMATCH_SIMP_TAC MCELL4_CONVEX_HULL; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; GMATCH_SIMP_TAC Local_lemmas.WEDGE_GE_EQ_AFF_GE; ASM_REWRITE_TAC[]; INTRO_TAC LEAF_RANK_COLLINEAR [`V`;`[u0;u1]`;`w0`;`n`;`f`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_TAC; ASM_REWRITE_TAC[]; BY(REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]) ]);; (* }}} *)
let LEAF_RANK_SUC_INJ = 
prove_by_refinement( `!V u0 u1 w0 n f i. packing V /\ saturated V /\ leaf_rank V [u0;u1] w0 n f /\ ~collinear {u0,u1,w0} /\ 1 < n ==> ~(f i = f (SUC i))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`;`SUC i`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`;arith `SUC i = i + 1`]; REWRITE_TAC[AZIM_REFL]; BY(ASM_MESON_TAC[ MOD_INJ1_ALT;arith `1 < n ==> ~(n = 0) /\ ~(1 = 0)`]) ]);;
(* }}} *)
let DIST_I_SUCI = 
prove_by_refinement( `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ ~collinear {u0, u1, w0 } /\ leaf_rank V [u0;u1] w0 n f ==> &2 <= dist (f i,f (SUC i))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `!j. leaf V [u0; u1; f j]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; INTRO_TAC s_leaf_leaf[`V`;`[u0;u1]`;`f j`]; REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN MATCH_MP_TAC; REWRITE_TAC[IN]; MATCH_MP_TAC LEAF_RANK_S_LEAF; BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); INTRO_TAC Packing3.BARV_SUBSET [`V`;`2`;`[u0;u1;f i]`]; ANTS_TAC; BY(ASM_MESON_TAC[Leaf_cell.leaf;IN]); INTRO_TAC Packing3.BARV_SUBSET [`V`;`2`;`[u0;u1;f (SUC i)]`]; ANTS_TAC; BY(ASM_MESON_TAC[Leaf_cell.leaf;IN]); REWRITE_TAC[set_of_list]; REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; REPEAT WEAKER_STRIP_TAC; TYPIFY `~(f i = f (SUC i))` (C SUBGOAL_THEN ASSUME_TAC); ASM_MESON_TAC[LEAF_RANK_SUC_INJ]; FIRST_X_ASSUM_ST `packing` MP_TAC; REWRITE_TAC[Sphere.packing]; BY(ASM_MESON_TAC[IN]) ]);;
(* }}} *)
let WEDGE3_Y4 = 
prove_by_refinement( `!V f w0 n i u0 u1 y1 y2 y3 y5 y6. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ ~collinear {u0, u1, w0 } /\ leaf_rank V [u0;u1] w0 n f /\ critical_edge_y (dist(u0,u1)) /\ ~(?vl. barV V 3 vl /\ {u0,u1} IN edgeX V (mcell4 V vl) /\ mcell4 V vl SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) ) /\ y1 = dist(u0,u1) /\ y2 = dist(u0,f i) /\ y3 = dist(u0,f (SUC i)) /\ y5 = dist(u1,f (SUC i)) /\ y6 = dist(u1,f i) ==> (?y4. &2 <= y4 /\ y4 <= &2 * sqrt(&2) /\ &0 < delta_y y1 y2 y3 y4 y5 y6 /\ dih_y y1 y2 y3 y4 y5 y6 <= azim u0 u1 (f i) (f (SUC i)) /\ &2 <= rad2_y y1 y2 y3 y4 y5 y6 /\ (azim u0 u1 (f i) (f (SUC i)) < pi /\ dist(f i,f (SUC i)) <= &2 * sqrt(&2) ==> y4 = dist(f i,f(SUC i))))`,
(* {{{ proof *) [ REWRITE_TAC[Pack_defs.critical_edge_y]; REPEAT WEAKER_STRIP_TAC; TYPIFY `!j. leaf V [u0; u1; f j]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; INTRO_TAC s_leaf_leaf[`V`;`[u0;u1]`;`f j`]; REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN MATCH_MP_TAC; REWRITE_TAC[IN]; MATCH_MP_TAC LEAF_RANK_S_LEAF; BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); INTRO_TAC LEAF_DOMAIN [`V`;`[u0;u1;f i]`]; INTRO_TAC LEAF_DOMAIN [`V`;`[u0;u1;f (SUC i)]`]; REWRITE_TAC[Bump.EL_EXPLICIT]; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; COMMENT "delta with delta";
TYPIFY `!y4. &2 <= y4 /\ y4 <= &2 * sqrt(&2) ==> &0 < delta_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) y4 (dist (u1,f (SUC i))) (dist (u1,f i))` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "FWGKMBZ"); REWRITE_TAC[Sphere.y_of_x;GSYM Sphere.delta_y]; REWRITE_TAC[Sphere.ineq]; DISCH_THEN (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]); REWRITE_TAC[arith `x > &0 <=> &0 < x`]; ASM_REWRITE_TAC[TAUT `x ==> b ==> c <=> x /\ b ==> c`]; DISCH_THEN MATCH_MP_TAC; REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); TYPIFY `&2 <= &2 * sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); REWRITE_TAC[GSYM Sphere.sqrt2]; MP_TAC Flyspeck_constants.bounds; BY(REAL_ARITH_TAC); COMMENT "first case"; TYPIFY `pi <= azim u0 u1 (f i) (f (SUC i))` ASM_CASES_TAC; TYPIFY `&2 * sqrt(&2)` EXISTS_TAC; ASM_SIMP_TAC[arith `pi <= x ==> ~(x < pi)`;arith `x <= x`]; CONJ_TAC; MATCH_MP_TAC REAL_LE_TRANS; TYPIFY `pi` EXISTS_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC (arith `x < y ==> x <= y`); MATCH_MP_TAC DIH_Y_LT_PI; CONJ2_TAC; FIRST_X_ASSUM MATCH_MP_TAC; BY(ASM_REWRITE_TAC[arith `x <= x`]); FIRST_X_ASSUM_ST `hminus` MP_TAC; BY(MP_TAC Nonlinear_lemma.hminus_gt THEN REAL_ARITH_TAC); REWRITE_TAC[GSYM Sphere.sqrt2;GSYM Nonlinear_lemma.sqrt8_sqrt2]; MATCH_MP_TAC RAD2_Y_SQRT8; ASM_SIMP_TAC[]; TYPIFY `!y. y < &2 * sqrt(&2) ==> y < &4` (C SUBGOAL_THEN ASSUME_TAC); REWRITE_TAC[GSYM Sphere.sqrt2]; MP_TAC Flyspeck_constants.bounds; BY(REAL_ARITH_TAC); ASM_SIMP_TAC[]; FIRST_X_ASSUM MATCH_MP_TAC; BY(ASM_REWRITE_TAC[arith `x <= x`;Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]); FIRST_X_ASSUM MP_TAC; REWRITE_TAC[arith `~(pi <= x) <=> x < pi`]; DISCH_TAC; COMMENT "second case"; TYPIFY `&2 * sqrt(&2) < dist(f i,f (SUC i))` ASM_CASES_TAC; TYPIFY `&2 * sqrt(&2)` EXISTS_TAC; ASM_SIMP_TAC[arith `x <= x`;arith `s < d ==> ~(d <= s)`]; CONJ2_TAC; REWRITE_TAC[GSYM Sphere.sqrt2;GSYM Nonlinear_lemma.sqrt8_sqrt2]; MATCH_MP_TAC RAD2_Y_SQRT8; ASM_SIMP_TAC[]; TYPIFY `!y. y < &2 * sqrt(&2) ==> y < &4` (C SUBGOAL_THEN ASSUME_TAC); REWRITE_TAC[GSYM Sphere.sqrt2]; MP_TAC Flyspeck_constants.bounds; BY(REAL_ARITH_TAC); ASM_SIMP_TAC[]; FIRST_X_ASSUM MATCH_MP_TAC; BY(ASM_REWRITE_TAC[arith `x <= x`;Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]); MATCH_MP_TAC REAL_LE_TRANS; TYPIFY `dihV u0 u1 (f i) (f (SUC i))` EXISTS_TAC; CONJ2_TAC; MATCH_MP_TAC Rogers.DIHV_LE_AZIM; BY(ASM_REWRITE_TAC[]); INTRO_TAC Merge_ineq.DIHV_EQ_DIH_Y [`u0`;`u1`;`f i`;`f(SUC i)`]; ASM_SIMP_TAC[LET_DEF;LET_END_DEF]; DISCH_THEN SUBST1_TAC; REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF]; MATCH_MP_TAC (arith `x < y ==> x <= y`); MATCH_MP_TAC Tame_inequalities.DIH_X_MONO_LT_4; REWRITE_TAC[GSYM Sphere.delta_y]; CONJ_TAC; GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE; BY(ASM_SIMP_TAC [arith `&2 <= x ==> abs(x ) = x`]); CONJ_TAC; GMATCH_SIMP_TAC REAL_LT_MUL_EQ; FIRST_X_ASSUM_ST `hminus` MP_TAC; BY(MP_TAC Nonlinear_lemma.hminus_gt THEN REAL_ARITH_TAC); CONJ_TAC; FIRST_X_ASSUM MATCH_MP_TAC; BY(ASM_REWRITE_TAC[arith `x <= x`]); TYPIFY `~coplanar {u0,u1,f i , f (SUC i)}` (C SUBGOAL_THEN ASSUME_TAC); REWRITE_TAC[ (GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR)]; DISCH_THEN DISJ_CASES_TAC; INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`;`SUC i`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`;arith `SUC i = i + 1`]; BY(ASM_MESON_TAC[ MOD_INJ1_ALT;arith `1 < n ==> ~(n = 0) /\ ~(1 = 0)`]); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); BY(ASM_REWRITE_TAC[GSYM coplanar_delta_y]); COMMENT "last case"; FIRST_X_ASSUM MP_TAC; REWRITE_TAC[arith `~(x < d) <=> (d <= x)`]; DISCH_TAC; TYPIFY `dist(f i,f (SUC i))` EXISTS_TAC; ASM_SIMP_TAC[]; TYPIFY `~(f i = f (SUC i))` (C SUBGOAL_THEN ASSUME_TAC); DISCH_TAC; INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`;`SUC i`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`;arith `SUC i = i + 1`]; REWRITE_TAC[AZIM_REFL]; BY(ASM_MESON_TAC[ MOD_INJ1_ALT;arith `1 < n ==> ~(n = 0) /\ ~(1 = 0)`]); TYPIFY `!i. V (f i)` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; FIRST_X_ASSUM_ST `leaf` MP_TAC; REWRITE_TAC[Leaf_cell.leaf;IN]; DISCH_THEN (C INTRO_TAC [`i'`]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Packing3.BARV_SUBSET [`V`;`2`;`[u0;u1;f i']`]; ASM_REWRITE_TAC[set_of_list;SUBSET;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; BY(MESON_TAC[IN]); SUBCONJ_TAC; FIRST_X_ASSUM_ST `packing` MP_TAC; REWRITE_TAC[Sphere.packing]; DISCH_THEN MATCH_MP_TAC; BY(ASM_MESON_TAC[]); DISCH_TAC; SUBCONJ_TAC; FIRST_X_ASSUM MATCH_MP_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; COMMENT "azim on last case"; CONJ_TAC; INTRO_TAC Rogers.DIHV_LE_AZIM [`u0`;`u1`;`f i`;`f(SUC i)`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); MATCH_MP_TAC (arith `x = y ==> (x <= a ==> y <= a)`); INTRO_TAC Merge_ineq.DIHV_EQ_DIH_Y [`u0`;`u1`;`f i`;`f(SUC i)`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); BY(REWRITE_TAC[LET_DEF;LET_END_DEF]); COMMENT "deal with rad"; MATCH_MP_TAC (arith `~(x < y) ==> y <= x`); REWRITE_TAC[Sphere.rad2_y;Sphere.y_of_x;arith `x * x = x pow 2`]; INTRO_TAC (GSYM GDRQXLGv3) [`u0`;`u1`;`f i`;`f (SUC i)`]; REWRITE_TAC[LET_DEF;LET_END_DEF]; ANTS_TAC; FIRST_X_ASSUM MP_TAC; BY(MESON_TAC[coplanar_delta_y]); DISCH_THEN SUBST1_TAC; DISCH_TAC; TYPIFY `radV {u0,u1,f i, f(SUC i)} < sqrt(&2)` ENOUGH_TO_SHOW_TAC; REPEAT WEAKER_STRIP_TAC; INTRO_TAC RAD_PI_IMP_WEDGE4 [`V`;`f`;`w0`;`n`;`i`;`u0`;`u1`]; ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `edgeX` MP_TAC; BY(MESON_TAC[]); FIRST_X_ASSUM MP_TAC; REWRITE_TAC[arith `x < y <=> ~(y <= x)`]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `~` MP_TAC; REWRITE_TAC[]; ONCE_REWRITE_TAC[GSYM Nonlin_def.sqrt2_sqrt2]; REWRITE_TAC[Sphere.sqrt2;arith `x pow 2 = x * x`]; GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; GMATCH_SIMP_TAC Trigonometry2.LT_IMP_ABS_REFL; ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC REAL_LT_RSQRT; BY(REAL_ARITH_TAC) ]);; (* }}} *)
let cc_4_cc_ke4 = 
prove_by_refinement( `!V u0 u1 w0 n f i. packing V /\ saturated V /\ leaf_rank V [u0;u1] w0 n f /\ ~collinear {u0,u1,w0} /\ periodic f n /\ 1 < n /\ leaf V [u0;u1;f i] /\ cc_4 V u0 u1 f i ==> cc_ke V [u0;u1;f i] = 4`,
(* {{{ proof *) [ REWRITE_TAC[cc_4]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC Leaf_cell.MCELL4_EDGE_FIRST [`V`;`ul`;`u0`;`u1`]; ANTS_TAC; BY(ASM_MESON_TAC[IN]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Leaf_cell.CC_KE_34 [`V`;`[u0;u1;f i]`]; DISCH_THEN (MP_TAC o (MATCH_MP (TAUT `a \/ b ==> b \/ a`))); DISCH_THEN DISJ_CASES_TAC; BY(ASM_REWRITE_TAC[]); INTRO_TAC K3_CC_WI_ALT [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; ASM_SIMP_TAC[Bump.EL_EXPLICIT]; ANTS_TAC; BY(ASM_MESON_TAC[]); DISCH_TAC; TYPIFY `?j. j< n /\ (f i) = (f j) /\ (f (SUC j) = f (SUC i))` (C SUBGOAL_THEN MP_TAC); TYPIFY `i MOD n` EXISTS_TAC; INTRO_TAC F_DEMOD [`f`;`n`;`i`]; BY(ASM_MESON_TAC[DIVISION;arith `1 < n ==> ~(n = 0)`]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u0;u1;f i]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_TAC; INTRO_TAC MCELL4_FULL_WEDGE [`V`;`cc_cell V [u0;u1;f i]`;`vl`;`w0`;`n`;`f`;`j`]; ANTS_TAC; ASM_SIMP_TAC[]; BY(ASM_MESON_TAC[Bump.RIJRIED;NOT_IN_EMPTY;Bump.MCELL4;Leaf_cell.CC_CELL_IN_MCELL_SET;IN]); DISCH_TAC; INTRO_TAC Ajripqn.AJRIPQN [`V`;`vl`;`cc_uh V [u0;u1;f i]`;`4`;`3`]; ASM_REWRITE_TAC[arith `~(4 = 3) /\ ~(3 = 4)`;IN_INSERT]; CONJ_TAC; BY(ASM_MESON_TAC[IN]); CONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); REWRITE_TAC[GSYM Bump.MCELL4]; TYPIFY `mcell 3 V (cc_uh V [EL 0 vl; EL 1 vl; f j]) = mcell4 V vl` (C SUBGOAL_THEN SUBST1_TAC); FIRST_X_ASSUM (SUBST1_TAC o GSYM); REWRITE_TAC[Leaf_cell.cc_cell]; BY(ASM_MESON_TAC[]); REWRITE_TAC[INTER_IDEMPOT]; BY(ASM_MESON_TAC[Bump.RIJRIED;NOT_IN_EMPTY;IN;Bump.MCELL4]) ]);;
(* }}} *)
let cc_4_cc_cell = 
prove_by_refinement( `!V u0 u1 w0 n f i. packing V /\ saturated V /\ periodic f n /\ leaf V [u0;u1;f i] /\ leaf_rank V [u0;u1] w0 n f /\ ~collinear {u0,u1,w0} /\ 1 < n /\ cc_4 V u0 u1 f i ==> gg_mcell V f u0 u1 i = gammaX V (cc_cell V [u0;u1;f i]) lmfun * critical_weight V (cc_cell V [u0;u1;f i]) + beta_bump_v1 V {u0,u1} (cc_cell V [u0;u1;f i])`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC cc_4_cc_ke4 [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; INTRO_TAC Leaf_cell.EL_CC_UH [`V`;`[u0;u1;f i]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; TYPED_ABBREV_TAC `j = (i:num)`; TYPIFY `mcell4 V (cc_uh V [u0;u1;f j]) = cc_cell V [u0;u1;f j]` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); INTRO_TAC MCELL4_GG [`V`;`cc_cell V [u0;u1;f i]`;`cc_uh V [u0;u1;f i]`;`w0`;`n`;`f`;`j`]; ASM_SIMP_TAC[]; ANTS_TAC; CONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); CONJ_TAC; MATCH_MP_TAC Leaf_cell.CC_CELL_NOT_NULLSET; BY(ASM_MESON_TAC[]); INTRO_TAC K4_CC_WI_ALT [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); DISCH_THEN (SUBST1_TAC o GSYM); BY(REWRITE_TAC[]) ]);;
(* }}} *)
let LEAF_RANK_PROPS = 
prove_by_refinement( `!V. packing V /\ saturated V /\ ~cell_cluster_estimate_v1 V /\ pack_nonlinear_non_ox3q1h ==> (?u0 u1 n w0 f. 1 < n /\ s_leaf V [u0;u1] HAS_SIZE n /\ ~(u0 = u1) /\ hminus <= hl [u0;u1] /\ hl [u0;u1] <= hplus /\ ~collinear {u0, u1, w0 } /\ leaf_rank V [u0;u1] w0 n f /\ u0 IN V /\ u1 IN V /\ periodic f n /\ (!j. leaf V [u0; u1; f j]) /\ critical_edge_y (dist(u0,u1)) /\ sum {i | i < n} (gg_mcell V f (u0) (u1)) < &0 /\ sum {i | i < n} (azim_mcell V f (u0) (u1)) = &2 * pi /\ (!i. azim_mcell V f u0 u1 i = azim (u0) (u1) (f i) (f (SUC i))) /\ cc_bool_model_v11 (cc_data_v8 V f u0 u1) /\ cc_bool_prep_v11 (cc_data_v8 V f u0 u1) ) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC CELL_CLUSTER_ESTIMATE_REDUCE [`V`]; ASM_REWRITE_TAC[NOT_FORALL_THM]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (MP_TAC o (MATCH_MP (TAUT `~(a /\ b /\ d ==>c) ==> a /\ b /\ d /\ ~c`))); REWRITE_TAC[arith `~(a <= b) <=> b < a`]; REPEAT WEAKER_STRIP_TAC; GEXISTL_TAC [`u0`;`u1`]; TYPED_ABBREV_TAC `(n:num) = CARD(s_leaf V [u0;u1])`; EXISTS_TAC `n:num`; TYPIFY `?w0. ~collinear {u0,u1,w0}` (C SUBGOAL_THEN MP_TAC); MATCH_MP_TAC Trigonometry2.TOW_DISTINCT_POINTS_EXISTS_RD_NOT_COLLINEAR; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; TYPIFY `w0` EXISTS_TAC; INTRO_TAC CELL_CLUSTER_N_LE_1 [`V`;`u0`;`u1`]; ASM_REWRITE_TAC[arith `&0 <= x <=> ~(x < &0)`;arith `~(n <= 1) <=> 1 < n`]; DISCH_TAC; TYPIFY `s_leaf V [u0;u1] HAS_SIZE n` (C SUBGOAL_THEN ASSUME_TAC); ASM_REWRITE_TAC[ HAS_SIZE]; MATCH_MP_TAC S_LEAF_FINITE; BY(ASM_REWRITE_TAC[]); INTRO_TAC LEAF_RANKING_LEMMA [`V`;`[u0;u1]`;`w0`;`n`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; ASM_SIMP_TAC[arith `1 < n ==> 0 < n`]; REPEAT WEAKER_STRIP_TAC; TYPIFY `f` EXISTS_TAC; SUBCONJ_TAC; BY(ASM_REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]); DISCH_TAC; TYPIFY `!j. leaf V [u0; u1; f j]` (C SUBGOAL_THEN ASSUME_TAC); GEN_TAC; INTRO_TAC s_leaf_leaf[`V`;`[u0;u1]`;`f j`]; REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN MATCH_MP_TAC; REWRITE_TAC[IN]; MATCH_MP_TAC LEAF_RANK_S_LEAF; BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); TYPIFY `critical_edge_y (dist(u0,u1))` (C SUBGOAL_THEN ASSUME_TAC); REWRITE_TAC[Pack_defs.critical_edge_y]; REPEAT (FIRST_X_ASSUM_ST `hl` MP_TAC); REWRITE_TAC[Marchal_cells_3.HL_2]; BY(REAL_ARITH_TAC); TYPIFY `u0 IN V /\ u1 IN V` (C SUBGOAL_THEN ASSUME_TAC); TYPIFY `u0 IN V /\ u1 IN V` (C SUBGOAL_THEN (unlist ASM_REWRITE_TAC)); INTRO_TAC Packing3.BARV_SUBSET [`V`;`2`;`[u0;u1;f 0]`]; ANTS_TAC; BY(ASM_MESON_TAC[Leaf_cell.leaf;IN;Sphere.BARV]); REWRITE_TAC[Bump.set_of_list3_explicit]; BY(SET_TAC[]); ASM_REWRITE_TAC[]; INTRO_TAC LEAF_RANK_GG_SUM [`V`;`[u0;u1]`;`w0`;`n`;`f`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN SUBST1_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); CONJ_TAC; ONCE_REWRITE_TAC[TAUT `!a b. a /\ b <=> b /\ a`]; BY(ASM_REWRITE_TAC[]); CONJ_TAC; INTRO_TAC LEAF_RANK_GRUTOTI [`V`;`[u0;u1]`;`w0`;`n`;`f`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN MATCH_MP_TAC; MATCH_MP_TAC REAL_LET_TRANS; TYPIFY `hplus` EXISTS_TAC; ASM_REWRITE_TAC[]; MP_TAC Flyspeck_constants.bounds; BY(REAL_ARITH_TAC); CONJ_TAC; GEN_TAC; INTRO_TAC LEAF_RANK_REUHADY [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); CONJ_TAC; MATCH_MP_TAC cc_bool_model_data; GEXISTL_TAC [`w0`;`n`]; BY(ASM_REWRITE_TAC[]); MATCH_MP_TAC cc_prep_model_data; BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let cc_real_dat_def = 
prove_by_refinement( `!V f u0 u1. cc_qx_v11 (cc_data_v8 V f u0 u1) = (\i. cc_4 V u0 u1 f i /\ ~(dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus /\ dist (u0,f (i + 1)) < &2 * hminus /\ dist (u1,f (i + 1)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus)) /\ cc_qy_v11 (cc_data_v8 V f u0 u1) = (\i. ~cc_4 V u0 u1 f i) /\ cc_qu_v11 (cc_data_v8 V f u0 u1) = (\i. cc_4 V u0 u1 f i /\ (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (i + 1)) < &2 * hminus /\ dist (u1,f (i + 1)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus) /\ cc_hassmall_v11 (cc_data_v8 V f u0 u1) = (\i. (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (i + 1)) < &2 * hminus /\ dist (u1,f (i + 1)) < &2 * hminus)`,
(* {{{ proof *) [ REWRITE_TAC[FUN_EQ_THM;Oxl_def.cc_subcrit_v11;Oxl_def.cc_crit_v11;Oxl_def.cc_supercrit_v11;Oxl_def.cc_small_v11;Oxl_def.cc_small_eta_v11;Oxl_def.cc_4cell_v11;Oxl_def.cc_bool_v11;cc_data_v8;Oxl_def.cc_v11;Bump.EL_EXPLICIT;Oxl_def.cc_qx_v11;Oxl_def.cc_qy_v11;Oxl_def.cc_hassmall_v11;Oxl_def.cc_qu_v11;GSYM cc_4]; REPEAT WEAKER_STRIP_TAC; BY(MESON_TAC[]) ]);;
(* }}} *)
let real_periodic_data = 
prove_by_refinement( `!V u0 u1 f n . periodic f n ==> periodic (azim_mcell V f u0 u1) n /\ periodic (gg_mcell V f u0 u1) n /\ periodic (\i. gammaX V (cc_cell V [u0; u1; f i]) lmfun) n /\ periodic (\i. gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun) n /\ periodic (\i. gammaX V (cc_cell V [u0; u1; f i]) lmfun * critical_weight V (cc_cell V [u0; u1; f i])) n /\ periodic (\i. gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * critical_weight V (cc_cell V [u1; u0; f (SUC i)])) n `,
(* {{{ proof *) [ REWRITE_TAC[Oxl_def.periodic;azim_mcell;gg_mcell;Pack_defs.critical_weight]; REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[arith `!i. SUC (i+n) = SUC i + n`]; BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *)
let LEAF_RANK_LEAF = 
prove_by_refinement( `!V u0 u1 w0 n f i. leaf_rank V [u0;u1] w0 n f ==> leaf V [u0;u1;f i]`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC s_leaf_leaf[`V`;`[u0;u1]`;`f i`]; REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN MATCH_MP_TAC; REWRITE_TAC[IN]; MATCH_MP_TAC LEAF_RANK_S_LEAF; BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]) ]);;
(* }}} *)
let cc_4_UL = 
prove_by_refinement( `!V u0 u1 w0 n f i. packing V /\ saturated V /\ leaf_rank V [u0;u1] w0 n f /\ ~collinear {u0,u1,w0} /\ 1 < n /\ cc_4 V u0 u1 f i ==> cc_cell V [u0;u1;f i] = mcell4 V [u0;u1;f i; f (SUC i)] `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC cc_4_cc_ke4 [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_SIMP_TAC[]; ANTS_TAC; BY(ASM_MESON_TAC[LEAF_RANK_PERIODIC;LEAF_RANK_LEAF]); DISCH_TAC; INTRO_TAC CC_CELL_WEDGE_MATCH_UH [`V`;`[u0;u1;f i]`;`u0`;`u1`;`w0`;`n`;`f`;`i`;`i`]; ANTS_TAC; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; INTRO_TAC K4_CC_WI_ALT [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); ASM_SIMP_TAC[Geomdetail.PAIR_EQ_EXPAND]; DISCH_THEN DISJ_CASES_TAC; INTRO_TAC Leaf_cell.LIST_OF_CC_UH [`V`;`[u0;u1;f i]`]; ASM_REWRITE_TAC[Leaf_cell.cc_cell]; ANTS_TAC; MATCH_MP_TAC LEAF_RANK_LEAF; BY(ASM_MESON_TAC[]); DISCH_THEN SUBST1_TAC; BY(REWRITE_TAC[Bump.MCELL4;Bump.EL_EXPLICIT]); BY(ASM_MESON_TAC[LEAF_RANK_SUC_INJ]) ]);;
(* }}} *)
let EDGEX_PAIR = 
prove_by_refinement( `!V X e. e IN edgeX V X ==> (?u v. e = {u,v} /\ ~(u = v))`,
(* {{{ proof *) [ REWRITE_TAC[Pack_defs.edgeX;IN_ELIM_THM]; BY(MESON_TAC[]) ]);;
(* }}} *)
let MCELL4_EDGE_EXPLICIT = 
prove_by_refinement( `!V u0 u1 u2 u3. packing V /\ saturated V /\ ~NULLSET (mcell4 V [u0;u1;u2;u3]) /\ barV V 3 [u0;u1;u2;u3] ==> edgeX V (mcell4 V [u0;u1;u2;u3]) = {{u0,u1},{u0,u2},{u0,u3},{u1,u2},{u1,u3},{u2,u3}}`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[EXTENSION]; GEN_TAC; TYPIFY `~(?u v. x = {u,v})` ASM_CASES_TAC; REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(ASM_MESON_TAC[EDGEX_PAIR]); FIRST_X_ASSUM MP_TAC; REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; INTRO_TAC Bump.MCELL4_EDGE [`V`;`[u0;u1;u2;u3]`;`u`;`v`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_THEN SUBST1_TAC; REWRITE_TAC[set_of_list]; INTRO_TAC MCELL4_CARD4 [`V`;`[u0;u1;u2;u3]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN (MP_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; REWRITE_TAC[IN_INSERT;SUBSET;NOT_IN_EMPTY]; TYPIFY `(u = u0)` ASM_CASES_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[]); TYPIFY `(u = u1)` ASM_CASES_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[]); TYPIFY `(u = u2)` ASM_CASES_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[]); TYPIFY `(u= u3)` ASM_CASES_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[]); ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let CC_4_PROPS = 
prove_by_refinement( `!V u0 u1 w0 n f i. packing V /\ saturated V /\ leaf_rank V [u0;u1] w0 n f /\ ~collinear {u0,u1,w0} /\ 1 < n /\ cc_4 V u0 u1 f i ==> cc_ke V [u0; u1; f i] = 4 /\ hl [u0;u1;f i;f (SUC i)] < sqrt(&2) /\ convex hull {u0,u1,f i,f (SUC i)} = cc_cell V [u0;u1;f i] /\ ~coplanar {u0,u1,f i, f (SUC i)} /\ cc_cell V [u0; u1; f i] SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ cc_cell V [u0; u1; f i] = mcell4 V [u0; u1; f i; f (SUC i)] /\ ~collinear {u0,u1,f i} /\ ~collinear {u0,u1,f (SUC i)} /\ leaf V [u0; u1; f i] /\ leaf V [u0; u1; f (SUC i)] /\ ~NULLSET (cc_cell V [u0; u1; f i]) /\ barV V 3 [u0;u1;f i;f (SUC i)]`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; PROOF_BY_CONTR_TAC; INTRO_TAC LEAF_RANK_LEAF [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; INTRO_TAC LEAF_RANK_LEAF [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; INTRO_TAC cc_4_cc_ke4 [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_SIMP_TAC[]; DISCH_THEN MP_TAC THEN ANTS_TAC; BY(ASM_MESON_TAC[LEAF_RANK_PERIODIC]); DISCH_TAC; INTRO_TAC K4_CC_WI_ALT [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_TAC; INTRO_TAC cc_4_UL [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; DISCH_TAC; INTRO_TAC Leaf_cell.EL_CC_UH [`V`;`[u0;u1;f i]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC Leaf_cell.CC_CELL_NOT_NULLSET [`V`;`[u0;u1;f i]`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; TYPIFY `hl [u0;u1;f i;f (SUC i)] < sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); PROOF_BY_CONTR_TAC; FIRST_X_ASSUM_ST `NULLSET` MP_TAC; ASM_REWRITE_TAC[]; BY(ASM_REWRITE_TAC[Pack_defs.mcell4;NEGLIGIBLE_EMPTY]); TYPIFY `convex hull {u0,u1,f i,f (SUC i)} = cc_cell V [u0;u1;f i]` (C SUBGOAL_THEN ASSUME_TAC); ASM_REWRITE_TAC[]; BY(ASM_REWRITE_TAC[Pack_defs.mcell4;set_of_list]); TYPIFY `~coplanar {u0,u1,f i,f (SUC i)}` (C SUBGOAL_THEN ASSUME_TAC); ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; DISCH_THEN (MP_TAC o (MATCH_MP COPLANAR_IMP_NEGLIGIBLE)); BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]); INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;f (SUC i)]`]; ASM_REWRITE_TAC[set_of_list]; PROOF_BY_CONTR_TAC; INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;f i]`]; ASM_REWRITE_TAC[set_of_list]; PROOF_BY_CONTR_TAC; COMMENT "barV";
INTRO_TAC MCELL4_BARV_FI [`V`;`cc_uh V [u0;u1;f i]`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN MP_TAC THEN ANTS_TAC; CONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); TYPIFY `mcell4 V (cc_uh V [u0; u1; f i]) = cc_cell V [u0;u1;f i]` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); ASM_REWRITE_TAC[]; CONJ_TAC; BY(ASM_MESON_TAC[]); BY(ASM_MESON_TAC[]); BY(ASM_MESON_TAC[]) ]);; (* }}} *)
let CC_4_BETA_BUMP_EXPLICIT = 
prove_by_refinement( `!V u0 u1 w0 n f i. packing V /\ saturated V /\ leaf_rank V [u0;u1] w0 n f /\ ~collinear {u0,u1,w0} /\ 1 < n /\ cc_4 V u0 u1 f i /\ critical_edge_y (dist(u0,u1)) /\ critical_edge_y (dist(f i, f (SUC i))) /\ dist(u0,f i) < &2 * hminus /\ dist(u0,f(SUC i)) < &2 * hminus /\ dist(u1,f i) < &2 * hminus /\ dist(u1,f(SUC i)) < &2 * hminus ==> beta_bump_v1 V {u0,u1} (cc_cell V [u0;u1;f i]) = bump (dist(u0,u1)/ &2) - bump (dist(f i,f (SUC i))/ &2) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; PROOF_BY_CONTR_TAC; INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `beta_bump_v1` MP_TAC; REWRITE_TAC[]; INTRO_TAC Bump.BETA_BUMP_ALT [`V`;`cc_cell V [u0;u1;f i]`;`(\e. VX V (cc_cell V [u0;u1;f i]) DIFF e)`;`{u0,u1}`]; ANTS_TAC; REWRITE_TAC[]; TYPIFY `packing V /\ saturated V` (C SUBGOAL_THEN (unlist REWRITE_TAC)); BY(ASM_REWRITE_TAC[]); ONCE_REWRITE_TAC[GSYM IN]; MATCH_MP_TAC Leaf_cell.CC_CELL_IN_MCELL_SET; BY(ASM_REWRITE_TAC[]); DISCH_THEN SUBST1_TAC; ASM_REWRITE_TAC[]; INTRO_TAC Bump.MCELL4_EDGE_OPP [`V`;`[u0;u1;f i;f (SUC i)]`]; REWRITE_TAC[Bump.EL_EXPLICIT]; ANTS_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[]); DISCH_THEN SUBST1_TAC; COND_CASES_TAC; BY(REWRITE_TAC[RADV2;arith `inv (&2) *x = x/ &2`]); PROOF_BY_CONTR_TAC; FIRST_X_ASSUM_ST `subcritical_edgeX` MP_TAC; REWRITE_TAC[]; REWRITE_TAC[Bump.CRITICAL_EDGEX_ALT]; REWRITE_TAC[Bump.SUBCRITICAL_EDGEX_ALT]; REWRITE_TAC[RADV2;arith `inv (&2) *x <= y <=> x <= &2 * y`;arith `y <= inv(&2) * x <=> &2 * y <= x`]; INTRO_TAC MCELL4_EDGE_EXPLICIT [`V`;`u0`;`u1`;`f i`;`f(SUC i)`]; ANTS_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[]); DISCH_THEN SUBST1_TAC; REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; REPEAT (FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC); REWRITE_TAC[Sphere.critical_edge_y]; REPEAT (DISCH_THEN (unlist REWRITE_TAC)); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC THEN ASM_REWRITE_TAC[RADV2;arith `inv (&2) *x < hminus <=> x < &2 * hminus`])) ]);;
(* }}} *)
let CC_4_BETA_BUMP_0 = 
prove_by_refinement( `!V u0 u1 w0 n f i. packing V /\ saturated V /\ leaf_rank V [u0;u1] w0 n f /\ ~collinear {u0,u1,w0} /\ 1 < n /\ cc_4 V u0 u1 f i /\ ~(critical_edge_y (dist(u0,u1)) /\ critical_edge_y (dist(f i, f (SUC i))) /\ dist(u0,f i) < &2 * hminus /\ dist(u0,f(SUC i)) < &2 * hminus /\ dist(u1,f i) < &2 * hminus /\ dist(u1,f(SUC i)) < &2 * hminus) ==> beta_bump_v1 V {u0,u1} (cc_cell V [u0;u1;f i]) = &0 `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; PROOF_BY_CONTR_TAC; INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `beta_bump_v1` MP_TAC; REWRITE_TAC[]; INTRO_TAC Bump.BETA_BUMP_ALT [`V`;`cc_cell V [u0;u1;f i]`;`(\e. VX V (cc_cell V [u0;u1;f i]) DIFF e)`;`{u0,u1}`]; ANTS_TAC; REWRITE_TAC[]; TYPIFY `packing V /\ saturated V` (C SUBGOAL_THEN (unlist REWRITE_TAC)); BY(ASM_REWRITE_TAC[]); ONCE_REWRITE_TAC[GSYM IN]; MATCH_MP_TAC Leaf_cell.CC_CELL_IN_MCELL_SET; BY(ASM_REWRITE_TAC[]); DISCH_THEN SUBST1_TAC; ASM_REWRITE_TAC[]; INTRO_TAC Bump.MCELL4_EDGE_OPP [`V`;`[u0;u1;f i;f (SUC i)]`]; REWRITE_TAC[Bump.EL_EXPLICIT]; ANTS_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[]); DISCH_THEN SUBST1_TAC; COND_CASES_TAC; PROOF_BY_CONTR_TAC; FIRST_X_ASSUM_ST `subcritical_edgeX` MP_TAC; REWRITE_TAC[Bump.CRITICAL_EDGEX_ALT;Bump.SUBCRITICAL_EDGEX_ALT]; REWRITE_TAC[RADV2;arith `inv (&2) *x <= y <=> x <= &2 * y`;arith `y <= inv(&2) * x <=> &2 * y <= x`]; INTRO_TAC MCELL4_EDGE_EXPLICIT [`V`;`u0`;`u1`;`f i`;`f(SUC i)`]; ANTS_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[]); DISCH_THEN SUBST1_TAC; REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; REPEAT WEAKER_STRIP_TAC; REPEAT (FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC); ASM_REWRITE_TAC[Sphere.critical_edge_y]; FIRST_X_ASSUM MP_TAC; REWRITE_TAC[GSYM RADV2;arith ` x < &2 * hminus <=> inv (&2) *x < hminus`]; INTRO_TAC MCELL4_CARD4 [`V`;`[u0;u1;f i;f (SUC i)]`]; ANTS_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN (MP_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); REPEAT WEAKER_STRIP_TAC; TYPIFY `!g. (g = {u0, f i} \/ g = {u0, f (SUC i)} \/ g = {u1, f i} \/ g = {u1 , f(SUC i)}) /\ ~(g = {u0,u1}) /\ ~(g = {f i,f(SUC i)}) ==> radV g < hminus` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); BY(REPEAT (CONJ_TAC THEN TRY( (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]))); BY(REWRITE_TAC[]) ]);;
(* }}} *)
let critical_edgeX_critical_edge_y = 
prove_by_refinement( `!V X u v. {u,v} IN critical_edgeX V X <=> {u,v} IN edgeX V X /\ critical_edge_y (dist(u,v))`,
(* {{{ proof *) [ REWRITE_TAC[Pack_defs.critical_edgeX;IN_ELIM_THM;Marchal_cells_3.HL_2;Sphere.critical_edge_y]; REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC (TAUT `((a==> b) /\ (b ==> a)) ==> (a = b)`); CONJ2_TAC; REWRITE_TAC[arith `!x y. inv(&2) * x <= y <=> x <= &2 * y`; arith `!x y. y <= inv (&2) * x <=> &2 * y <= x`]; BY(MESON_TAC[]); REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; REWRITE_TAC[arith `!x y. inv(&2) * x <= y <=> x <= &2 * y`; arith `!x y. y <= inv (&2) * x <=> &2 * y <= x`]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM DISJ_CASES_TAC; BY(ASM_REWRITE_TAC[]); TYPIFY `{u,v} = {u',v'}` (C SUBGOAL_THEN SUBST1_TAC); ASM_REWRITE_TAC[]; BY(SET_TAC[]); BY(ASM_MESON_TAC[DIST_SYM]) ]);;
(* }}} *)
let critical_weight_wtcount6_y = 
prove_by_refinement( `!V u0 u1 w0 n f i. packing V /\ saturated V /\ leaf_rank V [u0;u1] w0 n f /\ ~collinear {u0,u1,w0} /\ 1 < n /\ cc_4 V u0 u1 f i /\ critical_edge_y (dist(u0,u1)) ==> critical_weight V (cc_cell V [u0;u1;f i]) = &1 / & (wtcount6_y (dist(u0,u1)) (dist(u0,f i)) (dist (u0,f (SUC i))) (dist (f i, f (SUC i))) (dist(u1, f (SUC i))) (dist (u1, f i)))`,
(* {{{ proof *) [ REWRITE_TAC[Pack_defs.critical_edge_y;Pack_defs.critical_weight;arith `&1/ x = inv(x)`;REAL_EQ_INV2;REAL_OF_NUM_EQ]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC Upfzbzm_support_lemmas.FINITE_critical_edgeX [`V`;`cc_cell V [u0;u1;f i]`]; DISCH_TAC; INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; TYPED_ABBREV_TAC `ee = critical_edgeX V (cc_cell V [u0; u1; f i])` ; INTRO_TAC MCELL4_EDGE_EXPLICIT [`V`;`u0`;`u1`;`f i`;`f (SUC i)`]; ANTS_TAC; BY(ASM_MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; TYPIFY `ee = {{u0, u1}, {u0, f i}, {u0, f (SUC i)}, {u1, f i}, {u1, f (SUC i)}, { f i, f (SUC i)}} INTER ee` (C SUBGOAL_THEN SUBST1_TAC); MATCH_MP_TAC (SET_RULE `!a b. b SUBSET a ==> b = a INTER b`); EXPAND_TAC "ee";
REWRITE_TAC[Pack_defs.critical_edgeX;SUBSET;IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; BY(ASM_MESON_TAC[]); TYPED_ABBREV_TAC `ex = edgeX V (cc_cell V [u0;u1;f i])` ; TYPIFY `!u v. {u,v} IN ee <=> {u,v} IN ex /\ critical_edge_y (dist(u,v))` (C SUBGOAL_THEN ASSUME_TAC); EXPAND_TAC "ee"; EXPAND_TAC "ex"; BY(REWRITE_TAC[critical_edgeX_critical_edge_y]); TYPIFY `{u0,u1} IN ex /\ {u0, f i} IN ex /\ {u0, f (SUC i)} IN ex /\ {u1, f i} IN ex /\ {u1, f (SUC i)} IN ex /\ {f i, f (SUC i)} IN ex` (C SUBGOAL_THEN ASSUME_TAC); EXPAND_TAC "ex"; FIRST_X_ASSUM_ST `edgeX` kill; BY(ASM_REWRITE_TAC[IN_INSERT]); INTRO_TAC MCELL4_CARD4 [`V`;`[u0;u1;f i;f (SUC i)]`]; ANTS_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN (ASSUME_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); REPLICATE_TAC 6 (ONCE_ASM_SIMP_TAC[CARD_INSERT_INTER_ALT] THEN ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY;Geomdetail.PAIR_EQ_EXPAND]); REWRITE_TAC[Pack_defs.wtcount6_y;INTER_EMPTY;Pack_defs.wtcount3_y;CARD_CLAUSES;arith `x + 0 = x`]; BY(ARITH_TAC) ]);; (* }}} *) (* 3q1h case *) (* let ox3q1h_data = prove_by_refinement( `!V f w0 n u0 u1. ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f /\ CARD (s_leaf V [u0; u1]) = 4 /\ (?i. cc_4 V u0 u1 f i /\ (hminus <= dist (f i,f (SUC i)) /\ dist (f i,f (SUC i)) <= hplus) /\ (cc_4 V u0 u1 f (i + 1) /\ (dist (u0,f (i + 1)) < &2 * hminus /\ dist (u1,f (i + 1)) < &2 * hminus) /\ dist (u0,f ((i + 1) + 1)) < &2 * hminus /\ dist (u1,f ((i + 1) + 1)) < &2 * hminus /\ dist (f (i + 1),f (SUC (i + 1))) < hminus) /\ (cc_4 V u0 u1 f (i + 2) /\ (dist (u0,f (i + 2)) < &2 * hminus /\ dist (u1,f (i + 2)) < &2 * hminus) /\ dist (u0,f ((i + 2) + 1)) < &2 * hminus /\ dist (u1,f ((i + 2) + 1)) < &2 * hminus /\ dist (f (i + 2),f (SUC (i + 2))) < hminus) /\ cc_4 V u0 u1 f (i + 3) /\ (dist (u0,f (i + 3)) < &2 * hminus /\ dist (u1,f (i + 3)) < &2 * hminus) /\ dist (u0,f ((i + 3) + 1)) < &2 * hminus /\ dist (u1,f ((i + 3) + 1)) < &2 * hminus /\ dist (f (i + 3),f (SUC (i + 3))) < hminus) ==> &0 <= sum {i | i < n} (gg_mcell V f u0 u1) `, (* {{{ proof *) [ st/r ]);; (* }}} *) *)
let c_4_azim_mcell_dih_y = 
prove_by_refinement( `!V u0 u1 w0 n f i. 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f /\ cc_4 V u0 u1 f i ==> azim_mcell V f u0 u1 i = dih_y (dist(u0,u1)) (dist(u0,f i)) (dist (u0, f(SUC i))) (dist(f i, f (SUC i))) (dist (u1,f (SUC i))) (dist (u1, f i))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC LEAF_RANK_REUHADY [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN SUBST1_TAC; INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC MCELL4_AZIM_LT_PI [`V`;`[u0;u1;f i;f(SUC i)]`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; ANTS_TAC; BY(ASM_MESON_TAC[]); DISCH_TAC; INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;f i]`]; ASM_REWRITE_TAC[set_of_list]; INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;f (SUC i)]`]; ASM_REWRITE_TAC[set_of_list]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC AZIM_DIHV_SAME [`u0`;`u1`;`f i`;`f(SUC i)`]; ASM_REWRITE_TAC[]; DISCH_THEN SUBST1_TAC; INTRO_TAC Merge_ineq.DIHV_EQ_DIH_Y [`u0`;`u1`;`f i`;`f (SUC i)`]; BY(ASM_REWRITE_TAC[LET_DEF;LET_END_DEF]) ]);;
(* }}} *)
let NOT_COPLANAR_IMP_CARD4_ALT = 
prove_by_refinement( `!(u0:real^3) u1 u2 u3. ~coplanar {u0,u1,u2,u3} ==> CARD {u0,u1,u2,u3} = 4`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC Collect_geom2.NOT_COPLANAR_IMP_CARD4; BY(ASM_MESON_TAC[Leaf_cell.coplanar_eq_coplanar_alt;DIMINDEX_3;arith `2 <= 3`]) ]);;
(* }}} *)
let radius_le_circumradius = 
prove_by_refinement( `!(u0:real^3) u1 u2 u3. ~coplanar {u0,u1,u2,u3} ==> dist(u0,u1) <= &2 * radV {u0,u1,u2,u3}`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC NOT_COPLANAR_IMP_CARD4_ALT [`u0`;`u1`;`u2`;`u3`]; ASM_REWRITE_TAC[]; DISCH_TAC; INTRO_TAC Rogers.AFFINE_HULL_RADV [`{u0,u1,u2,u3}`;`{u0,u1}`]; ANTS_TAC; CONJ_TAC; BY(ASM_MESON_TAC[AFF_DEP_COPLANAR]); BY(SET_TAC[]); REWRITE_TAC[RADV2]; REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[arith `x <= &2 * y <=> inv (&2) * x <= y`]; TYPED_ABBREV_TAC `d = inv(&2) * dist(u0,u1)` ; TYPED_ABBREV_TAC `r = radV {u0,u1,u2,u3}` ; TYPIFY `d pow 2 <= r pow 2` (C SUBGOAL_THEN ASSUME_TAC); ASM_REWRITE_TAC[]; REWRITE_TAC[arith `x <= x + y <=> &0 <= y`]; BY(REWRITE_TAC[ REAL_LE_POW_2]); GMATCH_SIMP_TAC Collect_geom.POW2_COND; BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *)
let radius_le_circumradius_all = 
prove_by_refinement( `!(u0:real^3) u1 u2 u3. ~coplanar {u0,u1,u2,u3} ==> dist(u0,u1) <= &2 * radV {u0,u1,u2,u3} /\ dist(u0,u2) <= &2 * radV {u0,u1,u2,u3} /\ dist(u0,u3) <= &2 * radV {u0,u1,u2,u3} /\ dist(u1,u2) <= &2 * radV {u0,u1,u2,u3} /\ dist(u1,u3) <= &2 * radV {u0,u1,u2,u3} /\ dist(u2,u3) <= &2 * radV {u0,u1,u2,u3} `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; FIRST_ASSUM (ASSUME_TAC o (MATCH_MP NOT_COPLANAR_IMP_CARD4_ALT )); TYPIFY `!u v. ~(u= v) /\ {u,v} SUBSET {u0,u1,u2,u3} ==> dist(u,v) <= &2 * radV {u0,u1,u2,u3}` (C SUBGOAL_THEN ASSUME_TAC); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Leaf_cell.SET2_INSERT2 [`u`;`v`;`u0`;`u1`;`u2`;`u3`]; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC radius_le_circumradius; BY(ASM_MESON_TAC[]); FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); BY(REPLICATE_TAC 6 (TRY CONJ_TAC THEN TRY (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN TRY (SET_TAC[]))) ]);;
(* }}} *)
let MCELL4_DOMAIN = 
prove_by_refinement( `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f /\ cc_4 V u0 u1 f i ==> &2 * hminus <= dist(u0,u1) /\ dist(u0,u1) <= &2 * hplus /\ &2 <= dist(u0,f i) /\ dist(u0,f i) < &2 * sqrt(&2) /\ &2 <= dist(u0,f (SUC i)) /\ dist(u0,f (SUC i)) < &2 * sqrt(&2) /\ &2 <= dist(f i, f (SUC i)) /\ dist(f i,f (SUC i)) < &2 * sqrt(&2) /\ &2 <= dist(u1,f i) /\ dist(u1,f i) < &2 * sqrt(&2) /\ &2 <= dist(u1,f (SUC i)) /\ dist(u1,f (SUC i)) < &2 * sqrt(&2) /\ rad2_y (dist(u0,u1)) (dist(u0,f i)) (dist (u0, f(SUC i))) (dist(f i, f (SUC i))) (dist (u1,f (SUC i))) (dist (u1, f i)) < &2 /\ &0 < delta_y (dist(u0,u1)) (dist(u0,f i)) (dist (u0, f(SUC i))) (dist(f i, f (SUC i))) (dist (u1,f (SUC i))) (dist (u1, f i)) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC GDRQXLGv3 [`u0`;`u1`;`f i`;`f (SUC i)`]; ASM_REWRITE_TAC[LET_DEF;LET_END_DEF]; DISCH_TAC; INTRO_TAC coplanar_delta_y [`u0`;`u1`;`f i`;`f (SUC i)`]; ASM_REWRITE_TAC[]; DISCH_TAC; ASM_REWRITE_TAC[]; INTRO_TAC NOT_COPLANAR_NOT_COLLINEAR [`u0`;`f i`;`f (SUC i)`;`u1`]; ANTS_TAC; TYPIFY `{u0, f i, f (SUC i), u1} = {u0,u1,f i,f (SUC i)}` (C SUBGOAL_THEN SUBST1_TAC); BY(SET_TAC[]); BY(ASM_REWRITE_TAC[]); REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS]; DISCH_TAC; INTRO_TAC Packing3.BARV_SUBSET [`V`;`3`;`[u0;u1;f i;f (SUC i)]`]; ASM_REWRITE_TAC[set_of_list]; REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC MCELL4_CARD4 [`V`;`[u0;u1;f i;f (SUC i)]`]; ANTS_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN (ASSUME_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); TYPIFY `&2 <= dist(u0,u1) /\ &2 <= dist (u0,f i) /\ &2 <= dist(u0,f(SUC i)) /\ &2 <= dist(u1, f i) /\ &2 <= dist(u1,f(SUC i)) /\ &2 <= dist (f i, f (SUC i))` (C SUBGOAL_THEN ASSUME_TAC); TYPIFY `!u v. u IN V /\ v IN V /\ ~(u = v) ==> &2 <= dist(u,v)` ENOUGH_TO_SHOW_TAC; DISCH_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[IN]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `packing` MP_TAC; REWRITE_TAC[Sphere.packing]; DISCH_THEN MATCH_MP_TAC; BY(ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; TYPIFY `&2 * hminus <= dist (u0,u1) /\ dist (u0,u1) <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; BY(MESON_TAC[Sphere.critical_edge_y]); ASM_REWRITE_TAC[]; REWRITE_TAC[Sphere.rad2_y;Sphere.y_of_x]; FIRST_ASSUM (MP_TAC o (MATCH_MP radius_le_circumradius_all)); REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[arith `x * x = x pow 2`]; FIRST_X_ASSUM_ST `rad2_x` (SUBST1_TAC o GSYM); TYPIFY `radV {u0,u1,f i,f (SUC i)} < sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `hl` MP_TAC; BY(REWRITE_TAC[Pack_defs.HL;set_of_list]); TYPED_ABBREV_TAC `r = radV {u0,u1,f i,f (SUC i)}` ; TYPIFY `!x. x <= &2 * r /\ r < sqrt(&2) ==> x < &2 * sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); BY(REAL_ARITH_TAC); ASM_SIMP_TAC[]; REWRITE_TAC[GSYM Nonlin_def.sqrt2_sqrt2;GSYM Sphere.sqrt2;arith `x * x = x pow 2`]; GMATCH_SIMP_TAC (GSYM Collect_geom2.LT_POW2_COND); ASM_REWRITE_TAC[Sphere.sqrt2]; GMATCH_SIMP_TAC SQRT_POS_LE; FIRST_X_ASSUM_ST `dist(u0,u1) <= &2 * r` MP_TAC; BY(MESON_TAC[arith `&0 <= d /\ d <= &2 * r ==> &0 <= r`;arith `&0 <= &2`;DIST_POS_LE]) ]);;
(* }}} *)
let real_model_azim_c4 = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. cc_4 V u0 u1 f i ==> azim_mcell V f u0 u1 i < #2.8)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC c_4_azim_mcell_dih_y [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; DISCH_THEN SUBST1_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "BIXPCGW 6652007036 a2") []; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; DISCH_THEN MATCH_MP_TAC; REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) ]);;
(* }}} *) (* renamed from gammaX_gamm4fgcy_ALT *)
let gammaX_gamma4fgcy_ALT = 
prove_by_refinement( `!V X u0 u1 u2 u3. saturated V /\ packing V /\ barV V 3 [u0;u1;u2;u3] /\ X = mcell4 V [u0;u1;u2;u3] /\ ~NULLSET X ==> gammaX V X lmfun = gamma4fgcy (dist(u0,u1)) (dist(u0,u2)) (dist(u0,u3)) (dist(u2,u3)) (dist(u1,u3)) (dist(u1,u2)) lmfun`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; BY(ASM_MESON_TAC[arith `4 >= 4`;Bump.MCELL4;Tskajxy_lemmas.gammaX_gamm4fgcy]) ]);;
(* }}} *)
let GG_MCELL_QUARTER = 
prove_by_refinement( `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ cc_4 V u0 u1 f i /\ (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus /\ leaf_rank V [u0; u1] w0 n f ==> gg_mcell V f u0 u1 i = gamma4fgcy (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist (f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i)) lmfun`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC cc_4_cc_cell; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC gammaX_gamma4fgcy_ALT; GEXISTL_TAC [`u0`;`f (SUC i)`;`u1`;`f i`]; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC critical_weight_wtcount6_y; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC CC_4_BETA_BUMP_0; CONJ_TAC; GEXISTL_TAC [`w0`;`n`]; ASM_REWRITE_TAC[Sphere.critical_edge_y]; BY(ASM_MESON_TAC[arith `d < t ==> ~(t <= d)`]); TYPIFY `(wtcount6_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist (f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i))) = 1` (C SUBGOAL_THEN SUBST1_TAC); ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; ASM_REWRITE_TAC[arith `x <= y <=> ~(y < x)`;Sphere.critical_edge_y]; BY(ARITH_TAC); BY(REAL_ARITH_TAC) ]);;
(* }}} *)
let GG_MCELL_BETA = 
prove_by_refinement( `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ cc_4 V u0 u1 f i /\ (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ critical_edge_y (dist(f i, f (SUC i))) /\ leaf_rank V [u0; u1] w0 n f ==> gg_mcell V f u0 u1 i = (gamma4fgcy (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist (f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i)) lmfun) / &2 + bump (dist (u0,u1) / &2) - bump (dist (f i,f (SUC i)) / &2) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC cc_4_cc_cell; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC gammaX_gamma4fgcy_ALT; GEXISTL_TAC [`u0`;`f (SUC i)`;`u1`;`f i`]; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC critical_weight_wtcount6_y; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC CC_4_BETA_BUMP_EXPLICIT; CONJ_TAC; GEXISTL_TAC [`w0`;`n`]; BY(ASM_REWRITE_TAC[]); TYPIFY `(wtcount6_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist (f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i))) = 2` (C SUBGOAL_THEN SUBST1_TAC); ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; ASM_REWRITE_TAC[arith `x <= y <=> ~(y < x)`;Sphere.critical_edge_y]; BY(ARITH_TAC); BY(REAL_ARITH_TAC) ]);;
(* }}} *)
let beta_bumpA_y_NONBETA = 
prove_by_refinement( `!y1 y2 y3 y4 y5 y6. ~(critical_edge_y y1 /\ critical_edge_y y4 /\ y2 < &2 * hminus /\ y3 < &2 * hminus /\ y5 < &2 * hminus /\ y6 < &2 * hminus) ==> beta_bumpA_y y1 y2 y3 y4 y5 y6 = &0`,
(* {{{ proof *) [ REWRITE_TAC[Sphere.beta_bumpA_y]; REWRITE_TAC[Sphere.beta_bumpA_y;DE_MORGAN_THM]; REPEAT WEAKER_STRIP_TAC; BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC THEN ASM_REWRITE_TAC[] THEN TRY REAL_ARITH_TAC)) ]);;
(* }}} *)
let GG_MCELL_NONBETA = 
prove_by_refinement( `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ cc_4 V u0 u1 f i /\ ~((dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ critical_edge_y (dist(f i, f (SUC i)))) /\ leaf_rank V [u0; u1] w0 n f ==> gg_mcell V f u0 u1 i = (gamma4fgcy (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist (f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i)) lmfun) / &(wtcount6_y (dist(u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist (f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i))) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC cc_4_cc_cell; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC gammaX_gamma4fgcy_ALT; GEXISTL_TAC [`u0`;`f (SUC i)`;`u1`;`f i`]; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC critical_weight_wtcount6_y; CONJ_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[arith `g * &1/ w + b = g / w <=> b = &0`]; GMATCH_SIMP_TAC CC_4_BETA_BUMP_0; GEXISTL_TAC [`w0`;`n`]; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `/\` MP_TAC; BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *)
let GG_MCELL_GENERAL = 
prove_by_refinement( `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ cc_4 V u0 u1 f i /\ leaf_rank V [u0; u1] w0 n f ==> gg_mcell V f u0 u1 i = gamma4fgcy (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist (f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i)) lmfun / &(wtcount6_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist (f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i))) + beta_bumpA_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist (f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC cc_4_cc_cell; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC gammaX_gamma4fgcy_ALT; GEXISTL_TAC [`u0`;`f (SUC i)`;`u1`;`f i`]; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC critical_weight_wtcount6_y; CONJ_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[arith `x * &1 / w = x / w`;arith `g + b = g + b' <=> b = b'`]; REWRITE_TAC[Sphere.beta_bumpA_y]; TYPIFY`critical_edge_y (dist (u0,u1)) /\ (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ critical_edge_y (dist(f i, f (SUC i)))` ASM_CASES_TAC; ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `mcell4` (SUBST1_TAC o GSYM); GMATCH_SIMP_TAC CC_4_BETA_BUMP_EXPLICIT; CONJ_TAC; GEXISTL_TAC [`w0`;`n`]; BY(ASM_REWRITE_TAC[]); BY(REAL_ARITH_TAC); ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `mcell4` (SUBST1_TAC o GSYM); GMATCH_SIMP_TAC CC_4_BETA_BUMP_0; CONJ_TAC; GEXISTL_TAC [`w0`;`n`]; ASM_REWRITE_TAC[Sphere.critical_edge_y]; BY(ASM_MESON_TAC[Sphere.critical_edge_y;arith `d < t ==> ~(t <= d)`]); FIRST_X_ASSUM (ASSUME_TAC o (REWRITE_RULE[DE_MORGAN_THM;Sphere.critical_edge_y])); FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; REWRITE_TAC[Sphere.critical_edge_y]; BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC THEN ASM_REWRITE_TAC[] THEN TRY REAL_ARITH_TAC)) ]);;
(* }}} *)
let real_model_gamma_qu = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. cc_4 V u0 u1 f i /\ (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus ==> -- #0.0057 <= gg_mcell V f u0 u1 i) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[Oxl_def.cc_eps]; MATCH_MP_TAC (arith `y > -- #0.00569 ==> -- #0.0057 <= y`); INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "BIXPCGW 9455898160") []; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; GMATCH_SIMP_TAC GG_MCELL_QUARTER; CONJ_TAC; BY(ASM_MESON_TAC[]); DISCH_THEN MATCH_MP_TAC; ASM_REWRITE_TAC[]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) ]);;
(* }}} *)
let ETA_Y_POS_LE_ALT = 
prove_by_refinement( `!u0 u1 (u2:real^3). &0 <= eta_y (dist (u0,u1)) (dist (u0,u2)) (dist (u1,u2)) `,
(* {{{ proof *) [ BY(MESON_TAC[Collect_geom2.ETA_Y_POS_LE;Geomdetail.dist3]) ]);;
(* }}} *)
let ETA_Y_LEMMA = 
prove_by_refinement( `!u0 u1 (u2:real^3) r. ~collinear {u0,u1,u2} /\ &0 < r /\ r <= hl[u0;u1;u2] ==> r pow 2 <= eta_y (dist (u0,u1)) (dist (u0,u2)) (dist (u1,u2)) pow 2 `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC (GSYM Collect_geom.POW2_COND_LT); MATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`); SUBCONJ_TAC; GMATCH_SIMP_TAC (GSYM RADV_ETAY); ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `hl` MP_TAC; BY(REWRITE_TAC[Pack_defs.HL;set_of_list]); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) ]);;
(* }}} *)
let ETA_Y_LEMMA_ALT = 
prove_by_refinement( `!u0 u1 (u2:real^3) r. ~collinear {u0,u1,u2} /\ hl[u0;u1;u2] <= r ==> eta_y (dist (u0,u1)) (dist (u0,u2)) (dist (u1,u2)) pow 2 <= r pow 2`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC (GSYM Collect_geom.POW2_COND); MATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`); SUBCONJ_TAC; GMATCH_SIMP_TAC (GSYM RADV_ETAY); ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `hl` MP_TAC; BY(REWRITE_TAC[Pack_defs.HL;set_of_list]); DISCH_TAC; SUBCONJ_TAC; BY(ASM_REWRITE_TAC[ETA_Y_POS_LE_ALT]); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) ]);;
(* }}} *)
let real_model_fhbv2  = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. (cc_4 V u0 u1 f i /\ (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus) /\ ~(hl [u0; u1; f (SUC i)] < #1.34) ==> #0.0057 <= gg_mcell V f u0 u1 i) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC (arith `y > #0.0057 ==> #0.0057 <= y`); INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "FHBVYXZv2 a") []; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; REWRITE_TAC[GSYM Sphere.rad2_y]; ONCE_REWRITE_TAC[TAUT `(r ==> a \/ b \/ c) <=> ((r /\ ~b /\ ~c) ==> a)`]; GMATCH_SIMP_TAC GG_MCELL_QUARTER; CONJ_TAC; BY(ASM_MESON_TAC[]); DISCH_THEN MATCH_MP_TAC; ASM_REWRITE_TAC[]; (ASM_SIMP_TAC[arith `x < y ==> x <= y`]); CONJ_TAC; MATCH_MP_TAC (arith `r < &2 ==> ~( r > &2)`); BY(ASM_REWRITE_TAC[]); REWRITE_TAC[arith `~(x < y ) <=> y <= x`]; MATCH_MP_TAC ETA_Y_LEMMA; INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `#1.34` MP_TAC; BY(REAL_ARITH_TAC) ]);;
(* }}} *)
let real_model_fhbv2_sym  = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. (cc_4 V u0 u1 f i /\ (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus) /\ ~(hl [u0; u1; f i] < #1.34) ==> #0.0057 <= gg_mcell V f u0 u1 i)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC (arith `y > #0.0057 ==> #0.0057 <= y`); INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "FHBVYXZv2 a") []; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; REWRITE_TAC[GSYM Sphere.rad2_y]; ONCE_REWRITE_TAC[TAUT `(r ==> a \/ b \/ c) <=> ((r /\ ~b /\ ~c) ==> a)`]; GMATCH_SIMP_TAC GG_MCELL_QUARTER; CONJ_TAC; BY(ASM_MESON_TAC[]); DISCH_TAC; ONCE_REWRITE_TAC[Merge_ineq.gamma4fgcy_sym23]; FIRST_X_ASSUM MATCH_MP_TAC; ASM_REWRITE_TAC[]; (ASM_SIMP_TAC[arith `x < y ==> x <= y`]); CONJ_TAC; MATCH_MP_TAC (arith `r < &2 ==> ~( r > &2)`); FIRST_X_ASSUM_ST `rad2_y` MP_TAC; BY(MESON_TAC[Merge_ineq.rad2_y_sym]); REWRITE_TAC[arith `~(x < y ) <=> y <= x`]; MATCH_MP_TAC ETA_Y_LEMMA; INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `#1.34` MP_TAC; BY(REAL_ARITH_TAC) ]);;
(* }}} *)
let CC_3_PROPS = 
prove_by_refinement( `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ packing V /\ saturated V /\ leaf_rank V [u0;u1] w0 n f /\ ~collinear {u0,u1,w0} /\ critical_edge_y (dist(u0,u1)) /\ s_leaf V [u0;u1] HAS_SIZE n /\ 1 < n /\ ~cc_4 V u0 u1 f i ==> cc_ke V [u0; u1; f i] = 3 /\ barV V 3 (cc_uh V ([u0;u1;f i])) /\ barV V 3 (cc_uh V ([u1;u0;f (SUC i)])) /\ beta_bump_v1 V {u0,u1} (cc_cell V [u0;u1;f i]) = &0 /\ beta_bump_v1 V {u0,u1} (cc_cell V [u1;u0;f (SUC i)]) = &0 /\ cc_ke V [u1;u0;f (SUC i)] = 3 /\ cc_cell V [u0;u1;f i] SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ cc_cell V [u1;u0;f(SUC i)] SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ ~(cc_cell V [u0;u1;f i] = cc_cell V [u1;u0;f (SUC i)]) /\ cc_cell V [u0; u1; f i] SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ ~collinear {u0,u1,f i} /\ ~collinear {u0,u1,f (SUC i)} /\ hl [u0;u1;f i] < sqrt(&2) /\ hl [u0;u1; f(SUC i)] < sqrt(&2) /\ hl [u1;u0; f(SUC i)] < sqrt(&2) /\ leaf V [u0; u1; f i] /\ leaf V [u0; u1; f (SUC i)] /\ leaf V [u1; u0; f (SUC i)] /\ &2 <= dist(u0,u1) /\ &2 <= dist(u0,f i) /\ &2 <= dist(u0,f(SUC i)) /\ &2 <= dist(u1,f i) /\ &2 <= dist(u1,f(SUC i)) /\ dist(u0,u1) <= &2 * sqrt(&2) /\ dist(u0,f i) <= &2 * sqrt(&2) /\ dist(u0,f (SUC i)) <= &2 * sqrt(&2) /\ dist(u1,f i) <= &2 * sqrt(&2) /\ dist(u1,f (SUC i)) <= &2 * sqrt(&2) /\ eta_y (dist (u0,u1)) (dist(u0,f i)) (dist (u1,f i)) < sqrt(&2) /\ eta_y (dist (u0,u1)) (dist(u0,f (SUC i))) (dist (u1,f (SUC i))) < sqrt(&2) /\ ~NULLSET (cc_cell V [u0; u1; f i]) /\ ~NULLSET (cc_cell V [u1; u0; f (SUC i)]) /\ azim_mcell V f u0 u1 i = azim u0 u1 (f i) (f (SUC i)) /\ (?y4. &2 <= y4 /\ y4 <= &2 * sqrt (&2) /\ &0 < delta_y (dist(u0,u1)) (dist(u0,f i)) (dist(u0, f(SUC i))) y4 (dist(u1,f(SUC i))) (dist(u1,f i)) /\ dih_y (dist(u0,u1)) (dist(u0,f i)) (dist(u0, f(SUC i))) y4 (dist(u1,f(SUC i))) (dist(u1,f i)) <= azim u0 u1 (f i) (f (SUC i)) /\ &2 <= rad2_y (dist(u0,u1)) (dist(u0,f i)) (dist(u0, f(SUC i))) y4 (dist(u1,f(SUC i))) (dist(u1,f i)) /\ (azim u0 u1 (f i) (f (SUC i)) < pi /\ dist (f i,f (SUC i)) <= &2 * sqrt (&2) ==> y4 = dist (f i,f (SUC i)))) `,
(* {{{ proof *) [ REWRITE_TAC[cc_4]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC NO_4CELL_IMP_K3 [`V`;`wedge_ge u0 u1 (f i) (f (SUC i))`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; REWRITE_TAC[TAUT `a /\ b /\ c <=> (a /\ b) /\ c`]; CONJ2_TAC; REWRITE_TAC[TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; MATCH_MP_TAC WEDGE3_Y4; GEXISTL_TAC [`V`;`w0`;`n`]; BY(ASM_REWRITE_TAC[]); CONJ2_TAC; INTRO_TAC LEAF_RANK_REUHADY [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); TYPIFY `leaf V [u0;u1;f i] /\ leaf V [u0;u1;f (SUC i)]` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[ LEAF_RANK_LEAF]); TYPIFY ` s_leaf V [u0;u1] (f (SUC i) )` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC LEAF_RANK_S_LEAF; BY(ASM_MESON_TAC[]); TYPIFY `leaf V [u1;u0;f (SUC i)]` (C SUBGOAL_THEN ASSUME_TAC); INTRO_TAC s_leaf_leaf [`V`;`[u1;u0]`;`f(SUC i)`]; REWRITE_TAC[IN;Bump.EL_EXPLICIT]; DISCH_THEN MATCH_MP_TAC; BY(ASM_MESON_TAC[S_LEAF_SYM]); SUBCONJ2_TAC; BY(ASM_MESON_TAC[Leaf_cell.CC_CELL_NOT_NULLSET]); DISCH_TAC; SUBCONJ2_TAC; BY(ASM_MESON_TAC[Leaf_cell.CC_CELL_NOT_NULLSET]); ASM_REWRITE_TAC[]; INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;f i]`]; ASM_REWRITE_TAC[]; INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;f (SUC i)]`]; ASM_REWRITE_TAC[set_of_list]; REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]; INTRO_TAC LEAF_DOMAIN [`V`;`[u0;u1;f i]`]; INTRO_TAC LEAF_DOMAIN [`V`;`[u1;u0;f (SUC i)]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; CONJ2_TAC; REPEAT (FIRST_X_ASSUM_ST `eta_y` MP_TAC); BY(MESON_TAC[DIST_SYM;Collect_geom.ETA_Y_SYYM]); REWRITE_TAC[TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; SUBCONJ_TAC; BY(ASM_MESON_TAC[ Leaf_cell.cc_uh;IN]); DISCH_TAC; SUBCONJ_TAC; BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); DISCH_TAC; REPEAT (FIRST_X_ASSUM_ST `NULLSET` MP_TAC); ASM_REWRITE_TAC[Leaf_cell.cc_cell]; REPEAT WEAKER_STRIP_TAC; REPEAT (GMATCH_SIMP_TAC Bump.MCELL_BUMP_0); ASM_REWRITE_TAC[arith `3 < 4`]; REPEAT (FIRST_X_ASSUM_ST `leaf` MP_TAC); REWRITE_TAC[Leaf_cell.leaf]; BY(MESON_TAC[Sphere.sqrt2]) ]);;
(* }}} *)
let real_model_gckb  = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. #0.606 <= azim_mcell V f u0 u1 i)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC (arith `y > x ==> x <= y`); INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "GCKBQEA") []; REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; DISCH_TAC; TYPIFY `cc_4 V u0 u1 f i` ASM_CASES_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC c_4_azim_mcell_dih_y [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; DISCH_THEN SUBST1_TAC; FIRST_X_ASSUM MATCH_MP_TAC; ASM_REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `dih_y` MP_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC (arith `d > c ==> (d <= a ==> a > c)`); FIRST_X_ASSUM MATCH_MP_TAC; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; BY(MESON_TAC[Sphere.critical_edge_y]) ]);;
(* }}} *)
let real_model_sum_azim = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> sum {i | i < n} (azim_mcell V f u0 u1) = &2 * pi`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC LEAF_RANK_GRUTOTI [`V`;`[u0;u1]`;`w0`;`n`;`f`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN MATCH_MP_TAC; REWRITE_TAC[Marchal_cells_3.HL_2]; REWRITE_TAC[arith `inv(&2) * x < y <=> x < &2 * y`]; FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; REWRITE_TAC[Sphere.critical_edge_y]; TYPIFY `&0 < sqrt(&2) - hplus` ENOUGH_TO_SHOW_TAC; BY(REAL_ARITH_TAC); BY(REWRITE_TAC[Flyspeck_constants.bounds]) ]);;
(* }}} *)
let real_model_ox3q1h_merge = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (CARD (s_leaf V [u0; u1]) = 4 /\ (?i. cc_4 V u0 u1 f i /\ (&2 * hminus <= dist (f i,f (SUC i)) /\ dist (f i,f (SUC i)) <= &2 * hplus) /\ (cc_4 V u0 u1 f (SUC i) /\ (dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus) /\ dist (u0,f (SUC (SUC i))) < &2 * hminus /\ dist (u1,f (SUC (SUC i))) < &2 * hminus /\ dist (f (SUC i),f (SUC (SUC i))) < &2 * hminus) /\ (cc_4 V u0 u1 f (i + 2) /\ (dist (u0,f (i + 2)) < &2 * hminus /\ dist (u1,f (i + 2)) < &2 * hminus) /\ dist (u0,f (SUC (i + 2))) < &2 * hminus /\ dist (u1,f (SUC (i + 2))) < &2 * hminus /\ dist (f (i + 2),f (SUC (i + 2))) < &2 * hminus) /\ cc_4 V u0 u1 f (i + 3) /\ (dist (u0,f (i + 3)) < &2 * hminus /\ dist (u1,f (i + 3)) < &2 * hminus) /\ dist (u0,f (SUC (i + 3))) < &2 * hminus /\ dist (u1,f (SUC (i + 3))) < &2 * hminus /\ dist (f (i + 3),f (SUC (i + 3))) < &2 * hminus) ==> &0 <= sum {i | i < n} (gg_mcell V f u0 u1)) `,
(* {{{ proof *) [ REWRITE_TAC[arith `i + 2 = SUC (i + 1) /\ i + 3 = SUC (i + 2) /\ i + 1 = SUC i`]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC real_model_sum_azim [`V`;`u0`;`u1`;`w0`;`n`;`f`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); TYPIFY `{i | i < n} = ( 0..n - 1)` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_MESON_TAC[NUMSEG_LT;arith `1 < n==> ~(n = 0)`;HAS_SIZE]); COMMENT "periodicity";
INTRO_TAC Oxl_def.periodic_sum [`gg_mcell V f u0 u1`;`n`]; ANTS_TAC; CONJ2_TAC; BY(ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`]); BY(ASM_MESON_TAC[real_periodic_data;LEAF_RANK_PERIODIC]); DISCH_THEN (C INTRO_TAC [`i`]); DISCH_THEN (SUBST1_TAC o GSYM); INTRO_TAC Oxl_def.periodic_sum [`azim_mcell V f u0 u1`;`n`]; ANTS_TAC; CONJ2_TAC; BY(ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`]); BY(ASM_MESON_TAC[real_periodic_data;LEAF_RANK_PERIODIC]); DISCH_THEN (C INTRO_TAC [`i`]); DISCH_THEN (SUBST1_TAC o GSYM); COMMENT "do sum"; TYPIFY `n = 4` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[HAS_SIZE]); ASM_REWRITE_TAC[arith `4 - 1 + i = SUC (SUC (SUC i))`]; REWRITE_TAC[SUM_SING_NUMSEG;SUM_CLAUSES_NUMSEG;arith `i <= SUC(SUC(SUC i)) /\ i <= SUC (SUC i) /\ i <= SUC i`]; REPEAT (FIRST_X_ASSUM_ST `SUC(SUC(SUC(SUC i)))` MP_TAC); ASM_REWRITE_TAC[arith `SUC(SUC(SUC (SUC i))) = i + 4`]; TYPIFY `f(i) = f (i+4)` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Oxl_def.periodic]); REPEAT WEAKER_STRIP_TAC; COMMENT "1st piece"; INTRO_TAC GG_MCELL_BETA [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[Sphere.critical_edge_y]); DISCH_THEN SUBST1_TAC; COMMENT "second piece"; INTRO_TAC GG_MCELL_QUARTER [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_THEN SUBST1_TAC; COMMENT "third piece"; INTRO_TAC GG_MCELL_QUARTER [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC(SUC i)`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_THEN SUBST1_TAC; COMMENT "fourth piece"; INTRO_TAC GG_MCELL_QUARTER [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC(SUC(SUC i))`]; ANTS_TAC; BY(ASM_REWRITE_TAC[arith `SUC(SUC(SUC(SUC i))) = i+4`]); DISCH_THEN SUBST1_TAC; MATCH_MP_TAC (arith `g > &0 ==> &0 <= g`); ASM_REWRITE_TAC[arith `SUC(SUC(SUC(SUC i))) = i+4`]; ONCE_REWRITE_TAC[arith `((a + b) +c) + d = a + d + c + b`]; COMMENT "intro ineq"; INTRO_TAC Merge_ineq.ox3q1h_merge []; ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; TYPIFY `bump (dist (u0,u1) / &2) - bump (dist (f (i + 4),f (SUC i)) / &2) = beta_bump_force_y (dist (u0,u1)) (dist (u0,f (i + 4))) (dist (u0,f (SUC i))) (dist (f (i + 4),f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f (i + 4)))` (C SUBGOAL_THEN SUBST1_TAC); BY(REWRITE_TAC[Sphere.beta_bump_force_y]); REWRITE_TAC[arith `(a+b)+c = a+b+c`]; DISCH_THEN MATCH_MP_TAC; ASM_SIMP_TAC[]; COMMENT "intro domain"; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC(SUC i)`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC(SUC(SUC i))`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; RULE_ASSUM_TAC (REWRITE_RULE[arith `SUC(SUC(SUC(SUC i))) = i+4`]); FIRST_X_ASSUM_ST `f i = f (i + 4)` (fun t -> (REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[GSYM t]) THEN ASSUME_TAC t); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[arith `x< y ==> x<= y`]; COMMENT "deal with angle sum"; FIRST_X_ASSUM_ST `azim_mcell` MP_TAC; REPEAT (GMATCH_SIMP_TAC c_4_azim_mcell_dih_y); ASM_REWRITE_TAC[]; SUBCONJ_TAC; BY(ASM_MESON_TAC[]); DISCH_TAC; ASM_REWRITE_TAC[arith `SUC(SUC(SUC(SUC i))) = i + 4`]; FIRST_X_ASSUM_ST `f i = f (i + 4)` ((unlist REWRITE_TAC) o GSYM); BY(REAL_ARITH_TAC) ]);; (* }}} *)
let mcell3_gammaX_gamma3f = 
prove_by_refinement( `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ packing V /\ saturated V /\ leaf_rank V [u0; u1] w0 n f /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ s_leaf V [u0; u1] HAS_SIZE n /\ 1 < n /\ ~cc_4 V u0 u1 f i ==> gammaX V (cc_cell V [u0;u1;f i]) lmfun = gamma3f (dist(u0,u1)) (dist(u0,f i)) (dist(u1,f i)) sqrt2 lmfun `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Tskajxy_lemmas.gammaX_gamma3f [`V`;`cc_cell V [u0;u1;f i]`;`cc_uh V [u0;u1;f i]`;`u0`;`u1`;`f i`;`EL 3 (cc_uh V [u0;u1;f i])`;`dist(u1,f i)`;`dist(u0,f i)`;`dist(u0,u1)`]; ANTS_TAC; ASM_REWRITE_TAC[]; TYPIFY ` [u0; u1; f i; EL 3 (cc_uh V [u0; u1; f i])] = cc_uh V [u0; u1; f i]` (C SUBGOAL_THEN ASSUME_TAC); GMATCH_SIMP_TAC Leaf_cell.LIST_OF_CC_UH; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell]); DISCH_THEN (unlist REWRITE_TAC); BY(MESON_TAC[Merge_ineq.gamma3f_sym]) ]);;
(* }}} *)
let mcell3_dihX_dih_y = 
prove_by_refinement( `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ packing V /\ saturated V /\ leaf_rank V [u0; u1] w0 n f /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ s_leaf V [u0; u1] HAS_SIZE n /\ 1 < n /\ ~cc_4 V u0 u1 f i ==> dihX V (cc_cell V [u0;u1;f i]) (u0,u1) = dih_y (dist(u0,u1)) (dist(u0,f i)) sqrt2 sqrt2 sqrt2 (dist(u1,f i)) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Tskajxy_lemmas.gammaX_gamma3f [`V`;`cc_cell V [u0;u1;f i]`;`cc_uh V [u0;u1;f i]`;`u0`;`u1`;`f i`;`EL 3 (cc_uh V [u0;u1;f i])`;`dist(u1,f i)`;`dist(u0,f i)`;`dist(u0,u1)`]; ANTS_TAC; ASM_REWRITE_TAC[]; TYPIFY ` [u0; u1; f i; EL 3 (cc_uh V [u0; u1; f i])] = cc_uh V [u0; u1; f i]` (C SUBGOAL_THEN ASSUME_TAC); GMATCH_SIMP_TAC Leaf_cell.LIST_OF_CC_UH; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell]); DISCH_THEN (unlist REWRITE_TAC); BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]) ]);;
(* }}} *)
let mcell3_gammaXb_gamma3f = 
prove_by_refinement( `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ packing V /\ saturated V /\ leaf_rank V [u0; u1] w0 n f /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ s_leaf V [u0; u1] HAS_SIZE n /\ 1 < n /\ ~cc_4 V u0 u1 f i ==> gammaX V (cc_cell V [u1;u0;f (SUC i)]) lmfun = gamma3f (dist(u0,u1)) (dist(u0,f (SUC i))) (dist(u1,f (SUC i))) sqrt2 lmfun `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Tskajxy_lemmas.gammaX_gamma3f [`V`;`cc_cell V [u1;u0;f (SUC i)]`;`cc_uh V [u1;u0;f (SUC i)]`;`u1`;`u0`;`f (SUC i)`;`EL 3 (cc_uh V [u1;u0;f (SUC i)])`;`dist(u0,f (SUC i))`;`dist(u1,f (SUC i))`;`dist(u0,u1)`]; ANTS_TAC; ASM_REWRITE_TAC[]; TYPIFY ` [u1; u0; f (SUC i); EL 3 (cc_uh V [u1; u0; f (SUC i)])] = cc_uh V [u1; u0; f (SUC i)]` (C SUBGOAL_THEN ASSUME_TAC); GMATCH_SIMP_TAC Leaf_cell.LIST_OF_CC_UH; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); CONJ_TAC; BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell]); ASM_REWRITE_TAC[]; BY(MESON_TAC[DIST_SYM]); DISCH_THEN (unlist REWRITE_TAC); BY(MESON_TAC[Merge_ineq.gamma3f_sym]) ]);;
(* }}} *)
let mcell3_dihXb_dih_y = 
prove_by_refinement( `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ packing V /\ saturated V /\ leaf_rank V [u0; u1] w0 n f /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ s_leaf V [u0; u1] HAS_SIZE n /\ 1 < n /\ ~cc_4 V u0 u1 f i ==> dihX V (cc_cell V [u1;u0;f (SUC i)]) (u0,u1) = dih_y (dist(u0,u1)) (dist(u0,f (SUC i))) sqrt2 sqrt2 sqrt2 (dist(u1,f (SUC i))) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Tskajxy_lemmas.gammaX_gamma3f [`V`;`cc_cell V [u1;u0;f (SUC i)]`;`cc_uh V [u1;u0;f (SUC i)]`;`u1`;`u0`;`f (SUC i)`;`EL 3 (cc_uh V [u1;u0;f (SUC i)])`;`dist(u0,f (SUC i))`;`dist(u1,f (SUC i))`;`dist(u0,u1)`]; ANTS_TAC; ASM_REWRITE_TAC[]; TYPIFY ` [u1; u0; f (SUC i); EL 3 (cc_uh V [u1; u0; f (SUC i)])] = cc_uh V [u1; u0; f (SUC i)]` (C SUBGOAL_THEN ASSUME_TAC); GMATCH_SIMP_TAC Leaf_cell.LIST_OF_CC_UH; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); CONJ_TAC; BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell]); ASM_REWRITE_TAC[]; BY(MESON_TAC[DIST_SYM]); REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC Marchal_cells_3.DIHX_SYM; ASM_REWRITE_TAC[]; CONJ_TAC; ONCE_REWRITE_TAC[GSYM IN]; MATCH_MP_TAC Leaf_cell.CC_CELL_IN_MCELL_SET; BY(ASM_REWRITE_TAC[]); INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u1;u0;f (SUC i)]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; TYPIFY `{u0,u1} = {u1,u0}` (C SUBGOAL_THEN SUBST1_TAC); BY(SET_TAC[]); BY(REWRITE_TAC[]) ]);;
(* }}} *) (* Moved to Merge_ineq let cell3_from_ineq_thm_ALT = prove_by_refinement( `pack_nonlinear_non_ox3q1h ==> (!y4 y5 y6. &2 <= y4 /\ &2 <= y5 /\ &2 <= y6 /\ y4 <= &2 * sqrt (&2) /\ y5 <= &2 * sqrt (&2) /\ y6 <= &2 * sqrt (&2) /\ eta_y y4 y5 y6 < sqrt (&2) ==> &0 <= gamma3f y4 y5 y6 sqrt2 lmfun) `, (* {{{ proof *) [ DISCH_TAC; INTRO_TAC Merge_ineq.cell3_from_ineq_thm []; ANTS_TAC; BY((REWRITE_TAC (map Merge_ineq.get_pack_nonlinear_non_ox3q1h ["QZECFIC wt0";"QZECFIC wt0 corner";"QZECFIC wt0 sqrt8";"QZECFIC wt1";"QZECFIC wt2 A";"CIHTIUM";"CJFZZDW";]))); BY(REWRITE_TAC[]) ]);; (* }}} *) *)
let MCELL3_EDGE_EXPLICIT = 
prove_by_refinement( `!V u0 u1 u2 u3. packing V /\ saturated V /\ ~NULLSET (mcell3 V [u0; u1; u2; u3]) /\ barV V 3 [u0; u1; u2; u3] ==> edgeX V (mcell3 V [u0; u1; u2; u3]) = {{u0, u1}, {u0, u2}, {u1, u2}}`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[EXTENSION]; GEN_TAC; TYPIFY `~(?u v. x = {u,v})` ASM_CASES_TAC; REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(ASM_MESON_TAC[EDGEX_PAIR]); FIRST_X_ASSUM MP_TAC; REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; INTRO_TAC Bump.MCELL3_EDGE [`V`;`[u0;u1;u2;u3]`;`u`;`v`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_THEN SUBST1_TAC; REWRITE_TAC[set_of_list]; INTRO_TAC MCELL3_EXTREME_CARD [`V`;`[u0;u1;u2;u3]`]; ANTS_TAC; BY(ASM_MESON_TAC[IN]); ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN (MP_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); REWRITE_TAC[Basics.TRUNCATE_SIMPLEX_EXPLICIT;set_of_list]; REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; REWRITE_TAC[IN_INSERT;SUBSET;NOT_IN_EMPTY]; TYPIFY `(u = u0)` ASM_CASES_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[]); TYPIFY `(u = u1)` ASM_CASES_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[]); TYPIFY `(u = u2)` ASM_CASES_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[]); ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let critical_weight1 = 
prove_by_refinement( `!V u0 u1 u2. critical_edge_y (dist(u0,u1)) /\ dist(u0,u2) < &2 * hminus /\ dist(u1,u2) < &2 * hminus /\ cc_ke V [u0;u1;u2] = 3 /\ packing V /\ saturated V /\ barV V 3 (cc_uh V [u0;u1;u2]) /\ leaf V [u0;u1;u2] /\ ~(NULLSET (cc_cell V [u0;u1;u2])) ==> critical_weight V (cc_cell V [u0;u1;u2]) = &1`,
(* {{{ proof *) [ REWRITE_TAC[Pack_defs.critical_weight]; REPEAT WEAKER_STRIP_TAC; TYPIFY `CARD (critical_edgeX V (cc_cell V [u0; u1; u2])) = 1` ENOUGH_TO_SHOW_TAC; DISCH_THEN SUBST1_TAC; BY(REAL_ARITH_TAC); MATCH_MP_TAC Misc_defs_and_lemmas.CARD_SING; REWRITE_TAC[SING]; TYPIFY `{u0,u1}` EXISTS_TAC; ONCE_REWRITE_TAC[EXTENSION]; REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; GEN_TAC; PROOF_BY_CONTR_TAC; TYPIFY `~(?u v. x = {u,v})` ENOUGH_TO_SHOW_TAC; DISCH_TAC; FIRST_X_ASSUM_ST `IN` MP_TAC; ASM_REWRITE_TAC[Pack_defs.critical_edgeX;IN_ELIM_THM]; BY(ASM_MESON_TAC[]); DISCH_THEN MP_TAC THEN STRIP_TAC; FIRST_X_ASSUM_ST `IN` MP_TAC; ASM_REWRITE_TAC[critical_edgeX_critical_edge_y]; TYPIFY `cc_cell V [u0;u1;u2] = mcell3 V (cc_uh V [u0;u1;u2])` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Leaf_cell.cc_cell;GSYM Bump.MCELL3]); ASM_REWRITE_TAC[]; INTRO_TAC Leaf_cell.LIST_OF_CC_UH [`V`;`[u0;u1;u2]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_TAC; ONCE_ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC MCELL3_EDGE_EXPLICIT; CONJ_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; TYPIFY `{u,v} = {u0,u1}` ASM_CASES_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[Geomdetail.DIST_PAIR_LEMMA]); REWRITE_TAC[Sphere.critical_edge_y]; REWRITE_TAC[arith `x <= d <=> ~(d < x)`]; TYPIFY `{u,v} = {u0,u2}` ASM_CASES_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[Geomdetail.DIST_PAIR_LEMMA]); TYPIFY `{u,v} = {u1,u2}` ASM_CASES_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[Geomdetail.DIST_PAIR_LEMMA]); BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *)
let critical_weight1a = 
prove_by_refinement( `!V u0 u1 w0 n f i . pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f /\ ~cc_4 V u0 u1 f (i) /\ dist(u0,f i) < &2 * hminus /\ dist(u1,f i) < &2 * hminus ==> critical_weight V (cc_cell V [u0; u1; f (i)]) = &1`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC critical_weight1 [`V`;`u0`;`u1`;`f i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); BY(DISCH_THEN (unlist REWRITE_TAC)) ]);;
(* }}} *)
let critical_weight1b = 
prove_by_refinement( `!V u0 u1 w0 n f i . pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f /\ ~cc_4 V u0 u1 f (i) /\ dist(u0,f (SUC i)) < &2 * hminus /\ dist(u1,f (SUC i)) < &2 * hminus ==> critical_weight V (cc_cell V [u1; u0; f (SUC i)]) = &1`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC critical_weight1 [`V`;`u1`;`u0`;`f (SUC i)`]; ANTS_TAC; (ASM_REWRITE_TAC[]); ONCE_REWRITE_TAC[DIST_SYM]; BY(ASM_REWRITE_TAC[]); BY(DISCH_THEN (unlist REWRITE_TAC)) ]);;
(* }}} *)
let real_model_quqy = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. (cc_4 V u0 u1 f i /\ (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus) /\ ~cc_4 V u0 u1 f (SUC i) ==> &0 <= gg_mcell V f u0 u1 i + gammaX V (cc_cell V [u0; u1; f (SUC i)]) lmfun * critical_weight V (cc_cell V [u0; u1; f (SUC i)]) )`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC critical_weight1a; CONJ_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[arith `x * &1 = x`]; INTRO_TAC mcell3_gammaX_gamma3f [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; ASM_REWRITE_TAC[]; DISCH_THEN SUBST1_TAC; INTRO_TAC GG_MCELL_QUARTER [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; DISCH_THEN SUBST1_TAC; MP_TAC (Merge_ineq.g_quqya_g_quqyb_ALT); ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; DISCH_TAC; ONCE_REWRITE_TAC[Merge_ineq.gamma4fgcy_sym23]; FIRST_X_ASSUM MATCH_MP_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; FIRST_X_ASSUM_ST `rad2_y` MP_TAC; BY(MESON_TAC[Merge_ineq.rad2_y_sym]) ]);;
(* }}} *) (* let real_model_quqy = prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. (cc_4 V u0 u1 f i /\ (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus) /\ ~cc_4 V u0 u1 f (SUC i) ==> &0 <= gg_mcell V f u0 u1 i + gammaX V (cc_cell V [u0; u1; f (SUC i)]) lmfun)`, (* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC mcell3_gammaX_gamma3f [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; ASM_REWRITE_TAC[]; DISCH_THEN SUBST1_TAC; INTRO_TAC GG_MCELL_QUARTER [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; DISCH_THEN SUBST1_TAC; MP_TAC (Merge_ineq.g_quqya_g_quqyb_ALT); ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; DISCH_TAC; ONCE_REWRITE_TAC[Merge_ineq.gamma4fgcy_sym23]; FIRST_X_ASSUM MATCH_MP_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; FIRST_X_ASSUM_ST `rad2_y` MP_TAC; BY(MESON_TAC[Merge_ineq.rad2_y_sym]) ]);; (* }}} *) *)
let real_model_quqy_sym = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. (cc_4 V u0 u1 f (SUC i) /\ (dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus) /\ dist (u0,f (SUC (SUC i))) < &2 * hminus /\ dist (u1,f (SUC (SUC i))) < &2 * hminus /\ dist (f (SUC i),f (SUC (SUC i))) < &2 * hminus) /\ ~cc_4 V u0 u1 f i ==> &0 <= gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * critical_weight V (cc_cell V [u1; u0; f (SUC i)]) + gg_mcell V f u0 u1 (SUC i))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC critical_weight1b; CONJ_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[arith `x * &1 = x`]; INTRO_TAC mcell3_gammaXb_gamma3f [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; DISCH_THEN SUBST1_TAC; INTRO_TAC GG_MCELL_QUARTER [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; ASM_REWRITE_TAC[]; DISCH_THEN SUBST1_TAC; ONCE_REWRITE_TAC[arith `a + b = b + a`]; MP_TAC (Merge_ineq.g_quqya_g_quqyb_ALT); ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; DISCH_THEN MATCH_MP_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) ]);;
(* }}} *) (* let real_model_quqy_sym = prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. (cc_4 V u0 u1 f (SUC i) /\ (dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus) /\ dist (u0,f (SUC (SUC i))) < &2 * hminus /\ dist (u1,f (SUC (SUC i))) < &2 * hminus /\ dist (f (SUC i),f (SUC (SUC i))) < &2 * hminus) /\ ~cc_4 V u0 u1 f i ==> &0 <= gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun + gg_mcell V f u0 u1 (SUC i))`, (* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC mcell3_gammaXb_gamma3f [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[]; DISCH_THEN SUBST1_TAC; INTRO_TAC GG_MCELL_QUARTER [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; ASM_REWRITE_TAC[]; DISCH_THEN SUBST1_TAC; ONCE_REWRITE_TAC[arith `a + b = b + a`]; MP_TAC (Merge_ineq.g_quqya_g_quqyb_ALT); ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; DISCH_THEN MATCH_MP_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) ]);; (* }}} *) *)
let real_model_ztg4 = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. cc_4 V u0 u1 f i ==> a_spine5 + b_spine5 * azim_mcell V f u0 u1 i <= gg_mcell V f u0 u1 i)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC GG_MCELL_GENERAL; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC c_4_azim_mcell_dih_y; CONJ_TAC; BY(ASM_MESON_TAC[]); MATCH_MP_TAC (arith `g > a ==> a <= g`); INTRO_TAC Merge_ineq.ztg4_ALT []; ASM_REWRITE_TAC[]; ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; DISCH_THEN MATCH_MP_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) ]);;
(* }}} *)
let real_model_azim1 = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. cc_4 V u0 u1 f i /\ (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus ==> -- #0.0659 + #0.042 * azim_mcell V f u0 u1 i <= gg_mcell V f u0 u1 i) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC GG_MCELL_QUARTER; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC c_4_azim_mcell_dih_y; CONJ_TAC; BY(ASM_MESON_TAC[]); MATCH_MP_TAC (arith `g +c - d > &0 ==> --c +d <= g`); MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "QITNPEA 5653753305"); ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`;arith `#0.0 = &0`]; DISCH_THEN MATCH_MP_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) ]);;
(* }}} *)
let real_model_gaz4 = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. cc_4 V u0 u1 f i /\ (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus ==> -- #0.0142852 + #0.00609451 * azim_mcell V f u0 u1 i <= gg_mcell V f u0 u1 i)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC GG_MCELL_QUARTER; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC c_4_azim_mcell_dih_y; CONJ_TAC; BY(ASM_MESON_TAC[]); MATCH_MP_TAC (arith `g +c - d > #0.0 ==> --c +d <= g`); MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "QITNPEA 6206775865"); ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; DISCH_THEN MATCH_MP_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2;arith `#2 = &2`]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) ]);;
(* }}} *)
let real_model_gaz6 = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. cc_4 V u0 u1 f i /\ (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus ==> #0.161517 - #0.119482 * azim_mcell V f u0 u1 i <= gg_mcell V f u0 u1 i) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC GG_MCELL_QUARTER; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC c_4_azim_mcell_dih_y; CONJ_TAC; BY(ASM_MESON_TAC[]); MATCH_MP_TAC (arith `g - c + d > #0.0 ==> c - d <= g`); MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "QITNPEA 3848804089"); ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; DISCH_THEN MATCH_MP_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2;arith `#2 = &2`]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) ]);;
(* }}} *)
let real_model_gamma_qx = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. cc_4 V u0 u1 f i /\ ~(dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus) ==> #0.0 <= gg_mcell V f u0 u1 i)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC GG_MCELL_GENERAL; CONJ_TAC; BY(ASM_MESON_TAC[]); MATCH_MP_TAC (arith `&0 < x ==> #0.0 <= x`); MP_TAC Merge_ineq.gamma_qx_ALT; ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; DISCH_THEN MATCH_MP_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2;arith `#2 = &2`]; (ASM_SIMP_TAC[arith `x < y ==> x <= y`]); BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let real_model_g_qxd = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. (cc_4 V u0 u1 f i /\ ~(dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus)) /\ #2.3 < azim_mcell V f u0 u1 i ==> #0.0057 <= gg_mcell V f u0 u1 i) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC GG_MCELL_GENERAL; CONJ_TAC; BY(ASM_MESON_TAC[]); MATCH_MP_TAC (arith `y < x ==> y <= x`); MP_TAC Merge_ineq.g_qxd_ALT; ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; DISCH_THEN MATCH_MP_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2;arith `#2 = &2`]; (ASM_SIMP_TAC[arith `x < y ==> x <= y`]); FIRST_X_ASSUM_ST `azim_mcell` MP_TAC; MATCH_MP_TAC (arith `a = d ==> (x < a ==> x < d)`); GMATCH_SIMP_TAC c_4_azim_mcell_dih_y; BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let wtcount6_y_sym23 = 
prove_by_refinement( `!y1 y2 y3 y4 y5 y6. wtcount6_y y1 y2 y3 y4 y5 y6 = wtcount6_y y1 y3 y2 y4 y6 y5 `,
(* {{{ proof *) [ REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; BY(ARITH_TAC) ]);;
(* }}} *)
let wtcount6_y_sym26 = 
prove_by_refinement( `!y1 y2 y3 y4 y5 y6. wtcount6_y y1 y2 y3 y4 y5 y6 = wtcount6_y y1 y6 y5 y4 y3 y2 `,
(* {{{ proof *) [ REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; BY(ARITH_TAC) ]);;
(* }}} *)
let beta_bumpA_y_sym23 = 
prove_by_refinement( `!y1 y2 y3 y4 y5 y6. beta_bumpA_y y1 y2 y3 y4 y5 y6 = beta_bumpA_y y1 y3 y2 y4 y6 y5 `,
(* {{{ proof *) [ REWRITE_TAC[Sphere.beta_bumpA_y;Sphere.beta_bumpA_y]; BY(REAL_ARITH_TAC) ]);;
(* }}} *)
let real_model_gamma10 = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. (cc_4 V u0 u1 f i /\ ~(dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus)) /\ ((dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus) /\ ~cc_4 V u0 u1 f (SUC i) ==> #0.0057 <= gg_mcell V f u0 u1 i + gammaX V (cc_cell V [u0; u1; f (SUC i)]) lmfun * critical_weight V (cc_cell V [u0; u1; f (SUC i)])) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC critical_weight1a; CONJ_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[arith `x * &1 = x`]; GMATCH_SIMP_TAC GG_MCELL_GENERAL; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC mcell3_gammaX_gamma3f; CONJ_TAC; BY(ASM_MESON_TAC[]); ONCE_REWRITE_TAC[Merge_ineq.gamma4fgcy_sym23]; ONCE_REWRITE_TAC[wtcount6_y_sym23]; ONCE_REWRITE_TAC[beta_bumpA_y_sym23]; MP_TAC Merge_ineq.gamma10_gamma11_ALT; ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`;arith `(a + b) + c = a + b + c`]; DISCH_THEN MATCH_MP_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2;arith `#2 = &2`]; (ASM_SIMP_TAC[arith `x < y ==> x <= y`]); CONJ2_TAC; BY(ASM_MESON_TAC[Merge_ineq.rad2_y_sym]); REPEAT (FIRST_X_ASSUM_ST `~` MP_TAC); ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC) ]);;
(* }}} *)
let real_model_gamma11 = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. (cc_4 V u0 u1 f (SUC i) /\ ~(dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (u0,f (SUC (SUC i))) < &2 * hminus /\ dist (u1,f (SUC (SUC i))) < &2 * hminus /\ dist (f (SUC i),f (SUC (SUC i))) < &2 * hminus)) /\ ((dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus) /\ dist (u0,f (SUC (SUC i))) < &2 * hminus /\ dist (u1,f (SUC (SUC i))) < &2 * hminus) /\ ~cc_4 V u0 u1 f i ==> #0.0057 <= gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * critical_weight V (cc_cell V [u1; u0; f (SUC i)]) + gg_mcell V f u0 u1 (SUC i)) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC critical_weight1b; CONJ_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[arith `x * &1 = x`]; GMATCH_SIMP_TAC GG_MCELL_GENERAL; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC mcell3_gammaXb_gamma3f; CONJ_TAC; BY(ASM_MESON_TAC[]); ONCE_REWRITE_TAC[arith `g3 + g4 + b = g4 + b + g3`]; MP_TAC Merge_ineq.gamma10_gamma11_ALT; ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`;arith `(a + b) + c = a + b + c`]; DISCH_THEN MATCH_MP_TAC; INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2;arith `#2 = &2`]; BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) ]);;
(* }}} *)
let leaf_CIHTIUM = 
prove_by_refinement( `!V u0 u1 u2. pack_nonlinear_non_ox3q1h /\ packing V /\ saturated V /\ leaf V [u0;u1;u2] /\ critical_edge_y (dist(u0,u1)) /\ (&2 * hminus <= dist(u0,u2)) /\ (&2 * hminus <= dist(u1,u2)) ==> F`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;u2]`]; ASM_REWRITE_TAC[set_of_list]; INTRO_TAC LEAF_DOMAIN [`V`;`[u0;u1;u2]`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; REPEAT (FIRST_X_ASSUM MP_TAC); REWRITE_TAC[Leaf_cell.leaf;Pack_defs.HL;set_of_list]; REPEAT WEAKER_STRIP_TAC; PROOF_BY_CONTR_TAC; MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "CIHTIUM"); ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; DISCH_TAC; FIRST_X_ASSUM_ST `sqrt2` MP_TAC; MATCH_MP_TAC (arith `s < r ==> (r < s ==> F)`); GMATCH_SIMP_TAC RADV_ETAY; ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC (GSYM Tactics_jordan.REAL_POW_2_LT); REWRITE_TAC[Nonlinear_lemma.sqrt2_nn;ETA_Y_POS_LE_ALT;Nonlin_def.sqrt2_sqrt2;arith `sqrt2 pow 2 = sqrt2 * sqrt2`]; REWRITE_TAC[arith `x < y <=> y > x`]; FIRST_X_ASSUM MATCH_MP_TAC; GEXISTL_TAC [`&1`;`&1`;`&1`]; ASM_REWRITE_TAC[REAL_LE_REFL]; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; BY(ASM_MESON_TAC[Sphere.critical_edge_y]) ]);;
(* }}} *)
let gamma4fgcy_sym26 = 
prove_by_refinement( `!y1 y2 y3 y4 y5 y6 f. gamma4fgcy y1 y2 y3 y4 y5 y6 f = gamma4fgcy y1 y6 y5 y4 y3 y2 f`,
(* {{{ proof *) [ BY(MESON_TAC[Merge_ineq.gamma4fgcy_sym03;Merge_ineq.gamma4fgcy_sym23;Merge_ineq.gamma4fgcy_sym12]) ]);;
(* }}} *)
let gamma4fgcy_POS = 
prove_by_refinement( `!y1 y2 y3 y4 y5 y6. pack_nonlinear_non_ox3q1h /\ rad2_y y1 y2 y3 y4 y5 y6 < &2 /\ critical_edge_y y1 /\ ~(y2 < &2 * hminus /\ y3 < &2 * hminus /\ y4 < &2 * hminus /\ y5 < &2 * hminus /\ y6 < &2 * hminus ) /\ &2 <= y2 /\ y2 <= sqrt8 /\ &2 <= y3 /\ y3 <= sqrt8 /\ &2 <= y4 /\ y4 <= sqrt8 /\ &2 <= y5 /\ y5 <= sqrt8 /\ &2 <= y6 /\ y6 <= sqrt8 ==> &0 < gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "GLFVCVK4 2477216213"); ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; REWRITE_TAC[TAUT `a ==> b \/ c \/ d <=> a /\ ~c /\ ~d ==> b`]; REWRITE_TAC[arith `g > &0 <=> &0 < g`]; DISCH_THEN MATCH_MP_TAC; ASM_REWRITE_TAC[]; REWRITE_TAC[GSYM Sphere.rad2_y]; SUBCONJ_TAC; BY(ASM_MESON_TAC[Sphere.critical_edge_y]); DISCH_TAC; CONJ2_TAC; BY(FIRST_X_ASSUM_ST `rad2_y` MP_TAC THEN REAL_ARITH_TAC); DISCH_THEN (MP_TAC o (MATCH_MP Merge_ineq.quarter_norm2hh)); BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *)
let real_model_gamma8 = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. (cc_4 V u0 u1 f i /\ ~(dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus)) /\ (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ ~(dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus) ==> #0.0057 <= gg_mcell V f u0 u1 i) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC GG_MCELL_NONBETA; CONJ_TAC; BY(ASM_MESON_TAC[]); MP_TAC Merge_ineq.QITNPEA4_9063653052_weak_ALT; ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; DISCH_TAC; MATCH_MP_TAC (arith `gw > c ==> c <= gw`); INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC leaf_CIHTIUM [`V`;`u0`;`u1`;`f (SUC i)`]; ASM_REWRITE_TAC[]; REWRITE_TAC[DE_MORGAN_THM ;arith `~(x <= y) <=> y < x`]; COMMENT "case split";
DISCH_THEN DISJ_CASES_TAC; FIRST_X_ASSUM_ST `~(a /\ b)` MP_TAC; ASM_REWRITE_TAC[arith `~(a < b) <=> b <= a`]; DISCH_TAC; ONCE_REWRITE_TAC[wtcount6_y_sym26]; ONCE_REWRITE_TAC[gamma4fgcy_sym26]; FIRST_X_ASSUM MATCH_MP_TAC; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; SUBCONJ_TAC; FIRST_X_ASSUM_ST `rad2_y` MP_TAC; BY(MESON_TAC[Merge_ineq.rad2_y_sym]); DISCH_TAC; MATCH_MP_TAC (arith `x < y ==> x <= y`); MATCH_MP_TAC gamma4fgcy_POS; ASM_REWRITE_TAC[]; ASM_SIMP_TAC[arith `x <= y ==> ~(y < x)`]; ASM_SIMP_TAC[Merge_ineq.y_bounds]; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); COMMENT "second case"; FIRST_X_ASSUM_ST `~(a /\ b)` MP_TAC; ASM_REWRITE_TAC[arith `~(a < b) <=> b <= a`]; DISCH_TAC; FIRST_X_ASSUM MATCH_MP_TAC; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; MATCH_MP_TAC (arith `x < y ==> x <= y`); MATCH_MP_TAC gamma4fgcy_POS; ASM_REWRITE_TAC[]; ASM_SIMP_TAC[arith `x <= y ==> ~(y < x)`]; ASM_SIMP_TAC[Merge_ineq.y_bounds]; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) ]);; (* }}} *)
let real_model_gamma8b = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. (cc_4 V u0 u1 f i /\ ~(dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus)) /\ (dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus) /\ ~(dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) ==> #0.0057 <= gg_mcell V f u0 u1 i) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC GG_MCELL_NONBETA; CONJ_TAC; BY(ASM_MESON_TAC[]); ONCE_REWRITE_TAC[Merge_ineq.gamma4fgcy_sym23]; ONCE_REWRITE_TAC[wtcount6_y_sym23]; MP_TAC Merge_ineq.QITNPEA4_9063653052_weak_ALT; ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; DISCH_TAC; MATCH_MP_TAC (arith `gw > c ==> c <= gw`); INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC leaf_CIHTIUM [`V`;`u0`;`u1`;`f i`]; ASM_REWRITE_TAC[]; REWRITE_TAC[DE_MORGAN_THM ;arith `~(x <= y) <=> y < x`]; COMMENT "case split";
DISCH_THEN DISJ_CASES_TAC; FIRST_X_ASSUM_ST `~(a /\ b)` MP_TAC; ASM_REWRITE_TAC[arith `~(a < b) <=> b <= a`]; DISCH_TAC; ONCE_REWRITE_TAC[wtcount6_y_sym26]; ONCE_REWRITE_TAC[gamma4fgcy_sym26]; FIRST_X_ASSUM MATCH_MP_TAC; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; SUBCONJ_TAC; FIRST_X_ASSUM_ST `rad2_y` MP_TAC; BY(MESON_TAC[Merge_ineq.rad2_y_sym]); DISCH_TAC; MATCH_MP_TAC (arith `x < y ==> x <= y`); MATCH_MP_TAC gamma4fgcy_POS; ASM_REWRITE_TAC[]; ASM_SIMP_TAC[arith `x <= y ==> ~(y < x)`]; ASM_SIMP_TAC[Merge_ineq.y_bounds]; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); COMMENT "second case"; FIRST_X_ASSUM_ST `~(a /\ b)` MP_TAC; ASM_REWRITE_TAC[arith `~(a < b) <=> b <= a`]; DISCH_TAC; FIRST_X_ASSUM MATCH_MP_TAC; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; SUBCONJ_TAC; FIRST_X_ASSUM_ST `rad2_y` MP_TAC; BY(MESON_TAC[Merge_ineq.rad2_y_sym]); DISCH_TAC; MATCH_MP_TAC (arith `x < y ==> x <= y`); MATCH_MP_TAC gamma4fgcy_POS; ASM_REWRITE_TAC[]; ASM_SIMP_TAC[arith `x <= y ==> ~(y < x)`]; ASM_SIMP_TAC[Merge_ineq.y_bounds]; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) ]);; (* }}} *)
let real_model_gaz9 = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. (cc_4 V u0 u1 f i /\ ~(dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus)) /\ (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus ==> #0.213849 - #0.119482 * azim_mcell V f u0 u1 i <= gg_mcell V f u0 u1 i) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC c_4_azim_mcell_dih_y; CONJ_TAC; BY(ASM_MESON_TAC[]); INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `~` MP_TAC; ASM_REWRITE_TAC[]; DISCH_TAC; GMATCH_SIMP_TAC GG_MCELL_GENERAL; CONJ_TAC; BY(ASM_MESON_TAC[]); MATCH_MP_TAC (arith `(?t. x <= g + t /\ &1 * t <= b) ==> x <= g + b`); TYPIFY`beta_bump_lb` EXISTS_TAC; REWRITE_TAC[ Merge_ineq.beta_bumpA_lb1 ]; MATCH_MP_TAC (arith `(?w. x <= g / w + t /\ g / w <= g / w') ==> (x <= g / w' + t)`); TYPIFY `&2` EXISTS_TAC; CONJ2_TAC; MATCH_MP_TAC Merge_ineq.gamma_wt; ONCE_REWRITE_TAC[TAUT `a /\ b /\ c <=> b /\ a /\ c`]; CONJ_TAC; REWRITE_TAC[arith `x > &0 <=> &0 < x`]; MATCH_MP_TAC gamma4fgcy_POS; ASM_REWRITE_TAC[]; ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; ASM_REWRITE_TAC[Sphere.critical_edge_y]; ASM_SIMP_TAC[arith `x < y ==> ~(y<= x)`]; BY(ARITH_TAC); MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "QITNPEA 2134082733"); ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; ASM_REWRITE_TAC[GSYM Sphere.rad2_y]; REWRITE_TAC[TAUT ` (a ==> b \/ c) <=> (a /\ ~c ==> b)`]; REWRITE_TAC[arith `g + b - c + d > #0.0 <=> c - d < g + b`]; DISCH_TAC; MATCH_MP_TAC (arith `x < y ==> x <= y`); FIRST_X_ASSUM MATCH_MP_TAC; ASM_REWRITE_TAC[]; CONJ2_TAC; BY(FIRST_X_ASSUM_ST `rad2_y` MP_TAC THEN REAL_ARITH_TAC); ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) ]);;
(* }}} *)
let real_model_azim2 = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. (cc_4 V u0 u1 f i /\ ~(dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ dist (f i,f (SUC i)) < &2 * hminus)) /\ ((dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus) /\ &2 * hplus < dist (f i,f (SUC i)) ==> #0.00457511 + #0.00609451 * azim_mcell V f u0 u1 i <= gg_mcell V f u0 u1 i) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC c_4_azim_mcell_dih_y; CONJ_TAC; BY(ASM_MESON_TAC[]); INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; TYPIFY `~critical_edge_y (dist(f i,f (SUC i)))` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_SIMP_TAC[Sphere.critical_edge_y;arith `h < x ==> ~(x<= h)`]); GMATCH_SIMP_TAC GG_MCELL_NONBETA; CONJ_TAC; BY(ASM_MESON_TAC[]); TYPIFY `wtcount6_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist (f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i)) = 1` (C SUBGOAL_THEN SUBST1_TAC); ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; ASM_REWRITE_TAC[Sphere.critical_edge_y]; ASM_SIMP_TAC[arith `x < y ==> ~(y<= x)`]; BY(ARITH_TAC); MATCH_MP_TAC (arith `g - c - d > #0.0 ==> c + d <= g / &1`); MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "QITNPEA 9939613598"); ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; ASM_REWRITE_TAC[GSYM Sphere.rad2_y]; REWRITE_TAC[TAUT ` (a ==> b \/ c) <=> (a /\ ~c ==> b)`]; DISCH_THEN MATCH_MP_TAC; ASM_REWRITE_TAC[]; CONJ2_TAC; BY(FIRST_X_ASSUM_ST `rad2_y` MP_TAC THEN REAL_ARITH_TAC); ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) ]);;
(* }}} *)
let CC_3_SUM_SET = 
prove_by_refinement( `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~cc_4 V u0 u1 f i /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> {X | mcell_set V X /\ {u0, u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i))} = {cc_cell V [u0;u1;f i],cc_cell V [u1;u0;f (SUC i)]} UNION {X | mcell_set V X /\ {u0,u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ ~(X = cc_cell V [u0;u1;f i]) /\ ~(X = cc_cell V [u1;u0;f (SUC i)])}`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; ONCE_REWRITE_TAC[EXTENSION]; REWRITE_TAC[IN_UNION;IN_INSERT;NOT_IN_EMPTY]; REWRITE_TAC[IN_ELIM_THM]; GEN_TAC; MATCH_MP_TAC (TAUT `((a==> b) /\ (b ==> a)) ==> (a = b)`); CONJ_TAC; BY(MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC NO_4CELL_IMP_K3 [`V`;`wedge_ge u0 u1 (f i) (f (SUC i))`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; ANTS_TAC; BY(ASM_MESON_TAC[cc_4]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Leaf_cell.STEM_EDGEX [`V`]; ASM_REWRITE_TAC[]; DISCH_TAC; INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; FIRST_ASSUM (C INTRO_TAC [`[u0;u1;f i]`]); FIRST_X_ASSUM (C INTRO_TAC [`[u1;u0;f(SUC i)]`]); ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; TYPIFY `{u1,u0} = {u0,u1}` (C SUBGOAL_THEN ASSUME_TAC); BY(SET_TAC[]); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `\/` DISJ_CASES_TAC; BY(ASM_MESON_TAC[Leaf_cell.CC_CELL_IN_MCELL_SET;IN]); BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *)
let CC_3_SUM_fn = 
prove_by_refinement( `!V u0 u1 w0 n f i fn. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~cc_4 V u0 u1 f i /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> sum {X | mcell_set V X /\ {u0, u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i))} fn = fn (cc_cell V [u0;u1;f i]) + fn (cc_cell V [u1;u0;f (SUC i)]) + sum {X | mcell_set V X /\ {u0,u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ ~(X = cc_cell V [u0;u1;f i]) /\ ~(X = cc_cell V [u1;u0;f (SUC i)])} fn`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC CC_3_SUM_SET; CONJ_TAC; BY(ASM_MESON_TAC[]); INTRO_TAC Marchal_cells_3.FINITE_EDGE_X2 [`V`;`{u0,u1}`;`u0`;`u1`]; ASM_REWRITE_TAC[]; DISCH_TAC; GMATCH_SIMP_TAC SUM_UNION; REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]; CONJ_TAC; CONJ_TAC; MATCH_MP_TAC FINITE_SUBSET; TYPIFY `{X | mcell_set V X /\ edgeX V X {u0, u1}}` EXISTS_TAC; ASM_REWRITE_TAC[]; REWRITE_TAC[SUBSET;IN_ELIM_THM]; BY(MESON_TAC[IN]); REWRITE_TAC[DISJOINT]; BY(SET_TAC[]); MATCH_MP_TAC (arith `s = s'+s'' ==> (s + a = s'+s'' + a)`); MATCH_MP_TAC Geomdetail.SUM_DIS2; INTRO_TAC NO_4CELL_IMP_K3 [`V`;`wedge_ge u0 u1 (f i) (f (SUC i))`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; ANTS_TAC; BY(ASM_MESON_TAC[cc_4]); BY(DISCH_THEN (unlist REWRITE_TAC)) ]);;
(* }}} *)
let EDGE_IMP_K23 = 
prove_by_refinement( `!V X u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~cc_4 V u0 u1 f i /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f /\ mcell_set V X /\ {u0, u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) ==> (?k v1 v2. barV V 3 [u0;u1;v1;v2] /\ ((k = 2)\/ (k = 3)) /\ X = mcell k V [u0;u1;v1;v2]) `,
(* {{{ proof *) [ REWRITE_TAC[Qzyzmjc.mcell_set_2;IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; TYPIFY `i'` EXISTS_TAC; FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP (arith `i' <= 4 ==> (i' <= 1 \/ i' = 4 \/ i' = 2 \/ i' = 3)`))); FIRST_X_ASSUM DISJ_CASES_TAC; INTRO_TAC Bump.EDGE_IMP_K2 [`V`;`ul`;`i'`]; ANTS_TAC; BY(ASM_MESON_TAC[IN]); BY(ASM_MESON_TAC[NOT_IN_EMPTY;IN]); FIRST_X_ASSUM DISJ_CASES_TAC; BY(ASM_MESON_TAC[cc_4;IN;Bump.MCELL4]); ASM_REWRITE_TAC[]; INTRO_TAC Leaf_cell.MCELL_EDGE_FIRST [`V`;`ul`;`i'`;`u0`;`u1`]; ANTS_TAC; BY(ASM_MESON_TAC[IN]); REPEAT WEAKER_STRIP_TAC; GEXISTL_TAC [ `EL 2 vl`;`EL 3 vl`]; TYPIFY `[u0; u1; EL 2 vl; EL 3 vl] = vl` (C SUBGOAL_THEN SUBST1_TAC); MATCH_MP_TAC EQ_SYM; ASM_REWRITE_TAC[]; MATCH_MP_TAC Bump.LENGTH4; REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; BY(ASM_MESON_TAC[IN]); BY(ASM_MESON_TAC[IN]) ]);;
(* }}} *)
let CC_2_PROPS = 
prove_by_refinement( `!V X u0 u1 vl. pack_nonlinear_non_ox3q1h /\ packing V /\ saturated V /\ critical_edge_y (dist(u0,u1)) /\ X = mcell2 V vl /\ {u0,u1} IN edgeX V X /\ barV V 3 vl ==> ~(NULLSET X) /\ gammaX V X lmfun = gamma2_x_div_azim_v2 (h0cut (dist(u0,u1))) (dist(u0,u1) * dist(u0,u1)) * dihX V X (u0,u1) /\ &0 < dihX V X (u0,u1) /\ #0.008 * dihX V X (u0,u1) < gammaX V X lmfun`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; SUBCONJ_TAC; REWRITE_TAC[Bump.MCELL2]; DISCH_THEN (MP_TAC o (MATCH_MP Bump.RIJRIED)); BY(ASM_MESON_TAC[NOT_IN_EMPTY;IN;Bump.MCELL2]); DISCH_TAC; INTRO_TAC Leaf_cell.MCELL2_EDGE_FIRST [`V`;`vl`;`u0`;`u1`]; ANTS_TAC; BY(ASM_MESON_TAC[IN]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC MCELL2_DIHX_POS [`V`;`X`;`vl'`]; ASM_REWRITE_TAC[]; ANTS_TAC; BY(ASM_MESON_TAC[IN]); DISCH_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC (TAUT `((a ==> b) /\ a) ==> (a /\ b)`); CONJ_TAC; DISCH_THEN SUBST1_TAC; MATCH_MP_TAC REAL_LT_RMUL; ASM_REWRITE_TAC[]; MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "GRKIBMP A V2"); ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; REWRITE_TAC[Sphere.y_of_x;Functional_equation.nonf_gamma2_x1_div_a_v2]; REWRITE_TAC[arith `x > y <=> y < x`]; DISCH_THEN MATCH_MP_TAC; GEXISTL_TAC [`&1`;`&1`;`&1`;`&1`;`&1`]; REWRITE_TAC[REAL_LE_REFL]; FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; ASM_REWRITE_TAC[Sphere.critical_edge_y]; MP_TAC Nonlinear_lemma.hminus_prop; BY(REAL_ARITH_TAC); COMMENT "gammaX formula";
INTRO_TAC Tskajxy.GAMMAX_GAMMA2_X [`V`;`X`;`vl'`;`dist(u0,u1)`;`dist(u0,mxi V vl')`;`dist(u0,omega_list_n V vl' 3)`;`dist(mxi V vl',omega_list_n V vl' 3)`;`dist(u1,omega_list_n V vl' 3)`;`dist(u1,mxi V vl')`]; ANTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; BY(ASM_MESON_TAC[IN]); BY(ASM_MESON_TAC[]); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC (arith `x = y ==> a * x = a * y`); GMATCH_SIMP_TAC Tskajxy.MCELL2_DIHX; CONJ_TAC; BY(ASM_MESON_TAC[IN]); GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Merge_ineq.DIHV_EQ_DIH_Y); INTRO_TAC Tskajxy.NOT_COPLANAR_EXTREME_MCELL2 [`V`;`vl'`]; ANTS_TAC; BY(ASM_MESON_TAC[IN]); DISCH_TAC; FIRST_ASSUM (ASSUME_TAC o (MATCH_MP NOT_COPLANAR_NOT_COLLINEAR)); ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `coplanar` MP_TAC; TYPIFY `{EL 0 vl', EL 1 vl', mxi V vl', omega_list_n V vl' 3} = {EL 0 vl', EL 1 vl', omega_list_n V vl' 3, mxi V vl'}` (C SUBGOAL_THEN SUBST1_TAC); BY(SET_TAC[]); BY(MESON_TAC[NOT_COPLANAR_NOT_COLLINEAR]) ]);; (* }}} *)
let MCELL2_CRITICAL_WEIGHT1 = 
prove_by_refinement( `!V X u0 u1 vl. pack_nonlinear_non_ox3q1h /\ packing V /\ saturated V /\ critical_edge_y (dist(u0,u1)) /\ X = mcell2 V vl /\ {u0,u1} IN edgeX V X /\ barV V 3 vl ==> critical_weight V X = &1`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[Pack_defs.critical_edge_y;Pack_defs.critical_weight]; MATCH_MP_TAC (arith `x = &1 ==> &1 / x = &1`); REWRITE_TAC[REAL_OF_NUM_EQ]; MATCH_MP_TAC Misc_defs_and_lemmas.CARD_SING; REWRITE_TAC[SING]; TYPIFY `{u0,u1}` EXISTS_TAC; ONCE_REWRITE_TAC[EXTENSION]; GEN_TAC; INTRO_TAC Bump.MCELL2_EDGE [`V`;`vl`;`{u0,u1}`]; ANTS_TAC; BY(ASM_MESON_TAC[IN]); DISCH_TAC; INTRO_TAC Tskajxy.MCELL2_VX_PROPS [`V`;`X`;`vl`]; ANTS_TAC; ASM_REWRITE_TAC[]; REWRITE_TAC[ Bump.MCELL2]; DISCH_THEN (MP_TAC o (MATCH_MP Bump.RIJRIED)); BY(ASM_MESON_TAC[NOT_IN_EMPTY;Bump.MCELL2]); REPEAT WEAKER_STRIP_TAC; PROOF_BY_CONTR_TAC; TYPIFY `~(?u v. x = {u,v})` ENOUGH_TO_SHOW_TAC; DISCH_TAC; FIRST_X_ASSUM_ST `IN` MP_TAC; ASM_REWRITE_TAC[Pack_defs.critical_edgeX;IN_ELIM_THM]; REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(ASM_MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `IN` MP_TAC; ASM_REWRITE_TAC[critical_edgeX_critical_edge_y;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; FIRST_X_ASSUM_ST `mcell2` (SUBST1_TAC o GSYM); ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; BY(ASM_MESON_TAC[Geomdetail.DIST_PAIR_LEMMA]) ]);;
(* }}} *)
let MCELL3_CRITICAL_WEIGHT = 
prove_by_refinement( `!V X u0 u1 v1 v2. pack_nonlinear_non_ox3q1h /\ packing V /\ saturated V /\ critical_edge_y (dist(u0,u1)) /\ X = mcell3 V [u0;u1;v1;v2] /\ {u0,u1} IN edgeX V X /\ barV V 3 [u0;u1;v1;v2] ==> critical_weight V X = &1 / &(wtcount3_y (dist(u0,u1)) (dist(u0,v1)) (dist(u1,v1)))`,
(* {{{ proof *) [ REWRITE_TAC[Pack_defs.critical_weight]; REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[Pack_defs.critical_edge_y;Pack_defs.critical_weight;arith `&1 /x = inv x`]; REWRITE_TAC[REAL_EQ_INV2;REAL_OF_NUM_EQ]; TYPIFY `~NULLSET X` (C SUBGOAL_THEN ASSUME_TAC); ASM_REWRITE_TAC[Bump.MCELL3]; DISCH_THEN (MP_TAC o (MATCH_MP Bump.RIJRIED)); BY(ASM_MESON_TAC[NOT_IN_EMPTY;Bump.MCELL3]); INTRO_TAC MCELL3_EDGE_EXPLICIT [`V`;`u0`;`u1`;`v1`;`v2`]; ANTS_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[]); DISCH_TAC; TYPIFY `critical_edgeX V X SUBSET edgeX V X` (C SUBGOAL_THEN MP_TAC); REWRITE_TAC[SUBSET;Bump.CRITICAL_EDGEX_ALT]; BY(MESON_TAC[]); ASM_REWRITE_TAC[]; DISCH_TAC; TYPIFY `critical_edgeX V (mcell3 V [u0; u1; v1; v2]) = {{u0, u1}, {u0, v1}, {u1, v1}} INTER critical_edgeX V (mcell3 V [u0; u1; v1; v2])` (C SUBGOAL_THEN SUBST1_TAC); FIRST_X_ASSUM MP_TAC; BY(SET_TAC[]); INTRO_TAC Upfzbzm_support_lemmas.FINITE_critical_edgeX [`V`;`X`]; ASM_REWRITE_TAC[]; DISCH_TAC; ASM_SIMP_TAC[CARD_INSERT_INTER_ALT]; ASM_REWRITE_TAC[INTER_EMPTY;CARD_CLAUSES;NOT_IN_EMPTY;IN_INSERT;critical_edgeX_critical_edge_y]; INTRO_TAC MCELL3_EXTREME_CARD [`V`;`[u0; u1; v1; v2]`]; ANTS_TAC; BY(ASM_MESON_TAC[IN]); REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN (ASSUME_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); ASM_REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; REWRITE_TAC[Sphere.wtcount3_y]; ASM_REWRITE_TAC[]; BY(ARITH_TAC) ]);;
(* }}} *)
let MCELL3_008 = 
prove_by_refinement( `!V X u0 u1 ul. pack_nonlinear_non_ox3q1h /\ packing V /\ saturated V /\ X = mcell3 V ul /\ critical_edge_y (dist(u0,u1)) /\ {u0,u1} IN edgeX V (X) /\ barV V 3 ul ==> #0.008 * dihX V (X) (u0,u1) <= gammaX V (X) lmfun * critical_weight V (X) + beta_bump_v1 V {u0, u1} (X) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; COMMENT "now 3 cell";
INTRO_TAC Leaf_cell.MCELL3_EDGE_FIRST [`V`;`ul`;`u0`;`u1`]; ANTS_TAC; BY(ASM_MESON_TAC[IN]); REWRITE_TAC[IN]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (fun t -> REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[t]); REPEAT WEAKER_STRIP_TAC; TYPIFY `~NULLSET X` (C SUBGOAL_THEN ASSUME_TAC); ASM_REWRITE_TAC[Bump.MCELL3]; DISCH_THEN (MP_TAC o (MATCH_MP Bump.RIJRIED)); BY(ASM_MESON_TAC[NOT_IN_EMPTY;Bump.MCELL3]); TYPIFY `vl = [EL 0 vl; EL 1 vl; EL 2 vl; EL 3 vl]` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC Bump.LENGTH4; BY(REWRITE_TAC[arith `4 = 3+1`] THEN ASM_MESON_TAC[Sphere.BARV;IN]); INTRO_TAC Tskajxy_lemmas.gammaX_gamma3f [`V`;`mcell3 V vl`;`vl`;`EL 0 vl`;`EL 1 vl`;`EL 2 vl`;`EL 3 vl`;`dist(EL 1 vl,EL 2 vl)`;`dist(EL 0 vl,EL 2 vl)`;`dist(EL 0 vl,EL 1 vl)`]; ANTS_TAC; ASM_REWRITE_TAC[Bump.MCELL3]; BY(ASM_MESON_TAC[Bump.MCELL3]); ASM_REWRITE_TAC[Bump.MCELL3]; FIRST_ASSUM SUBST1_TAC; REWRITE_TAC[Bump.EL_EXPLICIT]; DISCH_THEN (unlist REWRITE_TAC); INTRO_TAC Merge_ineq.cell3_008_from_ineq_ALT []; ASM_REWRITE_TAC[]; DISCH_TAC; REWRITE_TAC[GSYM Bump.MCELL3]; GMATCH_SIMP_TAC MCELL3_CRITICAL_WEIGHT; GEXISTL_TAC [`EL 0 vl`;`EL 1 vl`;`EL 2 vl`]; CONJ_TAC; TYPIFY `EL 3 vl` EXISTS_TAC; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[Bump.MCELL3]); TYPIFY `gamma3f (dist (EL 1 vl,EL 2 vl)) (dist (EL 0 vl,EL 2 vl)) (dist (EL 0 vl,EL 1 vl)) sqrt2 lmfun = gamma3f (dist (EL 0 vl,EL 1 vl)) (dist (EL 1 vl,EL 2 vl)) (dist (EL 0 vl,EL 2 vl)) sqrt2 lmfun` (C SUBGOAL_THEN SUBST1_TAC); BY(MESON_TAC[Merge_ineq.gamma3f_sym]); TYPIFY `wtcount3_y (dist (EL 0 vl,EL 1 vl)) (dist (EL 0 vl,EL 2 vl)) (dist (EL 1 vl,EL 2 vl)) = wtcount3_y (dist (EL 0 vl,EL 1 vl)) (dist (EL 1 vl,EL 2 vl)) (dist (EL 0 vl,EL 2 vl))` (C SUBGOAL_THEN SUBST1_TAC); REWRITE_TAC[Sphere.wtcount3_y]; BY(ARITH_TAC); REWRITE_TAC[arith `x * &1 / y = x / y`]; REWRITE_TAC[arith `#0.008 * d = d * #0.008`]; REWRITE_TAC[Bump.MCELL3]; REPEAT (GMATCH_SIMP_TAC Bump.MCELL_BUMP_0); CONJ_TAC; BY(ASM_MESON_TAC[arith `3 < 4`;Bump.MCELL3]); REWRITE_TAC[arith `x + &0 = x`]; FIRST_X_ASSUM MATCH_MP_TAC; INTRO_TAC MCELL3_DOMAIN [`V`;`[EL 0 vl;EL 1 vl;EL 2 vl;EL 3 vl]`]; REWRITE_TAC[Bump.EL_EXPLICIT]; ANTS_TAC; BY(ASM_MESON_TAC[Bump.MCELL3]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; ASM_REWRITE_TAC[Sphere.critical_edge_y]; DISCH_THEN (unlist REWRITE_TAC); FIRST_X_ASSUM MP_TAC; MATCH_MP_TAC (arith `e = e' ==> (e < s ==> e'< s)`); BY(MESON_TAC[Collect_geom.ETA_Y_SYYM]) ]);; (* }}} *)
let real_model_008 = 
prove_by_refinement( `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f /\ ~cc_4 V u0 u1 f i ==> sum {X | mcell_set V X /\ {u0, u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ ~(X = cc_cell V [u0; u1; f i]) /\ ~(X = cc_cell V [u1; u0; f (SUC i)])} (\X. #0.008 * dihX V X (u0,u1)) <= sum {X | mcell_set V X /\ {u0, u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ ~(X = cc_cell V [u0; u1; f i]) /\ ~(X = cc_cell V [u1; u0; f (SUC i)])} (\X. gammaX V X lmfun * critical_weight V X + beta_bump_v1 V {u0, u1} X) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC SUM_LE; SUBCONJ_TAC; INTRO_TAC Marchal_cells_3.FINITE_EDGE_X2 [`V`;`{u0,u1}`;`u0`;`u1`]; ASM_REWRITE_TAC[]; DISCH_TAC; MATCH_MP_TAC FINITE_SUBSET; TYPIFY `{X | mcell_set V X /\ edgeX V X {u0, u1}}` EXISTS_TAC; ASM_REWRITE_TAC[]; REWRITE_TAC[SUBSET;IN_ELIM_THM]; BY(MESON_TAC[IN]); DISCH_TAC; REWRITE_TAC[IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC EDGE_IMP_K23 [`V`;`x`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; FIRST_X_ASSUM DISJ_CASES_TAC; REPEAT (GMATCH_SIMP_TAC Bump.MCELL_BUMP_0); CONJ_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; BY(ASM_SIMP_TAC[arith `(k = 2) ==> (k < 4)`]); FIRST_X_ASSUM_ST `edgeX` MP_TAC; ASM_REWRITE_TAC[]; BY(MESON_TAC[Bump.RIJRIED;NOT_IN_EMPTY]); REWRITE_TAC[arith `x + &0 = x`]; GMATCH_SIMP_TAC MCELL2_CRITICAL_WEIGHT1; CONJ_TAC; GEXISTL_TAC [`u0`;`u1`;`[u0;u1;v1;v2]`]; ASM_REWRITE_TAC[]; BY(ASM_MESON_TAC[Bump.MCELL2]); REWRITE_TAC[arith `x * &1 = x`]; INTRO_TAC CC_2_PROPS [`V`;`x`;`u0`;`u1`;`[u0;u1;v1;v2]`]; ANTS_TAC; BY(ASM_REWRITE_TAC[Bump.MCELL2]); BY(ASM_MESON_TAC[arith `x < y ==> x <= y`]); COMMENT "now 3 cell";
INTRO_TAC MCELL3_008 [`V`;`x`;`u0`;`u1`;`[u0;u1;v1;v2]`]; ANTS_TAC; BY(ASM_REWRITE_TAC[Bump.MCELL3]); BY(ASM_REWRITE_TAC[]) ]);; (* }}} *)
let real_model_cell23 = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. ~cc_4 V u0 u1 f i ==> gammaX V (cc_cell V [u0; u1; f i]) lmfun * critical_weight V (cc_cell V [u0; u1; f i]) + gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * critical_weight V (cc_cell V [u1; u0; f (SUC i)]) <= gg_mcell V f u0 u1 i) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[gg_mcell]; GMATCH_SIMP_TAC CC_3_SUM_fn; CONJ_TAC; BY(ASM_MESON_TAC[]); INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[arith `x + &0 = x`]; REWRITE_TAC[arith `g1 + g2 <= g1 + g2 + s <=> &0 <= s`]; INTRO_TAC real_model_008 [`V`; `u0`; `u1`; `w0`; `n`; `f`; `i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; TYPIFY `&0 <= sum {X | mcell_set V X /\ {u0, u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ ~(X = cc_cell V [u0; u1; f i]) /\ ~(X = cc_cell V [u1; u0; f (SUC i)])} (\X. #0.008 * dihX V X (u0,u1))` ENOUGH_TO_SHOW_TAC; FIRST_X_ASSUM MP_TAC; TYPED_ABBREV_TAC `s = {X | mcell_set V X /\ {u0, u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ ~(X = cc_cell V [u0; u1; f i]) /\ ~(X = cc_cell V [u1; u0; f (SUC i)])}` ; BY(REAL_ARITH_TAC); MATCH_MP_TAC SUM_POS_LE; CONJ_TAC; MATCH_MP_TAC FINITE_SUBSET; TYPIFY `{X | mcell_set V X /\ edgeX V X {u0,u1} }` EXISTS_TAC; CONJ_TAC; MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2; BY(ASM_MESON_TAC[]); BY(SET_TAC[]); REWRITE_TAC[IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC REAL_LE_MUL; CONJ_TAC; BY(REAL_ARITH_TAC); BY(REWRITE_TAC[Upfzbzm_support_lemmas.DIHX_POS]) ]);;
(* }}} *)
let real_model_cell23_008 = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. ~cc_4 V u0 u1 f i ==> (gammaX V (cc_cell V [u0; u1; f i]) lmfun * critical_weight V (cc_cell V [u0; u1; f i]) - #0.008 * dihX V (cc_cell V [u0;u1;f i]) (u0,u1)) + (gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * critical_weight V (cc_cell V [u1; u0; f (SUC i)]) - #0.008 * dihX V (cc_cell V [u1;u0;f (SUC i)]) (u0,u1)) + #0.008 * azim_mcell V f u0 u1 i <= gg_mcell V f u0 u1 i) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[gg_mcell;azim_mcell]; GMATCH_SIMP_TAC CC_3_SUM_fn; CONJ_TAC; BY(ASM_MESON_TAC[]); GMATCH_SIMP_TAC CC_3_SUM_fn; CONJ_TAC; BY(ASM_MESON_TAC[]); INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[arith `x + &0 = x`]; TYPED_ABBREV_TAC `s = {X | mcell_set V X /\ {u0, u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ ~(X = cc_cell V [u0; u1; f i]) /\ ~(X = cc_cell V [u1; u0; f (SUC i)])}` ; TYPIFY `!X. X IN s ==> (?k v1 v2. barV V 3 [u0; u1; v1; v2] /\ (k = 2 \/ k = 3) /\ X = mcell k V [u0; u1; v1; v2])` (C SUBGOAL_THEN ASSUME_TAC); EXPAND_TAC "s";
REWRITE_TAC[IN_ELIM_THM]; REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC EDGE_IMP_K23; BY(ASM_MESON_TAC[]); TYPIFY `sum s (\X. gammaX V X lmfun * critical_weight V X + beta_bump_v1 V {u0, u1} X) = sum s (\X. gammaX V X lmfun * critical_weight V X )` (C SUBGOAL_THEN ASSUME_TAC); MATCH_MP_TAC SUM_EQ; REWRITE_TAC[arith `g + b = g <=> b = &0`]; REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM (C INTRO_TAC [`x`]); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; MATCH_MP_TAC Bump.MCELL_BUMP_0; ASM_REWRITE_TAC[]; CONJ_TAC; FIRST_X_ASSUM_ST `\/` MP_TAC; BY(ARITH_TAC); DISCH_THEN (ASSUME_TAC o (MATCH_MP Bump.RIJRIED)); FIRST_X_ASSUM_ST `IN` MP_TAC; EXPAND_TAC "s"; BY(ASM_REWRITE_TAC[IN_ELIM_THM;NOT_IN_EMPTY]); ASM_REWRITE_TAC[]; COMMENT "reduce to 008 bound"; TYPIFY `#0.008 * sum s (\X. dihX V X (u0,u1)) <= sum s (\X. gammaX V X lmfun * critical_weight V X)` ENOUGH_TO_SHOW_TAC; BY(REAL_ARITH_TAC); REWRITE_TAC[GSYM SUM_LMUL]; FIRST_X_ASSUM (SUBST1_TAC o GSYM); EXPAND_TAC "s"; MATCH_MP_TAC real_model_008; BY(ASM_MESON_TAC[]) ]);; (* }}} *)
let GAMMAX_008a = 
prove_by_refinement( `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f /\ ~cc_4 V u0 u1 f i ==> #0.008 * dihX V (cc_cell V [u0; u1; f i]) (u0,u1) <= gammaX V (cc_cell V [u0; u1; f i]) lmfun * critical_weight V (cc_cell V [u0; u1; f i]) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC MCELL3_008 [`V`;`cc_cell V [u0;u1; f i]`;`u0`;`u1`;`cc_uh V [u0;u1;f i]`]; ANTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL3]); INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;` [u0;u1;f i]`]; BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); BY(ASM_REWRITE_TAC[arith `x + &0 = x`]) ]);;
(* }}} *)
let GAMMAX_008b = 
prove_by_refinement( `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f /\ ~cc_4 V u0 u1 f i ==> #0.008 * dihX V (cc_cell V [u1; u0; f (SUC i)]) (u0,u1) <= gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * critical_weight V (cc_cell V [u1; u0; f (SUC i)])`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;` [u1;u0;f (SUC i)]`]; (ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); DISCH_TAC; GMATCH_SIMP_TAC (GSYM Marchal_cells_3.DIHX_SYM); CONJ_TAC; ASM_REWRITE_TAC[]; ONCE_REWRITE_TAC[GSYM IN] THEN MATCH_MP_TAC Leaf_cell.CC_CELL_IN_MCELL_SET; BY(ASM_REWRITE_TAC[]); INTRO_TAC MCELL3_008 [`V`;`cc_cell V [u1;u0; f (SUC i)]`;`u1`;`u0`;`cc_uh V [u1;u0;f (SUC i)]`]; ANTS_TAC; ASM_REWRITE_TAC[]; CONJ_TAC; BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL3]); ONCE_REWRITE_TAC[DIST_SYM]; BY(ASM_REWRITE_TAC[]); TYPIFY `{u1,u0} = {u0,u1}` (C SUBGOAL_THEN SUBST1_TAC); BY(SET_TAC[]); BY((ASM_REWRITE_TAC[arith `x + &0 = x`])) ]);;
(* }}} *)
let real_model_3a = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. ~cc_4 V u0 u1 f i ==> &0 <= gammaX V (cc_cell V [u0; u1; f i]) lmfun * critical_weight V (cc_cell V [u0; u1; f i])) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC REAL_LE_MUL; REWRITE_TAC[CRITICAL_WEIGHT_POS_LE]; INTRO_TAC TSKAJXY_3 [`V`;`cc_cell V [u0;u1;f i]`;`cc_uh V [u0;u1;f i]`]; REWRITE_TAC[arith `g >= &0 <=> &0 <= g`]; DISCH_THEN MATCH_MP_TAC; INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL3]) ]);;
(* }}} *)
let real_model_3b = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. ~cc_4 V u0 u1 f i ==> &0 <= gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * critical_weight V (cc_cell V [u1; u0; f (SUC i)])) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; GMATCH_SIMP_TAC REAL_LE_MUL; REWRITE_TAC[CRITICAL_WEIGHT_POS_LE]; INTRO_TAC TSKAJXY_3 [`V`;`cc_cell V [u1;u0;f (SUC i)]`;`cc_uh V [u1;u0;f (SUC i)]`]; REWRITE_TAC[arith `g >= &0 <=> &0 <= g`]; DISCH_THEN MATCH_MP_TAC; INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_MESON_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL3]) ]);;
(* }}} *)
let real_model_gr = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. ~cc_4 V u0 u1 f i ==> #0.008 * azim_mcell V f u0 u1 i <= gg_mcell V f u0 u1 i) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC real_model_cell23_008 [`V`;`u0`;`u1`;`w0`;`n`;`f`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_THEN (C INTRO_TAC [`i`]); ASM_REWRITE_TAC[]; MATCH_MP_TAC (arith `&0 <= t1 /\ &0 <= t2 ==> (t1 + t2 + a <= g ==> a <= g)`); REWRITE_TAC[arith `&0 <= g - d <=> d <= g`]; CONJ_TAC; MATCH_MP_TAC GAMMAX_008a; BY(ASM_MESON_TAC[]); MATCH_MP_TAC GAMMAX_008b; BY(ASM_MESON_TAC[]) ]);;
(* }}} *)
let JSP_BOUNDS = 
prove_by_refinement( `!(u0:real^3) u1 u2. pack_nonlinear_non_ox3q1h /\ ~collinear {u0, u1, u2} /\ hl [u0; u1; u2] <= #1.34 /\ &2 * hminus <= dist (u0,u1) /\ &2 <= dist (u0,u2) /\ &2 <= dist (u1,u2) ==> dist(u0,u2) < &2 * hminus /\ dist(u1,u2) < &2 * hminus`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC JSPEVYT_EXPLICIT [`u0`;`u1`;`u2`]; ASM_REWRITE_TAC[]; DISCH_THEN (unlist REWRITE_TAC); INTRO_TAC JSPEVYT_EXPLICIT [`u1`;`u0`;`u2`]; ANTS_TAC; TYPIFY `{u1,u0,u2 } = {u0,u1,u2}` (C SUBGOAL_THEN ASSUME_TAC); BY(SET_TAC[]); TYPIFY `hl [u1;u0;u2] = hl[u0;u1;u2]` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_REWRITE_TAC[Pack_defs.HL;set_of_list]); ASM_REWRITE_TAC[]; ONCE_REWRITE_TAC[DIST_SYM]; BY(ASM_REWRITE_TAC[]); BY(REWRITE_TAC[]) ]);;
(* }}} *)
let real_model_pema = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. ~cc_4 V u0 u1 f i /\ hl [u0; u1; f i] < #1.34 /\ ~(hl [u0; u1; f (SUC i)] < #1.34) /\ azim_mcell V f u0 u1 i < #1.074 ==> a_spine5 + b_spine5 * azim_mcell V f u0 u1 i <= gg_mcell V f u0 u1 i) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC real_model_cell23_008 [`V`;`u0`;`u1`;`w0`;`n`;`f`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); TYPIFY `&2 * hminus <= dist (u0,u1) /\ dist(u0,u1) <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; BY((REWRITE_TAC[Sphere.critical_edge_y]) THEN REAL_ARITH_TAC); DISCH_THEN (C INTRO_TAC [`i`]); ASM_REWRITE_TAC[]; MATCH_MP_TAC (arith `&0 <= t /\ a <= t'+ a' ==> (t' + t + a' <= g ==> a <= g)`); CONJ_TAC; REWRITE_TAC[arith `&0 <= g - d <=> d <= g`]; MATCH_MP_TAC GAMMAX_008b; BY(ASM_MESON_TAC[]); INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; COMMENT "bound edges 3,5";
INTRO_TAC JSP_BOUNDS [`u0`;`u1`;`f i`]; ANTS_TAC; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); REPEAT WEAKER_STRIP_TAC; COMMENT "simplify goal"; TYPIFY `a_spine5 + b_spine5 * dih_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) y4 (dist (u1,f (SUC i))) (dist (u1,f i)) <= gammaX V (cc_cell V [u0; u1; f i]) lmfun * critical_weight V (cc_cell V [u0; u1; f i]) - #0.008 * dihX V (cc_cell V [u0; u1; f i]) (u0,u1) + #0.008 * dih_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) y4 (dist (u1,f (SUC i))) (dist (u1,f i))` ENOUGH_TO_SHOW_TAC; REWRITE_TAC[Sphere.b_spine5]; FIRST_X_ASSUM_ST `dih_y` MP_TAC; BY(REAL_ARITH_TAC); COMMENT "import inequality"; MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "PEMKWKU"); ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; REWRITE_TAC[GSYM Sphere.rad2_y]; REWRITE_TAC[ (TAUT ` (p ==> a \/ b) <=> (p /\ ~b ==> a)`)]; REWRITE_TAC[DE_MORGAN_THM]; REWRITE_TAC[Functional_equation.nonf_gamma23_keep135_x;Sphere.y_of_x]; REWRITE_TAC[GSYM (REWRITE_RULE[LET_DEF;LET_END_DEF] Sphere.dih_y)]; DISCH_TAC; FIRST_X_ASSUM (C INTRO_TAC [`(dist (u0,u1))`;` (dist (u0,f (SUC i)))`;` (dist (u0,f i))`;` y4`; ` (dist (u1,f i))`;`(dist (u1,f (SUC i)))`]); ANTS_TAC; REWRITE_TAC[arith `~(x < y) <=> y<= x`;arith`~(x > y) <=> x <= y`]; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; GMATCH_SIMP_TAC ETA_Y_LEMMA; ASM_REWRITE_TAC[]; CONJ_TAC; BY(REPEAT (FIRST_X_ASSUM_ST `#1.34` MP_TAC) THEN REAL_ARITH_TAC); TYPIFY `!x. x <= &2 <=> x <= (sqrt(&2) pow 2)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); BY(REWRITE_TAC[GSYM Sphere.sqrt2;arith `x pow 2 = x * x`;Nonlin_def.sqrt2_sqrt2]); REPEAT (GMATCH_SIMP_TAC ETA_Y_LEMMA_ALT); ASM_SIMP_TAC[arith `x < y ==> x <= y`]; CONJ2_TAC; CONJ_TAC; FIRST_X_ASSUM_ST `rad2_y` MP_TAC; BY(MESON_TAC[Merge_ineq.rad2_y_sym]); PURE_ONCE_REWRITE_TAC[Nonlinear_lemma.dih_y_sym]; FIRST_X_ASSUM_ST `dih_y` MP_TAC; FIRST_X_ASSUM_ST `#1.074` MP_TAC; ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC); BY(ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]); COMMENT "handle gamma3_f"; GMATCH_SIMP_TAC (GSYM Merge_ineq.gamma3_x_gamma3f); CONJ_TAC; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); GMATCH_SIMP_TAC critical_weight1; CONJ_TAC; BY(ASM_REWRITE_TAC[]); GMATCH_SIMP_TAC mcell3_gammaX_gamma3f; CONJ_TAC; GEXISTL_TAC [`w0`;`n`]; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[arith `g + dd * #0.008 > r <=> g > r - dd * #0.008`]; MATCH_MP_TAC(arith `r = s + a - b ==> (g > r ==> s <= g * &1 - a + b)`); REWRITE_TAC[arith `(a+b) - c = a + b - c`;arith `(a+b) + c = a + b + c`]; AP_TERM_TAC; MATCH_MP_TAC (arith `(d = d' /\ e' = -- e) ==> (b * d - e = b * d' + e')`); CONJ_TAC; BY(MESON_TAC[Nonlinear_lemma.dih_y_sym]); MATCH_MP_TAC (arith `d3' = d3'' /\ d6 = d6' ==> (#0.008 * d3' - #0.008 * d6 = --( ( d6' - d3'')* #0.008))`); CONJ2_TAC; BY(MESON_TAC[Nonlinear_lemma.dih_y_sym]); GMATCH_SIMP_TAC mcell3_dihX_dih_y; CONJ_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlin_def.sqrt2_sqrt2]; BY(MESON_TAC[Nonlinear_lemma.dih_x_sym]) ]);; (* }}} *)
let real_model_pemb = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. ~cc_4 V u0 u1 f i /\ ~(hl [u0; u1; f i] < #1.34) /\ hl [u0; u1; f (SUC i)] < #1.34 /\ azim_mcell V f u0 u1 i < #1.074 ==> a_spine5 + b_spine5 * azim_mcell V f u0 u1 i <= gg_mcell V f u0 u1 i) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC real_model_cell23_008 [`V`;`u0`;`u1`;`w0`;`n`;`f`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); TYPIFY `&2 * hminus <= dist (u0,u1) /\ dist(u0,u1) <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; BY((REWRITE_TAC[Sphere.critical_edge_y]) THEN REAL_ARITH_TAC); DISCH_THEN (C INTRO_TAC [`i`]); ASM_REWRITE_TAC[]; MATCH_MP_TAC (arith `&0 <= t' /\ a <= t+ a' ==> (t' + t + a' <= g ==> a <= g)`); CONJ_TAC; REWRITE_TAC[arith `&0 <= g - d <=> d <= g`]; MATCH_MP_TAC GAMMAX_008a; BY(ASM_MESON_TAC[]); INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; COMMENT "bound edges 2,6";
INTRO_TAC JSP_BOUNDS [`u0`;`u1`;`f (SUC i)`]; ANTS_TAC; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); REPEAT WEAKER_STRIP_TAC; COMMENT "simplify goal+"; TYPIFY `a_spine5 + b_spine5 * dih_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) y4 (dist (u1,f (SUC i))) (dist (u1,f i)) <= gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * critical_weight V (cc_cell V [u1; u0; f (SUC i)]) - #0.008 * dihX V (cc_cell V [u1; u0; f (SUC i)]) (u0,u1) + #0.008 * dih_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) y4 (dist (u1,f (SUC i))) (dist (u1,f i)) ` ENOUGH_TO_SHOW_TAC; REWRITE_TAC[Sphere.b_spine5]; FIRST_X_ASSUM_ST `dih_y` MP_TAC; BY(REAL_ARITH_TAC); COMMENT "import inequality"; MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "PEMKWKU"); ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; REWRITE_TAC[GSYM Sphere.rad2_y]; REWRITE_TAC[ (TAUT ` (p ==> a \/ b) <=> (p /\ ~b ==> a)`)]; REWRITE_TAC[DE_MORGAN_THM]; REWRITE_TAC[Functional_equation.nonf_gamma23_keep135_x;Sphere.y_of_x]; REWRITE_TAC[GSYM (REWRITE_RULE[LET_DEF;LET_END_DEF] Sphere.dih_y)]; DISCH_TAC; COMMENT "instantiate pem"; FIRST_X_ASSUM (C INTRO_TAC [`(dist (u0,u1))`;` (dist (u0,f ( i)))`;` (dist (u0,f (SUC i)))`;` y4`; ` (dist (u1,f (SUC i)))`;`(dist (u1,f ( i)))`]); ANTS_TAC; REWRITE_TAC[arith `~(x < y) <=> y<= x`;arith`~(x > y) <=> x <= y`]; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; GMATCH_SIMP_TAC ETA_Y_LEMMA; ASM_REWRITE_TAC[]; CONJ_TAC; BY(REPEAT (FIRST_X_ASSUM_ST `#1.34` MP_TAC) THEN REAL_ARITH_TAC); TYPIFY `!x. x <= &2 <=> x <= (sqrt(&2) pow 2)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); BY(REWRITE_TAC[GSYM Sphere.sqrt2;arith `x pow 2 = x * x`;Nonlin_def.sqrt2_sqrt2]); REPEAT (GMATCH_SIMP_TAC ETA_Y_LEMMA_ALT); ASM_SIMP_TAC[arith `x < y ==> x <= y`]; CONJ2_TAC; FIRST_X_ASSUM_ST `dih_y` MP_TAC; FIRST_X_ASSUM_ST `#1.074` MP_TAC; ASM_REWRITE_TAC[]; BY(REAL_ARITH_TAC); BY(ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]); COMMENT "handle gamma3_f"; GMATCH_SIMP_TAC (GSYM Merge_ineq.gamma3_x_gamma3f); CONJ_TAC; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); GMATCH_SIMP_TAC critical_weight1; CONJ_TAC; (ASM_REWRITE_TAC[]); ONCE_REWRITE_TAC[DIST_SYM]; BY(ASM_REWRITE_TAC[]); GMATCH_SIMP_TAC mcell3_gammaXb_gamma3f; CONJ_TAC; GEXISTL_TAC [`w0`;`n`]; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[arith `g + dd * #0.008 > r <=> g > r - dd * #0.008`]; MATCH_MP_TAC(arith `r = s + a - b ==> (g > r ==> s <= g * &1 - a + b)`); REWRITE_TAC[arith `(a+b) - c = a + b - c`;arith `(a+b) + c = a + b + c`]; AP_TERM_TAC; MATCH_MP_TAC (arith `(d = d' /\ e' = -- e) ==> (b * d - e = b * d' + e')`); CONJ_TAC; BY(REWRITE_TAC[]); MATCH_MP_TAC (arith `d3' = d3'' /\ d6 = d6' ==> (#0.008 * d3' - #0.008 * d6 = --( ( d6' - d3'')* #0.008))`); REWRITE_TAC[]; GMATCH_SIMP_TAC mcell3_dihXb_dih_y; CONJ_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlin_def.sqrt2_sqrt2]; BY(MESON_TAC[Nonlinear_lemma.dih_x_sym]) ]);; (* }}} *) let c2089 = Flyspeck_constants.calc `atn (sqrt (#3.07)) < pi - #2.089`;; let c1946 = Flyspeck_constants.calc `pi - #1.946 < atn (sqrt (#6.45))`;;
let IXPOTPA_MERGED = 
prove_by_refinement( `!y1 y2 y3 y4 y5 y6. pack_nonlinear_non_ox3q1h /\ critical_edge_y y1 /\ &2 <= y2 /\ y2 <= &2 * hminus /\ &2 <= y3 /\ y3 <= &2 * hminus /\ sqrt8 <= y4 /\ y4 <= y5 + y6 /\ &2 <= y5 /\ y5 <= &2 * hminus /\ &2 <= y6 /\ y6 <= &2 * hminus /\ &0 < delta_y y1 y2 y3 y4 y5 y6 /\ dih_y y1 y2 y3 y4 y5 y6 <= #2.089 /\ #1.946 <= dih_y y1 y2 y3 y4 y5 y6 /\ eta_y y1 y2 y6 pow 2 <= #1.34 pow 2/\ eta_y y1 y3 y5 pow 2 <= #1.34 pow 2 ==> &3 * #0.0057 <= gamma3f y1 y2 y6 sqrt2 lmfun + gamma3f y1 y3 y5 sqrt2 lmfun + (dih_y y1 y2 y3 y4 y5 y6 - (dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2)) * #0.008`,
(* {{{ proof *) [ COMMENT "prelims";
REPEAT WEAKER_STRIP_TAC; TYPIFY `y4 <= &4 * hminus ` (C SUBGOAL_THEN ASSUME_TAC); BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); TYPIFY `&2 * hminus <= y1 /\ y1 <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Sphere.critical_edge_y]); TYPIFY `&0 < y1` (C SUBGOAL_THEN ASSUME_TAC); MP_TAC Nonlinear_lemma.hminus_gt; FIRST_X_ASSUM MP_TAC; BY(REAL_ARITH_TAC); TYPIFY `&0 < y1 * y1` (C SUBGOAL_THEN ASSUME_TAC); GMATCH_SIMP_TAC REAL_LT_MUL_EQ; BY(ASM_REWRITE_TAC[]); TYPIFY `delta4_y y1 y2 y3 y4 y5 y6 < &0` (C SUBGOAL_THEN ASSUME_TAC); REWRITE_TAC[Sphere.delta4_y;Sphere.y_of_x]; MATCH_MP_TAC Merge_ineq.dih_gt_pi2; ASM_REWRITE_TAC[]; REPEAT (FIRST_X_ASSUM MP_TAC); REWRITE_TAC[Sphere.dih_y;Sphere.delta_y;LET_DEF;LET_END_DEF]; MP_TAC Flyspeck_constants.bounds; BY(REAL_ARITH_TAC); COMMENT "add nonlinear"; MATCH_MP_TAC (arith `x > y ==> y <= x`); INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "IXPOTPA") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; ASM_REWRITE_TAC[Sphere.ineq;LET_DEF;LET_END_DEF]; REWRITE_TAC[TAUT `a \/ b \/ c <=> (a \/ b) \/ c`]; ONCE_REWRITE_TAC[TAUT `a \/ b <=> (~a ==> b)`]; REWRITE_TAC[DE_MORGAN_THM]; REWRITE_TAC[TAUT `(a /\ b) /\c <=> a /\ b /\ c`]; ASM_REWRITE_TAC[Functional_equation.nonf_gamma23_full8_x;Sphere.y_of_x]; REPEAT (GMATCH_SIMP_TAC (GSYM Merge_ineq.gamma3_x_gamma3f)); ASM_SIMP_TAC[Merge_ineq.y_bounds]; REWRITE_TAC[REWRITE_RULE[LET_DEF;LET_END_DEF] (GSYM Sphere.dih_y);GSYM Nonlinear_lemma.sqrt2_sqrt2]; DISCH_THEN MATCH_MP_TAC; COMMENT "remove hypotheses"; ASM_SIMP_TAC [arith `&0 < x ==> ~(x < &0)`]; ASM_SIMP_TAC [arith `x <= y ==> ~(x > y)`]; ASM_SIMP_TAC [arith `x < &0 ==> ~(x > &0)`]; CONJ_TAC; MATCH_MP_TAC (arith `b < a ==> ~(a < b)`); TYPIFY `#3.07 = sqrt (#3.07) pow 2 ` (C SUBGOAL_THEN SUBST1_TAC); GMATCH_SIMP_TAC SQRT_POW_2; BY(REAL_ARITH_TAC); GMATCH_SIMP_TAC (GSYM Merge_ineq.lindihpi_lt_y); ASM_REWRITE_TAC[]; CONJ_TAC; GMATCH_SIMP_TAC REAL_LT_RSQRT; BY(REAL_ARITH_TAC); FIRST_X_ASSUM_ST `#2.089` MP_TAC; MP_TAC c2089; BY(REAL_ARITH_TAC); MATCH_MP_TAC (arith `a < b ==> ~(a > b)`); TYPIFY `#6.45 = sqrt (#6.45) pow 2 ` (C SUBGOAL_THEN SUBST1_TAC); GMATCH_SIMP_TAC SQRT_POW_2; BY(REAL_ARITH_TAC); GMATCH_SIMP_TAC (GSYM Merge_ineq.lindihpi_gt_y); ASM_REWRITE_TAC[]; CONJ_TAC; GMATCH_SIMP_TAC REAL_LT_RSQRT; BY(REAL_ARITH_TAC); FIRST_X_ASSUM_ST `#1.946` MP_TAC; MP_TAC c1946; BY(REAL_ARITH_TAC) ]);; (* }}} *)
let TXQTPVC_MERGED = 
prove_by_refinement( `!y1 y2 y3 y4 y5 y6. pack_nonlinear_non_ox3q1h /\ critical_edge_y y1 /\ &2 <= y2 /\ y2 <= &2 * hminus /\ &2 <= y3 /\ y3 <= &2 * hminus /\ &2 <= y4 /\ y4 <= y5 + y6 /\ &2 <= rad2_y y1 y2 y3 y4 y5 y6 /\ &2 <= y5 /\ y5 <= &2 * hminus /\ &2 <= y6 /\ y6 <= &2 * hminus /\ &0 < delta_y y1 y2 y3 y4 y5 y6 /\ dih_y y1 y2 y3 y4 y5 y6 <= #2.089 /\ #1.946 <= dih_y y1 y2 y3 y4 y5 y6 /\ eta_y y1 y2 y6 pow 2 <= #1.34 pow 2/\ eta_y y1 y3 y5 pow 2 <= #1.34 pow 2 ==> &3 * #0.0057 <= gamma3f y1 y2 y6 sqrt2 lmfun + gamma3f y1 y3 y5 sqrt2 lmfun + (dih_y y1 y2 y3 y4 y5 y6 - (dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2)) * #0.008`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `&2 * hminus <= y1 /\ y1 <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Sphere.critical_edge_y]); TYPIFY `sqrt8 <= y4` ASM_CASES_TAC; MATCH_MP_TAC IXPOTPA_MERGED; BY(ASM_REWRITE_TAC[]); TYPIFY `y4 <= sqrt8` (C SUBGOAL_THEN ASSUME_TAC); BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); MATCH_MP_TAC (arith `y > x ==> x<= y`); INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "TXQTPVC") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; ASM_REWRITE_TAC[Sphere.ineq;LET_DEF;LET_END_DEF]; ONCE_REWRITE_TAC[TAUT `a \/ b <=> ~b ==> a`]; REWRITE_TAC[DE_MORGAN_THM]; ASM_REWRITE_TAC[Functional_equation.nonf_gamma23_full8_x;Sphere.y_of_x]; REPEAT (GMATCH_SIMP_TAC (GSYM Merge_ineq.gamma3_x_gamma3f)); ASM_SIMP_TAC[Merge_ineq.y_bounds]; REWRITE_TAC[REWRITE_RULE[LET_DEF;LET_END_DEF] (GSYM Sphere.dih_y);GSYM Nonlinear_lemma.sqrt2_sqrt2]; DISCH_THEN MATCH_MP_TAC; COMMENT "deal with assumptions";
ASM_SIMP_TAC [arith `x <= y ==> ~(x > y)`]; ASM_SIMP_TAC [arith `c <= d ==> ~(d < c)`]; FIRST_X_ASSUM_ST `rad2_y` MP_TAC; REWRITE_TAC[Nonlin_def.sqrt2_sqrt2]; REWRITE_TAC[Sphere.rad2_y;Sphere.y_of_x]; BY(REAL_ARITH_TAC) ]);; (* }}} *)
let TEWNSCJ_MERGED = 
prove_by_refinement( `!y1 y2 y3 y4 y5 y6. pack_nonlinear_non_ox3q1h /\ critical_edge_y y1 /\ &2 <= y2 /\ y2 <= &2 * hminus /\ &2 <= y3 /\ y3 <= &2 * hminus /\ &2 <= y4 /\ y4 <= sqrt8 /\ &2 <= rad2_y y1 y2 y3 y4 y5 y6 /\ &2 <= y5 /\ y5 <= &2 * hminus /\ &2 <= y6 /\ y6 <= &2 * hminus /\ eta_y y1 y2 y6 pow 2 <= #1.34 pow 2 /\ eta_y y1 y3 y5 pow 2 <= #1.34 pow 2 ==> a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6 <= gamma3f y1 y2 y6 sqrt2 lmfun + gamma3f y1 y3 y5 sqrt2 lmfun + (dih_y y1 y2 y3 y4 y5 y6 - (dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2)) * #0.008`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `&2 * hminus <= y1 /\ y1 <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_MESON_TAC[Sphere.critical_edge_y]); MATCH_MP_TAC (arith `y > x ==> x<= y`); INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "TEWNSCJ") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; ASM_REWRITE_TAC[Sphere.ineq;LET_DEF;LET_END_DEF]; ONCE_REWRITE_TAC[TAUT `a \/ b <=> ~b ==> a`]; REWRITE_TAC[DE_MORGAN_THM]; ASM_REWRITE_TAC[Functional_equation.nonf_gamma23_full8_x;Sphere.y_of_x]; REPEAT (GMATCH_SIMP_TAC (GSYM Merge_ineq.gamma3_x_gamma3f)); ASM_SIMP_TAC[Merge_ineq.y_bounds]; REWRITE_TAC[REWRITE_RULE[LET_DEF;LET_END_DEF] (GSYM Sphere.dih_y);GSYM Nonlinear_lemma.sqrt2_sqrt2]; DISCH_THEN MATCH_MP_TAC; COMMENT "deal with assumptions";
ASM_SIMP_TAC [arith `x <= y ==> ~(x > y)`]; ASM_SIMP_TAC [arith `c <= d ==> ~(d < c)`]; FIRST_X_ASSUM_ST `rad2_y` MP_TAC; REWRITE_TAC[Nonlin_def.sqrt2_sqrt2]; REWRITE_TAC[Sphere.rad2_y;Sphere.y_of_x]; BY(REAL_ARITH_TAC) ]);; (* }}} *)
let CC_3_AZIM_LT_PI_COPLANAR = 
prove_by_refinement( `!V u0 u1 w0 n f i . pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ ~cc_4 V u0 u1 f i /\ leaf_rank V [u0; u1] w0 n f /\ azim u0 u1 (f i) (f (SUC i)) < pi ==> ~(coplanar {u0,u1,f i,f (SUC i)})`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY((ASM_REWRITE_TAC[])); REPEAT WEAKER_STRIP_TAC; FIRST_X_ASSUM_ST `coplanar` MP_TAC; REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; ASM_SIMP_TAC[arith `x < y ==> ~(x = y)`]; ASM_SIMP_TAC[Local_lemmas.AZIM_EQ_0_GE_ALT2]; GMATCH_SIMP_TAC Local_lemmas1.DIJ_AFF_GE_PARTITION; REWRITE_TAC[IN_UNION]; ASM_SIMP_TAC[Fan.th3a]; REWRITE_TAC[DE_MORGAN_THM]; CONJ_TAC; MATCH_MP_TAC Fan.th3c; BY(ASM_MESON_TAC[]); DISCH_TAC; TYPIFY `cc_A0 [u0;u1;f i] = cc_A0 [u0;u1;f (SUC i)]` (C SUBGOAL_THEN ASSUME_TAC); REWRITE_TAC[Leaf_cell.cc_A0;Bump.EL_EXPLICIT]; MATCH_MP_TAC Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; BY(ASM_REWRITE_TAC[]); INTRO_TAC Leaf_cell.FCHKUGT [`V`;`u0`;`u1`;`f i`;`f (SUC i)`]; ASM_REWRITE_TAC[]; DISCH_TAC; INTRO_TAC DIST_I_SUCI [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ASM_REWRITE_TAC[DIST_REFL]; BY(REAL_ARITH_TAC) ]);;
(* }}} *)
let real_model_txq = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. ~cc_4 V u0 u1 f i /\ hl [u0; u1; f i] < #1.34 /\ hl [u0; u1; f (SUC i)] < #1.34 /\ #1.946 <= azim_mcell V f u0 u1 i /\ azim_mcell V f u0 u1 i <= #2.089 ==> #3.0 * #0.0057 <= gg_mcell V f u0 u1 i) `,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC real_model_cell23_008 [`V`;`u0`;`u1`;`w0`;`n`;`f`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); TYPIFY `&2 * hminus <= dist (u0,u1) /\ dist(u0,u1) <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; BY((REWRITE_TAC[Sphere.critical_edge_y]) THEN REAL_ARITH_TAC); DISCH_THEN (C INTRO_TAC [`i`]); ASM_REWRITE_TAC[]; MATCH_MP_TAC (arith `a <= l ==> (l <= g ==> a <= g)`); INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; COMMENT "build asm list";
INTRO_TAC JSP_BOUNDS [`u0`;`u1`;`f i`]; INTRO_TAC JSP_BOUNDS [`u0`;`u1`;`f (SUC i)`]; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; REPEAT WEAKER_STRIP_TAC; TYPIFY `azim u0 u1 (f i) (f (SUC i)) < pi` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `#2.089` MP_TAC; ASM_REWRITE_TAC[]; MP_TAC Flyspeck_constants.bounds; BY(REAL_ARITH_TAC); INTRO_TAC CC_3_AZIM_LT_PI_COPLANAR [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); DISCH_TAC; TYPIFY `&0 < delta_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist(f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i))` (C SUBGOAL_THEN ASSUME_TAC); BY(ASM_REWRITE_TAC[GSYM coplanar_delta_y]); COMMENT "simplify goal+"; REPEAT (GMATCH_SIMP_TAC critical_weight1); ASM_REWRITE_TAC[]; ONCE_REWRITE_TAC[DIST_SYM]; ASM_REWRITE_TAC[arith `x * &1 = x`]; TYPIFY `azim u0 u1 (f i) (f (SUC i)) = dih_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist(f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i))` (C SUBGOAL_THEN ASSUME_TAC); GMATCH_SIMP_TAC AZIM_DIHV_SAME; CONJ_TAC; BY(ASM_REWRITE_TAC[]); GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Merge_ineq.DIHV_EQ_DIH_Y); BY(ASM_REWRITE_TAC[]); ASM_REWRITE_TAC[]; REPEAT (FIRST_X_ASSUM_ST `DECIMAL` MP_TAC); ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; COMMENT "import inequality"; INTRO_TAC TXQTPVC_MERGED [`(dist (u0,u1))`;` (dist (u0,f ( i)))`;` (dist (u0,f (SUC i)))`;`dist(f i,f (SUC i))`; ` (dist (u1,f (SUC i)))`;`(dist (u1,f ( i)))`]; ANTS_TAC; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; CONJ_TAC; MATCH_MP_TAC DIST_I_SUCI; BY(ASM_MESON_TAC[]); CONJ_TAC; BY(MESON_TAC[DIST_TRIANGLE;DIST_SYM;arith `x + y = y + x`]); CONJ_TAC; INTRO_TAC RAD_PI_IMP_WEDGE4 [`V`;`f`;`w0`;`n`;`i`;`u0`;`u1`]; ASM_REWRITE_TAC[]; FIRST_X_ASSUM_ST `cc_4` MP_TAC; REWRITE_TAC[cc_4]; DISCH_TAC; DISCH_THEN (MP_TAC o (MATCH_MP (TAUT `(b ==> a) ==> (~a ==> ~b)`))); ANTS_TAC; BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); REWRITE_TAC[arith `~(r < s) <=> s <= r`]; REWRITE_TAC[Sphere.rad2_y;Sphere.y_of_x;arith `x * x = x pow 2`]; GMATCH_SIMP_TAC (GSYM (REWRITE_RULE[LET_DEF;LET_END_DEF] GDRQXLGv3)); ASM_REWRITE_TAC[]; DISCH_TAC; REWRITE_TAC[GSYM Nonlin_def.sqrt2_sqrt2;arith `x * x = x pow 2`]; MATCH_MP_TAC Collect_geom2.POS_IMP_POW2; ASM_REWRITE_TAC[Sphere.sqrt2]; GMATCH_SIMP_TAC SQRT_POS_LE; BY(REAL_ARITH_TAC); CONJ_TAC; MATCH_MP_TAC ETA_Y_LEMMA_ALT; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); MATCH_MP_TAC ETA_Y_LEMMA_ALT; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); COMMENT "match ineq with goal"; MATCH_MP_TAC (arith `(r = r') ==> (&3 * a <= r ==> #3.0 * a <= r')`); MATCH_MP_TAC (arith `(g1 = g1' /\ g2 = g2' /\ d1 = d1' /\ d2 = d2') ==> (g1 + g2 + (d - (d1 + d2))* #0.008 = g1' - #0.008 * d1' + g2' - #0.008 * d2' + #0.008 * d)`); GMATCH_SIMP_TAC mcell3_gammaXb_gamma3f; CONJ_TAC; GEXISTL_TAC [`w0`;`n`]; BY(ASM_REWRITE_TAC[]); GMATCH_SIMP_TAC mcell3_gammaX_gamma3f; CONJ_TAC; GEXISTL_TAC [`w0`;`n`]; BY(ASM_REWRITE_TAC[]); GMATCH_SIMP_TAC mcell3_dihXb_dih_y; CONJ_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlin_def.sqrt2_sqrt2]; GMATCH_SIMP_TAC mcell3_dihX_dih_y; CONJ_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlin_def.sqrt2_sqrt2]; BY(MESON_TAC[Nonlinear_lemma.dih_x_sym]) ]);; (* }}} *)
let real_model_tew = 
prove_by_refinement( `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> (!i. ~cc_4 V u0 u1 f i /\ hl [u0; u1; f i] < #1.34 /\ hl [u0; u1; f (SUC i)] < #1.34 ==> a_spine5 + b_spine5 * azim_mcell V f u0 u1 i <= gg_mcell V f u0 u1 i)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC real_model_cell23_008 [`V`;`u0`;`u1`;`w0`;`n`;`f`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); TYPIFY `&2 * hminus <= dist (u0,u1) /\ dist(u0,u1) <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; BY((REWRITE_TAC[Sphere.critical_edge_y]) THEN REAL_ARITH_TAC); DISCH_THEN (C INTRO_TAC [`i`]); ASM_REWRITE_TAC[]; MATCH_MP_TAC (arith `a <= l ==> (l <= g ==> a <= g)`); INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; ANTS_TAC; BY(ASM_REWRITE_TAC[]); REPEAT WEAKER_STRIP_TAC; ASM_REWRITE_TAC[]; COMMENT "build asm list";
INTRO_TAC JSP_BOUNDS [`u0`;`u1`;`f i`]; INTRO_TAC JSP_BOUNDS [`u0`;`u1`;`f (SUC i)`]; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; REPEAT WEAKER_STRIP_TAC; COMMENT "simplify goal+"; REPEAT (GMATCH_SIMP_TAC critical_weight1); ASM_REWRITE_TAC[]; ONCE_REWRITE_TAC[DIST_SYM]; ASM_REWRITE_TAC[arith `x * &1 = x`]; TYPIFY `a_spine5 + b_spine5 * dih_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) y4 (dist (u1,f (SUC i))) (dist (u1,f i)) <= gammaX V (cc_cell V [u0; u1; f i]) lmfun - #0.008 * dihX V (cc_cell V [u0; u1; f i]) (u0,u1) + gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun - #0.008 * dihX V (cc_cell V [u1; u0; f (SUC i)]) (u0,u1) + #0.008 * dih_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) y4 (dist (u1,f (SUC i))) (dist (u1,f i))` ENOUGH_TO_SHOW_TAC; REWRITE_TAC[Sphere.b_spine5]; REPEAT (FIRST_X_ASSUM_ST `dih_y` MP_TAC); BY(REAL_ARITH_TAC); COMMENT "import inequality"; INTRO_TAC TEWNSCJ_MERGED [`(dist (u0,u1))`;` (dist (u0,f ( i)))`;` (dist (u0,f (SUC i)))`;`y4`; ` (dist (u1,f (SUC i)))`;`(dist (u1,f ( i)))`]; ANTS_TAC; ASM_SIMP_TAC[arith `x < y ==> x <= y`]; ASM_REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]; CONJ_TAC; MATCH_MP_TAC ETA_Y_LEMMA_ALT; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); MATCH_MP_TAC ETA_Y_LEMMA_ALT; BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); COMMENT "match ineq with goal"; MATCH_MP_TAC (arith `(r = r') ==> (a <= r ==> a <= r')`); MATCH_MP_TAC (arith `(g1 = g1' /\ g2 = g2' /\ d1 = d1' /\ d2 = d2') ==> (g1 + g2 + (d - (d1 + d2))* #0.008 = g1' - #0.008 * d1' + g2' - #0.008 * d2' + #0.008 * d)`); GMATCH_SIMP_TAC mcell3_gammaXb_gamma3f; CONJ_TAC; GEXISTL_TAC [`w0`;`n`]; BY(ASM_REWRITE_TAC[]); GMATCH_SIMP_TAC mcell3_gammaX_gamma3f; CONJ_TAC; GEXISTL_TAC [`w0`;`n`]; BY(ASM_REWRITE_TAC[]); GMATCH_SIMP_TAC mcell3_dihXb_dih_y; CONJ_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlin_def.sqrt2_sqrt2]; GMATCH_SIMP_TAC mcell3_dihX_dih_y; CONJ_TAC; BY(ASM_MESON_TAC[]); REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlin_def.sqrt2_sqrt2]; BY(MESON_TAC[Nonlinear_lemma.dih_x_sym]) ]);; (* }}} *) let intro_real_model th = INTRO_TAC th [`V:real^3->bool`;`u0:real^3`;`u1:real^3`;`w0:real^3`;`n:num`;`f:num->real^3`] THEN ANTS_TAC THEN ASM_REWRITE_TAC[] THEN (DISCH_THEN (unlist REWRITE_TAC));;
let cc_real_model_data = 
prove_by_refinement( `!V f w0 n u0 u1. pack_nonlinear_non_ox3q1h /\ ox3q1h /\ 1 < n /\ packing V /\ saturated V /\ s_leaf V [u0; u1] HAS_SIZE n /\ u0 IN V /\ u1 IN V /\ periodic f n /\ ~collinear {u0, u1, w0} /\ critical_edge_y (dist (u0,u1)) /\ leaf_rank V [u0; u1] w0 n f ==> cc_real_model_v11 (cc_data_v8 V f u0 u1)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; REWRITE_TAC[Oxl_def.cc_real_model_v11;cc_real_data;cc_bool_data;cc_card_data;GSYM cc_4;cc_real_dat_def;Oxl_def.cc_eps]; TYPIFY `periodic (azim_mcell V f u0 u1) (CARD (s_leaf V [u0; u1])) /\ periodic (gg_mcell V f u0 u1) (CARD (s_leaf V [u0; u1])) /\ periodic (\i. gammaX V (cc_cell V [u0; u1; f i]) lmfun * critical_weight V (cc_cell V [u0; u1; f i])) (CARD (s_leaf V [u0; u1])) /\ periodic (\i. gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * critical_weight V (cc_cell V [u1; u0; f (SUC i)])) (CARD (s_leaf V [u0; u1]))` (C SUBGOAL_THEN (unlist REWRITE_TAC)); BY(ASM_MESON_TAC[real_periodic_data;HAS_SIZE]); TYPIFY `( 0..CARD (s_leaf V [u0;u1]) - 1) = {i | i < n}` (C SUBGOAL_THEN SUBST1_TAC); BY(ASM_MESON_TAC[NUMSEG_LT;arith `1 < n==> ~(n = 0)`;HAS_SIZE]); REWRITE_TAC[arith `!i. i + 1 = SUC i`]; intro_real_model real_model_ox3q1h_merge; intro_real_model real_model_azim_c4; intro_real_model real_model_gamma_qu; intro_real_model real_model_fhbv2; intro_real_model real_model_fhbv2_sym; intro_real_model real_model_gckb; intro_real_model real_model_sum_azim; intro_real_model real_model_quqy; intro_real_model real_model_quqy_sym; intro_real_model real_model_ztg4; intro_real_model real_model_azim1; intro_real_model real_model_gaz4; intro_real_model real_model_gaz6; intro_real_model real_model_gamma_qx; intro_real_model real_model_g_qxd; intro_real_model real_model_gamma10; intro_real_model real_model_gamma11; intro_real_model real_model_gamma8; intro_real_model real_model_gamma8b; intro_real_model real_model_gaz9; intro_real_model real_model_azim2; intro_real_model real_model_cell23; intro_real_model real_model_3a; intro_real_model real_model_3b; intro_real_model real_model_gr; intro_real_model real_model_pema; intro_real_model real_model_pemb; intro_real_model real_model_tew; BY(intro_real_model real_model_txq) ]);;
(* }}} *)
let CELL_CLUSTER_ESTIMATE_PROPS = 
prove_by_refinement( `!V. packing V /\ saturated V /\ ~cell_cluster_estimate_v1 V /\ pack_nonlinear_non_ox3q1h /\ ox3q1h ==> (?u0 u1 n f. 1 < n /\ sum {i | i < n} (gg_mcell V f (u0) (u1)) < &0 /\ n = cc_card_v11 (cc_data_v8 V f u0 u1) /\ cc_bool_model_v11 (cc_data_v8 V f u0 u1) /\ cc_bool_prep_v11 (cc_data_v8 V f u0 u1) /\ cc_real_model_v11 (cc_data_v8 V f u0 u1))`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC (* Oxlzlez. *)LEAF_RANK_PROPS [`V`]; ASM_REWRITE_TAC[HAS_SIZE;(* Oxlzlez. *)cc_card_data]; REPEAT WEAKER_STRIP_TAC; GEXISTL_TAC [`u0`;`u1`;`n`;`f`]; ASM_REWRITE_TAC[]; MATCH_MP_TAC (* Oxlzlez. *)cc_real_model_data; GEXISTL_TAC [`w0`;`n`]; BY((ASM_REWRITE_TAC[HAS_SIZE])) ]);;
(* }}} *)
let OXLZLEZ = 
prove_by_refinement( `!V. pack_nonlinear_non_ox3q1h /\ ox3q1h /\ packing V /\ saturated V ==> cell_cluster_estimate_v1 V`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; PROOF_BY_CONTR_TAC; INTRO_TAC CELL_CLUSTER_ESTIMATE_PROPS [`V`]; ASM_REWRITE_TAC[]; REPEAT WEAKER_STRIP_TAC; INTRO_TAC Oxl_2012.GRHIDFA [`cc_data_v8 V f u0 u1`]; ASM_REWRITE_TAC[(* Oxlzlez. *)cc_real_data]; TYPIFY_GOAL_THEN `(0..(n-1)) = {i | i < n}` (unlist ASM_MESON_TAC); REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG]; BY(ASM_TAC THEN ARITH_TAC) ]);;
(* }}} *)
let PACKING_CHAPTER_MAIN_CONCLUSION = 
prove_by_refinement( `~kepler_conjecture /\ pack_nonlinear_non_ox3q1h /\ ox3q1h ==> (?V. packing V /\ V SUBSET ball_annulus /\ ~lmfun_ineq_center V)`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC Rdwkarc.RDWKARC; ASM_REWRITE_TAC[]; CONJ_TAC; REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC OXLZLEZ; BY(ASM_REWRITE_TAC[]); REWRITE_TAC[Pack_concl.TSKAJXY_statement]; REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC Tskajxy.TSKAJXY; BY(ASM_REWRITE_TAC[]) ]);;
(* }}} *) end;;