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


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


module Nuxcoea = 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;;
open Imjxphr;;

(**TATIC CHANGE (need Hales_tactics)**)

let MRESA_TAC th1 (th: term list) = INTRO_TAC (GEN_ALL th1) th THEN RESA_TAC;;

let MRESAL_TAC th1 (th: term list) (th2: thm list) =INTRO_TAC (GEN_ALL th1) th THEN ASM_REWRITE_TAC th2 THEN STRIP_TAC THEN ASM_REWRITE_TAC th2;;


let MRESAS_TAC th1 (th: term list) (th2: thm list) =INTRO_TAC (GEN_ALL th1) th THEN ASM_REWRITE_TAC th2 THEN STRIP_TAC THEN ASM_REWRITE_TAC th2
THEN POP_ASSUM MP_TAC
THEN ASM_SIMP_TAC th2
THEN STRIP_TAC
THEN ASM_SIMP_TAC th2
;;


let THAYTHE_TAC n (th1: term list) =
REPLICATE_TAC n (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPLICATE_TAC n DISCH_TAC
THEN MRESA_TAC th th1 );;


let THAYTHEL_TAC n (th1: term list) (th2: thm list) =
REPLICATE_TAC n (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPLICATE_TAC n DISCH_TAC
THEN MRESAL_TAC th th1 th2);;


let THAYTHES_TAC n (th1: term list) (th2: thm list) =
REPLICATE_TAC n (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPLICATE_TAC n DISCH_TAC
THEN MRESAS_TAC th th1 th2);;


let THAYTHE_ASM_TAC n (th1: term list) =
REPLICATE_TAC n (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPLICATE_TAC n DISCH_TAC
THEN MRESA_TAC th th1 
THEN ASSUME_TAC th);;




let THAYTHEL_ASM_TAC n (th1: term list) (th2: thm list) =
REPLICATE_TAC n (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPLICATE_TAC n DISCH_TAC
THEN MRESAL_TAC th th1 th2
THEN ASSUME_TAC th);;


let DICH_TAC n  =
REPLICATE_TAC n (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPLICATE_TAC n DISCH_TAC
THEN MP_TAC th );;


let MATCH_DICH_TAC n  =
REPLICATE_TAC n (POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPLICATE_TAC n DISCH_TAC
THEN MATCH_MP_TAC th );;




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

let v3_defor_v5=new_definition`  v3_defor_v5 a x1 x5 x2 v1 v2 v t= v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (v - v1) t + v1`;;
let EQ_SUC_K_SUB=
prove(`l MOD k = SUC i MOD k /\ 1<k ==> (l + k - 1) MOD k = i MOD k`,
STRIP_TAC THEN MP_TAC(ARITH_RULE`1<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l `) THEN 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`]);;
let EQ_SUC_K_SUB3=
prove(`l MOD k = SUC i MOD k /\ 3<k ==> (l + k - 1) MOD k = i MOD k`,
STRIP_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ 1+l+k-1= 1*k+l `) THEN 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`]);;
let WL_IN_V=
prove(`(w:num->real^3) l IN IMAGE w (:num)`,
REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]);;
let WL_IN_FF=
prove(`((w:num->real^3) l,w (SUC l)) IN IMAGE (\i. w i,w (SUC i)) (:num)`,
REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`l:num` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]);;
let WL_IN_BALL_ANNULUS=
prove(`BBs_v39 s w ==> w l IN ball_annulus`,
REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN STRIP_TAC THEN ASM_TAC THEN STRIP_TAC THEN REPEAT (STRIP_TAC THEN REMOVE_ASSUM_TAC) THEN MP_TAC WL_IN_V THEN STRIP_TAC THEN MP_TAC(SET_RULE`IMAGE w (:num) SUBSET ball_annulus /\ w l IN IMAGE w (:num) ==> w l IN ball_annulus`) THEN RESA_TAC);;
let NORM_LE_2_IN_BBS=
prove(`BBs_v39 s w ==> &2<= norm (w l)`,
STRIP_TAC THEN MP_TAC WL_IN_BALL_ANNULUS THEN ASM_REWRITE_TAC[IN_ELIM_THM;ball_annulus;DIFF;ball;] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist;VECTOR_ARITH`A- vec 0= A`] THEN REAL_ARITH_TAC);;
let MMS_IMP_BBS=
prove(`MMs_v39 s w==> BBs_v39 s w`,
REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN RESA_TAC);;
let MMS_IMP_BBPRIME=
prove(`MMs_v39 s w==> BBprime_v39 s w`,
REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN RESA_TAC);;
let MMS_IMP_BBPRIME2=
prove(`MMs_v39 s w==> BBprime2_v39 s w`,
REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN RESA_TAC);;
let NORM_LE_2_IN_MMS=
prove(`MMs_v39 s w ==> &2<= norm (w l)`,
STRIP_TAC THEN MP_TAC MMS_IMP_BBS THEN ASM_REWRITE_TAC[NORM_LE_2_IN_BBS]) ;;
let CHANGE_A_SCS_MODL=
prove(`is_scs_v39 s /\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) ==> scs_a_v39 s j l =scs_a_v39 s j1 l`,
REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s= 0)`) THEN 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-> MRESA_TAC th[`j:num`] THEN MRESA_TAC th[`j1:num`]));;
let CHANGE_A_SCS_MODR=
prove(`is_scs_v39 s /\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) ==> scs_a_v39 s l j =scs_a_v39 s l j1`,
REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s= 0)`) THEN 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-> MRESA_TAC th[`j:num`] THEN MRESA_TAC th[`j1:num`]));;
let CHANGE_A_SCS_MOD=
prove(`is_scs_v39 s /\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) /\ l MOD (scs_k_v39 s) = l1 MOD (scs_k_v39 s) ==> scs_a_v39 s l j =scs_a_v39 s l1 j1`,
STRIP_TAC THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MODR)[`j:num`;`s:scs_v39`;`l:num`;`j1:num`] THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MODL)[`l1:num`;`s:scs_v39`;`l:num`;`j1:num`]) ;;
let CHANGE_B_SCS_MODL=
prove(`is_scs_v39 s /\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) ==> scs_b_v39 s j l =scs_b_v39 s j1 l`,
REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s= 0)`) THEN RESA_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-> MRESA_TAC th[`j:num`] THEN MRESA_TAC th[`j1:num`]));;
let CHANGE_B_SCS_MODR=
prove(`is_scs_v39 s /\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) ==> scs_b_v39 s l j =scs_b_v39 s l j1`,
REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s= 0)`) THEN RESA_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-> MRESA_TAC th[`j:num`] THEN MRESA_TAC th[`j1:num`]));;
let CHANGE_B_SCS_MOD=
prove(`is_scs_v39 s /\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) /\ l MOD (scs_k_v39 s) = l1 MOD (scs_k_v39 s) ==> scs_b_v39 s l j =scs_b_v39 s l1 j1`,
STRIP_TAC THEN MRESA_TAC( GEN_ALL CHANGE_B_SCS_MODR)[`j:num`;`s:scs_v39`;`l:num`;`j1:num`] THEN MRESA_TAC( GEN_ALL CHANGE_B_SCS_MODL)[`l1:num`;`s:scs_v39`;`l:num`;`j1:num`]) ;;
let CHANGE_W_IN_BBS_MOD_LE3=
prove(`3<= scs_k_v39 s /\ BBs_v39 s w /\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) ==> (w:num->real^3) j= (w:num->real^3) j1`,
REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s= 0)`) THEN RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM(fun th-> MRESA_TAC th[`j:num`] THEN MRESA_TAC th[`j1:num`]));;
let CHANGE_W_IN_BBS_MOD_IS_SCS=
prove(`is_scs_v39 s /\ BBs_v39 s w /\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) ==> (w:num->real^3) j= (w:num->real^3) j1`,
REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] THEN REPEAT RESA_TAC THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s= 0)`) THEN RESA_TAC THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;periodic] THEN POP_ASSUM(fun th-> MRESA_TAC th[`j:num`] THEN MRESA_TAC th[`j1:num`]));;
let EXPAND_PERIODIC=
prove( `BBs_v39 s w ==> w (l + scs_k_v39 s)= w l`,
REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic] THEN RESA_TAC);;
let COLLINEAR_EQ_SUB=
prove(`collinear {vec 0, v1, v1 - v2:real^3} <=> collinear {vec 0, v1, v2}`,
ASM_REWRITE_TAC[GSYM CROSS_EQ_0;VECTOR_ARITH`A-B=A+(--B):real^3`;CROSS_RADD;CROSS_RNEG;CROSS_REFL] THEN VECTOR_ARITH_TAC);;
let COLLINEAR_EQ_SUB_NEG=
prove(`collinear {vec 0, -- v1, v2 - v1:real^3} <=> collinear {vec 0, v1, v2}`,
ASM_REWRITE_TAC[GSYM CROSS_EQ_0;VECTOR_ARITH`A-B=A+(--B):real^3`;CROSS_RADD;CROSS_RNEG;CROSS_REFL;CROSS_LNEG] THEN VECTOR_ARITH_TAC);;
let DEFORMATION_MK_DEFOR_IN_BALL_ANNULUS=
prove(`&0< x1 /\ &0<x2 /\ &0< x5 /\ norm v2= &2 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 ==> ?e. &0< e/\ (!t. --e<t/\ t< e==> (v3_defor_v4 a x1 x5 x2 (-- v1) (v2-v1) (v2-v1) t) +v1 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 ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v2:real^3`] THEN MRESAL_TAC(GEN_ALL UPS_X_POS_SEG)[`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x2:real`;`x5:real`][COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[v3_defor_v4;] THEN GEN_TAC THEN POP_ASSUM(fun th-> STRIP_TAC THEN MRESA_TAC th[`t:real`]) THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`-- &1`;`x5:real`;`x2:real`;`x1:real`;`x5-t:real`;`v2-v1:real^3`;`v3_defor_v1 (-- &1) (-- v1) (v2-v1:real^3) x1 x5 x2 x2 (x5 - t)`;`-- v1:real^3`;`x2:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3/\ a- -- b=a+b`;NORM_NEG] THEN ASM_REWRITE_TAC[NORM_LE_SQUARE;DOT_SQUARE_NORM] THEN REWRITE_TAC[REAL_ARITH`a<=b<=> b>=a`] THEN ASM_REWRITE_TAC[NORM_GE_SQUARE;DOT_SQUARE_NORM;REAL_ARITH`(&2 <= &0 \/ x2 >= x2)`;h0] THEN REMOVE_ASSUM_TAC THEN EXPAND_TAC"x2" THEN REAL_ARITH_TAC);;
let EYYPQDW_CONTINUOUS_LIFT_DIST_ADD=
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+w,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 +w,v))= (lift o (\x. dist(x,v))) o(\x3. v3_defor_v1 a v1 v2 x1 x2 x5 x6 x3+w)`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 RESA_TAC THEN RESA_TAC THENL[ MATCH_MP_TAC CONTINUOUS_ADD THEN ASM_SIMP_TAC[CONTINUOUS_CONST;lemma30000]; 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_ADD=
prove(`&0< x1 /\ &0<x2 /\ &0< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a = -- &1 /\ c< dist(v2,w) ==> ?e. &0< e /\ (!t. --e<t /\ t<e ==> c<dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w))`,
STRIP_TAC THEN MRESAL_TAC(GEN_ALL UPS_X_POS_SEG)[`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x2:real`;`x5:real`][COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] 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`;`x2:real`;`x5:real`;`v2-v1:real^3`][REAL_ARITH`(--a< &0<=> &0<a)/\ a- &0=a`;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] 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_ADD)[`x2:real`;`a:real`;`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x5:real`;`x2:real`;`x2:real`;`v1:real^3`;`w:real^3`;`x5:real`][SET_RULE`A IN {A, B}`;continuous_atreal;DIST_LIFT;o_DEF;GSYM REAL_ABS_BETWEEN;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] 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[`x5-t:real`][REAL_ARITH`x2 - d < x2 - t /\ x2 - t < x2 + d <=> --d<t/\ t<d`;VECTOR_ARITH`a-b+b=a:real^3`]) THEN ASM_TAC THEN REAL_ARITH_TAC);;
let DEFORMATION_DIST_LE_MK_A=
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(v2-v1) pow 2=x5/\ 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. --e < t/\ t< e ==> scs_a_v39 s l i < dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i)))`,
STRIP_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST_ADD 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_MK=
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(v2-v1) pow 2=x5/\ 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. --e< 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 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i))`,
[ REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_DIST_LE_MK_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) /\ ~(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 MRESAL_TAC REAL_LE_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i 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 /\ ~(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 POP_ASSUM MP_TAC THEN MP_TAC(REAL_ARITH`t < e1/\ e1<= e (i MOD k)/\ &0 < e (i MOD k)/\ --e1<t ==> t < e (i MOD k)/\ -- e (i MOD k)< t`) THEN 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] 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 EXISTS_SMALL_LT_CONST_ADD=
prove(`&0< x1 /\ &0<x2 /\ &0< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a = -- &1 /\ dist(v2,w)<c ==> ?e. &0< e /\ (!t. --e <t /\ t<e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w)<c)`,
STRIP_TAC THEN MRESAL_TAC(GEN_ALL UPS_X_POS_SEG)[`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x2:real`;`x5:real`][COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] 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`;`x2:real`;`x5:real`;`v2-v1:real^3`][REAL_ARITH`(--a< &0<=> &0<a)/\ a- &0=a`;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] 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_ADD)[`x2:real`;`a:real`;`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x5:real`;`x2:real`;`x2:real`;`v1:real^3`;`w:real^3`;`x5:real`][SET_RULE`A IN {A, B}`;continuous_atreal;DIST_LIFT;o_DEF;GSYM REAL_ABS_BETWEEN;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] 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[`x5-t:real`][REAL_ARITH`x2 - d < x2 - t /\ x2 - t < x2 + d <=> --d<t/\ t<d`;VECTOR_ARITH`a-b+b=a:real^3`]) THEN ASM_TAC THEN REAL_ARITH_TAC);;
let DEFORMATION_DIST_LE_V3_DEFOR_B_MK=
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(v2-v1) pow 2=x5/\ 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. --e< t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i)<scs_b_v39 s l i)) `,
[STRIP_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LT_CONST_ADD 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 V3_DEFOR_IN_AFF_GT_V1_MK=
prove(`&0< x1 /\ &0<x2 /\ &0< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ 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 - v1) x1 x5 x2 x2 (x5 - t) + v1 IN aff_gt {vec 0} {v1,w})`,
STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC(GEN_ALL UPS_X_POS_SEG)[`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x2:real`;`x5:real`][COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] THEN POP_ASSUM (fun th-> MRESAL_TAC th[`&0`][REAL_ARITH`(--a< &0<=> &0<a)/\ 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_ADD)[`a:real`;`v2:real^3`;` x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`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`;`x5:real`;`x2:real`;`x1:real`;`x5-t:real`;`x2:real`;`v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t)`;`a:real`;`--v1:real^3`;`v2-v1:real^3`][SET_RULE`a IN {a,b}`;GSYM v3_defor_v1;DOT_CROSS_SELF;DOT_LMUL;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG;CROSS_LADD;CROSS_LNEG;CROSS_RNEG;VECTOR_ARITH`--A=B<=> A= --B:real^3`;CROSS_REFL] THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[VECTOR_ARITH`A-B=A+ --B:real^3`;CROSS_RADD;CROSS_RNEG;CROSS_REFL;VECTOR_ARITH`A+ -- vec 0=A`;DOT_CROSS_SELF;DOT_LMUL;DOT_LNEG] THEN REAL_ARITH_TAC);;
let V3_DEFOR_INCREASING_IN_ANGLE=
prove(`&0< x1 /\ &0<x2 /\ &0< x5 /\ ~(collinear{vec 0,v1,w:real^3})/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a = -- &1 /\ v2 IN aff_gt {vec 0} {v1, w} ==> ?e. &0< e /\ (!t. &0<t /\ t<e ==> dist(v2,w)<dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w))`,
STRIP_TAC THEN MRESAL_TAC(GEN_ALL UPS_X_POS_SEG)[`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x2:real`;`x5:real`][COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] 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`;`x2:real`;`x5:real`;`v2-v1:real^3`][REAL_ARITH`(--a< &0<=> &0<a)/\ a- &0=a`;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] THEN MP_TAC V3_DEFOR_IN_AFF_GT_V1_MK 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 GEN_TAC THEN REPLICATE_TAC (19-12) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0<t/\ t<e1/\ e1<e ==> --e<t/\ t<e`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN REPLICATE_TAC (24-14) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0<t/\ t<e1/\ e1<e' ==> --e'<t/\ t<e'`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN ABBREV_TAC`v=v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t)` THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v2:real^3`] THEN MP_TAC(SET_RULE`DISJOINT {vec 0, v2} {v1} ==> ~(v1=v2:real^3)`) THEN RESA_TAC THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`-- &1`;`x5:real`;`x2:real`;`x1:real`;`x5-t:real`;`v2-v1:real^3`;`v3_defor_v1 (-- &1) (-- v1) (v2-v1:real^3) x1 x5 x2 x2 (x5 - t)`;`-- v1:real^3`;`x2:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3/\ a- -- b=a+b`;NORM_NEG] THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORMV3)[`x2:real`;`-- &1`;`x5:real`;`x2:real`;`x1:real`;`x2:real`;`--v1:real^3`;`v2-v1:real^3`;`v3_defor_v1 (-- &1) (-- v1) (v2-v1:real^3) x1 x5 x2 x2 (x5 - t)`;`x5-t:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3/\ a- -- b=a+b`;NORM_NEG] THEN MRESAL_TAC xrr_increasing[`norm(v1:real^3)`;`norm(v2:real^3)`;`norm(v:real^3)`;`norm(v2-v1:real^3)`][NORM_POS_LT;NORM_POS_LE;NORM_LT_SQUARE;DOT_SQUARE_NORM;REAL_ARITH`a-b<a<=> &0<b`;VECTOR_ARITH`a-b= vec 0<=> a=b: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 DOT_NORM_SUB[`v2:real^3`;`v1: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 MP_TAC THEN ONCE_REWRITE_TAC[DOT_SYM] THEN ASM_REWRITE_TAC[VECTOR_ARITH`A- vec 0=A`;real_div;REAL_INV_MUL;REAL_ARITH`(x1 + x2) - x6= x2+x1-x6/\ (a*b)*c=a*b*c`] THEN STRIP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) THEN MRESA_TAC (GEN_ALL Planarity.properties_of_collinear4_points_fan) [`vec 0:real^3`;`v1:real^3`;`w:real^3`;`v+v1:real^3`] THEN MRESA_TAC th3[`vec 0:real^3`;`v+v1:real^3`;`v1:real^3`] THEN MRESAL_TAC DOT_NORM_SUB[`v+v1:real^3`;`v1:real^3`][VECTOR_ARITH`(a+b)-b=a:real^3`] THEN MRESAL_TAC COS_ANGLE[`v1:real^3`;`vec 0:real^3`;`v+v1: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 MP_TAC THEN ONCE_REWRITE_TAC[DOT_SYM] THEN ASM_REWRITE_TAC[VECTOR_ARITH`A- vec 0=A`;real_div;REAL_INV_MUL;REAL_ARITH`(x1 + x2) - x6= x2+x1-x6/\ (a*b)*c=a*b*c`] THEN SUBGOAL_THEN`norm(v+v1:real^3)= norm (v2:real^3)`ASSUME_TAC THENL[ ASM_REWRITE_TAC[NORM_EQ_SQUARE;NORM_POS_LE;NORM_LT_SQUARE;DOT_SQUARE_NORM] ; ASM_REWRITE_TAC[] THEN STRIP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) THEN MRESAL_TAC COS_MONO_LT_EQ[`angle (v1,vec 0,v2:real^3)`;`angle (v1,vec 0,v+v1:real^3)`][ANGLE_RANGE] THEN MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, w}/\ v+v1 IN aff_gt {vec 0} {v1, w} /\ aff_gt {vec 0} {v1,w} SUBSET aff_ge {vec 0} {v1,w}==> v2 IN aff_ge {vec 0} {v1, w}/\ v+v1 IN aff_ge {vec 0} {v1, w: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`;`w:real^3`] THEN MRESA_TAC Polar_fan.ANGLES_ADD_AFF_GE [`vec 0:real^3`;`v1:real^3`;`w:real^3`;`v2:real^3`] THEN MRESA_TAC Polar_fan.ANGLES_ADD_AFF_GE [`vec 0:real^3`;`v1:real^3`;`w:real^3`;`v+v1:real^3`] THEN STRIP_TAC THEN MP_TAC(REAL_ARITH`angle (v1,vec 0,v+v1) < angle (v1,vec 0,v2) /\ angle (v1,vec 0,v2) + angle (v2,vec 0,w) = angle (v1,vec 0,w) /\ angle (v1,vec 0,v+v1) + angle (v+v1,vec 0,w) = angle (v1,vec 0,w) ==> angle (v2,vec 0,w) <angle (v+v1,vec 0,w:real^3)`) THEN RESA_TAC THEN MRESAL_TAC COS_MONO_LT_EQ[`angle (v+v1,vec 0,w:real^3)`;`angle (v2,vec 0,w:real^3)`][ANGLE_RANGE] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[ANGLE_SYM] THEN MRESAL_TAC COS_ANGLE[`w: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 MRESAL_TAC COS_ANGLE[`w:real^3`;`vec 0:real^3`;`v+v1: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 MRESA_TAC DOT_NORM_SUB[`w:real^3`;`v2:real^3`] THEN MRESAL_TAC DOT_NORM_SUB[`w:real^3`;`v+v1:real^3`][GSYM dist] THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`v2:real^3`;`vec 0:real^3`][VECTOR_ARITH`A- vec 0=A:real^3`] THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`w:real^3`;`vec 0:real^3`][VECTOR_ARITH`A- vec 0=A:real^3`] THEN ASM_SIMP_TAC[REAL_LT_RMUL_EQ;REAL_ARITH`a*b*c=(a*b)*c`] THEN STRIP_TAC THEN ONCE_REWRITE_TAC[DIST_SYM] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`(a-b)/ &2< (a-c)/ &2<=> c<b`;dist] THEN STRIP_TAC THEN ASM_REWRITE_TAC[NORM_POS_LE;NORM_LT_SQUARE;DOT_SQUARE_NORM] THEN MRESA_TAC (GEN_ALL Planarity.properties_of_collinear4_points_fan) [`vec 0:real^3`;`w:real^3`;`v1:real^3`;`v+v1: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`{B,C}={C,B}`] THEN RESA_TAC THEN MRESA_TAC th3[`w:real^3`;`v+v1:real^3`;`vec 0:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,B,A}`] THEN RESA_TAC THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`w:real^3`;`v+v1:real^3`][VECTOR_ARITH`A- vec 0=A:real^3`]]);;
let DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK1=
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(v2-v1) pow 2=x5/\ a= -- &1/\ ~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)} /\ (SUC l MOD k = j MOD k) /\ scs_a_v39 s l j = dist (v2,w j) ==> ?e. &0< e/\ (!t. &0 < t/\ t< e ==> scs_a_v39 s l j < dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w j))`,
STRIP_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN MATCH_MP_TAC V3_DEFOR_INCREASING_IN_ANGLE THEN ASM_REWRITE_TAC[] THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`SUC l`] 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[]);;
let  DEFORMATION_DIST_LE_V3_DEFOR_AA_COM_MK=
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(v2-v1) pow 2=x5/\ a= -- &1/\ ~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)} /\ (SUC l MOD k = j MOD k) /\ scs_a_v39 s l j = dist (v2,w j)/\ (!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) ==> scs_a_v39 s l i < dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i))`,
STRIP_TAC THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK THEN RESA_TAC THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK1 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(SET_RULE`(SUC l MOD k = i MOD k)\/ ~(SUC l MOD k = i MOD k)`) THEN RESA_TAC THENL[ MP_TAC(REAL_ARITH`t<e1/\ e1<e'==> t< e'`) THEN RESA_TAC THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`i:num`] THEN THAYTHE_TAC (29-18) [`t:real`] THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`l:num`;`j:num`;`s:scs_v39`;`l:num`;`i:num`] THEN SYM_ASSUM_TAC THEN ASM_REWRITE_TAC[]; MP_TAC(REAL_ARITH`t<e1/\ e1<e/\ &0<t==> t< e/\ --e< t`) THEN RESA_TAC THEN THAYTHE_TAC (28-16) [`t:real`;`i:num`]]);;
let EYYPQDW_V3_DEFOR_INCREASING_IN_ANGLE=
prove(`&0< x1 /\ &0<x2 /\ &0< x5 /\ ~(collinear{vec 0,v1,w:real^3})/\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a = -- &1 /\ v2 IN aff_gt {vec 0} {v1, w} ==> ?e. &0< e /\ (!t. &0<t /\ t<e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,v1)< dist(v2,v1))`,
STRIP_TAC THEN MRESAL_TAC(GEN_ALL UPS_X_POS_SEG)[`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x2:real`;`x5:real`][COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] 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`;`x2:real`;`x5:real`;`v2-v1:real^3`][REAL_ARITH`(--a< &0<=> &0<a)/\ a- &0=a`;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] THEN MP_TAC V3_DEFOR_IN_AFF_GT_V1_MK 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 GEN_TAC THEN REPLICATE_TAC (19-12) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0<t/\ t<e1/\ e1<e ==> --e<t/\ t<e`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN REPLICATE_TAC (24-14) (POP_ASSUM MP_TAC) THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0<t/\ t<e1/\ e1<e' ==> --e'<t/\ t<e'`) THEN RESA_TAC THEN MRESA_TAC th[`t:real`]) THEN ABBREV_TAC`v=v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t)` THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v2:real^3`] THEN MP_TAC(SET_RULE`DISJOINT {vec 0, v2} {v1} ==> ~(v1=v2:real^3)`) THEN RESA_TAC THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`-- &1`;`x5:real`;`x2:real`;`x1:real`;`x5-t:real`;`v2-v1:real^3`;`v3_defor_v1 (-- &1) (-- v1) (v2-v1:real^3) x1 x5 x2 x2 (x5 - t)`;`-- v1:real^3`;`x2:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3/\ a- -- b=a+b`;NORM_NEG] THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORMV3)[`x2:real`;`-- &1`;`x5:real`;`x2:real`;`x1:real`;`x2:real`;`--v1:real^3`;`v2-v1:real^3`;`v3_defor_v1 (-- &1) (-- v1) (v2-v1:real^3) x1 x5 x2 x2 (x5 - t)`;`x5-t:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3/\ a- -- b=a+b`;NORM_NEG;dist;VECTOR_ARITH`(a+b)-b=a:real^3`;NORM_POS_LE;NORM_LT_SQUARE;DOT_SQUARE_NORM;REAL_ARITH`a-b<a<=> &0<b`] THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`v2:real^3`;`v1:real^3`][VECTOR_ARITH`A- vec 0=A:real^3`]);;
let DEFORMATION_DIST_LE_V3_DEFOR_EDGE_SUB=
prove(` 3<k /\ is_scs_v39 s /\ MMs_v39 s w /\ scs_k_v39 s =k/\ w l=v2/\ w (l+k-1) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5/\ a= -- &1/\ ~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)} ==> (!j. (l MOD k = SUC j MOD k) ==> ?e. &0< e/\ (!t. &0 < t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w j)<scs_b_v39 s l j))`,
STRIP_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM]THEN MRESA_TAC (GEN_ALL EYYPQDW_V3_DEFOR_INCREASING_IN_ANGLE) [`(w:num->real^3)(SUC l)`;`a:real`;`x1:real`;`x2:real`;`x5:real`;`v2:real^3`;`v1: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`{B,C}={C,B}`] THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN THAYTHE_TAC (20-18)[`t:real`] THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MRESA_TAC(GEN_ALL EQ_SUC_K_SUB3)[`l:num`;`j:num`;`k:num`] THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`l+k-1:num`] THEN MRESA_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`l:num`;`j:num`;`s:scs_v39`;`l:num`;`l+k-1:num`] 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 THAYTHE_TAC (59-29)[`l:num`;`l+k-1`] THEN DICH_TAC (60-55) THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);;
let DIST_V3_DEFOR_EDGE_SUC=
prove(` 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(v2-v1) pow 2=x5/\ a= -- &1 /\ (SUC l MOD k = j MOD k) /\ dist (v2,w j)< scs_b_v39 s l j ==> ?e. &0< e/\ (!t. --e< t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w j)<scs_b_v39 s l j) `,
STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LT_CONST_ADD THEN ASM_REWRITE_TAC[] THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REPEAT STRIP_TAC);;
let DEFORMATION_DIST_LE_V3_DEFOR_B_COM_MK1=
prove(` 3<k /\ is_scs_v39 s /\ MMs_v39 s w /\ scs_k_v39 s =k/\ w l=v2/\ w (l+k-1) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5/\ a= -- &1/\ ~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)} /\ (SUC l MOD k = j MOD k) /\ dist (v2,w j) < scs_b_v39 s l j /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) ==> (!i. ~(l MOD k = i MOD k)==> ?e. &0< e/\ (!t. &0< t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i)<scs_b_v39 s l i))`,
STRIP_TAC THEN MP_TAC DIST_V3_DEFOR_EDGE_SUC THEN RESA_TAC THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_EDGE_SUB 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 MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_B_MK 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 REPEAT STRIP_TAC THEN MP_TAC(SET_RULE`(SUC l MOD k = i MOD k)\/ ~(SUC l MOD k = i MOD k)`) THEN RESA_TAC THENL[ EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0< t/\ t< e==> --e< t`) THEN RESA_TAC THEN THAYTHE_TAC (23-16)[`t:real`] THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`i:num`;`w:num->real^3`;`j:num`] THEN MRESA_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`l:num`;`i:num`;`s:scs_v39`;`l:num`;`j:num`]; MP_TAC(SET_RULE`(l MOD k = SUC i MOD k)\/ ~(l MOD k =SUC i MOD k)`) THEN RESA_TAC THENL[ THAYTHE_TAC (21-17)[`i:num`] THEN EXISTS_TAC`(e':num->real) i` THEN ASM_REWRITE_TAC[]; THAYTHEL_TAC (21-18)[`i:num`] [scs_diag] THEN EXISTS_TAC`(e'':num->real) i` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MATCH_DICH_TAC 2 THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]);;
let DEFORMATION_DIST_LE_V3_DEFOR_B_COM_MK=
prove_by_refinement(` 3<k /\ is_scs_v39 s /\ MMs_v39 s w /\ scs_k_v39 s =k/\ w l=v2/\ w (l+k-1) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5/\ a= -- &1/\ ~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)} /\ (SUC l MOD k = j MOD k) /\ dist (v2,w j) < scs_b_v39 s l j /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) ==> ?e. &0< e/\ (!t i. &0< t/\ t< e /\ ~(l MOD k = i MOD k) ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i)<scs_b_v39 s l i)`,
[ REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_B_COM_MK1 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_V3_DEFOR_NOT_IN_V_MK=
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(v2-v1) pow 2=x5/\ 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 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i))))`,
REPEAT STRIP_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST_ADD THEN ASM_REWRITE_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_MK=
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(v2-v1) pow 2=x5/\ 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 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i))`,
[ REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_MK 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_MK=
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(v2-v1) pow 2=x5/\ a= -- &1 ==> ?e. &0< e /\ (!t i. -- e<t /\ t<e/\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i))`,
STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_MK 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_MK=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t,a IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF <=> v2,a 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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] 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;VECTOR_ARITH`a-b+b=a:real^3`]); POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN RESA_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] THEN REPEAT RESA_TAC THEN DICH_TAC 3 THEN EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN 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] 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 DICH_TAC (69-62) THEN RESA_TAC THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN MP_TAC(SET_RULE`x' MOD k= l MOD k\/ ~(x' MOD k= l MOD k)`) THEN RESA_TAC; REPEAT RESA_TAC; REPEAT RESA_TAC THEN THAYTHE_TAC (70-34)[`t:real`;`x':num`] THEN DICH_TAC (70-61) THEN RESA_TAC THEN DICH_TAC 1 THEN ASM_REWRITE_TAC[]; EXISTS_TAC`v2:real^3,a':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,a'):real^3#real^3`] THEN VECTOR_ARITH_TAC;]);;
let V3_DEFOR_EQ_IN_FF_MK_SYM=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=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, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF <=> a, 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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] 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;VECTOR_ARITH`a-b+b=a:real^3`]); POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN RESA_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] THEN REPEAT RESA_TAC THEN DICH_TAC 3 THEN EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN 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] 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 DICH_TAC (69-62) THEN RESA_TAC THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN MP_TAC(SET_RULE`SUC x' MOD k= l MOD k\/ ~(SUC x' MOD k= l MOD k)`) THEN RESA_TAC; REPEAT RESA_TAC; REPEAT RESA_TAC THEN THAYTHE_TAC (70-34)[`t:real`;`SUC x':num`]; EXISTS_TAC`a':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`;`(a',v2):real^3#real^3`] THEN VECTOR_ARITH_TAC]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_MK=
prove_by_refinement(`scs_k_v39 s = k /\ 3 < 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)} /\ j MOD k = SUC l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V ==> (?e. &0 < e /\ (!t. --e < t /\ t < e ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t) (rho_node1 (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t)) (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 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_MK THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5: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 ASM_REWRITE_TAC[] THEN STRIP_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_MK_SYM THEN RESA_TAC THEN REWRITE_TAC[rho_node1] THEN MP_TAC V3_DEFOR_EQ_IN_FF_MK THEN RESA_TAC THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4] THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ SUC(l+k-1)= l+k /\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN MP_TAC WL_IN_FF THEN 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 (50-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;BBs_v39;periodic;BBprime_v39;] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN 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)`;`v2:real^3`;`(w:num->real^3)(SUC l)`] 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 DICH_TAC (55-4) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e' /\ --e1<t ==> t< e'/\ --e'<t`) THEN RESA_TAC THEN THAYTHE_TAC (57-27)[`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)`;`(w:num->real^3)(l+k-1)`] 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_SUB_MK=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (@a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t,a IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) = v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1`,
[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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA THEN STRIP_TAC; EXISTS_TAC`v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1` THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`v1:real^3,v2:real^3` THEN ASM_REWRITE_TAC[] THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`]; GEN_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(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; DICH_TAC (45-42) THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN MRESAL_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`;`(v1,v2):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] THEN MP_TAC Imjxphr.MOD_ADD_SUB_1 THEN RESA_TAC THEN THAYTHE_TAC(48-15)[`t:real`;`l+k-1`]; DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN MRESAL_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`;`(v1,v2):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] THEN STRIP_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`v1,a' 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)`;`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)`;`a':real^3`;]]);;
let V3_DEFOR_EQ_IN_FF_SUB_MK_SYM=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=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, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF <=> a, v1 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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] 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 DICH_TAC 2 THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN MRESAL_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`;`(v1,v2):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] THEN MP_TAC Imjxphr.MOD_ADD_SUB_1 THEN RESA_TAC THEN THAYTHE_TAC(48-15)[`t:real`;`l+k-1`]; MP_TAC(SET_RULE`v2=FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; DICH_TAC (2) THEN ASM_REWRITE_TAC[] THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN MRESAL_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`;`(v1,v2):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] THEN STRIP_TAC THEN SUBGOAL_THEN`v2,v1 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)`;`v1:real^3`;`FST (x:real^3#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 POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) 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)`]); DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[] THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN MRESAL_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`;`(v1,v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN REPEAT RESA_TAC; EXISTS_TAC`a':real^3,v1:real^3` THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) THEN RESA_TAC; STRIP_TAC THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`]; 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)`;`v2:real^3`;`v1:real^3`;] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) 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[`v1:real^3`]); REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);;
let DEFORMATION_AZIM_V3_DEFOR_SUB_MK=
prove_by_refinement(`scs_k_v39 s = k /\ 3 < 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)} /\ j MOD k = SUC l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V ==> (?e. &0 < e /\ (!t. --e < t /\ t < e ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t) (rho_node1 (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t)) (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 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_MK THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5: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 ASM_REWRITE_TAC[] THEN STRIP_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_SUB_MK_SYM THEN RESA_TAC THEN REWRITE_TAC[rho_node1] THEN MP_TAC V3_DEFOR_EQ_IN_FF_SUB_MK THEN RESA_TAC THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ SUC(l+k-1)= l+k /\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN MP_TAC WL_IN_FF THEN 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 (50-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;BBs_v39;periodic;BBprime_v39;] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MRESAL_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`;`(v1,v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN ASM_REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`] THEN 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)`;`v2:real^3`;`(w:num->real^3)(SUC l)`] 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 MP_TAC(REAL_ARITH`t<e1 /\ e1< e' /\ --e1<t ==> t< e'/\ --e'<t`) THEN RESA_TAC THEN THAYTHE_TAC (57-27)[`t:real`] 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 ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] 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`{C,A,B}={C,B,A}`] THEN ASM_REWRITE_TAC[] THEN RESA_TAC 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)`;`v1:real^3`;`v2:real^3`] THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT THEN STRIP_TAC THEN ASM_REWRITE_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]; ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] THEN ASM_REWRITE_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[]]);;
let V3_DEFOR_EQ_IN_FF_SUC_MK=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (SUC l)) t,a IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF <=> w(SUC l),a 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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`v2=SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT THEN RESA_TAC THEN DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[] THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] THEN MRESAL_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(SUC l)):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN STRIP_TAC THEN SUBGOAL_THEN`w(SUC l),v2 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)`;`SND (x:real^3#real^3)`;`(w:num->real^3)(SUC l)`] 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)(SUC l)`;`v2:real^3`;] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`SND (x:real^3#real^3),(w:num->real^3)(SUC l)`;`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)`]); MP_TAC(SET_RULE`v2=FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[] THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] THEN MRESAL_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(SUC l)):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`l:num`]) THEN THAYTHE_TAC (46-15)[`t:real`;`SUC l`]; DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[] THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] THEN MRESAL_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(SUC l)):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN STRIP_TAC THEN DICH_TAC 1 THEN ASM_REWRITE_TAC[]; EXISTS_TAC`w (SUC l):real^3,a':real^3` THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) THEN RESA_TAC; STRIP_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`]; 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 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)(SUC l)`;`v2:real^3`;] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) 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)(SUC l)`;`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[`v2:real^3`]); REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);;
let V3_DEFOR_EQ_IN_FF_SUC_MK_SYM=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=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, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (SUC l)) t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF ) = v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1`,
[ 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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA THEN STRIP_TAC; EXISTS_TAC`v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1` 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 MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`]; GEN_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(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; DICH_TAC (45-43) THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] THEN MRESAL_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(SUC l)):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ THEN RESA_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`l:num`]) THEN THAYTHE_TAC (47-15)[`t:real`;`SUC l`]; DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] THEN MRESAL_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(SUC l)):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN STRIP_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`a',w(SUC l) IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_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)`;`(w:num->real^3)(SUC l)`;`v2:real^3`] 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)`;`(w:num->real^3)(SUC l)`;`a':real^3`]]);;
let DEFORMATION_AZIM_V3_DEFOR_SUC_MK=
prove_by_refinement(`scs_k_v39 s = k /\ 3 < 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)} /\ j MOD k = SUC l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V ==> (?e. &0 < e /\ (!t. --e < t /\ t < e ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (SUC l)) t) (rho_node1 (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (SUC l)) t)) (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (SUC l)) t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 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_MK THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5: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 ASM_REWRITE_TAC[] THEN STRIP_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_SUC_MK_SYM THEN RESA_TAC THEN REWRITE_TAC[rho_node1] THEN MP_TAC V3_DEFOR_EQ_IN_FF_SUC_MK THEN RESA_TAC THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ SUC(l+k-1)= l+k /\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN MP_TAC WL_IN_FF THEN 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 (50-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;BBs_v39;periodic;BBprime_v39;] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MRESAL_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(SUC l)):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN ASM_REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`] THEN 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)`;`v2:real^3`;`(w:num->real^3)(SUC l)`] 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 MP_TAC(REAL_ARITH`t<e1 /\ e1< e' /\ --e1<t ==> t< e'/\ --e'<t`) THEN RESA_TAC THEN THAYTHE_TAC (57-27)[`t:real`]; 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`{A,B}={B,A}`] 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,w(SUC l)):real^3#real^3`] THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`(w:num->real^3)(SUC l)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;`(rho_node1 FF (w(SUC l)))`;] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] THEN ASM_REWRITE_TAC[] 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)`;`(w:num->real^3)(SUC l)`;`v2:real^3`] THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT THEN STRIP_TAC THEN ASM_REWRITE_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(SUC l)}` THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN ASM_REWRITE_TAC[]; ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] 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_NOT_MK=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=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 ==> (!a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t,a IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF <=> v,a IN FF)`,
[STRIP_TAC THEN REPLICATE_TAC (23-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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`v2=SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT THEN RESA_TAC THEN DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN STRIP_TAC THEN SUBGOAL_THEN`v,v2 IN FF:real^3#real^3->bool`ASSUME_TAC; ASM_REWRITE_TAC[]; MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN 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)`] THEN DICH_TAC (52-19) THEN RESA_TAC; MP_TAC(SET_RULE`v2=FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN DICH_TAC(47-22) THEN EXPAND_TAC "V" THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] THEN STRIP_TAC THEN THAYTHE_TAC (48-15)[`t:real`;`x':num`] THEN POP_ASSUM MP_TAC THEN MP_TAC(SET_RULE`x' MOD k = l MOD k\/ ~(x' MOD k = l MOD k)`) THEN RESA_TAC; MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`x':num`;`w:num->real^3`;`l:num`]; SET_TAC[]; DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN RESA_TAC; EXISTS_TAC`v:real^3,a':real^3` THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN POP_ASSUM MP_TAC THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) THEN RESA_TAC; STRIP_TAC THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN 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)`] THEN DICH_TAC (52-19) THEN RESA_TAC; REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);;
let V3_DEFOR_EQ_IN_FF_NOT_MK_SYM=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=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 ==> (!a. a, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF <=> a,v IN FF)`,
[STRIP_TAC THEN REPLICATE_TAC (23-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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`v2=FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] 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:real^3,(w:num->real^3) (SUC l)`] THEN DICH_TAC 3 THEN DICH_TAC 3 THEN MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT THEN RESA_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN STRIP_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`v2,v 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)`;`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 DICH_TAC (54-21) THEN RESA_TAC; MP_TAC(SET_RULE`v2=SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN DICH_TAC(47-22) THEN EXPAND_TAC "V" THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] THEN STRIP_TAC THEN THAYTHE_TAC (48-15)[`t:real`;`x':num`] THEN POP_ASSUM MP_TAC THEN MP_TAC(SET_RULE`x' MOD k = l MOD k\/ ~(x' MOD k = l MOD k)`) THEN RESA_TAC; MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`x':num`;`w:num->real^3`;`l:num`]; SET_TAC[]; DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN REPEAT RESA_TAC; EXISTS_TAC`a':real^3,v:real^3` THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN POP_ASSUM MP_TAC THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) THEN RESA_TAC; MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] THEN STRIP_TAC 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`;`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)`]; REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);;
let DEFORMATION_AZIM_V3_DEFOR_NOT_MK=
prove_by_refinement(`scs_k_v39 s = k /\ 3 < 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)} /\ j MOD k = SUC l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (: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_v5 (-- &1) x1 x5 x2 v1 v2 (v) t) (rho_node1 (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t)) (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 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_MK THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5: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 ASM_REWRITE_TAC[] THEN STRIP_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_NOT_MK_SYM THEN RESA_TAC THEN REWRITE_TAC[rho_node1] THEN MP_TAC V3_DEFOR_EQ_IN_FF_NOT_MK THEN RESA_TAC THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ SUC(l+k-1)= l+k /\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN MP_TAC WL_IN_FF THEN 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 (54-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;BBs_v39;periodic;BBprime_v39;] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MRESAL_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(SUC l)):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN ASM_REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`]]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_MK=
prove_by_refinement(`scs_k_v39 s = k /\ 3 < 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)} /\ j MOD k = SUC l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V ==> (?e. &0 < e /\ (!t v. --e < t /\ t < e /\ v IN V ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t) (rho_node1 (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t)) (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 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_MK THEN RESA_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_SUB_MK THEN RESA_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_SUC_MK THEN RESA_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_NOT_MK 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; MATCH_DICH_TAC (46-24) 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; MATCH_DICH_TAC (47-26) THEN ASM_REWRITE_TAC[]; MP_TAC(SET_RULE`(v=(w:num->real^3)(l))\/ ~(v=(w:num->real^3)( l))`) THEN RESA_TAC; MATCH_DICH_TAC (48-22) THEN ASM_REWRITE_TAC[]; MATCH_DICH_TAC (48-28) THEN ASM_REWRITE_TAC[]]);;
let DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_AT_ALL_MK=
prove(`scs_k_v39 s = k /\ 3 < 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)} /\ j MOD k = SUC l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V ==> (?e. &0 < e /\ (!t v. --e < t /\ t < e /\ v IN V ==> interior_angle1 (vec 0) (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v t) = interior_angle1 (vec 0) FF v))`,
let DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_LE_PI_AT_ALL_MK=
prove(`scs_k_v39 s = k /\ 3 < 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)} /\ j MOD k = SUC l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V ==> (?e. &0 < e /\ (!t v. --e < t /\ t < e /\ v IN V /\ interior_angle1 (vec 0) FF v= pi ==> interior_angle1 (vec 0) (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v t) <= pi ))`,
STRIP_TAC THEN MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_AT_ALL_MK THEN RESA_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN REPEAT RESA_TAC THEN THAYTHE_TAC (26-22)[`t:real`;`v:real^3`] THEN REAL_ARITH_TAC);;
let FUN_V3_DEFOR_V5=
prove(`v3_defor_v5 a x1 x2 x6 v1 w v = (\t. v3_defor_v5 a x1 x2 x6 v1 w v t)`,
REWRITE_TAC[FUN_EQ_THM]);;
let V3_DEFOR_DEFORMATION_V5=
prove_by_refinement(`&0< x1 /\ &0<x2 /\ &0<x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 ==> ?e. &0< e /\ deformation (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2) V (--e,e)`,
[ REWRITE_TAC[deformation;real_interval;IN_ELIM_THM;REAL_ARITH`(-- &1 < &0 /\ &0 < &1)`] THEN STRIP_TAC THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v2:real^3`] THEN MRESAL_TAC(GEN_ALL UPS_X_POS_SEG)[`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x2:real`;`x5:real`][COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] 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_V5] THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] THEN MP_TAC(SET_RULE`(v=v2:real^3)\/ ~(v=v2)`) THEN RESA_TAC; MATCH_MP_TAC CONTINUOUS_ADD THEN ASM_SIMP_TAC[CONTINUOUS_CONST;] THEN 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 (GEN_ALL EYYPQDW_CONTINUOUS_AT_X) THEN ASM_REWRITE_TAC[] THEN THAYTHE_TAC (20-15)[`r:real`] THEN EXISTS_TAC`x2:real` THEN ASM_REWRITE_TAC[COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] THEN SET_TAC[]; REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`;CONTINUOUS_CONST]; REPEAT RESA_TAC THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;] THEN MRESAL_TAC (GEN_ALL V3_DEFOR_ID)[`a:real`;`-- v1:real^3`;`x1:real`;`x2:real`;`x5:real`;`v2-v1:real^3`][REAL_ARITH`(--a< &0<=> &0<a)/\ a- &0=a`;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] THEN MP_TAC(SET_RULE`(v=v2:real^3)\/ ~(v=v2)`) THEN RESA_TAC THEN VECTOR_ARITH_TAC]);;
let V_DEFORMATION_V3_DEFOR_V5=
prove(`IMAGE (\i. v3_defor_v4 (-- &1) x1 x5 x2 (--v1) (v2 - v1) (w i - v1) t + v1) (:num)=IMAGE (\v. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v t) (IMAGE w (:num))`,
REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION;v3_defor_v5] THEN SET_TAC[]);;
let E_DEFORMATION_V3_DEFOR_V5=
prove_by_refinement(`IMAGE (\i. {v3_defor_v4 (-- &1) x1 x5 x2 (--v1) (v2 - v1) (w i - v1) t + v1, v3_defor_v4 (-- &1) x1 x5 x2 (--v1) (v2 - v1) (w (SUC i) - v1) t + v1}) (:num) = IMAGE (IMAGE (\v. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v t)) (IMAGE (\i. {w i, w (SUC i)}) (:num))`,
[ REWRITE_TAC[EXTENSION] THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;v3_defor_v5] 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_V5=
prove(`IMAGE (\i. v3_defor_v4 (-- &1) x1 x5 x2 (--v1) (v2 - v1) (w i - v1) t + v1, v3_defor_v4 (-- &1) x1 x5 x2 (--v1) (v2 - v1) (w (SUC i) - v1) t + v1) (:num) = IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) (IMAGE (\i. w i, w (SUC i)) (:num))`,
REWRITE_TAC[EXTENSION;IMAGE;IN_ELIM_THM;v3_defor_v5] 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_MK=
prove_by_refinement( `scs_k_v39 s = k /\ 3 < 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)} /\ j MOD k = SUC l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V /\ ~(v=v2)/\ ~(w1=v2) /\ 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_v5 (-- &1) x1 x5 x2 v1 v2 v2 t IN affine hull {vec 0, v, w1, v2})`,
[STRIP_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_MK THEN RESA_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN DICH_TAC (30-4) THEN RESA_TAC THEN DICH_TAC (30-4) THEN RESA_TAC THEN DICH_TAC (30-4) THEN RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5: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 ASM_REWRITE_TAC[] THEN STRIP_TAC THEN REPLICATE_TAC (32-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/\ SUC(l+k-1)= l+k /\ ~(k<=3)`) THEN REPEAT RESA_TAC) THEN MP_TAC BBS_IMP_CONVEX_LOCAL_FAN THEN RESA_TAC THEN MP_TAC WL_IN_V THEN RESA_TAC THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN MP_TAC WL_IN_FF THEN 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; THAYTHE_TAC (71-31)[`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[v3_defor_v5;v3_defor_v4] ]);;
let V3_DEFOR_CONVEX_LOCAL_FAN_MK_concl =`!s k w l j. scs_k_v39 s=k /\ 3 < 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)} /\ (j MOD k = SUC l MOD k ) /\ (scs_a_v39 s j l = dist(w j,w l)) /\ (dist(w j,w l)<scs_b_v39 s j l ) /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist(w l,w i)) /\ (!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(v2-v1) pow 2=x5/\ a= -- &1 /\ norm v2 = &2 /\ (!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 x5 x2 (--v1) (v2 - v1) (w i - v1) t + v1) (:num), IMAGE (\i. {v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w i - v1) t + v1, v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w (SUC i) - v1) t + v1}) (:num), IMAGE (\i. v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w i - v1) t + v1, v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w (SUC i) - v1) t + v1) (:num))))`;;
let V3_DEFOR_CONVEX_LOCAL_FAN_MK=prove_by_refinement(
(mk_imp(ZLZTHIC_concl, mk_imp (MHAEYJN_concl, V3_DEFOR_CONVEX_LOCAL_FAN_MK_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/\ SUC(l+k-1)= l+k /\ ~(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-21)(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 WL_IN_V
THEN RESA_TAC
THEN MRESA_TAC(GEN_ALL WL_IN_V)[`l+k-1`;`w:num->real^3`]
THEN MRESA_TAC(GEN_ALL WL_IN_V)[`SUC l`;`w:num->real^3`]
THEN MP_TAC WL_IN_BALL_ANNULUS
THEN RESA_TAC
THEN MRESA_TAC (GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`l+k-1`]
THEN MRESA_TAC (GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`SUC l`]
THEN MP_TAC EXPAND_PERIODIC
THEN RESA_TAC
THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`];

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 MRESA_TAC(GEN_ALL NORM_POS_COLLINEAR)[`v2:real^3`;`v1:real^3`;`x2:real`;`x1:real`;`x5:real`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN RESA_TAC
THEN MP_TAC DEFORMATION_MK_DEFOR_IN_BALL_ANNULUS
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 MP_TAC Wrgcvdr_cizmrrh.CIZMRRH
THEN RESA_TAC;

MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_LE_PI_AT_ALL_MK
THEN RESA_TAC
THEN MP_TAC V3_DEFOR_DEFORMATION_V5
THEN RESA_TAC;

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

MRESA_TAC (GEN_ALL DEFORMATION_SMALL_INTERVAL)[`-- e''':real`;`e''':real`;`v3_defor_v5 (-- &1) x1 x5 x2 v1 v2`;`V:real^3->bool`;`--e1:real`;`e1:real`]
THEN THAYTHE_TAC (76-0) [`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v5 (-- &1) x1 x5 x2 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_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t,
                      v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t)
               FF)
               (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v t) <=
               pi)`ASSUME_TAC;

ASM_REWRITE_TAC[IN_REAL_INTERVAL]
THEN REPEAT RESA_TAC
THEN MATCH_DICH_TAC (79-63)
THEN ASM_REWRITE_TAC[]
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_V5;E_DEFORMATION_V3_DEFOR_V5;F_DEFORMATION_V3_DEFOR_V5]
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_MK
THEN RESA_TAC
THEN MP_TAC V3_DEFOR_DEFORMATION_V5
THEN RESA_TAC;

ABBREV_TAC`e1= (min(min(min (min e (&1)) e') e'') e''')/ &2`
THEN MP_TAC(REAL_ARITH`e1= (min(min(min (min e (&1)) e') e'') e''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\  -- e'''<= --e1/\ --e1< &0`)
THEN RESA_TAC
THEN SUBGOAL_THEN`(!u' t.
           u' IN V /\ ~(v2 = u':real^3) /\ t IN real_interval (--e1,e1)
           ==> v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 u' t = u')`ASSUME_TAC;

REPEAT STRIP_TAC
THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-c=b-c<=>a=b:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[th;])
THEN VECTOR_ARITH_TAC;

SUBGOAL_THEN`(!t. t IN real_interval (--e1,e1)
       ==> v3_defor_v5 (-- &1) x1 x5 x2 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 MATCH_DICH_TAC (83-69)
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_v5 (-- &1) x1 x5 x2 v1 v2`;`V:real^3->bool`;`--e1:real`;`e1:real`]
THEN REPLICATE_TAC (83-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_v5 (-- &1) x1 x5 x2 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_V5;E_DEFORMATION_V3_DEFOR_V5;F_DEFORMATION_V3_DEFOR_V5]
THEN GEN_TAC
THEN POP_ASSUM(fun th-> STRIP_TAC
THEN MRESA_TAC th[`t:real`])]);;
let CARD_FF_EQ_V3_DEFOR_DEFORMATION_MK=
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_v5 a x1 x5 x2 v1 v2 (w i) t)) ==> (!t. &0< t/\ t< e1==> CARD (IMAGE (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t, v3_defor_v5 a x1 x5 x2 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_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t)`;`IMAGE ((\i. v3_defor_v5 a x1 x5 x2 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_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t, v3_defor_v5 a x1 x5 x2 v1 v2 (w (SUC i)) t}) (:num)`;`IMAGE (\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t,v3_defor_v5 a x1 x5 x2 v1 v2 (w (SUC i)) t) (:num)`;`IMAGE (\i. v3_defor_v5 a x1 x5 x2 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_MK=
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_v5 a x1 x5 x2 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;v3_defor_v5;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`]; 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;v3_defor_v5;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`]]);;
let INTERIOR_ANGLE_SAME_V3_DEFOR1_MK=
prove(`scs_k_v39 s = k /\ 3 < 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)} /\ j MOD k = SUC l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V /\(!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t))/\ &0< e1 ==> (?e. &0< e/\ (!t i. &0< t /\ t< e ==> interior_angle1 (vec 0) (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (ITER i (rho_node1 (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF)) (v3_defor_v5 (-- &1) x1 x5 x2 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_V3_DEFOR_V1_AT_ALL_MK 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 (45-29)(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_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t) (:num)`;`IMAGE (\i. { v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t, v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t, v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) (SUC i)) t) (:num)`;`(\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t) (l MOD k)`;`(\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t)`;`l MOD k`] [MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[v3_defor_v5; F_DEFORMATION_V3_DEFOR_V5] THEN RESA_TAC THEN REWRITE_TAC[GSYM v3_defor_v5] THEN MATCH_DICH_TAC (47-31) 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_MK_concl = `!s k w l. scs_k_v39 s = k /\ 3 < 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)} /\ j MOD k = SUC l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\(!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t))/\ &0< e1 ==> (?e. &0 < e /\ (!t. &0 < t /\ t < e ==> taustar_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t)= taustar_v39 s w ))`;;
let TAUSTAR_V3_DEFOR_MK=prove_by_refinement(( TAUSTAR_V3_DEFOR_MK_concl),
[
REPEAT STRIP_TAC;

REPLICATE_TAC (20-3)(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_MK
THEN RESA_TAC
THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[GSYM dist]
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN REWRITE_TAC[dist]
THEN RESA_TAC
THEN REWRITE_TAC[GSYM dist]
THEN MRESAL_TAC(GEN_ALL UPS_X_POS_SEG)[`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x2:real`;`x5:real`][COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG]
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`)
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_MK
THEN RESA_TAC
THEN POP_ASSUM(fun th->MRESA1_TAC th`t:real`)
THEN MP_TAC DSV_V3_DEFOR_EQ_MK
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]);

THAYTHE_TAC (60-18)[`t:real`]
THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`IMAGE  (\i. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t) (:num)`;` (\i. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t)`;`l:num`;`s:scs_v39`;` (\i. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t) (l MOD scs_k_v39 s)`;`IMAGE (\i.  v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (SUC i)) t) (:num)`;`IMAGE (\i. {  v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w i) t,  v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]);

MATCH_MP_TAC SUM_EQ
THEN REWRITE_TAC[IN_ELIM_THM;F_DEFORMATION_V3_DEFOR_V5]
THEN REPEAT STRIP_TAC
THEN MP_TAC(REAL_ARITH`t<e2/\ e2<e/\ &0<t ==> --e<t`)
THEN RESA_TAC;

THAYTHEL_TAC (62-42)[`t:real`;`x:num`][F_DEFORMATION_V3_DEFOR_V5;ITER]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[v3_defor_v5; F_DEFORMATION_V3_DEFOR_V5]
THEN RESA_TAC
THEN REWRITE_TAC[GSYM v3_defor_v5]
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 MATCH_MP_TAC(SET_RULE`x=y==> rho_fun x= rho_fun y`)
THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=>a=c:real^3`]
THEN MP_TAC(SET_RULE`(w:num->real^3) (x + l MOD k) = v2 \/ ~(w (x + l MOD k) = v2)`)
THEN RESA_TAC;

ASM_REWRITE_TAC[NORM_EQ_SQUARE;NORM_POS_LE;DOT_SQUARE_NORM]
THEN MP_TAC(REAL_ARITH`&0< t/\ t< e'==> --e'<t`)
THEN RESA_TAC
THEN THAYTHE_TAC (92-70)[`t:real`]
THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`-- &1`;`x5:real`;`x2:real`;`x1:real`;`x5-t:real`;`v2-v1:real^3`;`v3_defor_v1 (-- &1) (-- v1) (v2-v1:real^3) x1 x5 x2 x2 (x5 - t)`;`-- v1:real^3`;`x2:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3/\ a- -- b=a+b`;NORM_NEG];

REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);;
let W_IN_BB_FUN_EQ=
prove(`is_scs_v39 s/\ BBs_v39 s w /\ w x= w y ==> x MOD (scs_k_v39 s)= y MOD (scs_k_v39 s)`,
REPEAT STRIP_TAC THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`scs_k_v39 s`;`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 ABBREV_TAC `k= scs_k_v39 s` THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) THEN RESA_TAC THEN MRESA_TAC DIVISION[`x:num`;`k:num`] THEN MRESA_TAC DIVISION[`y:num`;`k: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`x:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA_TAC th[`y:num`]) THEN THAYTHE_TAC (33-25)[`x MOD k`;`y MOD k`]);;
let MIN_LEAST=
prove(`!X c. c IN X ==> (min_num X) IN X /\ min_num X <= c`,
REWRITE_TAC[IN;Misc_defs_and_lemmas.min_least]);;
(***************************) (**********TWO CASES********) (***************************)
let DEFORMATION_DIST_LE_MK_A_TWO_CASES=
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(v2-v1) pow 2=x5/\ 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. --e < t/\ t< e ==> scs_a_v39 s l i < dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i)))`,
STRIP_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST_ADD THEN ASM_REWRITE_TAC[] THEN THAYTHE_TAC (16-10) [`i:num`]);;
let DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK_TWO_CASES=
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(v2-v1) pow 2=x5/\ 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. --e< 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 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i))`,
[REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_DIST_LE_MK_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) /\ ~(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==> 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)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/\ 3<k /\ ~(k=0)/\ SUC 1=2/\ ~(0=1)/\ ~(0=2)/\ SUC 0=1/\ ~(1=2)/\ ~(1=3)/\ ~(2=3)/\ SUC 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)0` THEN EXISTS_TAC`0` 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) /\ ~(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 THAYTHE_TAC (20-11)[`i:num`]; REPEAT STRIP_TAC THEN MRESAL_TAC REAL_LE_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i 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 /\ ~(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 THAYTHE_TAC (27-11) [`i:num MOD k`] THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) THEN POP_ASSUM MP_TAC THEN MP_TAC(REAL_ARITH`t < e1/\ e1<= e (i MOD k)/\ &0 < e (i MOD k)/\ --e1<t ==> t < e (i MOD k)/\ -- e (i MOD k)< t`) THEN 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] 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_MK_TWO_CASES=
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(v2-v1) pow 2=x5/\ 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. --e< t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i)<scs_b_v39 s l i)) `,
[STRIP_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LT_CONST_ADD 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_V3_DEFOR_A_COM_MK1_TWO_CASES=
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(v2-v1) pow 2=x5/\ a= -- &1/\ ~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)} /\ (l MOD k =SUC j MOD k) /\ scs_a_v39 s l j = dist (v2,w j) ==> ?e. &0< e/\ (!t. &0 < t/\ t< e ==> scs_a_v39 s l j < dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w j))`,
STRIP_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN MATCH_MP_TAC V3_DEFOR_INCREASING_IN_ANGLE THEN ASM_REWRITE_TAC[] THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MRESA_TAC(GEN_ALL EQ_SUC_K_SUB3)[`l:num`;`j:num`;`k:num`] THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`l+k-1:num`] 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[]);;
let  DEFORMATION_DIST_LE_V3_DEFOR_AA_COM_MK_TWO_CASES=
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(v2-v1) pow 2=x5/\ a= -- &1/\ ~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)} /\ (l MOD k = SUC j MOD k) /\ scs_a_v39 s l j = dist (v2,w j)/\ (!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) ==> scs_a_v39 s l i < dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i))`,
STRIP_TAC THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK_TWO_CASES THEN RESA_TAC THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK1_TWO_CASES 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(SET_RULE`(l MOD k = SUC i MOD k)\/ ~(l MOD k =SUC i MOD k)`) THEN RESA_TAC THENL[ MP_TAC(REAL_ARITH`t<e1/\ e1<e'==> t< e'`) THEN RESA_TAC THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)`) THEN RESA_TAC THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`j:num`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`i:num`] THEN THAYTHE_TAC (31-18) [`t:real`] THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`l:num`;`j:num`;`s:scs_v39`;`l:num`;`i:num`] THEN SYM_ASSUM_TAC THEN ASM_REWRITE_TAC[]; MP_TAC(REAL_ARITH`t<e1/\ e1<e/\ &0<t==> t< e/\ --e< t`) THEN RESA_TAC THEN THAYTHE_TAC (28-16) [`t:real`;`i:num`]]);;
let DEFORMATION_DIST_LE_V3_DEFOR_EDGE_SUB_TWO_CASES=
prove(` 3<k /\ is_scs_v39 s /\ MMs_v39 s w /\ scs_k_v39 s =k/\ w l=v2/\ w (SUC l) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5/\ a= -- &1/\ ~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)} ==> (!j. (SUC l MOD k = j MOD k) ==> ?e. &0< e/\ (!t. &0 < t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w j)<scs_b_v39 s l j))`,
STRIP_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM]THEN MRESA_TAC (GEN_ALL EYYPQDW_V3_DEFOR_INCREASING_IN_ANGLE) [`(w:num->real^3)(l+k-1)`;`a:real`;`x1:real`;`x2:real`;`x5:real`;`v2:real^3`;`v1:real^3`] THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN THAYTHE_TAC (20-18)[`t:real`] THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`SUC l:num`] THEN MRESA_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`l:num`;`j:num`;`s:scs_v39`;`l:num`;`SUC l:num`] 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 THAYTHE_TAC (58-29)[`l:num`;`SUC l`] THEN DICH_TAC (59-55) THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);;
let DIST_V3_DEFOR_EDGE_SUC_TWO_CASES=
prove(` 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(v2-v1) pow 2=x5/\ a= -- &1 /\ (l MOD k =SUC j MOD k) /\ dist (v2,w j)< scs_b_v39 s l j ==> ?e. &0< e/\ (!t. --e< t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w j)<scs_b_v39 s l j) `,
STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LT_CONST_ADD THEN ASM_REWRITE_TAC[] THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REPEAT STRIP_TAC);;
let DEFORMATION_DIST_LE_V3_DEFOR_B_COM_MK1_TWO_CASES=
prove( ` 3<k /\ is_scs_v39 s /\ MMs_v39 s w /\ scs_k_v39 s =k/\ w l=v2/\ w (SUC l) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5/\ a= -- &1/\ ~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)} /\ (l MOD k =SUC j MOD k) /\ dist (v2,w j) < scs_b_v39 s l j /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) ==> (!i. ~(l MOD k = i MOD k)==> ?e. &0< e/\ (!t. &0< t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i)<scs_b_v39 s l i))`,
STRIP_TAC THEN MP_TAC DIST_V3_DEFOR_EDGE_SUC_TWO_CASES THEN RESA_TAC THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_EDGE_SUB_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 MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_B_MK_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 REPEAT STRIP_TAC THEN MP_TAC(SET_RULE`(l MOD k = SUC i MOD k)\/ ~(l MOD k = SUC i MOD k)`) THEN RESA_TAC THENL[ EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0< t/\ t< e==> --e< t`) THEN RESA_TAC THEN THAYTHE_TAC (23-16)[`t:real`] THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)`) THEN RESA_TAC THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`j:num`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`i:num`;`w:num->real^3`;`j:num`] THEN MRESA_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`l:num`;`i:num`;`s:scs_v39`;`l:num`;`j:num`]; MP_TAC(SET_RULE`(SUC l MOD k = i MOD k)\/ ~(SUC l MOD k = i MOD k)`) THEN RESA_TAC THENL[ THAYTHE_TAC (21-17)[`i:num`] THEN EXISTS_TAC`(e':num->real) i` THEN ASM_REWRITE_TAC[]; THAYTHEL_TAC (21-18)[`i:num`] [scs_diag] THEN EXISTS_TAC`(e'':num->real) i` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MATCH_DICH_TAC 2 THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]);;
let DEFORMATION_DIST_LE_V3_DEFOR_B_COM_MK_TWO_CASES=
prove_by_refinement(` 3<k /\ is_scs_v39 s /\ MMs_v39 s w /\ scs_k_v39 s =k/\ w l=v2/\ w (SUC l) =v1 /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5/\ a= -- &1/\ ~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)} /\ (l MOD k = SUC j MOD k) /\ dist (v2,w j) < scs_b_v39 s l j /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) ==> ?e. &0< e/\ (!t i. &0< t/\ t< e /\ ~(l MOD k = i MOD k) ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i)<scs_b_v39 s l i)`,
[ REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_B_COM_MK1_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_MK_TWO_CASES=
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(v2-v1) pow 2=x5/\ 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 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i))))`,
REPEAT STRIP_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST_ADD THEN ASM_REWRITE_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_MK_TWO_CASES=
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(v2-v1) pow 2=x5/\ 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 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i))`,
[ REPEAT STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_MK_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_MK_TWO_CASES=
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(v2-v1) pow 2=x5/\ a= -- &1 ==> ?e. &0< e /\ (!t i. -- e<t /\ t<e/\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i))`,
STRIP_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_MK_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_MK_TWO_CASES=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t,a IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF <=> v2,a 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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] 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;VECTOR_ARITH`a-b+b=a:real^3`]); POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN RESA_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] THEN REPEAT RESA_TAC THEN DICH_TAC 3 THEN EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN 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] 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 DICH_TAC (69-62) THEN RESA_TAC THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN MP_TAC(SET_RULE`x' MOD k= l MOD k\/ ~(x' MOD k= l MOD k)`) THEN RESA_TAC; REPEAT RESA_TAC; REPEAT RESA_TAC THEN THAYTHE_TAC (70-34)[`t:real`;`x':num`] THEN DICH_TAC (70-61) THEN RESA_TAC THEN DICH_TAC 1 THEN ASM_REWRITE_TAC[]; EXISTS_TAC`v2:real^3,a':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,a'):real^3#real^3`] THEN VECTOR_ARITH_TAC]);;
let V3_DEFOR_EQ_IN_FF_MK_SYM_TWO_CASES=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=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, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF <=> a, 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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] 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;VECTOR_ARITH`a-b+b=a:real^3`]); POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC th) THEN RESA_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] THEN REPEAT RESA_TAC THEN DICH_TAC 3 THEN EXPAND_TAC"FF" THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN STRIP_TAC THEN 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] 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 DICH_TAC (69-62) THEN RESA_TAC THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN MP_TAC(SET_RULE`SUC x' MOD k= l MOD k\/ ~(SUC x' MOD k= l MOD k)`) THEN RESA_TAC; REPEAT RESA_TAC; REPEAT RESA_TAC THEN THAYTHE_TAC (70-34)[`t:real`;`SUC x':num`]; EXISTS_TAC`a':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`;`(a',v2):real^3#real^3`] THEN VECTOR_ARITH_TAC]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_MK_TWO_CASES=
prove_by_refinement( `scs_k_v39 s = k /\ 3 < 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)} /\ SUC j MOD k = l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V ==> (?e. &0 < e /\ (!t. --e < t /\ t < e ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t) (rho_node1 (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t)) (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 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_MK_TWO_CASES THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] 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 ASM_REWRITE_TAC[] THEN STRIP_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_MK_SYM_TWO_CASES THEN RESA_TAC THEN REWRITE_TAC[rho_node1] THEN MP_TAC V3_DEFOR_EQ_IN_FF_MK_TWO_CASES THEN RESA_TAC THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4] THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ SUC(l+k-1)= l+k /\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN MP_TAC WL_IN_FF THEN 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 (50-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;BBs_v39;periodic;BBprime_v39;] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN 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)`;`v2:real^3`;`(w:num->real^3)(SUC l)`] 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 DICH_TAC (55-4) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`t<e1 /\ e1< e' /\ --e1<t ==> t< e'/\ --e'<t`) THEN RESA_TAC THEN THAYTHE_TAC (57-27)[`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)`;`(w:num->real^3)(l+k-1)`] 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[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[]; ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN 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[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_SUB_MK_TWO_CASES=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=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,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) = v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1`,
[ 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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA THEN STRIP_TAC; EXISTS_TAC`v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1` THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] THEN EXISTS_TAC`v2:real^3,v1:real^3` THEN ASM_REWRITE_TAC[] THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`]; GEN_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(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; DICH_TAC (45-43) THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] THEN MRESAL_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,v1):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ THEN RESA_TAC THEN THAYTHE_TAC 0[`l:num`] THEN THAYTHE_TAC(48-15)[`t:real`;`SUC l`]; DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] THEN MRESAL_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,v1):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] THEN STRIP_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`a',v1 IN (FF:real^3#real^3->bool)`ASSUME_TAC; ASM_REWRITE_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 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)`;`a':real^3`;]]);;
let V3_DEFOR_EQ_IN_FF_SUB_MK_SYM_TWO_CASES=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (!a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t,a IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF <=> v1,a 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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] 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 DICH_TAC 3 THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] THEN MRESAL_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,v1):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ THEN RESA_TAC THEN THAYTHE_TAC 0[`l:num`] THEN THAYTHE_TAC(48-15)[`t:real`;`SUC l`]; MP_TAC(SET_RULE`v2=SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; DICH_TAC 3 THEN ASM_REWRITE_TAC[] THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] THEN MRESAL_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,v1):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] THEN STRIP_TAC THEN SUBGOAL_THEN`v1,v2 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)`;`SND (x:real^3#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)`;`v1:real^3`;`v2:real^3`;] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(SUC l),v2:real^3`;`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)`]); DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[] THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] THEN MRESAL_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,v1):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN REPEAT RESA_TAC; EXISTS_TAC`v1:real^3,a':real^3` THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) THEN RESA_TAC; STRIP_TAC THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`]; 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)`;`v2:real^3`;`v1:real^3`;] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(SUC l),v2:real^3`;`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[`v1:real^3`]); REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);;
let DEFORMATION_AZIM_V3_DEFOR_SUB_MK_TWO_CASES=
prove_by_refinement( `scs_k_v39 s = k /\ 3 < 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)} /\ SUC j MOD k = l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V ==> (?e. &0 < e /\ (!t. --e < t /\ t < e ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t) (rho_node1 (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t)) (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 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_MK_TWO_CASES THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] 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 ASM_REWRITE_TAC[] THEN STRIP_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_SUB_MK_SYM_TWO_CASES THEN RESA_TAC THEN REWRITE_TAC[rho_node1] THEN MP_TAC V3_DEFOR_EQ_IN_FF_SUB_MK_TWO_CASES THEN RESA_TAC THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ SUC(l+k-1)= l+k /\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN MP_TAC WL_IN_FF THEN 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 (50-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;BBs_v39;periodic;BBprime_v39;] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MRESAL_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,v1):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN ASM_REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`] THEN 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)`;`v2:real^3`;`(w:num->real^3)(SUC l)`] 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 MP_TAC(REAL_ARITH`t<e1 /\ e1< e' /\ --e1<t ==> t< e'/\ --e'<t`) THEN RESA_TAC THEN THAYTHE_TAC (57-27)[`t:real`] 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 ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] 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`;`(w:num->real^3)(l+k-1)`;`(rho_node1 FF (w(SUC l)))`;] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] THEN ASM_REWRITE_TAC[] 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)`;`v1:real^3`;`v2:real^3`] THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT THEN STRIP_TAC THEN ASM_REWRITE_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(l+k-1),v1}` THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]; ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] 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[] THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] THEN ASM_REWRITE_TAC[]]);;
let V3_DEFOR_EQ_IN_FF_SUC_MK_TWO_CASES=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=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,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (l+k-1)) t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF <=> a, w(l+k-1) 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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`v2=SND(x:real^3#real^3)\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT THEN RESA_TAC THEN DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[] THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1:num`;`w:num->real^3`] THEN MRESAL_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(l+k-1),v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN STRIP_TAC THEN MP_TAC Imjxphr.MOD_ADD_SUB_1 THEN RESA_TAC THEN THAYTHE_TAC (48-15)[`t:real`;`l+k-1`]; MP_TAC(SET_RULE`v2=FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[] THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1:num`;`w:num->real^3`] THEN MRESAL_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(l+k-1),v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN REPEAT STRIP_TAC THEN SUBGOAL_THEN`v2,w(l+k-1) IN FF:real^3#real^3->bool`ASSUME_TAC; ASM_REWRITE_TAC[]; MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->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 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(l+k-1):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(l+k-1):real^3`;`FST(x:real^3#real^3)`] THEN DICH_TAC 2 THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) 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)`]); DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[] THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1:num`;`w:num->real^3`] THEN MRESAL_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(l+k-1),v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN REPEAT RESA_TAC; EXISTS_TAC`a':real^3,w(l+k-1):real^3` THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) THEN RESA_TAC; STRIP_TAC THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1:num`;`w:num->real^3`]; MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->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 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(l+k-1):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(l+k-1):real^3`;`v2:real^3`] THEN DICH_TAC 2 THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) 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)`]); REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);;
let V3_DEFOR_EQ_IN_FF_SUC_MK_SYM_TWO_CASES=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) /\ t <e /\ IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF /\ IMAGE (w:num->real^3) (:num)=V ==> (@a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (l+k-1)) t,a IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF ) = v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1`,
[ 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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA THEN STRIP_TAC; EXISTS_TAC`v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1` 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 MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1:num`;`w:num->real^3`]; GEN_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(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; DICH_TAC (45-42) THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1:num`;`w:num->real^3`] THEN MRESAL_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(l+k-1),v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN MP_TAC Imjxphr.MOD_ADD_SUB_1 THEN RESA_TAC THEN THAYTHE_TAC (48-15)[`t:real`;`l+k-1`]; DICH_TAC 2 THEN DICH_TAC 2 THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1:num`;`w:num->real^3`] THEN MRESAL_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(l+k-1),v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN STRIP_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`w(l+k-1),a' 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)`;`(w:num->real^3)(l+k-1)`;`a':real^3`;]]);;
let DEFORMATION_AZIM_V3_DEFOR_SUC_MK_TWO_CASES=
prove_by_refinement( `scs_k_v39 s = k /\ 3 < 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)} /\ SUC j MOD k = l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V ==> (?e. &0 < e /\ (!t. --e < t /\ t < e ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (l+k-1)) t) (rho_node1 (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (l+k-1)) t)) (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (l+k-1)) t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 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_MK_TWO_CASES THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] 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 ASM_REWRITE_TAC[] THEN STRIP_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_SUC_MK_SYM_TWO_CASES THEN RESA_TAC THEN REWRITE_TAC[rho_node1] THEN MP_TAC V3_DEFOR_EQ_IN_FF_SUC_MK_TWO_CASES THEN RESA_TAC THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ SUC(l+k-1)= l+k /\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN MP_TAC WL_IN_FF THEN 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 (50-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;BBs_v39;periodic;BBprime_v39;] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MRESAL_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(l+k-1),v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN ASM_REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`] THEN 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)`;`v2:real^3`;`(w:num->real^3)(SUC l)`] 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 MP_TAC(REAL_ARITH`t<e1 /\ e1< e' /\ --e1<t ==> t< e'/\ --e'<t`) THEN RESA_TAC THEN THAYTHE_TAC (57-27)[`t:real`]; 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 ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] 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`;`(w(l+k-1),v2):real^3#real^3`] 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`{C,A,B}={C,B,A}`] THEN ASM_REWRITE_TAC[] THEN RESA_TAC 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] THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT THEN STRIP_TAC THEN ASM_REWRITE_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(l+k-1),v1}` THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]; ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] THEN ASM_REWRITE_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}`]]);;
let V3_DEFOR_EQ_IN_FF_NOT_MK_TWO_CASES=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=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=v2) /\ ~(v=v1) /\ v IN V ==> (!a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t,a IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF <=> v,a IN FF)`,
[STRIP_TAC THEN REPLICATE_TAC (23-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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`v2=SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT THEN RESA_TAC THEN DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN STRIP_TAC THEN SUBGOAL_THEN`v,v2 IN FF:real^3#real^3->bool`ASSUME_TAC; ASM_REWRITE_TAC[]; MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN 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)`] THEN DICH_TAC (52-19) THEN RESA_TAC; MP_TAC(SET_RULE`v2=FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN DICH_TAC(47-22) THEN EXPAND_TAC "V" THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] THEN STRIP_TAC THEN THAYTHE_TAC (48-15)[`t:real`;`x':num`] THEN POP_ASSUM MP_TAC THEN MP_TAC(SET_RULE`x' MOD k = l MOD k\/ ~(x' MOD k = l MOD k)`) THEN RESA_TAC; MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`x':num`;`w:num->real^3`;`l:num`]; SET_TAC[]; DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN RESA_TAC; EXISTS_TAC`v:real^3,a':real^3` THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN POP_ASSUM MP_TAC THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) THEN RESA_TAC; STRIP_TAC THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN 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)`] THEN DICH_TAC (52-19) THEN RESA_TAC; REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);;
let V3_DEFOR_EQ_IN_FF_NOT_MK_SYM_TWO_CASES=
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< x5 /\ ~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5 /\ a= -- &1 /\ &0< e/\ --e<t /\ (!t i. --e<t /\ t<e /\ ~(i MOD k= l MOD k) ==> ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=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=v2)/\ ~(v=v1) /\ v IN V ==> (!a. a, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF <=> a,v IN FF)`,
[STRIP_TAC THEN REPLICATE_TAC (23-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;v3_defor_v5;v3_defor_v4] 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/\ SUC(l+k-1)= l+k /\ ~(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;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; MP_TAC(SET_RULE`v2=FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) THEN RESA_TAC; MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] 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:real^3,(w:num->real^3) (SUC l)`] THEN DICH_TAC 3 THEN DICH_TAC 3 THEN MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT THEN RESA_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN STRIP_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`v2,v 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)`;`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 DICH_TAC (54-21) THEN RESA_TAC; MP_TAC(SET_RULE`v2=SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) THEN RESA_TAC; DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN DICH_TAC(47-22) THEN EXPAND_TAC "V" THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] THEN STRIP_TAC THEN THAYTHE_TAC (48-15)[`t:real`;`x':num`] THEN POP_ASSUM MP_TAC THEN MP_TAC(SET_RULE`x' MOD k = l MOD k\/ ~(x' MOD k = l MOD k)`) THEN RESA_TAC; MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`x':num`;`w:num->real^3`;`l:num`]; SET_TAC[]; DICH_TAC 2 THEN DICH_TAC 2 THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN REPEAT RESA_TAC; EXISTS_TAC`a':real^3,v:real^3` THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] THEN POP_ASSUM MP_TAC THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) THEN RESA_TAC; MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] THEN STRIP_TAC 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`;`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)`]; REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);;
let DEFORMATION_AZIM_V3_DEFOR_NOT_MK_TWO_CASES=
prove_by_refinement(`scs_k_v39 s = k /\ 3 < 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)} /\ SUC j MOD k = l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V ==> (?e. &0 < e /\ (!t v. --e < t /\ t < e /\ ~(v= w(l+k-1))/\ ~(v=v2)/\ ~(v=v1) /\ v IN V ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t) (rho_node1 (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t)) (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 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_MK_TWO_CASES THEN RESA_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN DICH_TAC (22-5) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] 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 ASM_REWRITE_TAC[] THEN STRIP_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_NOT_MK_SYM_TWO_CASES THEN RESA_TAC THEN REWRITE_TAC[rho_node1] THEN MP_TAC V3_DEFOR_EQ_IN_FF_NOT_MK_TWO_CASES THEN RESA_TAC THEN MP_TAC MMS_IMP_BBS THEN RESA_TAC THEN MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ SUC(l+k-1)= l+k /\ 1+l+k-1= 1*k+l /\ ~(k<=3)`) THEN RESA_TAC THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN MP_TAC WL_IN_FF THEN 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 (54-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;BBs_v39;periodic;BBprime_v39;] THEN REPEAT RESA_TAC); MP_TAC Local_lemmas.CVLF_LF_F THEN RESA_TAC THEN MRESAL_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(l+k-1),v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] THEN ASM_REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`]]);;
let DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_MK_TWO_CASES=
prove_by_refinement(`scs_k_v39 s = k /\ 3 < 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)} /\ SUC j MOD k = l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V ==> (?e. &0 < e /\ (!t v. --e < t /\ t < e /\ v IN V ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t) (rho_node1 (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t)) (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t IN IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 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_MK_TWO_CASES THEN RESA_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_SUC_MK_TWO_CASES THEN RESA_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_SUB_MK_TWO_CASES THEN RESA_TAC THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_NOT_MK_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; MATCH_DICH_TAC (46-24) 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; MATCH_DICH_TAC (47-26) THEN ASM_REWRITE_TAC[]; MP_TAC(SET_RULE`(v=(w:num->real^3)(l))\/ ~(v=(w:num->real^3)( l))`) THEN RESA_TAC; MATCH_DICH_TAC (48-22) THEN ASM_REWRITE_TAC[]; MATCH_DICH_TAC (48-28) THEN ASM_REWRITE_TAC[]]);;
let DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_AT_ALL_MK_TWO_CASES=
prove( `scs_k_v39 s = k /\ 3 < 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)} /\ SUC j MOD k = l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V ==> (?e. &0 < e /\ (!t v. --e < t /\ t < e /\ v IN V ==> interior_angle1 (vec 0) (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v t) = interior_angle1 (vec 0) FF v))`,
let DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_LE_PI_AT_ALL_MK_TWO_CASES=
prove(`scs_k_v39 s = k /\ 3 < 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)} /\ SUC j MOD k = l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V ==> (?e. &0 < e /\ (!t v. --e < t /\ t < e /\ v IN V /\ interior_angle1 (vec 0) FF v= pi ==> interior_angle1 (vec 0) (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v t) <= pi ))`,
STRIP_TAC THEN MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_AT_ALL_MK_TWO_CASES THEN RESA_TAC THEN EXISTS_TAC`e:real` THEN ASM_REWRITE_TAC[] THEN REPEAT RESA_TAC THEN THAYTHE_TAC (26-22)[`t:real`;`v:real^3`] THEN REAL_ARITH_TAC);;
let DEFORMATION_LUNAR_AFFINE_HULL_MK_TWO_CASES=
prove_by_refinement(`scs_k_v39 s = k /\ 3 < 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)} /\ SUC j MOD k = l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V /\ ~(v=v2)/\ ~(w1=v2) /\ 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_v5 (-- &1) x1 x5 x2 v1 v2 v2 t IN affine hull {vec 0, v, w1, v2})`,
[STRIP_TAC THEN ASM_TAC THEN REPEAT RESA_TAC THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_MK_TWO_CASES THEN RESA_TAC THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist] THEN RESA_TAC THEN REWRITE_TAC[GSYM dist] THEN DICH_TAC (30-4) THEN RESA_TAC THEN DICH_TAC (30-4) THEN RESA_TAC THEN DICH_TAC (30-4) THEN RESA_TAC THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] 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 ASM_REWRITE_TAC[] THEN STRIP_TAC THEN REPLICATE_TAC (32-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/\ SUC(l+k-1)= l+k /\ ~(k<=3)`) THEN REPEAT RESA_TAC) THEN MP_TAC BBS_IMP_CONVEX_LOCAL_FAN THEN RESA_TAC THEN MP_TAC WL_IN_V THEN RESA_TAC THEN MP_TAC EXPAND_PERIODIC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] THEN MP_TAC WL_IN_FF THEN 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; THAYTHE_TAC (71-31)[`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] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[v3_defor_v5;v3_defor_v4]]);;
let V3_DEFOR_CONVEX_LOCAL_FAN_MK_TWO_CASES_concl =`!s k w l j. scs_k_v39 s=k /\ 3 < 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)} /\ (SUC j MOD k = l MOD k ) /\ (scs_a_v39 s j l = dist(w j,w l)) /\ (dist(w j,w l)<scs_b_v39 s j l ) /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist(w l,w i)) /\ (!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(v2-v1) pow 2=x5/\ a= -- &1 /\ norm v2 = &2 /\ (!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 x5 x2 (--v1) (v2 - v1) (w i - v1) t + v1) (:num), IMAGE (\i. {v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w i - v1) t + v1, v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w (SUC i) - v1) t + v1}) (:num), IMAGE (\i. v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w i - v1) t + v1, v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w (SUC i) - v1) t + v1) (:num))))`;;
let V3_DEFOR_CONVEX_LOCAL_FAN_MK_TWO_CASES=prove_by_refinement(
(mk_imp(ZLZTHIC_concl, mk_imp (MHAEYJN_concl, V3_DEFOR_CONVEX_LOCAL_FAN_MK_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/\ SUC(l+k-1)= l+k /\ ~(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-21)(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 WL_IN_V
THEN RESA_TAC
THEN MRESA_TAC(GEN_ALL WL_IN_V)[`l+k-1`;`w:num->real^3`]
THEN MRESA_TAC(GEN_ALL WL_IN_V)[`SUC l`;`w:num->real^3`]
THEN MP_TAC WL_IN_BALL_ANNULUS
THEN RESA_TAC
THEN MRESA_TAC (GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`l+k-1`]
THEN MRESA_TAC (GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`SUC l`]
THEN MP_TAC EXPAND_PERIODIC
THEN RESA_TAC
THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`];

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 RESA_TAC
THEN MRESA_TAC(GEN_ALL NORM_POS_COLLINEAR)[`v2:real^3`;`v1:real^3`;`x2:real`;`x1:real`;`x5:real`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN RESA_TAC
THEN MP_TAC DEFORMATION_MK_DEFOR_IN_BALL_ANNULUS
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 MP_TAC Wrgcvdr_cizmrrh.CIZMRRH
THEN RESA_TAC;


MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_LE_PI_AT_ALL_MK_TWO_CASES
THEN RESA_TAC
THEN MP_TAC V3_DEFOR_DEFORMATION_V5
THEN RESA_TAC;

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

MRESA_TAC (GEN_ALL DEFORMATION_SMALL_INTERVAL)[`-- e''':real`;`e''':real`;`v3_defor_v5 (-- &1) x1 x5 x2 v1 v2`;`V:real^3->bool`;`--e1:real`;`e1:real`]
THEN THAYTHE_TAC (76-0) [`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v5 (-- &1) x1 x5 x2 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_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t,
                      v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t)
               FF)
               (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v t) <=
               pi)`ASSUME_TAC;

ASM_REWRITE_TAC[IN_REAL_INTERVAL]
THEN REPEAT RESA_TAC
THEN MATCH_DICH_TAC (79-63)
THEN ASM_REWRITE_TAC[]
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_V5;E_DEFORMATION_V3_DEFOR_V5;F_DEFORMATION_V3_DEFOR_V5]
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_MK_TWO_CASES
THEN RESA_TAC
THEN MP_TAC V3_DEFOR_DEFORMATION_V5
THEN RESA_TAC;

ABBREV_TAC`e1= (min(min(min (min e (&1)) e') e'') e''')/ &2`
THEN MP_TAC(REAL_ARITH`e1= (min(min(min (min e (&1)) e') e'') e''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\  -- e'''<= --e1/\ --e1< &0`)
THEN RESA_TAC
THEN SUBGOAL_THEN`(!u' t.
           u' IN V /\ ~(v2 = u':real^3) /\ t IN real_interval (--e1,e1)
           ==> v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 u' t = u')`ASSUME_TAC;

REPEAT STRIP_TAC
THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-c=b-c<=>a=b:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[th;])
THEN VECTOR_ARITH_TAC;

SUBGOAL_THEN`(!t. t IN real_interval (--e1,e1)
       ==> v3_defor_v5 (-- &1) x1 x5 x2 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 MATCH_DICH_TAC (83-69)
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_v5 (-- &1) x1 x5 x2 v1 v2`;`V:real^3->bool`;`--e1:real`;`e1:real`]
THEN REPLICATE_TAC (83-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_v5 (-- &1) x1 x5 x2 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_V5;E_DEFORMATION_V3_DEFOR_V5;F_DEFORMATION_V3_DEFOR_V5]
THEN GEN_TAC
THEN POP_ASSUM(fun th-> STRIP_TAC
THEN MRESA_TAC th[`t:real`])]);;
let INTERIOR_ANGLE_SAME_V3_DEFOR1_MK_TWO_CASES=
prove( `scs_k_v39 s = k /\ 3 < 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)} /\ SUC j MOD k = l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\ IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ IMAGE w (:num) = V /\(!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t))/\ &0< e1 ==> (?e. &0< e/\ (!t i. &0< t /\ t< e ==> interior_angle1 (vec 0) (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF) (ITER i (rho_node1 (IMAGE (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) FF)) (v3_defor_v5 (-- &1) x1 x5 x2 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_V3_DEFOR_V1_AT_ALL_MK_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 (45-29)(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_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t) (:num)`;`IMAGE (\i. { v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t, v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t, v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) (SUC i)) t) (:num)`;`(\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t) (l MOD k)`;`(\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t)`;`l MOD k`] [MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[v3_defor_v5; F_DEFORMATION_V3_DEFOR_V5] THEN RESA_TAC THEN REWRITE_TAC[GSYM v3_defor_v5] THEN MATCH_DICH_TAC (47-31) 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_MK_TWO_CASES_concl = `!s k w l. scs_k_v39 s = k /\ 3 < 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)} /\ SUC j MOD k = l MOD k /\ scs_a_v39 s j l = dist (w j,w l) /\ dist (w j,w l) < scs_b_v39 s j l /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ (!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 (v2 - v1) pow 2 = x5 /\ a = -- &1 /\(!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t))/\ &0< e1 ==> (?e. &0 < e /\ (!t. &0 < t /\ t < e ==> taustar_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t)= taustar_v39 s w ))`;;
let TAUSTAR_V3_DEFOR_MK_TWO_CASES=prove_by_refinement(
( TAUSTAR_V3_DEFOR_MK_TWO_CASES_concl),
[
REPEAT STRIP_TAC;

REPLICATE_TAC (20-3)(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_MK_TWO_CASES
THEN RESA_TAC
THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[GSYM dist]
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN REWRITE_TAC[dist]
THEN RESA_TAC
THEN REWRITE_TAC[GSYM dist]
THEN MRESAL_TAC(GEN_ALL UPS_X_POS_SEG)[`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x2:real`;`x5:real`][COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG]
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`)
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_MK
THEN RESA_TAC
THEN POP_ASSUM(fun th->MRESA1_TAC th`t:real`)
THEN MP_TAC DSV_V3_DEFOR_EQ_MK
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]);

THAYTHE_TAC (60-18)[`t:real`]
THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`IMAGE  (\i. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t) (:num)`;` (\i. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t)`;`l:num`;`s:scs_v39`;` (\i. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t) (l MOD scs_k_v39 s)`;`IMAGE (\i.  v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (SUC i)) t) (:num)`;`IMAGE (\i. {  v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w i) t,  v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]);

MATCH_MP_TAC SUM_EQ
THEN REWRITE_TAC[IN_ELIM_THM;F_DEFORMATION_V3_DEFOR_V5]
THEN REPEAT STRIP_TAC
THEN MP_TAC(REAL_ARITH`t<e2/\ e2<e/\ &0<t ==> --e<t`)
THEN RESA_TAC;

THAYTHEL_TAC (62-42)[`t:real`;`x:num`][F_DEFORMATION_V3_DEFOR_V5;ITER]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[v3_defor_v5; F_DEFORMATION_V3_DEFOR_V5]
THEN RESA_TAC
THEN REWRITE_TAC[GSYM v3_defor_v5]
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 MATCH_MP_TAC(SET_RULE`x=y==> rho_fun x= rho_fun y`)
THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=>a=c:real^3`]
THEN MP_TAC(SET_RULE`(w:num->real^3) (x + l MOD k) = v2 \/ ~(w (x + l MOD k) = v2)`)
THEN RESA_TAC;

ASM_REWRITE_TAC[NORM_EQ_SQUARE;NORM_POS_LE;DOT_SQUARE_NORM]
THEN MP_TAC(REAL_ARITH`&0< t/\ t< e'==> --e'<t`)
THEN RESA_TAC
THEN THAYTHE_TAC (92-70)[`t:real`]
THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`-- &1`;`x5:real`;`x2:real`;`x1:real`;`x5-t:real`;`v2-v1:real^3`;`v3_defor_v1 (-- &1) (-- v1) (v2-v1:real^3) x1 x5 x2 x2 (x5 - t)`;`-- v1:real^3`;`x2:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3/\ a- -- b=a+b`;NORM_NEG];

REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);;
let NUXCOEA_concl = `!s k w l j. scs_k_v39 s=k /\ 3 < 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)} /\ (j MOD k = SUC l MOD k \/ SUC j MOD k = l MOD k) /\ (scs_a_v39 s j l = dist(w j,w l)) /\ (dist(w j,w l)<scs_b_v39 s j l ) /\ (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ (!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 NUXCOEA=prove_by_refinement( (mk_imp(ZLZTHIC_concl, mk_imp (MHAEYJN_concl, NUXCOEA_concl))),
[

REPEAT DISCH_TAC
THEN REPEAT GEN_TAC
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC IMJXPHR
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 MP_TAC NORM_LE_2_IN_MMS
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`&2 <= norm ((w:num->real^3) l) ==> ~(&2 = norm (w l)) \/ &2= norm (w l) `)
THEN RESA_TAC
THEN ASM_TAC
THEN REPLICATE_TAC (16) (RESA_TAC)
THEN REPLICATE_TAC (15-10)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC)
THEN MP_TAC th)
;

MP_TAC MMS_IMP_BBS
THEN RESA_TAC
THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`SUC l`]
THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MODL)[`j:num`;`s:scs_v39`;`SUC l:num`;`l:num`]
THEN ASM_REWRITE_TAC[]
THEN REPLICATE_TAC (18-4)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC th
THEN ASM_REWRITE_TAC[is_scs_v39;periodic2]
THEN ASSUME_TAC th
THEN RESA_TAC)
THEN STRIP_TAC
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[DIST_SYM]
;


REPLICATE_TAC (39-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 MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ SUC(l+k-1)= l+k /\ 1+l+k-1= 1*k+l /\ ~(k<=3)`)
THEN RESA_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 (59-14)(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 WL_IN_BALL_ANNULUS
THEN RESA_TAC
THEN MRESA_TAC(GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`SUC l`]
THEN MRESA_TAC(GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`l+k-1`]
THEN MP_TAC WL_IN_V
THEN RESA_TAC
THEN MRESA_TAC(GEN_ALL WL_IN_V)[`SUC l`;`w:num->real^3`]
THEN MRESA_TAC(GEN_ALL WL_IN_V)[`l+k-1`;`w:num->real^3`]
THEN MP_TAC WL_IN_FF
THEN RESA_TAC
THEN MP_TAC EXPAND_PERIODIC
THEN RESA_TAC
THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`]
;




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;


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 MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_LE3)[`s:scs_v39`;`i:num`;`w:num->real^3`;`l+k-1:num`]
THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MODL)[`i:num`;`s:scs_v39`;`l+k-1:num`;`l:num`];



REPLICATE_TAC (71-10)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MRESAL_TAC th[`i:num`][scs_diag]);



ABBREV_TAC`v2= (w:num->real^3) l`
THEN ABBREV_TAC`v3= (w:num->real^3) (SUC 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`x3=norm (v3:real^3) pow 2`
THEN ABBREV_TAC`x5=norm (v2-v1:real^3) pow 2`
THEN ABBREV_TAC`x6=norm (v2-v3:real^3) pow 2`
THEN ABBREV_TAC`a= -- &1`
;


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 MRESA_TAC(GEN_ALL NORM_POS_COLLINEAR)[`v2:real^3`;`v1:real^3`;`x2:real`;`x1:real`;`x5:real`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
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,v3):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 MRESA_TAC(GEN_ALL NORM_POS_COLLINEAR)[`v2:real^3`;`v3:real^3`;`x2:real`;`x3:real`;`x6:real`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN RESA_TAC
THEN MP_TAC DEFORMATION_MK_DEFOR_IN_BALL_ANNULUS
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN RESA_TAC
THEN MRESA_TAC DIST_SYM[`v3:real^3`;`v2:real^3`]
THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_AA_COM_MK
THEN RESA_TAC
THEN DICH_TAC (94-8)
THEN RESA_TAC
THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_B_COM_MK
THEN RESA_TAC
THEN MP_TAC V3_DEFOR_CONVEX_LOCAL_FAN_MK
THEN RESA_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`j:num`])
THEN POP_ASSUM MP_TAC
THEN DICH_TAC (96-9)
THEN RESA_TAC
THEN MATCH_MP_TAC(SET_RULE`(B==> A==>C)==>((A==>B)==> A==>C)`)
THEN STRIP_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 SUBGOAL_THEN`!t. &0 < t /\ t < e1
==> BBs_v39 s (\i. (v3_defor_v4 a x1 x5 x2 (--v1) (v2-v1) ((w:num->real^3) i-v1) t)+v1 )` 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;]
THEN REPEAT RESA_TAC
THEN MP_TAC(SET_RULE`((w:num->real^3) x' -v1 =v2- v1)\/ ~(w x' -v1 = v2-v1)`)
THEN RESA_TAC;


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

THAYTHE_TAC (111-89)[`t:real`];


ASM_REWRITE_TAC[v3_defor_v4];

DICH_TAC(109-12)
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;VECTOR_ARITH`A-B+B=A:real^3`]
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
THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`];



MP_TAC(SET_RULE`(w:num->real^3) j' =w l \/ ~(w j' = w l)`)
THEN RESA_TAC
THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`];



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;




THAYTHEL_TAC (121-93) [`t:real`;`j':num`][DIST_REFL]
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`l:num`[ARITH_RULE`4 MOD 4=0`;VECTOR_ARITH`a-b+b=a:real^3`])
THEN DICH_TAC 1
THEN REAL_ARITH_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 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;




THAYTHEL_TAC (121-93) [`t:real`;`i:num`][]
THEN ONCE_REWRITE_TAC[DIST_SYM]
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`l:num`[ARITH_RULE`4 MOD 4=0`;VECTOR_ARITH`a-b+b=a:real^3`])
THEN DICH_TAC 1
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;VECTOR_ARITH`a-b+b=a:real^3`]
THEN REPEAT RESA_TAC;



(**************scs_b_v39************)


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
THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`];



MP_TAC(SET_RULE`(w:num->real^3) j' =w l \/ ~(w j' = w l)`)
THEN RESA_TAC
THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`];



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;


THAYTHEL_TAC (109-14) [`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;




THAYTHEL_TAC (121-96) [`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`;VECTOR_ARITH`a-b+b=a:real^3`])
THEN DICH_TAC 1
THEN REAL_ARITH_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 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;




THAYTHEL_TAC (121-96) [`t:real`;`i:num`][]
THEN ONCE_REWRITE_TAC[DIST_SYM]
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`;VECTOR_ARITH`a-b+b=a:real^3`])
THEN DICH_TAC 1
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;VECTOR_ARITH`a-b+b=a:real^3`]
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 THAYTHE_TAC (108-98)[`t:real`;]
;



POP_ASSUM MP_TAC
THEN REWRITE_TAC[GSYM v3_defor_v5]
THEN STRIP_TAC
THEN MP_TAC TAUSTAR_V3_DEFOR_MK
THEN RESA_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`])
THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK1
THEN RESA_TAC
THEN ABBREV_TAC`e3=e''''':real`;


ABBREV_TAC`e2= (min (min (min e1 e'''')e') e3)/ &2`
THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e''''
/\ &0< e' /\ &0< e3
==> &0< e2/\ e2< e1/\ e2< e''''/\ e2< e'/\ e2< e3`)
THEN RESA_TAC
THEN SUBGOAL_THEN`!t. &0 < t /\ t < e2
          ==> BBprime_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t)`ASSUME_TAC
;


REPEAT RESA_TAC
THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e''''
/\ &0< e' /\ &0< e3
/\ &0<t/\ t<e2
==> t< e1/\ t< e''''`)
THEN RESA_TAC
THEN THAYTHE_TAC (120-105)[`t:real`]
THEN THAYTHE_TAC (120-106)[`t:real`];





SUBGOAL_THEN`!t. &0 < t /\ t < e2
          ==> BBindex_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t)< BBindex_v39 s w`ASSUME_TAC
;



REWRITE_TAC[BBindex_v39]
THEN REPEAT RESA_TAC
THEN MATCH_MP_TAC CARD_PSUBSET
THEN STRIP_TAC;


REWRITE_TAC[PSUBSET_ALT]
THEN STRIP_TAC;



REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;SUBSET;IN_ELIM_THM]
THEN REPEAT RESA_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC(SET_RULE`(w:num->real^3) x=v2 \/ ~(w x= v2)`)
THEN RESA_TAC;


MRESA_TAC (GEN_ALL W_IN_BB_FUN_EQ)[`w:num->real^3`;`x:num`;`l:num`;`s:scs_v39`]
THEN MP_TAC(SET_RULE`(w:num->real^3) (SUC x)=v2 \/ ~(w (SUC x)= v2)`)
THEN RESA_TAC;



REWRITE_TAC[DIST_REFL];


MRESA_TAC (GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`x:num`;`l:num`;`k:num`]
THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`SUC x:num`;`w:num->real^3`;`SUC l`]
THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`x:num`;`SUC x:num`;`s:scs_v39`;`l:num`;`SUC l:num`] 
THEN RESA_TAC
;


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


MRESA_TAC (GEN_ALL W_IN_BB_FUN_EQ)[`w:num->real^3`;`SUC x:num`;`l:num`;`s:scs_v39`]
THEN MRESA_TAC (GEN_ALL EQ_SUC_K_SUB)[`l:num`;`x:num`;`k:num`]
THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`x:num`;`w:num->real^3`;`l+k-1`]
THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`x:num`;`SUC x:num`;`s:scs_v39`;`l+k-1:num`;`l:num`] 
THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e''''
/\ &0< e' /\ &0< e3
/\ &0<t/\ t<e2
==> t< e'`)
THEN RESA_TAC
THEN MP_TAC Imjxphr.MOD_ADD_SUB_1
THEN RESA_TAC
THEN THAYTHEL_TAC (128-92)[`t:real`;`l+k-1`][VECTOR_ARITH`a-b+b=a:real^3`]
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC
;


REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]
;

EXISTS_TAC`l MOD k`
THEN ASM_REWRITE_TAC[IN_ELIM_THM]
THEN MRESA_TAC DIVISION[`l:num`;`k:num`]
THEN MRESA_TAC MOD_LT[`l MOD k`;`k:num`]
THEN MRESA_TAC MOD_REFL[`SUC l`;`k:num`]
THEN MRESA_TAC Hypermap.lemma_suc_mod[`l:num`;`k:num`]
THEN MRESAL_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`l MOD k:num`;`SUC(l MOD k):num`;`s:scs_v39`;`l:num`;`SUC (l MOD k) MOD k:num`][MOD_REFL] 
THEN MRESAL_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`l:num`;`SUC l MOD k:num`;`s:scs_v39`;`l:num`;`SUC l:num`][MOD_REFL] 
THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`l MOD k :num`;`w:num->real^3`;`l:num`]
THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`SUC(l MOD k) :num`;`w:num->real^3`;`SUC(l MOD k) MOD k:num`]
THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`SUC l MOD k :num`;`w:num->real^3`;`SUC l :num`]
THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`]
THEN MRESAL_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,v3):real^3#real^3`][VECTOR_ARITH`a-b+b=a:real^3`]
THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e''''
/\ &0< e' /\ &0< e3
/\ &0<t/\ t<e2
==> t< e3`)
THEN RESA_TAC
THEN THAYTHE_TAC (131-109)[`t:real`]
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC;


MATCH_MP_TAC FINITE_SUBSET
THEN EXISTS_TAC`0..k`
THEN ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG]
THEN ARITH_TAC;


STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN DICH_TAC (118-40)
THEN STRIP_TAC
THEN SUBGOAL_THEN`BBindex_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) (e2 / &3)) IN
      IMAGE (BBindex_v39 s) (BBprime_v39 s)`ASSUME_TAC
;

REWRITE_TAC[IMAGE;IN_ELIM_THM;]
THEN EXISTS_TAC`(\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) (e2 / &3))`
THEN ASM_REWRITE_TAC[IN]
THEN MATCH_DICH_TAC 2
THEN DICH_TAC (117-111)
THEN REAL_ARITH_TAC;


MRESAL_TAC MIN_LEAST[`(IMAGE (BBindex_v39 s) (BBprime_v39 s))`;`BBindex_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) (e2/ &3))`][GSYM BBindex_min_v39]
THEN MP_TAC(REAL_ARITH`&0< e2==> &0 < e2 / &3 /\ e2 / &3 < e2`)
THEN RESA_TAC
THEN THAYTHE_TAC (123-117)[`e2/ &3`]
THEN POP_ASSUM MP_TAC
THEN DICH_TAC 2
THEN 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 REMOVE_ASSUM_TAC
THEN THAYTHE_TAC  (71-16)[`l:num`;`l+k-1`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC;

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

(*************TWO_CASES***************)

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

MP_TAC MMS_IMP_BBS
THEN RESA_TAC
THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`SUC l`]
THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MODL)[`j:num`;`s:scs_v39`;`SUC l:num`;`l:num`]
THEN ASM_REWRITE_TAC[]
THEN REPLICATE_TAC (18-4)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC th
THEN ASM_REWRITE_TAC[is_scs_v39;periodic2]
THEN ASSUME_TAC th
THEN RESA_TAC)
THEN STRIP_TAC
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[DIST_SYM]
;


REPLICATE_TAC (39-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 MP_TAC(ARITH_RULE`3<k==> ~(k=0)/\ ~(k=1)/\ 0<k/\ 1<k/\ SUC(l+k-1)= l+k /\ 1+l+k-1= 1*k+l /\ ~(k<=3)`)
THEN RESA_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 (59-14)(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 WL_IN_BALL_ANNULUS
THEN RESA_TAC
THEN MRESA_TAC(GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`SUC l`]
THEN MRESA_TAC(GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`l+k-1`]
THEN MP_TAC WL_IN_V
THEN RESA_TAC
THEN MRESA_TAC(GEN_ALL WL_IN_V)[`SUC l`;`w:num->real^3`]
THEN MRESA_TAC(GEN_ALL WL_IN_V)[`l+k-1`;`w:num->real^3`]
THEN MP_TAC WL_IN_FF
THEN RESA_TAC
THEN MP_TAC EXPAND_PERIODIC
THEN RESA_TAC
THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`]
;




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;


MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_LE3)[`s:scs_v39`;`i:num`;`w:num->real^3`;`SUC l:num`]
THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MODL)[`i:num`;`s:scs_v39`;`SUC l:num`;`l:num`];



REPLICATE_TAC (71-10)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC
THEN MRESAL_TAC th[`i:num`][scs_diag]);



ABBREV_TAC`v2= (w:num->real^3) l`
THEN ABBREV_TAC`v1= (w:num->real^3) (SUC l)`
THEN ABBREV_TAC`v3= (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`x3=norm (v3:real^3) pow 2`
THEN ABBREV_TAC`x5=norm (v2-v1:real^3) pow 2`
THEN ABBREV_TAC`x6=norm (v2-v3:real^3) pow 2`
THEN ABBREV_TAC`a= -- &1`
;


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 RESA_TAC
THEN MRESA_TAC(GEN_ALL NORM_POS_COLLINEAR)[`v2:real^3`;`v1:real^3`;`x2:real`;`x1:real`;`x5:real`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
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`;`(v3,v2):real^3#real^3`]
THEN MRESA_TAC(GEN_ALL NORM_POS_COLLINEAR)[`v2:real^3`;`v3:real^3`;`x2:real`;`x3:real`;`x6:real`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN RESA_TAC
THEN MP_TAC DEFORMATION_MK_DEFOR_IN_BALL_ANNULUS
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN RESA_TAC
THEN MRESA_TAC DIST_SYM[`(w:num->real^3)j`;`v2:real^3`]
THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_AA_COM_MK_TWO_CASES
THEN RESA_TAC
THEN DICH_TAC (94-8)
THEN RESA_TAC
THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_B_COM_MK_TWO_CASES
THEN RESA_TAC
THEN MP_TAC V3_DEFOR_CONVEX_LOCAL_FAN_MK_TWO_CASES
THEN RESA_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`j:num`])
THEN POP_ASSUM MP_TAC
THEN DICH_TAC (96-9)
THEN RESA_TAC
THEN MATCH_MP_TAC(SET_RULE`(B==> A==>C)==>((A==>B)==> A==>C)`)
THEN STRIP_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 SUBGOAL_THEN`!t. &0 < t /\ t < e1
==> BBs_v39 s (\i. (v3_defor_v4 a x1 x5 x2 (--v1) (v2-v1) ((w:num->real^3) i-v1) t)+v1 )` 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;]
THEN REPEAT RESA_TAC
THEN MP_TAC(SET_RULE`((w:num->real^3) x' -v1 =v2- v1)\/ ~(w x' -v1 = v2-v1)`)
THEN RESA_TAC;


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

THAYTHE_TAC (111-89)[`t:real`];


ASM_REWRITE_TAC[v3_defor_v4];

DICH_TAC(109-12)
THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;VECTOR_ARITH`A-B+B=A:real^3`]
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
THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`];



MP_TAC(SET_RULE`(w:num->real^3) j' =w l \/ ~(w j' = w l)`)
THEN RESA_TAC
THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`];



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;




THAYTHEL_TAC (121-93) [`t:real`;`j':num`][DIST_REFL]
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`l:num`[ARITH_RULE`4 MOD 4=0`;VECTOR_ARITH`a-b+b=a:real^3`])
THEN DICH_TAC 1
THEN REAL_ARITH_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 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;




THAYTHEL_TAC (121-93) [`t:real`;`i:num`][]
THEN ONCE_REWRITE_TAC[DIST_SYM]
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`l:num`[ARITH_RULE`4 MOD 4=0`;VECTOR_ARITH`a-b+b=a:real^3`])
THEN DICH_TAC 1
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;VECTOR_ARITH`a-b+b=a:real^3`]
THEN REPEAT RESA_TAC;



(**************scs_b_v39************)


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
THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`];



MP_TAC(SET_RULE`(w:num->real^3) j' =w l \/ ~(w j' = w l)`)
THEN RESA_TAC
THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`];



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;


THAYTHEL_TAC (109-14) [`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;




THAYTHEL_TAC (121-96) [`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`;VECTOR_ARITH`a-b+b=a:real^3`])
THEN DICH_TAC 1
THEN REAL_ARITH_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 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;




THAYTHEL_TAC (121-96) [`t:real`;`i:num`][]
THEN ONCE_REWRITE_TAC[DIST_SYM]
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`;VECTOR_ARITH`a-b+b=a:real^3`])
THEN DICH_TAC 1
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;VECTOR_ARITH`a-b+b=a:real^3`]
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 THAYTHE_TAC (108-98)[`t:real`;]
;



POP_ASSUM MP_TAC
THEN REWRITE_TAC[GSYM v3_defor_v5]
THEN STRIP_TAC
THEN MP_TAC TAUSTAR_V3_DEFOR_MK_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 MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK1_TWO_CASES
THEN RESA_TAC
THEN ABBREV_TAC`e3=e''''':real`;


ABBREV_TAC`e2= (min (min (min e1 e'''')e') e3)/ &2`
THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e''''
/\ &0< e' /\ &0< e3
==> &0< e2/\ e2< e1/\ e2< e''''/\ e2< e'/\ e2< e3`)
THEN RESA_TAC
THEN SUBGOAL_THEN`!t. &0 < t /\ t < e2
          ==> BBprime_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t)`ASSUME_TAC
;


REPEAT RESA_TAC
THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39]
THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e''''
/\ &0< e' /\ &0< e3
/\ &0<t/\ t<e2
==> t< e1/\ t< e''''`)
THEN RESA_TAC
THEN THAYTHE_TAC (120-105)[`t:real`]
THEN THAYTHE_TAC (120-106)[`t:real`];





SUBGOAL_THEN`!t. &0 < t /\ t < e2
          ==> BBindex_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t)< BBindex_v39 s w`ASSUME_TAC
;



REWRITE_TAC[BBindex_v39]
THEN REPEAT RESA_TAC
THEN MATCH_MP_TAC CARD_PSUBSET
THEN STRIP_TAC;


REWRITE_TAC[PSUBSET_ALT]
THEN STRIP_TAC;



REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;SUBSET;IN_ELIM_THM]
THEN REPEAT RESA_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC(SET_RULE`(w:num->real^3) x=v2 \/ ~(w x= v2)`)
THEN RESA_TAC;


MRESA_TAC (GEN_ALL W_IN_BB_FUN_EQ)[`w:num->real^3`;`x:num`;`l:num`;`s:scs_v39`]
THEN MP_TAC(SET_RULE`(w:num->real^3) (SUC x)=v2 \/ ~(w (SUC x)= v2)`)
THEN RESA_TAC;



REWRITE_TAC[DIST_REFL];




MRESAL_TAC (GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`l:num`;`x:num`;`k:num`][ARITH_RULE`1+i=SUC i`]
THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`SUC x:num`;`w:num->real^3`;`SUC l:num`]
THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`x:num`;`SUC x:num`;`s:scs_v39`;`l:num`;`SUC l:num`] 
THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e''''
/\ &0< e' /\ &0< e3
/\ &0<t/\ t<e2
==> t< e'`)
THEN RESA_TAC
THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ
THEN RESA_TAC
THEN THAYTHE_TAC 0[`l:num`]
THEN THAYTHEL_TAC (128-92)[`t:real`;`SUC l`][VECTOR_ARITH`a-b+b=a:real^3`]
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC
;


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


MRESA_TAC(GEN_ALL W_IN_BB_FUN_EQ)[`w:num->real^3`;`SUC x`;`l:num`;`s:scs_v39`]
THEN MRESA_TAC (GEN_ALL EQ_SUC_K_SUB3)[`l:num`;`x:num`;`k:num`]
THEN MRESA_TAC (GEN_ALL EQ_SUC_K_SUB3)[`l:num`;`j:num`;`k:num`]
THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`x:num`;`w:num->real^3`;`j:num`]
THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`x:num`;`SUC x:num`;`s:scs_v39`;`j:num`;`l:num`] 
THEN RESA_TAC;




REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]
;

EXISTS_TAC`(l+k-1) MOD k`
THEN ASM_REWRITE_TAC[IN_ELIM_THM]
THEN MRESA_TAC DIVISION[`l+k-1:num`;`k:num`]
THEN MRESA_TAC MOD_REFL[`l+k:num`;`k:num`]
THEN MRESA_TAC MOD_REFL[`l+k-1:num`;`k:num`]
THEN MRESA_TAC MOD_REFL[`l:num`;`k:num`]
THEN MRESA_TAC Hypermap.lemma_suc_mod[`l+k-1:num`;`k:num`]
THEN MRESAL_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`(l+k-1) MOD k:num`;`SUC((l+k-1) MOD k):num`;`s:scs_v39`;`l+k-1:num`;`SUC ((l+k-1) MOD k) MOD k:num`][MOD_REFL] 
THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`][ARITH_RULE`1 * k + l= l+k`]
THEN MRESAL_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`l+k-1:num`;`l MOD k:num`;`s:scs_v39`;`l+k-1:num`;`l:num`][MOD_REFL] 
THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(l+k-1) MOD k :num`;`w:num->real^3`;`l+k-1:num`]
THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`SUC((l+k-1) MOD k) :num`;`w:num->real^3`;`SUC((l+k-1) MOD k) MOD k:num`]
THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`l MOD k :num`;`w:num->real^3`;`l :num`]
THEN MRESA_TAC (GEN_ALL EQ_SUC_K_SUB3)[`l:num`;`j:num`;`k:num`]
THEN ONCE_REWRITE_TAC[DIST_SYM]
THEN MRESAL_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`l:num`;`l+k-1:num`;`s:scs_v39`;`l:num`;`j:num`][MOD_REFL] 
THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j :num`;`w:num->real^3`;`l+k-1 :num`]
THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`]
THEN MRESAL_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`;`(v3,v2):real^3#real^3`][VECTOR_ARITH`a-b+b=a:real^3`]
THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e''''
/\ &0< e' /\ &0< e3
/\ &0<t/\ t<e2
==> t< e3`)
THEN RESA_TAC
THEN THAYTHE_TAC (136-109)[`t:real`]
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC;




MATCH_MP_TAC FINITE_SUBSET
THEN EXISTS_TAC`0..k`
THEN ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG]
THEN ARITH_TAC;


STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN DICH_TAC (118-40)
THEN STRIP_TAC
THEN SUBGOAL_THEN`BBindex_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) (e2 / &3)) IN
      IMAGE (BBindex_v39 s) (BBprime_v39 s)`ASSUME_TAC
;

REWRITE_TAC[IMAGE;IN_ELIM_THM;]
THEN EXISTS_TAC`(\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) (e2 / &3))`
THEN ASM_REWRITE_TAC[IN]
THEN MATCH_DICH_TAC 2
THEN DICH_TAC (117-111)
THEN REAL_ARITH_TAC;


MRESAL_TAC MIN_LEAST[`(IMAGE (BBindex_v39 s) (BBprime_v39 s))`;`BBindex_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) (e2/ &3))`][GSYM BBindex_min_v39]
THEN MP_TAC(REAL_ARITH`&0< e2==> &0 < e2 / &3 /\ e2 / &3 < e2`)
THEN RESA_TAC
THEN THAYTHE_TAC (123-117)[`e2/ &3`]
THEN POP_ASSUM MP_TAC
THEN DICH_TAC 2
THEN ARITH_TAC;


ONCE_REWRITE_TAC[DIST_SYM]
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC (GEN_ALL EQ_SUC_K_SUB3)[`l:num`;`j:num`;`k:num`]
THEN MRESAL_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`l:num`;`l+k-1:num`;`s:scs_v39`;`l:num`;`j:num`][MOD_REFL] 
THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j :num`;`w:num->real^3`;`l+k-1 :num`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN STRIP_TAC
THEN REMOVE_ASSUM_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 ONCE_REWRITE_TAC[DIST_SYM]
THEN THAYTHE_TAC  (71-16)[`l:num`;`SUC l`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC;

]);;
let NUXCOEAv2=prove((NUXCOEA_concl),
MP_TAC NUXCOEA
THEN ASM_REWRITE_TAC[Lunar_deform.MHAEYJN;Zlzthic.ZLZTHIC]
THEN MESON_TAC[]);;
let IMJXPHRv2=prove((IMJXPHR_concl),
MP_TAC IMJXPHR
THEN ASM_REWRITE_TAC[Lunar_deform.MHAEYJN;Zlzthic.ZLZTHIC]
THEN MESON_TAC[]);;
let ODXLSTCv2=prove((ODXLSTCv2_concl),
MP_TAC ODXLSTCv2
THEN ASM_REWRITE_TAC[Lunar_deform.MHAEYJN;Zlzthic.ZLZTHIC]
THEN MESON_TAC[]);;
end;; (* let check_completeness_claimA_concl = Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) *)