(* ========================================================================== *)
(* FLYSPECK - BOOK FORMALIZATION                                              *)
(*                                                                            *)
(* Chapter: Local Fan                                              *)
(* Author: Hoang Le Truong                                        *)
(* Date: 2012-04-01                                                           *)
(* ========================================================================= *)


(*
remaining conclusions from appendix to Local Fan chapter
*)


module Imjxphr = struct


open Polyhedron;;
open Sphere;;
open Topology;;		
open Fan_misc;;
open Planarity;; 
open Conforming;;
open Hypermap;;
open Fan;;
open Topology;;
open Wrgcvdr_cizmrrh;;
open Local_lemmas;;
open Collect_geom;;
open Dih2k_hypermap;;
open Wjscpro;;
open Tecoxbm;;
open Hdplygy;;
open Nkezbfc_local;;
open Flyspeck_constants;;
open Gbycpxs;;
open Pcrttid;;
open Local_lemmas1;;
open Pack_defs;;

open Hales_tactic;;

open Appendix;;





open Hypermap;;
open Fan;;
open Wrgcvdr_cizmrrh;;
open Local_lemmas;;
open Flyspeck_constants;;
open Pack_defs;;

open Hales_tactic;;

open Appendix;;


open Zithlqn;;


open Xwitccn;;

open Ayqjtmd;;

open Jkqewgv;;


open Mtuwlun;;


open Uxckfpe;;
open Sgtrnaf;;

open Yxionxl;;

open Qknvmlb;;
open Odxlstcv2;;

open Yxionxl2;;
open Eyypqdw;;
open Ocbicby;;


let v3_defor_v4=new_definition`v3_defor_v4 a x1 x2 x6 v1 w v t= 
if v= w then (v3_defor_v1 a v1 w x1 x2 x6 x6 (x2-t)) else v`;;
let FUN_V3_DEFOR=
prove(`v3_defor_v4 a x1 x2 x6 v1 w v = (\t. v3_defor_v4 a x1 x2 x6 v1 w v t)`,
REWRITE_TAC[FUN_EQ_THM]);;
let BBS_IMP_CONVEX_LOCAL_FAN=
prove(` 3<k/\ scs_k_v39 s =k /\ BBs_v39 s w ==> convex_local_fan (IMAGE w (:num),IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num),IMAGE (\i. w i,w (SUC i)) (:num))`,
STRIP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN RESA_TAC);;
let MOD_ADD_SUB_1=
prove(`1<k==> ~((l+k-1) MOD k= l MOD k)`,
STRIP_TAC THEN MP_TAC(ARITH_RULE`1<k==> ~(k=0)/\ 1 + l + k - 1=1*k+l/\ 1+l= SUC(l)`) THEN RESA_TAC THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`] THEN MRESA_TAC (Ocbicby.MOD_EQ_MOD_SHIFT)[`k:num`;`l+k-1`;`l:num`;`1`] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN ASM_SIMP_TAC[Qknvmlb.SUC_MOD_NOT_EQ]);;
let UPS_X_POS_SEG=
prove(`~(collinear{vec 0,v1,v2:real^3}) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ &0< x2 ==> ?e. &0< e/\ (!t. -- e< t/\ t< e ==> &0< ups_x x1 (x2-t) x6/\ &0< x2-t)`,
STRIP_TAC THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v2:real^3`] THEN MRESAL_TAC (GEN_ALL Trigonometry1.DIST_UPS_X_POS)[`vec 0:real^3`;`v1:real^3`;`v2:real^3`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG] THEN MRESAL_TAC Collect_geom.FHFMKIY[`vec 0:real^3`;`v1:real^3`;`v2:real^3`;`x1:real`;`x2:real`;`x6:real`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG] THEN MP_TAC LIFT_UPS_CONTINUOUS THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[continuous_atreal;o_DEF;DIST_LIFT] THEN ABBREV_TAC`a=ups_x x1 x2 x6` THEN ABBREV_TAC`b= min a x2` THEN MP_TAC(REAL_ARITH`&0<= a/\ ~(a= &0)/\ &0<x2/\ b=min a x2 ==> &0<b/ &2/\ &0< a- b/ &2`) THEN RESA_TAC THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`b/ &2`]) THEN EXISTS_TAC`min d x2:real` THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`&0<d/\ &0< x2==> &0< min d x2`) THEN RESA_TAC THEN GEN_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> STRIP_TAC THEN STRIP_TAC THEN MRESA_TAC th[`x2-t:real`]) THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[GSYM REAL_ABS_BETWEEN;REAL_ARITH`x2 - d < x2 - t<=> t<d`; REAL_ARITH`x2 - t < x2 + d<=> --d<t`;REAL_ARITH`a- a/ &2=a/ &2`] THEN MP_TAC(REAL_ARITH`--min d x2<t /\ t< min d x2/\ &0<x2 ==> t < d /\ --d < t/\ &0< x2-t`) THEN RESA_TAC THEN ASM_TAC THEN REAL_ARITH_TAC);;
let UPS_X_POS_SEG_C=
prove(`~(collinear{vec 0,v1,v2:real^3}) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ &0< x2/\ &0<c ==> ?e. &0< e/\ (!t. -- e< t/\ t< e ==> &0< ups_x x1 (x2-t) x6/\ &0< x2-t/\ t<c)`,
STRIP_TAC THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v2:real^3`] THEN MRESAL_TAC (GEN_ALL Trigonometry1.DIST_UPS_X_POS)[`vec 0:real^3`;`v1:real^3`;`v2:real^3`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG] THEN MRESAL_TAC Collect_geom.FHFMKIY[`vec 0:real^3`;`v1:real^3`;`v2:real^3`;`x1:real`;`x2:real`;`x6:real`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG] THEN MP_TAC LIFT_UPS_CONTINUOUS THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[continuous_atreal;o_DEF;DIST_LIFT] THEN ABBREV_TAC`a=ups_x x1 x2 x6` THEN ABBREV_TAC`b= (min a x2) ` THEN MP_TAC(REAL_ARITH`&0<= a/\ ~(a= &0)/\ &0<x2/\ b=(min a x2) ==> &0<b/ &2/\ &0< a- b/ &2`) THEN RESA_TAC THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`b/ &2`]) THEN ABBREV_TAC`e1=min (min d x2) c/ &2` THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`&0<d/\ &0< x2/\ &0< c/\ e1=min (min d x2) c/ &2 ==> &0<e1/\ e1<c/\ e1<d/\ e1<x2`) THEN RESA_TAC THEN GEN_TAC THEN REPLICATE_TAC (24-19) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`x2-t:real`]) THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[GSYM REAL_ABS_BETWEEN;REAL_ARITH`x2 - d < x2 - t<=> t<d`; REAL_ARITH`x2 - t < x2 + d<=> --d<t`;REAL_ARITH`a- a/ &2=a/ &2`] THEN MP_TAC(REAL_ARITH`--e1<t /\ t<e1/\ &0<d/\ &0<e1/\ e1<d/\ e1<x2/\ e1<c==> t < d /\ --d < t/\ &0< x2-t/\ t<c`) THEN RESA_TAC THEN ASM_TAC THEN REAL_ARITH_TAC);;
let V3_DEFOR_V1_O_DEF=
prove(`(\t. v3_defor_v1 a v1 w x1 x2 x6 x6 (x2 - t)) = (\x3. v3_defor_v1 a v1 w x1 x2 x6 x6 x3) o (\t. x2-t)`,
REWRITE_TAC[o_DEF]);;
let V3_DEFOR_ID=
prove(`&0< x1/\ ~(collinear{vec 0,v1,w:real^3})/\ norm v1 pow 2 = x1/\ norm w pow 2 =x2/\ norm(v1-w) pow 2=x6 /\ a = -- &1 ==> v3_defor_v1 a v1 w x1 x2 x6 x6 (x2 - &0) = w`,
STRIP_TAC THEN ASM_REWRITE_TAC[v3_defor_v1;CROSS_LAGRANGE;REAL_ARITH`A- &0=A`] THEN ASM_REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL; DOT_RMUL;DOT_CROSS_SELF;REAL_ARITH`A* &0= &0/\ A+ &0=A/\ &0 +A=A`;DOT_CROSS;REAL_INV_MUL;CROSS_LAGRANGE;CROSS_LADD;VECTOR_ARITH`A-B=A+(--B):real^3/\ a % vec 0= vec 0 /\ vec 0 +A=A`;CROSS_LMUL;CROSS_REFL;CROSS_LADD;CROSS_LNEG;DOT_SQUARE_NORM;o_DEF] THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`w:real^3`] THEN MRESAL_TAC (GEN_ALL Trigonometry1.DIST_UPS_X_POS)[`vec 0:real^3`;`v1:real^3`;`w:real^3`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG] THEN MRESAL_TAC Collect_geom.FHFMKIY[`vec 0:real^3`;`v1:real^3`;`w:real^3`;`x1:real`;`x2:real`;`x6:real`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG] THEN ASM_TAC THEN REWRITE_TAC[GSYM DOT_SQUARE_NORM] THEN ASM_REWRITE_TAC[DOT_LSUB;DOT_RSUB;DOT_LMUL; DOT_RMUL;DOT_CROSS_SELF;REAL_ARITH`A* &0= &0/\ A+ &0=A/\ &0 +A=A`;DOT_CROSS;REAL_INV_MUL;] THEN REPEAT RESA_TAC THEN MRESA_TAC DOT_SYM[`w:real^3`;`v1:real^3`] THEN REPLICATE_TAC (13-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[REAL_ARITH`x1 - v1 dot v2 - (v1 dot v2 - x2) = x6 <=> v1 dot v2 = (x1 + x2 - x6)/ &2`;REAL_ARITH`a*a *b=a pow 2 *b/\ A- &0=A/\ (a*b) pow 2=a pow 2 * b pow 2`;REAL_INV_MUL] THEN RESA_TAC THEN MRESA_TAC REAL_MUL_LINV[`ups_x x1 x2 x6`] THEN MRESAL_TAC SQRT_UNIQUE[`&1`;`&1`][REAL_ARITH`&0<= &1/\ &1 pow 2= &1`] THEN REWRITE_TAC[VECTOR_ARITH`((inv (&2) * inv x1) * (x1 + x2 - x6)) % v1 + (inv x1 * -- &1 * &1) % ((x1 + x2 - x6) / &2 % v1 + --(x1 % w)) = (inv x1 *x1) % w`] THEN MP_TAC(REAL_ARITH`&0< x1==> ~(x1= &0)`) THEN RESA_TAC THEN MRESA_TAC REAL_MUL_LINV[`x1:real`] THEN VECTOR_ARITH_TAC);;
let V3_DEFOR_DEFORMATION=
prove_by_refinement(` &0< x1 /\ &0<x2 /\ &0<x4 /\ &0<x5 /\ &0< x6 /\ ~(collinear{vec 0,v1,w:real^3})/\ norm v1 pow 2 = x1/\ norm w pow 2 =x2/\ norm(v1-w) pow 2=x6 /\ a= -- &1 ==> (?e. &0<e /\ deformation (v3_defor_v4 a x1 x2 x6 v1 w) V (-- e,e))`,
[REWRITE_TAC[deformation;real_interval;IN_ELIM_THM;REAL_ARITH`(-- &1 < &0 /\ &0 < &1)`] THEN STRIP_TAC THEN MRESA_TAC(GEN_ALL UPS_X_POS_SEG)[`v1:real^3`;`w:real^3`;`x1:real`;`x6:real`;`x2:real`] THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`&0< e==> -- e< &0`) THEN RESA_TAC THEN STRIP_TAC; REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[FUN_V3_DEFOR] THEN REWRITE_TAC[v3_defor_v4] THEN MP_TAC(SET_RULE`v=w:real^3\/ ~(v=w)`) THEN RESA_TAC; REWRITE_TAC[V3_DEFOR_V1_O_DEF] THEN MATCH_MP_TAC CONTINUOUS_REAL_CONTINUOUS_ATREAL_COMPOSE THEN STRIP_TAC; MATCH_MP_TAC REAL_CONTINUOUS_SUB THEN ASM_SIMP_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_ID]; MATCH_MP_TAC CONTINUOUS_ATREAL_WITHINREAL THEN REWRITE_TAC[] THEN MATCH_MP_TAC EYYPQDW_CONTINUOUS_AT_X THEN ASM_REWRITE_TAC[] THEN REPLICATE_TAC (16-11) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`r:real`]) THEN REWRITE_TAC[SET_RULE`a IN{a,b}`]; ASM_SIMP_TAC[CONTINUOUS_CONST;REAL_CONTINUOUS_AT_ID]; REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[FUN_V3_DEFOR] THEN REWRITE_TAC[v3_defor_v4] THEN MP_TAC(SET_RULE`v=w:real^3\/ ~(v=w)`) THEN RESA_TAC; MATCH_MP_TAC V3_DEFOR_ID THEN ASM_REWRITE_TAC[]]);;
let V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION=
prove_by_refinement(`&0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1/\ v2 IN ball_annulus/\ ~(norm v2 = &2) ==> ?e. &0< e/\ (!t. &0<t/\ t< e==> v3_defor_v4 a x1 x2 x6 v1 v2 v2 t IN ball_annulus)`,
[ REWRITE_TAC[ball_annulus;cball;DIFF;ball;IN_ELIM_THM;dist; VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a<b)<=> b<= a`] THEN STRIP_TAC THEN MRESAL_TAC (GEN_ALL NORM_GE_SQUARE)[`&2`;`v2:real^3`][REAL_ARITH`~(&2<= &0)/\ (a>=b<=> b<=a)`] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[DOT_SQUARE_NORM] THEN MRESAL_TAC (GEN_ALL NORM_EQ_SQUARE)[`&2`;`v2:real^3`][REAL_ARITH`(&0<= &2)/\ (a>=b<=> b<=a)`] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[DOT_SQUARE_NORM] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&2 pow 2 <= x2 /\ ~(x2= &2 pow 2)==> &0 < (x2- &4)/ &2 `) THEN RESA_TAC THEN MRESA_TAC (GEN_ALL UPS_X_POS_SEG_C)[`v1:real^3`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`(x2- &4)/ &2`] THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[v3_defor_v4] THEN GEN_TAC THEN POP_ASSUM(fun th-> STRIP_TAC THEN MP_TAC(REAL_ARITH`&0< e/\ &0<t==> --e<t`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORMV3)[`x2:real`;`-- &1`;`x2:real`;`x6:real`;`x1:real`;`x6:real`;`v1:real^3`;`v2:real^3`;`v3_defor_v1 (-- &1) v1 (v2:real^3) x1 x2 x6 x6 (x2 - t)`;`x2-t:real`][SET_RULE`a IN{a,b}`;v3_defor_v1] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM v3_defor_v1] THEN ASM_TAC THEN REWRITE_TAC[NORM_LE_SQUARE;NORM_GE_SQUARE] THEN ASM_REWRITE_TAC[DOT_SQUARE_NORM] THEN REPEAT RESA_TAC; ASM_TAC THEN REAL_ARITH_TAC; ASM_TAC THEN REWRITE_TAC[REAL_ARITH`~(&2<= &0)/\ (a<=b<=> b>=a)`;NORM_GE_SQUARE] THEN REPEAT RESA_TAC THEN ASM_REWRITE_TAC[DOT_SQUARE_NORM] THEN ASM_TAC THEN REAL_ARITH_TAC]);;
let NORM_POS_COLLINEAR=
prove(`~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 ==> &0< x1 /\ &0<x2 /\ &0< x6`,
STRIP_TAC THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v2:real^3`] THEN MP_TAC(REAL_ARITH`&0<= norm (v1:real^3) pow 2==> norm v1 pow 2 = &0 \/ &0<norm v1 pow 2`) THEN REWRITE_TAC[REAL_LE_POW_2] THEN REWRITE_TAC[GSYM DOT_SQUARE_NORM] THEN STRIP_TAC THEN MRESAL_TAC (GEN_ALL NORM_EQ_SQUARE)[`&0`;`v1:real^3`][REAL_ARITH`&0<= &0/\ &0 pow 2= &0`;NORM_EQ_0] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[DOT_SQUARE_NORM] THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0<= norm (v2:real^3) pow 2==> norm v2 pow 2 = &0 \/ &0<norm v2 pow 2`) THEN REWRITE_TAC[REAL_LE_POW_2] THEN REWRITE_TAC[GSYM DOT_SQUARE_NORM] THEN STRIP_TAC THEN MRESAL_TAC (GEN_ALL NORM_EQ_SQUARE)[`&0`;`v2:real^3`][REAL_ARITH`&0<= &0/\ &0 pow 2= &0`;NORM_EQ_0] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[DOT_SQUARE_NORM] THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0<= norm (v1-v2:real^3) pow 2==> norm (v1-v2) pow 2 = &0 \/ &0<norm (v1-v2) pow 2`) THEN REWRITE_TAC[REAL_LE_POW_2] THEN REWRITE_TAC[GSYM DOT_SQUARE_NORM] THEN STRIP_TAC THEN MRESAL_TAC (GEN_ALL NORM_EQ_SQUARE)[`&0`;`v1-v2:real^3`][REAL_ARITH`&0<= &0/\ &0 pow 2= &0`;NORM_EQ_0] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b= vec 0<=> a=b`] THENL[ MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN ASM_REWRITE_TAC[] THEN RESA_TAC; POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[DOT_SQUARE_NORM] THEN RESA_TAC]);;
let HYPER_MM_COLLINEAR=
prove_by_refinement(`scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ 3<k/\ w l=v2/\ w (SUC l) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 ==> &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3}) `,
[REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;] THEN STRIP_TAC THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` THEN ASM_TAC THEN RESA_TAC THEN REPEAT DISCH_TAC; ASM_TAC THEN ARITH_TAC; SUBGOAL_THEN`((v2,v1):real^3#real^3) IN FF`ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`]; MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN STRIP_TAC THEN MP_TAC NORM_POS_COLLINEAR THEN RESA_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[]]);;
let EYYPQDW_CONTINUOUS_LIFT_DIST=
prove(`&0< x1 /\ &0<x2 /\ &0< x3 /\ &0<x4 /\ &0<x5 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a IN {-- &1, &1} /\ &0< ups_x x1 x3 x5 ==> lift o (\x3. dist(v3_defor_v1 a v1 v2 x1 x2 x5 x6 x3,v)) continuous atreal (x3)`,
REPEAT STRIP_TAC THEN SUBGOAL_THEN`lift o(\x3. dist(v3_defor_v1 a v1 v2 x1 x2 x5 x6 x3,v))= (lift o (\x. dist(x,v))) o(\x3. v3_defor_v1 a v1 v2 x1 x2 x5 x6 x3)`ASSUME_TAC THENL[ REWRITE_TAC[o_DEF]; ASM_REWRITE_TAC[] THEN MATCH_MP_TAC CONTINUOUS_ATREAL_COMPOSE THEN MP_TAC EYYPQDW_CONTINUOUS_AT_X THEN ASM_REWRITE_TAC[] THEN RESA_TAC THEN MATCH_MP_TAC CONTINUOUS_AT_WITHIN THEN ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_SIMP_TAC[CONTINUOUS_AT_LIFT_DIST]]);;
let EXISTS_SMALL_LE_CONST=
prove(`&0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a = -- &1 /\ c< dist(v2,w) ==> ?e. &0< e /\ (!t. &0<t /\ t<e ==> c<dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w))`,
STRIP_TAC THEN MP_TAC UPS_X_POS_SEG THEN RESA_TAC THEN POP_ASSUM (fun th-> MRESAL_TAC th[`&0`][REAL_ARITH`(--a< &0<=> &0<a)/\ a- &0=a`] THEN ASSUME_TAC th) THEN MRESAL_TAC (GEN_ALL V3_DEFOR_ID)[`a:real`;`v1:real^3`;`x1:real`;`x6:real`;`x2:real`;`v2:real^3`][REAL_ARITH`(--a< &0<=> &0<a)/\ a- &0=a`] THEN MP_TAC(REAL_ARITH`c< dist(v2,w:real^3)==> &0< (dist(v2,w:real^3)- c )/ &2/\ c< dist (v2,w) - (dist (v2,w) - c) / &2`) THEN RESA_TAC THEN MRESAL_TAC (GEN_ALL EYYPQDW_CONTINUOUS_LIFT_DIST)[`x2:real`;`a:real`;`v1:real^3`;`v2:real^3`;`x1:real`;`x2:real`;`x6:real`;`x6:real`;`w:real^3`;`x2:real`][SET_RULE`A IN {A, B}`;continuous_atreal;DIST_LIFT;o_DEF;GSYM REAL_ABS_BETWEEN] THEN POP_ASSUM (fun th-> MRESA_TAC th[`(dist(v2,w:real^3)- c )/ &2`]) THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN EXISTS_TAC`d:real` THEN ASM_REWRITE_TAC[] THEN GEN_TAC THEN POP_ASSUM(fun th-> STRIP_TAC THEN MP_TAC(REAL_ARITH` &0< d/\ &0<t ==> --d<t`) THEN RESA_TAC THEN MRESAL_TAC th[`x2-t:real`][REAL_ARITH`x2 - d < x2 - t /\ x2 - t < x2 + d <=> --d<t/\ t<d`]) THEN ASM_TAC THEN REAL_ARITH_TAC);;
let EXISTS_SMALL_LE_CONST_V1=
prove(`&0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a = -- &1 /\ c< dist(v2,w) ==> ?e. &0< e /\ (!t. --e<t /\ t<e ==> c<dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w))`,
STRIP_TAC THEN MP_TAC UPS_X_POS_SEG THEN RESA_TAC THEN POP_ASSUM (fun th-> MRESAL_TAC th[`&0`][REAL_ARITH`(--a< &0<=> &0<a)/\ a- &0=a`] THEN ASSUME_TAC th) THEN MRESAL_TAC (GEN_ALL V3_DEFOR_ID)[`a:real`;`v1:real^3`;`x1:real`;`x6:real`;`x2:real`;`v2:real^3`][REAL_ARITH`(--a< &0<=> &0<a)/\ a- &0=a`] THEN MP_TAC(REAL_ARITH`c< dist(v2,w:real^3)==> &0< (dist(v2,w:real^3)- c )/ &2/\ c< dist (v2,w) - (dist (v2,w) - c) / &2`) THEN RESA_TAC THEN MRESAL_TAC (GEN_ALL EYYPQDW_CONTINUOUS_LIFT_DIST)[`x2:real`;`a:real`;`v1:real^3`;`v2:real^3`;`x1:real`;`x2:real`;`x6:real`;`x6:real`;`w:real^3`;`x2:real`][SET_RULE`A IN {A, B}`;continuous_atreal;DIST_LIFT;o_DEF;GSYM REAL_ABS_BETWEEN] THEN POP_ASSUM (fun th-> MRESA_TAC th[`(dist(v2,w:real^3)- c )/ &2`]) THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN EXISTS_TAC`d:real` THEN ASM_REWRITE_TAC[] THEN GEN_TAC THEN POP_ASSUM(fun th-> STRIP_TAC THEN MRESAL_TAC th[`x2-t:real`][REAL_ARITH`x2 - d < x2 - t /\ x2 - t < x2 + d <=> --d<t/\ t<d`]) THEN ASM_TAC THEN REAL_ARITH_TAC);;
let DEFORMATION_DIST_LE_V3_DEFOR_A=
prove(`is_scs_v39 s /\ MMs_v39 s w /\ scs_k_v39 s =k/\ 3<k /\ w l=v2/\ w (SUC l) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ (!i. ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k) ==> scs_a_v39 s l i < dist (v2,w i)) ==> (!i. ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k) ==> ?e. &0< e/\ (!t. &0< t/\ t< e ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)))`,
STRIP_TAC THEN MP_TAC HYPER_MM_COLLINEAR THEN RESA_TAC THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST THEN ASM_REWRITE_TAC[] THEN REPLICATE_TAC (16-10)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`i:num`]));;
let DEFORMATION_DIST_LE_V3_DEFOR_A_COM=
prove_by_refinement(`is_scs_v39 s /\ MMs_v39 s w /\ scs_k_v39 s =k/\ 3<k /\ w l=v2/\ w (SUC l) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ (!i. ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k) ==> scs_a_v39 s l i < dist (v2,w i)) ==> ?e. &0< e/\ (!t i. &0< t/\ t< e /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k) ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i))`,
[ REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] THEN REWRITE_TAC[SKOLEM_THM] THEN STRIP_TAC THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}` THEN EXISTS_TAC`e1:real` THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`ASSUME_TAC; MATCH_MP_TAC FINITE_SUBSET THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` THEN STRIP_TAC; MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG]; REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_ELIM_THM] THEN GEN_TAC THEN RESA_TAC THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN REPLICATE_TAC (16-12)(POP_ASSUM MP_TAC) THEN ARITH_TAC; SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)} = {})`ASSUME_TAC; REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(l MOD k =0)`) THEN RESA_TAC; EXISTS_TAC`(e:num->real)1` THEN EXISTS_TAC`1` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 1<k/\ 2<k /\ ~(k=0)/\ SUC 1=2/\ ~(0=1)/\ ~(0=2)`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESA_TAC MOD_LT[`2`;`k:num`]; MP_TAC(SET_RULE`l MOD k=1\/ ~(l MOD k= 1 )`) THEN RESA_TAC; EXISTS_TAC`(e:num->real)2` THEN EXISTS_TAC`2` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 1<k/\ 2<k /\ ~(k=0)/\ SUC 1=2/\ ~(1=2)/\ ~(1=3)/\ SUC 2=3`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`2`;`k:num`] THEN MRESA_TAC MOD_LT[`3`;`k:num`]; EXISTS_TAC`(e:num->real)0` THEN EXISTS_TAC`0` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 0<k/\ 1<k /\ ~(k=0)/\ SUC 1=2/\ ~(1=2)/\ ~(1=3)/\ SUC 0=1`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`0`;`k:num`] THEN MRESA_TAC MOD_LT[`1`;`k:num`]; STRIP_TAC; MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`;`&0`] THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT RESA_TAC THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] THEN REPLICATE_TAC (20-11) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`]); REPEAT STRIP_TAC THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`;`t:real`] THEN POP_ASSUM MP_TAC THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`ASSUME_TAC; REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`i MOD k` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ 1<k`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`i:num`;`k:num`] THEN MRESA_TAC MOD_LT[`i MOD k`;`k:num`] THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`k:num`][GSYM ADD1]; STRIP_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ 1<k`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`i:num`;`k:num`] THEN MRESA_TAC MOD_LT[`i MOD k`;`k:num`] THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`k:num`][GSYM ADD1] THEN REPLICATE_TAC (27-11) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num MOD k`]) THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`])]);;
let DEFORMATION_DIST_LE_V3_DEFOR_A_SUC=
prove(`is_scs_v39 s /\ MMs_v39 s w /\ scs_k_v39 s =k/\ 3<k /\ w l=v2/\ w (SUC l) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ (!i. ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k) ==> scs_a_v39 s l i < dist (v2,w i)) ==> (!i. ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k) ==> ?e. &0< e/\ (!t. &0< t/\ t< e ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)))`,
STRIP_TAC THEN MP_TAC HYPER_MM_COLLINEAR THEN RESA_TAC THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST THEN ASM_REWRITE_TAC[] THEN REPLICATE_TAC (16-10)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`i:num`]));;
let DEFORMATION_DIST_LE_V3_DEFOR_A_COM_SUC=
prove_by_refinement( `is_scs_v39 s /\ MMs_v39 s w /\ scs_k_v39 s =k/\ 3<k /\ w l=v2/\ w (SUC l) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ (!i. ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k) ==> scs_a_v39 s l i < dist (v2,w i)) ==> ?e. &0< e/\ (!t i. &0< t/\ t< e /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k) ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i))`,
[ REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_SUC THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] THEN REWRITE_TAC[SKOLEM_THM] THEN STRIP_TAC THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}` THEN EXISTS_TAC`e1:real` THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`ASSUME_TAC; MATCH_MP_TAC FINITE_SUBSET THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` THEN STRIP_TAC; MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG]; REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_ELIM_THM] THEN GEN_TAC THEN RESA_TAC THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN REPLICATE_TAC (16-12)(POP_ASSUM MP_TAC) THEN ARITH_TAC; SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)} = {})`ASSUME_TAC; REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(l MOD k =0)`) THEN RESA_TAC; EXISTS_TAC`(e:num->real)2` THEN EXISTS_TAC`2` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 0<k/\ 1<k/\ 2<k /\ ~(k=0)/\ SUC 1=2/\ ~(0=1)/\ ~(0=2)/\ SUC 0=1/\ ~(1=2)`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`0`;`k:num`] THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESA_TAC MOD_LT[`2`;`k:num`] THEN MRESA_TAC (GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`l:num`;`0:num`;`k:num`]; MP_TAC(SET_RULE`l MOD k=1\/ ~(l MOD k= 1 )`) THEN RESA_TAC; EXISTS_TAC`(e:num->real)3` THEN EXISTS_TAC`3` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 0<k/\ 1<k/\ 2<k/\ 3<k /\ ~(k=0)/\ SUC 1=2/\ ~(0=1)/\ ~(0=2)/\ SUC 0=1/\ ~(1=2)/\ ~(1=3)/\ ~(2=3)`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`0`;`k:num`] THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESA_TAC MOD_LT[`2`;`k:num`] THEN MRESA_TAC MOD_LT[`3`;`k:num`] THEN MRESA_TAC (GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`l:num`;`1:num`;`k:num`]; EXISTS_TAC`(e:num->real)1` THEN EXISTS_TAC`1` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 0<k/\ 1<k/\ 2<k/\ 3<k /\ ~(k=0)/\ SUC 1=2/\ ~(0=1)/\ ~(0=2)/\ SUC 0=1/\ ~(1=2)/\ ~(1=3)/\ ~(2=3)`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`0`;`k:num`] THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESA_TAC MOD_LT[`2`;`k:num`] THEN MRESA_TAC MOD_LT[`3`;`k:num`] THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`l:num`;`0:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`]; STRIP_TAC; MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`;`&0`] THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT RESA_TAC THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] THEN REPLICATE_TAC (20-11) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`]); REPEAT STRIP_TAC THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`;`t:real`] THEN POP_ASSUM MP_TAC THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`ASSUME_TAC; REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`i MOD k` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ 1<k`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`i:num`;`k:num`] THEN MRESA_TAC MOD_LT[`i MOD k`;`k:num`] THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`k:num`][GSYM ADD1]; STRIP_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ 1<k`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`i:num`;`k:num`] THEN MRESA_TAC MOD_LT[`i MOD k`;`k:num`] THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`k:num`][GSYM ADD1] THEN REPLICATE_TAC (27-11) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num MOD k`]) THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`])]);;
(***SCS_B***)
let EXISTS_SMALL_LT_CONST=
prove(`&0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a = -- &1 /\ dist(v2,w)<c ==> ?e. &0< e /\ (!t. &0<t /\ t<e ==> dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w)<c)`,
STRIP_TAC THEN MP_TAC UPS_X_POS_SEG THEN RESA_TAC THEN POP_ASSUM (fun th-> MRESAL_TAC th[`&0`][REAL_ARITH`(--a< &0<=> &0<a)/\ a- &0=a`] THEN ASSUME_TAC th) THEN MRESAL_TAC (GEN_ALL V3_DEFOR_ID)[`a:real`;`v1:real^3`;`x1:real`;`x6:real`;`x2:real`;`v2:real^3`][REAL_ARITH`(--a< &0<=> &0<a)/\ a- &0=a`] THEN MP_TAC(REAL_ARITH`dist(v2,w:real^3)<c==> &0< (c-dist(v2,w:real^3))/ &2/\ dist (v2,w) + (c-dist (v2,w) ) / &2<c`) THEN RESA_TAC THEN MRESAL_TAC (GEN_ALL EYYPQDW_CONTINUOUS_LIFT_DIST)[`x2:real`;`a:real`;`v1:real^3`;`v2:real^3`;`x1:real`;`x2:real`;`x6:real`;`x6:real`;`w:real^3`;`x2:real`][SET_RULE`A IN {A, B}`;continuous_atreal;DIST_LIFT;o_DEF;GSYM REAL_ABS_BETWEEN] THEN POP_ASSUM (fun th-> MRESA_TAC th[`(c-dist(v2,w:real^3))/ &2`]) THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN EXISTS_TAC`d:real` THEN ASM_REWRITE_TAC[] THEN GEN_TAC THEN POP_ASSUM(fun th-> STRIP_TAC THEN MP_TAC(REAL_ARITH` &0< d/\ &0<t ==> --d<t`) THEN RESA_TAC THEN MRESAL_TAC th[`x2-t:real`][REAL_ARITH`x2 - d < x2 - t /\ x2 - t < x2 + d <=> --d<t/\ t<d`]) THEN ASM_TAC THEN REAL_ARITH_TAC);;
let EXISTS_SMALL_LT_CONST_V1=
prove(`&0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a = -- &1 /\ dist(v2,w)<c ==> ?e. &0< e /\ (!t. --e <t /\ t<e ==> dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w)<c)`,
STRIP_TAC THEN MP_TAC UPS_X_POS_SEG THEN RESA_TAC THEN POP_ASSUM (fun th-> MRESAL_TAC th[`&0`][REAL_ARITH`(--a< &0<=> &0<a)/\ a- &0=a`] THEN ASSUME_TAC th) THEN MRESAL_TAC (GEN_ALL V3_DEFOR_ID)[`a:real`;`v1:real^3`;`x1:real`;`x6:real`;`x2:real`;`v2:real^3`][REAL_ARITH`(--a< &0<=> &0<a)/\ a- &0=a`] THEN MP_TAC(REAL_ARITH`dist(v2,w:real^3)<c==> &0< (c-dist(v2,w:real^3))/ &2/\ dist (v2,w) + (c-dist (v2,w) ) / &2<c`) THEN RESA_TAC THEN MRESAL_TAC (GEN_ALL EYYPQDW_CONTINUOUS_LIFT_DIST)[`x2:real`;`a:real`;`v1:real^3`;`v2:real^3`;`x1:real`;`x2:real`;`x6:real`;`x6:real`;`w:real^3`;`x2:real`][SET_RULE`A IN {A, B}`;continuous_atreal;DIST_LIFT;o_DEF;GSYM REAL_ABS_BETWEEN] THEN POP_ASSUM (fun th-> MRESA_TAC th[`(c-dist(v2,w:real^3))/ &2`]) THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN EXISTS_TAC`d:real` THEN ASM_REWRITE_TAC[] THEN GEN_TAC THEN POP_ASSUM(fun th-> STRIP_TAC THEN MRESAL_TAC th[`x2-t:real`][REAL_ARITH`x2 - d < x2 - t /\ x2 - t < x2 + d <=> --d<t/\ t<d`]) THEN ASM_TAC THEN REAL_ARITH_TAC);;
let DEFORMATION_DIST_LE_V3_DEFOR_B_SUC=
prove_by_refinement( ` scs_k_v39 s =k/\ 3<k /\ is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) ==> (!i. scs_diag k l i ==> ?e. &0< e/\ (!t. &0< t/\ t< e ==> dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)<scs_b_v39 s l i)) `,
[STRIP_TAC THEN MP_TAC HYPER_MM_COLLINEAR THEN RESA_TAC THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LT_CONST THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN STRIP_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k<=3)`) THEN RESA_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN SUBGOAL_THEN`v2 IN IMAGE (w:num->real^3) (:num)`ASSUME_TAC; REWRITE_TAC[IN_ELIM_THM;IMAGE] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; SUBGOAL_THEN`w i IN IMAGE (w:num->real^3) (:num)`ASSUME_TAC; REWRITE_TAC[IN_ELIM_THM;IMAGE] THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; MP_TAC(SET_RULE`v2 IN IMAGE w (:num)/\ w i IN IMAGE w (:num)/\ IMAGE w (:num) SUBSET ball_annulus ==> v2 IN ball_annulus/\ w i IN ball_annulus`) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[IN_ELIM_THM;DIFF;ball_annulus;cball;] THEN REPEAT STRIP_TAC THEN MRESA_TAC DIST_TRIANGLE[`v2:real^3`;`vec 0:real^3`;`(w:num->real^3) i`] THEN MP_TAC(REAL_ARITH`dist (v2,vec 0) <= &2 * h0/\ dist (vec 0,w i) <= &2 * h0/\ dist (v2,w i) <= dist (v2,vec 0) + dist (vec 0,w i) ==> dist (v2,(w:num->real^3) i)<= &4 *h0`) THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REPLICATE_TAC (53-41)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`i:num`]) THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC]);;
let xrr_decreasing_lt = 
prove_by_refinement( `!y1 y1' y2 y6. &2 <= y1 /\ &2 <= y1' /\ &2 <= y2 /\ &2 <= y6 /\ y2 <= &2 * h0 /\ y1 < y1' ==> xrr y1' y2 y6 < xrr y1 y2 y6`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; INTRO_TAC REAL_MVT_SIMPLE [`(\q. xrr q y2 y6)`;`\q. ( -- &4 * ((q*q + y6*y6 - y2*y2)/ (q pow 2 * y2)))`;`y1`;`y1'`]; REWRITE_TAC[IN_REAL_INTERVAL]; ANTS_TAC; CONJ_TAC; BY(ASM_TAC THEN REAL_ARITH_TAC); REPEAT WEAKER_STRIP_TAC; MATCH_MP_TAC HAS_REAL_DERIVATIVE_ATREAL_WITHIN; INTRO_TAC derived_form_xrr_wrt_y1 [`x`;`y2`;`y6`]; REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]; DISCH_THEN MATCH_MP_TAC; BY(ASM_TAC THEN REAL_ARITH_TAC); REPEAT WEAKER_STRIP_TAC; ONCE_REWRITE_TAC [arith `x < y <=> &0 < y - x`]; RULE_ASSUM_TAC(ONCE_REWRITE_RULE[arith `x' - x = (-- &4 * u/v) * z <=> x - x' = &4 * u/ v * z`]); ASM_REWRITE_TAC[]; GMATCH_SIMP_TAC REAL_LT_MUL; GMATCH_SIMP_TAC REAL_LT_MUL; GMATCH_SIMP_TAC REAL_LT_DIV; GMATCH_SIMP_TAC REAL_LT_MUL; REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; ENOUGH_TO_SHOW_TAC ` &0 < x * x + y6 * y6 - y2 * y2`; BY(ASM_TAC THEN REAL_ARITH_TAC); MATCH_MP_TAC REAL_LT_TRANS; TYPIFY `&2 * &2 + &2 * &2 - (&2 * h0) * (&2 * h0)` EXISTS_TAC; CONJ_TAC; BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); MATCH_MP_TAC (arith `x < x' /\ y <= y' /\ z' <= z ==> x + y - z < x' + y' - z'`); GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE; BY(ASM_TAC THEN REAL_ARITH_TAC) ]);;
(* }}} *)
let exp_aff_gt_by_dot=
prove_by_refinement(`!x:real^3 v:real^3 u:real^3. ~collinear {x,v,u} ==> aff_gt {x,v} {u}={w:real^3| (w-x) dot (e2_fan x v u)= &0 /\ &0 < (w-x) dot (e1_fan x v u) }`,
let CROSS_LAGRANGE1 = prove
 (`!x y z. (x cross y) cross z = (x dot z) % y - (z dot y) % x`,
  VEC3_TAC) in
[REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]th3) THEN RES_TAC
  THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]AFF_GT_2_1) THEN RESA_TAC
  THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) THEN RESA_TAC
  THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC;

STRIP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`(a % x + b +c) -x= (a- &1)% x + b + c `] THEN 
REMOVE_ASSUM_TAC THEN SYM_ASSUM_TAC THEN REWRITE_TAC[VECTOR_ARITH`((a-(a+b+c)) % x + b % v +c % u)=  b % (v-x) + c % (u-x)`] 
THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL]
   THEN REDUCE_ARITH_TAC
  THEN ASM_MESON_TAC[REAL_LT_MUL] ;
STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a")
  THEN DISCH_THEN(LABEL_TAC"b")
THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3)( v:real^3) (u:real^3)`;
`e3_fan (x:real^3) (v:real^3) (u:real^3)`;]ORTHONORMAL_IMP_SPANNING) THEN ASM_REWRITE_TAC[SPAN_3;EXTENSION] 
  THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(x':real^3)-(x:real^3)`th)) THEN REWRITE_TAC[SET_RULE`(a:real^3) IN (:real^3)`;IN_ELIM_THM] THEN RES_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL]
  THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"c")
  THEN FIND_ASSUM(MP_TAC)`orthonormal (e1_fan (x:real^3) (v:real^3) (u:real^3)) (e2_fan x v u) (e3_fan x v u)`
  THEN REWRITE_TAC[orthonormal] THEN STRIP_TAC THEN ASM_REWRITE_TAC[]  THEN ASM_REWRITE_TAC[DOT_SYM]
  THEN REDUCE_ARITH_TAC
  THEN DISCH_TAC THEN REMOVE_THEN "c" MP_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC THEN DISCH_THEN (LABEL_TAC"a")
  THEN REMOVE_THEN "b" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL;] THEN REWRITE_TAC[DOT_SYM] THEN ASM_REWRITE_TAC[]
  THEN REDUCE_ARITH_TAC
  THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC
  THEN ASM_REWRITE_TAC[e1_fan;e2_fan;CROSS_LMUL;VECTOR_ARITH`a% b% v=(a*b)%v`;CROSS_LAGRANGE1] 
  THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[VECTOR_ARITH`a%(x- b % v)+ c % v=(c- a* b) % v+  a % x `;
e3_fan;VECTOR_ARITH`a% b% v=(a*b)%v`]
  THEN STRIP_TAC THEN
EXISTS_TAC
`&1 - ((((w:real) -
   ((u':real) * inv (norm (inv (norm ((v:real^3) - (x:real^3))) % (v - x) cross ((u:real^3) - x)))) *
   (inv (norm (v - x)) % (v - x) dot (u - x))) *
  inv (norm (v - x)))+
((u':real) * inv (norm (e3_fan (x:real^3) (v:real^3) (u:real^3) cross (u - x)))))`
  THEN EXISTS_TAC
`(((w:real) -
   ((u':real) * inv (norm (inv (norm ((v:real^3) - (x:real^3))) % (v - x) cross ((u:real^3) - x)))) *
   (inv (norm (v - x)) % (v - x) dot (u - x))) *
  inv (norm (v - x)))`
  THEN EXISTS_TAC
` ((u':real) * inv (norm (e3_fan (x:real^3) (v:real^3) (u:real^3) cross (u - x))))`
THEN
STRIP_TAC;

SUBGOAL_THEN `~(collinear {vec 0, v-x, u-x})==> ~((e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))= vec 0)` ASSUME_TAC;

 MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[e3_fan;CROSS_LMUL] 
THEN DISCH_TAC THEN MP_TAC(ISPECL [`v:real^3`; `x:real^3`] imp_inv_norm_not_zero_fan) 
THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN 
MP_TAC(ISPECL [`inv(norm((v:real^3)-(x:real^3)))`; `((v:real^3) -(x:real^3)) cross ((u:real^3)-(x:real^3))`; `(vec 0):real^3`] VECTOR_MUL_LCANCEL_IMP) 
THEN ASM_REWRITE_TAC[VECTOR_MUL_RZERO;CROSS_EQ_0 ];

POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM COLLINEAR_3] 
THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{a,b,c}={b,a,c}`] THEN RED_TAC
THEN
MP_TAC(ISPECL [`(e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))`; `((vec 0):real^3)`] imp_norm_gl_zero_fan)
  THEN REDUCE_VECTOR_TAC THEN RES_TAC THEN 
MP_TAC(ISPECL[`u':real`;`inv (norm ((e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))))`] 
REAL_LT_MUL) THEN RES_TAC THEN POP_ASSUM MATCH_MP_TAC THEN POP_ASSUM MP_TAC
 THEN REAL_ARITH_TAC;

STRIP_TAC THENL[REAL_ARITH_TAC;
REWRITE_TAC[e3_fan] THEN POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]
]);;
let exp_aff_by_dot=
prove_by_refinement( `!x:real^3 v:real^3 u:real^3. ~collinear {x,v,u} ==> aff {x,v,u}={w:real^3| (w-x) dot (e2_fan x v u)= &0 }`,
let CROSS_LAGRANGE1 = prove
 (`!x y z. (x cross y) cross z = (x dot z) % y - (z dot y) % x`,
  VEC3_TAC) in
[
REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]th3) THEN RES_TAC
  THEN ASM_SIMP_TAC[aff;aff;Collect_geom2.AFFINE_HULL_3]
  THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) THEN RESA_TAC
  THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC;

STRIP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`(a % x + b +c) -x= (a- &1)% x + b + c `] THEN 
REMOVE_ASSUM_TAC THEN SYM_ASSUM_TAC THEN REWRITE_TAC[VECTOR_ARITH`((a-(a+b+c)) % x + b % v +c % u)=  b % (v-x) + c % (u-x)`] 
THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL]
   THEN REDUCE_ARITH_TAC
  THEN ASM_MESON_TAC[REAL_LT_MUL] ;

STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a")
  THEN DISCH_THEN(LABEL_TAC"b")
THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3)( v:real^3) (u:real^3)`;
`e3_fan (x:real^3) (v:real^3) (u:real^3)`;]ORTHONORMAL_IMP_SPANNING) THEN ASM_REWRITE_TAC[SPAN_3;EXTENSION] 
  THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(x':real^3)-(x:real^3)`th)) THEN REWRITE_TAC[SET_RULE`(a:real^3) IN (:real^3)`;IN_ELIM_THM] THEN RES_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL]
  THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"c")
  THEN FIND_ASSUM(MP_TAC)`orthonormal (e1_fan (x:real^3) (v:real^3) (u:real^3)) (e2_fan x v u) (e3_fan x v u)`
  THEN REWRITE_TAC[orthonormal] THEN STRIP_TAC THEN ASM_REWRITE_TAC[]  THEN ASM_REWRITE_TAC[DOT_SYM]
  THEN REDUCE_ARITH_TAC
  THEN DISCH_TAC THEN REMOVE_THEN "c" MP_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC 
THEN DISCH_THEN (LABEL_TAC"a")
  THEN REMOVE_THEN "b" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL;] THEN REWRITE_TAC[DOT_SYM] THEN ASM_REWRITE_TAC[]
  THEN REDUCE_ARITH_TAC
  THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC
THEN ASM_REWRITE_TAC[]
THEN REDUCE_VECTOR_TAC 
  THEN ASM_REWRITE_TAC[e1_fan;e2_fan;CROSS_LMUL;VECTOR_ARITH`a% b% v=(a*b)%v`;CROSS_LAGRANGE1] 
  THEN REDUCE_VECTOR_TAC 
THEN REWRITE_TAC[VECTOR_ARITH`a%(x- b % v)+ c % v=(c- a* b) % v+  a % x `;
e3_fan;VECTOR_ARITH`a% b% v=(a*b)%v`]
  THEN STRIP_TAC 
THEN
EXISTS_TAC
`&1 - ((((w:real) -
   ((u':real) * inv (norm (inv (norm ((v:real^3) - (x:real^3))) % (v - x) cross ((u:real^3) - x)))) *
   (inv (norm (v - x)) % (v - x) dot (u - x))) *
  inv (norm (v - x)))+
((u':real) * inv (norm (e3_fan (x:real^3) (v:real^3) (u:real^3) cross (u - x)))))`
  THEN EXISTS_TAC
`(((w:real) -
   ((u':real) * inv (norm (inv (norm ((v:real^3) - (x:real^3))) % (v - x) cross ((u:real^3) - x)))) *
   (inv (norm (v - x)) % (v - x) dot (u - x))) *
  inv (norm (v - x)))`
  THEN EXISTS_TAC
` ((u':real) * inv (norm (e3_fan (x:real^3) (v:real^3) (u:real^3) cross (u - x))))`;



STRIP_TAC ;
REAL_ARITH_TAC;
REWRITE_TAC[e3_fan] 
THEN  POP_ASSUM MP_TAC
THEN VECTOR_ARITH_TAC;
]);;
let IN_AFF_EQ_DOT_E2_FAN=
prove(` ~collinear {vec 0,x,y} ==>( e2_fan (vec 0) x y dot z = &0 <=> z IN aff {vec 0, x, y}) `,
STRIP_TAC THEN ONCE_REWRITE_TAC[DOT_SYM] THEN ASM_SIMP_TAC[exp_aff_by_dot;IN_ELIM_THM] THEN REDUCE_VECTOR_TAC);;
let OPEN_RELA_AFF_GT=
prove_by_refinement(` ~collinear {vec 0,z,x}/\ ~collinear {vec 0,x,y} /\ z IN aff_gt {vec 0} {x,y:real^3} ==> ?e. &0< e/\ ball(z,e) INTER aff{vec 0, x,z} SUBSET aff_gt {vec 0} {x,y}`,
[ STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[Planarity.aff_gt_inter_aff_gt;exp_aff_gt_by_dot;] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN STRIP_TAC THEN ASM_SIMP_TAC[Planarity.aff_gt_inter_aff_gt;exp_aff_gt_by_dot;Conforming.aff_3_rep_cross_dot;INTER;IN_ELIM_THM;VECTOR_ARITH`a- vec 0=a`;exp_aff_by_dot] THEN ONCE_REWRITE_TAC[DOT_SYM] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0< e1_fan (vec 0:real^3) y x dot z ==> &0<(e1_fan (vec 0) y x dot z)/ &2/\ &0< e1_fan (vec 0) y x dot z - (e1_fan (vec 0) y x dot z) / &2`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0< e1_fan (vec 0:real^3) x y dot z ==> &0<(e1_fan (vec 0) x y dot z)/ &2/\ &0< e1_fan (vec 0) x y dot z - (e1_fan (vec 0) x y dot z) / &2`) THEN RESA_TAC THEN MRESAL_TAC (GEN_ALL CONTINUOUS_AT_LIFT_DOT)[`e1_fan (vec 0:real^3) y x`;`z:real^3`][CONTINUOUS_AT_LIFT_RANGE;GSYM REAL_ABS_BETWEEN] THEN POP_ASSUM(fun th-> MRESA_TAC th[`(e1_fan (vec 0) y x dot z) / &2`]) THEN MRESAL_TAC (GEN_ALL CONTINUOUS_AT_LIFT_DOT)[`e1_fan (vec 0:real^3) x y`;`z:real^3`][CONTINUOUS_AT_LIFT_RANGE;GSYM REAL_ABS_BETWEEN;SUBSET;IN_ELIM_THM;ball;] THEN POP_ASSUM(fun th-> MRESA_TAC th[`(e1_fan (vec 0) x y dot z) / &2`]) THEN EXISTS_TAC`min d d'` THEN MP_TAC(REAL_ARITH`&0< d/\ &0< d' ==> &0< min d d'`) THEN RESA_TAC THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN GEN_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM(fun th1-> STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC THEN MP_TAC(REAL_ARITH`norm (x' - z) < min d d' /\ &0<d/\ &0< d' ==> norm(x'-z)< d/\ norm(x'-z:real^3)< d'`) THEN RESA_TAC THEN MRESA_TAC th1[`x':real^3`]) THEN MRESA_TAC th[`x':real^3`]) THEN MP_TAC(REAL_ARITH`e1_fan (vec 0) x y dot z - (e1_fan (vec 0) x y dot z) / &2 < e1_fan (vec 0) x y dot x' /\ &0 < e1_fan (vec 0) x y dot z - (e1_fan (vec 0) x y dot z) / &2 ==> &0< e1_fan (vec 0:real^3) x y dot x' `) THEN MP_TAC(REAL_ARITH`e1_fan (vec 0) y x dot z - (e1_fan (vec 0) y x dot z) / &2 < e1_fan (vec 0) y x dot x' /\ &0 < e1_fan (vec 0) y x dot z - (e1_fan (vec 0) y x dot z) / &2 ==> &0< e1_fan (vec 0:real^3) y x dot x' `) THEN RESA_TAC THEN RESA_TAC THEN REPLICATE_TAC (22-14) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) THEN REPLICATE_TAC (21-2) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) THEN POP_ASSUM MP_TAC THEN REDUCE_VECTOR_TAC THEN ASM_SIMP_TAC[IN_AFF_EQ_DOT_E2_FAN] THEN ASM_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN REPEAT STRIP_TAC THEN REPLICATE_TAC (2) (POP_ASSUM MP_TAC) THEN ASM_SIMP_TAC[IN_AFF_EQ_DOT_E2_FAN;aff;IN_ELIM_THM;Collect_geom2.AFFINE_HULL_3] THEN RESA_TAC THEN RESA_TAC THEN REDUCE_VECTOR_TAC THEN EXISTS_TAC`&1 - v - w * v' - w* w'` THEN EXISTS_TAC`v +w*v':real` THEN EXISTS_TAC`w*w':real` THEN STRIP_TAC; REAL_ARITH_TAC ; VECTOR_ARITH_TAC; REAL_ARITH_TAC ; VECTOR_ARITH_TAC]);;
let V3_DEFOR_IN_AFF_GT=
prove(`&0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ ~collinear {vec 0,v1,w}/\v2 IN aff_gt {vec 0} {v1,w} ==> ?e. &0< e/\ (!t. &0< t/\ t< e ==> v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t) IN aff_gt {vec 0} {v1,w})`,
STRIP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC UPS_X_POS_SEG THEN RESA_TAC THEN POP_ASSUM (fun th-> MRESAL_TAC th[`&0`][REAL_ARITH`(-- e< &0<=> &0< e)/\ a- &0=a`] THEN ASSUME_TAC th) THEN STRIP_TAC THEN MRESA_TAC (GEN_ALL OPEN_RELA_AFF_GT)[`v2:real^3`;`v1:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN RESA_TAC THEN MRESAL_TAC (GEN_ALL EXISTS_SMALL_LT_CONST)[`a:real`;`v1:real^3`;`v2:real^3`;` x1:real`;`x6:real`;`x2:real`;`v2:real^3`;`e':real`][DIST_REFL] THEN ABBREV_TAC`e1=(min (min e e') e'')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min (min e e') e'')/ &2/\ &0< e/\ &0< e' /\ &0< e'' ==> &0< e1/\ e1< e /\ e1< e'/\ e1< e''`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`A SUBSET B/\ a IN A==> a IN B`)) THEN EXISTS_TAC`ball (v2,e') INTER aff {vec 0, v2, v1:real^3}` THEN ASM_REWRITE_TAC[INTER;ball;IN_ELIM_THM] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REPLICATE_TAC (23-16) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''==> t< e''`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_SIMP_TAC[exp_aff_by_dot;IN_ELIM_THM] THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[e2_fan;e3_fan] THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[DOT_RMUL;CROSS_LMUL] THEN ONCE_REWRITE_TAC[DOT_SYM] THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN REPLICATE_TAC (24-11) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e/\ &0<t==> t< e/\ -- e< t`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN MRESAL_TAC (GEN_ALL EYYPQDW_SCALAR_POS)[`x2:real`;`x2:real`;`x6:real`;`x1:real`;`x2-t:real`;`x6:real`;`v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`;`a:real`;`v1:real^3`;`v2:real^3`][SET_RULE`a IN {a,b}`;GSYM v3_defor_v1;DOT_CROSS_SELF;DOT_LMUL] THEN REAL_ARITH_TAC);;
let V3_DEFOR_IN_AFF_GT_V1=
prove(`&0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ ~collinear {vec 0,v1,w}/\v2 IN aff_gt {vec 0} {v1,w} ==> ?e. &0< e/\ (!t. --e< t/\ t< e ==> v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t) IN aff_gt {vec 0} {v1,w})`,
STRIP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC UPS_X_POS_SEG THEN RESA_TAC THEN POP_ASSUM (fun th-> MRESAL_TAC th[`&0`][REAL_ARITH`(-- e< &0<=> &0< e)/\ a- &0=a`] THEN ASSUME_TAC th) THEN STRIP_TAC THEN MRESA_TAC (GEN_ALL OPEN_RELA_AFF_GT)[`v2:real^3`;`v1:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN RESA_TAC THEN MRESAL_TAC (GEN_ALL EXISTS_SMALL_LT_CONST_V1)[`a:real`;`v1:real^3`;`v2:real^3`;` x1:real`;`x6:real`;`x2:real`;`v2:real^3`;`e':real`][DIST_REFL] THEN ABBREV_TAC`e1=(min (min e e') e'')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min (min e e') e'')/ &2/\ &0< e/\ &0< e' /\ &0< e'' ==> &0< e1/\ e1< e /\ e1< e'/\ e1< e''`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`A SUBSET B/\ a IN A==> a IN B`)) THEN EXISTS_TAC`ball (v2,e') INTER aff {vec 0, v2, v1:real^3}` THEN ASM_REWRITE_TAC[INTER;ball;IN_ELIM_THM] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REPLICATE_TAC (23-16) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC(REAL_ARITH`-- e1<t /\ t< e1/\ e1< e''==> t< e''/\ --e'' <t`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_SIMP_TAC[exp_aff_by_dot;IN_ELIM_THM] THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[e2_fan;e3_fan] THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[DOT_RMUL;CROSS_LMUL] THEN ONCE_REWRITE_TAC[DOT_SYM] THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN REPLICATE_TAC (25-11) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e/\ --e1<t==> t< e/\ -- e< t`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN MRESAL_TAC (GEN_ALL EYYPQDW_SCALAR_POS)[`x2:real`;`x2:real`;`x6:real`;`x1:real`;`x2-t:real`;`x6:real`;`v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`;`a:real`;`v1:real^3`;`v2:real^3`][SET_RULE`a IN {a,b}`;GSYM v3_defor_v1;DOT_CROSS_SELF;DOT_LMUL] THEN REAL_ARITH_TAC);;
let xrr_increasing_le = 
prove_by_refinement( `!y1 y2 y6 y6'. &0 < y1 /\ &0 < y2 /\ &0 <= y6 /\ y6 <= y6' ==> xrr y1 y2 y6 <= xrr y1 y2 y6'`,
(* {{{ proof *) [ REPEAT WEAKER_STRIP_TAC; TYPIFY `y6 = y6'` ASM_CASES_TAC; BY(ASM_REWRITE_TAC[arith `x <= x`]); MATCH_MP_TAC(REAL_ARITH`a<b==> a<=b`) THEN MATCH_MP_TAC xrr_increasing THEN ASM_TAC THEN REAL_ARITH_TAC; ]);;
(* }}} *)
let EDGE_DOT_LE_NORM=
prove_by_refinement(`is_scs_v39 s /\ MMs_v39 s w /\ scs_k_v39 s =k/\ 3<k /\ l MOD k= SUC i MOD k ==> (w i ) dot (w l)< norm (w l) pow 2 `,
[ REPEAT STRIP_TAC THEN REWRITE_TAC[dist;VECTOR_ARITH`(&1 - t) % w - w1 = --(t % w-(w-w1))`;NORM_NEG] THEN SUBGOAL_THEN`((w:num->real^3) l- w i) dot -- (w:num->real^3) l< &0` ASSUME_TAC; MRESAL_TAC DOT_NORM[`(w:num->real^3) l- w i`;`-- (w:num->real^3) l`][VECTOR_ARITH`wl - wi + (-- wl)= --wi:real^3`;NORM_NEG] THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;IMAGE;SUBSET;IN_ELIM_THM;ball_annulus;cball;DIFF;ball] THEN REPEAT RESA_TAC THEN SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) l = w x) `ASSUME_TAC; EXISTS_TAC `l:num` THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; EXISTS_TAC `i:num` THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; REPLICATE_TAC (37-20) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`(w:num->real^3) i`] THEN MRESA_TAC th[`(w:num->real^3) l`]) THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG] THEN REPEAT STRIP_TAC THEN REPLICATE_TAC (40-21) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ 1< k`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`SUC i`;`k:num`] THEN MRESA_TAC DIVISION[`i:num`;`k:num`] THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) THEN REPLICATE_TAC (48-14) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESAL_TAC th[`l:num MOD k`;`i MOD k:num`][dist]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN MP_TAC(REAL_ARITH`&2 <= scs_a_v39 s i l /\ scs_a_v39 s i l <= norm (w l - (w:num->real^3)i)/\ ~(norm (w l) < &2) ==> &2<= norm (w l - (w:num->real^3)i) /\ &2<= norm (w l)`) THEN RESA_TAC THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm ((w:num->real^3) l)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (w l - (w:num->real^3)i)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] THEN ASM_TAC THEN REWRITE_TAC[h0] THEN REPEAT RESA_TAC THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; EXISTS_TAC `l:num` THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; EXISTS_TAC `i:num` THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; REPLICATE_TAC (37-20) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`(w:num->real^3) i`] THEN MRESA_TAC th[`(w:num->real^3) l`]) THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG] THEN REPEAT STRIP_TAC THEN REPLICATE_TAC (40-21) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ 1< k`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`SUC i`;`k:num`] THEN MRESA_TAC DIVISION[`i:num`;`k:num`] THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) THEN REPLICATE_TAC (48-14) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESAL_TAC th[`l:num MOD k`;`i MOD k:num`][dist]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN MP_TAC(REAL_ARITH`&2 <= scs_a_v39 s i l /\ scs_a_v39 s i l <= norm (w l - (w:num->real^3)i)/\ ~(norm (w l) < &2) ==> &2<= norm (w l - (w:num->real^3)i) /\ &2<= norm (w l)`) THEN RESA_TAC THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm ((w:num->real^3) l)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (w l - (w:num->real^3)i)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] THEN ASM_TAC THEN REWRITE_TAC[h0] THEN REPEAT RESA_TAC THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; POP_ASSUM MP_TAC THEN REWRITE_TAC[DOT_RNEG;REAL_ARITH`-- a< &0 <=> a> &0`;] THEN REWRITE_TAC[DOT_LSUB;DOT_SQUARE_NORM] THEN REAL_ARITH_TAC]);;
let DEFORMATION_DIST_LE_2=
prove(` 3<k /\ scs_k_v39 s =k/\ is_scs_v39 s /\ MMs_v39 s w /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ w l=v2/\ w (SUC l) =v1/\ ~(norm v2 = &2)/\ scs_a_v39 s l i < dist (v2,w i) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ l MOD k= SUC i MOD k ==> ?e. &0< e/\ (!t. &0< t/\ t< e ==> &2<dist (v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i) ) `,
STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST THEN ASM_REWRITE_TAC[] THEN MP_TAC HYPER_MM_COLLINEAR THEN RESA_TAC THEN ASM_TAC THEN STRIP_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k<=3)/\ ~(k=0)/\ 1<k`) THEN RESA_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESA_TAC DIVISION[`i:num`;`k:num`] THEN MRESA_TAC DIVISION[`l:num`;`k:num`] THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) THEN REPLICATE_TAC (56-18) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num MOD k`;`l MOD k` ]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) THEN REPLICATE_TAC (59-42) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);;
let DEFORMATION_V3_DEFOR_EDGE=
prove_by_refinement(` 3<k /\ scs_k_v39 s =k/\ is_scs_v39 s /\ MMs_v39 s w /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ w l=v2/\ w (SUC l) =v1/\ ~(norm v2 = &2)/\ scs_a_v39 s l i < dist (v2,w i) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ l MOD k= SUC i MOD k ==> ?e. &0< e/\ (!t. &0< t/\ t< e ==> dist (v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)<dist (v2,w i) ) `,
[ REPEAT STRIP_TAC THEN MP_TAC HYPER_MM_COLLINEAR THEN RESA_TAC THEN MP_TAC DEFORMATION_DIST_LE_2 THEN RESA_TAC THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`] THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`l+k-1`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] THEN MP_TAC UPS_X_POS_SEG THEN RESA_TAC THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` THEN SUBGOAL_THEN`(w:num->real^3) l IN V` ASSUME_TAC; EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; SUBGOAL_THEN`(w:num->real^3) (SUC l) IN V` ASSUME_TAC; EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`SUC l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; SUBGOAL_THEN`(w:num->real^3) l IN ball_annulus` ASSUME_TAC; MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`V:real^3->bool` THEN ASM_REWRITE_TAC[]; SUBGOAL_THEN`(w:num->real^3) (SUC l) IN ball_annulus` ASSUME_TAC; MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`V:real^3->bool` THEN ASM_REWRITE_TAC[]; REPLICATE_TAC (4) (POP_ASSUM MP_TAC) THEN REPEAT RESA_TAC THEN MP_TAC V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION THEN RESA_TAC THEN REPLICATE_TAC (68-41) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) THEN REPLICATE_TAC (67-41) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l+k-1:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA_TAC th[`i:num`]) THEN REPEAT STRIP_TAC THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) i`] THEN ABBREV_TAC`e1= (min (min (min e e') e'') e''')/ &2` THEN MP_TAC(REAL_ARITH`e1= (min (min (min e e') e'') e''')/ &2 /\ &0< e /\ &0< e'/\ &0< e''/\ &0< e''' ==> &0< e1/\ e1<= e/\ e1<=e'/\ e1< e''/\ e1< e'''`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'') e''')/ &2 /\ &0< e /\ &0< e'/\ &0< e''/\ t<e1/\ &0<t/\ &0< e'''==> --e' < t/\ t< e'/\ t<e/\ t< e'''/\ t< e''`) THEN RESA_TAC THEN REPLICATE_TAC (87-59) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`t:real`]) THEN REPLICATE_TAC (88-65) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`t:real`]) THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[v3_defor_v4] THEN REPLICATE_TAC (87-72) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC th[`t:real`]) THEN ABBREV_TAC`v3=v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) ` THEN ASM_REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0-A= -- A`;NORM_NEG;REAL_ARITH`~(a<b)<=> b<=a`] THEN STRIP_TAC THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORMV3)[`x2:real`;`-- &1`;`x2:real`;`x6:real`;`x1:real`;`x6:real`;`v1:real^3`;`v2:real^3`;`v3_defor_v1 (-- &1) v1 (v2:real^3) x1 x2 x6 x6 (x2 - t)`;`x2-t:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1] THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`-- &1`;`x2:real`;`x6:real`;`x1:real`;`x2-t:real`;`v2:real^3`;`v3_defor_v1 (-- &1) v1 (v2:real^3) x1 x2 x6 x6 (x2 - t)`;`v1:real^3`;`x6:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1] THEN MRESA_TAC DOT_NORM_SUB[`v1:real^3`;`v3:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[dist] THEN ABBREV_TAC`v4= (w:num->real^3) i` THEN MRESA_TAC DOT_NORM_SUB[`v4:real^3`;`v2:real^3`] THEN MRESA_TAC DOT_NORM_SUB[`v4:real^3`;`v3:real^3`] THEN MRESA_TAC DOT_NORM_SUB[`v1:real^3`;`v2:real^3`] THEN STRIP_TAC ; REPLICATE_TAC (97-63) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> POP_ASSUM(fun th1-> REPEAT STRIP_TAC THEN MP_TAC th1) THEN MP_TAC th) THEN ASM_REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0-A= -- A`;NORM_NEG;REAL_ARITH`~(a<b)<=> b<=a`] THEN REPEAT STRIP_TAC THEN SUBGOAL_THEN`&2 <= norm (v1 - v2:real^3) ` ASSUME_TAC ; REPLICATE_TAC (99-30) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`SUC l:num`;`l:num`]) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[dist] THEN MRESA_TAC DIVISION[`SUC l`;`k:num`] THEN MRESA_TAC DIVISION[`l:num`;`k:num`] THEN MRESA_TAC (GEN_ALL Qknvmlb.SUC_MOD_NOT_EQ)[`k:num`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`l:num`]) THEN REPLICATE_TAC (103-22) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`SUC l MOD k:num`;`l MOD k:num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC l MOD k)`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) THEN REAL_ARITH_TAC; MRESAL_TAC xrr_decreasing_lt[`norm (v3:real^3)`;`norm (v2:real^3)`;`norm(v1:real^3)`;`norm (v1-v2:real^3)`][xrr;REAL_ARITH`a*a= a pow 2`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[Pack1.norm_abs] THEN ASM_REWRITE_TAC[REAL_LT_SQUARE_ABS] THEN ASM_REWRITE_TAC[REAL_ABS_NORM;REAL_ARITH`a-b<a<=> &0<b`] THEN REWRITE_TAC[REAL_ARITH`&8*(&1-A)< &8*(&1-B) <=> B<A`] THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v2:real^3`] THEN MRESAL_TAC COS_ANGLE[`v1:real^3`;`vec 0:real^3`;`v2:real^3`][VECTOR_ARITH`A- vec 0=A`;real_div;REAL_INV_MUL;REAL_ARITH`(x1 + x2) - x6= x2+x1-x6/\ (a*b)*c*d=a*b*d*c`] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) THEN SUBGOAL_THEN`~(v3 = vec 0:real^3)` ASSUME_TAC ; STRIP_TAC THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;NORM_0;REAL_ARITH`~(&2<= &0)`]) ; MRESAL_TAC COS_ANGLE[`v1:real^3`;`vec 0:real^3`;`v3:real^3`][VECTOR_ARITH`A- vec 0=A`;real_div;REAL_INV_MUL;REAL_ARITH`(x1 + x2) - x6= x2+x1-x6/\ (a*b)*c*d=a*b*d*c`] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN MRESAL_TAC COS_MONO_LT_EQ[`angle (v1,vec 0,v3:real^3)`;`angle (v1,vec 0,v2:real^3)`][ANGLE_RANGE] THEN MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, v4}/\ v3 IN aff_gt {vec 0} {v1, v4} /\ aff_gt {vec 0} {v1,v4} SUBSET aff_ge {vec 0} {v1,v4}==> v2 IN aff_ge {vec 0} {v1, v4}/\ v3 IN aff_ge {vec 0} {v1, v4:real^3}`) THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] THEN RESA_TAC THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v4:real^3`] THEN MRESA_TAC Polar_fan.ANGLES_ADD_AFF_GE [`vec 0:real^3`;`v1:real^3`;`v4:real^3`;`v2:real^3`] THEN MRESA_TAC Polar_fan.ANGLES_ADD_AFF_GE [`vec 0:real^3`;`v1:real^3`;`v4:real^3`;`v3:real^3`] THEN MP_TAC(REAL_ARITH`angle (v1,vec 0,v2) < angle (v1,vec 0,v3) /\ angle (v1,vec 0,v2) + angle (v2,vec 0,v4) = angle (v1,vec 0,v4) /\ angle (v1,vec 0,v3) + angle (v3,vec 0,v4) = angle (v1,vec 0,v4) ==> angle (v3,vec 0,v4) <angle (v2,vec 0,v4:real^3)`) THEN RESA_TAC THEN MRESAL_TAC COS_MONO_LT_EQ[`angle (v2,vec 0,v4:real^3)`;`angle (v3,vec 0,v4:real^3)`][ANGLE_RANGE] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[ANGLE_SYM] THEN MRESAL_TAC COS_ANGLE[`v4:real^3`;`vec 0:real^3`;`v3:real^3`][VECTOR_ARITH`A- vec 0=A`;real_div;REAL_INV_MUL;REAL_ARITH`(x1 + x2) - x6= x2+x1-x6/\ (a*b)*c*d=a*b*d*c`] THEN MRESAL_TAC COS_ANGLE[`v4:real^3`;`vec 0:real^3`;`v2:real^3`][VECTOR_ARITH`A- vec 0=A`;real_div;REAL_INV_MUL;REAL_ARITH`(x1 + x2) - x6= x2+x1-x6/\ (a*b)*c*d=a*b*d*c`] THEN REPLICATE_TAC (116-88) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> POP_ASSUM(fun th1-> REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th1) THEN MP_TAC th) THEN REWRITE_TAC[REAL_ARITH`(norm v4 pow 2 + x2) - norm (v4 - v2) pow 2 =x2+norm v4 pow 2 - norm (v4 - v2) pow 2`;real_div;REAL_ARITH`a*b*c*d=(a*b)*c*d`] THEN STRIP_TAC THEN STRIP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN POP_ASSUM(fun th1-> REWRITE_TAC[SYM th1] THEN ASSUME_TAC (SYM th) THEN ASSUME_TAC (SYM th))) THEN SUBGOAL_THEN`(w:num->real^3) (l+k-1) IN V` ASSUME_TAC; EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; SUBGOAL_THEN`(w:num->real^3) (l+k-1) IN ball_annulus` ASSUME_TAC; MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`V:real^3->bool` THEN ASM_REWRITE_TAC[]; POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0-A= -- A`;NORM_NEG;REAL_ARITH`~(a<b)<=> b<=a`;real_div] THEN STRIP_TAC THEN ABBREV_TAC`a1=(norm (v4:real^3) pow 2)` THEN ABBREV_TAC`a2=(norm (v4-v2:real^3) pow 2)` THEN ABBREV_TAC`a3= x2+a1- &2 *((v4:real^3) dot v3) * (inv (norm v3)) * (inv (norm v4)) * norm v4 * norm(v2:real^3)` THEN ABBREV_TAC`x= v4- v3_defor_v1 a (vec 0- v4) (v2- v4:real^3) a1 a2 x2 x2 (a3)` THEN STRIP_TAC THEN MP_TAC(REAL_ARITH`&2<=norm (v4:real^3)/\ &2<=norm (v2:real^3)==> &0< norm v4/\ &0< norm v2`) THEN RESA_TAC ; MP_TAC(REAL_ARITH`norm (v4 - v2) pow 2 <= a3\/ a3< norm(v4-v2:real^3) pow 2`) THEN RESA_TAC ; MRESA_TAC REAL_LE_RSQRT[`norm(v4-v2:real^3)`;`a3:real`] THEN MP_TAC(REAL_ARITH`norm (v4 - v2) pow 2 <= a3/\ &0<= norm(v4-v2:real^3) pow 2 ==> &0<= a3`) THEN ASM_REWRITE_TAC[NORM_POS_LE;REAL_LE_POW_2] THEN RESA_TAC THEN MRESA_TAC SQRT_POW_2[`a3:real`] THEN MRESAL_TAC xrr_increasing_le[`norm(v4:real^3)`;`norm(v2:real^3)`;`norm(v4-v2:real^3)`;`sqrt(a3)`][NORM_POS_LE;xrr;REAL_ARITH`(&8 *( &1-a)<= &8 *( &1-b)<=> b<=a)/\ a*a= a pow 2`;real_div] THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN EXPAND_TAC"a3" THEN REWRITE_TAC[REAL_ARITH`x+y-(y+x-a)=a`;REAL_INV_MUL] THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v4:real^3`;`vec 0:real^3`] THEN ASM_TAC THEN REDUCE_VECTOR_TAC THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v2:real^3`;`vec 0:real^3`] THEN ASM_TAC THEN REDUCE_VECTOR_TAC THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH` (&2 *a * inv (b) * inv (c) * c * d) * inv (&2) * inv (c) * inv (d) = (a * inv (b) * inv (c)) * (inv (c) * c )* (inv (d) * d)`;REAL_ARITH`a * &1=a`] THEN ASM_REWRITE_TAC[REAL_ARITH`a*b*c*d=(a*b)*d*c`] THEN ONCE_REWRITE_TAC[REAL_ARITH` a1 + x2 - a2= x2+a1-a2`] THEN ASM_REWRITE_TAC[REAL_ARITH`a<=b<=> ~(b<a)`] ; MRESA_TAC DOT_NORM_SUB[`v4:real^3`;`v3:real^3`] THEN SUBGOAL_THEN`norm (v4 - v3:real^3) pow 2 < a3`ASSUME_TAC; POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`a=((a1+x2-t)-c)/ &2<=> c= a1+x2-t - &2 *a`] THEN RESA_TAC THEN EXPAND_TAC"a3" THEN REWRITE_TAC[REAL_ARITH`a1 + x2 - t - &2 * (v4 dot v3) < x2 + a1 - &2 * (v4 dot v3) * inv (norm v3) * inv (norm v4) * norm v4 * norm v2 <=> (v4 dot v3) * inv (norm v3) * (inv (norm v4) * norm v4) * norm v2 < (v4 dot v3)+ t/ &2 `] THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v4:real^3`;`vec 0:real^3`] THEN ASM_TAC THEN REDUCE_VECTOR_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN ABBREV_TAC`g=(v4:real^3) dot v3` THEN MRESAL_TAC SQRT_UNIQUE[`x2:real`;`norm(v2:real^3)`][NORM_POS_LE] THEN MRESAL_TAC SQRT_UNIQUE[`x2-t:real`;`norm(v3:real^3)`][NORM_POS_LE] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;REAL_ARITH`&1*a=a`]) THEN MP_TAC(REAL_ARITH`&0< x2-t/\ &0< x2/\ &0<t==> &0<= x2-t/\ &0<= x2/\ x2-t<x2/\ ~(x2-t= &0)`) THEN RESA_TAC THEN MRESA_TAC SQRT_INV[`x2-t:real`] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) THEN MRESA_TAC REAL_LE_INV[`x2-t:real`] THEN MRESA_TAC REAL_LT_INV[`x2-t:real`] THEN MRESA_TAC SQRT_MUL[`inv(x2-t):real`;`x2:real`] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) THEN MRESA_TAC REAL_MUL_LINV[`x2-t:real`] THEN MRESA_TAC REAL_LT_LMUL[`inv(x2-t)`;`x2-t:real`;`x2:real`] THEN MRESAL_TAC SQRT_MONO_LT[`&1:real`;`inv(x2-t) *x2`][REAL_ARITH`&0<= &1`;SQRT_1] THEN MP_TAC(REAL_ARITH`(v4:real^3) dot v3 = &0\/ &0< --((v4:real^3) dot v3)\/ &0< (v4:real^3) dot v3 `) THEN RESA_TAC; ASM_REWRITE_TAC[REAL_ARITH`&0 *a< &0 + t/ &2<=> &0< t`] ; MRESA_TAC REAL_LT_LMUL[`-- g`;`&1:real`;`sqrt (inv (x2 - t) * x2):real`] THEN POP_ASSUM MP_TAC THEN MP_TAC(REAL_ARITH`&0< t==> &0< t/ &2`) THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC ; MP_TAC(REAL_ARITH`&0< g/\ &1 < inv (x2 - t) * x2 ==> ~(g= &0)/\ &0 <= inv (x2 - t) * x2`) THEN RESA_TAC THEN MRESA_TAC REAL_MUL_LINV[`g:real`] THEN MRESAL_TAC REAL_LT_LMUL[`g:real`;`sqrt (inv (x2 - t) * x2):real`;`(inv g)*(g+t/ &2)`][REAL_ARITH`a*b*c=(b*a)*c/\ &1*x=x`] THEN POP_ASSUM MATCH_MP_TAC THEN MATCH_MP_TAC REAL_LT_LSQRT THEN ASM_REWRITE_TAC[REAL_ARITH`a*(b+c)=a*b+a*c`] THEN STRIP_TAC ; MATCH_MP_TAC(REAL_ARITH`&0< a*b ==> &0<= &1+a *b/ &2`) THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LT_INV THEN ASM_REWRITE_TAC[] ; REWRITE_TAC[REAL_ARITH`(&1+b) pow 2= &1+ &2*b+ b pow 2/\ &2 * inv g * t / &2= inv g * t `] THEN MATCH_MP_TAC(REAL_ARITH`&0<=d /\ a< b+c==> a< b+c+d`) THEN ASM_REWRITE_TAC[REAL_LE_POW_2] THEN MRESAL_TAC REAL_LT_LMUL[`inv(x2-t):real`;`x2:real`;`(x2-t)*(&1+ inv g *t)`][REAL_ARITH`a*b*c=(a*b)*c/\ &1*x=x`] THEN POP_ASSUM MATCH_MP_TAC THEN REWRITE_TAC[REAL_ARITH`x2 < (x2 - t) * (&1 + inv g * t) <=> t< t*(x2-t) * inv g`] THEN MRESAL_TAC REAL_LT_LMUL[`t:real`;`&1:real`;`(x2-t)*inv g `][REAL_ARITH`a*b*c=a*b*c/\ x* &1=x`] THEN POP_ASSUM MATCH_MP_TAC THEN MRESAL_TAC REAL_LT_LMUL[`inv g:real`;`g:real`;`(x2-t) `][REAL_ARITH`a*b*c=a*b*c/\ x* &1=x`] THEN ONCE_REWRITE_TAC[REAL_ARITH`a*b=b*a`] THEN POP_ASSUM MATCH_MP_TAC THEN STRIP_TAC ; MATCH_MP_TAC REAL_LT_INV THEN ASM_REWRITE_TAC[] ; EXPAND_TAC"g" THEN REPLICATE_TAC (151-55) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESAL_TAC th[`t:real`][dist]) THEN MP_TAC(REAL_ARITH`&2<norm(v3-v4)==> &2<=norm(v3-v4:real^3)`) THEN RESA_TAC THEN MRESAL_TAC DOT_NORM[`v3 - v4:real^3`;`-- v3:real^3`][VECTOR_ARITH`wl - wi + (-- wl)= --wi:real^3`;NORM_NEG] THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (v3:real^3)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (v3 - v4:real^3)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[GSYM h0] THEN ASM_REWRITE_TAC[h0] THEN STRIP_TAC THEN MP_TAC(REAL_ARITH`(v3 - v4) dot --v3 = (a1 - norm (v3 - v4) pow 2 - (x2 - t)) / &2 /\ &2 pow 2 <= x2 - t /\ &2 pow 2 <= norm (v3 - v4) pow 2 /\ a1 <= (&2 * #1.26) pow 2 ==> (v3 - v4:real^3) dot --v3< &0`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;DOT_RNEG;DOT_LSUB;DOT_SQUARE_NORM]) THEN REAL_ARITH_TAC; POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; ]);;
let DEFORMATION_DIST_LE_BLL_V3_DEFOR_COM=
prove_by_refinement(` 3<k /\ scs_k_v39 s =k/\ is_scs_v39 s /\ MMs_v39 s w /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ w l=v2/\ w (SUC l) =v1/\ ~(norm v2 = &2)/\ scs_a_v39 s l (l + k - 1) < dist (v2,w (l + k - 1)) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) ==> (!i. ~(i MOD k = l MOD k) ==> ?e. &0< e/\ (!t. &0< t/\ t< e ==> dist (v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)<=scs_b_v39 s l i ))`,
[ REPEAT STRIP_TAC THEN MP_TAC(SET_RULE`l MOD k = SUC i MOD k \/ ~(SUC i MOD k= l MOD k)`) THEN RESA_TAC; MP_TAC DEFORMATION_V3_DEFOR_EDGE THEN RESA_TAC THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`] THEN REPLICATE_TAC (55-46) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`l+k-1`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESA_TAC th[`l+k-1:num`] THEN MRESA_TAC th[`i:num`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESA_TAC th[`l+k-1:num`] THEN MRESA_TAC th[`i:num`]) THEN REPLICATE_TAC (59-53) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN RESA_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN GEN_TAC THEN POP_ASSUM (fun th-> STRIP_TAC THEN MRESA_TAC th[`t:real`]) THEN POP_ASSUM MP_TAC THEN REPLICATE_TAC (62-30) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESAL_TAC th[`l:num`;`i:num`][]) THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; MP_TAC(SET_RULE`i MOD k= SUC l MOD k \/ ~(i MOD k= SUC l MOD k )`) THEN RESA_TAC; MP_TAC HYPER_MM_COLLINEAR THEN RESA_TAC THEN MP_TAC UPS_X_POS_SEG THEN RESA_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[] THEN GEN_TAC THEN POP_ASSUM (fun th-> STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e/\ &0< t==> --e<t`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORMV3)[`x2:real`;`-- &1`;`x2:real`;`x6:real`;`x1:real`;`x6:real`;`v1:real^3`;`v2:real^3`;`v3_defor_v1 (-- &1) v1 (v2:real^3) x1 x2 x6 x6 (x2 - t)`;`x2-t:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1] THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`-- &1`;`x2:real`;`x6:real`;`x1:real`;`x2-t:real`;`v2:real^3`;`v3_defor_v1 (-- &1) v1 (v2:real^3) x1 x2 x6 x6 (x2 - t)`;`v1:real^3`;`x6:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1] THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`] THEN MRESA_TAC th[` SUC l:num`]) THEN REWRITE_TAC[dist] THEN REPLICATE_TAC (68-30) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESAL_TAC th[`l:num`;`SUC l:num`][]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC REAL_EQ_SQUARE_ABS[`norm (v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) - v1:real^3)`;`norm(v1-v2:real^3)`][REAL_ABS_NORM;GSYM dist] THEN STRIP_TAC THEN ONCE_REWRITE_TAC[DIST_SYM] THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`] THEN MRESA_TAC th[`SUC l:num`]); MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_B_SUC THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESAL_TAC th[`i:num`][scs_diag]) THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN GEN_TAC THEN POP_ASSUM (fun th-> STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e/\ &0< t==> --e<t`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]);;
let DEFORMATION_DIST_LE_BLL_V3_DEFOR_COM=
prove_by_refinement(` 3<k /\ scs_k_v39 s =k/\ is_scs_v39 s /\ MMs_v39 s w /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ w l=v2/\ w (SUC l) =v1/\ ~(norm v2 = &2)/\ scs_a_v39 s l (l + k - 1) < dist (v2,w (l + k - 1)) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1/\(!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) ==> ?e. &0< e/\ (!t i. &0< t/\ t< e/\ ~(i MOD k = l MOD k) ==> dist (v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)<=scs_b_v39 s l i )`,
[ REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_DIST_LE_BLL_V3_DEFOR_COM THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] THEN REWRITE_TAC[SKOLEM_THM] THEN STRIP_TAC THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k/\ ~(i= l MOD k)}` THEN EXISTS_TAC`e1:real` THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; MATCH_MP_TAC FINITE_SUBSET THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` THEN STRIP_TAC; MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG]; REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] THEN REPEAT RESA_TAC THEN EXISTS_TAC`i:num` THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) THEN RESA_TAC; EXISTS_TAC`(e:num->real)1` THEN EXISTS_TAC`1` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 1<k `) THEN RESA_TAC; EXISTS_TAC`(e:num->real)0` THEN EXISTS_TAC`0` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 0<k `) THEN RESA_TAC; STRIP_TAC; MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`&0`] THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT RESA_TAC THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`]); REPEAT STRIP_TAC THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`t:real`] THEN POP_ASSUM MP_TAC THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`i MOD k` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; STRIP_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)`) THEN RESA_TAC THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] THEN REPLICATE_TAC (15-5) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num MOD k`]) THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]); ]);;
(**************************) (***********BBs_V39********) (**************************)
let DEFORMATION_SMALL_INTERVAL=
prove(`deformation ff V (a,b) /\ a<= c/\ c< &0 /\ &0<d /\ d<=b ==> deformation ff V (c,d)`,
REWRITE_TAC[deformation;IN_REAL_INTERVAL] THEN RESA_TAC THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`c < r /\ r < d /\ a <= c/\d <= b ==> a < r /\ r < b`) THEN RESA_TAC THEN REPLICATE_TAC (12-2)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[]);;
let DEFORMATION_V3_DEFOR_NOT_IN_V=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 ==> (!i. ?e. &0< e /\ (!t. &0<t /\ t<e ==> &0<dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)))`,
[ REPEAT STRIP_TAC THEN MP_TAC(SET_RULE`i MOD k= l MOD k\/ ~(i MOD k= l MOD k)`) THEN RESA_TAC; MP_TAC HYPER_MM_COLLINEAR THEN RESA_TAC THEN MP_TAC UPS_X_POS_SEG THEN RESA_TAC THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA_TAC th[`l:num`]) THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[] THEN GEN_TAC THEN REPLICATE_TAC (54-51) (POP_ASSUM MP_TAC) THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e/\ &0< t==> --e<t`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORMV3)[`x2:real`;`-- &1`;`x2:real`;`x6:real`;`x1:real`;`x6:real`;`v1:real^3`;`v2:real^3`;`v3_defor_v1 (-- &1) v1 (v2:real^3) x1 x2 x6 x6 (x2 - t)`;`x2-t:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1] THEN POP_ASSUM MP_TAC THEN MP_TAC(SET_RULE`v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)= v2\/ ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=v2:real^3)`) THEN RESA_TAC; REWRITE_TAC[REAL_ARITH`a=a-t<=> t= &0`] THEN STRIP_TAC THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th;REAL_ARITH`~(&0< &0)`]); STRIP_TAC THEN MATCH_MP_TAC(REAL_ARITH`&0<= a/\ ~(a= &0)==> &0 < a`) THEN ASM_REWRITE_TAC[dist;NORM_POS_LE] THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t):real^3`;`v2:real^3`]; MATCH_MP_TAC EXISTS_SMALL_LE_CONST THEN ASM_REWRITE_TAC[] THEN MP_TAC HYPER_MM_COLLINEAR THEN RESA_TAC THEN MATCH_MP_TAC(REAL_ARITH`&0<= a/\ ~(a= &0)==> &0 < a`) THEN ASM_REWRITE_TAC[dist;NORM_POS_LE] THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> MRESA_TAC DIVISION[`i:num`;`k:num`] THEN MRESA_TAC DIVISION[`l:num`;`k:num`] THEN MRESA_TAC th[`i MOD k`;`l MOD k`]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA_TAC th[`l:num`]) THEN STRIP_TAC THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v2:real^3`;`(w:num->real^3) i`;]]);;
let DEFORMATION_V3_DEFOR_NOT_IN_V_V1=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 ==> (!i. ~(i MOD k= l MOD k) ==> (?e. &0< e /\ (!t. --e<t /\ t<e ==> &0<dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i))))`,
[REPEAT STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST_V1 THEN ASM_REWRITE_TAC[] THEN MP_TAC HYPER_MM_COLLINEAR THEN RESA_TAC THEN MATCH_MP_TAC(REAL_ARITH`&0<= a/\ ~(a= &0)==> &0 < a`) THEN ASM_REWRITE_TAC[dist;NORM_POS_LE] THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> MRESA_TAC DIVISION[`i:num`;`k:num`] THEN MRESA_TAC DIVISION[`l:num`;`k:num`] THEN MRESA_TAC th[`i MOD k`;`l MOD k`]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA_TAC th[`l:num`]) THEN STRIP_TAC THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v2:real^3`;`(w:num->real^3) i`;] ]);;
let DEFORMATION_V3_DEFOR_NOT_IN_V_COM=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 ==> ?e. &0< e /\ (!t i. &0<t /\ t<e ==> &0<dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i))`,
[ REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] THEN REWRITE_TAC[SKOLEM_THM] THEN STRIP_TAC THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k}` THEN EXISTS_TAC`e1:real` THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k }`ASSUME_TAC; MATCH_MP_TAC FINITE_SUBSET THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` THEN STRIP_TAC; MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG]; REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] THEN REPEAT RESA_TAC THEN EXISTS_TAC`i:num` THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; SUBGOAL_THEN`~({(e:num->real) i | i < k } = {})`ASSUME_TAC; REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] THEN EXISTS_TAC`(e:num->real)1` THEN EXISTS_TAC`1` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 1<k `) THEN RESA_TAC; MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k}`;`&0`] THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT RESA_TAC; MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k}`;`t:real`] THEN POP_ASSUM MP_TAC THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k }`ASSUME_TAC; REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`i MOD k` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; STRIP_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) THEN REPLICATE_TAC (18-10) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num MOD k`]) THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN (POP_ASSUM MP_TAC) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]);]);;
let DEFORMATION_V3_DEFOR_NOT_IN_V_COM_V1=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 ==> ?e. &0< e /\ (!t i. --e<t /\ t<e/\ ~(i MOD k= l MOD k) ==> &0<dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i))`,
[ REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_V1 THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] THEN REWRITE_TAC[SKOLEM_THM] THEN STRIP_TAC THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k/\ ~(i= l MOD k)}` THEN EXISTS_TAC`e1:real` THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; MATCH_MP_TAC FINITE_SUBSET THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` THEN STRIP_TAC; MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG]; REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] THEN REPEAT RESA_TAC THEN EXISTS_TAC`i:num` THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) THEN RESA_TAC; EXISTS_TAC`(e:num->real)1` THEN EXISTS_TAC`1` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 1<k `) THEN RESA_TAC; EXISTS_TAC`(e:num->real)0` THEN EXISTS_TAC`0` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 0<k `) THEN RESA_TAC; STRIP_TAC; MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`&0`] THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT RESA_TAC THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`]); REPEAT STRIP_TAC THEN MRESAL_TAC REAL_LE_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`e1:real`][REAL_ARITH`a<=a`] THEN POP_ASSUM MP_TAC THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`i MOD k` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; STRIP_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)`) THEN RESA_TAC THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] THEN MP_TAC(REAL_ARITH`-- e1<t/\t<e1/\ e1<= e(i MOD k)==> -- e(i MOD k)< t/\ t< e(i MOD k)`) THEN RESA_TAC THEN REPLICATE_TAC (12) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num MOD k`]) THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]);]);;
let DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 ==> ?e. &0< e /\ (!t i. &0<t /\ t<e ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i))`,
STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM THEN RESA_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN REPEAT GEN_TAC THEN POP_ASSUM(fun th-> STRIP_TAC THEN MRESA_TAC th[`t:real`;`i:num`]) THEN POP_ASSUM (fun th-> STRIP_TAC THEN MP_TAC th THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[DIST_REFL]) THEN REAL_ARITH_TAC);;
let DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 ==> ?e. &0< e /\ (!t i. -- e<t /\ t<e/\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i))`,
STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_V1 THEN RESA_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN REPEAT GEN_TAC THEN POP_ASSUM(fun th-> STRIP_TAC THEN MRESA_TAC th[`t:real`;`i:num`]) THEN POP_ASSUM (fun th-> STRIP_TAC THEN MP_TAC th THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[DIST_REFL]) THEN REAL_ARITH_TAC);;
let V3_DEFOR_EQ_IN_FF=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ &0<t /\ (!t i. &0<t /\ t<e ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!w. v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t),w IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF <=> v2,w IN FF)`,
[STRIP_TAC THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT THEN RESA_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (47-44)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN REPLICATE_TAC (48-18)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`x':num`]); EXISTS_TAC`v2:real^3,w':real^3` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w'):real^3#real^3`]]);;
let V3_DEFOR_EQ_IN_FF_V1=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!w. v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t),w IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF <=> v2,w IN FF)`,
[ STRIP_TAC THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT THEN RESA_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (47-44)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN REPLICATE_TAC (48-18)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`x':num`]) THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x':num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA_TAC th[`l:num`]) THEN REPLICATE_TAC (68-61)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[]; EXISTS_TAC`v2:real^3,w':real^3` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w'):real^3#real^3`]]);;
let V3_DEFOR_RHO_NODE=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ &0<t /\ (!t i. &0<t /\ t<e ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (rho_node1 (IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF) (v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t))) = (rho_node1 FF v2)`,
REWRITE_TAC[rho_node1] THEN STRIP_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF THEN RESA_TAC);;
let V3_DEFOR_RHO_NODE_V1=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e/\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (rho_node1 (IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF) (v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t))) = (rho_node1 FF v2)`,
REWRITE_TAC[rho_node1] THEN STRIP_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF_V1 THEN RESA_TAC);;
let V3_DEFOR_EQ_IN_FF_SYM=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ &0<t /\ (!t i. &0<t /\ t<e ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!w. w,v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF <=> w,v2 IN FF)`,
[ STRIP_TAC THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (40-23)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT THEN RESA_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (47-44)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN REPLICATE_TAC (48-18)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`SUC x':num`]); EXISTS_TAC`w':real^3,v2:real^3` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w',v2):real^3#real^3`]]);;
let V3_DEFOR_EQ_IN_FF_SYM_V1=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!w. w,v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF <=> w,v2 IN FF)`,
[STRIP_TAC THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (40-23)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT THEN RESA_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (47-44)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN REPLICATE_TAC (48-18)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`SUC x':num`]) THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x':num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA_TAC th[`l:num`]) THEN REPLICATE_TAC (68-61)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[]; EXISTS_TAC`w':real^3,v2:real^3` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w',v2):real^3#real^3`]]);;
let DEFORMATION_AZIM_V3_DEFOR_V1=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t. &0< t/\ t< e ==> azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t) (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t)) (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) = azim (vec 0) v2 (rho_node1 FF v2) (@a. a,v2 IN FF)))`,
[ STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] THEN ABBREV_TAC`e1=(min e e')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' ==> &0< e1/\ e1< e/\ e1<e'`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e ==> t< e`) THEN RESA_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF_SYM THEN RESA_TAC THEN ASM_SIMP_TAC[v3_defor_v4;] THEN MP_TAC V3_DEFOR_RHO_NODE THEN RESA_TAC THEN ASM_REWRITE_TAC[GSYM ivs_rho_node1] THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN REPLICATE_TAC (67-31) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) THEN RESA_TAC THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN SUBGOAL_THEN`(w:num->real^3) (l) IN V` ASSUME_TAC; EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; MRESA_TAC (GEN_ALL Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1)[`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3) (l)`]) THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l)`;`w:num->real^3`;`l:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;is_scs_v39;periodic2] THEN POP_ASSUM(fun th-> MRESAL_TAC th[`SUC 0`][ITER] THEN MRESA_TAC th[`k-1`]) THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0+l= SUC(l)/\ k-1+l= l+k-1`] THEN REPLICATE_TAC (75-57) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e' ==> t< e'`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN MATCH_MP_TAC Planarity.aff_gt2_subset_aff_ge THEN ASM_REWRITE_TAC[] THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`(w:num->real^3)(l+k-1)`] THEN STRIP_TAC; MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan THEN EXISTS_TAC`v1:real^3` THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN ASM_REWRITE_TAC[]; MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan THEN EXISTS_TAC`(w:num->real^3)(l+k-1)` THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN ASM_REWRITE_TAC[]]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_V1=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t. --e< t/\ t< e ==> azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t) (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t)) (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) = azim (vec 0) v2 (rho_node1 FF v2) (@a. a,v2 IN FF)))`,
[ STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1 THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] THEN ABBREV_TAC`e1=(min e e')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' ==> &0< e1/\ e1< e/\ e1<e'`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e/\ --e1<t ==> t< e/\ --e<t`) THEN RESA_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF_SYM_V1 THEN RESA_TAC THEN ASM_SIMP_TAC[v3_defor_v4;] THEN MP_TAC V3_DEFOR_RHO_NODE_V1 THEN RESA_TAC THEN ASM_REWRITE_TAC[GSYM ivs_rho_node1] THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN REPLICATE_TAC (68-31) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) THEN RESA_TAC THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN SUBGOAL_THEN`(w:num->real^3) (l) IN V` ASSUME_TAC; EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; MRESA_TAC (GEN_ALL Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1)[`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3) (l)`]) THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l)`;`w:num->real^3`;`l:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;is_scs_v39;periodic2] THEN POP_ASSUM(fun th-> MRESAL_TAC th[`SUC 0`][ITER] THEN MRESA_TAC th[`k-1`]) THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0+l= SUC(l)/\ k-1+l= l+k-1`]; REPLICATE_TAC (76-57) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e' /\ --e1<t ==> t< e'/\ --e'<t`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN MATCH_MP_TAC Planarity.aff_gt2_subset_aff_ge THEN ASM_REWRITE_TAC[] THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`(w:num->real^3)(l+k-1)`] THEN STRIP_TAC; MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan THEN EXISTS_TAC`v1:real^3` THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN ASM_REWRITE_TAC[]; MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan THEN EXISTS_TAC`(w:num->real^3)(l+k-1)` THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN ASM_REWRITE_TAC[]]);;
let V3_DEFOR_EQ_IN_FF_AT_V1=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ &0<t /\ (!t i. &0<t /\ t<e ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!w. v1,w IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF<=> v1,w IN FF)`,
[ STRIP_TAC THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (44-15)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`SUC l:num`]) THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; SUBGOAL_THEN`v1,v2 IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] THEN REPLICATE_TAC (49-8)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN RESA_TAC THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`(w:num->real^3) (l+k-1)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN ASM_REWRITE_TAC[]; EXISTS_TAC`v1:real^3,w':real^3` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) THEN RESA_TAC; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] THEN REPLICATE_TAC (51-8)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN RESA_TAC THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`(w:num->real^3) (l+k-1)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN ASM_REWRITE_TAC[]]);;
let V3_DEFOR_EQ_IN_FF_AT_V1_V1=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!w. v1,w IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF<=> v1,w IN FF)`,
[ STRIP_TAC THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (44-15)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`SUC l:num`]) THEN POP_ASSUM MP_TAC THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th [`l:num`]) THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; SUBGOAL_THEN`v1,v2 IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] THEN REPLICATE_TAC (49-8)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN RESA_TAC THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`(w:num->real^3) (l+k-1)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN ASM_REWRITE_TAC[]; EXISTS_TAC`v1:real^3,w':real^3` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) THEN RESA_TAC; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] THEN REPLICATE_TAC (51-8)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN RESA_TAC THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`(w:num->real^3) (l+k-1)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN ASM_REWRITE_TAC[]]);;
let V3_DEFOR_RHO_NODE_AT_V1=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ &0<t /\ (!t i. &0<t /\ t<e ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (rho_node1 (IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF) v1) =(rho_node1 FF v1)`,
REWRITE_TAC[rho_node1] THEN STRIP_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V1 THEN RESA_TAC);;
let V3_DEFOR_RHO_NODE_AT_V1_V1=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k)==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (rho_node1 (IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF) v1) =(rho_node1 FF v1)`,
REWRITE_TAC[rho_node1] THEN STRIP_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V1_V1 THEN RESA_TAC);;
let V3_DEFOR_EQ_IN_FF_AT_V1_SYM=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ &0<t /\ (!t i. &0<t /\ t<e ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (@w. w,v1 IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF)= v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`,
[ STRIP_TAC THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA THEN STRIP_TAC; EXISTS_TAC`v3_defor_v1 (-- &1) (v1) (v2) x1 x2 x6 x6 (x2 - t)` THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`v2:real^3,v1:real^3` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN RESA_TAC; MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (45-16)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`SUC l:num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC; SUBGOAL_THEN`w',v1 IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v1:real^3`;`FF:real^3#real^3->bool`;`v2:real^3`;`(w':real^3) `]]);;
let V3_DEFOR_EQ_IN_FF_AT_V1_SYM_V1=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (@w. w,v1 IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF)= v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`,
[ STRIP_TAC THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA THEN STRIP_TAC; EXISTS_TAC`v3_defor_v1 (-- &1) (v1) (v2) x1 x2 x6 x6 (x2 - t)` THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`v2:real^3,v1:real^3` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN RESA_TAC; MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (45-16)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`SUC l:num`]) THEN POP_ASSUM MP_TAC THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th [`l:num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC; SUBGOAL_THEN`w',v1 IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v1:real^3`;`FF:real^3#real^3->bool`;`v2:real^3`;`(w':real^3) `]]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_AT_V1=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t. &0< t/\ t< e ==> azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v1 t) (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v1 t)) (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v1 t IN IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) = azim (vec 0) v1 (rho_node1 FF v1) (@a. a,v1 IN FF)))`,
[ STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] THEN ABBREV_TAC`e1=(min e e')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' ==> &0< e1/\ e1< e/\ e1<e'`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e ==> t< e`) THEN RESA_TAC THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V1_SYM THEN RESA_TAC THEN ASM_SIMP_TAC[v3_defor_v4;] THEN MP_TAC V3_DEFOR_RHO_NODE_AT_V1 THEN RESA_TAC THEN ASM_REWRITE_TAC[GSYM ivs_rho_node1] THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN REPLICATE_TAC (73-31) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) THEN RESA_TAC THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v1:real^3`;`v2:real^3`] THEN MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, w (l + k - 1)}/\ aff_gt {vec 0} {v1, w (l + k - 1)} SUBSET aff_ge {vec 0} {v1, w (l + k - 1)} ==> v2 IN aff_ge {vec 0} {v1:real^3, w (l + k - 1)}`) THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] THEN RESA_TAC THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`v1:real^3`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;`(rho_node1 FF v1)`;] THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT THEN STRIP_TAC; MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`aff_gt{vec 0:real^3} {v1,w(l+k-1)}` THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] THEN REPLICATE_TAC (81-57) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(REAL_ARITH`t<e1/\ e1<e'==> t< e'`) THEN ASM_REWRITE_TAC[]; ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan THEN EXISTS_TAC`(w:num->real^3) (l+k-1)` THEN ASM_REWRITE_TAC[] THEN REPLICATE_TAC (81-57) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(REAL_ARITH`t<e1/\ e1<e'==> t< e'`) THEN ASM_REWRITE_TAC[]]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_AT_V1_V1=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t. --e< t/\ t< e ==> azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v1 t) (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v1 t)) (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v1 t IN IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) = azim (vec 0) v1 (rho_node1 FF v1) (@a. a,v1 IN FF)))`,
[ STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1 THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] THEN ABBREV_TAC`e1=(min e e')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' ==> &0< e1/\ e1< e/\ e1<e'`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e/\ --e1<t ==> t< e/\ --e<t`) THEN RESA_TAC THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V1_SYM_V1 THEN RESA_TAC THEN ASM_SIMP_TAC[v3_defor_v4;] THEN MP_TAC V3_DEFOR_RHO_NODE_AT_V1_V1 THEN RESA_TAC THEN ASM_REWRITE_TAC[GSYM ivs_rho_node1] THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC; REPLICATE_TAC (74-31) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) THEN RESA_TAC THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v1:real^3`;`v2:real^3`] THEN MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, w (l + k - 1)}/\ aff_gt {vec 0} {v1, w (l + k - 1)} SUBSET aff_ge {vec 0} {v1, w (l + k - 1)} ==> v2 IN aff_ge {vec 0} {v1:real^3, w (l + k - 1)}`) THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] THEN RESA_TAC THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`v1:real^3`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;`(rho_node1 FF v1)`;] THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT THEN STRIP_TAC; MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`aff_gt{vec 0:real^3} {v1,w(l+k-1)}` THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]; REPLICATE_TAC (82-57) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`t<e1/\ e1<e'/\ --e1<t ==> t< e'/\ --e'<t`) THEN RESA_TAC THEN ASM_REWRITE_TAC[]; ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan THEN EXISTS_TAC`(w:num->real^3) (l+k-1)` THEN ASM_REWRITE_TAC[] THEN REPLICATE_TAC (82-57) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`t<e1/\ e1<e'/\ --e1<t ==> t< e'/\ --e'<t`) THEN RESA_TAC THEN ASM_REWRITE_TAC[]]);;
let V3_DEFOR_EQ_IN_FF_AT_W=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ &0<t /\ (!t i. &0<t /\ t<e ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!v. v,w (l + (scs_k_v39 s - 1)) IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF<=> v,w (l + (scs_k_v39 s - 1)) IN FF)`,
[ STRIP_TAC THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (44-15)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`l+k-1:num`]) THEN POP_ASSUM MP_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; SUBGOAL_THEN`v2, w(l+k-1) IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`SND(x:real^3#real^3)`]); EXISTS_TAC`v:real^3,(w:num->real^3) (l + k - 1)` THEN ASM_REWRITE_TAC[] THEN SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;]; MP_TAC(SET_RULE`v2=v:real^3\/ ~(v=v2)`) THEN RESA_TAC; SUBGOAL_THEN`v2, w(l+k-1) IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3)(l+k-1)`]);]);;
let V3_DEFOR_EQ_IN_FF_AT_W_V1=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!v. v,w (l + (scs_k_v39 s - 1)) IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF<=> v,w (l + (scs_k_v39 s - 1)) IN FF)`,
[ STRIP_TAC THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (44-15)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`l+k-1:num`]) THEN POP_ASSUM MP_TAC THEN MP_TAC MOD_ADD_SUB_1 THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; SUBGOAL_THEN`v2, w(l+k-1) IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`SND(x:real^3#real^3)`]); EXISTS_TAC`v:real^3,(w:num->real^3) (l + k - 1)` THEN ASM_REWRITE_TAC[] THEN SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;]; MP_TAC(SET_RULE`v2=v:real^3\/ ~(v=v2)`) THEN RESA_TAC; SUBGOAL_THEN`v2, w(l+k-1) IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3)(l+k-1)`])]);;
let V3_DEFOR_EQ_IN_FF_AT_W_SYM=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ &0<t /\ (!t i. &0<t /\ t<e ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (@v. w(l+k-1),v IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF)= v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`,
[ STRIP_TAC THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA THEN STRIP_TAC; EXISTS_TAC`v3_defor_v1 (-- &1) (v1) (v2) x1 x2 x6 x6 (x2 - t)` THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`(w:num->real^3) (l + k - 1),v2:real^3` THEN ASM_REWRITE_TAC[] THEN SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;]; REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN RESA_TAC; MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (46-16)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`l+k-1:num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC; SUBGOAL_THEN`(w:num->real^3)(l+k-1),v IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v:real^3`;]]);;
let V3_DEFOR_EQ_IN_FF_AT_W_SYM_V1=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (@v. w(l+k-1),v IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF)= v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`,
[ STRIP_TAC THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA THEN STRIP_TAC; EXISTS_TAC`v3_defor_v1 (-- &1) (v1) (v2) x1 x2 x6 x6 (x2 - t)` THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`(w:num->real^3) (l + k - 1),v2:real^3` THEN ASM_REWRITE_TAC[] THEN SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;]; REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN RESA_TAC; MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (46-16)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`l+k-1:num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC MOD_ADD_SUB_1 THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC; SUBGOAL_THEN`(w:num->real^3)(l+k-1),v IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v:real^3`;] ]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_AT_W=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t. &0< t/\ t< e ==> azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t) (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t)) (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t IN IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) = azim (vec 0) (w (l + k - 1)) (rho_node1 FF (w (l + k - 1))) (@a. a,w (l + k - 1) IN FF)))`,
[ STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] THEN ABBREV_TAC`e1=(min e e')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' ==> &0< e1/\ e1< e/\ e1<e'`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e ==> t< e`) THEN RESA_TAC THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] THEN REPEAT RESA_TAC; ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;] THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_W_SYM THEN RESA_TAC THEN ASM_SIMP_TAC[v3_defor_v4;] THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_W THEN RESA_TAC THEN ASM_REWRITE_TAC[rho_node1] THEN ASM_REWRITE_TAC[GSYM rho_node1;GSYM ivs_rho_node1] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] THEN ONCE_REWRITE_TAC[Rogers.AZIM_EQ_SYM]; MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, w (l + k - 1)}/\ aff_gt {vec 0} {v1, w (l + k - 1)} SUBSET aff_ge {vec 0} {v1, w (l + k - 1)} ==> v2 IN aff_ge {vec 0} {v1:real^3, w (l + k - 1)}`) THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN MRESA_TAC(GEN_ALL Planarity.properties_of_collinear4_points_fan) [`vec 0:real^3`;`(w:num->real^3)(l+k-1)`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN RESA_TAC THEN RESA_TAC THEN RESA_TAC THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`(w:num->real^3)(l+k-1)`;`v2:real^3`;`v1:real^3`;`(ivs_rho_node1 FF (w(l+k-1)))`;] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN RESA_TAC THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT THEN STRIP_TAC; ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`aff_gt{vec 0:real^3} {v1,w(l+k-1)}` THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] THEN REPLICATE_TAC (47-22) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(REAL_ARITH`t<e1/\ e1<e'==> t< e'`) THEN ASM_REWRITE_TAC[]; ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan THEN EXISTS_TAC`v1:real^3` THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN ASM_REWRITE_TAC[] THEN REPLICATE_TAC (47-22) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(REAL_ARITH`t<e1/\ e1<e'==> t< e'`) THEN ASM_REWRITE_TAC[]]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_AT_W_V1=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t. --e< t/\ t< e ==> azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t) (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t)) (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t IN IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) = azim (vec 0) (w (l + k - 1)) (rho_node1 FF (w (l + k - 1))) (@a. a,w (l + k - 1) IN FF)))`,
[ STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1 THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] THEN ABBREV_TAC`e1=(min e e')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' ==> &0< e1/\ e1< e/\ e1<e'`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e/\ --e1<t ==> t< e/\ --e<t`) THEN RESA_TAC THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] THEN REPEAT RESA_TAC; ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (38-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;] THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_W_SYM_V1 THEN RESA_TAC THEN ASM_SIMP_TAC[v3_defor_v4;] THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_W_V1 THEN RESA_TAC THEN ASM_REWRITE_TAC[rho_node1] THEN ASM_REWRITE_TAC[GSYM rho_node1;GSYM ivs_rho_node1] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] THEN ONCE_REWRITE_TAC[Rogers.AZIM_EQ_SYM]; MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, w (l + k - 1)}/\ aff_gt {vec 0} {v1, w (l + k - 1)} SUBSET aff_ge {vec 0} {v1, w (l + k - 1)} ==> v2 IN aff_ge {vec 0} {v1:real^3, w (l + k - 1)}`) THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN MRESA_TAC(GEN_ALL Planarity.properties_of_collinear4_points_fan) [`vec 0:real^3`;`(w:num->real^3)(l+k-1)`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN RESA_TAC THEN RESA_TAC THEN RESA_TAC THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`(w:num->real^3)(l+k-1)`;`v2:real^3`;`v1:real^3`;`(ivs_rho_node1 FF (w(l+k-1)))`;] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN RESA_TAC THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT THEN STRIP_TAC; ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`aff_gt{vec 0:real^3} {v1,w(l+k-1)}` THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] THEN REPLICATE_TAC (48-22) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`t<e1/\ e1<e'/\ --e1<t ==> t< e'/\ --e'<t`) THEN RESA_TAC THEN ASM_REWRITE_TAC[]; ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan THEN EXISTS_TAC`v1:real^3` THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN ASM_REWRITE_TAC[] THEN REPLICATE_TAC (48-22) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`t<e1/\ e1<e'/\ --e1<t==> t< e'/\ --e'<t`) THEN RESA_TAC THEN ASM_REWRITE_TAC[]]);;
let V3_DEFOR_EQ_IN_FF_AT_V_ANY=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ &0<t /\ (!t i. &0<t /\ t<e ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V /\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(l+k-1)) /\ v IN V ==> (!w. v,w IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF<=> v,w IN FF)`,
[ STRIP_TAC THEN REPLICATE_TAC (24-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (42-25)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (49-23)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN REPLICATE_TAC (50-16)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`x':num`]) THEN REPLICATE_TAC (50-46)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN POP_ASSUM MP_TAC THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; SUBGOAL_THEN`v,v2 IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`(w:num->real^3) (l+k-1)`]; EXISTS_TAC`v:real^3,w':real^3` THEN ASM_REWRITE_TAC[] THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) THEN RESA_TAC; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`(w:num->real^3) (l+k-1)`]]);;
let V3_DEFOR_EQ_IN_FF_AT_V_ANY_V1=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V /\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(l+k-1)) /\ v IN V ==> (!w. v,w IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF<=> v,w IN FF)`,
[ STRIP_TAC THEN REPLICATE_TAC (24-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (42-25)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (49-23)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN REPLICATE_TAC (50-16)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`x':num`]) THEN REPLICATE_TAC (50-46)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN POP_ASSUM MP_TAC THEN MRESA_TAC DIVISION[`x':num`;`k:num`] THEN MRESA_TAC DIVISION[`l:num`;`k:num`] THEN MP_TAC(SET_RULE`x' MOD k = l MOD k \/ ~(x' MOD k = l MOD k)`) THEN RESA_TAC; ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x':num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA_TAC th[`l:num`]) THEN REPLICATE_TAC (77-39)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[]; RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; SUBGOAL_THEN`v,v2 IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`(w:num->real^3) (l+k-1)`]; EXISTS_TAC`v:real^3,w':real^3` THEN ASM_REWRITE_TAC[] THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) THEN RESA_TAC; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`(w:num->real^3) (l+k-1)`]]);;
let V3_DEFOR_EQ_IN_FF_AT_V_ANY_SYM=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ &0<t /\ (!t i. &0<t /\ t<e ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V /\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(l+k-1)) /\ v IN V ==> (!w. w,v IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF<=> w,v IN FF)`,
[ STRIP_TAC THEN REPLICATE_TAC (24-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (42-25)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (49-23)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN REPLICATE_TAC (50-16)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`x':num`]) THEN REPLICATE_TAC (50-47)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN POP_ASSUM MP_TAC THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; SUBGOAL_THEN`v2,v IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`v1:real^3`;] THEN REPLICATE_TAC (54-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[]; EXISTS_TAC`w':real^3,v:real^3` THEN ASM_REWRITE_TAC[] THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) THEN RESA_TAC; SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`v1:real^3`;] THEN REPLICATE_TAC (54-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[]]);;
let V3_DEFOR_EQ_IN_FF_AT_V_ANY_SYM_V1=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V /\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(l+k-1)) /\ v IN V ==> (!w. w,v IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF<=> w,v IN FF)`,
[ STRIP_TAC THEN REPLICATE_TAC (24-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (42-25)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (49-23)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN REPLICATE_TAC (50-16)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`x':num`]) THEN REPLICATE_TAC (50-47)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN POP_ASSUM MP_TAC THEN MRESA_TAC DIVISION[`x':num`;`k:num`] THEN MRESA_TAC DIVISION[`l:num`;`k:num`] THEN MP_TAC(SET_RULE`x' MOD k = l MOD k \/ ~(x' MOD k = l MOD k)`) THEN RESA_TAC; ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x':num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA_TAC th[`l:num`]) THEN REPLICATE_TAC (77-39)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[]; RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; SUBGOAL_THEN`v2,v IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`v1:real^3`;] THEN REPLICATE_TAC (54-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[]; EXISTS_TAC`w':real^3,v:real^3` THEN ASM_REWRITE_TAC[] THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) THEN RESA_TAC; SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`v1:real^3`;] THEN REPLICATE_TAC (54-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[]]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_AT_V_ANY=
prove( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t v. &0< t/\ t< e /\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(l+k-1)) /\ v IN V ==> azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t)) (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t IN IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) = azim (vec 0) v (rho_node1 FF v) (@a. a,v IN FF)))`,
STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] THEN ABBREV_TAC`e1=(min e e')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' ==> &0< e1/\ e1< e/\ e1<e'`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e ==> t< e`) THEN RESA_TAC THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V_ANY_SYM THEN RESA_TAC THEN ASM_SIMP_TAC[v3_defor_v4;] THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V_ANY THEN RESA_TAC THEN ASM_SIMP_TAC[rho_node1;]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_AT_V_ANY_V1=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t v. --e< t/\ t< e /\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(l+k-1)) /\ v IN V ==> azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t)) (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t IN IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) = azim (vec 0) v (rho_node1 FF v) (@a. a,v IN FF)))`,
STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1 THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] THEN ABBREV_TAC`e1=(min e e')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' ==> &0< e1/\ e1< e/\ e1<e'`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e/\ --e1<t ==> t< e/\ --e<t`) THEN RESA_TAC THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V_ANY_SYM_V1 THEN RESA_TAC THEN ASM_SIMP_TAC[v3_defor_v4;] THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V_ANY_V1 THEN RESA_TAC THEN ASM_SIMP_TAC[rho_node1;]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t v. &0< t/\ t< e /\ v IN V ==> azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t) (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t)) (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t IN IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) = azim (vec 0) (v) (rho_node1 FF (v)) (@a. a,v IN FF)))`,
[ STRIP_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_W THEN RESA_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_V1 THEN RESA_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1 THEN RESA_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_V_ANY THEN RESA_TAC THEN ABBREV_TAC`e1=(min (min (min e e') e'')e''')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'')e''')/ &2/\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''==> &0< e1/\ e1<e/\ e1<e'/\ e1< e''/\ e1< e'''`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT RESA_TAC THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'')e''')/ &2/\ &0< e/\ &0< e'/\ &0< e''/\ t<e1/\ &0<t/\ &0< e'''==> t<e/\ t<e'/\ t< e''/\ t < e'''`) THEN RESA_TAC THEN MP_TAC(SET_RULE`(v=(w:num->real^3)(l+k-1))\/ ~(v=(w:num->real^3)(l+k-1))`) THEN RESA_TAC; REPLICATE_TAC (40-20) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[]; MP_TAC(SET_RULE`(v=(v1:real^3))\/ ~(v=v1)`) THEN RESA_TAC; REPLICATE_TAC (41-22) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[]; MP_TAC(SET_RULE`(v=(v2:real^3))\/ ~(v=v2)`) THEN RESA_TAC; REPLICATE_TAC (42-24) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[]; REPLICATE_TAC (42-26) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[]]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_V1=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t v. --e< t/\ t< e /\ v IN V ==> azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t) (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t)) (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t IN IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) = azim (vec 0) (v) (rho_node1 FF (v)) (@a. a,v IN FF)))`,
[ STRIP_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_W_V1 THEN RESA_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_V1_V1 THEN RESA_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_V1 THEN RESA_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_V_ANY_V1 THEN RESA_TAC THEN ABBREV_TAC`e1=(min (min (min e e') e'')e''')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'')e''')/ &2/\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''==> &0< e1/\ e1<e/\ e1<e'/\ e1< e''/\ e1< e'''`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT RESA_TAC THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'')e''')/ &2/\ &0< e/\ &0< e'/\ &0< e''/\ t<e1/\ --e1<t/\ &0< e'''==> t<e/\ t<e'/\ t< e''/\ t < e''' /\ --e< t/\ --e'<t /\ --e''<t/\ --e'''<t`) THEN RESA_TAC THEN MP_TAC(SET_RULE`(v=(w:num->real^3)(l+k-1))\/ ~(v=(w:num->real^3)(l+k-1))`) THEN RESA_TAC; REPLICATE_TAC (44-20) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[]; MP_TAC(SET_RULE`(v=(v1:real^3))\/ ~(v=v1)`) THEN RESA_TAC; REPLICATE_TAC (45-22) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[]; MP_TAC(SET_RULE`(v=(v2:real^3))\/ ~(v=v2)`) THEN RESA_TAC; REPLICATE_TAC (46-24) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[]; REPLICATE_TAC (46-26) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[]]);;
let DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!v t. v IN V /\ &0< t /\ t< e /\ interior_angle1 (vec 0) FF v = pi ==> interior_angle1 (vec 0) (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) <= pi))`,
REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL THEN RESA_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[interior_angle1] THEN REPEAT RESA_TAC THEN REPLICATE_TAC (24-20) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`t:real`;`v:real^3`]) THEN REAL_ARITH_TAC);;
let DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!v t. v IN V /\ --e< t /\ t< e /\ interior_angle1 (vec 0) FF v = pi ==> interior_angle1 (vec 0) (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) <= pi))`,
REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_V1 THEN RESA_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[interior_angle1] THEN REPEAT RESA_TAC THEN REPLICATE_TAC (24-20) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`t:real`;`v:real^3`]) THEN REAL_ARITH_TAC);;
let V_DEFORMATION_V3_DEFOR=
prove(` IMAGE (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w i) t) (:num) =IMAGE (\v. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) (IMAGE w (:num))`,
REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION] THEN SET_TAC[]);;
let E_DEFORMATION_V3_DEFOR=
prove_by_refinement(`IMAGE (\i. {v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w i) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC i)) t}) (:num) = IMAGE (IMAGE (\v. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t)) (IMAGE (\i. {w i, w (SUC i)}) (:num))`,
[REWRITE_TAC[EXTENSION] THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC; RESA_TAC THEN EXISTS_TAC`{(w:num->real^3) x', w (SUC x')}` THEN STRIP_TAC; EXISTS_TAC`x':num` THEN ASM_REWRITE_TAC[]; SET_TAC[]; RESA_TAC THEN EXISTS_TAC`x'':num` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]]);;
let F_DEFORMATION_V3_DEFOR=
prove(`IMAGE (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w i) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC i)) t) (:num) = IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) (IMAGE (\i. w i,w (SUC i)) (:num))`,
REWRITE_TAC[EXTENSION;IMAGE;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC THENL[ RESA_TAC THEN EXISTS_TAC`(w:num->real^3) x',w (SUC x')` THEN ASM_REWRITE_TAC[] THEN EXISTS_TAC`x':num` THEN ASM_REWRITE_TAC[]; RESA_TAC THEN EXISTS_TAC`x'':num` THEN ASM_REWRITE_TAC[]]);;
let DEFORMATION_LUNAR_AFFINE_HULL=
prove_by_refinement( `3<k /\ scs_k_v39 s =k/\ is_scs_v39 s /\ MMs_v39 s w /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ w l=v2/\ w (SUC l) =v1/\ ~(norm v2 = &2) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ ~(v=v2)/\ ~(w1=v2) /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V /\ IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)=E /\ lunar (v,w1) V E ==> ?e. &0<e /\ (!t. &0 < t /\ t < e ==> v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN affine hull {vec 0, v, w1, v2})`,
[ STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ THEN RESA_TAC THEN MP_TAC HYPER_MM_COLLINEAR THEN RESA_TAC THEN REPLICATE_TAC (25-6)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> POP_ASSUM(fun th1-> REPEAT DISCH_TAC THEN MP_TAC th THEN MP_TAC th1)) THEN REPEAT RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] THEN REPLICATE_TAC (27-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;] THEN MP_TAC th THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REPEAT RESA_TAC) THEN MP_TAC BBS_IMP_CONVEX_LOCAL_FAN THEN RESA_TAC THEN SUBGOAL_THEN`(v2:real^3) IN V` ASSUME_TAC; EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`v1:real^3`;] THEN MRESAL_TAC (GEN_ALL LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI) [`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w1:real^3`;][DIFF;IN_ELIM_THM;SET_RULE`~(a IN {b,c}) <=> (~(a=b)/\ ~(a=c))`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`v2:real^3`]) THEN MRESA_TAC (GEN_ALL Collect_geom2.THREE_GEN_POINTS_IN_AFF3)[`v2:real^3`;`v:real^3`;`w1:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.CONV02_SUBSET_AFF2)[`v:real^3`;`w1:real^3`] THEN MP_TAC(SET_RULE`v IN aff {v2, v, w1}/\ w1 IN aff {v2, v, w1} ==> {v, w1} SUBSET aff {v2, v, w1:real^3}`) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{v, w1:real^3}`;` {v2, v, w1:real^3}`] THEN MP_TAC(SET_RULE`v1 IN aff {v2, v, w1}/\ w (l + k - 1) IN aff {v2, v, w1} /\ vec 0 IN conv0 {v, w1} /\ conv0 {v, w1} SUBSET aff {v, w1} /\ aff {v, w1} SUBSET aff {v2, v, w1} ==> {vec 0, v1, w (l + k - 1)} SUBSET aff {v2, v, w1:real^3}`) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{vec 0, v1, w (l + k - 1):real^3}`;` {v2, v, w1:real^3}`] THEN MRESAL_TAC (GEN_ALL Local_lemmas.AFF_GT_SUB_AFF_UNION)[`{vec 0:real^3}`;`{ v1, w (l + k - 1):real^3}`][SET_RULE`{A}UNION {B,C}={A,B,C}`] THEN EXISTS_TAC`e':real` THEN ASM_REWRITE_TAC[] THEN REPEAT RESA_TAC THEN REPLICATE_TAC (66-27)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`]) THEN REWRITE_TAC[GSYM aff] THEN MRESAL_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA[`{v2, v, w1:real^3}`;`{vec 0,v, w1,v2:real^3}`][SET_RULE`{A,B,C} SUBSET {D,B,C,A}`;GSYM aff] THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`aff {v2, v, w1:real^3}` THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`aff {vec 0, v1, w (l + k - 1):real^3}` THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`aff_gt {vec 0} {v1, w (l + k - 1):real^3}` THEN ASM_REWRITE_TAC[v3_defor_v4]]);;
let DEFORMATION_LUNAR_AFFINE_HULL_V1=
prove_by_refinement(`3<k /\ scs_k_v39 s =k/\ is_scs_v39 s /\ MMs_v39 s w /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ w l=v2/\ w (SUC l) =v1/\ ~(norm v2 = &2) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ ~(v=v2)/\ ~(w1=v2) /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V /\ IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)=E /\ lunar (v,w1) V E ==> ?e. &0<e /\ (!t. t IN real_interval (--e,e) ==> v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN affine hull {vec 0, v, w1, v2})`,
[ STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1 THEN RESA_TAC THEN MP_TAC HYPER_MM_COLLINEAR THEN RESA_TAC THEN REPLICATE_TAC (25-6)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> POP_ASSUM(fun th1-> REPEAT DISCH_TAC THEN MP_TAC th THEN MP_TAC th1)) THEN REPEAT RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] THEN REPLICATE_TAC (27-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;IN_REAL_INTERVAL] THEN MP_TAC th THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REPEAT RESA_TAC) THEN MP_TAC BBS_IMP_CONVEX_LOCAL_FAN THEN RESA_TAC THEN SUBGOAL_THEN`(v2:real^3) IN V` ASSUME_TAC; EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`v1:real^3`;] THEN MRESAL_TAC (GEN_ALL LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI) [`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w1:real^3`;][DIFF;IN_ELIM_THM;SET_RULE`~(a IN {b,c}) <=> (~(a=b)/\ ~(a=c))`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`v2:real^3`]) THEN MRESA_TAC (GEN_ALL Collect_geom2.THREE_GEN_POINTS_IN_AFF3)[`v2:real^3`;`v:real^3`;`w1:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.CONV02_SUBSET_AFF2)[`v:real^3`;`w1:real^3`] THEN MP_TAC(SET_RULE`v IN aff {v2, v, w1}/\ w1 IN aff {v2, v, w1} ==> {v, w1} SUBSET aff {v2, v, w1:real^3}`) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{v, w1:real^3}`;` {v2, v, w1:real^3}`] THEN MP_TAC(SET_RULE`v1 IN aff {v2, v, w1}/\ w (l + k - 1) IN aff {v2, v, w1} /\ vec 0 IN conv0 {v, w1} /\ conv0 {v, w1} SUBSET aff {v, w1} /\ aff {v, w1} SUBSET aff {v2, v, w1} ==> {vec 0, v1, w (l + k - 1)} SUBSET aff {v2, v, w1:real^3}`) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{vec 0, v1, w (l + k - 1):real^3}`;` {v2, v, w1:real^3}`] THEN MRESAL_TAC (GEN_ALL Local_lemmas.AFF_GT_SUB_AFF_UNION)[`{vec 0:real^3}`;`{ v1, w (l + k - 1):real^3}`][SET_RULE`{A}UNION {B,C}={A,B,C}`] THEN EXISTS_TAC`e':real` THEN ASM_REWRITE_TAC[] THEN REPEAT RESA_TAC THEN REPLICATE_TAC (66-27)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`]) THEN REWRITE_TAC[GSYM aff] THEN MRESAL_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA[`{v2, v, w1:real^3}`;`{vec 0,v, w1,v2:real^3}`][SET_RULE`{A,B,C} SUBSET {D,B,C,A}`;GSYM aff] THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`aff {v2, v, w1:real^3}` THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`aff {vec 0, v1, w (l + k - 1):real^3}` THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`aff_gt {vec 0} {v1, w (l + k - 1):real^3}` THEN ASM_REWRITE_TAC[v3_defor_v4];]);;
(******************************) let MHAEYJNv1_concl = `!a b V E FF f v w u. convex_local_fan (V,E,FF) /\ lunar (v,w) V E /\ deformation f V (a,b) /\ interior_angle1 (vec 0) FF v < pi /\ u IN V /\ ~(u = v) /\ ~(u = w) /\ (!u' t. u' IN V /\ ~(u = u') /\ t IN real_interval (a,b) ==> f u' t = u') /\ (!t. &0< t/\ t<b ==> f u t IN affine hull {vec 0, v, w, u}) ==> (?e. &0 < e /\ (!t. --e < t /\ t < e ==> convex_local_fan (IMAGE (\v. f v t) V, IMAGE (IMAGE (\v. f v t)) E, IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) /\ lunar (v,w) (IMAGE (\v. f v t) V) (IMAGE (IMAGE (\v. f v t)) E)))`;; let ZLZTHICv1_concl = `!a b V E FF f. convex_local_fan (V,E,FF) /\ generic V E /\ deformation f V (a,b) /\ (!v t. v IN V /\ &0<t/\ t<b /\ interior_angle1 (vec 0) FF v = pi ==> interior_angle1 (vec 0) ( IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) (f v t) <= pi) ==> (?e. &0 < e /\ (!t. --e < t /\ t < e ==> convex_local_fan (IMAGE (\v. f v t) V, IMAGE (IMAGE (\v. f v t)) E, IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) /\ generic (IMAGE (\v. f v t) V) (IMAGE (IMAGE (\v. f v t)) E)))`;; let V3_DEFOR_CONVEX_LOCAL_FAN_concl =`!s k w l. scs_k_v39 s=k /\ is_scs_v39 s /\ MMs_v39 s w /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ 3 < k /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ (&10= &10) /\ ~(&2 = norm (v2)) /\ (&1= &1) /\ (!i. ~(scs_J_v39 s l i)) /\ w l=v2/\ w (SUC l) =v1/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1/\ (!V E v. V = IMAGE w (:num) /\ E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> ~(lunar (v,(w l)) V E )) ==> (?e. &0 < e /\ (!t. --e < t /\ t < e ==> convex_local_fan (IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t) (:num), IMAGE (\i. {v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t, v3_defor_v4 a x1 x2 x6 v1 v2 (w (SUC i)) t}) (:num), IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t, v3_defor_v4 a x1 x2 x6 v1 v2 (w (SUC i)) t) (:num))))`;;
let V3_DEFOR_DEFORMATION_CONVEX_LOCAL_FAN=prove_by_refinement((mk_imp(ZLZTHICv1_concl, mk_imp (MHAEYJNv1_concl, V3_DEFOR_CONVEX_LOCAL_FAN_concl))),
[
REPEAT STRIP_TAC
;

REPLICATE_TAC (19-4)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC th
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN ASSUME_TAC th
THEN STRIP_TAC)
THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)`
THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`
THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)`
THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;]
THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`]
THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`)
THEN RESA_TAC
THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC;


REPLICATE_TAC (38-19)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC)
;

SUBGOAL_THEN`(v2:real^3) IN V` ASSUME_TAC;


EXPAND_TAC"V"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`l:num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`];


SUBGOAL_THEN`(v1:real^3) IN V` ASSUME_TAC;


EXPAND_TAC"V"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`SUC l:num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`];

SUBGOAL_THEN`(v2:real^3) IN ball_annulus` ASSUME_TAC;


REPLICATE_TAC (41-19)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC)
THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`))
THEN EXISTS_TAC`V:real^3->bool`
THEN ASM_REWRITE_TAC[];



SUBGOAL_THEN`(v1:real^3) IN ball_annulus` ASSUME_TAC;


REPLICATE_TAC (42-19)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC)
THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`))
THEN EXISTS_TAC`V:real^3->bool`
THEN ASM_REWRITE_TAC[];



SUBGOAL_THEN`((v2,v1):real^3#real^3) IN FF`ASSUME_TAC
;


EXPAND_TAC"FF"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`l:num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`];

MP_TAC Local_lemmas.CVLF_LF_F
THEN RESA_TAC
THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN STRIP_TAC
THEN MP_TAC NORM_POS_COLLINEAR
THEN RESA_TAC
THEN MP_TAC V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION
THEN RESA_TAC
THEN MP_TAC UPS_X_POS_SEG
THEN RESA_TAC
;



MRESA_TAC Deformation.XRECQNS[`-- &1`;`&1`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ww_defor ((w:num->real^3) l)`]
THEN MRESAL_TAC (GEN_ALL V3_DEFOR_DEFORMATION)[`x2:real`;`x6:real`;`a:real`;`x1:real`;`x2:real`;`x6:real`;`v1:real^3`;`v2:real^3`;`V:real^3->bool`][REAL_ARITH`&0< &1`]
THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH
THEN RESA_TAC;


MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR
THEN RESA_TAC
;


ABBREV_TAC`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2`
THEN MP_TAC(REAL_ARITH`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e'''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\  -- e'''<= --e1/\ --e1< &0/\ e1< e''''`)
THEN RESA_TAC
;


MRESA_TAC (GEN_ALL DEFORMATION_SMALL_INTERVAL)[`-- e''':real`;`e''':real`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`;`V:real^3->bool`;`--e1:real`;`e1:real`]
THEN REPLICATE_TAC (73-0) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC th[`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`])
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`(!v t.
           v IN V /\
           &0< t /\ t< e1 /\
           interior_angle1 (vec 0) FF v = pi
           ==> interior_angle1 (vec 0)
               (IMAGE
                (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t,
                      v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t)
               FF)
               (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) <=
               pi)`ASSUME_TAC;


REPEAT RESA_TAC
THEN REPLICATE_TAC (76-61)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MATCH_MP_TAC th)
THEN ASM_REWRITE_TAC[]
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''==> t<e''''`)
THEN RESA_TAC;

RESA_TAC
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN EXISTS_TAC`e''''':real`
THEN ASM_REWRITE_TAC[V_DEFORMATION_V3_DEFOR;E_DEFORMATION_V3_DEFOR;F_DEFORMATION_V3_DEFOR]
THEN GEN_TAC
THEN POP_ASSUM(fun th-> STRIP_TAC
THEN MRESA_TAC th[`t:real`]);



(***********lunar**********)


MRESAL_TAC JKQEWGV3[`s:scs_v39`;`w:num->real^3`;`v:real^3`;`w':real^3`][LET_DEF;LET_END_DEF;]
THEN MP_TAC(REAL_ARITH`interior_angle1 (vec 0) FF v < pi / &2/\ &0< pi
==> interior_angle1 (vec 0) FF v < pi`)
THEN ASM_REWRITE_TAC[PI_WORKS]
THEN RESA_TAC
THEN STRIP_TAC
THEN SUBGOAL_THEN`~(v2=v:real^3)`ASSUME_TAC;


POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`w':real^3`])
THEN STRIP_TAC
THEN POP_ASSUM(fun th->
ASM_TAC
THEN REWRITE_TAC[th]
THEN REPEAT RESA_TAC)
THEN ASM_REWRITE_TAC[Local_lemmas.LUNAR_COMM];


SUBGOAL_THEN`~(v2=w':real^3)`ASSUME_TAC;


REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`])
THEN STRIP_TAC
THEN POP_ASSUM(fun th->
ASM_TAC
THEN REWRITE_TAC[th]
THEN REPEAT RESA_TAC);


POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN ABBREV_TAC`w1=w':real^3`
THEN MP_TAC DEFORMATION_LUNAR_AFFINE_HULL
THEN RESA_TAC
THEN ABBREV_TAC`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2`
THEN MP_TAC(REAL_ARITH`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e'''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\  -- e'''<= --e1/\ --e1< &0/\ e1< e''''`)
THEN RESA_TAC
THEN SUBGOAL_THEN`(!u' t.
           u' IN V /\ ~(v2 = u':real^3) /\ t IN real_interval (--e1,e1)
           ==> v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 u' t = u')`ASSUME_TAC;


REPEAT STRIP_TAC
THEN REWRITE_TAC[v3_defor_v4]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[th]);



SUBGOAL_THEN`(!t. &0< t/\ t< e1
       ==> v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN
           affine hull {vec 0, v, w1, v2})`ASSUME_TAC
;


REPEAT RESA_TAC
THEN REPLICATE_TAC (80-67)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MATCH_MP_TAC th)
THEN ASM_REWRITE_TAC[]
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''==> t<e''''`)
THEN RESA_TAC;

MRESA_TAC (GEN_ALL DEFORMATION_SMALL_INTERVAL)[`-- e''':real`;`e''':real`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`;`V:real^3->bool`;`--e1:real`;`e1:real`]
THEN REPLICATE_TAC (80-1) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC th[`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`;`v:real^3`;`w':real^3`;`v2:real^3`])
THEN POP_ASSUM MP_TAC
;


RESA_TAC
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN EXISTS_TAC`e''''':real`
THEN ASM_REWRITE_TAC[V_DEFORMATION_V3_DEFOR;E_DEFORMATION_V3_DEFOR;F_DEFORMATION_V3_DEFOR]
THEN GEN_TAC
THEN POP_ASSUM(fun th-> STRIP_TAC
THEN MRESA_TAC th[`t:real`]);






]);;
let V3_DEFOR_DEFORMATION_CONVEX_LOCAL_FAN_V1=prove_by_refinement((mk_imp(ZLZTHIC_concl, mk_imp (MHAEYJN_concl, V3_DEFOR_CONVEX_LOCAL_FAN_concl))),
[

REPEAT STRIP_TAC;


REPLICATE_TAC (19-4)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC th
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN ASSUME_TAC th
THEN STRIP_TAC)
THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)`
THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`
THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)`
THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;]
THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`]
THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`)
THEN RESA_TAC
THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC;



REPLICATE_TAC (38-19)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC);


SUBGOAL_THEN`(v2:real^3) IN V` ASSUME_TAC;



EXPAND_TAC"V"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`l:num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`];



SUBGOAL_THEN`(v1:real^3) IN V` ASSUME_TAC;



EXPAND_TAC"V"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`SUC l:num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`];


SUBGOAL_THEN`(v2:real^3) IN ball_annulus` ASSUME_TAC;



REPLICATE_TAC (41-19)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC)
THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`))
THEN EXISTS_TAC`V:real^3->bool`
THEN ASM_REWRITE_TAC[];




SUBGOAL_THEN`(v1:real^3) IN ball_annulus` ASSUME_TAC;



REPLICATE_TAC (42-19)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC)
THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`))
THEN EXISTS_TAC`V:real^3->bool`
THEN ASM_REWRITE_TAC[];




SUBGOAL_THEN`((v2,v1):real^3#real^3) IN FF`ASSUME_TAC;



EXPAND_TAC"FF"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`l:num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`];


MP_TAC Local_lemmas.CVLF_LF_F
THEN RESA_TAC
THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN STRIP_TAC
THEN MP_TAC NORM_POS_COLLINEAR
THEN RESA_TAC
THEN MP_TAC V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION
THEN RESA_TAC
THEN MP_TAC UPS_X_POS_SEG
THEN RESA_TAC;




MRESA_TAC Deformation.XRECQNS[`-- &1`;`&1`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ww_defor ((w:num->real^3) l)`]
THEN MRESAL_TAC (GEN_ALL V3_DEFOR_DEFORMATION)[`x2:real`;`x6:real`;`a:real`;`x1:real`;`x2:real`;`x6:real`;`v1:real^3`;`v2:real^3`;`V:real^3->bool`][REAL_ARITH`&0< &1`]
THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH
THEN RESA_TAC;



MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1
THEN RESA_TAC;



ABBREV_TAC`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2`
THEN MP_TAC(REAL_ARITH`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e'''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\  -- e'''<= --e1/\ --e1< &0/\ e1< e''''`)
THEN RESA_TAC;



MRESA_TAC (GEN_ALL DEFORMATION_SMALL_INTERVAL)[`-- e''':real`;`e''':real`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`;`V:real^3->bool`;`--e1:real`;`e1:real`]
THEN REPLICATE_TAC (73-0) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC th[`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`])
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`(!v t.
           v IN V /\
           t IN real_interval (--e1,e1) /\
           interior_angle1 (vec 0) FF v = pi
           ==> interior_angle1 (vec 0)
               (IMAGE
                (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t,
                      v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t)
               FF)
               (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) <=
               pi)`ASSUME_TAC;


ASM_REWRITE_TAC[IN_REAL_INTERVAL]
THEN REPEAT RESA_TAC
THEN REPLICATE_TAC (76-61)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MATCH_MP_TAC th)
THEN ASM_REWRITE_TAC[IN_REAL_INTERVAL]
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''/\ --e1 <t ==> t<e''''/\ --e''''<t`)
THEN RESA_TAC;


RESA_TAC
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN EXISTS_TAC`e''''':real`
THEN ASM_REWRITE_TAC[V_DEFORMATION_V3_DEFOR;E_DEFORMATION_V3_DEFOR;F_DEFORMATION_V3_DEFOR]
THEN GEN_TAC
THEN POP_ASSUM(fun th-> STRIP_TAC
THEN MRESA_TAC th[`t:real`]);




(***********lunar**********)


MRESAL_TAC JKQEWGV3[`s:scs_v39`;`w:num->real^3`;`v:real^3`;`w':real^3`][LET_DEF;LET_END_DEF;]
THEN MP_TAC(REAL_ARITH`interior_angle1 (vec 0) FF v < pi / &2/\ &0< pi
==> interior_angle1 (vec 0) FF v < pi`)
THEN ASM_REWRITE_TAC[PI_WORKS]
THEN RESA_TAC
THEN STRIP_TAC
THEN SUBGOAL_THEN`~(v2=v:real^3)`ASSUME_TAC;



POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`w':real^3`])
THEN STRIP_TAC
THEN POP_ASSUM(fun th->
ASM_TAC
THEN REWRITE_TAC[th]
THEN REPEAT RESA_TAC)
THEN ASM_REWRITE_TAC[Local_lemmas.LUNAR_COMM];



SUBGOAL_THEN`~(v2=w':real^3)`ASSUME_TAC;



REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`])
THEN STRIP_TAC
THEN POP_ASSUM(fun th->
ASM_TAC
THEN REWRITE_TAC[th]
THEN REPEAT RESA_TAC);



POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN ABBREV_TAC`w1=w':real^3`
THEN MP_TAC DEFORMATION_LUNAR_AFFINE_HULL_V1
THEN RESA_TAC
THEN ABBREV_TAC`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2`
THEN MP_TAC(REAL_ARITH`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e'''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\  -- e'''<= --e1/\ --e1< &0/\ e1< e''''`)
THEN RESA_TAC
THEN SUBGOAL_THEN`(!u' t.
           u' IN V /\ ~(v2 = u':real^3) /\ t IN real_interval (--e1,e1)
           ==> v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 u' t = u')`ASSUME_TAC;



REPEAT STRIP_TAC
THEN REWRITE_TAC[v3_defor_v4]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[th]);




SUBGOAL_THEN`(!t. t IN real_interval (--e1,e1)
       ==> v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN
           affine hull {vec 0, v, w1, v2})`ASSUME_TAC;

ASM_REWRITE_TAC[IN_REAL_INTERVAL]
THEN REPEAT RESA_TAC
THEN REPLICATE_TAC (80-67)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MATCH_MP_TAC th)
THEN ASM_REWRITE_TAC[IN_REAL_INTERVAL]
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''/\ --e1<t==> t<e''''/\ --e''''<t`)
THEN RESA_TAC;


MRESA_TAC (GEN_ALL DEFORMATION_SMALL_INTERVAL)[`-- e''':real`;`e''':real`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`;`V:real^3->bool`;`--e1:real`;`e1:real`]
THEN REPLICATE_TAC (80-1) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC th[`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`;`v:real^3`;`w':real^3`;`v2:real^3`])
THEN POP_ASSUM MP_TAC
;


RESA_TAC
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN EXISTS_TAC`e''''':real`
THEN ASM_REWRITE_TAC[V_DEFORMATION_V3_DEFOR;E_DEFORMATION_V3_DEFOR;F_DEFORMATION_V3_DEFOR]
THEN GEN_TAC
THEN POP_ASSUM(fun th-> STRIP_TAC
THEN MRESA_TAC th[`t:real`]);





]);;
let CARD_FF_EQ_V3_DEFOR_DEFORMATION=
prove(`scs_k_v39 s =k /\ IMAGE (w:num->real^3) (:num)=V/\ is_scs_v39 s /\ 3< k/\ BBs_v39 s w /\(!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t)) ==> (!t. &0< t/\ t< e1==> CARD (IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t, v3_defor_v4 a x1 x2 x6 v1 v2 (w (SUC i)) t) (:num)) =CARD(IMAGE (\i. w i,w (SUC i)) (:num)))`,
STRIP_TAC THEN GEN_TAC THEN POP_ASSUM(fun th-> STRIP_TAC THEN MRESA_TAC th[`t:real`]) THEN MRESA_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`] THEN MRESA_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`(\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t)`;`IMAGE ((\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t)) (:num)`;`k:num`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k<= 3)`) THEN RESA_TAC THEN POP_ASSUM(fun th-> ASM_TAC THEN ASSUME_TAC(th) THEN REPEAT RESA_TAC) THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;convex_local_fan] THEN REPEAT RESA_TAC THEN MRESA_TAC(GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) [`IMAGE (\i. { v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t, v3_defor_v4 a x1 x2 x6 v1 v2 (w (SUC i)) t}) (:num)`;`IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t,v3_defor_v4 a x1 x2 x6 v1 v2 (w (SUC i)) t) (:num)`;`IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (:num)`] THEN MRESA_TAC(GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) [`IMAGE (\i. {w i, (w:num->real^3) (SUC i)}) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`V:real^3->bool`]);;
let DSV_V3_DEFOR_EQ=
prove_by_refinement( `scs_k_v39 s=k/\ is_scs_v39 s /\ BBs_v39 s w /\ (!i. ~(scs_J_v39 s l i)) ==> dsv_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 (w l) (w i) t) = dsv_v39 s w`,
[ REWRITE_TAC[dsv_v39] THEN STRIP_TAC THEN MATCH_MP_TAC(REAL_ARITH`a=b==> c+a=c+b`) THEN MP_TAC(SET_RULE`is_ear_v39 s\/ ~(is_ear_v39 s)`) THEN RESA_TAC THEN MATCH_MP_TAC(REAL_ARITH`a=b==> #0.1*a= #0.1*b`); REWRITE_TAC[REAL_ARITH`&1 *a=a`] THEN MATCH_MP_TAC SUM_EQ THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN MP_TAC(SET_RULE`(w:num->real^3) l= w x\/ ~(w l =w x)`) THEN RESA_TAC; MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] THEN REPEAT RESA_TAC THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) THEN RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`l MOD k:num`;`x:num`]) THEN REPLICATE_TAC (34-25) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`SUC x:num`;]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (SUC x)`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]); MP_TAC(SET_RULE`(w:num->real^3) l= w (SUC x)\/ ~(w l =w (SUC x))`) THEN RESA_TAC; MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] THEN REPEAT RESA_TAC THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) THEN RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] THEN POP_ASSUM MP_TAC THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] THEN MRESA_TAC DIVISION[`SUC x:num`;`scs_k_v39 s`] THEN REPLICATE_TAC (6) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`l MOD k:num`;`SUC x MOD k:num`]) THEN REPLICATE_TAC (37-25) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`x:num`;]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (x)`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); ASM_REWRITE_TAC[v3_defor_v4]; REWRITE_TAC[REAL_ARITH`-- &1 *a= -- &1 * b<=> a=b`] THEN MATCH_MP_TAC SUM_EQ THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN MP_TAC(SET_RULE`(w:num->real^3) l= w x\/ ~(w l =w x)`) THEN RESA_TAC; MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] THEN REPEAT RESA_TAC THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) THEN RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`l MOD k:num`;`x:num`]) THEN REPLICATE_TAC (34-25) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`SUC x:num`;]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (SUC x)`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]); MP_TAC(SET_RULE`(w:num->real^3) l= w (SUC x)\/ ~(w l =w (SUC x))`) THEN RESA_TAC; MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] THEN REPEAT RESA_TAC THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) THEN RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] THEN POP_ASSUM MP_TAC THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] THEN MRESA_TAC DIVISION[`SUC x:num`;`scs_k_v39 s`] THEN REPLICATE_TAC (6) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`l MOD k:num`;`SUC x MOD k:num`]) THEN REPLICATE_TAC (37-25) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`x:num`;]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (x)`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); ASM_REWRITE_TAC[v3_defor_v4]]);;
let DEFORMATION_INTERIOR_ANGLE1_EQ_V3_DEFOR_V1=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!v t. v IN V /\ --e< t /\ t< e ==> interior_angle1 (vec 0) (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) = interior_angle1 (vec 0) FF v))`,
REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_V1 THEN RESA_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[interior_angle1] THEN REPEAT RESA_TAC THEN REPLICATE_TAC (23-20) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`t:real`;`v:real^3`]) THEN REAL_ARITH_TAC);;
let RHO_FUN_DEFORMATION_V3_DEFOR=
prove_by_refinement(` &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a = -- &1 ==> ?e. &0< e /\ (!t. &0<t /\ t<e ==> rho_fun (norm(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t))) < rho_fun (norm (v2)))`,
[ STRIP_TAC THEN MP_TAC UPS_X_POS_SEG THEN RESA_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN GEN_TAC THEN POP_ASSUM(fun th-> STRIP_TAC THEN MP_TAC(REAL_ARITH`&0<t/\ t<e==> --e<t`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORMV3)[`x2:real`;`-- &1`;`x2:real`;`x6:real`;`x1:real`;`x6:real`;`v1:real^3`;`v2:real^3`;`v3_defor_v1 (-- &1) v1 (v2:real^3) x1 x2 x6 x6 (x2 - t)`;`x2-t:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1] THEN REWRITE_TAC[rho_fun;h0;] THEN MATCH_MP_TAC(REAL_ARITH`a<b==> c+a<c+ b`) THEN MATCH_MP_TAC REAL_LT_LMUL THEN STRIP_TAC; MATCH_MP_TAC REAL_LT_INV THEN REAL_ARITH_TAC; MATCH_MP_TAC REAL_LT_LMUL THEN STRIP_TAC; MATCH_MP_TAC REAL_LT_INV THEN REWRITE_TAC[PI_WORKS]; MATCH_MP_TAC REAL_LT_LMUL THEN REWRITE_TAC[Gbycpxs.SOL0_POS] THEN MATCH_MP_TAC(REAL_ARITH`a<b==> a-c<b-c`) THEN REWRITE_TAC[ww_defor;NORM_MUL] THEN MP_TAC(REAL_ARITH`t< &1==> &0<= &1- t`) THEN RESA_TAC THEN MRESA_TAC REAL_ABS_REFL[`&1-t`] THEN ASM_REWRITE_TAC[NORM_LT;DOT_SQUARE_NORM;REAL_ARITH`a-b<a<=> &0<b`]]);;
let INTERIOR_ANGLE_SAME_V3_DEFOR1=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\(!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t))/\ &0< e1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t i. &0< t /\ t< e ==> interior_angle1 (vec 0) (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (ITER i (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF)) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l MOD k)) t)) = interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) (w (l MOD k)))))`,
STRIP_TAC THEN MP_TAC DEFORMATION_INTERIOR_ANGLE1_EQ_V3_DEFOR_V1 THEN RESA_TAC THEN ABBREV_TAC`e2=(min e e1)/ &2` THEN MP_TAC(REAL_ARITH`e2=(min e e1)/ &2 /\ &0< e/\ &0<e1==> &0<e2/\ e2<e/\ e2<e1`) THEN RESA_TAC THEN EXISTS_TAC`e2:real` THEN ASM_REWRITE_TAC[] THEN REPEAT RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;] THEN REPEAT STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`;`w:num->real^3`;`l MOD k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;] THEN REPLICATE_TAC (43-25)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC(REAL_ARITH`t<e2/\ e2<e1==> t<e1`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME) [`IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (:num)`;`IMAGE (\i. { v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t, v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t, v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) (SUC i)) t) (:num)`;`(\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (l MOD k)`;`(\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t)`;`l MOD k`] [MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;F_DEFORMATION_V3_DEFOR] THEN REPLICATE_TAC (45-29)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`t<e2/\ e2<e/\ &0<t==> t<e/\ --e<t`) THEN RESA_TAC THEN EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`i + l MOD k` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]);;
let TAUSTAR_V3_DEFOR_concl = `!s k w l. 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (SUC l) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1/\ ~(&2 = norm (w l)) /\ (!i. ~(scs_J_v39 s l i)) /\ (!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t))/\ &0< e1 ==> (?e. &0 < e /\ (!t. &0 < t /\ t < e ==> taustar_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t)< taustar_v39 s w ))`;;
let TAUSTAR_V3_DEFOR=prove_by_refinement( TAUSTAR_V3_DEFOR_concl,
[
REPEAT STRIP_TAC;

REPLICATE_TAC (22-5)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC th
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN ASSUME_TAC th
THEN STRIP_TAC)
THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)`
THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`
THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)`
THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;]
THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`]
THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`)
THEN RESA_TAC
THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC;

REPLICATE_TAC (41-22)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC);

ASM_REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF;tau_fun]
THEN STRIP_TAC
THEN MP_TAC INTERIOR_ANGLE_SAME_V3_DEFOR1
THEN RESA_TAC
THEN MP_TAC RHO_FUN_DEFORMATION_V3_DEFOR
THEN RESA_TAC
THEN ABBREV_TAC`e2=(min (min e1 e) e')/ &2`
THEN MP_TAC(REAL_ARITH`e2=(min(min e1 e) e')/ &2/\ &0< e1/\ &0< e/\ &0<e'
==> &0< e2/\ e2< e1/\ e2<e/\ e2< e'`)
THEN RESA_TAC
THEN EXISTS_TAC`e2:real`
THEN ASM_REWRITE_TAC[]
THEN REPEAT STRIP_TAC
THEN MP_TAC(REAL_ARITH`e2=(min(min e1 e) e')/ &2/\ &0< e1/\ &0< e/\ &0<e'
/\ t<e2/\ &0<t
==> t< e1/\ t<e/\ t< e'`)
THEN RESA_TAC
THEN MP_TAC CARD_FF_EQ_V3_DEFOR_DEFORMATION
THEN RESA_TAC
THEN POP_ASSUM(fun th->MRESA1_TAC th`t:real`)
THEN MP_TAC DSV_V3_DEFOR_EQ
THEN RESA_TAC
THEN MATCH_MP_TAC(REAL_ARITH`a<b==> a-c< b-c`)
THEN MATCH_MP_TAC(REAL_ARITH`a<b==> a-c< b-c`)
THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`V:real^3->bool`;`w:num->real^3`;`l:num`;`s:scs_v39`;`(w:num->real^3) (l MOD scs_k_v39 s)`;`FF:real^3#real^3->bool`;`E:(real^3->bool)->bool`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REPLICATE_TAC (59-20)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MRESA_TAC th[`t:real`])
THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`IMAGE  (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (:num)`;` (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t)`;`l:num`;`s:scs_v39`;` (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (l MOD scs_k_v39 s)`;`IMAGE (\i.  v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC i)) t) (:num)`;`IMAGE (\i. {  v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w i) t,  v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN SUBGOAL_THEN`{i|i<k:num}= 0..(k-1)`ASSUME_TAC;

REWRITE_TAC[IN_ELIM_THM;IN_NUMSEG;EXTENSION]
THEN REPLICATE_TAC (59-2)(POP_ASSUM MP_TAC)
THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN ARITH_TAC;

ASM_REWRITE_TAC[]
THEN MRESAL_TAC SUM_ADD_SPLIT[`(\i. rho_fun (norm (w (i + l MOD k))) *
      interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) (w (l MOD k))))`;`0`;`0`;`k-1`][ARITH_RULE`0<=0+1/\ 0+A=A`]
THEN MRESAL_TAC SUM_ADD_SPLIT[`(\i. rho_fun (norm (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (i + l MOD k)) t)) *
      interior_angle1 (vec 0)
      (IMAGE (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w i) t,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC i)) t)
      (:num))
      (ITER i
       (rho_node1
       (IMAGE (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (i)) t,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC i )) t)
       (:num)))
      (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w ( l MOD k)) t)))`;`0`;`0`;`k-1`][ARITH_RULE`0<=0+1/\ 0+A=A`]
THEN MATCH_MP_TAC(REAL_ARITH`a<b/\ c=d==> a+c<b+d`)
THEN REWRITE_TAC[SUM_SING_NUMSEG;ITER]
THEN STRIP_TAC;

REWRITE_TAC[ARITH_RULE`0+A=A`]
THEN REPLICATE_TAC (62-40)(POP_ASSUM MP_TAC)
THEN POP_ASSUM (fun th-> ASM_TAC
THEN MP_TAC th)
THEN REPEAT RESA_TAC
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39;convex_local_fan]
THEN REPEAT RESA_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN SUBGOAL_THEN`(v2:real^3) IN V`ASSUME_TAC;

EXPAND_TAC"V"
THEN REWRITE_TAC[IN_ELIM_THM;IMAGE]
THEN EXISTS_TAC`l:num`
THEN ASM_REWRITE_TAC[SET_RULE`(l:num)IN(:num)`];

REPLICATE_TAC (91-67)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC(REAL_ARITH`t<e2/\ e2<e/\ &0<t ==> --e<t`)
THEN RESA_TAC
THEN MRESAL_TAC th[`t:real`;`0`][F_DEFORMATION_V3_DEFOR;ITER])
THEN MP_TAC Local_lemmas.LOFA_IMP_V_DIFF
THEN RESA_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3) l`])
THEN MATCH_MP_TAC REAL_LT_RMUL
THEN STRIP_TAC;

REPLICATE_TAC (93-68)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC(REAL_ARITH`t<e2/\ e2<e'/\ &0<t ==> --e'<t`)
THEN RESA_TAC
THEN MRESAL_TAC th[`t:real`][v3_defor_v4]);

MRESA_TAC (GEN_ALL Local_lemmas.INTERIOR_ANGLE1_POS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3) (l MOD scs_k_v39 s)`];

MATCH_MP_TAC SUM_EQ
THEN REWRITE_TAC[IN_NUMSEG;F_DEFORMATION_V3_DEFOR]
THEN REPEAT STRIP_TAC
THEN MP_TAC(ARITH_RULE`x<=k-1/\ 3< k==> x< k`)
THEN RESA_TAC
THEN REPLICATE_TAC (65-44)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC(REAL_ARITH`t<e2/\ e2<e/\ &0<t ==> --e<t`)
THEN RESA_TAC
THEN MRESAL_TAC th[`t:real`;`x:num`][F_DEFORMATION_V3_DEFOR;ITER])
THEN REWRITE_TAC[REAL_EQ_MUL_RCANCEL]
THEN MATCH_MP_TAC (SET_RULE`A==> A\/ B`)
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39;convex_local_fan]
THEN REPEAT RESA_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN SUBGOAL_THEN`(v2:real^3) IN V`ASSUME_TAC;

EXPAND_TAC"V"
THEN REWRITE_TAC[IN_ELIM_THM;IMAGE]
THEN EXISTS_TAC`l:num`
THEN ASM_REWRITE_TAC[SET_RULE`(l:num)IN(:num)`];

MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;convex_local_fan;is_scs_v39;periodic2]
THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`;`w:num->real^3`;`l MOD k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;convex_local_fan;is_scs_v39;periodic2]
THEN POP_ASSUM(fun th-> MRESA_TAC th[`x:num`] )
THEN MP_TAC(ARITH_RULE`1<=x==> 0<x`)
THEN RESA_TAC
THEN 
MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_DIS_ELMS23)
[`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`]
THEN POP_ASSUM(fun th-> MRESAL_TAC th[`0:num`;`x:num`][ITER;v3_defor_v4] )]);;
(**********TWO ***************)
let EQ_W_L_IN_BBS=
prove(`3<k/\ scs_k_v39 s=k/\ BBs_v39 s w ==> w (SUC(l+k-1))= w l`,
REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF] THEN REPEAT STRIP_TAC THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)/\ SUC(l+k-1)=1*k+l`) THEN RESA_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`] THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESAL1_TAC th`1*k+l:num`[ARITH_RULE`4 MOD 4=0`]));;
let HYPER_MM_COLLINEAR_TWO_CASES=
prove_by_refinement(`scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ 3<k/\ w l=v2/\ w (l+k-1) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 ==> &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3}) `,
[ REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;] THEN STRIP_TAC THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` THEN ASM_TAC THEN RESA_TAC THEN REPEAT DISCH_TAC; ASM_TAC THEN ARITH_TAC; SUBGOAL_THEN`((v1,v2):real^3#real^3) IN FF`ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`] THEN MP_TAC EQ_W_L_IN_BBS THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF] THEN RESA_TAC; MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v1,v2):real^3#real^3`] THEN MP_TAC NORM_POS_COLLINEAR THEN RESA_TAC]);;
let DEFORMATION_DIST_LE_V3_DEFOR_A_TWO_CASES=
prove(`is_scs_v39 s /\ MMs_v39 s w /\ scs_k_v39 s =k/\ 3<k /\ w l=v2/\ w (l+k-1) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ (!i. ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k) ==> scs_a_v39 s l i < dist (v2,w i)) ==> (!i. ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k) ==> ?e. &0< e/\ (!t. &0< t/\ t< e ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)))`,
STRIP_TAC THEN MP_TAC HYPER_MM_COLLINEAR_TWO_CASES THEN RESA_TAC THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST THEN ASM_REWRITE_TAC[] THEN REPLICATE_TAC (16-10)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`i:num`]));;
let DEFORMATION_DIST_LE_V3_DEFOR_A_COM_TWO_CASES=
prove_by_refinement( `is_scs_v39 s /\ MMs_v39 s w /\ scs_k_v39 s =k/\ 3<k /\ w l=v2/\ w (l+k-1) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ (!i. ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k) ==> scs_a_v39 s l i < dist (v2,w i)) ==> ?e. &0< e/\ (!t i. &0< t/\ t< e /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k) ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i))`,
[ REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_TWO_CASES THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] THEN REWRITE_TAC[SKOLEM_THM] THEN STRIP_TAC THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}` THEN EXISTS_TAC`e1:real` THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`ASSUME_TAC; MATCH_MP_TAC FINITE_SUBSET THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` THEN STRIP_TAC; MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG]; REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_ELIM_THM] THEN GEN_TAC THEN RESA_TAC THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN REPLICATE_TAC (16-12)(POP_ASSUM MP_TAC) THEN ARITH_TAC; SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)} = {})`ASSUME_TAC; REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(l MOD k =0)`) THEN RESA_TAC; EXISTS_TAC`(e:num->real)2` THEN EXISTS_TAC`2` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 0<k /\ 1<k/\ 2<k /\ ~(k=0)/\ SUC 1=2/\ ~(0=1)/\ ~(0=2)/\ SUC 0=1/\ ~(1=2)`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESA_TAC MOD_LT[`2`;`k:num`] THEN MRESA_TAC MOD_LT[`0`;`k:num`] THEN MRESA_TAC MOD_LT[`3`;`k:num`] THEN MRESA_TAC(GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`l:num`;`0:num`;`k:num`]; MP_TAC(SET_RULE`l MOD k=1\/ ~(l MOD k= 1 )`) THEN RESA_TAC; EXISTS_TAC`(e:num->real)3` THEN EXISTS_TAC`3` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 0<k /\ 1<k/\ 2<k /\ ~(k=0)/\ SUC 1=2/\ ~(0=1)/\ ~(0=2)/\ SUC 0=1/\ ~(1=2)/\ ~(1=3)/\ ~(2=3)`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESA_TAC MOD_LT[`2`;`k:num`] THEN MRESA_TAC MOD_LT[`0`;`k:num`] THEN MRESA_TAC MOD_LT[`3`;`k:num`] THEN MRESA_TAC(GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`l:num`;`1:num`;`k:num`]; EXISTS_TAC`(e:num->real)1` THEN EXISTS_TAC`1` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 0<k /\ 1<k/\ 2<k /\ ~(k=0)/\ SUC 1=2/\ ~(0=1)/\ ~(0=2)/\ SUC 0=1/\ ~(1=2)/\ ~(1=3)/\ ~(2=3)`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESA_TAC MOD_LT[`2`;`k:num`] THEN MRESA_TAC MOD_LT[`0`;`k:num`] THEN MRESA_TAC MOD_LT[`3`;`k:num`] THEN MRESAL_TAC(Hdplygy.MOD_EQ_MOD1)[`l:num`;`0`;`1:num`;`k:num`][ARITH_RULE`0<=a/\ 1+a= SUC a`]; STRIP_TAC; MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`;`&0`] THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT RESA_TAC THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] THEN REPLICATE_TAC (20-11) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`]); REPEAT STRIP_TAC THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`;`t:real`] THEN POP_ASSUM MP_TAC THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`ASSUME_TAC; REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`i MOD k` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ 1<k`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`i:num`;`k:num`] THEN MRESA_TAC MOD_LT[`i MOD k`;`k:num`] THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`k:num`][GSYM ADD1]; STRIP_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ 1<k`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`i:num`;`k:num`] THEN MRESA_TAC MOD_LT[`i MOD k`;`k:num`] THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`k:num`][GSYM ADD1] THEN REPLICATE_TAC (27-11) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num MOD k`]) THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`])]);;
let DEFORMATION_DIST_LE_V3_DEFOR_A_SUC_TWO_CASES=
prove(`is_scs_v39 s /\ MMs_v39 s w /\ scs_k_v39 s =k/\ 3<k /\ w l=v2/\ w (l+k-1) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ (!i. ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k) ==> scs_a_v39 s l i < dist (v2,w i)) ==> (!i. ~(l MOD k = i MOD k) /\ ~(l MOD k =SUC i MOD k) ==> ?e. &0< e/\ (!t. &0< t/\ t< e ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)))`,
STRIP_TAC THEN MP_TAC HYPER_MM_COLLINEAR_TWO_CASES THEN RESA_TAC THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST THEN ASM_REWRITE_TAC[] THEN REPLICATE_TAC (16-10)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`i:num`]));;
let DEFORMATION_DIST_LE_V3_DEFOR_A_COM_SUC_TWO_CASES=
prove_by_refinement(`is_scs_v39 s /\ MMs_v39 s w /\ scs_k_v39 s =k/\ 3<k /\ w l=v2/\ w (l+k-1) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ (!i. ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k) ==> scs_a_v39 s l i < dist (v2,w i)) ==> ?e. &0< e/\ (!t i. &0< t/\ t< e /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k) ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i))`,
[ REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_SUC_TWO_CASES THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] THEN REWRITE_TAC[SKOLEM_THM] THEN STRIP_TAC THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}` THEN EXISTS_TAC`e1:real` THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`ASSUME_TAC; MATCH_MP_TAC FINITE_SUBSET THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` THEN STRIP_TAC; MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG]; REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_ELIM_THM] THEN GEN_TAC THEN RESA_TAC THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN REPLICATE_TAC (16-12)(POP_ASSUM MP_TAC) THEN ARITH_TAC; SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)} = {})`ASSUME_TAC; REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(l MOD k =0)`) THEN RESA_TAC; EXISTS_TAC`(e:num->real)1` THEN EXISTS_TAC`1` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 1<k/\ 2<k /\ ~(k=0)/\ SUC 1=2/\ ~(0=1)/\ ~(0=2)`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESA_TAC MOD_LT[`2`;`k:num`]; MP_TAC(SET_RULE`l MOD k=1\/ ~(l MOD k= 1 )`) THEN RESA_TAC; EXISTS_TAC`(e:num->real)2` THEN EXISTS_TAC`2` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 1<k/\ 2<k /\ ~(k=0)/\ SUC 1=2/\ ~(1=2)/\ ~(1=3)/\ SUC 2=3`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`2`;`k:num`] THEN MRESA_TAC MOD_LT[`3`;`k:num`]; EXISTS_TAC`(e:num->real)0` THEN EXISTS_TAC`0` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 0<k/\ 1<k /\ ~(k=0)/\ SUC 1=2/\ ~(1=2)/\ ~(1=3)/\ SUC 0=1`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`0`;`k:num`] THEN MRESA_TAC MOD_LT[`1`;`k:num`]; STRIP_TAC; MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`;`&0`] THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT RESA_TAC THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] THEN REPLICATE_TAC (20-11) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`]); REPEAT STRIP_TAC THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`;`t:real`] THEN POP_ASSUM MP_TAC THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`ASSUME_TAC; REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`i MOD k` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ 1<k`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`i:num`;`k:num`] THEN MRESA_TAC MOD_LT[`i MOD k`;`k:num`] THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`k:num`][GSYM ADD1]; STRIP_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ 1<k`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`i:num`;`k:num`] THEN MRESA_TAC MOD_LT[`i MOD k`;`k:num`] THEN MRESA_TAC MOD_LT[`1`;`k:num`] THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`k:num`][GSYM ADD1] THEN REPLICATE_TAC (27-11) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num MOD k`]) THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`])]);;
let DEFORMATION_DIST_LE_V3_DEFOR_B_SUC_TWO_CASES=
prove_by_refinement(` scs_k_v39 s =k/\ 3<k /\ is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) ==> (!i. scs_diag k l i ==> ?e. &0< e/\ (!t. &0< t/\ t< e ==> dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)<scs_b_v39 s l i)) `,
[STRIP_TAC THEN MP_TAC HYPER_MM_COLLINEAR_TWO_CASES THEN RESA_TAC THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LT_CONST THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN STRIP_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k<=3)`) THEN RESA_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN SUBGOAL_THEN`v2 IN IMAGE (w:num->real^3) (:num)`ASSUME_TAC; REWRITE_TAC[IN_ELIM_THM;IMAGE] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; SUBGOAL_THEN`w i IN IMAGE (w:num->real^3) (:num)`ASSUME_TAC; REWRITE_TAC[IN_ELIM_THM;IMAGE] THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; MP_TAC(SET_RULE`v2 IN IMAGE w (:num)/\ w i IN IMAGE w (:num)/\ IMAGE w (:num) SUBSET ball_annulus ==> v2 IN ball_annulus/\ w i IN ball_annulus`) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[IN_ELIM_THM;DIFF;ball_annulus;cball;] THEN REPEAT STRIP_TAC THEN MRESA_TAC DIST_TRIANGLE[`v2:real^3`;`vec 0:real^3`;`(w:num->real^3) i`] THEN MP_TAC(REAL_ARITH`dist (v2,vec 0) <= &2 * h0/\ dist (vec 0,w i) <= &2 * h0/\ dist (v2,w i) <= dist (v2,vec 0) + dist (vec 0,w i) ==> dist (v2,(w:num->real^3) i)<= &4 *h0`) THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REPLICATE_TAC (53-41)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`i:num`]) THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC]);;
let DEFORMATION_DIST_LE_2_TWO_CASES=
prove(` 3<k /\ scs_k_v39 s =k/\ is_scs_v39 s /\ MMs_v39 s w /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ w l=v2/\ w (l+k-1) =v1/\ ~(norm v2 = &2)/\ scs_a_v39 s l i < dist (v2,w i) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ SUC l MOD k= i MOD k ==> ?e. &0< e/\ (!t. &0< t/\ t< e ==> &2<dist (v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i) ) `,
STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST THEN ASM_REWRITE_TAC[] THEN MP_TAC HYPER_MM_COLLINEAR_TWO_CASES THEN RESA_TAC THEN ASM_TAC THEN STRIP_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k<=3)/\ ~(k=0)/\ 1<k`) THEN RESA_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESA_TAC DIVISION[`i:num`;`k:num`] THEN MRESA_TAC DIVISION[`l:num`;`k:num`] THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`l:num`) THEN REPLICATE_TAC (56-18) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num MOD k`;`l MOD k` ]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) THEN REPLICATE_TAC (59-42) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);;
let DEFORMATION_V3_DEFOR_EDGE_TWO_CASES=
prove_by_refinement(` 3<k /\ scs_k_v39 s =k/\ is_scs_v39 s /\ MMs_v39 s w /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ w l=v2/\ w (l+k-1) =v1/\ ~(norm v2 = &2)/\ scs_a_v39 s l i < dist (v2,w i) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ SUC l MOD k= i MOD k ==> ?e. &0< e/\ (!t. &0< t/\ t< e ==> dist (v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)<dist (v2,w i) ) `,
[ REPEAT STRIP_TAC THEN MP_TAC HYPER_MM_COLLINEAR_TWO_CASES THEN RESA_TAC THEN MP_TAC DEFORMATION_DIST_LE_2_TWO_CASES THEN RESA_TAC THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`] THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`l+k-1`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] THEN MP_TAC UPS_X_POS_SEG THEN RESA_TAC THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` THEN SUBGOAL_THEN`(w:num->real^3) l IN V` ASSUME_TAC; EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; SUBGOAL_THEN`(w:num->real^3) (l+k-1) IN V` ASSUME_TAC; EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; SUBGOAL_THEN`(w:num->real^3) l IN ball_annulus` ASSUME_TAC; MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`V:real^3->bool` THEN ASM_REWRITE_TAC[]; SUBGOAL_THEN`(w:num->real^3) (l+k-1) IN ball_annulus` ASSUME_TAC; MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`V:real^3->bool` THEN ASM_REWRITE_TAC[]; REPLICATE_TAC (4) (POP_ASSUM MP_TAC) THEN REPEAT RESA_TAC THEN MP_TAC V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION THEN RESA_TAC THEN REPLICATE_TAC (68-41) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) THEN REPLICATE_TAC (67-41) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA_TAC th[`i:num`]) THEN REPEAT STRIP_TAC THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) i`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN RESA_TAC THEN ABBREV_TAC`e1= (min (min (min e e') e'') e''')/ &2` THEN MP_TAC(REAL_ARITH`e1= (min (min (min e e') e'') e''')/ &2 /\ &0< e /\ &0< e'/\ &0< e''/\ &0< e''' ==> &0< e1/\ e1<= e/\ e1<=e'/\ e1< e''/\ e1< e'''`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'') e''')/ &2 /\ &0< e /\ &0< e'/\ &0< e''/\ t<e1/\ &0<t/\ &0< e'''==> --e' < t/\ t< e'/\ t<e/\ t< e'''/\ t< e''`) THEN RESA_TAC THEN REPLICATE_TAC (87-59) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`t:real`]) THEN REPLICATE_TAC (88-65) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`t:real`]) THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[v3_defor_v4] THEN REPLICATE_TAC (87-72) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC th[`t:real`]) THEN ABBREV_TAC`v3=v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) ` THEN ASM_REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0-A= -- A`;NORM_NEG;REAL_ARITH`~(a<b)<=> b<=a`] THEN STRIP_TAC THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORMV3)[`x2:real`;`-- &1`;`x2:real`;`x6:real`;`x1:real`;`x6:real`;`v1:real^3`;`v2:real^3`;`v3_defor_v1 (-- &1) v1 (v2:real^3) x1 x2 x6 x6 (x2 - t)`;`x2-t:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1] THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`-- &1`;`x2:real`;`x6:real`;`x1:real`;`x2-t:real`;`v2:real^3`;`v3_defor_v1 (-- &1) v1 (v2:real^3) x1 x2 x6 x6 (x2 - t)`;`v1:real^3`;`x6:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1] THEN MRESA_TAC DOT_NORM_SUB[`v1:real^3`;`v3:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[dist] THEN ABBREV_TAC`v4= (w:num->real^3) i` THEN MRESA_TAC DOT_NORM_SUB[`v4:real^3`;`v2:real^3`] THEN MRESA_TAC DOT_NORM_SUB[`v4:real^3`;`v3:real^3`] THEN MRESA_TAC DOT_NORM_SUB[`v1:real^3`;`v2:real^3`] THEN STRIP_TAC; REPLICATE_TAC (97-63) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> POP_ASSUM(fun th1-> REPEAT STRIP_TAC THEN MP_TAC th1) THEN MP_TAC th) THEN ASM_REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0-A= -- A`;NORM_NEG;REAL_ARITH`~(a<b)<=> b<=a`] THEN REPEAT STRIP_TAC THEN SUBGOAL_THEN`&2 <= norm (v1 - v2:real^3) ` ASSUME_TAC; REPLICATE_TAC (99-30) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`l+k-1:num`;`l:num`]) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[dist] THEN MRESA_TAC DIVISION[`l+k-1`;`k:num`] THEN MRESA_TAC DIVISION[`l:num`;`k:num`] THEN MRESA_TAC (GEN_ALL Qknvmlb.SUC_MOD_NOT_EQ)[`k:num`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`]) THEN REPLICATE_TAC (103-22) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`(l+k-1) MOD k:num`;`l MOD k:num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(l+k-1):num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((l+k-1) MOD k)`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) THEN MP_TAC MOD_ADD_SUB_1 THEN RESA_TAC THEN REAL_ARITH_TAC; MRESAL_TAC xrr_decreasing_lt[`norm (v3:real^3)`;`norm (v2:real^3)`;`norm(v1:real^3)`;`norm (v1-v2:real^3)`][xrr;REAL_ARITH`a*a= a pow 2`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[Pack1.norm_abs] THEN ASM_REWRITE_TAC[REAL_LT_SQUARE_ABS] THEN ASM_REWRITE_TAC[REAL_ABS_NORM;REAL_ARITH`a-b<a<=> &0<b`] THEN REWRITE_TAC[REAL_ARITH`&8*(&1-A)< &8*(&1-B) <=> B<A`] THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v2:real^3`] THEN MRESAL_TAC COS_ANGLE[`v1:real^3`;`vec 0:real^3`;`v2:real^3`][VECTOR_ARITH`A- vec 0=A`;real_div;REAL_INV_MUL;REAL_ARITH`(x1 + x2) - x6= x2+x1-x6/\ (a*b)*c*d=a*b*d*c`] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) THEN SUBGOAL_THEN`~(v3 = vec 0:real^3)` ASSUME_TAC; STRIP_TAC THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;NORM_0;REAL_ARITH`~(&2<= &0)`]); MRESAL_TAC COS_ANGLE[`v1:real^3`;`vec 0:real^3`;`v3:real^3`][VECTOR_ARITH`A- vec 0=A`;real_div;REAL_INV_MUL;REAL_ARITH`(x1 + x2) - x6= x2+x1-x6/\ (a*b)*c*d=a*b*d*c`] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN MRESAL_TAC COS_MONO_LT_EQ[`angle (v1,vec 0,v3:real^3)`;`angle (v1,vec 0,v2:real^3)`][ANGLE_RANGE] THEN MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, v4}/\ v3 IN aff_gt {vec 0} {v1, v4} /\ aff_gt {vec 0} {v1,v4} SUBSET aff_ge {vec 0} {v1,v4}==> v2 IN aff_ge {vec 0} {v1, v4}/\ v3 IN aff_ge {vec 0} {v1, v4:real^3}`) THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN RESA_TAC THEN MRESA_TAC th3[`vec 0:real^3`;`v4:real^3`;`v1:real^3`] THEN MRESA_TAC Polar_fan.ANGLES_ADD_AFF_GE [`vec 0:real^3`;`v1:real^3`;`v4:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN RESA_TAC THEN MRESA_TAC Polar_fan.ANGLES_ADD_AFF_GE [`vec 0:real^3`;`v1:real^3`;`v4:real^3`;`v3:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN RESA_TAC THEN MP_TAC(REAL_ARITH`angle (v1,vec 0,v2) < angle (v1,vec 0,v3) /\ angle (v1,vec 0,v2) + angle (v2,vec 0,v4) = angle (v1,vec 0,v4) /\ angle (v1,vec 0,v3) + angle (v3,vec 0,v4) = angle (v1,vec 0,v4) ==> angle (v3,vec 0,v4) <angle (v2,vec 0,v4:real^3)`) THEN RESA_TAC THEN MRESAL_TAC COS_MONO_LT_EQ[`angle (v2,vec 0,v4:real^3)`;`angle (v3,vec 0,v4:real^3)`][ANGLE_RANGE] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[ANGLE_SYM] THEN MRESAL_TAC COS_ANGLE[`v4:real^3`;`vec 0:real^3`;`v3:real^3`][VECTOR_ARITH`A- vec 0=A`;real_div;REAL_INV_MUL;REAL_ARITH`(x1 + x2) - x6= x2+x1-x6/\ (a*b)*c*d=a*b*d*c`] THEN MRESAL_TAC COS_ANGLE[`v4:real^3`;`vec 0:real^3`;`v2:real^3`][VECTOR_ARITH`A- vec 0=A`;real_div;REAL_INV_MUL;REAL_ARITH`(x1 + x2) - x6= x2+x1-x6/\ (a*b)*c*d=a*b*d*c`] THEN REPLICATE_TAC (116-88) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> POP_ASSUM(fun th1-> REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th1) THEN MP_TAC th) THEN REWRITE_TAC[REAL_ARITH`(norm v4 pow 2 + x2) - norm (v4 - v2) pow 2 =x2+norm v4 pow 2 - norm (v4 - v2) pow 2`;real_div;REAL_ARITH`a*b*c*d=(a*b)*c*d`] THEN STRIP_TAC THEN STRIP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN POP_ASSUM(fun th1-> REWRITE_TAC[SYM th1] THEN ASSUME_TAC (SYM th) THEN ASSUME_TAC (SYM th))) THEN SUBGOAL_THEN`(w:num->real^3) (SUC l) IN V` ASSUME_TAC; EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`SUC l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; SUBGOAL_THEN`(w:num->real^3) (SUC l) IN ball_annulus` ASSUME_TAC; MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`V:real^3->bool` THEN ASM_REWRITE_TAC[]; POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0-A= -- A`;NORM_NEG;REAL_ARITH`~(a<b)<=> b<=a`;real_div] THEN STRIP_TAC THEN ABBREV_TAC`a1=(norm (v4:real^3) pow 2)` THEN ABBREV_TAC`a2=(norm (v4-v2:real^3) pow 2)` THEN ABBREV_TAC`a3= x2+a1- &2 *((v4:real^3) dot v3) * (inv (norm v3)) * (inv (norm v4)) * norm v4 * norm(v2:real^3)` THEN ABBREV_TAC`x= v4- v3_defor_v1 a (vec 0- v4) (v2- v4:real^3) a1 a2 x2 x2 (a3)` THEN STRIP_TAC THEN MP_TAC(REAL_ARITH`&2<=norm (v4:real^3)/\ &2<=norm (v2:real^3)==> &0< norm v4/\ &0< norm v2`) THEN RESA_TAC ; MP_TAC(REAL_ARITH`norm (v4 - v2) pow 2 <= a3\/ a3< norm(v4-v2:real^3) pow 2`) THEN RESA_TAC ; MRESA_TAC REAL_LE_RSQRT[`norm(v4-v2:real^3)`;`a3:real`] THEN MP_TAC(REAL_ARITH`norm (v4 - v2) pow 2 <= a3/\ &0<= norm(v4-v2:real^3) pow 2 ==> &0<= a3`) THEN ASM_REWRITE_TAC[NORM_POS_LE;REAL_LE_POW_2] THEN RESA_TAC THEN MRESA_TAC SQRT_POW_2[`a3:real`] THEN MRESAL_TAC xrr_increasing_le[`norm(v4:real^3)`;`norm(v2:real^3)`;`norm(v4-v2:real^3)`;`sqrt(a3)`][NORM_POS_LE;xrr;REAL_ARITH`(&8 *( &1-a)<= &8 *( &1-b)<=> b<=a)/\ a*a= a pow 2`;real_div] THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN EXPAND_TAC"a3" THEN REWRITE_TAC[REAL_ARITH`x+y-(y+x-a)=a`;REAL_INV_MUL] THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v4:real^3`;`vec 0:real^3`] THEN ASM_TAC THEN REDUCE_VECTOR_TAC THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v2:real^3`;`vec 0:real^3`] THEN ASM_TAC THEN REDUCE_VECTOR_TAC THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH` (&2 *a * inv (b) * inv (c) * c * d) * inv (&2) * inv (c) * inv (d) = (a * inv (b) * inv (c)) * (inv (c) * c )* (inv (d) * d)`;REAL_ARITH`a * &1=a`] THEN ASM_REWRITE_TAC[REAL_ARITH`a*b*c*d=(a*b)*d*c`] THEN ONCE_REWRITE_TAC[REAL_ARITH` a1 + x2 - a2= x2+a1-a2`] THEN ASM_REWRITE_TAC[REAL_ARITH`a<=b<=> ~(b<a)`]; MRESA_TAC DOT_NORM_SUB[`v4:real^3`;`v3:real^3`] THEN SUBGOAL_THEN`norm (v4 - v3:real^3) pow 2 < a3`ASSUME_TAC; POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`a=((a1+x2-t)-c)/ &2<=> c= a1+x2-t - &2 *a`] THEN RESA_TAC THEN EXPAND_TAC"a3" THEN REWRITE_TAC[REAL_ARITH`a1 + x2 - t - &2 * (v4 dot v3) < x2 + a1 - &2 * (v4 dot v3) * inv (norm v3) * inv (norm v4) * norm v4 * norm v2 <=> (v4 dot v3) * inv (norm v3) * (inv (norm v4) * norm v4) * norm v2 < (v4 dot v3)+ t/ &2 `] THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v4:real^3`;`vec 0:real^3`] THEN ASM_TAC THEN REDUCE_VECTOR_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN ABBREV_TAC`g=(v4:real^3) dot v3` THEN MRESAL_TAC SQRT_UNIQUE[`x2:real`;`norm(v2:real^3)`][NORM_POS_LE] THEN MRESAL_TAC SQRT_UNIQUE[`x2-t:real`;`norm(v3:real^3)`][NORM_POS_LE] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;REAL_ARITH`&1*a=a`]) THEN MP_TAC(REAL_ARITH`&0< x2-t/\ &0< x2/\ &0<t==> &0<= x2-t/\ &0<= x2/\ x2-t<x2/\ ~(x2-t= &0)`) THEN RESA_TAC THEN MRESA_TAC SQRT_INV[`x2-t:real`] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) THEN MRESA_TAC REAL_LE_INV[`x2-t:real`] THEN MRESA_TAC REAL_LT_INV[`x2-t:real`] THEN MRESA_TAC SQRT_MUL[`inv(x2-t):real`;`x2:real`] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) THEN MRESA_TAC REAL_MUL_LINV[`x2-t:real`] THEN MRESA_TAC REAL_LT_LMUL[`inv(x2-t)`;`x2-t:real`;`x2:real`] THEN MRESAL_TAC SQRT_MONO_LT[`&1:real`;`inv(x2-t) *x2`][REAL_ARITH`&0<= &1`;SQRT_1] THEN MP_TAC(REAL_ARITH`(v4:real^3) dot v3 = &0\/ &0< --((v4:real^3) dot v3)\/ &0< (v4:real^3) dot v3 `) THEN RESA_TAC; ASM_REWRITE_TAC[REAL_ARITH`&0 *a< &0 + t/ &2<=> &0< t`]; MRESA_TAC REAL_LT_LMUL[`-- g`;`&1:real`;`sqrt (inv (x2 - t) * x2):real`] THEN POP_ASSUM MP_TAC THEN MP_TAC(REAL_ARITH`&0< t==> &0< t/ &2`) THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; MP_TAC(REAL_ARITH`&0< g/\ &1 < inv (x2 - t) * x2 ==> ~(g= &0)/\ &0 <= inv (x2 - t) * x2`) THEN RESA_TAC THEN MRESA_TAC REAL_MUL_LINV[`g:real`] THEN MRESAL_TAC REAL_LT_LMUL[`g:real`;`sqrt (inv (x2 - t) * x2):real`;`(inv g)*(g+t/ &2)`][REAL_ARITH`a*b*c=(b*a)*c/\ &1*x=x`] THEN POP_ASSUM MATCH_MP_TAC THEN MATCH_MP_TAC REAL_LT_LSQRT THEN ASM_REWRITE_TAC[REAL_ARITH`a*(b+c)=a*b+a*c`] THEN STRIP_TAC; MATCH_MP_TAC(REAL_ARITH`&0< a*b ==> &0<= &1+a *b/ &2`) THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LT_INV THEN ASM_REWRITE_TAC[]; REWRITE_TAC[REAL_ARITH`(&1+b) pow 2= &1+ &2*b+ b pow 2/\ &2 * inv g * t / &2= inv g * t `] THEN MATCH_MP_TAC(REAL_ARITH`&0<=d /\ a< b+c==> a< b+c+d`) THEN ASM_REWRITE_TAC[REAL_LE_POW_2] THEN MRESAL_TAC REAL_LT_LMUL[`inv(x2-t):real`;`x2:real`;`(x2-t)*(&1+ inv g *t)`][REAL_ARITH`a*b*c=(a*b)*c/\ &1*x=x`] THEN POP_ASSUM MATCH_MP_TAC THEN REWRITE_TAC[REAL_ARITH`x2 < (x2 - t) * (&1 + inv g * t) <=> t< t*(x2-t) * inv g`] THEN MRESAL_TAC REAL_LT_LMUL[`t:real`;`&1:real`;`(x2-t)*inv g `][REAL_ARITH`a*b*c=a*b*c/\ x* &1=x`] THEN POP_ASSUM MATCH_MP_TAC THEN MRESAL_TAC REAL_LT_LMUL[`inv g:real`;`g:real`;`(x2-t) `][REAL_ARITH`a*b*c=a*b*c/\ x* &1=x`] THEN ONCE_REWRITE_TAC[REAL_ARITH`a*b=b*a`] THEN POP_ASSUM MATCH_MP_TAC THEN STRIP_TAC; MATCH_MP_TAC REAL_LT_INV THEN ASM_REWRITE_TAC[]; EXPAND_TAC"g" THEN REPLICATE_TAC (151-55) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESAL_TAC th[`t:real`][dist]) THEN MP_TAC(REAL_ARITH`&2<norm(v3-v4)==> &2<=norm(v3-v4:real^3)`) THEN RESA_TAC THEN MRESAL_TAC DOT_NORM[`v3 - v4:real^3`;`-- v3:real^3`][VECTOR_ARITH`wl - wi + (-- wl)= --wi:real^3`;NORM_NEG] THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (v3:real^3)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (v3 - v4:real^3)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[GSYM h0] THEN ASM_REWRITE_TAC[h0] THEN STRIP_TAC THEN MP_TAC(REAL_ARITH`(v3 - v4) dot --v3 = (a1 - norm (v3 - v4) pow 2 - (x2 - t)) / &2 /\ &2 pow 2 <= x2 - t /\ &2 pow 2 <= norm (v3 - v4) pow 2 /\ a1 <= (&2 * #1.26) pow 2 ==> (v3 - v4:real^3) dot --v3< &0`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;DOT_RNEG;DOT_LSUB;DOT_SQUARE_NORM]) THEN REAL_ARITH_TAC; POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; ]);;
let DEFORMATION_DIST_LE_BLL_V3_DEFOR_COM_TWO_CASES=
prove_by_refinement( ` 3<k /\ scs_k_v39 s =k/\ is_scs_v39 s /\ MMs_v39 s w /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ w l=v2/\ w (l+k-1) =v1/\ ~(norm v2 = &2)/\ scs_a_v39 s l (SUC l ) < dist (v2,w (SUC l)) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) ==> (!i. ~(i MOD k = l MOD k) ==> ?e. &0< e/\ (!t. &0< t/\ t< e ==> dist (v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)<=scs_b_v39 s l i ))`,
[ REPEAT STRIP_TAC THEN MP_TAC(SET_RULE`SUC l MOD k = i MOD k \/ ~(i MOD k= SUC l MOD k)`) THEN RESA_TAC; MP_TAC DEFORMATION_V3_DEFOR_EDGE_TWO_CASES THEN RESA_TAC THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`] THEN REPLICATE_TAC (55-46) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`l+k-1`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESA_TAC th[`SUC l:num`] THEN MRESA_TAC th[`i:num`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESA_TAC th[`SUC l:num`] THEN MRESA_TAC th[`i:num`]) THEN REPLICATE_TAC (59-53) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN RESA_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN GEN_TAC THEN POP_ASSUM (fun th-> STRIP_TAC THEN MRESA_TAC th[`t:real`]) THEN POP_ASSUM MP_TAC THEN REPLICATE_TAC (62-30) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESAL_TAC th[`l:num`;`i:num`][]) THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; MP_TAC(SET_RULE`SUC i MOD k= l MOD k \/ ~(SUC i MOD k= l MOD k )`) THEN RESA_TAC; MP_TAC HYPER_MM_COLLINEAR_TWO_CASES THEN RESA_TAC THEN MP_TAC UPS_X_POS_SEG THEN RESA_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[] THEN GEN_TAC THEN POP_ASSUM (fun th-> STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e/\ &0< t==> --e<t`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORMV3)[`x2:real`;`-- &1`;`x2:real`;`x6:real`;`x1:real`;`x6:real`;`v1:real^3`;`v2:real^3`;`v3_defor_v1 (-- &1) v1 (v2:real^3) x1 x2 x6 x6 (x2 - t)`;`x2-t:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1] THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`-- &1`;`x2:real`;`x6:real`;`x1:real`;`x2-t:real`;`v2:real^3`;`v3_defor_v1 (-- &1) v1 (v2:real^3) x1 x2 x6 x6 (x2 - t)`;`v1:real^3`;`x6:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1] THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`] THEN MRESA_TAC th[` l+k-1:num`]) THEN REWRITE_TAC[dist] THEN REPLICATE_TAC (68-30) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESAL_TAC th[`l:num`;`l+k-1:num`][]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC REAL_EQ_SQUARE_ABS[`norm (v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) - v1:real^3)`;`norm(v1-v2:real^3)`][REAL_ABS_NORM;GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`] THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`l+k-1`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] THEN REPEAT RESA_TAC THEN ONCE_REWRITE_TAC[DIST_SYM] THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`] THEN MRESA_TAC th[`l+k-1:num`]); MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_B_SUC_TWO_CASES THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESAL_TAC th[`i:num`][scs_diag]) THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN GEN_TAC THEN POP_ASSUM (fun th-> STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e/\ &0< t==> --e<t`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]);;
let DEFORMATION_DIST_LE_BLL_V3_DEFOR_COM_TWO_CASES=
prove_by_refinement(` 3<k /\ scs_k_v39 s =k/\ is_scs_v39 s /\ MMs_v39 s w /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ w l=v2/\ w (l+k-1) =v1/\ ~(norm v2 = &2)/\ scs_a_v39 s l (SUC l) < dist (v2,w (SUC l )) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1/\(!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) ==> ?e. &0< e/\ (!t i. &0< t/\ t< e/\ ~(i MOD k = l MOD k) ==> dist (v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)<=scs_b_v39 s l i )`,
[ REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_DIST_LE_BLL_V3_DEFOR_COM_TWO_CASES THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] THEN REWRITE_TAC[SKOLEM_THM] THEN STRIP_TAC THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k/\ ~(i= l MOD k)}` THEN EXISTS_TAC`e1:real` THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; MATCH_MP_TAC FINITE_SUBSET THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` THEN STRIP_TAC; MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG]; REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] THEN REPEAT RESA_TAC THEN EXISTS_TAC`i:num` THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) THEN RESA_TAC; EXISTS_TAC`(e:num->real)1` THEN EXISTS_TAC`1` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 1<k `) THEN RESA_TAC; EXISTS_TAC`(e:num->real)0` THEN EXISTS_TAC`0` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 0<k `) THEN RESA_TAC; STRIP_TAC; MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`&0`] THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT RESA_TAC THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`]); REPEAT STRIP_TAC THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`t:real`] THEN POP_ASSUM MP_TAC THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`i MOD k` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; STRIP_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)`) THEN RESA_TAC THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] THEN REPLICATE_TAC (15-5) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num MOD k`]) THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]); ]);;
let DEFORMATION_V3_DEFOR_NOT_IN_V_V1_TWO_CASES=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 ==> (!i. ~(i MOD k= l MOD k) ==> (?e. &0< e /\ (!t. --e<t /\ t<e ==> &0<dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i))))`,
[ REPEAT STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST_V1 THEN ASM_REWRITE_TAC[] THEN MP_TAC HYPER_MM_COLLINEAR_TWO_CASES THEN RESA_TAC THEN MATCH_MP_TAC(REAL_ARITH`&0<= a/\ ~(a= &0)==> &0 < a`) THEN ASM_REWRITE_TAC[dist;NORM_POS_LE] THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> MRESA_TAC DIVISION[`i:num`;`k:num`] THEN MRESA_TAC DIVISION[`l:num`;`k:num`] THEN MRESA_TAC th[`i MOD k`;`l MOD k`]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA_TAC th[`l:num`]) THEN STRIP_TAC THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v2:real^3`;`(w:num->real^3) i`;]]);;
let DEFORMATION_V3_DEFOR_NOT_IN_V_COM_V1_TWO_CASES=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 ==> ?e. &0< e /\ (!t i. --e<t /\ t<e/\ ~(i MOD k= l MOD k) ==> &0<dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i))`,
[ REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_V1_TWO_CASES THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] THEN REWRITE_TAC[SKOLEM_THM] THEN STRIP_TAC THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k/\ ~(i= l MOD k)}` THEN EXISTS_TAC`e1:real` THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; MATCH_MP_TAC FINITE_SUBSET THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` THEN STRIP_TAC; MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG]; REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] THEN REPEAT RESA_TAC THEN EXISTS_TAC`i:num` THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) THEN RESA_TAC; EXISTS_TAC`(e:num->real)1` THEN EXISTS_TAC`1` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 1<k `) THEN RESA_TAC; EXISTS_TAC`(e:num->real)0` THEN EXISTS_TAC`0` THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MP_TAC(ARITH_RULE`3<k==> 0<k `) THEN RESA_TAC; STRIP_TAC; MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`&0`] THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT RESA_TAC THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`]); REPEAT STRIP_TAC THEN MRESAL_TAC REAL_LE_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`e1:real`][REAL_ARITH`a<=a`] THEN POP_ASSUM MP_TAC THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`i MOD k` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; STRIP_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)`) THEN RESA_TAC THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] THEN MP_TAC(REAL_ARITH`-- e1<t/\t<e1/\ e1<= e(i MOD k)==> -- e(i MOD k)< t/\ t< e(i MOD k)`) THEN RESA_TAC THEN REPLICATE_TAC (12) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num MOD k`]) THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]);]);;
let DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1_TWO_CASES=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 ==> ?e. &0< e /\ (!t i. -- e<t /\ t<e/\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i))`,
STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_V1_TWO_CASES THEN RESA_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN REPEAT GEN_TAC THEN POP_ASSUM(fun th-> STRIP_TAC THEN MRESA_TAC th[`t:real`;`i:num`]) THEN POP_ASSUM (fun th-> STRIP_TAC THEN MP_TAC th THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[DIST_REFL]) THEN REAL_ARITH_TAC);;
let V3_DEFOR_EQ_IN_FF_V1_TWO_CASES=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!w. v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t),w IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF <=> v2,w IN FF)`,
[ STRIP_TAC THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT THEN RESA_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (47-44)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN REPLICATE_TAC (48-18)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`x':num`]) THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x':num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA_TAC th[`l:num`]) THEN REPLICATE_TAC (68-61)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[]; EXISTS_TAC`v2:real^3,w':real^3` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w'):real^3#real^3`];]);;
let V3_DEFOR_RHO_NODE_V1_TWO_CASES=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w ( l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e/\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (rho_node1 (IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF) (v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t))) = (rho_node1 FF v2)`,
REWRITE_TAC[rho_node1] THEN STRIP_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF_V1_TWO_CASES THEN RESA_TAC);;
let V3_DEFOR_EQ_IN_FF_SYM_V1_TWO_CASES=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!w. w,v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF <=> w,v2 IN FF)`,
[STRIP_TAC THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (40-23)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT THEN RESA_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (47-44)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN REPLICATE_TAC (48-18)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`SUC x':num`]) THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x':num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA_TAC th[`l:num`]) THEN REPLICATE_TAC (68-61)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[]; EXISTS_TAC`w':real^3,v2:real^3` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w',v2):real^3#real^3`]]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_V1_TWO_CASES=
prove_by_refinement(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t. --e< t/\ t< e ==> azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t) (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t)) (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) = azim (vec 0) v2 (rho_node1 FF v2) (@a. a,v2 IN FF)))`,
[ STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1_TWO_CASES THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (SUC l)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN RESA_TAC THEN ABBREV_TAC`e1=(min e e')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' ==> &0< e1/\ e1< e/\ e1<e'`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e/\ --e1<t ==> t< e/\ --e<t`) THEN RESA_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF_SYM_V1_TWO_CASES THEN RESA_TAC THEN ASM_SIMP_TAC[v3_defor_v4;] THEN MP_TAC V3_DEFOR_RHO_NODE_V1_TWO_CASES THEN RESA_TAC THEN ASM_REWRITE_TAC[GSYM ivs_rho_node1] THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN REPLICATE_TAC (68-31) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) THEN RESA_TAC THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN SUBGOAL_THEN`(w:num->real^3) (l) IN V` ASSUME_TAC; EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; MRESA_TAC (GEN_ALL Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1)[`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3) (l)`]) THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l)`;`w:num->real^3`;`l:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;is_scs_v39;periodic2] THEN POP_ASSUM(fun th-> MRESAL_TAC th[`SUC 0`][ITER] THEN MRESA_TAC th[`k-1`]) THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0+l= SUC(l)/\ k-1+l= l+k-1`]; REPLICATE_TAC (76-57) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e' /\ --e1<t ==> t< e'/\ --e'<t`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN MATCH_MP_TAC Planarity.aff_gt2_subset_aff_ge THEN ASM_REWRITE_TAC[] THEN MRESA_TAC th3[`vec 0:real^3`;`(w:num->real^3)(SUC l)`;`v1:real^3`] THEN STRIP_TAC; MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan THEN EXISTS_TAC`(w:num->real^3) (SUC l)` THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN ASM_REWRITE_TAC[]; MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan THEN EXISTS_TAC`(w:num->real^3)(l+k-1)` THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN ASM_REWRITE_TAC[]]);;
let V3_DEFOR_EQ_IN_FF_AT_V1_V1_TWO_CASES=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!a. w(SUC l),a IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF<=> w(SUC l),a IN FF)`,
[ STRIP_TAC THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (44-15)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`SUC l:num`]) THEN POP_ASSUM MP_TAC THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th [`l:num`]) THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; SUBGOAL_THEN`(w:num->real^3) (SUC l),v2 IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`v1,v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v1:real^3`;`(w:num->real^3) (SUC l)`] THEN REPLICATE_TAC (49-8)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN RESA_TAC THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`(w:num->real^3) (l+k-1)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN ASM_REWRITE_TAC[]; EXISTS_TAC`(w:num->real^3)(SUC l),a':real^3` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN MP_TAC(SET_RULE`v2= a':real^3\/ ~(v2=a')`) THEN RESA_TAC; SUBGOAL_THEN`v1,v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v1:real^3`;`(w:num->real^3) (SUC l)`] THEN REPLICATE_TAC (51-8)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN RESA_TAC THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`(w:num->real^3) (l+k-1)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN ASM_REWRITE_TAC[]; SUBGOAL_THEN`v2,(w:num->real^3) (SUC l) IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w (SUC l)):real^3#real^3`] THEN MRESA_TAC th3[`v2:real^3`;`vec 0:real^3`;`(w:num->real^3) (SUC l)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC]);;
let V3_DEFOR_RHO_NODE_AT_V1_V1_TWO_CASES=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k)==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (rho_node1 (IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF) (w (SUC l))) =(rho_node1 FF (w (SUC l)))`,
REWRITE_TAC[rho_node1] THEN STRIP_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V1_V1_TWO_CASES THEN RESA_TAC);;
let V3_DEFOR_EQ_IN_FF_AT_V1_SYM_V1_TWO_CASES=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (@a. a,w(SUC l) IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF)= v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`,
[ STRIP_TAC THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA THEN STRIP_TAC; EXISTS_TAC`v3_defor_v1 (-- &1) (v1) (v2) x1 x2 x6 x6 (x2 - t)` THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`v2:real^3,(w:num->real^3)(SUC l)` THEN ASM_REWRITE_TAC[] THEN SUBGOAL_THEN`v2,(w:num->real^3) (SUC l) IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w (SUC l)):real^3#real^3`] THEN MRESA_TAC th3[`v2:real^3`;`vec 0:real^3`;`(w:num->real^3) (SUC l)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC; REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN RESA_TAC; MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (45-16)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`SUC l:num`]) THEN POP_ASSUM MP_TAC THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th [`l:num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC; SUBGOAL_THEN`a',w(SUC l) IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`v2,w(SUC l) IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(w:num->real^3)(SUC l)`;`FF:real^3#real^3->bool`;`v2:real^3`;`(a':real^3) `]]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_AT_V1_V1_TWO_CASES=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t. --e< t/\ t< e ==> azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC l)) t) (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC l)) t)) (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC l)) t IN IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) = azim (vec 0) (w (SUC l)) (rho_node1 FF (w (SUC l))) (@a. a,(w (SUC l)) IN FF)))`,
[ STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1_TWO_CASES THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (SUC l )`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN RESA_TAC THEN ABBREV_TAC`e1=(min e e')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' ==> &0< e1/\ e1< e/\ e1<e'`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e/\ --e1<t ==> t< e/\ --e<t`) THEN RESA_TAC THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V1_SYM_V1_TWO_CASES THEN RESA_TAC THEN ASM_SIMP_TAC[v3_defor_v4;] THEN MP_TAC V3_DEFOR_RHO_NODE_AT_V1_V1_TWO_CASES THEN RESA_TAC THEN ASM_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC; REPLICATE_TAC (74-31) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) THEN RESA_TAC THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN SUBGOAL_THEN`v2,(w:num->real^3) (SUC l) IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w (SUC l)):real^3#real^3`] THEN MRESA_TAC th3[`v2:real^3`;`vec 0:real^3`;`(w:num->real^3) (SUC l)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN ASM_REWRITE_TAC[GSYM ivs_rho_node1]; MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(SUC l)`;`v2:real^3`] THEN MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, w (SUC l)}/\ aff_gt {vec 0} {v1, w (SUC l)} SUBSET aff_ge {vec 0} {v1, w (SUC l)} ==> v2 IN aff_ge {vec 0} {v1:real^3, w (SUC l)}`) THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN RESA_TAC THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`(w:num->real^3)(SUC l)`;`v2:real^3`;`v1:real^3`;`(rho_node1 FF (w (SUC l)))`;] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN RESA_TAC THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT THEN STRIP_TAC; MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`aff_gt{vec 0:real^3} {w(SUC l),v1}` THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]; REPLICATE_TAC (89-57) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`t<e1/\ e1<e'/\ --e1<t ==> t< e'/\ --e'<t`) THEN RESA_TAC THEN ASM_REWRITE_TAC[]; ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan THEN EXISTS_TAC`(w:num->real^3) (l+k-1)` THEN ASM_REWRITE_TAC[] THEN REPLICATE_TAC (89-57) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`t<e1/\ e1<e'/\ --e1<t ==> t< e'/\ --e'<t`) THEN RESA_TAC THEN ASM_REWRITE_TAC[]]);;
let V3_DEFOR_EQ_IN_FF_AT_W_V1_TWO_CASES=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!v. v,w (l + (scs_k_v39 s - 1)) IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF<=> v,w (l + (scs_k_v39 s - 1)) IN FF)`,
[ STRIP_TAC THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (44-15)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`l+k-1:num`]) THEN POP_ASSUM MP_TAC THEN MP_TAC MOD_ADD_SUB_1 THEN RESA_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; SUBGOAL_THEN`v2, w(l+k-1) IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`SND(x:real^3#real^3)`]); EXISTS_TAC`v:real^3,(w:num->real^3) (l + k - 1)` THEN ASM_REWRITE_TAC[] THEN SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;]; MP_TAC(SET_RULE`v2=v:real^3\/ ~(v=v2)`) THEN RESA_TAC; SUBGOAL_THEN`v2, w(l+k-1) IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3)(l+k-1)`])]);;
let V3_DEFOR_EQ_IN_FF_AT_W_SYM_V1_TWO_CASES=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (@v. w(l+k-1),v IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF)= v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`,
[ STRIP_TAC THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA THEN STRIP_TAC; EXISTS_TAC`v3_defor_v1 (-- &1) (v1) (v2) x1 x2 x6 x6 (x2 - t)` THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`(w:num->real^3) (l + k - 1),v2:real^3` THEN ASM_REWRITE_TAC[] THEN SUBGOAL_THEN`v1,v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;]; REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN RESA_TAC; MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (46-16)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`l+k-1:num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC MOD_ADD_SUB_1 THEN RESA_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC; SUBGOAL_THEN`v1,v IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`v1,v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v1:real^3`;`v2:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v:real^3`;]]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_AT_W_V1_TWO_CASES=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t. --e< t/\ t< e ==> azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t) (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t)) (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t IN IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) = azim (vec 0) (w (l + k - 1)) (rho_node1 FF (w (l + k - 1))) (@a. a,w (l + k - 1) IN FF)))`,
[ STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1_TWO_CASES THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (SUC l)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN RESA_TAC THEN ABBREV_TAC`e1=(min e e')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' ==> &0< e1/\ e1< e/\ e1<e'`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e/\ --e1<t ==> t< e/\ --e<t`) THEN RESA_TAC THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] THEN REPEAT RESA_TAC; ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (38-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_W_SYM_V1_TWO_CASES THEN RESA_TAC THEN ASM_SIMP_TAC[v3_defor_v4;] THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_W_V1_TWO_CASES THEN RESA_TAC THEN ASM_REWRITE_TAC[rho_node1] THEN ASM_REWRITE_TAC[GSYM rho_node1;GSYM ivs_rho_node1] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] THEN ONCE_REWRITE_TAC[Rogers.AZIM_EQ_SYM]; MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, w (SUC l)}/\ aff_gt {vec 0} {v1, w (SUC l)} SUBSET aff_ge {vec 0} {v1, w (SUC l)} ==> v2 IN aff_ge {vec 0} {v1:real^3, w (SUC l )}`) THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN MRESA_TAC(GEN_ALL Planarity.properties_of_collinear4_points_fan) [`vec 0:real^3`;`(w:num->real^3)(SUC l)`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN RESA_TAC THEN RESA_TAC THEN RESA_TAC THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`(w:num->real^3)(l+k-1)`;`v2:real^3`;`(w:num->real^3)(SUC l)`;`(ivs_rho_node1 FF (w(l+k-1)))`;] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN RESA_TAC THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT THEN STRIP_TAC; ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`aff_gt{vec 0:real^3} {w(SUC l),v1}` THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] THEN REPLICATE_TAC (47-22) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`t<e1/\ e1<e'/\ --e1<t ==> t< e'/\ --e'<t`) THEN RESA_TAC THEN ASM_REWRITE_TAC[]; ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan THEN EXISTS_TAC`(w:num->real^3)(SUC l)` THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN ASM_REWRITE_TAC[] THEN REPLICATE_TAC (47-22) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`t<e1/\ e1<e'/\ --e1<t==> t< e'/\ --e'<t`) THEN RESA_TAC THEN ASM_REWRITE_TAC[]]);;
let V3_DEFOR_EQ_IN_FF_AT_V_ANY_V1_TWO_CASES=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V /\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(SUC l)) /\ v IN V ==> (!w. v,w IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF<=> v,w IN FF)`,
[ STRIP_TAC THEN REPLICATE_TAC (24-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (42-25)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (49-23)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN REPLICATE_TAC (50-16)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`x':num`]) THEN REPLICATE_TAC (50-46)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN POP_ASSUM MP_TAC THEN MRESA_TAC DIVISION[`x':num`;`k:num`] THEN MRESA_TAC DIVISION[`l:num`;`k:num`] THEN MP_TAC(SET_RULE`x' MOD k = l MOD k \/ ~(x' MOD k = l MOD k)`) THEN RESA_TAC; ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x':num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA_TAC th[`l:num`]) THEN REPLICATE_TAC (77-39)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[]; RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; SUBGOAL_THEN`v,v2 IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`v1,v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`v1:real^3`]; EXISTS_TAC`v:real^3,w':real^3` THEN ASM_REWRITE_TAC[] THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) THEN RESA_TAC; SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`(w:num->real^3) (l+k-1)`]]);;
let V3_DEFOR_EQ_IN_FF_AT_V_ANY_SYM_V1_TWO_CASES=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V /\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(SUC l)) /\ v IN V ==> (!w. w,v IN IMAGE (\uv. (if FST uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else FST uv), (if SND uv = v2 then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) else SND uv)) FF<=> w,v IN FF)`,
[ STRIP_TAC THEN REPLICATE_TAC (24-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN ASSUME_TAC th THEN STRIP_TAC) THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; REPLICATE_TAC (42-25)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN REPLICATE_TAC (49-23)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN REPLICATE_TAC (50-16)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`;`x':num`]) THEN REPLICATE_TAC (50-47)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN POP_ASSUM MP_TAC THEN MRESA_TAC DIVISION[`x':num`;`k:num`] THEN MRESA_TAC DIVISION[`l:num`;`k:num`] THEN MP_TAC(SET_RULE`x' MOD k = l MOD k \/ ~(x' MOD k = l MOD k)`) THEN RESA_TAC; ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x':num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA_TAC th[`l:num`]) THEN REPLICATE_TAC (77-39)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[]; RESA_TAC; POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN REPEAT RESA_TAC THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; SUBGOAL_THEN`v2,v IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_TAC[]; SUBGOAL_THEN`v2,w(SUC l) IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`(w:num->real^3)(SUC l)`;] THEN REPLICATE_TAC (54-22)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[]; EXISTS_TAC`w':real^3,v:real^3` THEN ASM_REWRITE_TAC[] THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) THEN RESA_TAC; SUBGOAL_THEN`v2,w(SUC l) IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`(w:num->real^3)(SUC l)`;] THEN REPLICATE_TAC (54-20)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[]]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_AT_V_ANY_V1_TWO_CASES=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t v. --e< t/\ t< e /\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(SUC l)) /\ v IN V ==> azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t)) (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t IN IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) = azim (vec 0) v (rho_node1 FF v) (@a. a,v IN FF)))`,
STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1_TWO_CASES THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (SUC l)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN RESA_TAC THEN ABBREV_TAC`e1=(min e e')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' ==> &0< e1/\ e1< e/\ e1<e'`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e/\ --e1<t ==> t< e/\ --e<t`) THEN RESA_TAC THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V_ANY_SYM_V1_TWO_CASES THEN RESA_TAC THEN ASM_SIMP_TAC[v3_defor_v4;] THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V_ANY_V1_TWO_CASES THEN RESA_TAC THEN ASM_SIMP_TAC[rho_node1;]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_V1_TWO_CASES=
prove_by_refinement( ` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t v. --e< t/\ t< e /\ v IN V ==> azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t) (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t)) (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t IN IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) = azim (vec 0) (v) (rho_node1 FF (v)) (@a. a,v IN FF)))`,
[STRIP_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_W_V1_TWO_CASES THEN RESA_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_V1_V1_TWO_CASES THEN RESA_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_V1_TWO_CASES THEN RESA_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_V_ANY_V1_TWO_CASES THEN RESA_TAC THEN ABBREV_TAC`e1=(min (min (min e e') e'')e''')/ &2` THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'')e''')/ &2/\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''==> &0< e1/\ e1<e/\ e1<e'/\ e1< e''/\ e1< e'''`) THEN RESA_TAC THEN EXISTS_TAC`e1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT RESA_TAC THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'')e''')/ &2/\ &0< e/\ &0< e'/\ &0< e''/\ t<e1/\ --e1<t/\ &0< e'''==> t<e/\ t<e'/\ t< e''/\ t < e''' /\ --e< t/\ --e'<t /\ --e''<t/\ --e'''<t`) THEN RESA_TAC THEN MP_TAC(SET_RULE`(v=(w:num->real^3)(l+k-1))\/ ~(v=(w:num->real^3)(l+k-1))`) THEN RESA_TAC; REPLICATE_TAC (44-20) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[]; MP_TAC(SET_RULE`(v=(w:num->real^3) (SUC l))\/ ~(v=(w:num->real^3) (SUC l))`) THEN RESA_TAC; REPLICATE_TAC (45-22) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[]; MP_TAC(SET_RULE`(v=(v2:real^3))\/ ~(v=v2)`) THEN RESA_TAC; REPLICATE_TAC (46-24) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[]; REPLICATE_TAC (46-26) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[]]);;
let DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_TWO_CASES=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!v t. v IN V /\ --e< t /\ t< e /\ interior_angle1 (vec 0) FF v = pi ==> interior_angle1 (vec 0) (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) <= pi))`,
REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_V1_TWO_CASES THEN RESA_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[interior_angle1] THEN REPEAT RESA_TAC THEN REPLICATE_TAC (24-20) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`t:real`;`v:real^3`]) THEN REAL_ARITH_TAC);;
let DEFORMATION_LUNAR_AFFINE_HULL_V1_TWO_CASES=
prove_by_refinement( `3<k /\ scs_k_v39 s =k/\ is_scs_v39 s /\ MMs_v39 s w /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ w l=v2/\ w (l+k-1) =v1/\ ~(norm v2 = &2) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1 /\ ~(v=v2)/\ ~(w1=v2) /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V /\ IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)=E /\ lunar (v,w1) V E ==> ?e. &0<e /\ (!t. t IN real_interval (--e,e) ==> v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN affine hull {vec 0, v, w1, v2})`,
[ STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1_TWO_CASES THEN RESA_TAC THEN MP_TAC HYPER_MM_COLLINEAR_TWO_CASES THEN RESA_TAC THEN REPLICATE_TAC (25-6)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> POP_ASSUM(fun th1-> REPEAT DISCH_TAC THEN MP_TAC th THEN MP_TAC th1)) THEN REPEAT RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (SUC l)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN RESA_TAC THEN REPLICATE_TAC (27-3)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC th THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;IN_REAL_INTERVAL] THEN MP_TAC th THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN REPEAT RESA_TAC) THEN MP_TAC BBS_IMP_CONVEX_LOCAL_FAN THEN RESA_TAC THEN SUBGOAL_THEN`(v2:real^3) IN V` ASSUME_TAC; EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; SUBGOAL_THEN`v1,v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l+k-1` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; SUBGOAL_THEN`v2,w (SUC l) IN (FF:real^3#real^3->bool)` ASSUME_TAC; EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] THEN MP_TAC(ARITH_RULE`3<k==> SUC(l+k-1)= l+k`) THEN RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] THEN REPEAT RESA_TAC; MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v1:real^3`;] THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`(w:num->real^3)(SUC l)`] THEN MRESAL_TAC (GEN_ALL LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI) [`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w1:real^3`;][DIFF;IN_ELIM_THM;SET_RULE`~(a IN {b,c}) <=> (~(a=b)/\ ~(a=c))`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`v2:real^3`]) THEN MRESA_TAC (GEN_ALL Collect_geom2.THREE_GEN_POINTS_IN_AFF3)[`v2:real^3`;`v:real^3`;`w1:real^3`] THEN MRESA_TAC (GEN_ALL Local_lemmas.CONV02_SUBSET_AFF2)[`v:real^3`;`w1:real^3`] THEN MP_TAC(SET_RULE`v IN aff {v2, v, w1}/\ w1 IN aff {v2, v, w1} ==> {v, w1} SUBSET aff {v2, v, w1:real^3}`) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{v, w1:real^3}`;` {v2, v, w1:real^3}`] THEN MP_TAC(SET_RULE`v1 IN aff {v2, v, w1}/\ w (SUC l) IN aff {v2, v, w1} /\ vec 0 IN conv0 {v, w1} /\ conv0 {v, w1} SUBSET aff {v, w1} /\ aff {v, w1} SUBSET aff {v2, v, w1} ==> {vec 0, v1, w (SUC l)} SUBSET aff {v2, v, w1:real^3}`) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{vec 0, v1, w (SUC l):real^3}`;` {v2, v, w1:real^3}`] THEN MRESAL_TAC (GEN_ALL Local_lemmas.AFF_GT_SUB_AFF_UNION)[`{vec 0:real^3}`;`{ v1, w (SUC l):real^3}`][SET_RULE`{A}UNION {B,C}={A,B,C}`] THEN EXISTS_TAC`e':real` THEN ASM_REWRITE_TAC[] THEN REPEAT RESA_TAC THEN REPLICATE_TAC (66-27)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MRESA_TAC th[`t:real`]) THEN REWRITE_TAC[GSYM aff] THEN MRESAL_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA[`{v2, v, w1:real^3}`;`{vec 0,v, w1,v2:real^3}`][SET_RULE`{A,B,C} SUBSET {D,B,C,A}`;GSYM aff] THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`aff {v2, v, w1:real^3}` THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`aff {vec 0, v1, w (SUC l):real^3}` THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) THEN EXISTS_TAC`aff_gt {vec 0} {v1, w (SUC l):real^3}` THEN ASM_REWRITE_TAC[v3_defor_v4] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[];]);;
let V3_DEFOR_CONVEX_LOCAL_FAN_TWO_CASES_concl =`!s k w l. scs_k_v39 s=k /\ is_scs_v39 s /\ MMs_v39 s w /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ 3 < k /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ (&10= &10) /\ ~(&2 = norm (v2)) /\ (&1= &1) /\ (!i. ~(scs_J_v39 s l i)) /\ w l=v2/\ w (l+k-1) =v1/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1/\ (!V E v. V = IMAGE w (:num) /\ E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> ~(lunar (v,(w l)) V E )) ==> (?e. &0 < e /\ (!t. --e < t /\ t < e ==> convex_local_fan (IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t) (:num), IMAGE (\i. {v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t, v3_defor_v4 a x1 x2 x6 v1 v2 (w (SUC i)) t}) (:num), IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t, v3_defor_v4 a x1 x2 x6 v1 v2 (w (SUC i)) t) (:num))))`;;
let V3_DEFOR_DEFORMATION_CONVEX_LOCAL_FAN_V1_TWO_CASES=prove_by_refinement(
(mk_imp(ZLZTHIC_concl, mk_imp (MHAEYJN_concl, V3_DEFOR_CONVEX_LOCAL_FAN_TWO_CASES_concl))),
[

REPEAT STRIP_TAC;

REPLICATE_TAC (19-4)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC th
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN ASSUME_TAC th
THEN STRIP_TAC)
THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)`
THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`
THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)`
THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;]
THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`]
THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`)
THEN RESA_TAC
THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC;


REPLICATE_TAC (38-19)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC);

SUBGOAL_THEN`(v2:real^3) IN V` ASSUME_TAC;


EXPAND_TAC"V"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`l:num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`];


SUBGOAL_THEN`(v1:real^3) IN V` ASSUME_TAC;


EXPAND_TAC"V"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`l+k-1:num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`];

SUBGOAL_THEN`(v2:real^3) IN ball_annulus` ASSUME_TAC;

REPLICATE_TAC (41-19)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC)
THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`))
THEN EXISTS_TAC`V:real^3->bool`
THEN ASM_REWRITE_TAC[];



SUBGOAL_THEN`(v1:real^3) IN ball_annulus` ASSUME_TAC;

REPLICATE_TAC (42-19)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC)
THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`))
THEN EXISTS_TAC`V:real^3->bool`
THEN ASM_REWRITE_TAC[];



SUBGOAL_THEN`((v1,v2):real^3#real^3) IN FF`ASSUME_TAC;

EXPAND_TAC"FF"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`l+k-1:num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`]
THEN MP_TAC EQ_W_L_IN_BBS
THEN RESA_TAC;

MP_TAC Local_lemmas.CVLF_LF_F
THEN RESA_TAC
THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v1,v2):real^3#real^3`]
THEN MP_TAC NORM_POS_COLLINEAR
THEN RESA_TAC
THEN MP_TAC V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION
THEN RESA_TAC
THEN MP_TAC UPS_X_POS_SEG
THEN RESA_TAC;


MRESA_TAC Deformation.XRECQNS[`-- &1`;`&1`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ww_defor ((w:num->real^3) l)`]
THEN MRESAL_TAC (GEN_ALL V3_DEFOR_DEFORMATION)[`x2:real`;`x6:real`;`a:real`;`x1:real`;`x2:real`;`x6:real`;`v1:real^3`;`v2:real^3`;`V:real^3->bool`][REAL_ARITH`&0< &1`]
THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH
THEN RESA_TAC;

MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_TWO_CASES
THEN RESA_TAC;

ABBREV_TAC`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2`
THEN MP_TAC(REAL_ARITH`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e'''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\  -- e'''<= --e1/\ --e1< &0/\ e1< e''''`)
THEN RESA_TAC;


MRESA_TAC (GEN_ALL DEFORMATION_SMALL_INTERVAL)[`-- e''':real`;`e''':real`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`;`V:real^3->bool`;`--e1:real`;`e1:real`]
THEN REPLICATE_TAC (73-0) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC th[`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`])
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`(!v t.
           v IN V /\
           t IN real_interval (--e1,e1) /\
           interior_angle1 (vec 0) FF v = pi
           ==> interior_angle1 (vec 0)
               (IMAGE
                (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t,
                      v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t)
               FF)
               (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) <=
               pi)`ASSUME_TAC;

ASM_REWRITE_TAC[IN_REAL_INTERVAL]
THEN REPEAT RESA_TAC
THEN REPLICATE_TAC (76-61)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MATCH_MP_TAC th)
THEN ASM_REWRITE_TAC[IN_REAL_INTERVAL]
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''/\ --e1 <t ==> t<e''''/\ --e''''<t`)
THEN RESA_TAC;


RESA_TAC
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN EXISTS_TAC`e''''':real`
THEN ASM_REWRITE_TAC[V_DEFORMATION_V3_DEFOR;E_DEFORMATION_V3_DEFOR;F_DEFORMATION_V3_DEFOR]
THEN GEN_TAC
THEN POP_ASSUM(fun th-> STRIP_TAC
THEN MRESA_TAC th[`t:real`]);



(***********lunar**********)


MRESAL_TAC JKQEWGV3[`s:scs_v39`;`w:num->real^3`;`v:real^3`;`w':real^3`][LET_DEF;LET_END_DEF;]
THEN MP_TAC(REAL_ARITH`interior_angle1 (vec 0) FF v < pi / &2/\ &0< pi
==> interior_angle1 (vec 0) FF v < pi`)
THEN ASM_REWRITE_TAC[PI_WORKS]
THEN RESA_TAC
THEN STRIP_TAC
THEN SUBGOAL_THEN`~(v2=v:real^3)`ASSUME_TAC;

POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`w':real^3`])
THEN STRIP_TAC
THEN POP_ASSUM(fun th->
ASM_TAC
THEN REWRITE_TAC[th]
THEN REPEAT RESA_TAC)
THEN ASM_REWRITE_TAC[Local_lemmas.LUNAR_COMM];


SUBGOAL_THEN`~(v2=w':real^3)`ASSUME_TAC;

REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`])
THEN STRIP_TAC
THEN POP_ASSUM(fun th->
ASM_TAC
THEN REWRITE_TAC[th]
THEN REPEAT RESA_TAC);

POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN ABBREV_TAC`w1=w':real^3`
THEN MP_TAC DEFORMATION_LUNAR_AFFINE_HULL_V1_TWO_CASES
THEN RESA_TAC
THEN ABBREV_TAC`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2`
THEN MP_TAC(REAL_ARITH`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e'''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\  -- e'''<= --e1/\ --e1< &0/\ e1< e''''`)
THEN RESA_TAC
THEN SUBGOAL_THEN`(!u' t.
           u' IN V /\ ~(v2 = u':real^3) /\ t IN real_interval (--e1,e1)
           ==> v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 u' t = u')`ASSUME_TAC;

REPEAT STRIP_TAC
THEN REWRITE_TAC[v3_defor_v4]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[th]);

SUBGOAL_THEN`(!t. t IN real_interval (--e1,e1)
       ==> v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN
           affine hull {vec 0, v, w1, v2})`ASSUME_TAC;

ASM_REWRITE_TAC[IN_REAL_INTERVAL]
THEN REPEAT RESA_TAC
THEN REPLICATE_TAC (80-67)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MATCH_MP_TAC th)
THEN ASM_REWRITE_TAC[IN_REAL_INTERVAL]
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''/\ --e1<t==> t<e''''/\ --e''''<t`)
THEN RESA_TAC;

MRESA_TAC (GEN_ALL DEFORMATION_SMALL_INTERVAL)[`-- e''':real`;`e''':real`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`;`V:real^3->bool`;`--e1:real`;`e1:real`]
THEN REPLICATE_TAC (80-1) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC th[`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`;`v:real^3`;`w':real^3`;`v2:real^3`])
THEN POP_ASSUM MP_TAC;

RESA_TAC
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN EXISTS_TAC`e''''':real`
THEN ASM_REWRITE_TAC[V_DEFORMATION_V3_DEFOR;E_DEFORMATION_V3_DEFOR;F_DEFORMATION_V3_DEFOR]
THEN GEN_TAC
THEN POP_ASSUM(fun th-> STRIP_TAC
THEN MRESA_TAC th[`t:real`]);]);;
let DEFORMATION_INTERIOR_ANGLE1_EQ_V3_DEFOR_V1_TWO_CASES=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!v t. v IN V /\ --e< t /\ t< e ==> interior_angle1 (vec 0) (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) = interior_angle1 (vec 0) FF v))`,
REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_V1_TWO_CASES THEN RESA_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[interior_angle1] THEN REPEAT RESA_TAC THEN REPLICATE_TAC (23-20) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`t:real`;`v:real^3`]) THEN REAL_ARITH_TAC);;
let INTERIOR_ANGLE_SAME_V3_DEFOR1_TWO_CASES=
prove(` 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1 /\(!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t))/\ &0< e1 /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (?e. &0< e/\ (!t i. &0< t /\ t< e ==> interior_angle1 (vec 0) (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF) (ITER i (rho_node1 (IMAGE (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) FF)) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l MOD k)) t)) = interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) (w (l MOD k)))))`,
STRIP_TAC THEN MP_TAC DEFORMATION_INTERIOR_ANGLE1_EQ_V3_DEFOR_V1_TWO_CASES THEN RESA_TAC THEN ABBREV_TAC`e2=(min e e1)/ &2` THEN MP_TAC(REAL_ARITH`e2=(min e e1)/ &2 /\ &0< e/\ &0<e1==> &0<e2/\ e2<e/\ e2<e1`) THEN RESA_TAC THEN EXISTS_TAC`e2:real` THEN ASM_REWRITE_TAC[] THEN REPEAT RESA_TAC THEN ASM_TAC THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;] THEN REPEAT STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`;`w:num->real^3`;`l MOD k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;] THEN REPLICATE_TAC (43-25)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MP_TAC(REAL_ARITH`t<e2/\ e2<e1==> t<e1`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME) [`IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (:num)`;`IMAGE (\i. { v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t, v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t, v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) (SUC i)) t) (:num)`;`(\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (l MOD k)`;`(\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t)`;`l MOD k`] [MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;F_DEFORMATION_V3_DEFOR] THEN REPLICATE_TAC (45-29)(POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC THEN MATCH_MP_TAC th) THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`t<e2/\ e2<e/\ &0<t==> t<e/\ --e<t`) THEN RESA_TAC THEN EXPAND_TAC"V" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`i + l MOD k` THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]);;
let TAUSTAR_V3_DEFOR_TWO_CASES_concl = `!s k w l. 3<k/\ scs_k_v39 s =k/\is_scs_v39 s /\ MMs_v39 s w /\ w l=v2/\ w (l+k-1) =v1 /\ &0< x1 /\ &0<x2 /\ &0< x6 /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 /\ a= -- &1/\ ~(&2 = norm (w l)) /\ (!i. ~(scs_J_v39 s l i)) /\ (!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t))/\ &0< e1 ==> (?e. &0 < e /\ (!t. &0 < t /\ t < e ==> taustar_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t)< taustar_v39 s w ))`;;
let TAUSTAR_V3_DEFOR_TWO_CASES=prove_by_refinement(( TAUSTAR_V3_DEFOR_TWO_CASES_concl),
[
REPEAT STRIP_TAC;

REPLICATE_TAC (22-5)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC th
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN ASSUME_TAC th
THEN STRIP_TAC)
THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)`
THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`
THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)`
THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;]
THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`]
THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`)
THEN RESA_TAC
THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC;

REPLICATE_TAC (41-22)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC);

ASM_REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF;tau_fun]
THEN STRIP_TAC
THEN MP_TAC INTERIOR_ANGLE_SAME_V3_DEFOR1_TWO_CASES
THEN RESA_TAC
THEN MP_TAC RHO_FUN_DEFORMATION_V3_DEFOR
THEN RESA_TAC
THEN ABBREV_TAC`e2=(min (min e1 e) e')/ &2`
THEN MP_TAC(REAL_ARITH`e2=(min(min e1 e) e')/ &2/\ &0< e1/\ &0< e/\ &0<e'
==> &0< e2/\ e2< e1/\ e2<e/\ e2< e'`)
THEN RESA_TAC
THEN EXISTS_TAC`e2:real`
THEN ASM_REWRITE_TAC[]
THEN REPEAT STRIP_TAC
THEN MP_TAC(REAL_ARITH`e2=(min(min e1 e) e')/ &2/\ &0< e1/\ &0< e/\ &0<e'
/\ t<e2/\ &0<t
==> t< e1/\ t<e/\ t< e'`)
THEN RESA_TAC
THEN MP_TAC CARD_FF_EQ_V3_DEFOR_DEFORMATION
THEN RESA_TAC
THEN POP_ASSUM(fun th->MRESA1_TAC th`t:real`)
THEN MP_TAC DSV_V3_DEFOR_EQ
THEN RESA_TAC
THEN MATCH_MP_TAC(REAL_ARITH`a<b==> a-c< b-c`)
THEN MATCH_MP_TAC(REAL_ARITH`a<b==> a-c< b-c`)
THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`V:real^3->bool`;`w:num->real^3`;`l:num`;`s:scs_v39`;`(w:num->real^3) (l MOD scs_k_v39 s)`;`FF:real^3#real^3->bool`;`E:(real^3->bool)->bool`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REPLICATE_TAC (59-20)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MRESA_TAC th[`t:real`])
THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`IMAGE  (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (:num)`;` (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t)`;`l:num`;`s:scs_v39`;` (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (l MOD scs_k_v39 s)`;`IMAGE (\i.  v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC i)) t) (:num)`;`IMAGE (\i. {  v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w i) t,  v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN SUBGOAL_THEN`{i|i<k:num}= 0..(k-1)`ASSUME_TAC;

REWRITE_TAC[IN_ELIM_THM;IN_NUMSEG;EXTENSION]
THEN REPLICATE_TAC (59-2)(POP_ASSUM MP_TAC)
THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN ARITH_TAC;

ASM_REWRITE_TAC[]
THEN MRESAL_TAC SUM_ADD_SPLIT[`(\i. rho_fun (norm (w (i + l MOD k))) *
      interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) (w (l MOD k))))`;`0`;`0`;`k-1`][ARITH_RULE`0<=0+1/\ 0+A=A`]
THEN MRESAL_TAC SUM_ADD_SPLIT[`(\i. rho_fun (norm (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (i + l MOD k)) t)) *
      interior_angle1 (vec 0)
      (IMAGE (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w i) t,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC i)) t)
      (:num))
      (ITER i
       (rho_node1
       (IMAGE (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (i)) t,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC i )) t)
       (:num)))
      (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w ( l MOD k)) t)))`;`0`;`0`;`k-1`][ARITH_RULE`0<=0+1/\ 0+A=A`]
THEN MATCH_MP_TAC(REAL_ARITH`a<b/\ c=d==> a+c<b+d`)
THEN REWRITE_TAC[SUM_SING_NUMSEG;ITER]
THEN STRIP_TAC;

REWRITE_TAC[ARITH_RULE`0+A=A`]
THEN REPLICATE_TAC (62-40)(POP_ASSUM MP_TAC)
THEN POP_ASSUM (fun th-> ASM_TAC
THEN MP_TAC th)
THEN REPEAT RESA_TAC
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39;convex_local_fan]
THEN REPEAT RESA_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN SUBGOAL_THEN`(v2:real^3) IN V`ASSUME_TAC;

EXPAND_TAC"V"
THEN REWRITE_TAC[IN_ELIM_THM;IMAGE]
THEN EXISTS_TAC`l:num`
THEN ASM_REWRITE_TAC[SET_RULE`(l:num)IN(:num)`];

REPLICATE_TAC (91-67)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC(REAL_ARITH`t<e2/\ e2<e/\ &0<t ==> --e<t`)
THEN RESA_TAC
THEN MRESAL_TAC th[`t:real`;`0`][F_DEFORMATION_V3_DEFOR;ITER])
THEN MP_TAC Local_lemmas.LOFA_IMP_V_DIFF
THEN RESA_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3) l`])
THEN MATCH_MP_TAC REAL_LT_RMUL
THEN STRIP_TAC;

REPLICATE_TAC (93-68)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC(REAL_ARITH`t<e2/\ e2<e'/\ &0<t ==> --e'<t`)
THEN RESA_TAC
THEN MRESAL_TAC th[`t:real`][v3_defor_v4]);

MRESA_TAC (GEN_ALL Local_lemmas.INTERIOR_ANGLE1_POS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3) (l MOD scs_k_v39 s)`];

MATCH_MP_TAC SUM_EQ
THEN REWRITE_TAC[IN_NUMSEG;F_DEFORMATION_V3_DEFOR]
THEN REPEAT STRIP_TAC
THEN MP_TAC(ARITH_RULE`x<=k-1/\ 3< k==> x< k`)
THEN RESA_TAC
THEN REPLICATE_TAC (65-44)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC(REAL_ARITH`t<e2/\ e2<e/\ &0<t ==> --e<t`)
THEN RESA_TAC
THEN MRESAL_TAC th[`t:real`;`x:num`][F_DEFORMATION_V3_DEFOR;ITER])
THEN REWRITE_TAC[REAL_EQ_MUL_RCANCEL]
THEN MATCH_MP_TAC (SET_RULE`A==> A\/ B`)
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39;convex_local_fan]
THEN REPEAT RESA_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN SUBGOAL_THEN`(v2:real^3) IN V`ASSUME_TAC;

EXPAND_TAC"V"
THEN REWRITE_TAC[IN_ELIM_THM;IMAGE]
THEN EXISTS_TAC`l:num`
THEN ASM_REWRITE_TAC[SET_RULE`(l:num)IN(:num)`];

MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;convex_local_fan;is_scs_v39;periodic2]
THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`;`w:num->real^3`;`l MOD k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;convex_local_fan;is_scs_v39;periodic2]
THEN POP_ASSUM(fun th-> MRESA_TAC th[`x:num`] )
THEN MP_TAC(ARITH_RULE`1<=x==> 0<x`)
THEN RESA_TAC
THEN 
MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_DIS_ELMS23)
[`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`]
THEN POP_ASSUM(fun th-> MRESAL_TAC th[`0:num`;`x:num`][ITER;v3_defor_v4] )]);;
let IMJXPHR_concl = `!s k w l. scs_k_v39 s=k /\ is_scs_v39 s /\ MMs_v39 s w /\ azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ 3 < k /\ ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ ~(&2 = norm (w l)) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist(w l,w i)) /\ (!i. ~(scs_J_v39 s l i)) /\ (!V E v. V = IMAGE w (:num) /\ E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> ~(lunar (v,(w l)) V E )) ==> (scs_a_v39 s l (SUC l) = dist (w l, w (SUC l)) /\ (scs_a_v39 s l (l + (k-1)) = dist (w l, w (l + (k-1)))))`;;
let IMJXPHR=prove_by_refinement((mk_imp(ZLZTHIC_concl, mk_imp (MHAEYJN_concl, IMJXPHR_concl))),

[

REPEAT DISCH_TAC
THEN REPEAT GEN_TAC
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC ODXLSTCv2
THEN RESA_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`])
THEN POP_ASSUM (fun th-> STRIP_TAC
THEN MP_TAC th
THEN POP_ASSUM MP_TAC)
THEN ASM_REWRITE_TAC[SET_RULE`(A==> ~(B/\ A)==>C)<=> A==> ~B==>C`]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> STRIP_TAC THEN MP_TAC th)
THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC)
THEN REWRITE_TAC[scs_diag]
THEN REPLICATE_TAC (2)STRIP_TAC
THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP]
THEN STRIP_TAC 
;

MP_TAC(SET_RULE`~(SUC l MOD k = i MOD k) /\
          ~(l MOD k = SUC i MOD k) \/ 
           (SUC l MOD k = i MOD k)\/ (l MOD k = SUC i MOD k)`)
THEN RESA_TAC;



REPLICATE_TAC (14-9)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC th[`i:num`])
;

MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`)
THEN RESA_TAC
THEN POP_ASSUM (fun th-> ASM_TAC
THEN MP_TAC th
THEN REPEAT DISCH_TAC
THEN POP_ASSUM MP_TAC)
THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`]
THEN SUBGOAL_THEN`scs_a_v39 s l (SUC l) = dist (w l,(w:num->real^3) (SUC l))`
ASSUME_TAC
;


ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
;

REPLICATE_TAC (54-26) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MRESA_TAC th[`l:num`;`i:num`])
;

REPLICATE_TAC (55-44) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN REPLICATE_TAC (2) (POP_ASSUM MP_TAC)
THEN REAL_ARITH_TAC
;

ASM_REWRITE_TAC[]
;

REPLICATE_TAC (23-5)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC th
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN ASSUME_TAC th
THEN STRIP_TAC)
THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)`
THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`
THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)`
THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;]
THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`]
THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC;


REPLICATE_TAC (35-22)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC)
;

SUBGOAL_THEN`(w:num->real^3) l IN V` ASSUME_TAC;


EXPAND_TAC"V"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`l:num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`];


SUBGOAL_THEN`(w:num->real^3) (SUC l) IN V` ASSUME_TAC;


EXPAND_TAC"V"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`SUC l:num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`];

SUBGOAL_THEN`(w:num->real^3) l IN ball_annulus` ASSUME_TAC;


REPLICATE_TAC (38-22)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC)
THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`))
THEN EXISTS_TAC`V:real^3->bool`
THEN ASM_REWRITE_TAC[];



SUBGOAL_THEN`(w:num->real^3) (SUC l) IN ball_annulus` ASSUME_TAC;


REPLICATE_TAC (39-22)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC)
THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`))
THEN EXISTS_TAC`V:real^3->bool`
THEN ASM_REWRITE_TAC[];


MP_TAC(REAL_ARITH`scs_a_v39 s l (l + k - 1) < dist ((w:num->real^3) l,w (l + k - 1))\/ scs_a_v39 s l (l + k - 1) >= dist (w l,w (l + k - 1))`)
THEN RESA_TAC;


SUBGOAL_THEN(`!i. ~(l MOD k = i MOD k) /\
          ~(SUC l MOD k = i MOD k)
          ==> scs_a_v39 s l i < dist ((w:num->real^3) l,(w:num->real^3) i)`)ASSUME_TAC;

GEN_TAC
THEN MP_TAC(SET_RULE`(l MOD k = SUC i' MOD k)\/ ~(l MOD k = SUC i' MOD k)`)
THEN RESA_TAC;

MRESAL_TAC Hdplygy.MOD_EQ_MOD[`l+k-1`;`i':num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`]
THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th))
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l+k-1:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l+k-1:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN ASM_REWRITE_TAC[]
;


REPLICATE_TAC (42-9)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MRESA_TAC th[`i':num`])
;






ABBREV_TAC`v2= (w:num->real^3) l`
THEN ABBREV_TAC`v1= (w:num->real^3) (SUC l)`
THEN ABBREV_TAC`x1=norm (v1:real^3) pow 2`
THEN ABBREV_TAC`x2=norm (v2:real^3) pow 2`
THEN ABBREV_TAC`x6=norm (v1-v2:real^3) pow 2`
THEN ABBREV_TAC`a= -- &1`
THEN SUBGOAL_THEN`((v2,v1):real^3#real^3) IN FF`ASSUME_TAC
;


EXPAND_TAC"FF"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`l:num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`];

MP_TAC Local_lemmas.CVLF_LF_F
THEN RESA_TAC
THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN STRIP_TAC
THEN MP_TAC NORM_POS_COLLINEAR
THEN RESA_TAC
THEN MP_TAC V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION
THEN RESA_TAC
THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_SUC
THEN RESA_TAC
THEN MP_TAC UPS_X_POS_SEG
THEN RESA_TAC
THEN ASM_TAC
THEN REPLICATE_TAC (4)(STRIP_TAC)
THEN ASM_REWRITE_TAC[]
THEN REPEAT DISCH_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC DEFORMATION_DIST_LE_BLL_V3_DEFOR_COM
THEN RESA_TAC
THEN MP_TAC V3_DEFOR_DEFORMATION_CONVEX_LOCAL_FAN_V1
THEN RESA_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`])
THEN POP_ASSUM MP_TAC
THEN MATCH_MP_TAC(SET_RULE`(B==> A==>C)==>((A==>B)==> A==>C)`)
THEN STRIP_TAC
THEN ABBREV_TAC`e1=(min (min (min (min e e') e'') e''')e'''') / &2`
THEN MP_TAC(REAL_ARITH`e1=(min (min (min (min e e') e'') e''')e'''') / &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e''''==> &0<e1/\ e1< e/\ e1<e'/\ e1<e''/\ e1<e'''/\ e1<e''''`)
THEN RESA_TAC
THEN SUBGOAL_THEN`!t. &0 < t /\ t < e1
==> BBs_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) (t) )` ASSUME_TAC;


REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT STRIP_TAC;


ASM_REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;ww_defor]
THEN REPEAT RESA_TAC
THEN MP_TAC(SET_RULE`((w:num->real^3) x' = v2)\/ ~(w x' = v2)`)
THEN RESA_TAC;


MP_TAC(REAL_ARITH`t< e1/\ e1< e==> t< e`)
THEN RESA_TAC
;

REPLICATE_TAC (80-59)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> 
REPEAT STRIP_TAC
THEN MRESA_TAC th[`t:real`])
;



ASM_REWRITE_TAC[v3_defor_v4]
;

REPLICATE_TAC (79-24)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC)
THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`))
THEN EXISTS_TAC`V:real^3->bool`
THEN ASM_REWRITE_TAC[]
THEN EXPAND_TAC"V"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`x':num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]
;


ASM_TAC
THEN REPLICATE_TAC 5 (STRIP_TAC)
THEN MP_TAC(ARITH_RULE`3< k==> ~(k<=3)`)
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;periodic;ww_defor]
THEN REPEAT RESA_TAC;


(****scs_a *****)

ASM_REWRITE_TAC[v3_defor_v4]
THEN MP_TAC(SET_RULE`(w:num->real^3) i' =w l \/ ~(w i' = w l)`)
THEN RESA_TAC;


MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`)
THEN RESA_TAC;




MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`]
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`])
THEN MRESA_TAC DIVISION[`i':num`;`k:num`]
THEN MRESA_TAC DIVISION[`j:num`;`k:num`]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th[`i' MOD k`;`j MOD k`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i' MOD k)`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]);








MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`]
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN MRESA_TAC DIVISION[`i':num`;`k:num`]
THEN MRESA_TAC DIVISION[`j:num`;`k:num`]
THEN MRESA_TAC DIVISION[`l:num`;`k:num`]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th[`i' MOD k`;`l MOD k`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE])
THEN MP_TAC(SET_RULE`j MOD k = l MOD k==> (w:num->real^3)(j MOD k)=(w:num->real^3)(l MOD k)`)
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`)
THEN RESA_TAC
;

REPLICATE_TAC (111-41) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN MP_TAC(SET_RULE`j MOD k=SUC l MOD k\/ ~(SUC l MOD k = j MOD k)`)
THEN RESA_TAC
;


REPLICATE_TAC (108-97) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN RESA_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (l  MOD k)`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC l:num`
THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC l)`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
;

REPLICATE_TAC (111-66) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) 
THEN RESA_TAC
;

REPLICATE_TAC (113-82) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC(REAL_ARITH`e1< e''/\  t< e1/\ &0<t==> --e''<t/\ t< e''`)
THEN RESA_TAC
THEN MRESA_TAC th[`t:real`])
THEN MRESAL_TAC(GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`a:real`;`x2:real`;`x6:real`;`x1:real`;`x2-t:real`;`v2:real^3`;`v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)`;`v1:real^3`;`x6:real`]
[SET_RULE`a IN{a,b}`;v3_defor_v1]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[GSYM v3_defor_v1;dist;REAL_ARITH`a<=b<=> b>=a`;NORM_GE_SQUARE]
THEN REWRITE_TAC[DOT_SQUARE_NORM;GSYM dist]
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN ASM_REWRITE_TAC[dist]
THEN RESA_TAC
THEN REWRITE_TAC[REAL_ARITH`x6>=x6`]
;

REPLICATE_TAC (111-81) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MRESA_TAC th[`t:real`;`j:num`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j)`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`l:num`)
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC;

(****scs_a SYM*****)

MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`)
THEN RESA_TAC;




MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`]
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN MRESA_TAC DIVISION[`i':num`;`k:num`]
THEN MRESA_TAC DIVISION[`j:num`;`k:num`]
THEN MRESA_TAC DIVISION[`l:num`;`k:num`]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th[`j MOD k`;`l MOD k`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i'`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE])
THEN MP_TAC(SET_RULE`i' MOD k = l MOD k==> (w:num->real^3)(i' MOD k)=(w:num->real^3)(l MOD k)`)
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`)
THEN RESA_TAC
;

REPLICATE_TAC (111-41) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN MP_TAC(SET_RULE`i' MOD k=SUC l MOD k\/ ~(SUC l MOD k = i' MOD k)`)
THEN RESA_TAC
;


REPLICATE_TAC (108-96) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN RESA_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (l  MOD k)`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC l:num`
THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC l)`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
;

REPLICATE_TAC (111-66) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`])
THEN RESA_TAC
;


REPLICATE_TAC (114-82) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC(REAL_ARITH`e1< e''/\  t< e1/\ &0<t==> --e''<t/\ t< e''`)
THEN RESA_TAC
THEN MRESA_TAC th[`t:real`])
THEN MRESAL_TAC(GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`a:real`;`x2:real`;`x6:real`;`x1:real`;`x2-t:real`;`v2:real^3`;`v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)`;`v1:real^3`;`x6:real`]
[SET_RULE`a IN{a,b}`;v3_defor_v1]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[GSYM v3_defor_v1;dist;REAL_ARITH`a<=b<=> b>=a`;NORM_GE_SQUARE]
THEN REWRITE_TAC[DOT_SQUARE_NORM;GSYM dist]
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN ASM_REWRITE_TAC[dist]
THEN RESA_TAC
THEN REWRITE_TAC[DOT_SQUARE_NORM;GSYM dist]
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN ASM_REWRITE_TAC[dist]
THEN REWRITE_TAC[REAL_ARITH`x6>=x6`]
;

REPLICATE_TAC (111-81) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MRESA_TAC th[`t:real`;`i':num`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i')`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`l:num`)
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC;


ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
;

(***LE scs_b**)



ASM_REWRITE_TAC[v3_defor_v4]
THEN MP_TAC(SET_RULE`(w:num->real^3) i' =w l \/ ~(w i' = w l)`)
THEN RESA_TAC;


MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`)
THEN RESA_TAC;



REWRITE_TAC[DIST_REFL]
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
;

REPLICATE_TAC (99-44) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MRESAL_TAC th[`i':num`;`j:num`][DIST_REFL]);




MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`]
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN MRESA_TAC DIVISION[`i':num`;`k:num`]
THEN MRESA_TAC DIVISION[`j:num`;`k:num`]
THEN MRESA_TAC DIVISION[`l:num`;`k:num`]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th[`i' MOD k`;`l MOD k`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE])
THEN MP_TAC(SET_RULE`j MOD k = l MOD k==> (w:num->real^3)(j MOD k)=(w:num->real^3)(l MOD k)`)
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'''==> t< e'''`)
THEN RESA_TAC
;


REPLICATE_TAC (111-86) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MRESAL_TAC th[`t:real`;`j:num`][DIST_REFL])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
;




(***********scs_b SYM**********)


MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`)
THEN RESA_TAC;



MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`]
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN MRESA_TAC DIVISION[`i':num`;`k:num`]
THEN MRESA_TAC DIVISION[`j:num`;`k:num`]
THEN MRESA_TAC DIVISION[`l:num`;`k:num`]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th[`j MOD k`;`l MOD k`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i'`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE])
THEN MP_TAC(SET_RULE`i' MOD k = l MOD k==> (w:num->real^3)(i' MOD k)=(w:num->real^3)(l MOD k)`)
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'''==> t< e'''`)
THEN RESA_TAC
;


REPLICATE_TAC (111-86) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MRESAL_TAC th[`t:real`;`i':num`][DIST_REFL])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i'`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN ASM_REWRITE_TAC[]
;



ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
;


(*************convex_local_fan**************)



ASM_REWRITE_TAC[]
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''/\ &0< t/\ &0< e''''==> t< e''''/\ --e''''< t`)
THEN RESA_TAC
THEN REPLICATE_TAC (78-67) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MRESA_TAC th[`t:real`;])
;




MP_TAC TAUSTAR_V3_DEFOR
THEN RESA_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`])
THEN POP_ASSUM MP_TAC
THEN ABBREV_TAC`e2= (min e1 e''''')/ &2`
THEN MP_TAC(REAL_ARITH`e2= (min e1 e''''')/ &2 /\ &0< e1/\ &0< e'''''
==> &0< e2/\ e2< e1/\ e2< e'''''`)
THEN RESA_TAC
THEN REPLICATE_TAC (80-75)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MRESA_TAC th[`e2:real`])
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MRESA_TAC th[`e2:real`])
THEN REPLICATE_TAC (81-25)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MRESA_TAC th[`(\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) e2)`])
THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC)
THEN REAL_ARITH_TAC
;

(*********************)

ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN REPLICATE_TAC (65-44)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MRESA_TAC th[`l:num`;`l+k-1`])
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC  ;



(*************CASE TWO****************)

MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l /\ ~(k<=3)`)
THEN RESA_TAC
THEN POP_ASSUM (fun th-> ASM_TAC
THEN MP_TAC th
THEN REPEAT DISCH_TAC
THEN POP_ASSUM MP_TAC)
THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`]
THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`l+k-1`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`]
THEN SUBGOAL_THEN`scs_a_v39 s l (l+k-1) = dist (w l,(w:num->real^3) (l+k-1))`
ASSUME_TAC
;


ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`l+k-1:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`l+k-1:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
;

REPLICATE_TAC (55-26) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MRESA_TAC th[`l:num`;`i:num`])
;


REPLICATE_TAC (56-44) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN REPLICATE_TAC (2) (POP_ASSUM MP_TAC)
THEN REAL_ARITH_TAC
;

ASM_REWRITE_TAC[]
;


REPLICATE_TAC (24-5)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC th
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN ASSUME_TAC th
THEN STRIP_TAC)
THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)`
THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`
THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)`
THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;]
THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`]
THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC;


REPLICATE_TAC (35-22)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC)
;

SUBGOAL_THEN`(w:num->real^3) l IN V` ASSUME_TAC;


EXPAND_TAC"V"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`l:num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`];


SUBGOAL_THEN`(w:num->real^3) (l+k-1) IN V` ASSUME_TAC;


EXPAND_TAC"V"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`l+k-1:num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`];

SUBGOAL_THEN`(w:num->real^3) l IN ball_annulus` ASSUME_TAC;


REPLICATE_TAC (38-22)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC)
THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`))
THEN EXISTS_TAC`V:real^3->bool`
THEN ASM_REWRITE_TAC[];



SUBGOAL_THEN`(w:num->real^3) (l+k-1) IN ball_annulus` ASSUME_TAC;


REPLICATE_TAC (39-22)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC)
THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`))
THEN EXISTS_TAC`V:real^3->bool`
THEN ASM_REWRITE_TAC[];


MP_TAC(REAL_ARITH`scs_a_v39 s l (SUC l) < dist ((w:num->real^3) l,w (SUC l))\/ scs_a_v39 s l (SUC l) >= dist (w l,w (SUC l))`)
THEN RESA_TAC;




SUBGOAL_THEN(`!i. ~(l MOD k = i MOD k) /\
          ~(l MOD k = SUC i MOD k)
          ==> scs_a_v39 s l i < dist ((w:num->real^3) l,(w:num->real^3) i)`)ASSUME_TAC;

GEN_TAC
THEN MP_TAC(SET_RULE`(SUC l MOD k = i' MOD k)\/ ~(SUC l MOD k = i' MOD k)`)
THEN RESA_TAC;


ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN ASM_REWRITE_TAC[]
;




REPLICATE_TAC (45-11)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MRESA_TAC th[`i':num`])
;




ASM_TAC
THEN REPLICATE_TAC (45)(RESA_TAC)
THEN STRIP_TAC;


ABBREV_TAC`v2= (w:num->real^3) l`
THEN ABBREV_TAC`v1= (w:num->real^3) (l+k-1)`
THEN ABBREV_TAC`x1=norm (v1:real^3) pow 2`
THEN ABBREV_TAC`x2=norm (v2:real^3) pow 2`
THEN ABBREV_TAC`x6=norm (v1-v2:real^3) pow 2`
THEN ABBREV_TAC`a= -- &1`
THEN SUBGOAL_THEN`((v1,v2):real^3#real^3) IN FF`ASSUME_TAC
;


EXPAND_TAC"FF"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`l+k-1:num`
THEN ASM_SIMP_TAC[SET_RULE`(a:num) IN (:num)`;EQ_W_L_IN_BBS]
THEN MP_TAC EQ_W_L_IN_BBS
THEN RESA_TAC;



MP_TAC Local_lemmas.CVLF_LF_F
THEN RESA_TAC
THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v1,v2):real^3#real^3`]
THEN MP_TAC NORM_POS_COLLINEAR
THEN RESA_TAC
THEN MP_TAC V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION
THEN RESA_TAC
THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_SUC_TWO_CASES
THEN RESA_TAC
THEN MP_TAC UPS_X_POS_SEG
THEN RESA_TAC
THEN ASM_TAC
THEN REPLICATE_TAC (4)(STRIP_TAC)
THEN ASM_REWRITE_TAC[]
THEN REPEAT DISCH_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC DEFORMATION_DIST_LE_BLL_V3_DEFOR_COM_TWO_CASES
THEN RESA_TAC
THEN MP_TAC V3_DEFOR_DEFORMATION_CONVEX_LOCAL_FAN_V1_TWO_CASES
THEN RESA_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`])
THEN POP_ASSUM MP_TAC
THEN MATCH_MP_TAC(SET_RULE`(B==> A==>C)==>((A==>B)==> A==>C)`)
THEN STRIP_TAC
THEN ABBREV_TAC`e1=(min (min (min (min e e') e'') e''')e'''') / &2`
THEN MP_TAC(REAL_ARITH`e1=(min (min (min (min e e') e'') e''')e'''') / &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e''''==> &0<e1/\ e1< e/\ e1<e'/\ e1<e''/\ e1<e'''/\ e1<e''''`)
THEN RESA_TAC
THEN SUBGOAL_THEN`!t. &0 < t /\ t < e1
==> BBs_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) (t) )` ASSUME_TAC;





REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT STRIP_TAC;


ASM_REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;ww_defor]
THEN REPEAT RESA_TAC
THEN MP_TAC(SET_RULE`((w:num->real^3) x' = v2)\/ ~(w x' = v2)`)
THEN RESA_TAC;


MP_TAC(REAL_ARITH`t< e1/\ e1< e==> t< e`)
THEN RESA_TAC
;

REPLICATE_TAC (80-59)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> 
REPEAT STRIP_TAC
THEN MRESA_TAC th[`t:real`])
;



ASM_REWRITE_TAC[v3_defor_v4]
;

REPLICATE_TAC (79-24)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MP_TAC th
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN REPEAT RESA_TAC)
THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`))
THEN EXISTS_TAC`V:real^3->bool`
THEN ASM_REWRITE_TAC[]
THEN EXPAND_TAC"V"
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`x':num`
THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]
;


ASM_TAC
THEN REPLICATE_TAC 5 (STRIP_TAC)
THEN MP_TAC(ARITH_RULE`3< k==> ~(k<=3)`)
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;periodic;ww_defor]
THEN REPEAT RESA_TAC;


(****scs_a *****)

ASM_REWRITE_TAC[v3_defor_v4]
THEN MP_TAC(SET_RULE`(w:num->real^3) i' =w l \/ ~(w i' = w l)`)
THEN RESA_TAC;


MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`)
THEN RESA_TAC;




MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`]
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`])
THEN MRESA_TAC DIVISION[`i':num`;`k:num`]
THEN MRESA_TAC DIVISION[`j:num`;`k:num`]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th[`i' MOD k`;`j MOD k`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i' MOD k)`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]);








MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`]
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN MRESA_TAC DIVISION[`i':num`;`k:num`]
THEN MRESA_TAC DIVISION[`j:num`;`k:num`]
THEN MRESA_TAC DIVISION[`l:num`;`k:num`]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th[`i' MOD k`;`l MOD k`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE])
THEN MP_TAC(SET_RULE`j MOD k = l MOD k==> (w:num->real^3)(j MOD k)=(w:num->real^3)(l MOD k)`)
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`)
THEN RESA_TAC
;

REPLICATE_TAC (111-41) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN MP_TAC(SET_RULE`SUC j MOD k= l MOD k\/ ~(l MOD k = SUC j MOD k)`)
THEN RESA_TAC
;


MRESAL_TAC Hdplygy.MOD_EQ_MOD[`j:num`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`]
;


REPLICATE_TAC (109-97) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN RESA_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (l  MOD k)`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`l+k-1:num`
THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (l+k-1)`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`] THEN  MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_ASSUM_TAC;

REPLICATE_TAC (112-66) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`l+k-1:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) 
THEN RESA_TAC
;

REPLICATE_TAC (114-82) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC(REAL_ARITH`e1< e''/\  t< e1/\ &0<t==> --e''<t/\ t< e''`)
THEN RESA_TAC
THEN MRESA_TAC th[`t:real`])
THEN MRESAL_TAC(GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`a:real`;`x2:real`;`x6:real`;`x1:real`;`x2-t:real`;`v2:real^3`;`v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)`;`v1:real^3`;`x6:real`]
[SET_RULE`a IN{a,b}`;v3_defor_v1]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[GSYM v3_defor_v1;dist;REAL_ARITH`a<=b<=> b>=a`;NORM_GE_SQUARE]
THEN REWRITE_TAC[DOT_SQUARE_NORM;GSYM dist]
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN ASM_REWRITE_TAC[dist]
THEN RESA_TAC
THEN REWRITE_TAC[REAL_ARITH`x6>=x6`]
;


REPLICATE_TAC (111-81) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MRESA_TAC th[`t:real`;`j:num`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j)`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC i:num` THEN MRESA1_TAC th`l:num`)
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC;

(****scs_a SYM*****)

MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`)
THEN RESA_TAC;




MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`]
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN MRESA_TAC DIVISION[`i':num`;`k:num`]
THEN MRESA_TAC DIVISION[`j:num`;`k:num`]
THEN MRESA_TAC DIVISION[`l:num`;`k:num`]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th[`j MOD k`;`l MOD k`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i'`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE])
THEN MP_TAC(SET_RULE`i' MOD k = l MOD k==> (w:num->real^3)(i' MOD k)=(w:num->real^3)(l MOD k)`)
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`)
THEN RESA_TAC
;

REPLICATE_TAC (111-41) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN MP_TAC(SET_RULE`SUC i' MOD k= l MOD k\/ ~(l MOD k = SUC i' MOD k)`)
THEN RESA_TAC
;

MRESAL_TAC Hdplygy.MOD_EQ_MOD[`i':num`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`]
;


REPLICATE_TAC (109-96) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN RESA_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (l  MOD k)`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`l+k-1:num`
THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (l+k-1)`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_ASSUM_TAC;

REPLICATE_TAC (112-66) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC th)
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`l+k-1:num`[ARITH_RULE`4 MOD 4=0`])
THEN RESA_TAC
;


REPLICATE_TAC (115-82) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MP_TAC(REAL_ARITH`e1< e''/\  t< e1/\ &0<t==> --e''<t/\ t< e''`)
THEN RESA_TAC
THEN MRESA_TAC th[`t:real`])
THEN MRESAL_TAC(GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`a:real`;`x2:real`;`x6:real`;`x1:real`;`x2-t:real`;`v2:real^3`;`v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)`;`v1:real^3`;`x6:real`]
[SET_RULE`a IN{a,b}`;v3_defor_v1]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[GSYM v3_defor_v1;dist;REAL_ARITH`a<=b<=> b>=a`;NORM_GE_SQUARE]
THEN REWRITE_TAC[DOT_SQUARE_NORM;GSYM dist]
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN ASM_REWRITE_TAC[dist]
THEN RESA_TAC
THEN REWRITE_TAC[DOT_SQUARE_NORM;GSYM dist]
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN ASM_REWRITE_TAC[dist]
THEN REWRITE_TAC[REAL_ARITH`x6>=x6`]
;

REPLICATE_TAC (111-81) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MRESA_TAC th[`t:real`;`i':num`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i')`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC i:num` THEN  MRESA1_TAC th`l:num`)
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC;


ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
;

(***LE scs_b**)



ASM_REWRITE_TAC[v3_defor_v4]
THEN MP_TAC(SET_RULE`(w:num->real^3) i' =w l \/ ~(w i' = w l)`)
THEN RESA_TAC;


MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`)
THEN RESA_TAC;



REWRITE_TAC[DIST_REFL]
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
;

REPLICATE_TAC (99-44) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MRESAL_TAC th[`i':num`;`j:num`][DIST_REFL]);




MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`]
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN MRESA_TAC DIVISION[`i':num`;`k:num`]
THEN MRESA_TAC DIVISION[`j:num`;`k:num`]
THEN MRESA_TAC DIVISION[`l:num`;`k:num`]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th[`i' MOD k`;`l MOD k`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE])
THEN MP_TAC(SET_RULE`j MOD k = l MOD k==> (w:num->real^3)(j MOD k)=(w:num->real^3)(l MOD k)`)
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'''==> t< e'''`)
THEN RESA_TAC
;


REPLICATE_TAC (111-86) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MRESAL_TAC th[`t:real`;`j:num`][DIST_REFL])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESA_TAC th[`SUC i`] THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
;




(***********scs_b SYM**********)


MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`)
THEN RESA_TAC;



MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`]
THEN ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]
THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN MRESA_TAC DIVISION[`i':num`;`k:num`]
THEN MRESA_TAC DIVISION[`j:num`;`k:num`]
THEN MRESA_TAC DIVISION[`l:num`;`k:num`]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th[`j MOD k`;`l MOD k`])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i'`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE])
THEN MP_TAC(SET_RULE`i' MOD k = l MOD k==> (w:num->real^3)(i' MOD k)=(w:num->real^3)(l MOD k)`)
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'''==> t< e'''`)
THEN RESA_TAC
;


REPLICATE_TAC (111-86) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MRESAL_TAC th[`t:real`;`i':num`][DIST_REFL])
THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i'`][ARITH_RULE`~(4=0)`;periodic]
THEN POP_ASSUM (fun th-> MRESA_TAC th[`SUC i`] THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`])
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN ASM_REWRITE_TAC[]
;



ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
;


(*************convex_local_fan**************)



ASM_REWRITE_TAC[]
THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''/\ &0< t/\ &0< e''''==> t< e''''/\ --e''''< t`)
THEN RESA_TAC
THEN REPLICATE_TAC (78-67) (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC
THEN MRESA_TAC th[`t:real`;])
;




MP_TAC TAUSTAR_V3_DEFOR_TWO_CASES
THEN RESA_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`])
THEN POP_ASSUM MP_TAC
THEN ABBREV_TAC`e2= (min e1 e''''')/ &2`
THEN MP_TAC(REAL_ARITH`e2= (min e1 e''''')/ &2 /\ &0< e1/\ &0< e'''''
==> &0< e2/\ e2< e1/\ e2< e'''''`)
THEN RESA_TAC
THEN REPLICATE_TAC (80-75)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MRESA_TAC th[`e2:real`])
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MRESA_TAC th[`e2:real`])
THEN REPLICATE_TAC (81-25)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MRESA_TAC th[`(\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) e2)`])
THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC)
THEN REAL_ARITH_TAC
;


ASM_TAC
THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2]
THEN REPEAT RESA_TAC
THEN REPLICATE_TAC (65-44)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MRESA_TAC th[`l:num`;`SUC l`])
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC  ;








]);;
end;; (* let check_completeness_claimA_concl = Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) *)