(* ========================================================================== *) (* FLYSPECK - BOOK FORMALIZATION *) (* *) (* Chapter: Local Fan *) (* Author: Hoang Le Truong *) (* Date: 2012-04-01 *) (* ========================================================================= *) module Mtuwlun = struct open Polyhedron;; open Sphere;; open Fan_defs;; open Hypermap;; open Vol1;; open Fan;; open Topology;; open Fan_misc;; open Planarity;; open Conforming;; open Sphere;; open Hypermap;; open Fan;; open Topology;; open Prove_by_refinement;; open Pack_defs;; 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;; let IS_SY = new_definition`IS_SY (s:stable_sy) p q={x| ?n m. n I_SY s1= IS_SY s p q /\ I_SY s2= IS_SY s q p /\ f_sy s1= fl_sy s p q /\ f_sy s2= fl_sy s q p`;; let COVER2_SY=new_definition`COVER2_SY (s:stable_sy) (s1:stable_sy) (s2:stable_sy) <=> d_sy s <= d_sy s1 + d_sy s2 `;; let COVER3_SY=new_definition`COVER3_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) <=> J_SY s1 SUBSET J_SY s UNION {{p,q}}/\ J_SY s2 SUBSET J_SY s UNION {{p,q}}`;; let COVER4_SY=new_definition`COVER4_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) <=> (!i j. ~({i,j }={p,q}) /\ i IN I_SY s1 /\ j IN I_SY s1 ==> a_sy s1 (i,j)=a_sy s (i,j)/\ b_sy s1 (i,j)=b_sy s (i,j)) /\ (!i j. ~({i,j }={p,q}) /\ i IN I_SY s2 /\ j IN I_SY s2 ==> a_sy s2 (i,j)=a_sy s (i,j)/\ b_sy s2 (i,j)=b_sy s (i,j))`;; let COVER5_SY=new_definition`COVER5_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) <=> a_sy s1 (p,q)<= a_sy s (p,q)/\ a_sy s2 (p,q)<= a_sy s (p,q)/\ a_sy s (p,q)<=b_sy s1 (p,q) /\ a_sy s (p,q)<=b_sy s2 (p,q)`;; let COVER6_SY=new_definition`COVER6_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) <=> (({p,q} IN J_SY s1 <=> {p,q} IN J_SY s2 ) /\ ({p,q} IN J_SY s1 <=> ear_sy s1 \/ ear_sy s2))`;; let COVER_SY=new_definition`COVER_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) <=> COVER1_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) /\ COVER2_SY (s:stable_sy) (s1:stable_sy) (s2:stable_sy) /\ COVER3_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) /\ COVER4_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) /\ COVER5_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) /\ COVER6_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy)`;; let pmat1=new_definition`pmat1 (A:real^N^M)= (lambda i j. if i< dimindex(:P) then A$i$j else A$ dimindex(:M)$j):real^N^P`;; let pmat2=new_definition`pmat2 (A:real^N^M)= (lambda i j. A$(dimindex(:M)- dimindex(:P)+i)$j):real^N^P`;; let DIA_SY=new_definition`DIA_SY p q (s:stable_sy) <=> ~(p=q) /\ p IN I_SY(s) /\ q IN I_SY s /\ ~(?i. i IN I_SY s /\ {p,q}= {i, f_sy s i})`;; let CARD_I_SY_LT_3=prove(` DIA_SY p q s ==> 3< CARD (I_SY s)`, MRESA1_TAC stable_sy_lemma`s:stable_sy` THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[stable_system;constraint_system;torsor; HAS_SIZE;] THEN REWRITE_TAC[DIA_SY] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(ARITH_RULE`3<= A /\ ~(A=3) ==> 3< A`) THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN STRIP_TAC THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`~(3<3)`]) THEN STRIP_TAC THEN STRIP_TAC THEN DISCH_THEN(LABEL_TAC"THY1") THEN DISCH_THEN(LABEL_TAC"THY2") THEN DISCH_THEN(LABEL_TAC"THY3") THEN DISCH_THEN(LABEL_TAC"THY4") THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_THEN"THY1" (fun th-> MRESA1_TAC th`p:num` THEN MRESA1_TAC th`f_sy (s:stable_sy) (p:num)`) THEN REMOVE_THEN"THY3" (fun th-> MRESAL_TAC th[`SUC 0`;`p:num`][ARITH_RULE`0 {p, f_sy s p, f_sy s (f_sy s p)} SUBSET I_SY s `) THEN RESA_TAC THEN MRESA_TAC CARD_SUBSET_EQ[`{p, f_sy (s:stable_sy) p, f_sy s (f_sy s p)}`;`I_SY (s:stable_sy)`] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN ASM_REWRITE_TAC[SET_RULE`A IN{B,C,D}<=> A= B \/ A=C\/ A=D`] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THENL[EXISTS_TAC`p:num` THEN ASM_REWRITE_TAC[]; EXISTS_TAC`f_sy s (f_sy (s:stable_sy)p)` THEN ASM_REWRITE_TAC[] THEN REMOVE_THEN"THY4" (fun th-> MRESA1_TAC th`p:num`) THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[ARITH_RULE`3=SUC(SUC(SUC 0))`;POWER;o_DEF;I_DEF] THEN RESA_TAC THEN SET_TAC[]]);; let COVER_NOT_EAR_SY=prove(`!(s:stable_sy). DIA_SY p q s ==> ~(ear_sy s)`, REWRITE_TAC[ear_sy;] THEN GEN_TAC THEN STRIP_TAC THEN MRESA_TAC (GEN_ALL CARD_I_SY_LT_3)[`p:num`;`q:num`;`s:stable_sy`] THEN REWRITE_TAC[DE_MORGAN_THM] THEN MP_TAC(ARITH_RULE`3 < CARD (I_SY s) ==> ~(CARD (I_SY (s:stable_sy))= 3)`) THEN RESA_TAC);; let DIAGONAL_SY=prove(`DIA_SY p q s ==> ~({p,q} IN J_SY s) `, MRESA1_TAC stable_sy_lemma`s:stable_sy` THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[stable_system;constraint_system;DIA_SY] THEN REPEAT STRIP_TAC THEN MP_TAC(SET_RULE`J_SY s SUBSET {{i, f_sy s i} | i | i IN I_SY (s:stable_sy)} /\ {p, q} IN J_SY s ==> {p, q} IN {{i, f_sy s i} | i | i IN I_SY (s:stable_sy)}`) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC);; let SCHANGE= new_definition`SCHANGE (f:num->num) (s:stable_sy) (s1:stable_sy)<=> k_sy s= k_sy s1 /\ d_sy s= d_sy s1 /\ (I_SY s)=IMAGE f (I_SY s1) /\ (!p q. {f p, f q} IN J_SY s<=> {p,q} IN J_SY s1) /\ (!p q. a_sy s (f p, f q)=a_sy s1 (p,q)) /\ (!p q. b_sy s (f p, f q)=b_sy s1 (p,q)) /\ f_sy s1 =(f_sy s) o f `;; let IK_SY=prove(`1<= p/\ I_SY s= 0..(p-1) ==> k_sy (s:stable_sy)= p`, STRIP_TAC THEN MP_TAC(ARITH_RULE`1<= p ==> (p - 1 + 1)-0 = p`) THEN RESA_TAC THEN MRESA1_TAC stable_sy_lemma`s:stable_sy` THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[stable_system;constraint_system;torsor;HAS_SIZE;CARD_NUMSEG;] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]);; let K_SY_LE2=prove(`2< k_sy (s:stable_sy)`, MRESA1_TAC stable_sy_lemma`s:stable_sy` THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[stable_system;constraint_system;torsor;HAS_SIZE;CARD_NUMSEG;] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN STRIP_TAC THEN REPEAT(STRIP_TAC THEN REMOVE_ASSUM_TAC) THEN POP_ASSUM MP_TAC THEN ARITH_TAC);; let IN_J_IMP_IN_J1_SY=prove(` k_sy s1=p /\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) /\ {0, p - 1} IN J_SY s1 ==> p-1,p IN J1_SY (s1:stable_sy)`, REPEAT STRIP_TAC THEN MRESA1_TAC (GEN_ALL K_SY_LE2)`s1:stable_sy` THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM] THEN MP_TAC(ARITH_RULE`2

SUC(p-1)= p/\1<= p-1 /\ p-1<=p /\ p-1< p /\ ~(p=0) /\ 1+p-1=p`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`] THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p`] THEN EXISTS_TAC`p-1:num` THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[]);; let D_FUN_COVER_SY=prove_by_refinement(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) /\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) /\ (ear_sy s2 <=> ear_sy s3) /\ DIA_SY 0 (p-1) s /\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 /\ COVER_SY 0 (p-1) s s1 s2 /\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) /\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} ==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) /\ matvec(pmat1(vecmats l))= l1 /\ matvec(pmat2(vecmats l))= l2 ==> d_fun(s,l) <= d_fun(s1,l1) + d_fun(s3,l2)`, [REPEAT STRIP_TAC THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p `) THEN RESA_TAC THEN MRESA_TAC (GEN_ALL IK_SY)[`s:stable_sy`;`k:num`] THEN MRESA_TAC (GEN_ALL IK_SY)[`s1:stable_sy`;`p:num`] THEN MRESA_TAC (GEN_ALL IK_SY)[`s3:stable_sy`;`k-p+2:num`] THEN MRESA1_TAC (GEN_ALL K_SY_LE2)`s:stable_sy` THEN MRESA1_TAC (GEN_ALL K_SY_LE2)`s1:stable_sy` THEN MRESA_TAC (GEN_ALL COVER_NOT_EAR_SY)[`0`;`p-1`;`s:stable_sy`] THEN MRESA1_TAC sigma_sy`s:stable_sy` THEN MRESA_TAC (GEN_ALL DIAGONAL_SY)[`0:num`;`p-1`;`s:stable_sy`] THEN DISJ_CASES_TAC(SET_RULE`{0,p-1} IN J_SY (s1:stable_sy)\/ ~({0,p-1} IN J_SY (s1:stable_sy))`); FIND_ASSUM MP_TAC `COVER_SY 0 (p - 1) s s1 (s2:stable_sy)` THEN REWRITE_TAC[COVER_SY;COVER3_SY;COVER6_SY] THEN RESA_TAC; ASM_REWRITE_TAC[d_fun] THEN MRESA1_TAC sigma_sy`s1:stable_sy` THEN FIND_ASSUM MP_TAC`SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 (s3:stable_sy)` THEN REWRITE_TAC[SCHANGE] THEN RESA_TAC THEN SUBGOAL_THEN`{0,1} IN J_SY (s3:stable_sy)`ASSUME_TAC; REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`0`;`1`]) THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`A+0=A/\ ~(1=0)`]) THEN MP_TAC(ARITH_RULE`2

p-2+1 =p-1`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`]; MRESA_TAC (GEN_ALL IN_J_IMP_IN_J1_SY)[`p:num`;`s1:stable_sy`] THEN SUBGOAL_THEN`(k-p+2,1) IN J1_SY (s3:stable_sy)`ASSUME_TAC; REWRITE_TAC[J1_SY;IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN STRIP_TAC THEN STRIP_TAC THEN EXISTS_TAC`k-p+2` THEN ASM_REWRITE_TAC[] THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\1+0=1/\ SUC 0=1 /\ k - p + 2 <= k - p + 2`] THEN MRESA_TAC MOD_LT[`1:num`;`k-p+2:num`]; MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats (l1:real^(P,3)finite_product))))`;`J1_SY (s1:stable_sy)`;`p-1,p`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] THEN MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l2) - row (SND x) (vecmats (l2:real^(N,3)finite_product))))`;`J1_SY (s3:stable_sy)`;`k-p+2,1`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] THEN SUBGOAL_THEN`J1_SY s1 DELETE (p-1,p) DELETE (p,1) SUBSET J1_SY (s:stable_sy)` ASSUME_TAC; ASM_REWRITE_TAC[SUBSET;J1_SY;IN_ELIM_THM;DELETE;IN_NUMSEG] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ;] THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) THEN RESA_TAC; MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`]; MP_TAC(ARITH_RULE`i

i=p-1 \/ i< p-1:num`) THEN RESA_TAC; MP_TAC(ARITH_RULE`2

SUC(p-1)=p /\ p-1 i< k /\ i<=k:num /\ 1+i ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] THEN MRESA_TAC MOD_LT[`1+i:num`;`k:num`] THEN MRESA_TAC MOD_LT[`1+i:num`;`p:num`] THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th] ) THEN FIND_ASSUM MP_TAC`J_SY s1 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`{i,(1+i) MOD p}`) THEN POP_ASSUM MP_TAC THEN MRESA_TAC MOD_LT[`1+i:num`;`p:num`] THEN STRIP_TAC THEN MP_TAC(SET_RULE`{i, 1 + i} = {0, p - 1} /\ ~(i=1+i) /\ ~(i=p-1) ==> i=0 /\ 1+i= p-1`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[ARITH_RULE`1+0=p-1<=> p=2`]; SUBGOAL_THEN`IMAGE (\(x,y). (p - 2 + x), (p - 2 + y)) (J1_SY s3 DELETE (k-p+2,1)) SUBSET J1_SY (s:stable_sy)` ASSUME_TAC; ASM_REWRITE_TAC[J1_SY;IMAGE;DELETE;SUBSET;IN_ELIM_THM;IN_NUMSEG] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ;] THEN MP_TAC(ARITH_RULE`i<=k-p+2 ==> i=k-p+2 \/ i< k-p+2:num`) THEN RESA_TAC; MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`]; MP_TAC(ARITH_RULE`i i=k-p+1 \/ i< k-p+1:num`) THEN RESA_TAC; POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN RESA_TAC THEN RESA_TAC THEN MP_TAC(ARITH_RULE`2

p-2+k-p+1=k-1/\ SUC(k-p+1)=k-p+2 /\ k-p+1 REWRITE_TAC[SYM th])`(\i. (1 + i) MOD (k - p + 2)) = f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)` THEN ASM_REWRITE_TAC[] THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`] THEN STRIP_TAC THEN FIND_ASSUM (fun th-> MP_TAC( ISPECL [`k-p+1`;`0`]th))`!p' q. {(if p' = 0 then 0 else (p - 2 + p') MOD k), (if q = 0 then 0 else (p - 2 + q) MOD k)} IN J_SY s2 <=> {p', q} IN J_SY (s3:stable_sy)` THEN POP_ASSUM (fun th-> REWRITE_TAC[th;ARITH_RULE`0=0`]) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN FIND_ASSUM MP_TAC`J_SY s2 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`{k-1,0}`); POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`1<=k-p /\2 ~(k-1=p-1) /\ ~(0= p-1)`) THEN RESA_TAC THEN MP_TAC(SET_RULE`~(k-1=p-1) /\ ~(0= p-1)==> ~(p-1 IN {k-1,0})`) THEN ASM_REWRITE_TAC[] THEN SET_TAC[]; STRIP_TAC THEN STRIP_TAC THEN EXISTS_TAC`p-2+i:num` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i p-2+i< k/\ p-2+i<=k /\ 1<=p-2+i/\ 1+p-2+i ~(i=0)/\ ~(1+i=0)`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`1+i:num`;`k-p+2:num`] THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] THEN REWRITE_TAC[ARITH_RULE`SUC (p - 2 + i)= p - 2 + SUC i`] THEN MRESA_TAC MOD_LT[`1+p-2+i:num`;`k:num`] THEN FIND_ASSUM (fun th-> MP_TAC( ISPECL [`i MOD (k - p + 2)`;`(f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)) (i MOD (k - p + 2))`] th))`!p' q. {(if p' = 0 then 0 else (p - 2 + p') MOD k), (if q = 0 then 0 else (p - 2 + q) MOD k)} IN J_SY s2 <=> {p', q} IN J_SY (s3:stable_sy)` THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`{i MOD (k - p + 2), (f_sy s2 o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)) (i MOD (k - p + 2))} IN J_SY (s3:stable_sy)` THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`(\i. (1 + i) MOD (k - p + 2)) = f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)` THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN STRIP_TAC THEN FIND_ASSUM MP_TAC`J_SY s2 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`{p-2+i,p-2+1+i}`); ASM_REWRITE_TAC[ARITH_RULE`1+p-2+i= p-2+1+i`]; MP_TAC(SET_RULE`{p - 2 + i, p - 2 + 1 + i} = {0, p - 1} ==> (p-2+i=0) \/ (p-2+1+i=0)`) THEN RESA_TAC THEN MP_TAC(ARITH_RULE`1<=i /\ 2< p==> ~(p-2+i=0) /\ ~(p-2+1+i=0)`) THEN ASM_REWRITE_TAC[]; MRESAL_TAC FINITE_DELETE_IMP[`J1_SY (s1:stable_sy)`;`p-1,p`][FINITE_J1_SY] THEN MRESAL_TAC FINITE_DELETE_IMP[`J1_SY (s3:stable_sy)`;`k-p+2,1`][FINITE_J1_SY] THEN DISJ_CASES_TAC(SET_RULE`ear_sy s3 \/ ~(ear_sy (s3:stable_sy))`); ASM_REWRITE_TAC[sigma_sy] THEN MATCH_MP_TAC(REAL_ARITH` d_sy s <= d_sy s1 + d_sy s3 /\ &0<= sum (J1_SY s) (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats l))) /\ &0<= sum (J1_SY s1 DELETE (p - 1,p)) (\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats l1))) /\ &0<= cstab - norm (row (p - 1) (vecmats l1) - row p (vecmats l1)) /\ &0<= sum (J1_SY s3 DELETE (k - p + 2,1)) (\x. cstab - norm (row (FST x) (vecmats l2) - row (SND x) (vecmats l2))) /\ &0<= cstab - norm (row (k - p + 2) (vecmats l2) - row 1 (vecmats l2)) ==> d_sy s + #0.1 * -- &1 * sum (J1_SY s) (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats l))) <= (d_sy s1 + #0.1 * &1 * (sum (J1_SY s1 DELETE (p - 1,p)) (\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats l1))) + cstab - norm (row (p - 1) (vecmats l1) - row p (vecmats l1)))) + d_sy s3 + #0.1 * &1 * (sum (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)) (\x. cstab - norm (row (FST x) (vecmats l2) - row (SND x) (vecmats l2))) + cstab - norm (row (k - p + 2) (vecmats l2) - row 1 (vecmats l2)))`) THEN RESA_TAC; FIND_ASSUM MP_TAC `COVER2_SY s s1 (s2:stable_sy)` THEN REWRITE_TAC[COVER2_SY] THEN RESA_TAC; STRIP_TAC; MATCH_MP_TAC SUM_POS_LE THEN REWRITE_TAC[FINITE_J1_SY] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG] THEN STRIP_TAC THEN MRESA_TAC (GEN_ALL B_SY_LE_CSTAB)[`i:num`;`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`;] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; STRIP_TAC; MATCH_MP_TAC SUM_POS_LE THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN DISJ_CASES_TAC(SET_RULE`x=p:num,1 \/ ~(x=p:num,1 )`); ASM_REWRITE_TAC[] THEN EXPAND_TAC"l1" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN SUBGOAL_THEN`1<= p/\ p<= dimindex(:P)==> row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<=1 /\ 1

x IN J1_SY (s:stable_sy)`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THY") THEN DISCH_THEN(LABEL_TAC"THY1") THEN REPEAT STRIP_TAC THEN REMOVE_THEN"THY" MP_TAC THEN REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM;IN_NUMSEG] THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_THEN"THY1" MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i<=p==> i=p \/ i i=p -1 \/ SUC i p-1< p /\ SUC (p-1)=p`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; RESA_TAC THEN RESA_TAC THEN EXPAND_TAC"l1" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG] THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`SUC i < p /\ 1<=k-p ==> i <= k/\ i row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p p-1 <= p /\ 1<= p-1/\ p-1 MP_TAC(ISPECL [`p-1`;`k:num`] th) )`!i j. {i MOD k, j MOD k} IN J_SY s UNION {{0, p - 1}} ==> norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= cstab` THEN REWRITE_TAC[IN_ELIM_THM;UNION;IN_SING] THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`;SET_RULE`{p-1,0}={0,p-1}`] THEN REAL_ARITH_TAC; STRIP_TAC; MATCH_MP_TAC SUM_POS_LE THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN DISJ_CASES_TAC(SET_RULE`x=k-p+1,k-p+2 \/ ~(x=k-p+1,k-p+2 )`); ASM_REWRITE_TAC[] THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN SUBGOAL_THEN`row (k-p+1) ((pmat2 (vecmats l)):real^3^N) = row (k-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+1<=k-p+2 /\ 1<= k-p+1 /\ k - (k - p + 2) + k - p + 1= k-1`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (k-p+2) ((pmat2 (vecmats l)):real^3^N) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE` 2 1<=k-1 /\ k-1<= k /\ SUC (k - 1)= k /\ k-1 i=k-p+2 \/ i i=k-p +1 \/ i< k-p+1:num`) THEN RESA_TAC; MP_TAC(ARITH_RULE`2

k-p+1< k-p+2 /\ SUC (k-p+1)=k-p+2`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`k-p+1:num`;`k-p+2:num`]; RESA_TAC THEN RESA_TAC THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] THEN SUBGOAL_THEN`row i ((pmat2 (vecmats l)):real^3^N) = row (p-2+i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + i= p-2+i`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE` i< k-p+1 /\ 2< p /\ 1<= k-p ==> 1<=p-2+i /\ p-2+i <= k /\ SUC (p-2+i)= p-2+ SUC i /\ p-2+i k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row 1 ((pmat2 (vecmats l)):real^3^N) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + 1= p-1/\ 1<=1 /\ 1<=k-p+2`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN ASM_REWRITE_TAC[] THEN FIND_ASSUM (fun th-> MP_TAC(ISPECL [`k:num`;`p-1:num`] th) )`!i j. {i MOD k, j MOD k} IN J_SY s UNION {{0, p - 1}} ==> norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= cstab` THEN REWRITE_TAC[IN_ELIM_THM;UNION;IN_SING] THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`;SET_RULE`{p-1,0}={0,p-1}`] THEN REAL_ARITH_TAC; ASM_REWRITE_TAC[sigma_sy] THEN SUBGOAL_THEN `cstab - norm (row (p - 1) (vecmats (l1:real^(P,3)finite_product)) - row p (vecmats l1)) =cstab - norm (row (k-p + 2) (vecmats (l2:real^(N,3)finite_product)) - row 1 (vecmats l2))` ASSUME_TAC; REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] THEN EXPAND_TAC"l1" THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN SUBGOAL_THEN`row 1 ((pmat2 (vecmats l)):real^3^N) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + 1= p-1/\ 1<=1 /\ 1<=k-p+2`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (k-p+2) ((pmat2 (vecmats l)):real^3^N) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (p-1) ((pmat1 (vecmats l)):real^3^P) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`2< p ==> p-1 <= p /\ 1<= p-1/\ p-1 row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p x = y)`ASSUME_TAC; REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ;ARITH_RULE`p-2+B=p-2+C<=> B=C`]; SUBGOAL_THEN`!x. x IN (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)) ==> ((\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l))) o (\(x,y). p - 2 + x,p - 2 + y)) x = (\x. cstab - norm (row (FST x) (vecmats (l2:real^(N,3)finite_product)) - row (SND x) (vecmats l2))) x` ASSUME_TAC; ASM_REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM;o_DEF;IN_NUMSEG] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`i<=k-p+2==> i=k-p+2 \/ i k - (k - p + 2) + i= p-2+i`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[]; MRESA_TAC SUM_EQ[` ((\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l))) o (\(x,y). p - 2 + x,p - 2 + y))`;`(\x. cstab - norm (row (FST x) (vecmats (l2:real^(N,3)finite_product)) - row (SND x) (vecmats l2)))`;`(J1_SY (s3:stable_sy) DELETE (k - p + 2,1))`] THEN MRESA_TAC SUM_IMAGE[`(\(x,y). p - 2 + x,p - 2 + y)`;`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`J1_SY (s3:stable_sy) DELETE (k - p + 2,1)`] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN MRESAL_TAC SUM_DIFF[`(\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l)))`;`J1_SY(s:stable_sy)`;`(IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)))`][FINITE_J1_SY] THEN MATCH_MP_TAC(REAL_ARITH` d_sy s <= d_sy s1+ d_sy s3 /\ &0<= sum (J1_SY s1 DELETE (p - 1,p)) (\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats l1))) /\ &0<= sum (J1_SY s) (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats l))) - sum (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1))) (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats l))) ==> d_sy s + #0.1 * -- &1 * sum (J1_SY (s:stable_sy)) (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats l))) <= (d_sy s1 + #0.1 * &1 * (sum (J1_SY s1 DELETE (p - 1,p)) (\x. cstab - norm (row (FST x) (vecmats (l1:real^(P,3)finite_product)) - row (SND x) (vecmats l1))) + cstab - norm (row (k - p + 2) (vecmats l2) - row 1 (vecmats l2)))) + d_sy s3 + #0.1 * -- &1 * (sum (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1))) (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product)))) + cstab - norm (row (k - p + 2) (vecmats (l2:real^(N,3)finite_product)) - row 1 (vecmats l2)))`) THEN RESA_TAC; FIND_ASSUM MP_TAC `COVER2_SY s s1 (s2:stable_sy)` THEN REWRITE_TAC[COVER2_SY] THEN RESA_TAC; STRIP_TAC; MATCH_MP_TAC SUM_POS_LE THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN DISJ_CASES_TAC(SET_RULE`x=p:num,1 \/ ~(x=p:num,1 )`); ASM_REWRITE_TAC[] THEN EXPAND_TAC"l1" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN SUBGOAL_THEN`1<= p/\ p<= dimindex(:P)==> row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<=1 /\ 1

x IN J1_SY (s:stable_sy)`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THY") THEN DISCH_THEN(LABEL_TAC"THY1") THEN REPEAT STRIP_TAC THEN REMOVE_THEN"THY" MP_TAC THEN REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM;IN_NUMSEG] THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_THEN"THY1" MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i<=p==> i=p \/ i i=p -1 \/ SUC i p-1< p /\ SUC (p-1)=p`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; RESA_TAC THEN RESA_TAC THEN EXPAND_TAC"l1" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG] THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`SUC i < p /\ 1<=k-p ==> i <= k/\ i REWRITE_TAC[SYM th]) THEN MATCH_MP_TAC SUM_POS_LE THEN STRIP_TAC; MATCH_MP_TAC FINITE_DIFF THEN REWRITE_TAC[FINITE_J1_SY]; REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG;DIFF] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN MRESA_TAC (GEN_ALL B_SY_LE_CSTAB)[`i:num`;`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`;] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; ASM_REWRITE_TAC[d_fun] THEN MRESA1_TAC sigma_sy`s3:stable_sy` THEN FIND_ASSUM MP_TAC`SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 (s3:stable_sy)` THEN REWRITE_TAC[SCHANGE] THEN RESA_TAC THEN SUBGOAL_THEN`{0,1} IN J_SY (s3:stable_sy)`ASSUME_TAC; REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`0`;`1`]) THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`A+0=A/\ ~(1=0)`]) THEN MP_TAC(ARITH_RULE`2

p-2+1 =p-1`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`]; MRESA_TAC (GEN_ALL IN_J_IMP_IN_J1_SY)[`p:num`;`s1:stable_sy`] THEN SUBGOAL_THEN`(k-p+2,1) IN J1_SY (s3:stable_sy)`ASSUME_TAC; REWRITE_TAC[J1_SY;IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN STRIP_TAC THEN STRIP_TAC THEN EXISTS_TAC`k-p+2` THEN ASM_REWRITE_TAC[] THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\1+0=1/\ SUC 0=1 /\ k - p + 2 <= k - p + 2`] THEN MRESA_TAC MOD_LT[`1:num`;`k-p+2:num`]; MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats (l1:real^(P,3)finite_product))))`;`J1_SY (s1:stable_sy)`;`p-1,p`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] THEN MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l2) - row (SND x) (vecmats (l2:real^(N,3)finite_product))))`;`J1_SY (s3:stable_sy)`;`k-p+2,1`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] THEN SUBGOAL_THEN`J1_SY s1 DELETE (p-1,p) DELETE (p,1) SUBSET J1_SY (s:stable_sy)` ASSUME_TAC; ASM_REWRITE_TAC[SUBSET;J1_SY;IN_ELIM_THM;DELETE;IN_NUMSEG] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ;] THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) THEN RESA_TAC; MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`]; MP_TAC(ARITH_RULE`i

i=p-1 \/ i< p-1:num`) THEN RESA_TAC; MP_TAC(ARITH_RULE`2

SUC(p-1)=p /\ p-1 i< k /\ i<=k:num /\ 1+i ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] THEN MRESA_TAC MOD_LT[`1+i:num`;`k:num`] THEN MRESA_TAC MOD_LT[`1+i:num`;`p:num`] THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th] ) THEN FIND_ASSUM MP_TAC`J_SY s1 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`{i,(1+i) MOD p}`) THEN POP_ASSUM MP_TAC THEN MRESA_TAC MOD_LT[`1+i:num`;`p:num`] THEN STRIP_TAC THEN MP_TAC(SET_RULE`{i, 1 + i} = {0, p - 1} /\ ~(i=1+i) /\ ~(i=p-1) ==> i=0 /\ 1+i= p-1`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[ARITH_RULE`1+0=p-1<=> p=2`]; SUBGOAL_THEN`IMAGE (\(x,y). (p - 2 + x), (p - 2 + y)) (J1_SY s3 DELETE (k-p+2,1)) SUBSET J1_SY (s:stable_sy)` ASSUME_TAC; ASM_REWRITE_TAC[J1_SY;IMAGE;DELETE;SUBSET;IN_ELIM_THM;IN_NUMSEG] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ;] THEN MP_TAC(ARITH_RULE`i<=k-p+2 ==> i=k-p+2 \/ i< k-p+2:num`) THEN RESA_TAC; MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`]; MP_TAC(ARITH_RULE`i i=k-p+1 \/ i< k-p+1:num`) THEN RESA_TAC; POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN RESA_TAC THEN RESA_TAC THEN MP_TAC(ARITH_RULE`2

p-2+k-p+1=k-1/\ SUC(k-p+1)=k-p+2 /\ k-p+1 REWRITE_TAC[SYM th])`(\i. (1 + i) MOD (k - p + 2)) = f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)` THEN ASM_REWRITE_TAC[] THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`] THEN STRIP_TAC THEN FIND_ASSUM (fun th-> MP_TAC( ISPECL [`k-p+1`;`0`]th))`!p' q. {(if p' = 0 then 0 else (p - 2 + p') MOD k), (if q = 0 then 0 else (p - 2 + q) MOD k)} IN J_SY s2 <=> {p', q} IN J_SY (s3:stable_sy)` THEN POP_ASSUM (fun th-> REWRITE_TAC[th;ARITH_RULE`0=0`]) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN FIND_ASSUM MP_TAC`J_SY s2 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`{k-1,0}`); POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`1<=k-p /\2 ~(k-1=p-1) /\ ~(0= p-1)`) THEN RESA_TAC THEN MP_TAC(SET_RULE`~(k-1=p-1) /\ ~(0= p-1)==> ~(p-1 IN {k-1,0})`) THEN ASM_REWRITE_TAC[] THEN SET_TAC[]; STRIP_TAC THEN STRIP_TAC THEN EXISTS_TAC`p-2+i:num` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i p-2+i< k/\ p-2+i<=k /\ 1<=p-2+i/\ 1+p-2+i ~(i=0)/\ ~(1+i=0)`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`1+i:num`;`k-p+2:num`] THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] THEN REWRITE_TAC[ARITH_RULE`SUC (p - 2 + i)= p - 2 + SUC i`] THEN MRESA_TAC MOD_LT[`1+p-2+i:num`;`k:num`] THEN FIND_ASSUM (fun th-> MP_TAC( ISPECL [`i MOD (k - p + 2)`;`(f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)) (i MOD (k - p + 2))`] th))`!p' q. {(if p' = 0 then 0 else (p - 2 + p') MOD k), (if q = 0 then 0 else (p - 2 + q) MOD k)} IN J_SY s2 <=> {p', q} IN J_SY (s3:stable_sy)` THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`{i MOD (k - p + 2), (f_sy s2 o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)) (i MOD (k - p + 2))} IN J_SY (s3:stable_sy)` THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`(\i. (1 + i) MOD (k - p + 2)) = f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)` THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN STRIP_TAC THEN FIND_ASSUM MP_TAC`J_SY s2 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`{p-2+i,p-2+1+i}`); ASM_REWRITE_TAC[ARITH_RULE`1+p-2+i= p-2+1+i`]; MP_TAC(SET_RULE`{p - 2 + i, p - 2 + 1 + i} = {0, p - 1} ==> (p-2+i=0) \/ (p-2+1+i=0)`) THEN RESA_TAC THEN MP_TAC(ARITH_RULE`1<=i /\ 2< p==> ~(p-2+i=0) /\ ~(p-2+1+i=0)`) THEN ASM_REWRITE_TAC[]; MRESAL_TAC FINITE_DELETE_IMP[`J1_SY (s1:stable_sy)`;`p-1,p`][FINITE_J1_SY] THEN MRESAL_TAC FINITE_DELETE_IMP[`J1_SY (s3:stable_sy)`;`k-p+2,1`][FINITE_J1_SY] THEN DISJ_CASES_TAC(SET_RULE`ear_sy s1 \/ ~(ear_sy (s1:stable_sy))`); ASM_REWRITE_TAC[sigma_sy] THEN MATCH_MP_TAC(REAL_ARITH` d_sy s <= d_sy s1 + d_sy s3 /\ &0<= sum (J1_SY s) (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats l))) /\ &0<= sum (J1_SY s1 DELETE (p - 1,p)) (\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats l1))) /\ &0<= cstab - norm (row (p - 1) (vecmats l1) - row p (vecmats l1)) /\ &0<= sum (J1_SY s3 DELETE (k - p + 2,1)) (\x. cstab - norm (row (FST x) (vecmats l2) - row (SND x) (vecmats l2))) /\ &0<= cstab - norm (row (k - p + 2) (vecmats l2) - row 1 (vecmats l2)) ==> d_sy s + #0.1 * -- &1 * sum (J1_SY s) (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats l))) <= (d_sy s1 + #0.1 * &1 * (sum (J1_SY s1 DELETE (p - 1,p)) (\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats l1))) + cstab - norm (row (p - 1) (vecmats l1) - row p (vecmats l1)))) + d_sy s3 + #0.1 * &1 * (sum (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)) (\x. cstab - norm (row (FST x) (vecmats l2) - row (SND x) (vecmats l2))) + cstab - norm (row (k - p + 2) (vecmats l2) - row 1 (vecmats l2)))`) THEN RESA_TAC; FIND_ASSUM MP_TAC `COVER2_SY s s1 (s2:stable_sy)` THEN REWRITE_TAC[COVER2_SY] THEN RESA_TAC; STRIP_TAC; MATCH_MP_TAC SUM_POS_LE THEN REWRITE_TAC[FINITE_J1_SY] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG] THEN STRIP_TAC THEN MRESA_TAC (GEN_ALL B_SY_LE_CSTAB)[`i:num`;`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`;] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; STRIP_TAC; MATCH_MP_TAC SUM_POS_LE THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN DISJ_CASES_TAC(SET_RULE`x=p:num,1 \/ ~(x=p:num,1 )`); ASM_REWRITE_TAC[] THEN EXPAND_TAC"l1" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN SUBGOAL_THEN`1<= p/\ p<= dimindex(:P)==> row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<=1 /\ 1

x IN J1_SY (s:stable_sy)`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THY") THEN DISCH_THEN(LABEL_TAC"THY1") THEN REPEAT STRIP_TAC THEN REMOVE_THEN"THY" MP_TAC THEN REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM;IN_NUMSEG] THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_THEN"THY1" MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i<=p==> i=p \/ i i=p -1 \/ SUC i p-1< p /\ SUC (p-1)=p`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; RESA_TAC THEN RESA_TAC THEN EXPAND_TAC"l1" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG] THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`SUC i < p /\ 1<=k-p ==> i <= k/\ i row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p p-1 <= p /\ 1<= p-1/\ p-1 MP_TAC(ISPECL [`p-1`;`k:num`] th) )`!i j. {i MOD k, j MOD k} IN J_SY s UNION {{0, p - 1}} ==> norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= cstab` THEN REWRITE_TAC[IN_ELIM_THM;UNION;IN_SING] THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`;SET_RULE`{p-1,0}={0,p-1}`] THEN REAL_ARITH_TAC; STRIP_TAC; MATCH_MP_TAC SUM_POS_LE THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN DISJ_CASES_TAC(SET_RULE`x=k-p+1,k-p+2 \/ ~(x=k-p+1,k-p+2 )`); ASM_REWRITE_TAC[] THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN SUBGOAL_THEN`row (k-p+1) ((pmat2 (vecmats l)):real^3^N) = row (k-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+1<=k-p+2 /\ 1<= k-p+1 /\ k - (k - p + 2) + k - p + 1= k-1`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (k-p+2) ((pmat2 (vecmats l)):real^3^N) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE` 2 1<=k-1 /\ k-1<= k /\ SUC (k - 1)= k /\ k-1 i=k-p+2 \/ i i=k-p +1 \/ i< k-p+1:num`) THEN RESA_TAC; MP_TAC(ARITH_RULE`2

k-p+1< k-p+2 /\ SUC (k-p+1)=k-p+2`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`k-p+1:num`;`k-p+2:num`]; RESA_TAC THEN RESA_TAC THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] THEN SUBGOAL_THEN`row i ((pmat2 (vecmats l)):real^3^N) = row (p-2+i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + i= p-2+i`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE` i< k-p+1 /\ 2< p /\ 1<= k-p ==> 1<=p-2+i /\ p-2+i <= k /\ SUC (p-2+i)= p-2+ SUC i /\ p-2+i k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row 1 ((pmat2 (vecmats l)):real^3^N) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + 1= p-1/\ 1<=1 /\ 1<=k-p+2`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN ASM_REWRITE_TAC[] THEN FIND_ASSUM (fun th-> MP_TAC(ISPECL [`k:num`;`p-1:num`] th) )`!i j. {i MOD k, j MOD k} IN J_SY s UNION {{0, p - 1}} ==> norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= cstab` THEN REWRITE_TAC[IN_ELIM_THM;UNION;IN_SING] THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`;SET_RULE`{p-1,0}={0,p-1}`] THEN REAL_ARITH_TAC; ASM_REWRITE_TAC[sigma_sy] THEN SUBGOAL_THEN `cstab - norm (row (p - 1) (vecmats (l1:real^(P,3)finite_product)) - row p (vecmats l1)) =cstab - norm (row (k-p + 2) (vecmats (l2:real^(N,3)finite_product)) - row 1 (vecmats l2))` ASSUME_TAC; REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] THEN EXPAND_TAC"l1" THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN SUBGOAL_THEN`row 1 ((pmat2 (vecmats l)):real^3^N) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + 1= p-1/\ 1<=1 /\ 1<=k-p+2`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (k-p+2) ((pmat2 (vecmats l)):real^3^N) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (p-1) ((pmat1 (vecmats l)):real^3^P) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`2< p ==> p-1 <= p /\ 1<= p-1/\ p-1 row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p /\ 1+0=1`] THEN MP_TAC(ARITH_RULE`2

1

MRESA1_TAC th`{0,1}`); MP_TAC(ARITH_RULE`2

~(p-1=0) /\ ~(p-1=1)`) THEN RESA_TAC THEN MP_TAC(SET_RULE`~(p-1=0) /\ ~(p-1=1) ==> ~(p-1 IN {0,1})`) THEN ASM_REWRITE_TAC[] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats (l1:real^(P,3)finite_product))))`;`J1_SY (s1:stable_sy) DELETE (p-1,p)`;`p:num,1`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] THEN MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`J1_SY (s:stable_sy)`;`k:num,1`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] THEN EXPAND_TAC"l1" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN SUBGOAL_THEN`1<= p/\ p<= dimindex(:P)==> row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<=1 /\ 1

A SUBSET B DELETE x`) THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(SET_RULE`~(x IN A) ==> ~(x IN A DELETE y)`) THEN MATCH_MP_TAC(SET_RULE`~(x IN A) ==> ~(x IN A DELETE y)`) THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;PAIR_EQ;IN_NUMSEG] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`1<= k-p ==> ~(k<=p)`) THEN RESA_TAC; ASM_REWRITE_TAC[REAL_ARITH`(A+ #0.1 * -- &1 *(C+B)) + D+ #0.1 * &1* (E+B)= (A+ #0.1 * -- &1 * C) + D+ #0.1 * &1 * E`] THEN MRESAL_TAC FINITE_DELETE_IMP[`J1_SY (s:stable_sy)`;`k:num,1`][FINITE_J1_SY] THEN MRESAL_TAC SUM_DIFF[`(\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l)))`;`J1_SY(s:stable_sy) DELETE (k,1)`;`J1_SY (s1:stable_sy) DELETE (p-1,p:num) DELETE (p:num,1)`][FINITE_J1_SY;] THEN MATCH_MP_TAC(REAL_ARITH` A1<= A+D /\ &0<= C1 -C /\ &0<= E ==> A1+ #0.1 * -- &1 * (C1+B) <=(A+ #0.1 * -- &1 *(C+B)) + D+ #0.1 * &1* E`) THEN STRIP_TAC; FIND_ASSUM MP_TAC `COVER2_SY s s1 (s2:stable_sy)` THEN REWRITE_TAC[COVER2_SY] THEN RESA_TAC; STRIP_TAC; SUBGOAL_THEN`!x. x IN (J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1)) ==> (\x. cstab - norm (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P))) x = (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product)))) x` ASSUME_TAC; ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;DELETE;IN_NUMSEG] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) THEN RESA_TAC; MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]; MP_TAC(ARITH_RULE`i< p /\ 2

i=p -1 \/ SUC i p-1< p /\ SUC (p-1)=p`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; RESA_TAC THEN RESA_TAC THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[]; MRESA_TAC SUM_EQ[`(\x. cstab - norm (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P)))`;`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`(J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1))`] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN MATCH_MP_TAC SUM_POS_LE THEN STRIP_TAC; MATCH_MP_TAC FINITE_DIFF THEN REWRITE_TAC[FINITE_J1_SY; FINITE_DELETE]; REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG;DIFF;DELETE] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN MRESA_TAC (GEN_ALL B_SY_LE_CSTAB)[`i:num`;`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`;] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; MATCH_MP_TAC SUM_POS_LE THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN DISJ_CASES_TAC(SET_RULE`x=k-p+1,k-p+2 \/ ~(x=k-p+1,k-p+2 )`); ASM_REWRITE_TAC[] THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN SUBGOAL_THEN`row (k-p+1) ((pmat2 (vecmats l)):real^3^N) = row (k-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+1<=k-p+2 /\ 1<= k-p+1 /\ k - (k - p + 2) + k - p + 1= k-1`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (k-p+2) ((pmat2 (vecmats l)):real^3^N) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE` 2 1<=k-1 /\ k-1<= k /\ SUC (k - 1)= k /\ k-1 i=k-p+2 \/ i i=k-p +1 \/ i< k-p+1:num`) THEN RESA_TAC; MP_TAC(ARITH_RULE`2

k-p+1< k-p+2 /\ SUC (k-p+1)=k-p+2`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`k-p+1:num`;`k-p+2:num`]; RESA_TAC THEN RESA_TAC THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] THEN SUBGOAL_THEN`row i ((pmat2 (vecmats l)):real^3^N) = row (p-2+i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + i= p-2+i`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE` i< k-p+1 /\ 2< p /\ 1<= k-p ==> 1<=p-2+i /\ p-2+i <= k /\ SUC (p-2+i)= p-2+ SUC i /\ p-2+i J1_SY (s1:stable_sy) DELETE (p - 1,p) = J1_SY s1 DELETE (p - 1,p) DELETE (p,1)`) THEN RESA_TAC THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) THEN MATCH_MP_TAC(REAL_ARITH` A1<= A+D /\ &0<= C1 -C /\ &0<= E ==> A1+ #0.1 * -- &1 * C1 <=(A+ #0.1 * -- &1 *(C+B)) + D+ #0.1 * &1* (E+B)`) THEN STRIP_TAC; FIND_ASSUM MP_TAC `COVER2_SY s s1 (s2:stable_sy)` THEN REWRITE_TAC[COVER2_SY] THEN RESA_TAC; STRIP_TAC; SUBGOAL_THEN`!x. x IN (J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1)) ==> (\x. cstab - norm (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P))) x = (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product)))) x` ASSUME_TAC; ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;DELETE;IN_NUMSEG] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) THEN RESA_TAC; MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]; MP_TAC(ARITH_RULE`i< p /\ 2

i=p -1 \/ SUC i p-1< p /\ SUC (p-1)=p`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; RESA_TAC THEN RESA_TAC THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[]; MRESA_TAC SUM_EQ[`(\x. cstab - norm (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P)))`;`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`(J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1))`] THEN EXPAND_TAC"l1" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN ASM_REWRITE_TAC[] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN MRESAL_TAC SUM_DIFF[`(\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l)))`;`J1_SY(s:stable_sy) `;`J1_SY (s1:stable_sy) DELETE (p-1,p:num) DELETE (p:num,1)`][FINITE_J1_SY;] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN MATCH_MP_TAC SUM_POS_LE THEN STRIP_TAC; MATCH_MP_TAC FINITE_DIFF THEN REWRITE_TAC[FINITE_J1_SY; FINITE_DELETE]; REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG;DIFF;DELETE] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN MRESA_TAC (GEN_ALL B_SY_LE_CSTAB)[`i:num`;`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`;] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; MATCH_MP_TAC SUM_POS_LE THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN DISJ_CASES_TAC(SET_RULE`x=k-p+1,k-p+2 \/ ~(x=k-p+1,k-p+2 )`); ASM_REWRITE_TAC[] THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN SUBGOAL_THEN`row (k-p+1) ((pmat2 (vecmats l)):real^3^N) = row (k-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+1<=k-p+2 /\ 1<= k-p+1 /\ k - (k - p + 2) + k - p + 1= k-1`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (k-p+2) ((pmat2 (vecmats l)):real^3^N) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE` 2 1<=k-1 /\ k-1<= k /\ SUC (k - 1)= k /\ k-1 i=k-p+2 \/ i i=k-p +1 \/ i< k-p+1:num`) THEN RESA_TAC; MP_TAC(ARITH_RULE`2

k-p+1< k-p+2 /\ SUC (k-p+1)=k-p+2`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`k-p+1:num`;`k-p+2:num`]; RESA_TAC THEN RESA_TAC THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] THEN SUBGOAL_THEN`row i ((pmat2 (vecmats l)):real^3^N) = row (p-2+i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + i= p-2+i`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE` i< k-p+1 /\ 2< p /\ 1<= k-p ==> 1<=p-2+i /\ p-2+i <= k /\ SUC (p-2+i)= p-2+ SUC i /\ p-2+i MP_TAC(ISPECL [`0`;`1`]th))`!p' q. {(if p' = 0 then 0 else (p - 2 + p') MOD k), (if q = 0 then 0 else (p - 2 + q) MOD k)} IN J_SY s2 <=> {p', q} IN J_SY (s3:stable_sy)` THEN POP_ASSUM(fun th-> REWRITE_TAC[th;ARITH_RULE`(0=0) /\ ~(1=0)`]) THEN MP_TAC(ARITH_RULE`2

p-2+1=p-1 /\ p-1 SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`2

p-2+1=p-1 /\ p-1

SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN STRIP_TAC THEN STRIP_TAC THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\ 1+0=1`] THEN MRESA_TAC MOD_LT[`1:num`;`k-p+2:num`]; SUBGOAL_THEN`J1_SY s1 DELETE (p-1,p) DELETE (p,1) SUBSET J1_SY (s:stable_sy)` ASSUME_TAC; ASM_REWRITE_TAC[SUBSET;J1_SY;IN_ELIM_THM;DELETE;IN_NUMSEG] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ;] THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) THEN RESA_TAC; MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`]; MP_TAC(ARITH_RULE`i

i=p-1 \/ i< p-1:num`) THEN RESA_TAC; MP_TAC(ARITH_RULE`2

SUC(p-1)=p /\ p-1 i< k /\ i<=k:num /\ 1+i ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] THEN MRESA_TAC MOD_LT[`1+i:num`;`k:num`] THEN MRESA_TAC MOD_LT[`1+i:num`;`p:num`] THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th] ) THEN FIND_ASSUM MP_TAC`J_SY s1 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`{i,(1+i) MOD p}`) THEN POP_ASSUM MP_TAC THEN MRESA_TAC MOD_LT[`1+i:num`;`p:num`] THEN STRIP_TAC THEN MP_TAC(SET_RULE`{i, 1 + i} = {0, p - 1} /\ ~(i=1+i) /\ ~(i=p-1) ==> i=0 /\ 1+i= p-1`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[ARITH_RULE`1+0=p-1<=> p=2`]; SUBGOAL_THEN`IMAGE (\(x,y). (p - 2 + x), (p - 2 + y)) (J1_SY s3 DELETE (k-p+2,1)) SUBSET J1_SY (s:stable_sy)` ASSUME_TAC; ASM_REWRITE_TAC[J1_SY;IMAGE;DELETE;SUBSET;IN_ELIM_THM;IN_NUMSEG] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ;] THEN MP_TAC(ARITH_RULE`i<=k-p+2 ==> i=k-p+2 \/ i< k-p+2:num`) THEN RESA_TAC; MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`]; MP_TAC(ARITH_RULE`i i=k-p+1 \/ i< k-p+1:num`) THEN RESA_TAC; POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN RESA_TAC THEN RESA_TAC THEN MP_TAC(ARITH_RULE`2

p-2+k-p+1=k-1/\ SUC(k-p+1)=k-p+2 /\ k-p+1 REWRITE_TAC[SYM th])`(\i. (1 + i) MOD (k - p + 2)) = f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)` THEN ASM_REWRITE_TAC[] THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`] THEN STRIP_TAC THEN FIND_ASSUM (fun th-> MP_TAC( ISPECL [`k-p+1`;`0`]th))`!p' q. {(if p' = 0 then 0 else (p - 2 + p') MOD k), (if q = 0 then 0 else (p - 2 + q) MOD k)} IN J_SY s2 <=> {p', q} IN J_SY (s3:stable_sy)` THEN POP_ASSUM (fun th-> REWRITE_TAC[th;ARITH_RULE`0=0`]) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN FIND_ASSUM MP_TAC`J_SY s2 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`{k-1,0}`); POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`1<=k-p /\2 ~(k-1=p-1) /\ ~(0= p-1)`) THEN RESA_TAC THEN MP_TAC(SET_RULE`~(k-1=p-1) /\ ~(0= p-1)==> ~(p-1 IN {k-1,0})`) THEN ASM_REWRITE_TAC[] THEN SET_TAC[]; STRIP_TAC THEN STRIP_TAC THEN EXISTS_TAC`p-2+i:num` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i p-2+i< k/\ p-2+i<=k /\ 1<=p-2+i/\ 1+p-2+i ~(i=0)/\ ~(1+i=0)`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`1+i:num`;`k-p+2:num`] THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] THEN REWRITE_TAC[ARITH_RULE`SUC (p - 2 + i)= p - 2 + SUC i`] THEN MRESA_TAC MOD_LT[`1+p-2+i:num`;`k:num`] THEN FIND_ASSUM (fun th-> MP_TAC( ISPECL [`i MOD (k - p + 2)`;`(f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)) (i MOD (k - p + 2))`] th))`!p' q. {(if p' = 0 then 0 else (p - 2 + p') MOD k), (if q = 0 then 0 else (p - 2 + q) MOD k)} IN J_SY s2 <=> {p', q} IN J_SY (s3:stable_sy)` THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`{i MOD (k - p + 2), (f_sy s2 o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)) (i MOD (k - p + 2))} IN J_SY (s3:stable_sy)` THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`(\i. (1 + i) MOD (k - p + 2)) = f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)` THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN STRIP_TAC THEN FIND_ASSUM MP_TAC`J_SY s2 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`{p-2+i,p-2+1+i}`); ASM_REWRITE_TAC[ARITH_RULE`1+p-2+i= p-2+1+i`]; MP_TAC(SET_RULE`{p - 2 + i, p - 2 + 1 + i} = {0, p - 1} ==> (p-2+i=0) \/ (p-2+1+i=0)`) THEN RESA_TAC THEN MP_TAC(ARITH_RULE`1<=i /\ 2< p==> ~(p-2+i=0) /\ ~(p-2+1+i=0)`) THEN ASM_REWRITE_TAC[]; MP_TAC(SET_RULE`~(k - p + 2,1 IN J1_SY s3) ==> J1_SY (s3:stable_sy) =J1_SY s3 DELETE (k - p + 2,1)`) THEN RESA_TAC THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) THEN MP_TAC(SET_RULE`~(p -1,p IN J1_SY s1) ==> J1_SY (s1:stable_sy) =J1_SY s1 DELETE (p -1,p)`) THEN RESA_TAC THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]); DISJ_CASES_TAC(SET_RULE`(p,1) IN J1_SY s1 DELETE (p - 1,p) \/ ~((p,1) IN J1_SY (s1:stable_sy) DELETE (p - 1,p))`); SUBGOAL_THEN`k,1 IN J1_SY (s:stable_sy)`ASSUME_TAC; POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;DELETE;PAIR_EQ;IN_NUMSEG] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p /\ 1+0=1`] THEN MP_TAC(ARITH_RULE`2

1

MRESA1_TAC th`{0,1}`); MP_TAC(ARITH_RULE`2

~(p-1=0) /\ ~(p-1=1)`) THEN RESA_TAC THEN MP_TAC(SET_RULE`~(p-1=0) /\ ~(p-1=1) ==> ~(p-1 IN {0,1})`) THEN ASM_REWRITE_TAC[] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; MRESAL_TAC FINITE_DELETE_IMP[`J1_SY (s1:stable_sy)`;`p-1,p`][FINITE_J1_SY] THEN MRESAL_TAC FINITE_DELETE_IMP[`J1_SY (s3:stable_sy)`;`k-p+2,1`][FINITE_J1_SY] THEN MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats (l1:real^(P,3)finite_product))))`;`J1_SY (s1:stable_sy) DELETE (p-1,p)`;`p:num,1`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] THEN MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`J1_SY (s:stable_sy)`;`k:num,1`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] THEN EXPAND_TAC"l1" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN SUBGOAL_THEN`1<= p/\ p<= dimindex(:P)==> row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<=1 /\ 1

A SUBSET B DELETE x`) THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(SET_RULE`~(x IN A) ==> ~(x IN A DELETE y)`) THEN MATCH_MP_TAC(SET_RULE`~(x IN A) ==> ~(x IN A DELETE y)`) THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;PAIR_EQ;IN_NUMSEG] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`1<= k-p ==> ~(k<=p)`) THEN RESA_TAC; ASM_REWRITE_TAC[REAL_ARITH` A1+ #0.1 * -- &1 * (C1+B) <=(A+ #0.1 * -- &1 *(C+B)) + D+ #0.1 * -- &1* E <=> A1+ #0.1 * -- &1 * (C1) <=(A+ #0.1 * -- &1 *(C)) + D+ #0.1 * -- &1* E `] THEN EXPAND_TAC"l1" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN MATCH_MP_TAC(REAL_ARITH` A1<= A+D /\ &0<=C1-(C+E) ==> A1+ #0.1 * -- &1 * (C1) <=(A+ #0.1 * -- &1 *(C)) + D+ #0.1 * -- &1* E`) THEN STRIP_TAC; FIND_ASSUM MP_TAC `COVER2_SY s s1 (s2:stable_sy)` THEN REWRITE_TAC[COVER2_SY] THEN RESA_TAC; SUBGOAL_THEN`!x. x IN (J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1)) ==> (\x. cstab - norm (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P))) x = (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product)))) x` ASSUME_TAC; ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;DELETE;IN_NUMSEG] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) THEN RESA_TAC; MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]; MP_TAC(ARITH_RULE`i< p /\ 2

i=p -1 \/ SUC i p-1< p /\ SUC (p-1)=p`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; RESA_TAC THEN RESA_TAC THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[]; MRESA_TAC SUM_EQ[`(\x. cstab - norm (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P)))`;`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`(J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1))`] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN SUBGOAL_THEN`!x. x IN (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)) ==> ((\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l))) o (\(x,y). p - 2 + x,p - 2 + y)) x = (\x. cstab - norm (row (FST x) (vecmats (l2:real^(N,3)finite_product)) - row (SND x) (vecmats l2))) x` ASSUME_TAC; ASM_REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM;o_DEF;IN_NUMSEG] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`i<=k-p+2==> i=k-p+2 \/ i k - (k - p + 2) + i= p-2+i`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[]; MRESA_TAC SUM_EQ[` ((\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l))) o (\(x,y). p - 2 + x,p - 2 + y))`;`(\x. cstab - norm (row (FST x) (vecmats (l2:real^(N,3)finite_product)) - row (SND x) (vecmats l2)))`;`(J1_SY (s3:stable_sy) DELETE (k - p + 2,1))`] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN SUBGOAL_THEN`(!x y. x IN J1_SY s3 DELETE (k - p + 2,1) /\ y IN J1_SY (s3:stable_sy) DELETE (k - p + 2,1) /\ (\(x,y). p - 2 + x,p - 2 + y) x = (\(x,y). p - 2 + x,p - 2 + y) y ==> x = y)`ASSUME_TAC; REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ;ARITH_RULE`p-2+B=p-2+C<=> B=C`]; MRESA_TAC SUM_IMAGE[`(\(x,y). p - 2 + x,p - 2 + y)`;`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`J1_SY (s3:stable_sy) DELETE (k - p + 2,1)`] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN SUBGOAL_THEN`J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1) INTER (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1)))={}` ASSUME_TAC; ASM_REWRITE_TAC[SET_RULE`A ={} <=> ~(?a. a IN A)`; INTER;IN_ELIM_THM;J1_SY;DELETE;IMAGE;IN_NUMSEG] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ] THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) THEN RESA_TAC; POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]; MP_TAC(ARITH_RULE`i

i=p-1 \/ i< p-1:num`) THEN RESA_TAC; POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE` 2< p ==> p-1< p:num/\ SUC (p-1)=p`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; MP_TAC(ARITH_RULE`1<= i /\ i< p-1 /\ 1<= i' ==> ~(i= p-2+i')`) THEN RESA_TAC; MRESA_TAC FINITE_IMAGE[`(\(x,y). p - 2 + x,p - 2 + y)`;`(J1_SY (s3:stable_sy) DELETE (k - p + 2,1))`] THEN MRESAL_TAC (GEN_ALL SUM_UNION_EQ)[`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1)`;`(IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)))`;`J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1) UNION (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)))`][FINITE_UNION;FINITE_DELETE] THEN SUBGOAL_THEN`IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1)) SUBSET J1_SY s DELETE (k,1)` ASSUME_TAC; MATCH_MP_TAC(SET_RULE`~(x IN A) /\ A SUBSET B ==> A SUBSET B DELETE x`) THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM;DELETE;J1_SY;IN_NUMSEG] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ] THEN MP_TAC(ARITH_RULE`i<= k-p+2 ==> i=k-p+2 \/ i< k-p+2`) THEN RESA_TAC; MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]; MP_TAC(ARITH_RULE`i< k-p+2 /\ 1<= k-p /\ 2< p ==> ~(k=p-2 +i)`) THEN RESA_TAC; MP_TAC(SET_RULE`IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1)) SUBSET J1_SY s DELETE (k,1) /\ J1_SY s1 DELETE (p - 1,p) DELETE (p,1) SUBSET J1_SY s DELETE (k,1) ==> J1_SY s1 DELETE (p - 1,p) DELETE (p,1) UNION (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1))) SUBSET J1_SY (s:stable_sy) DELETE (k,1)`) THEN RESA_TAC THEN MRESAL_TAC SUM_DIFF[`(\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l)))`;`J1_SY(s:stable_sy) DELETE (k,1)`;`J1_SY (s1:stable_sy) DELETE (p-1,p:num) DELETE (p:num,1) UNION (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1)))`][FINITE_J1_SY;FINITE_DELETE] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN MATCH_MP_TAC SUM_POS_LE THEN STRIP_TAC; MATCH_MP_TAC FINITE_DIFF THEN REWRITE_TAC[FINITE_J1_SY; FINITE_DELETE]; REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG;DIFF;DELETE] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN MRESA_TAC (GEN_ALL B_SY_LE_CSTAB)[`i:num`;`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`;] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; MP_TAC(SET_RULE`~(p,1 IN J1_SY s1 DELETE (p - 1,p)) ==> J1_SY (s1:stable_sy) DELETE (p - 1,p) = J1_SY s1 DELETE (p - 1,p) DELETE (p,1)`) THEN RESA_TAC THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) THEN SUBGOAL_THEN`J1_SY s1 DELETE (p - 1,p) DELETE (p,1) SUBSET J1_SY (s:stable_sy) DELETE (k,1)`ASSUME_TAC; MATCH_MP_TAC(SET_RULE`~(x IN A) /\ A SUBSET B==> A SUBSET B DELETE x`) THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(SET_RULE`~(x IN A) ==> ~(x IN A DELETE y)`) THEN MATCH_MP_TAC(SET_RULE`~(x IN A) ==> ~(x IN A DELETE y)`) THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;PAIR_EQ;IN_NUMSEG] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`1<= k-p ==> ~(k<=p)`) THEN RESA_TAC; ASM_REWRITE_TAC[REAL_ARITH` A1+ #0.1 * -- &1 * (C1+B) <=(A+ #0.1 * -- &1 *(C+B)) + D+ #0.1 * -- &1* E <=> A1+ #0.1 * -- &1 * (C1) <=(A+ #0.1 * -- &1 *(C)) + D+ #0.1 * -- &1* E `] THEN MATCH_MP_TAC(REAL_ARITH` A1<= A+D /\ &0<=C1-(C+E) ==> A1+ #0.1 * -- &1 * (C1) <=(A+ #0.1 * -- &1 *(C)) + D+ #0.1 * -- &1* E`) THEN STRIP_TAC; FIND_ASSUM MP_TAC `COVER2_SY s s1 (s2:stable_sy)` THEN REWRITE_TAC[COVER2_SY] THEN RESA_TAC; SUBGOAL_THEN`!x. x IN (J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1)) ==> (\x. cstab - norm (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P))) x = (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product)))) x` ASSUME_TAC; ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;DELETE;IN_NUMSEG] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) THEN RESA_TAC; MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]; MP_TAC(ARITH_RULE`i< p /\ 2

i=p -1 \/ SUC i p-1< p /\ SUC (p-1)=p`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; RESA_TAC THEN RESA_TAC THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[]; MRESA_TAC SUM_EQ[`(\x. cstab - norm (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P)))`;`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`(J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1))`] THEN EXPAND_TAC"l1" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN ASM_REWRITE_TAC[] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN SUBGOAL_THEN`!x. x IN (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)) ==> ((\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l))) o (\(x,y). p - 2 + x,p - 2 + y)) x = (\x. cstab - norm (row (FST x) (vecmats (l2:real^(N,3)finite_product)) - row (SND x) (vecmats l2))) x` ASSUME_TAC; ASM_REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM;o_DEF;IN_NUMSEG] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID;] THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`i<=k-p+2==> i=k-p+2 \/ i k - (k - p + 2) + i= p-2+i`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[]; MRESA_TAC SUM_EQ[` ((\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l))) o (\(x,y). p - 2 + x,p - 2 + y))`;`(\x. cstab - norm (row (FST x) (vecmats (l2:real^(N,3)finite_product)) - row (SND x) (vecmats l2)))`;`(J1_SY (s3:stable_sy) DELETE (k - p + 2,1))`] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN SUBGOAL_THEN`(!x y. x IN J1_SY s3 DELETE (k - p + 2,1) /\ y IN J1_SY (s3:stable_sy) DELETE (k - p + 2,1) /\ (\(x,y). p - 2 + x,p - 2 + y) x = (\(x,y). p - 2 + x,p - 2 + y) y ==> x = y)`ASSUME_TAC; REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ;ARITH_RULE`p-2+B=p-2+C<=> B=C`]; MRESA_TAC SUM_IMAGE[`(\(x,y). p - 2 + x,p - 2 + y)`;`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`J1_SY (s3:stable_sy) DELETE (k - p + 2,1)`] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN SUBGOAL_THEN`J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1) INTER (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1)))={}` ASSUME_TAC; ASM_REWRITE_TAC[SET_RULE`A ={} <=> ~(?a. a IN A)`; INTER;IN_ELIM_THM;J1_SY;DELETE;IMAGE;IN_NUMSEG] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ] THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) THEN RESA_TAC; POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]; MP_TAC(ARITH_RULE`i

i=p-1 \/ i< p-1:num`) THEN RESA_TAC; POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE` 2< p ==> p-1< p:num/\ SUC (p-1)=p`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; MP_TAC(ARITH_RULE`1<= i /\ i< p-1 /\ 1<= i' ==> ~(i= p-2+i')`) THEN RESA_TAC; MRESAL_TAC FINITE_IMAGE[`(\(x,y). p - 2 + x,p - 2 + y)`;`(J1_SY (s3:stable_sy) DELETE (k - p + 2,1))`][FINITE_J1_SY;FINITE_DELETE] THEN MRESAL_TAC (GEN_ALL SUM_UNION_EQ)[`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1)`;`(IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)))`;`J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1) UNION (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)))`][FINITE_UNION;FINITE_DELETE;FINITE_J1_SY] THEN MP_TAC(SET_RULE`IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1)) SUBSET J1_SY s /\ J1_SY s1 DELETE (p - 1,p) DELETE (p,1) SUBSET J1_SY s ==> J1_SY s1 DELETE (p - 1,p) DELETE (p,1) UNION (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1))) SUBSET J1_SY (s:stable_sy) `) THEN RESA_TAC THEN MRESAL_TAC SUM_DIFF[`(\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l)))`;`J1_SY(s:stable_sy) `;`J1_SY (s1:stable_sy) DELETE (p-1,p:num) DELETE (p:num,1) UNION (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1)))`][FINITE_J1_SY;FINITE_DELETE] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN MATCH_MP_TAC SUM_POS_LE THEN STRIP_TAC; MATCH_MP_TAC FINITE_DIFF THEN REWRITE_TAC[FINITE_J1_SY; FINITE_DELETE]; REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG;DIFF;DELETE] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN MRESA_TAC (GEN_ALL B_SY_LE_CSTAB)[`i:num`;`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`;] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]);; let F_SY_COVER_EQ=prove_by_refinement(`!(l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ 2

i=j) ==> (F_SY(vecmats l1) DELETE (row (p-1) (vecmats l1), row p (vecmats l1))) UNION (F_SY(vecmats l2) DELETE (row (k-p+2) (vecmats l2), row 1 (vecmats l2))) = F_SY(vecmats l)`, [REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THY") THEN REWRITE_TAC[F_SY;UNION;EXTENSION;IN_ELIM_THM;DELETE] THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p `) THEN RESA_TAC THEN GEN_TAC THEN EQ_TAC THEN RESA_TAC; EXPAND_TAC"l1" THEN REWRITE_TAC[VECMATS_MATVEC_ID] THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<=1 /\ 1

i= p-1 \/ SUC i< p`) THEN RESA_TAC; MP_TAC(ARITH_RULE` 2< p ==> p-1< p:num /\ SUC(p-1)=p`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; MP_TAC(ARITH_RULE` i< p /\ 1<= k-p ==> i< k:num /\ i<=k`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] THEN STRIP_TAC THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[] THEN REMOVE_THEN "THY" MP_TAC THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[]; POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`i <= k-p+2 ==> i=k-p+2 \/ i k - (k - p + 2) + i= p-2+i`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; MP_TAC(ARITH_RULE` i< k-p+2 /\ 1<= k-p /\ 2 p-2+ i< k:num /\ p-2+i <=k/\ 1<= p-2+i/\ p-2+ SUC i= SUC(p-2+i)`) THEN RESA_TAC THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] THEN MRESA_TAC MOD_LT[`p-2+i:num`;`k:num`] THEN DISCH_THEN(LABEL_TAC"THY") THEN STRIP_TAC THEN EXISTS_TAC`p-2+i` THEN ASM_REWRITE_TAC[]; DISJ_CASES_TAC(ARITH_RULE`i< p-1\/ p-1<= i`); MATCH_MP_TAC(SET_RULE`A==> A\/B`) THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i i< k /\ i<= p /\ i

1<= SUC i /\ SUC i <= p`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[] THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] THEN DISCH_THEN(LABEL_TAC"THY") THEN STRIP_TAC; EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[]; REMOVE_THEN "THY" MP_TAC THEN SUBGOAL_THEN`row (p-1) ((pmat1 (vecmats l)):real^3^P) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`2< p ==> p-1 <= p /\ 1<= p-1/\ p-1 row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<= p-1 /\ p-1<= k /\ ~(i=p-1)`) THEN RESA_TAC THEN REMOVE_THEN"THY"(fun th-> MRESA_TAC th[`i:num`;`p-1`]); MP_TAC(ARITH_RULE`i<= k ==> i=k \/ i< k:num`) THEN RESA_TAC; POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN MATCH_MP_TAC(SET_RULE`A==> A\/B`) THEN STRIP_TAC; EXISTS_TAC`p:num` THEN ASM_REWRITE_TAC[] THEN EXPAND_TAC"l1" THEN REWRITE_TAC[VECMATS_MATVEC_ID] THEN REMOVE_THEN "THY" MP_TAC THEN SUBGOAL_THEN`1<= p/\ p<= dimindex(:P)==> row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<=1 /\ 1

p-1 <= p /\ 1<= p-1/\ p-1 MRESA_TAC th[`k:num`;`p-1`]) THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`2< p /\ 1<= k-p ==> 1<= p-1 /\ ~(k=p-1)`) THEN RESA_TAC; MATCH_MP_TAC(SET_RULE`A==> B\/A`) THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`p-1<= i /\ 2< p/\ i< k /\ 1<= k-p ==> 1<= i- (p-2) /\ i-(p-2)<= k-p+2/\ k - (k - p + 2) = p-2 /\ i-(p-2)< k- p+2/\ SUC (i - (p - 2))= SUC i - (p - 2)/\ k<=k`) THEN RESA_TAC THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID] THEN REMOVE_THEN "THY" MP_TAC THEN SUBGOAL_THEN`row (i-(p-2)) ((pmat2 (vecmats l)):real^3^N) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE` 2

p-2 + i-(p-2) =i`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row (SUC i -(p-2)) ((pmat2 (vecmats l)):real^3^N) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

p-2 + SUC i -(p-2)= SUC i/\ 1<= SUC i -(p-2) /\ SUC i - (p-2)<= k-p+2`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; DISCH_THEN(LABEL_TAC"THY") THEN STRIP_TAC; EXISTS_TAC`i-(p-2)` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] THEN MRESA_TAC MOD_LT[`i-(p-2):num`;`k-p+2:num`]; POP_ASSUM MP_TAC THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID] THEN SUBGOAL_THEN`row (k-p+2) ((pmat2 (vecmats l)):real^3^N) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; DISCH_THEN(LABEL_TAC"THY") THEN ASM_REWRITE_TAC[PAIR_EQ] THEN STRIP_TAC THEN REMOVE_THEN"THY"(fun th->MRESA_TAC th[`i:num`;`k:num`]) THEN MP_TAC(ARITH_RULE`i ~(i=k:num)`) THEN RESA_TAC]);; let F_SY_COVER_INTER=prove_by_refinement(`!(l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ 2

i=j) ==> (F_SY(vecmats l1) DELETE (row (p-1) (vecmats l1), row p (vecmats l1))) INTER (F_SY(vecmats l2) DELETE (row (k-p+2) (vecmats l2), row 1 (vecmats l2))) = {} `, [REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THY") THEN REWRITE_TAC[F_SY;INTER;IN_ELIM_THM;DELETE;SET_RULE`A={}<=> ~(?a. a IN A)`] THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p `) THEN RESA_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THY1") THEN STRIP_TAC THEN REMOVE_THEN "THY1"MP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ] THEN EXPAND_TAC"l1" THEN EXPAND_TAC"l2" THEN REWRITE_TAC[VECMATS_MATVEC_ID] THEN REMOVE_THEN "THY" MP_TAC THEN SUBGOAL_THEN`1<= p/\ p<= dimindex(:P)==> row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p k - (k - p + 2) + i'= p-2+i'`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i k<=k /\ 1<= p-2+i' /\ p-2+i'<=k/\ ~(i'=0)`) THEN RESA_TAC THEN REMOVE_THEN "THY"(fun th-> MRESA_TAC th[`k:num`;`p-2+i'`] THEN POP_ASSUM MP_TAC THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"THY")) THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`k = p - 2 + i'/\ 2

i'= k-p+2`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN MRESAL_TAC MOD_MULT[`i':num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN REMOVE_THEN"THY1"MP_TAC THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0=1`] THEN REMOVE_THEN"THY" MP_TAC THEN SUBGOAL_THEN`row 1 ((pmat2 (vecmats l)):real^3^N) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + 1= p-1/\ 1<=1 /\ 1<=k-p+2`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; SUBGOAL_THEN`row 1 ((pmat1 (vecmats l)):real^3^P) = row 1 (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; MP_TAC(ARITH_RULE`2 1<=1 /\ 1

MRESA_TAC th[`1:num`;`p-1`] ) THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`2< p /\ 1<= k-p ==> 1<=1 /\ 1<= p-1 /\ p-1<=k /\ ~(1=p-1)`) THEN RESA_TAC; SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"THY") THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THY1") THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THY") THEN STRIP_TAC THEN STRIP_TAC THEN REMOVE_THEN "THY"(fun th-> MRESA_TAC th[`i:num`;`p-2+i'`] ) THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`i

i <= k /\ 1 <= p - 2 + i' /\ p - 2 + i' <= k /\ p-1<= p-2+i'`) THEN RESA_TAC THEN MP_TAC(ARITH_RULE`i

(i=p-1 /\ i'=1) \/ i< p-2+i'`) THEN RESA_TAC; REMOVE_THEN"THY1"MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i

p-1

(row (p - 1) (vecmats l1),row p (vecmats l1)) IN F_SY (vecmats l1)`, REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[F_SY;IN_ELIM_THM] THEN EXISTS_TAC`p-1` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`2 p-1

ear_sy s3) /\ DIA_SY 0 (p-1) s /\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 /\ COVER_SY 0 (p-1) s s1 s2 /\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) /\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} ==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) /\ matvec(pmat1(vecmats l))= l1 /\ matvec(pmat2(vecmats l))= l2 /\ 1<= i /\ i<= k-p+2 ==> row i (vecmats l2) = row (p-2+i ) (vecmats l)`, REPEAT STRIP_TAC THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 k - (k - p + 2) + i= p-2+i`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]);; let PMAT1_EQ_SY=prove(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) /\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) /\ (ear_sy s2 <=> ear_sy s3) /\ DIA_SY 0 (p-1) s /\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 /\ COVER_SY 0 (p-1) s s1 s2 /\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) /\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} ==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) /\ matvec(pmat1(vecmats l))= l1 /\ matvec(pmat2(vecmats l))= l2 /\ 1<= i /\ i<= p-1 ==> row i (vecmats l1) = row i (vecmats l)`, REPEAT STRIP_TAC THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 i<= p /\ i< p`) THEN RESA_TAC THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]);; let PMAT1_EQ_SY_P=prove(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) /\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) /\ (ear_sy s2 <=> ear_sy s3) /\ DIA_SY 0 (p-1) s /\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 /\ COVER_SY 0 (p-1) s s1 s2 /\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) /\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} ==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) /\ matvec(pmat1(vecmats l))= l1 /\ matvec(pmat2(vecmats l))= l2 ==> row p (vecmats l1) = row k (vecmats l)`, REPEAT STRIP_TAC THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC THENL[ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p ITER (i-1) (rho_node1 (F_SY (vecmats l))) v=u`, [INDUCT_TAC; ARITH_TAC; POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THY") THEN REPEAT GEN_TAC THEN DISJ_CASES_TAC(ARITH_RULE`i=0 \/ 1<=i`); ASM_REWRITE_TAC[ARITH_RULE`1-1=0/\ SUC 0=1`;ITER] THEN RESA_TAC THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); STRIP_TAC THEN MP_TAC(ARITH_RULE`1<=i /\ SUC i <= dimindex(:M) ==> SUC i- 1= SUC(i-1) /\ i<= dimindex(:M) /\ i< dimindex(:M)`) THEN RESA_TAC THEN REMOVE_THEN "THY"(fun th-> MRESA_TAC th[`row i (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`]) THEN ASM_REWRITE_TAC[ITER] THEN MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) THEN EXISTS_TAC`V_SY (vecmats (l:real^(M,3)finite_product))` THEN EXISTS_TAC`E_SY (vecmats (l:real^(M,3)finite_product))` THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC EDGE_IN_F_SY THEN ASM_REWRITE_TAC[] THEN MRESA_TAC MOD_LT[`i:num`;`dimindex(:M)`]]);; let RHO_NODE_K_SY=prove(`!(l:real^(M,3)finite_product). local_fan (V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l),F_SY (vecmats l)) /\ dimindex(:M)=k /\ row k (vecmats l)=u /\ row 1 (vecmats l)=v ==> (rho_node1 (F_SY (vecmats l))) u=v`, REPEAT STRIP_TAC THEN MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) THEN EXISTS_TAC`V_SY (vecmats (l:real^(M,3)finite_product))` THEN EXISTS_TAC`E_SY (vecmats (l:real^(M,3)finite_product))` THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC (GEN_ALL EDGE_IN_F_SY) THEN EXISTS_TAC`k:num` THEN ASM_REWRITE_TAC[] THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MP_TAC(ARITH_RULE`1<=k==> k<=k /\ ~(k=0)/\ SUC 0=1`) THEN RESA_TAC THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]);; let RHO_NODE_SY=prove(`!i (l:real^(M,3)finite_product). local_fan (V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l),F_SY (vecmats l)) /\ 1<= i /\ i<= dimindex (:M) ==> (rho_node1 (F_SY (vecmats l))) (row i (vecmats l))=row (SUC (i MOD dimindex (:M))) (vecmats l)`, REPEAT STRIP_TAC THEN MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) THEN EXISTS_TAC`V_SY (vecmats (l:real^(M,3)finite_product))` THEN EXISTS_TAC`E_SY (vecmats (l:real^(M,3)finite_product))` THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC (GEN_ALL EDGE_IN_F_SY) THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[] THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MP_TAC(ARITH_RULE`1<=k==> k<=k /\ ~(k=0)/\ SUC 0=1`) THEN RESA_TAC THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]);; let ORDER_COVER1_SY=prove(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) /\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) /\ (ear_sy s2 <=> ear_sy s3) /\ DIA_SY 0 (p-1) s /\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 /\ COVER_SY 0 (p-1) s s1 s2 /\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) /\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} ==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) /\ matvec(pmat1(vecmats l))= l1 /\ matvec(pmat2(vecmats l))= l2 /\ row k (vecmats l)= v /\ row (p-1) (vecmats l)= w ==> order (rho_node1 (F_SY (vecmats l))) v w = p-1`, REPEAT GEN_TAC THEN STRIP_TAC THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MP_TAC(ARITH_RULE`2

1<= p-1 /\ p-1<=k/\ p-1= SUC(p-1-1)`) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`p-1`;`w:real^3`;`l:real^(M,3)finite_product`] THEN STRIP_TAC THENL[ POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THY") THEN STRIP_TAC THEN REMOVE_THEN"THY"(fun th-> ONCE_REWRITE_TAC[th;]) THEN REWRITE_TAC[POWER;o_DEF] THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`]; STRIP_TAC THENL[ REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`0 1<=i /\ i<=k/\ i= SUC(i-1)`) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`i:num`;`row i (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THY") THEN STRIP_TAC THEN REMOVE_THEN"THY"(fun th-> ONCE_REWRITE_TAC[th;]) THEN REWRITE_TAC[POWER;o_DEF] THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN STRIP_TAC THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`p-1:num`]) THEN MP_TAC(ARITH_RULE`i< p-1 ==> ~(i=p-1)`) THEN RESA_TAC; STRIP_TAC THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1:num`]) THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`1<= k-p ==> k<=k/\ ~(k=p-1)`) THEN RESA_TAC]]);; let SLICEV_EQ_V_SY=prove_by_refinement(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) /\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) /\ (ear_sy s2 <=> ear_sy s3) /\ DIA_SY 0 (p-1) s /\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 /\ COVER_SY 0 (p-1) s s1 s2 /\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) /\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} ==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) /\ matvec(pmat1(vecmats l))= l1 /\ matvec(pmat2(vecmats l))= l2 /\ row k (vecmats l)= v /\ row (p-1) (vecmats l)= w ==> slicev (E_SY (vecmats l)) (F_SY (vecmats l)) v w = V_SY(vecmats l1)`, [REPEAT GEN_TAC THEN STRIP_TAC THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MP_TAC(ARITH_RULE`0 1<=n /\ n<=k/\ n<=p/\ n= SUC(n-1)`) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`n:num`;`row n (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THY") THEN STRIP_TAC THEN REMOVE_THEN"THY"(fun th-> ONCE_REWRITE_TAC[th;]) THEN REWRITE_TAC[POWER;o_DEF] THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN EXISTS_TAC`n:num` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`n:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i<= p ==> i=p \/ i< p:num`) THEN RESA_TAC; ASM_REWRITE_TAC[ITER] THEN EXISTS_TAC`0:num` THEN ASM_REWRITE_TAC[ITER;ARITH_RULE`0<=0`] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MP_TAC(ARITH_RULE`2 0<= p-1`) THEN RESA_TAC; FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;convex_local_fan;] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`1<=i /\ i< p /\ 1<= k-p ==> 0<=i/\ 1<=i /\ i<=p-1/\ i<=k/\ i= SUC(i-1)`) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`i:num`;`row i (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THY") THEN STRIP_TAC THEN REMOVE_THEN"THY"(fun th-> ONCE_REWRITE_TAC[th;]) THEN REWRITE_TAC[POWER;o_DEF] THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN MP_TAC(ARITH_RULE`1<=i /\ i< p /\ 1<= k-p ==> SUC(i-1)=i`) THEN RESA_TAC THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]]);; let SLICEE_EQ_E_SY=prove_by_refinement(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) /\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) /\ (ear_sy s2 <=> ear_sy s3) /\ DIA_SY 0 (p-1) s /\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 /\ COVER_SY 0 (p-1) s s1 s2 /\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) /\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} ==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) /\ matvec(pmat1(vecmats l))= l1 /\ matvec(pmat2(vecmats l))= l2 /\ row k (vecmats l)= v /\ row (p-1) (vecmats l)= w ==> slicee (E_SY (vecmats l)) (F_SY (vecmats l)) v w = E_SY(vecmats l1)`, [REPEAT GEN_TAC THEN STRIP_TAC THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MP_TAC(ARITH_RULE`2

i<= k/\ 1<=1/\ 1<= p-1 `) THEN RESA_TAC THEN MRESA_TAC (GEN_ALL RHO_NODE_SY)[`i:num`;`l:real^(M,3)finite_product`] THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i SUBST_ALL_TAC(th)) THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN EXISTS_TAC`p:num` THEN ASM_REWRITE_TAC[] THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; MP_TAC(ARITH_RULE`1<=i /\ i< p /\ 1<= k-p ==> 0<=i/\ 1<=i /\ i<=p-1/\ i i= p-1 \/ SUC i<= p-1`) THEN RESA_TAC; POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN ASM_TAC THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`SUC(i):num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; EXISTS_TAC`p-1` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`2

p-1<= p/\ 1<=p-1/\ p-1

REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MP_TAC(ARITH_RULE`2

i<= k/\ 1<=1/\ 1<= p-1 `) THEN RESA_TAC THEN MP_TAC(ARITH_RULE`i<=p ==> i= p \/ i< p:num`) THEN RESA_TAC; MATCH_MP_TAC (SET_RULE`A==> A\/B`) THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN EXISTS_TAC`v:real^3` THEN ASM_REWRITE_TAC[] THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN STRIP_TAC; EXISTS_TAC`p:num` THEN ASM_REWRITE_TAC[]; STRIP_TAC THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1:num`;`k:num`]) THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`1<= k-p /\ 2< p==> p-1<=k /\ k<=k /\ ~(p-1=k)`) THEN RESA_TAC; MP_TAC(ARITH_RULE`i

i= p-1 \/ SUC i<= p-1`) THEN RESA_TAC; POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN MATCH_MP_TAC(SET_RULE`A==> B\/A`) THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`2

p-1<= p/\ 1<=p-1/\ p-1

A\/B`) THEN MP_TAC(ARITH_RULE`1<=i /\ i< p /\ 1<= k-p ==> 0<=i/\ 1<=i /\ i<=p-1/\ i 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1:num`;`i:num`]) THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`1<= k-p /\ 2< p /\ SUC i<= p-1 ==> p-1<=k /\ ~(p-1=i)`) THEN RESA_TAC]);; let SLICEF_EQ_F_SY=prove_by_refinement(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) /\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) /\ (ear_sy s2 <=> ear_sy s3) /\ DIA_SY 0 (p-1) s /\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 /\ COVER_SY 0 (p-1) s s1 s2 /\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) /\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} ==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) /\ matvec(pmat1(vecmats l))= l1 /\ matvec(pmat2(vecmats l))= l2 /\ row k (vecmats l)= v /\ row (p-1) (vecmats l)= w ==> slicef (E_SY (vecmats l)) (F_SY (vecmats l)) v w = F_SY(vecmats l1)`, [REPEAT GEN_TAC THEN STRIP_TAC THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MP_TAC(ARITH_RULE`2

i<= k/\ 1<=1/\ 1<= p-1 `) THEN RESA_TAC THEN MRESA_TAC (GEN_ALL RHO_NODE_SY)[`i:num`;`l:real^(M,3)finite_product`] THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i SUBST_ALL_TAC(th)) THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN EXISTS_TAC`p:num` THEN ASM_REWRITE_TAC[] THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; MP_TAC(ARITH_RULE`1<=i /\ i< p /\ 1<= k-p ==> 0<=i/\ 1<=i /\ i<=p-1/\ i i= p-1 \/ SUC i<= p-1`) THEN RESA_TAC; POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN ASM_TAC THEN REPEAT RESA_TAC; MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`SUC(i):num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; REWRITE_TAC[F_SY;IN_ELIM_THM] THEN ASM_REWRITE_TAC[] THEN EXISTS_TAC`p-1` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`2

p-1<= p/\ 1<=p-1/\ p-1

REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MP_TAC(ARITH_RULE`2

i<= k/\ 1<=1/\ 1<= p-1 `) THEN RESA_TAC THEN MP_TAC(ARITH_RULE`i<=p ==> i= p \/ i< p:num`) THEN RESA_TAC; MATCH_MP_TAC (SET_RULE`A==> A\/B`) THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN EXISTS_TAC`v:real^3` THEN ASM_REWRITE_TAC[] THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN STRIP_TAC; EXISTS_TAC`p:num` THEN ASM_REWRITE_TAC[]; STRIP_TAC THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1:num`;`k:num`]) THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`1<= k-p /\ 2< p==> p-1<=k /\ k<=k /\ ~(p-1=k)`) THEN RESA_TAC; MP_TAC(ARITH_RULE`i

i= p-1 \/ SUC i<= p-1`) THEN RESA_TAC; POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN MATCH_MP_TAC(SET_RULE`A==> B\/A`) THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`2

p-1<= p/\ 1<=p-1/\ p-1

A\/B`) THEN MP_TAC(ARITH_RULE`1<=i /\ i< p /\ 1<= k-p ==> 0<=i/\ 1<=i /\ i<=p-1/\ i 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1:num`;`i:num`]) THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`1<= k-p /\ 2< p /\ SUC i<= p-1 ==> p-1<=k /\ ~(p-1=i)`) THEN RESA_TAC]);; let ORDER_COVER2_SY=prove(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) /\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) /\ (ear_sy s2 <=> ear_sy s3) /\ DIA_SY 0 (p-1) s /\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 /\ COVER_SY 0 (p-1) s s1 s2 /\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) /\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} ==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) /\ matvec(pmat1(vecmats l))= l1 /\ matvec(pmat2(vecmats l))= l2 /\ row k (vecmats l)= v /\ row (p-1) (vecmats l)= w ==> order (rho_node1 (F_SY (vecmats l))) w v = k-p+1`, REPEAT GEN_TAC THEN STRIP_TAC THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MP_TAC(ARITH_RULE`2

1<= p-1 /\ p-1<=k/\ p-1= SUC(p-1-1) /\ (k - p + 1) + p - 1 - 1 =k-1`) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`p-1`;`w:real^3`;`l:real^(M,3)finite_product`] THEN STRIP_TAC THENL[POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THY") THEN STRIP_TAC THEN REWRITE_TAC[POWER;o_DEF] THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;GSYM Hypermap.lemma_add_exponent_function]) THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`k:num`;`v:real^3`;`l:real^(M,3)finite_product`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] THEN STRIP_TAC THEN POP_ASSUM MATCH_MP_TAC THEN ARITH_TAC; STRIP_TAC THENL[ POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THY") THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`0 1<=i+p-1 /\ i+p-1<=k/\ i= SUC(i-1)/\ (i + p - 1) - 1 =i + p - 1 - 1`) THEN RESA_TAC THEN REMOVE_THEN"THY"(fun th-> ASM_REWRITE_TAC[SYM th;GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER;GSYM Hypermap.lemma_add_exponent_function]) THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`i+p-1:num`;`row (i+p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] THEN RESA_TAC THEN STRIP_TAC THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`i+p-1:num`;`k:num`]) THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`i< k-p+1 /\2

~(i+p-1=k) /\ k<=k`) THEN RESA_TAC; STRIP_TAC THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1:num`]) THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`1<= k-p ==> k<=k/\ ~(k=p-1)`) THEN RESA_TAC]]);; let SLICEV_EQ_V2_SY=prove(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) /\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) /\ (ear_sy s2 <=> ear_sy s3) /\ DIA_SY 0 (p-1) s /\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 /\ COVER_SY 0 (p-1) s s1 s2 /\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) /\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} ==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) /\ matvec(pmat1(vecmats l))= l1 /\ matvec(pmat2(vecmats l))= l2 /\ row k (vecmats l)= v /\ row (p-1) (vecmats l)= w ==> slicev (E_SY (vecmats l)) (F_SY (vecmats l)) w v = V_SY(vecmats l2)`, REPEAT GEN_TAC THEN STRIP_TAC THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MP_TAC(ARITH_RULE`2

1<= p-1 /\ p-1<=k/\ p-1= SUC(p-1-1) /\ (k - p + 1) + p - 1 - 1 =k-1/\ 1<= n+p-1 /\ n+p-1<=k /\ (n+p-1)-1=n+p-1-1 /\ 1<= n+1 /\ n+1<= k-p+2/\ p-2+n+1=n+p-1`) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`p-1`;`w:real^3`;`l:real^(M,3)finite_product`] THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER;GSYM Hypermap.lemma_add_exponent_function]) THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`n+p-1:num`;`row (n+p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] THEN RESA_TAC THEN EXISTS_TAC`n+1` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`n+1`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; RESA_TAC THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;convex_local_fan;] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN EXISTS_TAC`i-1` THEN MP_TAC(ARITH_RULE`2

0<= i-1 /\ i-1<=k-p+1/\ 1<= p-1 /\ p-1<=k/\ 1<=p-2+i /\ p-2+i<=k /\ (p - 2 + i) - 1=i - 1 + p - 1 - 1`) THEN RESA_TAC THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`p-1`;`w:real^3`;`l:real^(M,3)finite_product`] THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER;GSYM Hypermap.lemma_add_exponent_function]) THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`p-2+i:num`;`row (p-2+i) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] THEN RESA_TAC]);; let SLICEE_EQ_E2_SY=prove_by_refinement(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) /\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) /\ (ear_sy s2 <=> ear_sy s3) /\ DIA_SY 0 (p-1) s /\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 /\ COVER_SY 0 (p-1) s s1 s2 /\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) /\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} ==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) /\ matvec(pmat1(vecmats l))= l1 /\ matvec(pmat2(vecmats l))= l2 /\ row k (vecmats l)= v /\ row (p-1) (vecmats l)= w ==> slicee (E_SY (vecmats l)) (F_SY (vecmats l)) w v = E_SY(vecmats l2)`, [REPEAT GEN_TAC THEN STRIP_TAC THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MP_TAC(ARITH_RULE`2

1<=p-2+i /\ p-2+i<=k `) THEN RESA_TAC THEN MRESA_TAC (GEN_ALL RHO_NODE_SY)[`p-2+i:num`;`l:real^(M,3)finite_product`] THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i<= k-p+2==> i= k-p+2 \/ i< k-p+2`) THEN RESA_TAC; POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`2

p-2+k-p+2=k`) THEN RESA_TAC THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN RESA_TAC; MP_TAC(ARITH_RULE`2

p-2+i p-2+k-p+2=k/\ k-p+2<=k-p+2/\ 1<=1/\ p-2+1=p-1`) THEN RESA_TAC THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`k-p+2`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`1`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; RESA_TAC THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MP_TAC(ARITH_RULE`i<=k-p+2==> i= k-p+2 \/ i< k-p+2`) THEN RESA_TAC; MATCH_MP_TAC(SET_RULE`A==> B\/A`) THEN MP_TAC(ARITH_RULE`1<=k-p /\ 2 p-2+k-p+2=k/\ k-p+2<=k-p+2/\ 1<=1/\ p-2+1=p-1`) THEN RESA_TAC THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`1`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; MATCH_MP_TAC(SET_RULE`A==> A\/B`) THEN MP_TAC(ARITH_RULE`2

p-2+i REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MP_TAC(ARITH_RULE`2

1<=p-2+i /\ p-2+i<=k `) THEN RESA_TAC THEN MRESA_TAC (GEN_ALL RHO_NODE_SY)[`p-2+i:num`;`l:real^(M,3)finite_product`] THEN STRIP_TAC; EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[]; STRIP_TAC THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-2+i:num`]) THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`1<= k-p/\ i< k-p+2 /\ 2

k<=k/\ ~(k=p-2+i)`) THEN RESA_TAC]);; let SLICEF_EQ_F2_SY=prove_by_refinement(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) /\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) /\ (ear_sy s2 <=> ear_sy s3) /\ DIA_SY 0 (p-1) s /\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 /\ COVER_SY 0 (p-1) s s1 s2 /\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) /\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} ==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) /\ matvec(pmat1(vecmats l))= l1 /\ matvec(pmat2(vecmats l))= l2 /\ row k (vecmats l)= v /\ row (p-1) (vecmats l)= w ==> slicef (E_SY (vecmats l)) (F_SY (vecmats l)) w v = F_SY(vecmats l2)`, [REPEAT GEN_TAC THEN STRIP_TAC THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MP_TAC(ARITH_RULE`2

1<=p-2+i /\ p-2+i<=k `) THEN RESA_TAC THEN MRESA_TAC (GEN_ALL RHO_NODE_SY)[`p-2+i:num`;`l:real^(M,3)finite_product`] THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i<= k-p+2==> i= k-p+2 \/ i< k-p+2`) THEN RESA_TAC; POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`2

p-2+k-p+2=k`) THEN RESA_TAC THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN RESA_TAC; MP_TAC(ARITH_RULE`2

p-2+i p-2+k-p+2=k/\ k-p+2<=k-p+2/\ 1<=1/\ p-2+1=p-1`) THEN RESA_TAC THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`k-p+2`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`1`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[F_SY;IN_ELIM_THM] THEN RESA_TAC THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MP_TAC(ARITH_RULE`i<=k-p+2==> i= k-p+2 \/ i< k-p+2`) THEN RESA_TAC; MATCH_MP_TAC(SET_RULE`A==> B\/A`) THEN MP_TAC(ARITH_RULE`1<=k-p /\ 2 p-2+k-p+2=k/\ k-p+2<=k-p+2/\ 1<=1/\ p-2+1=p-1`) THEN RESA_TAC THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`1`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; MATCH_MP_TAC(SET_RULE`A==> A\/B`) THEN MP_TAC(ARITH_RULE`2

p-2+i REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MP_TAC(ARITH_RULE`2

1<=p-2+i /\ p-2+i<=k `) THEN RESA_TAC THEN MRESA_TAC (GEN_ALL RHO_NODE_SY)[`p-2+i:num`;`l:real^(M,3)finite_product`] THEN STRIP_TAC; EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[]; STRIP_TAC THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-2+i:num`]) THEN POP_ASSUM MP_TAC THEN MP_TAC(ARITH_RULE`1<= k-p/\ i< k-p+2 /\ 2

k<=k/\ ~(k=p-2+i)`) THEN RESA_TAC]);; let TAU_STAR_COVER_concl=`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) /\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) /\ (ear_sy s2 <=> ear_sy s3) /\ DIA_SY 0 (p-1) s /\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 /\ COVER_SY 0 (p-1) s s1 s2 /\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) /\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} ==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) /\ matvec(pmat1(vecmats l))= l1 /\ matvec(pmat2(vecmats l))= l2 /\ row k (vecmats l)= v /\ row (p-1) (vecmats l)= w /\ (!u u1. u IN {v, w} /\ u1 IN V_SY(vecmats l) /\ ~(u = u1) ==> ~collinear {vec 0, u, u1}) ==> tau_star s1 l1 + tau_star s3 l2 <= tau_star s l` ;; let TAU_STAR_COVER_concl2 = mk_imp (EJRCFJD_concl, TAU_STAR_COVER_concl);; let TAU_STAR_COVER=prove_by_refinement(TAU_STAR_COVER_concl2, [DISCH_THEN(LABEL_TAC"THY") THEN REPEAT STRIP_TAC THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 p - 2 + k - p + 2= k/\ p-2+1=p-1 /\ 1<=p-1 /\ p-1<=k /\ p-1 {A,B}SUBSET C`) THEN STRIP_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM;V_SY;rows]; EXISTS_TAC`k:num` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC; EXISTS_TAC`p-1` THEN ASM_REWRITE_TAC[]; SUBGOAL_THEN`norm (v - w:real^3) <= cstab`ASSUME_TAC; MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] THEN FIND_ASSUM (fun th-> MP_TAC(ISPECL [`k:num`;`p-1`]th))`!i j. {i MOD k, j MOD k} IN J_SY s UNION {{0, p - 1}} ==> norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= cstab` THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th; SET_RULE`{0,p-1} IN J_SY s UNION {{0,p-1}}`]) THEN ASM_REWRITE_TAC[]; SUBGOAL_THEN`~({v, w} IN E_SY (vecmats (l:real^(M,3)finite_product)))`ASSUME_TAC; ASM_REWRITE_TAC[E_SY;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;convex_local_fan;local_fan] THEN LET_TAC THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`row (i) (vecmats(l:real^(M,3)finite_product))`;` (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(l:real^(M,3)finite_product)`] THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;` (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`row i (vecmats(l:real^(M,3)finite_product))`] THEN DISJ_CASES_TAC(SET_RULE`row k (vecmats l)= row (p - 1) (vecmats l) \/ ~(row k (vecmats l)= row (p - 1) (vecmats (l:real^(M,3)finite_product)))`); MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN RESA_TAC; POP_ASSUM MP_TAC THEN RESA_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`1 <= SUC (i' MOD dimindex (:M)) /\ SUC (i' MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] THEN MRESAL_TAC DIVISION[`i':num`;`dimindex (:M):num`][DIMINDEX_NONZERO] THEN POP_ASSUM MP_TAC THEN ARITH_TAC; POP_ASSUM MP_TAC THEN RESA_TAC THEN MP_TAC(SET_RULE`{row k (vecmats l), row (p - 1) (vecmats l)} = {row i (vecmats l), row (SUC (i MOD k)) (vecmats l)} /\ ~(row k (vecmats l) = row (p - 1) (vecmats l)) /\ ~(row i (vecmats l) = row (SUC (i MOD k)) (vecmats l)) ==> (row i (vecmats l) = row (k) (vecmats l) /\ row (p-1) (vecmats l) = row (SUC (i MOD k)) (vecmats l)) \/ (row i (vecmats l) = row (p-1) (vecmats l) /\ row (k) (vecmats l) = row (SUC (i MOD k)) (vecmats (l:real^(M,3)finite_product)))`) THEN RESA_TAC; MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`k:num`] THEN MRESA_TAC th[`p-1:num`;`SUC(i MOD k):num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN MP_TAC(ARITH_RULE`2 ~(p-1=1)/\ 1<=1`) THEN RESA_TAC; MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`p-1:num`] THEN MRESA_TAC th[`k:num`;`SUC(i MOD k):num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] THEN MP_TAC(ARITH_RULE`2

~(k= SUC (p-1))/\ 1<= SUC(p-1)/\ SUC(p-1)<=k`) THEN RESA_TAC; MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d_sy (s:stable_sy)`;`J_SY (s:stable_sy)`;`k_sy (s:stable_sy)`;`k:num`;`p-1:num`;`a_sy (s:stable_sy)`;`b_sy (s:stable_sy)`;`row k (vecmats (l:real^(M,3)finite_product))`;`row (p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN MRESAL_TAC(GEN_ALL TECOXBM1)[`d_sy (s:stable_sy)`;`J_SY(s:stable_sy)`;`k:num`;`a_sy(s:stable_sy)`;`b_sy(s:stable_sy)`;`row k (vecmats (l:real^(M,3)finite_product))`;`row (p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`][SET_RULE`{A} UNION {B,C}={A,B,C}`] THEN MP_TAC(SET_RULE`{v, w} SUBSET V_SY (vecmats l)==> v IN V_SY (vecmats l) /\ w IN V_SY (vecmats (l:real^(M,3)finite_product))`) THEN RESA_TAC THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MRESA_TAC (GEN_ALL SLICEV_EQ_V_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL SLICEE_EQ_E_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL SLICEF_EQ_F_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL SLICEF_EQ_F2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL SLICEE_EQ_E2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL SLICEV_EQ_V2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN REMOVE_THEN"THY"(fun th-> MRESA_TAC th[`V_SY(vecmats (l:real^(M,3)finite_product))`;`E_SY(vecmats (l:real^(M,3)finite_product))`;`F_SY(vecmats (l:real^(M,3)finite_product))`; `v:real^3`;`w:real^3`]) THEN MRESA_TAC(GEN_ALL D_FUN_COVER_SY)[`k:num`;`p:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]);; let IN_B_SY_COVER_concl=`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) /\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) /\ (ear_sy s2 <=> ear_sy s3) /\ DIA_SY 0 (p-1) s /\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 /\ COVER_SY 0 (p-1) s s1 s2 /\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) /\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} ==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) /\ matvec(pmat1(vecmats l))= l1 /\ matvec(pmat2(vecmats l))= l2 /\ row k (vecmats l)= v /\ row (p-1) (vecmats l)= w /\ (!u u1. u IN {v, w} /\ u1 IN V_SY(vecmats l) /\ ~(u = u1) ==> ~collinear {vec 0, u, u1}) /\ norm(v-w)<= min (b_sy s1 (p-1,0)) (b_sy s2 (p-1,0)) ==> l1 IN (B_SY1 (a_sy s1) (b_sy s1))`;; let IN_B_SY_COVER_concl2 = mk_imp (EJRCFJD_concl, IN_B_SY_COVER_concl);; let IN_B_SY_COVER=prove_by_refinement(IN_B_SY_COVER_concl2, [DISCH_THEN(LABEL_TAC"THY") THEN REPEAT STRIP_TAC THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 p - 2 + k - p + 2= k/\ p-2+1=p-1 /\ 1<=p-1 /\ p-1<=k /\ p-1 {A,B}SUBSET C`) THEN STRIP_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM;V_SY;rows]; EXISTS_TAC`k:num` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC; EXISTS_TAC`p-1` THEN ASM_REWRITE_TAC[]; SUBGOAL_THEN`norm (v - w:real^3) <= cstab`ASSUME_TAC; MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] THEN FIND_ASSUM (fun th-> MP_TAC(ISPECL [`k:num`;`p-1`]th))`!i j. {i MOD k, j MOD k} IN J_SY s UNION {{0, p - 1}} ==> norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= cstab` THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th; SET_RULE`{0,p-1} IN J_SY s UNION {{0,p-1}}`]) THEN ASM_REWRITE_TAC[]; SUBGOAL_THEN`~({v, w} IN E_SY (vecmats (l:real^(M,3)finite_product)))`ASSUME_TAC; ASM_REWRITE_TAC[E_SY;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;convex_local_fan;local_fan] THEN LET_TAC THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`row (i) (vecmats(l:real^(M,3)finite_product))`;` (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(l:real^(M,3)finite_product)`] THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;` (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`row i (vecmats(l:real^(M,3)finite_product))`] THEN DISJ_CASES_TAC(SET_RULE`row k (vecmats l)= row (p - 1) (vecmats l) \/ ~(row k (vecmats l)= row (p - 1) (vecmats (l:real^(M,3)finite_product)))`); MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN RESA_TAC; POP_ASSUM MP_TAC THEN RESA_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`1 <= SUC (i' MOD dimindex (:M)) /\ SUC (i' MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] THEN MRESAL_TAC DIVISION[`i':num`;`dimindex (:M):num`][DIMINDEX_NONZERO] THEN POP_ASSUM MP_TAC THEN ARITH_TAC; POP_ASSUM MP_TAC THEN RESA_TAC THEN MP_TAC(SET_RULE`{row k (vecmats l), row (p - 1) (vecmats l)} = {row i (vecmats l), row (SUC (i MOD k)) (vecmats l)} /\ ~(row k (vecmats l) = row (p - 1) (vecmats l)) /\ ~(row i (vecmats l) = row (SUC (i MOD k)) (vecmats l)) ==> (row i (vecmats l) = row (k) (vecmats l) /\ row (p-1) (vecmats l) = row (SUC (i MOD k)) (vecmats l)) \/ (row i (vecmats l) = row (p-1) (vecmats l) /\ row (k) (vecmats l) = row (SUC (i MOD k)) (vecmats (l:real^(M,3)finite_product)))`) THEN RESA_TAC; MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`k:num`] THEN MRESA_TAC th[`p-1:num`;`SUC(i MOD k):num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN MP_TAC(ARITH_RULE`2 ~(p-1=1)/\ 1<=1`) THEN RESA_TAC; MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`p-1:num`] THEN MRESA_TAC th[`k:num`;`SUC(i MOD k):num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] THEN MP_TAC(ARITH_RULE`2

~(k= SUC (p-1))/\ 1<= SUC(p-1)/\ SUC(p-1)<=k`) THEN RESA_TAC; MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d_sy (s:stable_sy)`;`J_SY (s:stable_sy)`;`k_sy (s:stable_sy)`;`k:num`;`p-1:num`;`a_sy (s:stable_sy)`;`b_sy (s:stable_sy)`;`row k (vecmats (l:real^(M,3)finite_product))`;`row (p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN MRESAL_TAC(GEN_ALL TECOXBM1)[`d_sy (s:stable_sy)`;`J_SY(s:stable_sy)`;`k:num`;`a_sy(s:stable_sy)`;`b_sy(s:stable_sy)`;`row k (vecmats (l:real^(M,3)finite_product))`;`row (p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`][SET_RULE`{A} UNION {B,C}={A,B,C}`] THEN MP_TAC(SET_RULE`{v, w} SUBSET V_SY (vecmats l)==> v IN V_SY (vecmats l) /\ w IN V_SY (vecmats (l:real^(M,3)finite_product))`) THEN RESA_TAC THEN MRESA_TAC (GEN_ALL SLICEV_EQ_V_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL SLICEE_EQ_E_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL SLICEF_EQ_F_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL SLICEF_EQ_F2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL SLICEE_EQ_E2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL SLICEV_EQ_V2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_THEN"THY"(fun th-> MRESA_TAC th[`V_SY(vecmats (l:real^(M,3)finite_product))`;`E_SY(vecmats (l:real^(M,3)finite_product))`;`F_SY(vecmats (l:real^(M,3)finite_product))`; `v:real^3`;`w:real^3`]) THEN EXISTS_TAC`vecmats(l1:real^(P,3)finite_product)` THEN ASM_REWRITE_TAC[MATVEC_VECMATS_ID] THEN STRIP_TAC; REPEAT STRIP_TAC THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i<= p-1:num`) THEN RESA_TAC; MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th`k:num`); MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th`i:num`) THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"MA") THEN STRIP_TAC THEN STRIP_TAC THEN REMOVE_THEN"MA" MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`i<=p /\1<=k-p ==> i<=k`) THEN RESA_TAC; ASM_REWRITE_TAC[CONDITION1_SY] THEN FIND_ASSUM MP_TAC`COVER_SY 0 (p - 1) s s1 (s2:stable_sy)` THEN REWRITE_TAC[COVER_SY;COVER5_SY;COVER4_SY;] THEN RESA_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THYGIANG") THEN DISCH_THEN(LABEL_TAC"THYGIANG1") THEN DISCH_THEN(LABEL_TAC"THYGIANG2") THEN DISCH_THEN(LABEL_TAC"THYGIANG3") THEN DISCH_THEN(LABEL_TAC"THYGIANG4") THEN DISCH_THEN(LABEL_TAC"THYGIANG5") THEN REPEAT GEN_TAC THEN STRIP_TAC; MP_TAC(ARITH_RULE`i<=p==> i=p \/ i

j=p \/ j

~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({0,0}= {0,p-1})`) THEN RESA_TAC THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`0:num`;`0:num`][IN_NUMSEG]) THEN MRESAL1_TAC stable_sy_lemma`s1:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`0:num`;`p:num`] THEN MRESA_TAC th[`p:num`;`p:num`]) THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`p:num`;`p:num`;`p:num`] THEN MRESAL_TAC MOD_MULT[`p:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`0`) THEN REWRITE_TAC[VECTOR_ARITH`A-A= vec 0`;NORM_0;REAL_ARITH`&0<= &0`] THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`0`;`0`]) THEN STRIP_TAC THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th]); MP_TAC(ARITH_RULE`j

j=p-1 \/ j ~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({0,0}= {0,p-1})`) THEN RESA_TAC THEN MRESAL1_TAC stable_sy_lemma`s1:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1:num`;`p:num`] ) THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`p:num`;`p:num`;`p:num`] THEN MRESAL_TAC MOD_MULT[`p:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`p-1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1:num`;`k:num`] ) THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN REMOVE_THEN"THYGIANG2"MP_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC; REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; FIND_ASSUM MP_TAC`norm (v - w:real^3) <= min (b_sy s1 (p - 1,0)) (b_sy s2 (p - 1,0))` THEN REAL_ARITH_TAC; MP_TAC(ARITH_RULE`2

~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({0,j}= {0,p-1})`) THEN RESA_TAC THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`0:num`;`j:num`][IN_NUMSEG]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MRESAL1_TAC stable_sy_lemma`s1:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`j:num`;`p:num`] THEN MRESA_TAC th[`p:num`;`p:num`]) THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`p:num`;`p:num`;`p:num`] THEN MRESAL_TAC MOD_MULT[`p:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN RESA_TAC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`j:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`j:num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`j:num`;`k:num`] ) THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN RESA_TAC THEN RESA_TAC; MP_TAC(ARITH_RULE`i

i=p-1 \/ i j=p \/ j

~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({0,0}= {0,p-1})`) THEN RESA_TAC THEN MRESAL1_TAC stable_sy_lemma`s1:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1:num`;`p:num`] ) THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`p:num`;`p:num`;`p:num`] THEN MRESAL_TAC MOD_MULT[`p:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`p-1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN ONCE_REWRITE_TAC[NORM_SUB] THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1`]) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1:num`;`k:num`] ) THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN REMOVE_THEN"THYGIANG2"MP_TAC THEN ASM_REWRITE_TAC[] THEN FIND_ASSUM MP_TAC`norm (v - w:real^3) <= min (b_sy s1 (p - 1,0)) (b_sy s2 (p - 1,0))` THEN REAL_ARITH_TAC; MP_TAC(ARITH_RULE`j

j=p-1 \/ j p-1<=p-1 `) THEN RESA_TAC THEN MRESAL1_TAC stable_sy_lemma`s1:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`p-1` ) THEN REWRITE_TAC[VECTOR_ARITH`A-A:real^3= vec 0`;NORM_0] THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1`;`p-1`]) THEN STRIP_TAC THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th]) THEN REAL_ARITH_TAC; MP_TAC(ARITH_RULE`2

~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({p-1,j}= {0,p-1})`) THEN RESA_TAC THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`p-1:num`;`j:num`][IN_NUMSEG]) THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`p-1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`j:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1:num`;`j:num`]); MP_TAC(ARITH_RULE`j<=p ==> j=p \/ j

~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({0,i}= {0,p-1})`) THEN RESA_TAC THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`0:num`;`i:num`][IN_NUMSEG]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MRESAL1_TAC stable_sy_lemma`s1:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`p:num`] THEN MRESA_TAC th[`p:num`;`p:num`]) THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`p:num`;`p:num`;`p:num`] THEN MRESAL_TAC MOD_MULT[`p:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN RESA_TAC THEN RESA_TAC THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`k:num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`k:num`] ) THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN RESA_TAC THEN RESA_TAC; MP_TAC(ARITH_RULE`j

j=p-1 \/ j ~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({p-1,i}= {0,p-1})`) THEN RESA_TAC THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`p-1:num`;`i:num`][IN_NUMSEG]) THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`p-1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`p-1:num`]) THEN MRESAL1_TAC stable_sy_lemma`s1:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) THEN ASM_REWRITE_TAC[] THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) THEN ASM_REWRITE_TAC[]; MP_TAC(ARITH_RULE`2

~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({i,j}= {0,p-1})`) THEN RESA_TAC THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`i:num`;`j:num`][IN_NUMSEG]) THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`j:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`j:num`])]);; let IN_B_SY2_COVER_concl=`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) (l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p /\ 1<= k-p /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) /\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) /\ (ear_sy s2 <=> ear_sy s3) /\ DIA_SY 0 (p-1) s /\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 /\ COVER_SY 0 (p-1) s s1 s2 /\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) /\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} ==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) /\ matvec(pmat1(vecmats l))= l1 /\ matvec(pmat2(vecmats l))= l2 /\ row k (vecmats l)= v /\ row (p-1) (vecmats l)= w /\ (!u u1. u IN {v, w} /\ u1 IN V_SY(vecmats l) /\ ~(u = u1) ==> ~collinear {vec 0, u, u1}) /\ norm(v-w)<= min (b_sy s1 (p-1,0)) (b_sy s2 (p-1,0)) ==> l2 IN (B_SY1 (a_sy s3) (b_sy s3))`;; let IN_B_SY2_COVER_concl2 = mk_imp (EJRCFJD_concl, IN_B_SY2_COVER_concl);; let IN_B_SY2_COVER=prove_by_refinement(IN_B_SY2_COVER_concl2, [DISCH_THEN(LABEL_TAC"THY") THEN REPEAT STRIP_TAC THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) /\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 p - 2 + k - p + 2= k/\ p-2+1=p-1 /\ 1<=p-1 /\ p-1<=k /\ p-1 {A,B}SUBSET C`) THEN STRIP_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM;V_SY;rows]; EXISTS_TAC`k:num` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC; EXISTS_TAC`p-1` THEN ASM_REWRITE_TAC[]; SUBGOAL_THEN`norm (v - w:real^3) <= cstab`ASSUME_TAC; MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] THEN FIND_ASSUM (fun th-> MP_TAC(ISPECL [`k:num`;`p-1`]th))`!i j. {i MOD k, j MOD k} IN J_SY s UNION {{0, p - 1}} ==> norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= cstab` THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th; SET_RULE`{0,p-1} IN J_SY s UNION {{0,p-1}}`]) THEN ASM_REWRITE_TAC[]; SUBGOAL_THEN`~({v, w} IN E_SY (vecmats (l:real^(M,3)finite_product)))`ASSUME_TAC; ASM_REWRITE_TAC[E_SY;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;convex_local_fan;local_fan] THEN LET_TAC THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`row (i) (vecmats(l:real^(M,3)finite_product))`;` (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(l:real^(M,3)finite_product)`] THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;` (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`row i (vecmats(l:real^(M,3)finite_product))`] THEN DISJ_CASES_TAC(SET_RULE`row k (vecmats l)= row (p - 1) (vecmats l) \/ ~(row k (vecmats l)= row (p - 1) (vecmats (l:real^(M,3)finite_product)))`); MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN RESA_TAC; POP_ASSUM MP_TAC THEN RESA_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`1 <= SUC (i' MOD dimindex (:M)) /\ SUC (i' MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] THEN MRESAL_TAC DIVISION[`i':num`;`dimindex (:M):num`][DIMINDEX_NONZERO] THEN POP_ASSUM MP_TAC THEN ARITH_TAC; POP_ASSUM MP_TAC THEN RESA_TAC THEN MP_TAC(SET_RULE`{row k (vecmats l), row (p - 1) (vecmats l)} = {row i (vecmats l), row (SUC (i MOD k)) (vecmats l)} /\ ~(row k (vecmats l) = row (p - 1) (vecmats l)) /\ ~(row i (vecmats l) = row (SUC (i MOD k)) (vecmats l)) ==> (row i (vecmats l) = row (k) (vecmats l) /\ row (p-1) (vecmats l) = row (SUC (i MOD k)) (vecmats l)) \/ (row i (vecmats l) = row (p-1) (vecmats l) /\ row (k) (vecmats l) = row (SUC (i MOD k)) (vecmats (l:real^(M,3)finite_product)))`) THEN RESA_TAC; MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`k:num`] THEN MRESA_TAC th[`p-1:num`;`SUC(i MOD k):num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] THEN MP_TAC(ARITH_RULE`2 ~(p-1=1)/\ 1<=1`) THEN RESA_TAC; MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ (1 <= j /\ j <= k) /\ row i (vecmats l) = row j (vecmats l) <=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ row i (vecmats l) = row j (vecmats l)`] THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`p-1:num`] THEN MRESA_TAC th[`k:num`;`SUC(i MOD k):num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] THEN MP_TAC(ARITH_RULE`2

~(k= SUC (p-1))/\ 1<= SUC(p-1)/\ SUC(p-1)<=k`) THEN RESA_TAC; MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d_sy (s:stable_sy)`;`J_SY (s:stable_sy)`;`k_sy (s:stable_sy)`;`k:num`;`p-1:num`;`a_sy (s:stable_sy)`;`b_sy (s:stable_sy)`;`row k (vecmats (l:real^(M,3)finite_product))`;`row (p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] THEN MRESAL_TAC(GEN_ALL TECOXBM1)[`d_sy (s:stable_sy)`;`J_SY(s:stable_sy)`;`k:num`;`a_sy(s:stable_sy)`;`b_sy(s:stable_sy)`;`row k (vecmats (l:real^(M,3)finite_product))`;`row (p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`][SET_RULE`{A} UNION {B,C}={A,B,C}`] THEN MP_TAC(SET_RULE`{v, w} SUBSET V_SY (vecmats l)==> v IN V_SY (vecmats l) /\ w IN V_SY (vecmats (l:real^(M,3)finite_product))`) THEN RESA_TAC THEN MRESA_TAC (GEN_ALL SLICEV_EQ_V_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL SLICEE_EQ_E_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL SLICEF_EQ_F_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL SLICEF_EQ_F2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL SLICEE_EQ_E2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL SLICEV_EQ_V2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_THEN"THY"(fun th-> MRESA_TAC th[`V_SY(vecmats (l:real^(M,3)finite_product))`;`E_SY(vecmats (l:real^(M,3)finite_product))`;`F_SY(vecmats (l:real^(M,3)finite_product))`; `v:real^3`;`w:real^3`]) THEN EXISTS_TAC`vecmats(l2:real^(N,3)finite_product)` THEN ASM_REWRITE_TAC[MATVEC_VECMATS_ID] THEN STRIP_TAC; REPEAT STRIP_TAC THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN FIND_ASSUM (fun th-> MATCH_MP_TAC(ISPEC `p-2+i`th))`!i. 1 <= i /\ i <= dimindex (:M) ==> row i (vecmats (l:real^(M,3)finite_product)) IN ball_annulus` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`1<=i /\ i<= k-p+2 /\ 2

1<= p-2+i /\ p-2+i<=k`) THEN RESA_TAC; ASM_REWRITE_TAC[CONDITION1_SY] THEN FIND_ASSUM MP_TAC`COVER_SY 0 (p - 1) s s1 (s2:stable_sy)` THEN REWRITE_TAC[COVER_SY;COVER5_SY;COVER4_SY;] THEN RESA_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THYGIANG") THEN DISCH_THEN(LABEL_TAC"THYGIANG1") THEN DISCH_THEN(LABEL_TAC"THYGIANG2") THEN DISCH_THEN(LABEL_TAC"THYGIANG3") THEN DISCH_THEN(LABEL_TAC"THYGIANG4") THEN DISCH_THEN(LABEL_TAC"THYGIANG5") THEN REPEAT GEN_TAC THEN STRIP_TAC; MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`j:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` (l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] THEN REMOVE_THEN "THYGIANG1"MP_TAC THEN REMOVE_THEN "THYGIANG3"MP_TAC THEN FIND_ASSUM MP_TAC`SCHANGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) s2 (s3:stable_sy)` THEN REWRITE_TAC[SCHANGE] THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`j:num`]) THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`j:num`]) THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`i<=k-p+2 ==> i=k-p+2 \/ i< k-p+2`) THEN RESA_TAC; MP_TAC(ARITH_RULE`j<=k-p+2 ==> j=k-p+2 \/ j< k-p+2`) THEN RESA_TAC; STRIP_TAC THEN STRIP_TAC THEN MRESAL_TAC MOD_MULT[`k:num`;`1`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN SUBGOAL_THEN`0 IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] THEN EXISTS_TAC`0` THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; MRESAL1_TAC stable_sy_lemma`s2:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA1_TAC th`0`) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`0:num`;`0:num`] ) THEN STRIP_TAC THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th;VECTOR_ARITH`A-A= vec 0 `;NORM_0;]) THEN REAL_ARITH_TAC; MRESAL_TAC MOD_MULT[`k:num`;`1`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN MP_TAC(ARITH_RULE`1<=j==> j=1 \/ 1 1 REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1:num`]) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1:num`;`k:num`] THEN MRESA_TAC th[`p:num`;`p:num`]) THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN MRESAL1_TAC stable_sy_lemma`s2:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) THEN FIND_ASSUM MP_TAC`norm (v - w:real^3) <= min (b_sy s1 (p - 1,0)) (b_sy (s2:stable_sy) (p - 1,0))` THEN REAL_ARITH_TAC; MP_TAC(ARITH_RULE`1 ~(j=0) /\ p-2+j ~({0,p-2+j}={0,p-1})`) THEN RESA_TAC THEN SUBGOAL_THEN`0 IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] THEN EXISTS_TAC`0` THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; SUBGOAL_THEN`p-2+j IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] THEN EXISTS_TAC`j:num` THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; STRIP_TAC THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`0`;`p-2+j`]) THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-2+j:num`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-2+j:num`;`k:num`] THEN MRESA_TAC th[`p:num`;`p:num`]) THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN RESA_TAC THEN RESA_TAC; MRESAL_TAC MOD_MULT[`k:num`;`1`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN MP_TAC(ARITH_RULE`1<=i==> i=1 \/ 1 j=1 \/ 1 MRESA1_TAC th`p-1`) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1:num`;`p-1:num`] ) THEN STRIP_TAC THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th;VECTOR_ARITH`A-A= vec 0 `;NORM_0;]) THEN REAL_ARITH_TAC; MP_TAC(ARITH_RULE`j<=k-p+2 ==> j=k-p+2 \/ j< k-p+2`) THEN RESA_TAC; REWRITE_TAC[ARITH_RULE`~(1=0)`] THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] THEN MP_TAC(ARITH_RULE`2 1 REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1:num`;`k:num`]) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1:num`;`k:num`] THEN MRESA_TAC th[`p:num`;`p:num`]) THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN REWRITE_TAC[NORM_SUB] THEN DISCH_THEN(LABEL_TAC"THY21") THEN DISCH_THEN(LABEL_TAC"THY22") THEN MRESAL1_TAC stable_sy_lemma`s2:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN FIND_ASSUM MP_TAC`norm (v - w:real^3) <= min (b_sy s1 (p - 1,0)) (b_sy (s2:stable_sy) (p - 1,0))` THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) THEN REMOVE_THEN"THY21"MP_TAC THEN REMOVE_THEN"THY22"MP_TAC THEN REAL_ARITH_TAC; MP_TAC(ARITH_RULE`1 ~(j=0) /\ p-2+j ~({p-1,p-2+j}={0,p-1})`) THEN RESA_TAC THEN SUBGOAL_THEN`p-1 IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] THEN EXISTS_TAC`1` THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 1/\ 1<= k-p+1`]; SUBGOAL_THEN`p-2+j IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] THEN EXISTS_TAC`j:num` THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; STRIP_TAC THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1`;`p-2+j`]) THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1:num`;`p-2+j:num`]); MP_TAC(ARITH_RULE`1 ~(i=0) /\ p-2+i j=k-p+2 \/ j< k-p+2`) THEN RESA_TAC; MP_TAC(SET_RULE`~(p-2+i=p-1) /\ ~(0=p-1)==> ~({p-2+i,0}={0,p-1})`) THEN RESA_TAC THEN SUBGOAL_THEN`0 IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] THEN EXISTS_TAC`0` THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; SUBGOAL_THEN`p-2+i IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; STRIP_TAC THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-2+i`;`0`]) THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-2+i:num`;`k:num`;]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[constraint_system] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-2+i:num`;`k:num`] THEN MRESA_TAC th[`p:num`;`p:num`]) THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] THEN RESA_TAC THEN RESA_TAC; MP_TAC(ARITH_RULE`j ~(j=0) /\ p-2+j ~({p-2+i,p-2+j}={0,p-1})`) THEN RESA_TAC THEN SUBGOAL_THEN`p-2+j IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] THEN EXISTS_TAC`j:num` THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; SUBGOAL_THEN`p-2+i IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; STRIP_TAC THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-2+i`;`p-2+j`]) THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] THEN STRIP_TAC THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-2+i:num`;`p-2+j:num`;])]);; let MTUWLUN1 = D_FUN_COVER_SY;; let MTUWLUN2 = TAU_STAR_COVER;; let MTUWLUN3 = IN_B_SY_COVER;; let MTUWLUN4 = IN_B_SY2_COVER;; end;;