(* ========================================================================== *)
(* FLYSPECK - BOOK FORMALIZATION                                              *)
(*                                                                            *)
(* Chapter: Fan                                              *)
(* Author: Hoang Le Truong                                        *)
(* Date: 2010-02-09                                                           *)
(* ========================================================================== *)



flyspeck_needs "general/sphere.hl";;
flyspeck_needs "fan/introduction.hl";;
flyspeck_needs "fan/topology.hl";;
flyspeck_needs "fan/fan_misc.hl";;


module Planarity  = struct


open Sphere;;
open Fan_defs;;
open Hypermap;;
open Vol1;;
open Fan;;
open Topology;;		
open Fan_misc;;

(***************************************************************************)
(**********************DHVFGBC                      ************************)
(***************************************************************************)



let collinear_continuous_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3 c:real. (\(t:real^1). (&1- drop(t))%u + drop(t) %w - (&1 -c)%x - c% v) continuous_on (:real^1)`,
SIMP_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_AT;OPEN_UNIV;DIMINDEX_1] THEN REPEAT STRIP_TAC THEN REWRITE_TAC[drop] THEN MATCH_MP_TAC CONTINUOUS_ADD THEN STRIP_TAC THENL[ MATCH_MP_TAC CONTINUOUS_VMUL THEN REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] THEN MATCH_MP_TAC REAL_CONTINUOUS_SUB THEN SIMP_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_1; ARITH]; REPEAT(MATCH_MP_TAC CONTINUOUS_SUB THEN SIMP_TAC[CONTINUOUS_CONST]) THEN MATCH_MP_TAC CONTINUOUS_VMUL THEN REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] THEN SIMP_TAC[REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_1; ARITH]]);;
let collinear1_continuous_fan=
prove(`!u:real^3 w:real^3 t:real^1. (\(t:real^1). (&1- drop(t))%u + drop(t) %w) continuous at t`,
REPEAT STRIP_TAC THEN REWRITE_TAC[drop] THEN MATCH_MP_TAC CONTINUOUS_ADD THEN STRIP_TAC THENL[ MATCH_MP_TAC CONTINUOUS_VMUL THEN REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] THEN MATCH_MP_TAC REAL_CONTINUOUS_SUB THEN SIMP_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_1; ARITH]; MATCH_MP_TAC CONTINUOUS_VMUL THEN REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] THEN SIMP_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_1; ARITH]]);;
let CONTINUOUS_CLOSED_PREIMAGE_CONSTANT = 
prove (`!f:real^M->real^N s a. f continuous_on s /\ closed s ==> closed {x | x IN s /\ f(x) = a}`,
REPEAT STRIP_TAC THEN ASM_CASES_TAC `{x | x IN s /\ (f:real^M->real^N)(x) = a} = {}` THEN ASM_REWRITE_TAC[CLOSED_EMPTY] THEN ONCE_REWRITE_TAC[SET_RULE `{x | x IN s /\ f(x) = a} = {x | x IN s /\ f(x) IN {a}}`] THEN MATCH_MP_TAC CONTINUOUS_CLOSED_PREIMAGE THEN ASM_REWRITE_TAC[CLOSED_SING] THEN SET_TAC[]);;
let open_collinear_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3 c:real. open{t| ~((\(t:real^1). (&1- drop(t))%u + drop(t) %w - (&1 -c)%x - c% v)(t)= vec 0)}`,
REPEAT STRIP_TAC THEN REWRITE_TAC[OPEN_CLOSED;DIFF; IN_ELIM_THM;] THEN MP_TAC(ISPECL[`(\(t:real^1). (&1- drop(t))%u + drop(t) %w - (&1 -c)%x - c% v:real^3)`;`(:real^1)`; `((vec 0):real^3)`]CONTINUOUS_CLOSED_PREIMAGE_CONSTANT) THEN SIMP_TAC[CLOSED_UNIV; DIMINDEX_1; collinear_continuous_fan]);;
let open_vector_angle_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3 c:real a:real. (!t. ~((&1 - t) % u + t % w = x)) ==> open{t| ~((\(t:real^1). vector_angle (v - x) (((&1 - drop(t)) % u + drop(t) % w) - x))(t) = a)}`,
REPEAT STRIP_TAC THEN REWRITE_TAC[OPEN_CLOSED;DIFF; IN_ELIM_THM;] THEN MP_TAC(ISPECL[`lift o (\(t:real^1). vector_angle (v - x:real^3) (((&1 - drop(t)) % u + drop(t) % w) - x))`;`(:real^1)`; `lift (a:real)`]CONTINUOUS_CLOSED_PREIMAGE_CONSTANT) THEN REWRITE_TAC[o_DEF;LIFT_EQ] THEN DISCH_TAC THEN POP_ASSUM MATCH_MP_TAC THEN SIMP_TAC[CLOSED_UNIV; DIMINDEX_1;] THEN REWRITE_TAC[GSYM o_DEF] THEN REWRITE_TAC[GSYM FORALL_LIFT_FUN] THEN MP_TAC(ISPECL[`x:real^3 `;`v:real^3 `;`u:real^3`;` w:real^3`;` &0`]collinear_continuous_fan) THEN REDUCE_ARITH_TAC THEN REDUCE_VECTOR_TAC THEN SIMP_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_AT;OPEN_UNIV;DIMINDEX_1] THEN MATCH_MP_TAC MONO_FORALL THEN GEN_TAC THEN DISCH_THEN (LABEL_TAC"MA") THEN STRIP_TAC THEN REMOVE_THEN "MA" MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(ISPECL[`(\(t:real^1). ((&1- drop(t))%(u:real^3) + drop(t) %(w:real^3)) - (x:real^3) )`;`(\(t:real^3). lift (vector_angle ((v:real^3)-(x:real^3)) t))`;`x':real^1`] CONTINUOUS_AT_COMPOSE) THEN ASM_REWRITE_TAC[GSYM o_ASSOC] THEN REWRITE_TAC[o_DEF] THEN DISCH_TAC THEN POP_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`;GSYM(o_DEF)] THEN REWRITE_TAC[GSYM(REAL_CONTINUOUS_CONTINUOUS1);GSYM(I_DEF);I_O_ID] THEN MATCH_MP_TAC(ISPECL[`(v:real^3)-(x:real^3)`;`(&1 - drop x') % u + drop x' % w - x:real^3 `]REAL_CONTINUOUS_AT_VECTOR_ANGLE) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A+B-C= vec 0<=> A+B=C:real^3`]);;
let exists_open_not_collinear=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E ==> ?t1:real. &0 < t1 /\ t1 <= &1 /\ (!t:real. &0<= t /\ t<= t1==> ~(collinear{x,v,(&1-t)%u+ t % w}))`,
REPEAT STRIP_TAC THEN REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN ONCE_REWRITE_TAC[COLLINEAR_3;] THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`v:real^3`] THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `; `(E:(real^3->bool)->bool)`;` w:real^3`;` u:real^3`] THEN FIND_ASSUM MP_TAC`~collinear {(x:real^3),(u:real^3),(w:real^3)}` THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B,C}={B,C,A}`;] THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[collinear_fan] THEN ASM_REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] THEN DISCH_THEN(LABEL_TAC"MA") THEN FIND_ASSUM MP_TAC`~((u:real^3) IN aff {(x:real^3), (v:real^3)})` THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] THEN DISCH_THEN(LABEL_TAC"A") THEN SUBGOAL_THEN`!(t:real). ~((&1 - t) % u + t % w = x:real^3)`ASSUME_TAC THENL(*1*)[ GEN_TAC THEN REMOVE_THEN "MA" MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN DISCH_TAC THEN EXISTS_TAC`&1-(t:real)` THEN EXISTS_TAC`(t:real)` THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - t + t = &1`];(*1*) SUBGOAL_THEN`!(t:real). (collinear {vec 0, v - x, ((&1 - t) % u + t % w) - x} <=> vector_angle (v - x:real^3) (((&1 - t) % u + t % w) - x) = &0 \/ vector_angle (v - x) (((&1 - t) % u + t % w) - x) = pi)`ASSUME_TAC THENL(*2*)[ GEN_TAC THEN MP_TAC(ISPECL[`(v:real^3)-(x:real^3)`;`((&1 - t) % (u:real^3) + (t:real) % (w:real^3)) - (x:real^3)`] COLLINEAR_VECTOR_ANGLE) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B=vec 0<=> A=B`];(*2*) ASM_REWRITE_TAC[] THEN MRESA_TAC open_vector_angle_fan[ `x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`c:real`;`&0`] THEN MRESA_TAC open_vector_angle_fan[ `x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`c:real`;`pi`] THEN REWRITE_TAC[DE_MORGAN_THM;] THEN MP_TAC(ISPECL[`{(t:real^1) | ~( vector_angle ((v:real^3) - x) (((&1 - drop(t)) % (u:real^3) + drop(t) % (w:real^3)) - x) = &0)}` ;`{(t:real^1) | ~(vector_angle (v - x) (((&1 - drop (t)) % u + drop (t) % w) - (x:real^3)) = pi)}`]OPEN_INTER) THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM] THEN DISCH_TAC THEN SUBGOAL_THEN` ((vec 0):real^1) IN {(t:real^1) | ~( vector_angle ((v:real^3) - x) (((&1 - drop(t)) % (u:real^3) + drop(t) % (w:real^3)) - x) = &0 )/\ ~(vector_angle (v - x) (((&1 - drop (t)) % u + drop (t) % w) - (x:real^3)) = pi)}` ASSUME_TAC THENL(*3*)[ SIMP_TAC[IN_ELIM_THM;drop;VEC_COMPONENT;GSYM(DE_MORGAN_THM)] THEN REDUCE_ARITH_TAC THEN REDUCE_VECTOR_TAC THEN MP_TAC(ISPECL[`((v:real^3)-(x:real^3))`;`((u:real^3)-(x:real^3))`]COLLINEAR_VECTOR_ANGLE) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B=vec 0<=> A=B:real^3`] THEN ONCE_REWRITE_TAC[GSYM(COLLINEAR_3);] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN ASM_REWRITE_TAC[];(*3*) POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"G") THEN DISCH_TAC THEN REMOVE_THEN "G" MP_TAC THEN REWRITE_TAC[open_def] THEN DISCH_TAC THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`(vec 0):real^1`th)) THEN ASM_REWRITE_TAC[IN_ELIM_THM;dist; VECTOR_ARITH`A-vec 0=A`] THEN STRIP_TAC THEN EXISTS_TAC`min ((e:real)/ &2) (&1)` THEN STRIP_TAC THENL(*4*)[ POP_ASSUM (fun th->REWRITE_TAC[]) THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*4*) STRIP_TAC THENL(*5*)[ REAL_ARITH_TAC; GEN_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`lift(t:real)`th)) THEN REWRITE_TAC[LIFT_DROP;NORM_LIFT] THEN DISCH_THEN(LABEL_TAC"G") THEN STRIP_TAC THEN REMOVE_THEN "G" MATCH_MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]]]]);;
let exist_close_fan=
prove(`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3). FAN(x,V,E) /\ {v,w} INTER {v1,w1}={} /\ {v1,w1} IN E /\ {v,w} IN E ==> ?h:real. (&0 < h) /\ (!y1:real^3 y2:real^3. y1 IN (aff_ge {x} {v, w} INTER ballnorm_fan x) /\ y2 IN (aff_ge {x} {v1, w1} INTER ballnorm_fan x) ==> h <= dist(y1,y2) ))`,
REPEAT STRIP_TAC THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; ` (v1:real^3)`] THEN MATCH_MP_TAC( ISPECL [`aff_ge {(x:real^3)} {(v:real^3), (w:real^3)} INTER ballnorm_fan x`; `aff_ge {(x:real^3)} {(v1:real^3), (w1:real^3)} INTER ballnorm_fan x`] SEPARATE_CLOSED_COMPACT) THEN MP_TAC(ISPECL[`(x:real^3) `;` (v:real^3)`;` (w:real^3)`]closed_aff_ge_ballnorm_fan) THEN RESA_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;` (v1:real^3)`;` (w1:real^3)`]compact_aff_ge_ballnorm_fan) THEN RESA_TAC THEN FIND_ASSUM(MP_TAC)`FAN(x:real^3,V,E)` THEN REWRITE_TAC[FAN;fan7] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(v:real^3),(w:real^3)}`;`{(v1:real^3),(w1:real^3)}`]th)) THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] THEN ASM_REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; SET_RULE`(A INTER C) INTER (B INTER C)= (A INTER B) INTER C`;] THEN ASSUME_TAC(AFFINE_SING) THEN MP_TAC(ISPEC`{ (x:real^3) }` AFFINE_HULL_EQ ) THEN RESA_TAC THEN RESA_TAC THEN REWRITE_TAC[ballnorm_fan;INTER; IN_SING; EXTENSION;EMPTY;IN_ELIM_THM;] THEN GEN_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[DIST_REFL ] THEN REAL_ARITH_TAC);;
let AFF_GT_1_2=
prove(`!x v w. DISJOINT {x} {v, w} ==> aff_gt {x} {v, w} = {y | ?t1 t2 t3. &0 < t2 /\ &0 < t3 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v + t3 % w}`,
AFF_TAC);;
let linear_aff_fan=
prove(`!x:real^3 v:real^3 u:real^3. linear (\(t:real^2). t$1 %(v-x)+t$2 %(u-x))`,
REPEAT STRIP_TAC THEN MATCH_MP_TAC LINEAR_COMPOSE_ADD THEN STRIP_TAC THEN MATCH_MP_TAC LINEAR_VMUL_COMPONENT THEN SIMP_TAC[LINEAR_ID; DIMINDEX_2; ARITH]);;
let linear1_aff_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3. linear (\(t:real^3). t$1 %(v-x)+t$2 %(u-x)+t$3 %(w-u))`,
REPEAT STRIP_TAC THEN REPEAT(MATCH_MP_TAC LINEAR_COMPOSE_ADD THEN STRIP_TAC) THEN MATCH_MP_TAC LINEAR_VMUL_COMPONENT THEN SIMP_TAC[LINEAR_ID; DIMINDEX_3; ARITH]);;
let linear_inj_fan=
prove(`!x:real^3 v:real^3 u:real^3. ~collinear{x,v,u} ==>(!(a:real^2) (b:real^2). (\(t:real^2). t$1 %(v-x)+t$2 %(u-x))(a)=(\(t:real^2). t$1 %(v-x)+t$2 %(u-x))(b) ==>a=b)`,
REPEAT GEN_TAC THEN DISCH_TAC THEN ASSUME_TAC(ISPECL[`x:real^3`;` v:real^3`;`u:real^3`]linear_aff_fan) THEN MP_TAC(ISPEC`(\(t:real^2). t$1 %(v-x)+t$2 %(u-x):real^3)`LINEAR_INJECTIVE_0) THEN RESP_TAC THEN REMOVE_ASSUM_TAC THEN GEN_TAC THEN DISJ_CASES_TAC(REAL_ARITH`(a:real^2)$2= &0 \/ ~(a$2= &0)`) THENL[ ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[VECTOR_MUL_EQ_0;VECTOR_ARITH`A-B=vec 0<=> B=A`] THEN MP_TAC(ISPECL[`x:real^3`;` v:real^3`;`u:real^3`]th3) THEN RESA_TAC THEN ASM_TAC THEN SIMP_TAC[ LAMBDA_BETA;CART_EQ; DIMINDEX_2; FORALL_2; VEC_COMPONENT; ARITH]; REWRITE_TAC[VECTOR_ARITH`A+B=vec 0<=>B= --A`] THEN STRIP_TAC THEN MP_TAC(SET_RULE`a$2 % (u - x) = --((a:real^2)$1 % (v - x:real^3)) ==> (inv (a$2)) % a$2 % (u - x) = (inv (a$2)) % (--(a$1 % (v - x)))`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) THEN MP_TAC(ISPEC`(a:real^2)$2`REAL_MUL_LINV) THEN RESA_TAC THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[VECTOR_ARITH`A-B=C%(--(D%(U-B)))<=> A= (&1+C*D)%B+(--C*D)%U:real^3`] THEN MP_TAC(ISPECL[`x:real^3`;` v:real^3`;`u:real^3`]th3) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] THEN DISCH_THEN(LABEL_TAC"A") THEN DISCH_TAC THEN SUBGOAL_THEN `F`ASSUME_TAC THENL[ REMOVE_THEN "A" MP_TAC THEN ASM_REWRITE_TAC[] THEN EXISTS_TAC`(&1 + inv ((a:real^2)$2) * a$1)` THEN EXISTS_TAC`(--inv ((a:real^2)$2) * a$1)` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; ASM_MESON_TAC[]]]);;
let origin_point_not_in_convex_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3). FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) ==> ~(x IN convex hull{v,u,w})`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[CONVEX_HULL_3; IN_ELIM_THM; coplanar] THEN STRIP_TAC THEN EXISTS_TAC`v:real^3` THEN EXISTS_TAC`u:real^3` THEN EXISTS_TAC`w:real^3` THEN SUBGOAL_THEN`(x:real^3)IN affine hull {v,u,w:real^3}` ASSUME_TAC THENL(*3*)[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`u':real` THEN EXISTS_TAC`v':real` THEN EXISTS_TAC`w':real` THEN ASM_MESON_TAC[]; SUBGOAL_THEN`(v:real^3)IN affine hull {v,u,w:real^3}` ASSUME_TAC THENL(*4*)[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`&1` THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&0` THEN REDUCE_ARITH_TAC THEN VECTOR_ARITH_TAC; SUBGOAL_THEN`(u:real^3)IN affine hull {v,u,w:real^3}` ASSUME_TAC THENL(*5*)[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1` THEN EXISTS_TAC`&0` THEN REDUCE_ARITH_TAC THEN VECTOR_ARITH_TAC; SUBGOAL_THEN`(w:real^3)IN affine hull {v,u,w:real^3}` ASSUME_TAC THENL(*6*)[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1` THEN REDUCE_ARITH_TAC THEN VECTOR_ARITH_TAC; ASM_TAC THEN SET_TAC[]]]]]);;
let separate_point_convex_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3). FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) ==> ?(h:real). &0< h /\ (!(y:real^3). y IN convex hull{v,u,w} ==> h < norm(y-x))`,
REPEAT STRIP_TAC THEN SUBGOAL_THEN `FINITE {(v:real^3),(u:real^3),(w:real^3)}` ASSUME_TAC THENL(*1*)[ MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] remark1_fan) THEN RESA_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; `(u:real^3)`] remark1_fan) THEN RESA_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (w:real^3)`] remark1_fan) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN MP_TAC(SET_RULE`(v:real^3) IN (V:real^3->bool) /\ (u:real^3) IN (V:real^3->bool) /\ (w:real^3) IN (V:real^3->bool)==> {v,u,w} SUBSET V`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MATCH_MP_TAC(ISPECL[`{(v:real^3),(u:real^3),(w:real^3)}`;`V:real^3->bool`]FINITE_SUBSET) THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REWRITE_TAC[FAN;fan1] THEN SET_TAC[]; MP_TAC(ISPEC`{(v:real^3),(u:real^3),(w:real^3)}`FINITE_IMP_COMPACT_CONVEX_HULL) THEN POP_ASSUM (fun th-> REWRITE_TAC[th;COMPACT_EQ_BOUNDED_CLOSED]) THEN DISCH_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`]origin_point_not_in_convex_fan) THEN RESA_TAC THEN MP_TAC(ISPECL[`convex hull {(v:real^3),(u:real^3),(w:real^3)}`;`x:real^3`]SEPARATE_POINT_CLOSED) THEN RESA_TAC THEN EXISTS_TAC`d:real/ &2` THEN STRIP_TAC THENL[ ASM_TAC THEN REAL_ARITH_TAC; ONCE_REWRITE_TAC[NORM_SUB] THEN GEN_TAC THEN POP_ASSUM (fun th ->MP_TAC(ISPEC`y:real^3`th)) THEN REWRITE_TAC[dist;] THEN DISCH_THEN(LABEL_TAC"A") THEN DISCH_TAC THEN REMOVE_THEN "A" MP_TAC THEN POP_ASSUM (fun th ->REWRITE_TAC[th]) THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]);;
let expansion_convex_fan=
prove(`!(v:real^3) (u:real^3) (w:real^3) (t:real) s:real. &0 <= t /\ t<= &1 /\ &0 <=s /\ s <= &1 ==> (&1-s)%v+s%((&1-t)%u+ t%w) IN convex hull{v,u,w}`,
REWRITE_TAC[REAL_ARITH`A<= &1 <=> &0<= &1 -A`] THEN REPEAT STRIP_TAC THEN REWRITE_TAC[CONVEX_HULL_3; IN_ELIM_THM;] THEN EXISTS_TAC`&1 - (s:real)` THEN EXISTS_TAC`(s:real)*(&1 - (t:real))` THEN EXISTS_TAC`(s:real)*(t:real)` THEN ASM_REWRITE_TAC[VECTOR_ARITH`s%((&1-t)%u+ t%w)= (s*(&1-t))%u+ (s*t)%w:real^3`] THEN STRIP_TAC THENL[MATCH_MP_TAC REAL_LE_MUL THEN ASM_TAC THEN REAL_ARITH_TAC; STRIP_TAC THENL[MATCH_MP_TAC REAL_LE_MUL THEN ASM_TAC THEN REAL_ARITH_TAC; REAL_ARITH_TAC]]);;
let expansion1_convex_fan=
prove(`!(v:real^3) (u:real^3) s:real. &0 <=s /\ s <= &1 ==> (&1-s)%v+s%u IN convex hull{v,u}`,
REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3)`;` (u:real^3)`;` &0`;`s:real`]expansion_convex_fan) THEN ASM_REWRITE_TAC[SET_RULE`{A,B,B}={A,B}`] THEN REDUCE_ARITH_TAC THEN REDUCE_VECTOR_TAC THEN DISCH_TAC THEN POP_ASSUM MATCH_MP_TAC THEN REAL_ARITH_TAC);;
let norm_origin_fan=
prove(`!x:real^3. (\(y:real^3). lift(norm(y-x))) continuous_on (:real^3) `,
GEN_TAC THEN MP_TAC(ISPECL[`(\(y:real^3). y-(x:real^3))`;`(\(y:real^3). lift(norm(y)))`;`(:real^3)`]CONTINUOUS_ON_COMPOSE) THEN REWRITE_TAC[o_DEF] THEN DISCH_TAC THEN POP_ASSUM MATCH_MP_TAC THEN REWRITE_TAC[CONTINUOUS_ON_LIFT_NORM;GSYM(o_DEF)] THEN MATCH_MP_TAC CONTINUOUS_ON_SUB THEN SIMP_TAC[CONTINUOUS_ON_CONST;CONTINUOUS_ON_ID]);;
let origin_point_not1_in_convex_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). FAN(x,V,E) /\ {v,u} IN E ==> ~(x IN convex hull{v,u})`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] remark1_fan) THEN RESA_TAC THEN FIND_ASSUM MP_TAC`~(u IN aff {x,v:real^3})` THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[CONVEX_HULL_2; IN_ELIM_THM;] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISJ_CASES_TAC(REAL_ARITH`(v':real= &0) \/ ~(v':real= &0)`) THENL[ASM_REWRITE_TAC[] THEN REDUCE_ARITH_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC THEN ASM_MESON_TAC[]; POP_ASSUM MP_TAC THEN REPEAT REMOVE_ASSUM_TAC THEN REWRITE_TAC[VECTOR_ARITH`A=B+C<=>C= A-B:real^3`;REAL_ARITH`a+b= &1<=> a= &1 -b:real`] THEN REPEAT DISCH_TAC THEN MP_TAC(SET_RULE`v'% u =x- u' % v ==> (inv (v')) % v' % u = (inv (v')) % (x-u' % v:real^3)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`(A%(B-(&1-U)%C)=(A%B)+(A*U-A)%C:real^3)`]) THEN MP_TAC(ISPEC`(v':real)`REAL_MUL_LINV) THEN RESA_TAC THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC`inv(v':real)` THEN EXISTS_TAC`&1-inv(v':real)` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC]);;
let inequality1_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real. FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d ==> ?(h:real). &0 <h /\ h<= &1 /\ (!t:real. &0 <= t /\ t<h ==> (!(s:real). &0 <= s /\ s <= &1 ==> s * inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))* norm(u-((&1-t)%u+ t%w))< d ))`,
REPEAT STRIP_TAC THEN REWRITE_TAC[VECTOR_ARITH`u-((&1-t)%u+ t%w)=t%(u-w):real^3`;NORM_MUL] THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`]separate_point_convex_fan) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN EXISTS_TAC`min ((h:real)*(d:real) *inv(norm(u-w:real^3))) (&1)` THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] remark1_fan) THEN RESA_TAC THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_gl_zero_fan) THEN RESA_TAC THEN MP_TAC(ISPECL[`(h:real)*(d:real)`;`inv(norm(u-w:real^3))`] REAL_LT_MUL) THEN RESA_TAC THEN STRIP_TAC THENL[ MP_TAC(ISPECL[`h:real`;`d:real`] REAL_LT_MUL) THEN RESA_TAC THEN ASM_TAC THEN REAL_ARITH_TAC; STRIP_TAC THENL[ REAL_ARITH_TAC; REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0 <(h:real)==> ~(h= &0)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(h:real)`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`(t:real)< min ((h:real) * (d:real) * inv (norm (u - w:real^3))) (&1)/\ min (h * d * inv (norm (u - w))) (&1)<= &1 ==>t<= &1/\ (t:real)< (h * d * inv (norm (u - w:real^3)))`) THEN ASM_REWRITE_TAC[REAL_ARITH`min (h * d * inv (norm (u - w))) (&1)<= &1`] THEN STRIP_TAC THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) THEN RESA_TAC THEN REMOVE_THEN "A"(fun th -> MP_TAC(ISPEC`(&1-s)%v+s%((&1-t)%u+ t%w):real^3`th)) THEN RESA_TAC THEN MP_TAC(ISPECL[`h:real`;`norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`]REAL_LT_INV2) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0 <h /\ (h:real)< norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)==> &0 <= norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`) THEN RESA_TAC THEN MP_TAC(ISPEC`norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`REAL_LE_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`t:real`REAL_ABS_REFL) THEN RESP_TAC THEN MP_TAC(ISPECL[`inv(norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))`; `inv(h:real)`;`t:real`;`(h * d * inv (norm (u - w:real^3)))`; ]REAL_LT_MUL2) THEN RESA_TAC THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_not_zero_fan) THEN RESA_TAC THEN MP_TAC(ISPEC`(norm(u-w:real^3))`REAL_MUL_LINV) THEN RESA_TAC THEN ASSUME_TAC(ISPEC`u-w:real^3`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(&0 =norm(u-w:real^3)) /\ &0 <= norm(u-w:real^3)==> &0 <norm(u-w:real^3)`) THEN RESA_TAC THEN MP_TAC(ISPECL[`inv (norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)) * (t:real)`;`inv (h:real) * h * d * inv (norm (u - w:real^3))`;`norm (u - w:real^3)`]REAL_LT_RMUL) THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B*C*D)*E=(A*B)*C*(D*E)`] THEN REDUCE_ARITH_TAC THEN STRIP_TAC THEN MP_TAC(ISPECL[`inv (norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))`;`(t:real)`;] REAL_LE_MUL) THEN RESA_TAC THEN MP_TAC(ISPECL[`inv (norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))*(t:real)`;`norm(u-w:real^3)`] REAL_LE_MUL) THEN RESA_TAC THEN DISJ_CASES_TAC(REAL_ARITH`(s= &1) \/ ~((s:real)= &1)`) THENL[ POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN REDUCE_ARITH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`A*B*C=(A*B)*C:real`;VECTOR_ARITH`(&1 - s) % v + s % ((&1 - t) % u + t % w) - x=((&1 - s) % v + s % ((&1 - t) % u + t % w))- x :real^3`]; MP_TAC(REAL_ARITH`~(s= &1) /\ s<= &1==> (s:real)< &1`) THEN RESA_TAC THEN MP_TAC(ISPECL[`s:real`;`&1`;`(inv (norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))*(t:real)) * norm(u-w:real^3)`; `d:real`]REAL_LT_MUL2) THEN REDUCE_ARITH_TAC THEN RESA_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`A*d*B*C=A*(d*B)*C:real`;VECTOR_ARITH`(&1 - s) % v + s % ((&1 - t) % u + t % w) - x=((&1 - s) % v + s % ((&1 - t) % u + t % w))- x :real^3`]]]]);;
let bounded_convex_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). FAN(x,V,E) /\ {v,u} IN E ==> ?(h:real). &0< h /\ (!(y:real^3). y IN convex hull{v,u} ==> norm(y-x)<h )`,
REPEAT STRIP_TAC THEN SUBGOAL_THEN `FINITE {(v:real^3),(u:real^3)}` ASSUME_TAC THENL(*1*)[SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; IN_INSERT; NOT_IN_EMPTY]; MP_TAC(ISPEC`{(v:real^3),(u:real^3)}`FINITE_IMP_COMPACT_CONVEX_HULL) THEN POP_ASSUM (fun th-> REWRITE_TAC[th;]) THEN DISCH_TAC THEN ASSUME_TAC(ISPEC`x:real^3` norm_origin_fan ) THEN ASSUME_TAC(SET_RULE`convex hull {(v:real^3), u} SUBSET (:real^3)`) THEN MP_TAC(ISPECL[`(\(y:real^3). lift(norm(y-x:real^3)))`;`(:real^3)`;`convex hull {(v:real^3),(u:real^3)}`]CONTINUOUS_ON_SUBSET) THEN RESA_TAC THEN MP_TAC(ISPECL[`(\(y:real^3). lift(norm(y-x:real^3)))`;`convex hull {(v:real^3),(u:real^3)}`]COMPACT_CONTINUOUS_IMAGE) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[COMPACT_EQ_BOUNDED_CLOSED;bounded;IMAGE;IN_ELIM_THM] THEN ONCE_REWRITE_TAC[TAUT`A/\B<=>B/\A`;] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN SUBGOAL_THEN `(?x':real^3. x' IN convex hull {v, u} /\ lift (norm (v - x:real^3)) = lift (norm (x' - x)))`ASSUME_TAC THENL[ EXISTS_TAC`v:real^3` THEN SIMP_TAC[CONVEX_HULL_2; IN_ELIM_THM;] THEN EXISTS_TAC`&1` THEN EXISTS_TAC`&0` THEN REDUCE_VECTOR_TAC THEN REAL_ARITH_TAC; SUBGOAL_THEN `&0< (a:real)` ASSUME_TAC THENL[ REMOVE_THEN "A" (fun th-> MP_TAC(ISPEC`lift (norm (v - (x:real^3)))`th)) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[NORM_LIFT;REAL_ABS_NORM ] THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] remark1_fan) THEN RESA_TAC THEN MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_not_zero_fan) THEN RESA_TAC THEN ASSUME_TAC(ISPEC`v-x:real^3`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(&0 =norm(v-x:real^3)) /\ &0 <= norm(v-x:real^3)==> &0 <norm(v-x:real^3)`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; EXISTS_TAC`&2 * a:real` THEN STRIP_TAC THENL[ REPEAT STRIP_TAC THEN SUBGOAL_THEN `(?x':real^3. x' IN convex hull {v, u} /\ lift (norm (y - x:real^3)) = lift (norm (x' - x)))`ASSUME_TAC THENL[ EXISTS_TAC`y:real^3` THEN ASM_SIMP_TAC[]; REMOVE_THEN "A"(fun th-> MP_TAC(ISPEC`lift (norm (y - x:real^3))`th)) THEN ASM_REWRITE_TAC[NORM_LIFT;REAL_ABS_NORM ] THEN ASM_TAC THEN REAL_ARITH_TAC]; ASM_TAC THEN REAL_ARITH_TAC]]]]);;
let REAL_ABS_SUB_NORM = 
prove (`!x y. abs(norm(x) - norm(y)) <= norm(x - y)`,
REWRITE_TAC[REAL_ARITH `abs(x - y) <= a <=> x <= y + a /\ y <= x + a`] THEN MESON_TAC[NORM_TRIANGLE_SUB; NORM_SUB]);;
let inequaility2_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real. FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d ==> ?(h:real). &0 <h /\ h<= &1 /\ (!t:real. &0 <= t /\ t<h ==> (!(s:real). &0 <= s /\ s <= &1 ==> (norm(inv(norm((&1-s)%v+s%u-x))%((&1-s)%v+s%u-x) - inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))% ((&1-s)%v+s%u-x)))< d ))`,
REWRITE_TAC[VECTOR_ARITH`A%B-C%B=(A-C)%B`;NORM_MUL] THEN REPEAT STRIP_TAC THEN REWRITE_TAC[VECTOR_ARITH`u-((&1-t)%u+ t%w)=t%(u-w):real^3`;NORM_MUL] THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`]separate_point_convex_fan) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`]origin_point_not_in_convex_fan) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"B") THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`]bounded_convex_fan) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"C") THEN EXISTS_TAC`min (h*h*(inv (h'))* inv(norm(u-w:real^3))*d:real) (&1)` THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] remark1_fan) THEN RESA_TAC THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_not_zero_fan) THEN RESA_TAC THEN ASSUME_TAC(ISPEC`u-w:real^3`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(&0 =norm(u-w:real^3)) /\ &0 <= norm(u-w:real^3)==> &0 <norm(u-w:real^3)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(norm(u-w:real^3))`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0 <(h:real)==> ~(h= &0)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(h:real)`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0 <(h':real)==> ~(h'= &0)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(h':real)`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(ISPEC`norm (u-w:real^3)`REAL_LE_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`norm (u-w:real^3)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`(h:real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0 <inv (h:real)==> &0 <= inv(h)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(h':real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0 <inv (h':real)==> &0 <= inv(h')`) THEN RESA_TAC THEN STRIP_TAC THENL(*1*)[ MP_TAC(ISPECL[`(h:real)`;`inv (h':real) `]REAL_LT_MUL) THEN RESA_TAC THEN MP_TAC(ISPECL[`(h:real)`;`(h:real)*inv (h':real) `]REAL_LT_MUL) THEN RESA_TAC THEN MP_TAC(ISPECL[`(h:real)*(h:real)*inv (h':real)`;`inv(norm(u-w:real^3))`]REAL_LT_MUL) THEN RESA_TAC THEN MP_TAC(ISPECL[`(h:real)*(h:real)*inv (h':real) *inv(norm(u-w:real^3))`;`d:real`]REAL_LT_MUL) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*1*) STRIP_TAC THENL(*2*)[ REAL_ARITH_TAC;(*2*) REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3)`;` s:real`]expansion1_convex_fan) THEN RESA_TAC THEN REMOVE_THEN "C"(fun th->MP_TAC(ISPEC`(&1 - s) % v + s % u:real^3`th)) THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] THEN RESA_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`] origin_point_not1_in_convex_fan) THEN RESA_TAC THEN SUBGOAL_THEN`~(x=(&1-s)%v+s%u:real^3)` ASSUME_TAC THENL(*3*)[ POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN RESA_TAC;(*3*) MP_TAC(ISPECL[`(&1-s)%v+s%u:real^3`;`x:real^3`]imp_norm_not_zero_fan) THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] THEN RESA_TAC THEN ASSUME_TAC(ISPEC`(&1-s)%v+s%u-x:real^3`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(norm((&1-s)%v+s%u-x:real^3)= &0) /\ &0 <= norm((&1-s)%v+s%u-x:real^3)==> &0 <norm((&1-s)%v+s%u-x:real^3)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(norm((&1-s)%v+s%u-x:real^3))`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(ISPEC`(norm((&1-s)%v+s%u-x:real^3))`REAL_LE_INV) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`(t:real)< min (h * h * inv h' * inv (norm (u - w)) * d) (&1)/\ min (h * h * inv h' * inv (norm (u - w)) * d) (&1)<= &1 ==> t<= &1/\ (t:real)< (h * h * inv h' * inv (norm (u - w:real^3)) * d) `) THEN ASM_REWRITE_TAC[REAL_ARITH`min (h * h * inv h' * inv (norm (u - w:real^3)) * d) (&1)<= &1`] THEN STRIP_TAC THEN MP_TAC(ISPECL[`norm ((&1 - s) % v + s % u - x:real^3) `; `(h':real)`;`t:real`;`(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) THEN RESA_TAC THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(&0:real) `;`s:real`]expansion_convex_fan) THEN REDUCE_ARITH_TAC THEN REDUCE_VECTOR_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &0/\ &0<= &1`] THEN DISCH_TAC THEN USE_THEN "A" (fun th-> MP_TAC(ISPEC`((&1 - s) % v + s % u:real^3)`th)) THEN POP_ASSUM(fun th-> REWRITE_TAC[th; VECTOR_ARITH`(A+B)-C=A+B-C:real^3`]) THEN DISCH_TAC THEN MP_TAC(ISPECL[`h:real`;`norm ((&1 - s) % v + s % u-x:real^3)`]REAL_LT_INV2) THEN RESA_TAC THEN MP_TAC(ISPECL[`norm((&1-s)%v+s%u-x:real^3)`;`t:real`]REAL_LE_MUL) THEN RESA_TAC THEN MP_TAC(ISPECL[`inv(norm ((&1 - s) % v + s % u - x:real^3))`;`inv(h:real)`;`norm ((&1 - s) % v + s % u - x:real^3)*(t:real)`;`(h':real)*(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) THEN RESA_TAC THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN USE_THEN "A" (fun th-> MP_TAC(ISPEC`(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3`th)) THEN POP_ASSUM(fun th-> REWRITE_TAC[th; VECTOR_ARITH`(A+B)-C=A+B-C:real^3`]) THEN DISCH_TAC THEN MP_TAC(ISPECL[`h:real`;`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`]REAL_LT_INV2) THEN RESA_TAC THEN MP_TAC(ISPECL[`inv(norm((&1-s)%v+s%u-x:real^3))`;`norm((&1-s)%v+s%u-x:real^3)*(t:real)`]REAL_LE_MUL) THEN RESA_TAC THEN ASSUME_TAC(ISPEC`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`NORM_POS_LE) THEN MP_TAC(ISPEC`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`REAL_LE_INV) THEN RESA_TAC THEN MP_TAC(ISPECL[`inv(norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3))`;`inv(h:real)`;`inv(norm ((&1 - s) % v + s % u - x:real^3)) * norm ((&1 - s) % v + s % u - x:real^3)*(t:real)`;`inv(h:real)*(h':real)*(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) THEN RESA_TAC THEN MP_TAC(ISPECL[`norm (u - w:real^3)`; `inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)) * inv (norm ((&1 - s) % v + s % u - x)) * norm ((&1 - s) % v + s % u - x) * t`;`inv h * inv h * h' * h * h * inv h' * inv (norm (u - w:real^3)) * d`;]REAL_LT_LMUL) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(B*C)*E*A*D`] THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*E*(C*D)`] THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*E*(C*D)`] THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D=(A*B)*C*D`] THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*(C*D)*E`] THEN ONCE_REWRITE_TAC[REAL_ARITH`(A*B*C)*D*E=A*B*(C*D)*E`] THEN ASM_REWRITE_TAC[] THEN REDUCE_ARITH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B*C)*D=A*B*(C*D)`] THEN REDUCE_ARITH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`((A*B)*C*D)*E=(A*C)*(B*D)*E`] THEN REDUCE_ARITH_TAC THEN REWRITE_TAC[REAL_ARITH`((A*B)*C)*D*E=(A*B)*(C*D)*E`] THEN ASSUME_TAC(ISPECL[`u:real^3`;`w:real^3`]NORM_SUB) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN MP_TAC(ISPECL[`t:real`;`w-u:real^3`]NORM_MUL) THEN MP_TAC(ISPEC`t:real`REAL_ABS_REFL) THEN RESP_TAC THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C*D=C*A*(B*D)`] THEN REDUCE_ARITH_TAC THEN DISCH_THEN(LABEL_TAC"BA") THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) THEN RESA_TAC THEN SUBGOAL_THEN`~(x=(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3)` ASSUME_TAC THENL(*4*)[ POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"MA") THEN STRIP_TAC THEN REMOVE_THEN"MA" MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN ASM_REWRITE_TAC[];(*4*) MP_TAC(ISPECL[`(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3`;`x:real^3`]imp_norm_not_zero_fan) THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] THEN RESA_TAC THEN MP_TAC(ISPECL[`norm((&1 - s) % v + s % u-x:real^3)`;`norm((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`]REAL_SUB_INV) THEN RESP_TAC THEN ASM_REWRITE_TAC[REAL_ABS_ABS;REAL_ABS_DIV;REAL_ABS_MUL;REAL_ABS_NORM;real_div;REAL_INV_MUL; REAL_ARITH`(A*B*C)*D=A*C*(B*D)`] THEN REDUCE_ARITH_TAC THEN MP_TAC(ISPECL[`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`;`((&1 - s) % v + s % u-x:real^3)`]REAL_ABS_SUB_NORM) THEN REWRITE_TAC[VECTOR_ARITH` ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)-((&1 - s) % v + s % u - x)=s%(t)%(w-u) :real^3`] THEN ONCE_REWRITE_TAC[NORM_MUL] THEN MP_TAC(ISPEC`s:real`REAL_ABS_REFL) THEN RESP_TAC THEN DISCH_TAC THEN MP_TAC(ISPECL[`abs (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3) - norm ((&1 - s) % v + s % u - x))`;`s * norm (t % (w - u):real^3)`;`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`]REAL_LE_RMUL) THEN RESA_TAC THEN REMOVE_THEN "BA" MP_TAC THEN POP_ASSUM MP_TAC THEN DISJ_CASES_TAC(REAL_ARITH`(s= &1)\/ ~((s:real) = &1)`) THENL(*5*)[ ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC;(*5*) MP_TAC(REAL_ARITH`~(s= &1) /\ s<= &1==> (s:real)< &1`) THEN RESA_TAC THEN ASSUME_TAC(ISPEC`(t % (w - u):real^3)`NORM_POS_LE) THEN MP_TAC(ISPECL[`norm (t % (w - u):real^3)`;`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`]REAL_LE_MUL) THEN RESA_TAC THEN REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`s:real`;`&1`;`norm (t % (w - u)) * inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`; `d:real`]REAL_LT_MUL2) THEN REDUCE_ARITH_TAC THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]]]]);;
let exists_point_small_edges_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real. FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d ==> ?(h:real). &0 <h /\ h<= &1 /\ (!t:real. &0 <= t /\ t<h ==> (!(s:real). &0 <= s /\ s <= &1 ==> norm(inv(norm((&1-s)%v+s%u-x))%((&1-s)%v+s%u-x) - inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))% ((&1-s)%v+s%((&1-t)%u+ t%w)-x))< d ))`,
REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0< (d:real)==> &0< d/ &2`) THEN RESA_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`]origin_point_not_in_convex_fan) THEN RESA_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`;` (d:real)/ &2`]inequaility2_fan) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool) `;`(v:real^3)`;` (u:real^3)`;` (w:real^3)`;` (d:real)/ &2`]inequality1_fan) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"B") THEN EXISTS_TAC`min (h:real) (h':real)` THEN STRIP_TAC THENL[ASM_TAC THEN REAL_ARITH_TAC; STRIP_TAC THENL[ ASM_TAC THEN REAL_ARITH_TAC; REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t< min (h:real) (h':real)==> t< (h:real) /\ t< (h':real)`) THEN RESA_TAC THEN REMOVE_THEN"B" (fun th-> MP_TAC(ISPEC`t:real`th)) THEN RESA_TAC THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"B") THEN REMOVE_THEN"A" (fun th-> MP_TAC(ISPEC`t:real`th)) THEN RESA_TAC THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN ASSUME_TAC(ISPEC`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`NORM_POS_LE) THEN MP_TAC(ISPEC`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`REAL_LE_INV) THEN RESA_TAC THEN MP_TAC(ISPECL[`s * inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)):real`;`(u - ((&1 - t) % u + t % w)):real^3`]NORM_MUL) THEN REWRITE_TAC[REAL_ABS_MUL] THEN MP_TAC(ISPEC`s:real`REAL_ABS_REFL) THEN RESP_TAC THEN MP_TAC(ISPEC`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)):real`REAL_ABS_REFL) THEN RESP_TAC THEN REWRITE_TAC[REAL_ARITH`(A*B)*C=A*B*C`] THEN DISCH_TAC THEN REMOVE_THEN"B"MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN REWRITE_TAC[VECTOR_ARITH`(s * inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x))) % (u - ((&1 - t) % u + t % w))= inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % u - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3`] THEN DISCH_TAC THEN MP_TAC(ISPECL[`norm(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % u - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)`;`(d:real)/ &2`; `norm (inv (norm ((&1 - s) % v + s % u - x)) % ((&1 - s) % v + s % u - x) - inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % u - x):real^3)`;`(d:real)/ &2`; ]REAL_LT_ADD2) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`d / &2 + d/ &2 = d`] THEN MP_TAC(ISPECL[`(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % u - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)`; `(inv (norm ((&1 - s) % v + s % u - x)) % ((&1 - s) % v + s % u - x) - inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % u - x):real^3)`]NORM_TRIANGLE) THEN REWRITE_TAC[VECTOR_ARITH`(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % u - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)+ (inv (norm ((&1 - s) % v + s % u - x)) % ((&1 - s) % v + s % u - x) - inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % u - x):real^3)=(inv (norm ((&1 - s) % v + s % u - x)) % ((&1 - s) % v + s % u - x) - inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) `] THEN REAL_ARITH_TAC]]);;
let same_projective_sphere_ge_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) (t:real) (y1:real^3). FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~collinear {x, v, (&1 - t) % u + t % w} /\ ~(y1=x) /\ (y1 IN aff_ge {x} {v, (&1-t)%u+(t:real)% (w:real^3)} INTER ballnorm_fan x) ==> ?s:real. &0 <= s/\ s<= &1 /\ y1=inv(norm((&1 - s) % v + s % ((&1 - t) % u + t % w)-x))%((&1 - s) % v + s % ((&1 - t) % u + t % w)-x)+x`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN MP_TAC(ISPECL[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;]th3) THEN RESA_TAC THEN MP_TAC(ISPECL[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;]AFF_GE_1_2) THEN RESA_TAC THEN REMOVE_THEN"A" MP_TAC THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;dist;ballnorm_fan] THEN STRIP_TAC THEN SUBGOAL_THEN`~(&1 - t1:real= &0)/\ &0 <= &1-t1` ASSUME_TAC THENL[ STRIP_TAC THENL[ FIND_ASSUM MP_TAC`t1+t2+t3= &1:real` THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN REWRITE_TAC[REAL_ARITH`(A+B)-A=B`] THEN STRIP_TAC THEN MP_TAC(REAL_ARITH`(&0 <= t2) /\ (&0 <= t3) /\(t2+t3= &0)==> t2= &0 /\ t3= &0`) THEN RESA_TAC THEN FIND_ASSUM MP_TAC`y1 = t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w) :real^3` THEN FIND_ASSUM MP_TAC`t1+t2+t3= &1:real` THEN POP_ASSUM (fun th-> REWRITE_TAC[(th)]) THEN POP_ASSUM (fun th-> REWRITE_TAC[(th)]) THEN REDUCE_ARITH_TAC THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[(th)]) THEN REDUCE_VECTOR_TAC THEN ASM_REWRITE_TAC[]; REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPECL[`t2:real`;`t3:real`]REAL_LT_ADD) THEN REAL_ARITH_TAC]; MP_TAC(REAL_ARITH`~(&1 - t1= &0)/\ &0 <= &1-t1==> &0< (&1 -t1:real)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(&1 -t1:real)`REAL_LE_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`(&1-t1:real)`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(ISPECL[`inv ((&1 - t1:real))`;`(t2:real)`]REAL_LE_MUL) THEN RESA_TAC THEN MP_TAC(ISPECL[`inv ((&1 - t1:real))`;`(t3:real)`]REAL_LE_MUL) THEN RESA_TAC THEN FIND_ASSUM MP_TAC `t1+t2+t3= &1:real` THEN REWRITE_TAC[REAL_ARITH`A+B+C=D<=>B+C=D-A`] THEN DISCH_TAC THEN MP_TAC(SET_RULE`t2+t3 = &1-t1 ==> (inv (&1-t1))*(t2+t3) = (inv (&1-t1))* (&1-t1:real)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)=D<=>D- A*C=A*B`] THEN REDUCE_ARITH_TAC THEN STRIP_TAC THEN EXISTS_TAC`inv ((&1 - t1:real))*(t3:real)` THEN STRIP_TAC THENL[ ASM_TAC THEN REAL_ARITH_TAC; STRIP_TAC THENL[ ASM_TAC THEN REAL_ARITH_TAC; ASM_REWRITE_TAC[VECTOR_ARITH`(inv (&1 - t1) * t2) % v + (inv (&1 - t1) * t3) % ((&1 - t) % u + t % w)-x= inv (&1 - t1) %( t2 % v + t3 % ((&1 - t) % u + t % w))-x:real^3`] THEN FIND_ASSUM MP_TAC `norm(x-y1:real^3)= &1` THEN FIND_ASSUM MP_TAC `y1 = t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w):real^3` THEN DISCH_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] THEN REWRITE_TAC[VECTOR_ARITH`(B%A+C+D)-A=C+D-(&1-B)%A`] THEN DISCH_TAC THEN MP_TAC(SET_RULE`norm (t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x:real^3) = &1 ==> (inv (&1-t1))*(norm (t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x) ) = (inv (&1-t1))* (&1):real`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[] THEN REDUCE_ARITH_TAC THEN MP_TAC(ISPECL[`inv(&1-t1:real)`;`t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x:real^3`]NORM_MUL) THEN MP_TAC(ISPEC`inv(&1-t1:real)`REAL_ABS_REFL) THEN RESP_TAC THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+C-E%D)=A%(B+C)-(A*E)%D`] THEN REDUCE_VECTOR_TAC THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[(th)]) THEN ASM_REWRITE_TAC[REAL_INV_INV;VECTOR_ARITH`(&1-A)%(B%C-D)+D= A%D+(B*(&1-A))%C:real^3`] THEN REDUCE_VECTOR_TAC]]]);;
let same_projective_sphere_gt_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) (t:real) (y1:real^3). FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~collinear {x, v, (&1 - t) % u + t % w} /\ (y1 IN aff_gt {x} {v, (&1-t)%u+(t:real)% (w:real^3)} INTER ballnorm_fan x) ==> ?s:real. &0 <= s/\ s<= &1 /\ y1=inv(norm((&1 - s) % v + s % ((&1 - t) % u + t % w)-x))%((&1 - s) % v + s % ((&1 - t) % u + t % w)-x)+x`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN MP_TAC(ISPECL[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;]th3) THEN RESA_TAC THEN MP_TAC(ISPECL[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;]AFF_GT_1_2) THEN RESA_TAC THEN REMOVE_THEN"A" MP_TAC THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;dist;ballnorm_fan] THEN STRIP_TAC THEN SUBGOAL_THEN`~(&1 - t1= &0)/\ &0 < &1-t1` ASSUME_TAC THENL[ REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPECL[`t2:real`;`t3:real`]REAL_LT_ADD) THEN REAL_ARITH_TAC; MP_TAC(ISPEC`(&1 -t1:real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`(&1-t1:real)`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(ISPECL[`inv ((&1 - t1:real))`;`(t2:real)`]REAL_LT_MUL) THEN RESA_TAC THEN MP_TAC(ISPECL[`inv ((&1 - t1:real))`;`(t3:real)`]REAL_LT_MUL) THEN RESA_TAC THEN FIND_ASSUM MP_TAC `t1+t2+t3= &1:real` THEN REWRITE_TAC[REAL_ARITH`A+B+C=D<=>B+C=D-A`] THEN DISCH_TAC THEN MP_TAC(SET_RULE`t2+t3 = &1-t1 ==> (inv (&1-t1))*(t2+t3) = (inv (&1-t1))* (&1-t1:real)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)=D<=>D- A*C=A*B`] THEN REDUCE_ARITH_TAC THEN STRIP_TAC THEN EXISTS_TAC`inv ((&1 - t1:real))*(t3:real)` THEN STRIP_TAC THENL[ ASM_TAC THEN REAL_ARITH_TAC; STRIP_TAC THENL[ ASM_TAC THEN REAL_ARITH_TAC; ASM_REWRITE_TAC[VECTOR_ARITH`(inv (&1 - t1) * t2) % v + (inv (&1 - t1) * t3) % ((&1 - t) % u + t % w)-x= inv (&1 - t1) %( t2 % v + t3 % ((&1 - t) % u + t % w))-x:real^3`] THEN FIND_ASSUM MP_TAC `norm(x-y1:real^3)= &1` THEN FIND_ASSUM MP_TAC `y1 = t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w):real^3` THEN DISCH_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] THEN REWRITE_TAC[VECTOR_ARITH`(B%A+C+D)-A=C+D-(&1-B)%A`] THEN DISCH_TAC THEN MP_TAC(SET_RULE`norm (t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x:real^3) = &1 ==> (inv (&1-t1))*(norm (t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x) ) = (inv (&1-t1))* (&1):real`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[] THEN REDUCE_ARITH_TAC THEN MP_TAC(REAL_ARITH`&0<inv(&1-t1:real)==> &0<= inv(&1-t1:real)`) THEN RESA_TAC THEN MP_TAC(ISPECL[`inv(&1-t1:real)`;`t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x:real^3`]NORM_MUL) THEN MP_TAC(ISPEC`inv(&1-t1:real)`REAL_ABS_REFL) THEN RESP_TAC THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+C-E%D)=A%(B+C)-(A*E)%D`] THEN REDUCE_VECTOR_TAC THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[(th)]) THEN ASM_REWRITE_TAC[REAL_INV_INV;VECTOR_ARITH`(&1-A)%(B%C-D)+D= A%D+(B*(&1-A))%C:real^3`] THEN REDUCE_VECTOR_TAC]]]);;
let separate1_sphere_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) (v1:real^3) (u1:real^3). FAN(x,V,E) /\ {v,u} INTER {v1,u1}={} /\ {v,u} IN E/\ {u,w} IN E /\ {v1,u1} IN E /\ ~(coplanar{x,v,u,w}) ==> ?h:real. (&0 < h) /\ (h<= &1) /\ (!t:real. &0<t /\ t<h ==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge {x} {v1, u1} INTER ballnorm_fan x={})`,
REPEAT STRIP_TAC THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN MRESA_TAC exist_close_fan[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`; `(v1:real^3)`;` (u1:real^3)`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THA") THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A" ) THEN MRESA_TAC exists_point_small_edges_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3)`;`(u:real^3) `;`(w:real^3)`;`h:real`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"B" ) THEN EXISTS_TAC`min ((h':real)/ &2) (t1:real)` THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*1*)[ ASM_TAC THEN REAL_ARITH_TAC;(*1*) STRIP_TAC THENL(*2*)[ ASM_TAC THEN REAL_ARITH_TAC;(*2*) REPEAT STRIP_TAC THEN REWRITE_TAC[EXTENSION] THEN GEN_TAC THEN EQ_TAC THENL(*3*)[ STRIP_TAC THEN REWRITE_TAC[EMPTY;IN_ELIM_THM] THEN SUBGOAL_THEN `!y1:real^3. y1 IN aff_gt {x} {v, (&1-t)%u+(t:real)% (w:real^3)} INTER ballnorm_fan x ==> ?y2:real^3. y2 IN aff_ge {x:real^3} {(v:real^3), (u:real^3)} INTER ballnorm_fan x /\ dist (y1,y2)<(h:real)` ASSUME_TAC THENL(*4*)[ MP_TAC(REAL_ARITH`&0 <(t:real)/\ &0< h' /\ t < min ((h':real)/ &2) (t1:real)==> &0 <= t /\ t<=t1 /\ t< h'`) THEN RESA_TAC THEN REMOVE_THEN"A" (fun th-> MP_TAC(ISPEC`t:real`th)) THEN RESA_TAC THEN REPEAT STRIP_TAC THEN MRESA_TAC same_projective_sphere_gt_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3)`;`(u:real^3) `;`(w:real^3)`;` (t:real) `;`(y1:real^3)`] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] THEN MRESA_TAC AFF_GE_1_2[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;dist] THEN MRESA_TAC expansion1_convex_fan[`(v:real^3)`;` (u:real^3)`;` s:real`] THEN MRESA_TAC origin_point_not1_in_convex_fan[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`] THEN SUBGOAL_THEN`~(x=(&1-s)%v+s%u:real^3)` ASSUME_TAC THENL(*5*)[ POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN RESA_TAC;(*5*) MP_TAC(ISPECL[`x:real^3`;`(&1 - s) % v + s % u:real^3`]imp_norm_not_zero_fan) THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] THEN RESA_TAC THEN ASSUME_TAC(ISPEC`(&1 - s) % v + s % u-x:real^3`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(&0 =norm((&1 - s) % v + s % u-x:real^3)) /\ &0 <= norm((&1 - s) % v + s % u-x:real^3)==> &0 <norm((&1 - s) % v + s % u-x:real^3)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(norm((&1 - s) % v + s % u-x:real^3))`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(ISPEC`(norm((&1 - s) % v + s % u-x:real^3))`REAL_LE_INV) THEN RESA_TAC THEN EXISTS_TAC`inv (norm ((&1 - s) % v + s % u - x)) % ((&1 - s) % v + s % u - x) +x:real^3` THEN STRIP_TAC THENL(*6*)[ STRIP_TAC THENL(*7*)[ EXISTS_TAC`&1 - inv (norm ((&1 - s) % v + s % u - x:real^3)) ` THEN EXISTS_TAC`inv (norm ((&1 - s) % v + s % u - x:real^3)) * (&1 - s)` THEN EXISTS_TAC`inv (norm ((&1 - s) % v + s % u - x:real^3)) * (s)` THEN REWRITE_TAC[VECTOR_ARITH`A%(B%C + a%b-c)+c=(&1-A)%c+(A*B)%C+(A*a)%b:real^3`] THEN ASM_REWRITE_TAC[REAL_ARITH`&1-A+A*(&1-C)+A*C= &1`] THEN STRIP_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC;(*7*) REWRITE_TAC[ballnorm_fan;IN_ELIM_THM;dist;VECTOR_ARITH`A-(B+A)=(--B):real^3`;NORM_NEG;NORM_MUL] THEN MP_TAC(ISPEC`inv (norm ((&1 - s) % v + s % u - x:real^3))`REAL_ABS_REFL) THEN RESP_TAC THEN ASM_REWRITE_TAC[]](*7*);(*6*) ASM_REWRITE_TAC[VECTOR_ARITH`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x) + x - (inv (norm ((&1 - s) % v + s % u - x)) % ((&1 - s) % v + s % u - x) + x)= inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x) - (inv (norm ((&1 - s) % v + s % u - x)) % ((&1 - s) % v + s % u - x) ):real^3`] THEN REMOVE_THEN "B" (fun th-> MP_TAC(ISPEC`t:real`th)) THEN RESA_TAC THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) THEN RESA_TAC THEN ASM_REWRITE_TAC[NORM_SUB]](*6*)](*5*);(*4*) POP_ASSUM (fun th->MP_TAC(ISPEC`x':real^3`th)) THEN MP_TAC(SET_RULE` x' IN aff_gt {x} {v, (&1 - t) % u + t % w} INTER aff_ge {x} {v1, u1} INTER ballnorm_fan x ==> x' IN aff_ge {x} {v1, u1:real^3} INTER ballnorm_fan x /\ x' IN aff_gt {x} {v, (&1 - t) % u + t % w:real^3} INTER ballnorm_fan x`) THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN SIMP_TAC[] THEN REPEAT STRIP_TAC THEN REMOVE_THEN "THA" (fun th-> MP_TAC(ISPECL[`y2:real^3`;`x':real^3`]th)) THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN SIMP_TAC[dist;NORM_SUB] THEN REAL_ARITH_TAC](*4*);(*3*) SET_TAC[]]]]);;
let SCALE_AFF_TAC th=REPEAT GEN_TAC THEN DISCH_TAC THEN REPEAT GEN_TAC THEN MRESAL_TAC th[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC`&1 - a* t2- a* t3:real` THEN EXISTS_TAC`a* t2:real` THEN EXISTS_TAC`a* t3:real` THEN ONCE_REWRITE_TAC[TAUT`A/\B/\C/\D<=>D/\ A/\B/\C`] THEN STRIP_TAC THENL[ ASM_REWRITE_TAC[] THEN FIND_ASSUM MP_TAC `t1+t2+t3= &1:real` THEN REWRITE_TAC[REAL_ARITH`A+B+C= &1<=>A= &1- B -C:real`] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC; MP_TAC(ISPECL[`a:real`;`(t2:real)`]REAL_LT_MUL) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`a:real`;`(t3:real)`] THEN MRESA_TAC REAL_LE_MUL[`a:real`;`(t2:real)`] THEN MRESA_TAC REAL_LE_MUL[`a:real`;`(t3:real)`] THEN ASM_TAC THEN REAL_ARITH_TAC];;
let scale_aff_ge_fan=
prove(`!x:real^3 v:real^3 u:real^3. DISJOINT {x} {v,u} ==> (!y:real^3 a:real. y IN aff_ge {x} {v,u} /\ &0 <= a==> a%(y-x)+x IN aff_ge{x} {v,u})`,
SCALE_AFF_TAC AFF_GE_1_2);;
let scale_aff_gt_fan=
prove(`!x:real^3 v:real^3 u:real^3. DISJOINT {x} {v,u} ==> (!y:real^3 a:real. y IN aff_gt {x} {v,u} /\ &0 < a==> a%(y-x)+x IN aff_gt{x} {v,u})`,
SCALE_AFF_TAC AFF_GT_1_2);;
let origin_is_not_aff_gt_fan=
prove(`!x:real^3 v:real^3 u:real^3. ~(u IN aff {x,v}) /\ DISJOINT {x} {v,u}==> ~(x IN aff_gt {x} {v,u})`,
REPEAT GEN_TAC THEN STRIP_TAC THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN REWRITE_TAC[GSYM FORALL_NOT_THM;DE_MORGAN_THM] THEN REPEAT STRIP_TAC THEN DISJ_CASES_TAC(REAL_ARITH`~( &0< (t2:real))\/ ( &0< (t2:real))`) THENL[ASM_MESON_TAC[]; DISJ_CASES_TAC(REAL_ARITH`~( &0< (t3:real))\/ ( &0< (t3:real))`) THENL[ASM_MESON_TAC[]; DISJ_CASES_TAC(REAL_ARITH`~( t1+t2+(t3:real)= &1)\/ ( t1+t2+(t3:real)= &1)`) THENL[ASM_MESON_TAC[]; ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`A+B+C= &1<=>A= &1- B -C:real`] THEN DISCH_TAC THEN MP_TAC(REAL_ARITH`&0<t3:real==> ~(t3= &0)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[VECTOR_ARITH`A=( &1-B-C) %A+B%E+C%D <=> C%(D-A)= (--B)%(E-A)`] THEN STRIP_TAC THEN MP_TAC(SET_RULE`t3 % (u - x) = (--t2) % (v - x):real^3 ==> (inv (t3))%(t3 % (u - x)) = (inv (t3))%((--t2) % (v - x))`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`] THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[VECTOR_ARITH`A-B=C%(V-B)<=>A=( &1-C)%B+C%V`] THEN FIND_ASSUM MP_TAC `~(u IN aff {x,v}:real^3->bool)` THEN MATCH_MP_TAC MONO_NOT THEN STRIP_TAC THEN REWRITE_TAC[aff; AFFINE_HULL_2; IN_ELIM_THM] THEN EXISTS_TAC`&1 - inv t3 * --t2:real` THEN EXISTS_TAC`inv t3 * --t2:real` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC]]]);;
let fan_run_in_small1_is_fan=
prove( `!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 v1:real^3 u1:real^3. FAN(x,V,E) /\ {v,u} INTER {v1,u1}={} /\ {v,u} IN E/\ {u,w} IN E /\ {v1,u1} IN E /\ ~(coplanar{x,v,u,w}) ==> ?t1:real. &0 < t1 /\ t1 <= &1 /\ (!t:real. &0< t /\ t< t1 ==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v1,u1}={})`,
REPEAT STRIP_TAC THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u1:real^3)`; ` (v1:real^3)`] THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"BA") THEN MRESA_TAC separate1_sphere_fan[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3)`;` (w:real^3)`;` (v1:real^3)`;`(u1:real^3)`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH` &0 < t1/\ &0 < h ==> &0 < min (h:real) (t1:real)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH` t1 <= &1 /\ h <= &1==> min (h:real) (t1:real)<= &1`) THEN RESA_TAC THEN EXISTS_TAC`min (h:real) (t1:real)` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH` &0 < t /\ t< min (h:real) (t1:real)==> t< h /\ t<= t1 /\ &0 <= t`) THEN RESA_TAC THEN REMOVE_THEN "A"(fun th-> MRESA1_TAC th `(t:real)`) THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN REMOVE_THEN "BA"(fun th-> MRESA1_TAC th `(t:real)`) THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] THEN MRESA_TAC origin_is_not_aff_gt_fan[`x:real^3`;`v:real^3`;`(&1-t)%u+t%w:real^3`] THEN REWRITE_TAC[EXTENSION;INTER;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC THENL[ REPEAT STRIP_TAC THEN SUBGOAL_THEN`~(x=x':real^3)`ASSUME_TAC THENL[ POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; MRESA_TAC imp_norm_not_zero_fan[`x':real^3`;`x:real^3`] THEN ASSUME_TAC(ISPEC`x'-x:real^3`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(norm(x'-x:real^3)= &0) /\ &0 <= norm(x'-x:real^3)==> &0 <norm(x'-x:real^3)`) THEN RESA_TAC THEN MRESA1_TAC REAL_LE_INV `norm(x'-x:real^3)` THEN MRESA1_TAC REAL_LT_INV `norm(x'-x:real^3)` THEN MRESA1_TAC REAL_MUL_LINV `norm(x'-x:real^3)` THEN MRESA_TAC scale_aff_ge_fan[`x:real^3`;`v1:real^3`;`u1:real^3`] THEN POP_ASSUM(fun th -> MRESA_TAC th [`x':real^3`;`inv(norm(x'-x:real^3))`]) THEN MRESA_TAC scale_aff_gt_fan[`x:real^3`;`v:real^3`;`(&1-t)%u+t%w:real^3`] THEN POP_ASSUM(fun th -> MRESA_TAC th [`x':real^3`;`inv(norm(x'-x:real^3))`]) THEN SUBGOAL_THEN`inv (norm (x' - x)) % (x' - x) + x IN ballnorm_fan x:real^3->bool` ASSUME_TAC THENL[ MRESA1_TAC REAL_ABS_REFL `inv(norm(x'-x:real^3))` THEN ASM_REWRITE_TAC[ballnorm_fan;IN_ELIM_THM;dist;VECTOR_ARITH`B-(A+B)= --A:real^3`;NORM_NEG;NORM_MUL]; ASM_TAC THEN SET_TAC[]]]; SET_TAC[]]);;
let azim_line_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3 t:real^1. ~coplanar {x,v,u,(&1-drop(t))%u+drop(t)%w} ==> (\(t:real^1). azim x v u ((&1 - drop(t)) % u + drop(t) % w)) real_continuous at t`,
REPEAT STRIP_TAC THEN REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1; o_DEF; CONTINUOUS_AT_LIFT_COMPONENT] THEN MP_TAC(ISPECL[`(\(t:real^1). ((&1 - drop(t)) % (u:real^3) + drop(t) %(w:real^3)))`;`(\(w:real^3). lift(azim (x:real^3) (v:real^3) (u:real^3) w))`;`t:real^1`] CONTINUOUS_AT_COMPOSE) THEN REWRITE_TAC[o_DEF] THEN DISCH_TAC THEN POP_ASSUM MATCH_MP_TAC THEN REWRITE_TAC[ISPECL[`u:real^3`;`w:real^3`;`t:real^1`]collinear1_continuous_fan] THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`((&1 - drop(t)) % (u:real^3) + drop(t) %(w:real^3))`]REAL_CONTINUOUS_AT_AZIM) THEN REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1; o_DEF; CONTINUOUS_AT_LIFT_COMPONENT] THEN ASM_MESON_TAC[]);;
(******fully surrounded*******)
let fan81=new_definition`fan81 (x:real^3,(V:real^3->bool),(E:(real^3->bool)->bool)):bool<=>(!v:real^3 u:real^3. {v,u} IN E ==> azim_fan x V E v u <pi)`;;
let fan80=new_definition`fan80 (x:real^3,(V:real^3->bool),(E:(real^3->bool)->bool)):bool<=>(!v:real^3 u:real^3. {v,u} IN E ==> &0< azim x v u (sigma_fan x V E v u) /\ azim x v u (sigma_fan x V E v u) <pi)`;;
let continuous_coplanar_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3. ~(coplanar{x,v,u,w}) ==>(!t:real. ~(t= &0) ==> ~coplanar {x,v,u,(&1-t)%u+t%w} )`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[] THEN FIND_ASSUM MP_TAC`~(coplanar{x,v,u,w:real^3})` THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[COPLANAR_DET_EQ_0;VECTOR_ARITH`((&1 - t) % u + t % w) - x=(&1 - t) % (u-x) + t % (w - x):real^3`;DET_3;VECTOR_3;VECTOR_ADD_COMPONENT;VECTOR_MUL_COMPONENT ;REAL_ARITH`(v - x)$1 * (u - x)$2 * ((&1 - t) * (u - x)$3 + t * (w - x)$3) + (v - x)$2 * (u - x)$3 * ((&1 - t) * (u - x)$1 + t * (w - x)$1) + (v - x)$3 * (u - x)$1 * ((&1 - t) * (u - x)$2 + t * (w - x)$2) - (v - x)$1 * (u - x)$3 * ((&1 - t) * (u - x)$2 + t * (w - x)$2) - (v - x)$2 * (u - x)$1 * ((&1 - t) * (u - x)$3 + t * (w - x)$3) - (v - x)$3 * (u - x)$2 * ((&1 - t) * (u - x)$1 + t * (w - x)$1)= t*((v - x)$1 * (u - x)$2 * ((w - x)$3) + (v - x)$2 * (u - x)$3 * ( (w - x)$1) + (v - x)$3 * (u - x)$1 * ((w - x)$2) - (v - x)$1 * (u - x)$3 * ((w - x)$2) - (v - x)$2 * (u - x)$1 * ( (w - x)$3) - (v - x)$3 * (u - x)$2 * ( (w - x)$1)):real`;REAL_ENTIRE] THEN ASM_TAC THEN REAL_ARITH_TAC);;
let open_is_not_zero_fan=
prove(`open{y:real^1 | ?x. ~(x = &0) /\ y = lift x}`,
(
let equality_real_fan=prove(`{y:real^1 | ?x. ~(x = &0) /\ y = lift x}={y:real^1 | ~(drop y = &0)}`,
REWRITE_TAC[EXTENSION;IN_ELIM_THM]
THEN GEN_TAC
THEN EQ_TAC
THENL[
STRIP_TAC
THEN ASM_REWRITE_TAC[LIFT_DROP];
STRIP_TAC
THEN EXISTS_TAC`drop (x:real^1)`
THEN ASM_REWRITE_TAC[LIFT_DROP]])in
(let ngu=prove(`{x | x IN (:real^1) /\ x = vec 0}={x | x IN (:real^1) /\ x$1 = &0}`,
REWRITE_TAC[EXTENSION;IN_ELIM_THM]
THEN GEN_TAC
THEN EQ_TAC
THENL[STRIP_TAC
THEN ASM_REWRITE_TAC[VEC_COMPONENT];
SIMP_TAC[IN_UNIV;CART_EQ;LAMBDA_BETA;VEC_COMPONENT;DIMINDEX_1;ARITH_RULE`1<=i /\ i<=1<=>i=1`]])
in
REWRITE_TAC[equality_real_fan]
THEN REWRITE_TAC[OPEN_CLOSED;DIFF; IN_ELIM_THM;]
THEN MP_TAC(ISPECL[`(\(t:real^1). t)`;`(:real^1)`;`(vec 0):real^1`]CONTINUOUS_CLOSED_PREIMAGE_CONSTANT)
THEN MP_TAC(ISPECL[`0`;`1`]VEC_COMPONENT)
THEN SIMP_TAC[CONTINUOUS_ON_ID;CLOSED_UNIV; DIMINDEX_1;drop;ngu])));;
let azim_continuous_when_not_coplanar=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3. ~coplanar {x,v,u,w} ==> (\(t:real). azim x v u ((&1 - t) % u + t % w)) real_continuous_on {t:real| ~(t= &0)}`,
REWRITE_TAC[REAL_CONTINUOUS_ON;o_DEF;IMAGE;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN ASSUME_TAC(open_is_not_zero_fan) THEN MRESA_TAC CONTINUOUS_ON_EQ_CONTINUOUS_AT[`(\t:real^1. lift (azim x v u ((&1 - drop t) % u + drop t % w))):real^1->real^1`;`{y:real^1| ?x. ~(x = &0) /\ y = lift x}`] THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[LIFT_DROP] THEN MRESAL_TAC azim_line_fan[`x:real^3`;` v:real^3`;` u:real^3`;` w:real^3`;` (lift x''):real^1`][REAL_CONTINUOUS_CONTINUOUS1; o_DEF;LIFT_DROP] THEN POP_ASSUM MATCH_MP_TAC THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `x'':real`));;
let injective_azim_coplanar=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3. ~coplanar {x,v,u,w} ==> !a:real b:real. ~(a= &0) /\ ~(b= &0)/\ (\(t:real). azim x v u ((&1 - t) % u + t % w))a=(\(t:real). azim x v u ((&1 - t) % u + t % w))b==>a=b`,
REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MRESA_TAC continuous_coplanar_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM(fun th -> MP_TAC(ISPEC`a:real`th)THEN ASSUME_TAC(th)) THEN POP_ASSUM(fun th -> MP_TAC(ISPEC`b:real`th)) THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`(&1 - a) % u + a % w:real^3`;`u:real^3`] THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`(&1 - b) % u + b % w:real^3`;`u:real^3`] THEN MRESA_TAC AZIM_EQ [`x:real^3`;`v:real^3`;`u:real^3`;`(&1 - b) % u + b % w:real^3`;`(&1 - a) % u + a % w:real^3`;] THEN MRESA_TAC AZIM_EQ_0 [`x:real^3`;`v:real^3`;`(&1 - a) % u + a % w:real^3`;`(&1 - b) % u + b % w:real^3`;] THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR [`x:real^3`;`v:real^3`;`(&1 - a) % u + a % w:real^3`;`(&1 - b) % u + b % w:real^3`;] THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC`~coplanar {x,v,u,w:real^3}` THEN REWRITE_TAC[COPLANAR_DET_EQ_0;VECTOR_ARITH`((&1 - t) % u + t % w) - x=(&1 - t) % (u-x) + t % (w - x):real^3`;DET_3;VECTOR_3;VECTOR_ADD_COMPONENT;VECTOR_MUL_COMPONENT] THEN STRIP_TAC THEN REWRITE_TAC[REAL_ARITH`(v - x)$1 * ((&1 - a) * (u - x)$2 + a * (w - x)$2) * ((&1 - b) * (u - x)$3 + b * (w - x)$3) + (v - x)$2 * ((&1 - a) * (u - x)$3 + a * (w - x)$3) * ((&1 - b) * (u - x)$1 + b * (w - x)$1) + (v - x)$3 * ((&1 - a) * (u - x)$1 + a * (w - x)$1) * ((&1 - b) * (u - x)$2 + b * (w - x)$2) - (v - x)$1 * ((&1 - a) * (u - x)$3 + a * (w - x)$3) * ((&1 - b) * (u - x)$2 + b * (w - x)$2) - (v - x)$2 * ((&1 - a) * (u - x)$1 + a * (w - x)$1) * ((&1 - b) * (u - x)$3 + b * (w - x)$3) - (v - x)$3 * ((&1 - a) * (u - x)$2 + a * (w - x)$2) * ((&1 - b) * (u - x)$1 + b * (w - x)$1)= (b-a)*((v - x)$1 * (u - x)$2 * (w - x)$3 + (v - x)$2 * (u - x)$3 * (w - x)$1 + (v - x)$3 * (u - x)$1 * (w - x)$2 - (v - x)$1 * (u - x)$3 * (w - x)$2 - (v - x)$2 * (u - x)$1 * (w - x)$3 - (v - x)$3 * (u - x)$2 * (w - x)$1)`;REAL_ENTIRE] THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);;
let fan_run_in_small21_is_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v,w1} IN E /\ ~coplanar {x,v,u,w} ==> ?t1:real. &0<t1 /\ t1<= &1 /\ (!t:real. &0< t /\ t<= t1==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v,w1}={})`,
REPEAT STRIP_TAC THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN DISJ_CASES_TAC(SET_RULE`(?h:real. &0<h /\ h<= &1/\ azim x v u w1=azim x v u ((&1-h)%u+h%w:real^3))\/ ~(?h:real. &0<h /\ h<= &1 /\ azim x v u ((&1-h)%u+h%w:real^3)=azim x v u w1)`) THENL(*1*)[ POP_ASSUM MP_TAC THEN STRIP_TAC THEN EXISTS_TAC`min (t1:real) ((h:real)/ &2)` THEN STRIP_TAC THENL(*2*)[ ASM_TAC THEN REAL_ARITH_TAC;(*2*) STRIP_TAC THENL(*3*)[ASM_TAC THEN REAL_ARITH_TAC;(*3*) REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0<t:real==> &0<=t`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`(t:real)<= min (t1:real) (h:real/ &2) ==> t <= t1`) THEN RESA_TAC THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; ` (v:real^3)`] THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM;] THEN GEN_TAC THEN EQ_TAC THENL(*4*)[ DISCH_TAC THEN SUBGOAL_THEN `(&1-t)%u+t%w IN aff_ge {x,v} {w1}:real^3->bool` ASSUME_TAC THENL(*5*)[ POP_ASSUM MP_TAC THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = t1'' % x + t2' % v + t3' % w1<=> t3 % ((&1 - t) % u + t % w) = (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3`] THEN MP_TAC(REAL_ARITH`&0<t3:real==> ~(t3= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`(t3:real)` THEN STRIP_TAC THEN MP_TAC(SET_RULE` t3 % ((&1 - t) % u + t % w) = (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3 ==> (inv (t3))%(t3 % ((&1 - t) % u + t % w)) = (inv (t3))%((t1''-t1') % x + (t2'-t2) % v + t3' % w1)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`A%(B%X+C%Y+D%Z)=(A*B)%X+(A*C)%Y+(A*D)%Z`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN FIND_ASSUM MP_TAC`t1'' + t2' + t3' = &1:real` THEN FIND_ASSUM MP_TAC`t1' + t2 + t3 = &1:real` THEN DISCH_TAC THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM(th)]) THEN REWRITE_TAC[REAL_ARITH`t1'' + t2' + t3' = t1' + t2 + t3<=> (t1''-t1') + (t2'-t2) + t3' = t3:real`] THEN STRIP_TAC THEN MP_TAC(SET_RULE` (t1''-t1') + (t2'-t2) + t3' = t3 ==> (inv (t3))*((t1''-t1') + (t2'-t2) + t3') = (inv (t3))*t3`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C+D)=A*B+A*C+A*D`] THEN STRIP_TAC THEN EXISTS_TAC`inv t3 * (t1'' - t1'):real` THEN EXISTS_TAC`inv t3 * (t2' - t2):real` THEN EXISTS_TAC`inv t3 * t3':real` THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LE_INV THEN ASM_TAC THEN REAL_ARITH_TAC;(*5*) MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`(&1 - t) % u + t % w:real^3`;] THEN MRESA_TAC injective_azim_coplanar[`x:real^3`;` v:real^3`;` u:real^3`;` w:real^3`] THEN POP_ASSUM (fun th->MRESA_TAC th [`h:real`;`t:real`]) THEN ASM_TAC THEN REAL_ARITH_TAC](*5*)(*4*); SET_TAC[]]]];(*1*) POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[NOT_EXISTS_THM] THEN DISCH_THEN(LABEL_TAC"B") THEN EXISTS_TAC`t1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0<t:real==> &0<=t`) THEN RESA_TAC THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; ` (v:real^3)`] THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM;] THEN GEN_TAC THEN EQ_TAC THENL(*2*)[ DISCH_TAC THEN SUBGOAL_THEN `(&1-t)%u+t%w IN aff_ge {x,v} {w1}:real^3->bool` ASSUME_TAC THENL(*3*)[ POP_ASSUM MP_TAC THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = t1'' % x + t2' % v + t3' % w1<=> t3 % ((&1 - t) % u + t % w) = (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3`] THEN MP_TAC(REAL_ARITH`&0<t3:real==> ~(t3= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`(t3:real)` THEN STRIP_TAC THEN MP_TAC(SET_RULE` t3 % ((&1 - t) % u + t % w) = (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3 ==> (inv (t3))%(t3 % ((&1 - t) % u + t % w)) = (inv (t3))%((t1''-t1') % x + (t2'-t2) % v + t3' % w1)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`A%(B%X+C%Y+D%Z)=(A*B)%X+(A*C)%Y+(A*D)%Z`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN FIND_ASSUM MP_TAC`t1'' + t2' + t3' = &1:real` THEN FIND_ASSUM MP_TAC`t1' + t2 + t3 = &1:real` THEN DISCH_TAC THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM(th)]) THEN REWRITE_TAC[REAL_ARITH`t1'' + t2' + t3' = t1' + t2 + t3<=> (t1''-t1') + (t2'-t2) + t3' = t3:real`] THEN STRIP_TAC THEN MP_TAC(SET_RULE` (t1''-t1') + (t2'-t2) + t3' = t3 ==> (inv (t3))*((t1''-t1') + (t2'-t2) + t3') = (inv (t3))*t3`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C+D)=A*B+A*C+A*D`] THEN STRIP_TAC THEN EXISTS_TAC`inv t3 * (t1'' - t1'):real` THEN EXISTS_TAC`inv t3 * (t2' - t2):real` THEN EXISTS_TAC`inv t3 * t3':real` THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LE_INV THEN ASM_TAC THEN REAL_ARITH_TAC;(*3*) MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`(&1 - t) % u + t % w:real^3`;] THEN REMOVE_THEN "B"(fun th -> MRESAL1_TAC th `t:real`[DE_MORGAN_THM]) THEN ASM_TAC THEN REAL_ARITH_TAC]; SET_TAC[]]]);;
let fan_run_in_small2_is_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 w1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v,w1} IN E /\ ~coplanar {x,v,u,w} ==> ?t1:real. &0<t1 /\ t1<= &1 /\ (!t:real. &0< t /\ t< t1==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v,w1}={})`,
REPEAT STRIP_TAC THEN MRESA_TAC fan_run_in_small21_is_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;` w:real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN EXISTS_TAC`t1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t<t1==>t<=t1`) THEN ASM_REWRITE_TAC[] THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`));;
let AFF_GT_2_2=
prove(`!x u v w. DISJOINT {x, u} {v, w} ==> aff_gt {x, u} {v, w} = {y | ?t1 t2 t3 t4. &0 < t3 /\ &0 < t4 /\ t1 + t2 + t3 +t4= &1 /\ y = t1 % x + t2 %u + t3 % v + t4 % w}`,
AFF_TAC);;
let extension_in_aff_2_2_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E ==> (!t:real. &0< t /\ t< &1 ==> (!t1:real t2:real t3:real. &0<t3 /\ &0<t2 /\ t1+t2+t3= &1 ==>t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w) IN aff_gt {x,u} {w,v}))`,
REPEAT STRIP_TAC THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN SUBGOAL_THEN `DISJOINT {x,u:real^3} {w,v:real^3}` ASSUME_TAC THENL[ REWRITE_TAC[DISJOINT_SYM;SET_RULE`{v:real^3,w:real^3}= {v} UNION {w}`;DISJOINT_UNION] THEN REWRITE_TAC[SET_RULE`{v} UNION {w}={v:real^3,w:real^3}`] THEN ONCE_REWRITE_TAC[DISJOINT_SYM] THEN ASM_REWRITE_TAC[]; MRESAL_TAC AFF_GT_2_2[`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`][IN_ELIM_THM] THEN EXISTS_TAC`t1:real` THEN EXISTS_TAC`t3*(&1-t):real` THEN EXISTS_TAC`t3*(t):real` THEN EXISTS_TAC`t2:real` THEN ASM_REWRITE_TAC[REAL_ARITH`t1 + t3 * (&1 - t) + t3 * t +t2 = t1+t2+t3:real`;VECTOR_ARITH`t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w) = t1 % x + (t3 * (&1 - t)) % u + (t3 * t) % w+ t2 % v:real^3`] THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_TAC THEN REAL_ARITH_TAC]);;
let inequality3_aim_in_convex_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ (&0< azim x u w v ) /\ (azim x u w v <pi) ==> (!t:real. &0< t /\ t< &1 ==> (!t1:real t2:real t3:real. &0<t3 /\ &0<t2 /\ t1+t2+t3= &1 ==> &0< azim x u w (t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w)) /\ azim x u w (t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w))< azim x u w v))`,
REPEAT STRIP_TAC THEN FIND_ASSUM MP_TAC`{v,u} IN (E:(real^3->bool)->bool)` THEN ONCE_REWRITE_TAC[SET_RULE`{v,u}={u,v}`] THEN STRIP_TAC THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`; ` (u:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;` u:real^3`;`w:real^3`;`v:real^3`] THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) THEN DISCH_TAC THEN MRESA_TAC extension_in_aff_2_2_fan[`x:real^3`;` v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM(fun th-> MRESA1_TAC th `t:real`) THEN POP_ASSUM(fun th-> MRESAL_TAC th [`t1:real`;`t2:real`;`t3:real`][wedge;IN_ELIM_THM]));;
let fan_run_in_small3_is_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 w1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {u,w1} IN E /\ ~coplanar {x,v,u,w} /\ sigma_fan x V E u w=v /\ (&0< azim x u w v ) /\ (azim x u w v <pi) ==> ?t1:real. &0<t1 /\ t1<= &1 /\ (!t:real. &0< t /\ t< t1==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {u,w1}={})`,
REPEAT STRIP_TAC THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN EXISTS_TAC`t1:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0<t:real==> &0<=t /\ ~(t= &0)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`t<t1 /\ t1<= &1==>t<=t1 /\ t< &1`) THEN RESA_TAC THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; ` (u:real^3)`] THEN REWRITE_TAC[EXTENSION;INTER;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC THENL(*1*)[ MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] THEN STRIP_TAC THEN SUBGOAL_THEN `x' IN (aff_ge {x,u} {w1}:real^3->bool)`ASSUME_TAC THENL(*2*)[ POP_ASSUM MP_TAC THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w1:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`u:real^3`;`w1:real^3`][IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC`t1'':real` THEN EXISTS_TAC`t2':real` THEN EXISTS_TAC`t3':real` THEN ASM_REWRITE_TAC[];(*2*) POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN MRESA_TAC inequality3_aim_in_convex_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`] THEN POP_ASSUM(fun th-> MRESA1_TAC th `t:real`) THEN POP_ASSUM(fun th-> MRESA_TAC th [`t1':real`;`t2:real`;`t3:real`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"BE") THEN DISCH_THEN(LABEL_TAC"YEU") THEN SUBGOAL_THEN`~collinear {x, u, x':real^3}`ASSUME_TAC THENL(*3*)[ MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `t:real`) THEN ASM_REWRITE_TAC[collinear_fan;] THEN POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[coplanar;aff; AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC`x:real^3` THEN EXISTS_TAC`v:real^3` THEN EXISTS_TAC`u:real^3` THEN SUBGOAL_THEN`(x:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL(*4*)[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`&1` THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&0` THEN REDUCE_ARITH_TAC THEN VECTOR_ARITH_TAC;(*4*) SUBGOAL_THEN`(v:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL(*5*)[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1` THEN EXISTS_TAC`&0` THEN REDUCE_ARITH_TAC THEN VECTOR_ARITH_TAC;(*5*) SUBGOAL_THEN`(u:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL(*6*)[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1` THEN REDUCE_ARITH_TAC THEN VECTOR_ARITH_TAC;(*6*) SUBGOAL_THEN`((&1 - t) % u + t % w:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL(*7*)[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(REAL_ARITH`&0<t3:real==> ~(t3= &0)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = u' % x + v' % u <=>t3 % ((&1 - t) % u + t % w) = (u'-t1') % x -t2 % v+v' % u:real^3`] THEN STRIP_TAC THEN MP_TAC(SET_RULE` t3 % ((&1 - t) % u + t % w) = (u'-t1') % x -t2 % v+v' % u ==> (inv (t3))%(t3 % ((&1 - t) % u + t % w) ) = (inv (t3))%((u'-t1') % x -t2 % v+v' % u):real^3`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B-C+D)=A%B-A%C+A%D`;VECTOR_ARITH`A%B%C=(A*B)%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC`(inv t3 * (u' - t1')):real` THEN EXISTS_TAC`-- (inv t3 * t2):real` THEN EXISTS_TAC`(inv t3 * v'):real` THEN ASM_REWRITE_TAC[VECTOR_ARITH`A+(--b)%C+d=A-b%C+d`;REAL_ARITH`inv t3 * (u' - t1') + --(inv t3 * t2) + inv t3 * v'=inv t3 * (t3+(u'+v') - (t1'+ t2+t3))`;REAL_ARITH`A+ &1- &1=A`];(*7*) ASM_TAC THEN SET_TAC[]](*7*)](*6*)](*5*)](*4*);(*3*) MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`u:real^3`;`x':real^3`;`w1:real^3`;] THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`u:real^3`;`x':real^3`;`w1:real^3`;] THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`;`x':real^3`;] THEN REMOVE_THEN"BE" MP_TAC THEN REMOVE_THEN"YEU" MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN FIND_ASSUM MP_TAC`(sigma_fan x V E u w = (v:real^3))` THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge u V E = {w:real^3}) \/ ~(set_of_edge u V E = {w})`) THENL(*4*)[ FIND_ASSUM MP_TAC`w1 IN set_of_edge (u:real^3) V E` THEN POP_ASSUM (fun th-> REWRITE_TAC[(th);IN_SING]) THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC (ISPECL[`x:real^3`;`u:real^3`;`w:real^3`]AZIM_REFL) THEN REAL_ARITH_TAC;(*4*) DISJ_CASES_TAC(SET_RULE`(w1:real^3)=w \/ ~((w1:real^3)=w)`) THENL(*5*)[ ASM_REWRITE_TAC[] THEN MP_TAC (ISPECL[`x:real^3`;`u:real^3`;`w:real^3`]AZIM_REFL) THEN REAL_ARITH_TAC;(*5*) MRESA_TAC SIGMA_FAN[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(u:real^3)`;`(w:real^3)`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `w1:real^3`) THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]]]; SET_TAC[]]);;
let properties_fully_surrounded=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ (&0< azim x u w v ) /\ (azim x u w v <pi) ==> ~coplanar {x,v,u,w}`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`{x,v,u,w}={x,u,w,v}`] THEN STRIP_TAC THEN FIND_ASSUM MP_TAC`{v,u} IN (E:(real^3->bool)->bool)` THEN REWRITE_TAC[SET_RULE`{v,u}={u,v}`] THEN STRIP_TAC THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`; ` (u:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`] THEN ASM_TAC THEN REAL_ARITH_TAC);;
let fan_run_in_small_is_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 v1:real^3 w1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v1,w1} IN E /\ (&0< azim x u w v ) /\ (azim x u w v <pi) /\ sigma_fan x V E u w = v ==> ?t1:real. &0<t1 /\ t1<= &1 /\ (!t:real. &0< t /\ t< t1==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v1,w1}={})`,
(
let lem=prove(`!x v v1. aff_ge {x} {v1, v}=aff_ge {x} {v, v1}`,
REPEAT STRIP_TAC
THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`]
THEN SIMP_TAC[]) in

REPEAT STRIP_TAC
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`]
THEN DISJ_CASES_TAC(SET_RULE`(v1=v)\/ ~(v1=v:real^3)`)
THENL[
MRESA_TAC fan_run_in_small2_is_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v1:real^3`;`u:real^3`;` w:real^3`;`w1:real^3`];

DISJ_CASES_TAC(SET_RULE`(v1=u)\/ ~(v1=u:real^3)`)
THENL[
MRESA_TAC fan_run_in_small3_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` v1:real^3`;` w:real^3`;`w1:real^3`];
 DISJ_CASES_TAC(SET_RULE`(w1=v)\/ ~(w1=v:real^3)`)
THENL[
FIND_ASSUM MP_TAC`{v1,w1} IN (E:(real^3->bool)->bool)`
THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`]
THEN STRIP_TAC
THEN MRESA_TAC fan_run_in_small2_is_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w1:real^3`;`u:real^3`;` w:real^3`;`v1:real^3`]
THEN EXISTS_TAC`t1:real`
THEN ASM_REWRITE_TAC[lem];
DISJ_CASES_TAC(SET_RULE`(w1=u)\/ ~(w1=u:real^3)`)
THENL[
FIND_ASSUM MP_TAC`{v1,w1} IN (E:(real^3->bool)->bool)`
THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`]
THEN STRIP_TAC
THEN MRESA_TAC fan_run_in_small3_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` w1:real^3`;` w:real^3`;`v1:real^3`]
THEN EXISTS_TAC`t1:real`
THEN ASM_REWRITE_TAC[lem];
SUBGOAL_THEN`{v,u} INTER {v1,w1:real^3}={}` ASSUME_TAC
THENL[
ASM_TAC
THEN SET_TAC[];
MRESA_TAC fan_run_in_small1_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`;`v1:real^3`;`w1:real^3`]]]]]]));;
let fan_run1_in_small_is_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) (E':(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ E' SUBSET E /\ (&0< azim x u w v ) /\ (azim x u w v <pi) /\ sigma_fan x V E u w = v ==> ?h:real. &0<h /\ h<= &1 /\ (!s:real. &0< s /\ s< h==> aff_gt{x} {v,(&1-s)%u+ s % w} INTER {v | ?e. e IN E' /\ v IN aff_ge {x} e}={})`,
REPEAT STRIP_TAC THEN MRESA_TAC set_edges_is_finite_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] THEN MRESA_TAC FINITE_SUBSET [`(E':(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`] THEN ABBREV_TAC`n=CARD (E':(real^3->bool)->bool)` THEN REPEAT(POP_ASSUM MP_TAC) THEN SPEC_TAC (`(E':(real^3->bool)->bool)`,`(E':(real^3->bool)->bool)`) THEN SPEC_TAC (`n:num`,`n:num`) THEN INDUCT_TAC THENL(*1*)[ REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`E':(real^3->bool)->bool`]CARD_EQ_0) THEN RESA_TAC THEN EXISTS_TAC`&1 / &2` THEN REWRITE_TAC[REAL_ARITH`&0< &1/ &2`;REAL_ARITH`&1 / &2 <= &1`] THEN ASM_SET_TAC[];(*1*) REPEAT GEN_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "A") THEN REPEAT STRIP_TAC THEN MP_TAC(ISPEC`(E':(real^3->bool)->bool)` CHOOSE_SUBSET) THEN RESA_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`n:num `th)) THEN REWRITE_TAC[ARITH_RULE `n:num <= SUC n`; HAS_SIZE] THEN STRIP_TAC THEN MP_TAC(SET_RULE` t SUBSET E' /\ E' SUBSET E ==> (t:(real^3->bool)->bool) SUBSET E`) THEN RESA_TAC THEN REMOVE_THEN "A" (fun th-> MP_TAC(ISPEC`(t:(real^3->bool)->bool)`th)) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") THEN SUBGOAL_THEN `~((E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)= {})` ASSUME_TAC THENL(*2*)[ STRIP_TAC THEN MP_TAC(SET_RULE`(E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)={} /\ t SUBSET E' ==> t= E'`) THEN RESA_TAC THEN FIND_ASSUM MP_TAC`CARD (t:(real^3->bool)->bool)=n` THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN ASM_REWRITE_TAC[] THEN ARITH_TAC;(*2*) SUBGOAL_THEN`?e. e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)` ASSUME_TAC THENL(*3*)[ ASM_SET_TAC[];(*3*) POP_ASSUM MP_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE`e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)/\ (E':(real^3->bool)->bool) SUBSET (E:(real^3->bool)->bool) /\ t SUBSET E' ==> e IN E'/\ e IN E/\ ~(e IN t) /\ {e} UNION t SUBSET E'`) THEN RESA_TAC THEN MP_TAC(ISPECL [`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`(E':(real^3->bool)->bool)`] FINITE_SUBSET) THEN RESA_TAC THEN ASSUME_TAC(SET_RULE`e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) THEN MP_TAC(ISPECL[`e:real^3->bool`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;]CARD_DELETE) THEN RESA_TAC THEN MP_TAC(SET_RULE `e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool) ==> ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e PSUBSET {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) THEN RESA_TAC THEN MP_TAC(ISPECL[`({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))DELETE e`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`]CARD_PSUBSET) THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN FIND_ASSUM MP_TAC`FINITE ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool))` THEN DISCH_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN DISCH_TAC THEN MP_TAC(ARITH_RULE`CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) < CARD ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) /\ CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) = CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))-1 <=>CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) +1= CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))`) THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) THEN REWRITE_TAC[ARITH_RULE`A=A`; ] THEN MP_TAC(SET_RULE`~(e IN t)==>({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e=t`) THEN RESA_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN FIND_ASSUM MP_TAC`(CARD (E':(real^3->bool)->bool)=SUC n)` THEN REWRITE_TAC[ARITH_RULE`SUC n=(n:num) +1`] THEN DISCH_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) THEN DISCH_TAC THEN MP_TAC(ISPECL[`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`E':(real^3->bool)->bool`]CARD_SUBSET_EQ) THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"MA") THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) THEN RESA_TAC THEN MRESA_TAC fan_run_in_small_is_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`;`v':real^3`;`w':real^3`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"BE") THEN EXISTS_TAC` min (h:real) (t1:real)` THEN STRIP_TAC THENL(*4*)[ ASM_TAC THEN REAL_ARITH_TAC;(*4*) STRIP_TAC THENL(*5*)[ ASM_TAC THEN REAL_ARITH_TAC;(*5*) REPEAT STRIP_TAC THEN REMOVE_THEN "MA" MP_TAC THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) THEN REWRITE_TAC[UNION;IN_ELIM_THM;EXTENSION; INTER;] THEN GEN_TAC THEN EQ_TAC THENL(*6*)[ ASM_REWRITE_TAC[IN_SING] THEN MP_TAC(REAL_ARITH`s< min h t1==> s<h /\ s<t1`) THEN RESA_TAC THEN STRIP_TAC THENL(*7*)[ POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN REMOVE_THEN "BE"(fun th-> MRESA1_TAC th `s:real`) THEN ASM_SET_TAC[]; POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th `s:real`) THEN ASM_SET_TAC[]]; SET_TAC[]]]]]]]);;
let fan_run_in_small_is_not_meet_xfan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ (&0< azim x u w v ) /\ (azim x u w v <pi) /\ sigma_fan x V E u w = v ==> ?h:real. &0<h /\ h<= &1 /\ (!s:real. &0< s /\ s< h==> aff_gt{x} {v,(&1-s)%u+ s % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={})`,
REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`u:real^3`;` (w:real^3)`]fan_run1_in_small_is_fan) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`A SUBSET A`] THEN RESA_TAC THEN EXISTS_TAC`h:real` THEN ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]);;
let fan_run_in_small_is_subset_yfan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ (&0< azim x u w v ) /\ (azim x u w v <pi) /\ sigma_fan x V E u w = v ==> ?h:real. &0<h /\ h<= &1 /\ (!s:real. &0< s /\ s< h==> aff_gt{x} {v,(&1-s)%u+ s % w} SUBSET yfan(x,V,E))`,
REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`u:real^3`;` (w:real^3)`]fan_run1_in_small_is_fan) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`A SUBSET A`;yfan;xfan] THEN RESA_TAC THEN EXISTS_TAC`h:real` THEN ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]);;
let not_collinear_is_properties_fully_surrounded1=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 t:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ (&0< azim x u w v ) /\ (azim x u w v <pi) /\ &0<=t /\ t<= &1 ==> ~ collinear {x,v,(&1-t)%u+ t % w}`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`&0<=t /\ t<= &1 ==> t= &0 \/ t= &1 \/ (&0<t /\ t< &1)`) THEN RESA_TAC THENL[ REDUCE_ARITH_TAC THEN REDUCE_VECTOR_TAC THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] ; REWRITE_TAC[REAL_ARITH`&1- &1= &0`] THEN REDUCE_VECTOR_TAC THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`w:real^3`;`u:real^3`] THEN POP_ASSUM MATCH_MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] THEN ASM_REWRITE_TAC[]; MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC collinear1_fan [`x:real^3`;`v:real^3`;`(&1-t)% u+t% w:real^3`] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN MRESA_TAC properties_fully_surrounded[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`] THEN POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff; AFFINE_HULL_2; IN_ELIM_THM; coplanar] THEN STRIP_TAC THEN EXISTS_TAC`x:real^3` THEN EXISTS_TAC`v:real^3` THEN EXISTS_TAC`u:real^3` THEN SUBGOAL_THEN`(x:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`&1` THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&0` THEN REDUCE_ARITH_TAC THEN VECTOR_ARITH_TAC; SUBGOAL_THEN`(v:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1` THEN EXISTS_TAC`&0` THEN REDUCE_ARITH_TAC THEN VECTOR_ARITH_TAC; SUBGOAL_THEN`(u:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1` THEN REDUCE_ARITH_TAC THEN VECTOR_ARITH_TAC; SUBGOAL_THEN`(w:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(REAL_ARITH`&0<t:real==> ~(t= &0)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(t:real)`REAL_MUL_LINV) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[VECTOR_ARITH`(&1 - t) % u + t % w = u' % x + v' % v <=>t % w = u' % x + v' % v-(&1 - t) % u :real^3`] THEN STRIP_TAC THEN MP_TAC(SET_RULE` t % w = u' % x + v' % v-(&1 - t) % u ==> (inv (t))%(t % w ) = (inv (t))%(u' % x + v' % v-(&1 - t) % u ):real^3`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+C-(&1-E)%D)=A%B+A%C+(A*E-A)%D`;VECTOR_ARITH`A%B%C=(A*B)%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC`(inv t * u'):real` THEN EXISTS_TAC`(inv t * v'):real` THEN EXISTS_TAC`(&1-inv t):real` THEN ASM_REWRITE_TAC[REAL_ARITH`A*B+A*C+D-E=A*(B+C)+D-E`] THEN ASM_TAC THEN REAL_ARITH_TAC; ASM_TAC THEN SET_TAC[]]]]]]);;
let not_collinear_is_properties_fully_surrounded=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 t:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ (&0< azim x u w v ) /\ (azim x u w v <pi) /\ &0<t /\ t< &1 ==> ~ collinear {x,v,(&1-t)%u+ t % w}`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`&0 <t /\ t < &1==> &0<= t /\ t <= &1`) THEN RESA_TAC THEN MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`t:real`] );;
let exists_inf_element_fix_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u1:real^3 . FAN(x,V,E)/\ v IN V /\ CARD (set_of_edge v V E) >1 ==> (?(u:real^3). (u IN (set_of_edge v V E)) /\ (!(w:real^3). (w IN (set_of_edge v V E)) ==> azim x v u1 u <= azim x v u1 w))`,
(
let lemma = prove
   (`!X:real->bool. 
          FINITE X /\ ~(X = {}) 
          ==> ?a. a IN X /\ !x. x IN X ==> a <= x`,
    MESON_TAC[INF_FINITE]) in
MP_TAC(lemma) 
THEN DISCH_THEN(LABEL_TAC "a") 
THEN REPEAT GEN_TAC THEN REWRITE_TAC[FAN;fan1] 
THEN STRIP_TAC 
THEN MRESA_TAC remark_finite_fan1[`(v:real^3)` ;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN DISJ_CASES_TAC(SET_RULE`((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))={})\/
 ~((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) ={})`)
THENL[
FIND_ASSUM MP_TAC `CARD ((set_of_edge v V E):real^3->bool) > 1`
THEN POP_ASSUM (fun th->REWRITE_TAC[th;CARD_CLAUSES])
THEN ARITH_TAC;
SUBGOAL_THEN`~(IMAGE (azim x v u1) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) )={})` ASSUME_TAC
THENL[
REWRITE_TAC[IMAGE_EQ_EMPTY] THEN ASM_MESON_TAC[];

SUBGOAL_THEN` FINITE (IMAGE (azim x v u1) (set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))` ASSUME_TAC
THENL[ASM_MESON_TAC[FINITE_IMAGE];

REMOVE_THEN "a" (fun th ->MRESAL1_TAC th `(IMAGE (azim x v u1) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) ))`[IMAGE;IN_ELIM_THM]) 
THEN EXISTS_TAC`x':real^3`
  THEN ASM_REWRITE_TAC[] 
THEN ASM_MESON_TAC[]]]]));;
let exists_element_in_half_sapace_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u1:real^3 w1:real^3. FAN(x,V,E)/\ v IN V /\ ~coplanar{x,v,u1,w1} /\ CARD (set_of_edge v V E) >1 /\ fan80(x,V,E) ==> ?u:real^3. {v,u} IN E /\ &0< azim x v u1 (u:real^3)/\ azim x v u1 (u:real^3) <pi `,
REWRITE_TAC[fan80] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "BE") THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`v:real^3`;`u1:real^3`;`w1:real^3`] THEN MRESA_TAC exists_inf_element_fix_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u1:real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "YEU") THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`v:real^3`] THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN MRESA_TAC SUR_SIGMA_FAN[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3) `;`(u:real^3)`] THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] THEN DISJ_CASES_TAC(REAL_ARITH`(pi<= azim (x:real^3) (v:real^3) (u1:real^3) u )\/ azim x v u1 (u:real^3) <pi `) THENL[ REMOVE_THEN "BE" (fun th-> MRESA_TAC th [`v:real^3`;`w:real^3`]) THEN MP_TAC(REAL_ARITH`pi <= azim (x:real^3) (v:real^3) (u1:real^3) (u:real^3) /\ azim x v w u < pi==> azim x v w u <= azim x v u1 u`) THEN RESA_TAC THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`v:real^3`;`u1:real^3`;`w:real^3`;`u:real^3`] THEN MP_TAC(REAL_ARITH`&0 < azim x v w u /\ azim (x:real^3) (v:real^3) (u1:real^3) (u:real^3) = azim x v u1 w + azim x v w u ==> azim x v u1 w < azim x v u1 u`) THEN POP_ASSUM (fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN RESA_TAC THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th `w:real^3`) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; ASSUME_TAC(ISPECL[`(x:real^3)`;`(v:real^3)`;`(u1:real^3)`;`u:real^3`]azim) THEN MP_TAC(REAL_ARITH`(&0<= azim (x:real^3) (v:real^3) (u1:real^3) u) ==>(azim (x:real^3) (v:real^3) (u1:real^3) u = &0 ) \/ &0< azim x v u1 (u:real^3) `) THEN POP_ASSUM (fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN REWRITE_TAC[]) THEN STRIP_TAC THENL[ EXISTS_TAC`sigma_fan x V E v (u:real^3)` THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E = {u:real^3})\/ ~(set_of_edge v V E = {u})`) THENL[ MRESA_TAC CARD_SING[`u:real^3`; `(set_of_edge v V E):real^3->bool`] THEN FIND_ASSUM MP_TAC `CARD ((set_of_edge v V E):real^3->bool) >1` THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun TH-> REWRITE_TAC[TH]) THEN ARITH_TAC; MRESA_TAC SIGMA_FAN[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3) `;`(u:real^3)`] THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`sigma_fan x V E v (u:real^3)`;`v:real^3`] THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th `sigma_fan x V E v (u:real^3)`) THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u1:real^3`;`u:real^3`;`sigma_fan x V E v (u:real^3)`] THEN REDUCE_ARITH_TAC THEN REMOVE_THEN "BE" (fun th-> MRESA_TAC th [`v:real^3`;`(u:real^3)`])]; EXISTS_TAC`(u:real^3)` THEN ASM_REWRITE_TAC[]]]);;
let JBDNJJB=
prove(`!u:real^3 v:real^3 w:real^3. ~collinear {vec 0, u, v} /\ ~collinear {vec 0, u, w} ==> ?t:real. &0< t /\ sin(azim (vec 0) u v w)=t *(u cross v) dot w`,
REPEAT STRIP_TAC THEN MRESA_TAC th3[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`] THEN MRESA_TAC properties_coordinate[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`] THEN MRESA_TAC azim[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`;`(w:real^3)`] THEN POP_ASSUM (fun th->MRESA_TAC th [`e1_fan ((vec 0):real^3) (u:real^3) (v:real^3)`;`e2_fan ((vec 0):real^3) (u:real^3) (v:real^3)`;`e3_fan ((vec 0):real^3) (u:real^3) (v:real^3)`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"YEU EM") THEN DISCH_TAC THEN DISCH_TAC THEN MRESA_TAC sincos1_of_u_fan[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`;`r1:real`; `psi:real`; `h1:real`] THEN REMOVE_THEN "YEU EM" MP_TAC THEN ASM_REWRITE_TAC[COS_ADD;SIN_ADD;] THEN REDUCE_ARITH_TAC THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE`w = (r2 * cos (azim (vec 0) u v w)) % e1_fan (vec 0) u v + (r2 * sin (azim (vec 0) u v w)) % e2_fan (vec 0) u v + h2 % u ==> (u cross v) dot w = (u cross v) dot ((r2 * cos (azim (vec 0) u v w)) % e1_fan (vec 0) u v + (r2 * sin (azim (vec 0) u v w)) % e2_fan (vec 0) u v + h2 % u)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_LMUL; DOT_RMUL;DOT_CROSS_SELF; e2_fan;e1_fan;e3_fan; VECTOR_ARITH`A- vec 0= A`;CROSS_LADD; CROSS_RADD; CROSS_LMUL; CROSS_RMUL;CROSS_REFL;CROSS_RNEG;CROSS_LNEG;] THEN REDUCE_ARITH_TAC THEN REWRITE_TAC[NORM_MUL;REAL_INV_MUL; REAL_ABS_INV;REAL_INV_INV;REAL_ABS_NORM;DOT_SQUARE_NORM ;REAL_ARITH`(r2 * sin (azim (vec 0) u v w)) * (norm u * inv (norm (u cross v))) * inv (norm u) * norm (u cross v) pow 2 =(r2* norm(u cross v)) * sin (azim (vec 0) u v w) * ( inv (norm u) * norm u)* ( inv (norm (u cross v))* norm (u cross (v:real^3)))` ] THEN MP_TAC(ISPECL[`u:real^3`;`(vec 0) :real^3`]imp_norm_not_zero_fan) THEN REDUCE_VECTOR_TAC THEN RESA_TAC THEN MP_TAC(ISPEC`(norm(u:real^3))`REAL_MUL_LINV) THEN RESA_TAC THEN ASSUME_TAC(ISPEC`u:real^3`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(&0 =norm(u:real^3)) /\ &0 <= norm(u:real^3)==> &0 <norm(u:real^3)`) THEN RESA_TAC THEN SUBGOAL_THEN`~(u cross v = vec 0)` ASSUME_TAC THENL[ASM_REWRITE_TAC[CROSS_EQ_0]; MP_TAC(ISPECL[`u cross v :real^3`;`(vec 0) :real^3`]imp_norm_not_zero_fan) THEN REDUCE_VECTOR_TAC THEN RESA_TAC THEN MP_TAC(ISPEC`(norm(u cross v:real^3))`REAL_MUL_LINV) THEN RESA_TAC THEN ASSUME_TAC(ISPEC`u cross v:real^3`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(&0 =norm(u cross v:real^3)) /\ &0 <= norm(u cross v:real^3)==> &0 <norm(u cross v:real^3)`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`r2:real`;`norm(u cross v:real^3)`] THEN MP_TAC(REAL_ARITH`&0<(r2:real)*norm(u cross v:real^3)==> ~((r2:real)*norm(u cross v:real^3)= &0)`) THEN REDUCE_VECTOR_TAC THEN RESA_TAC THEN MP_TAC(ISPEC`(r2 * norm(u cross v:real^3))`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(ISPEC`(r2 * norm(u cross v:real^3))`REAL_LT_INV) THEN RESA_TAC THEN REDUCE_ARITH_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE`(u cross v) dot w = (r2 * norm (u cross v)) * sin (azim (vec 0) u v w) ==> inv (r2 * norm (u cross v))*(r2 * norm (u cross v)) * sin (azim (vec 0) u v w)= inv (r2 * norm (u cross v)) *((u cross v) dot w)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`inv (r2 * norm (u cross v)) * (r2 * norm (u cross v)) * sin (azim (vec 0) u v w)=(inv (r2 * norm (u cross v)) * (r2 * norm (u cross v)))* sin (azim (vec 0) u v w)`] THEN REDUCE_ARITH_TAC THEN STRIP_TAC THEN EXISTS_TAC`inv (r2 * norm (u cross v)):real` THEN ASM_REWRITE_TAC[]]);;
let independent_run_edges_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ fan80(x,V,E) /\ sigma_fan x V E u w = v /\ &0<a /\ a<= &1 ==> independent {v - x, u - x, ((&1 - a) % u + a % w) - x}`,
REPEAT STRIP_TAC THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` THEN REWRITE_TAC[fan80] THEN DISCH_TAC THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MP_TAC(REAL_ARITH`&0< a==> ~(a= &0)`) THEN RESA_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) THEN POP_ASSUM MP_TAC THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, v, u, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,v:real^3,u:real^3,(&1 - a) % u + a % w:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN REMOVE_ASSUM_TAC THEN DISCH_TAC THEN MRESA_TAC NOT_COPLANAR_0_4_IMP_INDEPENDENT[`v - x:real^3`; `u - x:real^3`; `((&1 - a) % u + a % w) - x:real^3`]);;
let span_run_edges_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ fan80(x,V,E) /\ sigma_fan x V E u w = v /\ &0<a /\ a< &1 ==> ?t1:real t2:real t3:real. u1-x =t1 % (v-x)+t2 % ((&1 - a) % u + a % w - x)+t3 %(u-x)`,
REPEAT STRIP_TAC THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` THEN REWRITE_TAC[fan80] THEN DISCH_TAC THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MP_TAC(REAL_ARITH`&0< a==> ~(a= &0)`) THEN RESA_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) THEN POP_ASSUM MP_TAC THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, v, u, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,v:real^3,u:real^3,(&1 - a) % u + a % w:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN REMOVE_ASSUM_TAC THEN DISCH_TAC THEN MRESA_TAC NOT_COPLANAR_0_4_IMP_INDEPENDENT[`v - x:real^3`; `u - x:real^3`; `((&1 - a) % u + a % w) - x:real^3`] THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`v - x:real^3`; `u - x:real^3`; `((&1 - a) % u + a % w) - x:real^3`;`(vec 0):real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={D,A,B,C}`] THEN RESA_TAC THEN POP_ASSUM(fun th-> MP_TAC(th) THEN ASSUME_TAC(th)) THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,D}={D,A,B}`] THEN DISCH_TAC THEN MRESA_TAC th3[`v - x:real^3`; `u - x:real^3`; `((&1 - a) % u + a % w) - x:real^3`] THEN MRESA_TAC th3[ `((&1 - a) % u + a % w) - x:real^3`;`v - x:real^3`; `u - x:real^3`;] THEN MP_TAC(ISPECL [`(:real^3)`; `{v - x, u - x, ((&1 - a) % u + a % w) - x:real^3}`] CARD_EQ_DIM) THEN ASM_SIMP_TAC[ORTHONORMAL_IMP_INDEPENDENT; SUBSET_UNIV] THEN REWRITE_TAC[DIM_UNIV; DIMINDEX_3; HAS_SIZE; FINITE_INSERT; FINITE_EMPTY] THEN SIMP_TAC[CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; IN_INSERT;] THEN ASM_REWRITE_TAC[NOT_IN_EMPTY; ARITH;SUBSET] THEN DISCH_TAC THEN POP_ASSUM(fun th-> MRESAL1_TAC th `u1-x:real^3`[IN_UNIV;SPAN_3;IN_ELIM_THM]) THEN EXISTS_TAC`u':real` THEN EXISTS_TAC`w':real` THEN EXISTS_TAC`v':real` THEN VECTOR_ARITH_TAC);;
let IMP_NORM_FAN=
prove(`!va:real^3 vb:real^3. ~(va = vb) ==> ~(norm (va-vb) = &0) /\ &0 <= norm (va-vb) /\ &0 < norm (va-vb) /\ &0 <= inv (norm (va-vb)) /\ &0 < inv (norm (va-vb)) /\ inv (norm (va-vb)) * norm (va-vb) = &1`,
REPEAT GEN_TAC THEN DISCH_TAC THEN MRESA_TAC imp_norm_not_zero_fan[`va:real^3`;`vb:real^3`] THEN ASSUME_TAC(ISPEC`va-vb:real^3`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(norm(va-vb:real^3)= &0) /\ &0 <= norm(va-vb:real^3)==> &0 <norm(va-vb:real^3)`) THEN RESA_TAC THEN MRESA1_TAC REAL_LE_INV `norm(va-vb:real^3)` THEN MRESA1_TAC REAL_LT_INV `norm(va-vb:real^3)` THEN MRESA1_TAC REAL_MUL_LINV `norm(va-vb:real^3)` THEN ASM_REWRITE_TAC[]);;
let cross_dot_fully_surrounded_fan=
prove(`!x:real^3 v1:real^3 u1:real^3 v:real^3. ~collinear{x,v1,u1} /\ ~collinear{x,v1,v} /\ &0< azim x v1 v u1 /\ azim x v1 v u1 < pi ==> &0 < ((v1 - x) cross (v - x)) dot (u1 - x)`,
REPEAT STRIP_TAC THEN MRESA1_TAC SIN_POS_PI`azim x v1 v (u1:real^3)` THEN POP_ASSUM MP_TAC THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`v1:real^3`;` v:real^3`;`u1:real^3`] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN MRESA_TAC JBDNJJB[`(v1-x):real^3`;`v-x:real^3`;`u1-x:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM COLLINEAR_3;] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN MRESAL_TAC REAL_LT_LMUL_EQ [` &0:real `;`(((v1 - x) cross (v - x)) dot ((u1 - x):real^3)):real`;`t:real`][REAL_ARITH`a * &0 = &0`]);;
let cross_dot_fully_surrounded_ge_fan=
prove(`!x:real^3 v1:real^3 u1:real^3 v:real^3. ~collinear{x,v1,u1} /\ ~collinear{x,v1,v} /\ &0<= azim x v1 v u1 /\ azim x v1 v u1 <= pi ==> &0 <= ((v1 - x) cross (v - x)) dot (u1 - x)`,
REPEAT STRIP_TAC THEN MRESA1_TAC SIN_POS_PI_LE`azim x v1 v (u1:real^3)` THEN POP_ASSUM MP_TAC THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`v1:real^3`;` v:real^3`;`u1:real^3`] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN MRESA_TAC JBDNJJB[`(v1-x):real^3`;`v-x:real^3`;`u1-x:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM COLLINEAR_3;] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN MRESAL_TAC REAL_LE_LMUL_EQ [` &0:real `;`(((v1 - x) cross (v - x)) dot ((u1 - x):real^3)):real`;`t:real`][REAL_ARITH`a * &0 = &0`]);;
let AFF_LT_2_1 = 
prove (`!x v w. DISJOINT {x,v} {w} ==> aff_lt {x,v} {w} = {y | ?t1 t2 t3. t3 < &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v + t3 % w}`,
AFF_TAC);;
let properties_of_collinear4_points_fan=
prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. ~collinear{x,v,u} /\ v1 IN aff_gt {x} {v,u} ==> ~collinear{x,v1,v}`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) THEN STRIP_TAC THEN ASM_REWRITE_TAC[collinear1_fan;] THEN FIND_ASSUM MP_TAC`~(u IN aff {x, v:real^3})` THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % u = u' % x + v' % v <=> t3 % u = (u'-t1) % x + (v'-t2) % v`;] THEN MP_TAC (REAL_ARITH`&0< t3==> ~(t3= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV `(t3:real)` THEN STRIP_TAC THEN MP_TAC(SET_RULE`t3 % u = (u'-t1) % x + (v'-t2) % v ==> (inv (t3)) % (t3) % ( u) = (inv (t3)) % ( (u'-t1) % x + (v'-t2) % v:real^3)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`;VECTOR_ARITH`A%(B+C)=A%B+A%C`]) THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC`inv t3 * ((u' - t1):real)` THEN EXISTS_TAC`inv t3 * ((v' - t2):real)` THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3 * (u' - t1) + inv t3 * (v' - t2)=inv t3 *(t3+ (u'+v') -( t1+ t2+t3))`;REAL_ARITH`A+ &1- &1=A`]);;
let cross_dot_fully_surrounded1_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a< &1 /\ fan80(x,V,E) /\ ~collinear{x,v1,u1} /\ v1 IN aff_gt {x} {v,(&1-a)%u+ a%w} /\ &0< azim x v1 v u1 /\ azim x v1 v u1 < pi ==> &0< ((v1 - x) cross (u1 - x)) dot ((&1 - a) % u + a % w-x)`,
REPEAT STRIP_TAC THEN MRESAL_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `(&1 - a) % u + a % w:real^3`;`u1:real^3`][VECTOR_ARITH`((&1 - a) % u + a % w) - x=(&1 - a) % u + a % w - x`] THEN POP_ASSUM MATCH_MP_TAC THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` THEN REWRITE_TAC[fan80] THEN DISCH_THEN(LABEL_TAC"yeu em") THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`(&1-a)%u+ a%w:real^3`;`v1:real^3`] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3) `;] THEN FIND_ASSUM MP_TAC `(v1:real^3) IN aff_gt {x} {v,(&1-a)%u+ a%(w:real^3)}` THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) THEN STRIP_TAC THEN SUBGOAL_THEN`~collinear {x, v1, (&1 - a) % u + a % w:real^3}` ASSUME_TAC THENL[ ASM_REWRITE_TAC[collinear1_fan;] THEN FIND_ASSUM MP_TAC`~((&1 - a) % u + a % w IN aff {x, v:real^3})` THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w) = u' % x + v' % ((&1 - a) % u + a % w)<=> (&1-(t1+t2+t3)) % x + (v'-t3) % ((&1 - a) % u + a % w-x) = (&1-(u'+v') ) % x + t2 % (v-x)`;REAL_ARITH`a-a= &0`] THEN REDUCE_VECTOR_TAC THEN DISJ_CASES_TAC(REAL_ARITH`v' - t3= &0 \/ ~(v' - (t3:real)= &0)`) THENL[ ASM_REWRITE_TAC[VECTOR_ARITH`&0 %A=B<=> B= vec 0`;VECTOR_MUL_EQ_0] THEN MP_TAC(REAL_ARITH`&0< t2==> ~(t2 = &0)`) THEN RESA_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> A=B`]; MRESA1_TAC REAL_MUL_LINV `(v'-t3:real)` THEN STRIP_TAC THEN MP_TAC(SET_RULE`(v' - t3) % ((&1 - a) % u + a % w - x) = t2 % (v - x:real^3) ==> (inv (v'-t3)) % (v' - t3) % ((&1 - a) % u + a % w - x) = (inv (v'-t3)) % ( t2 % (v - x))`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) THEN REWRITE_TAC[VECTOR_ARITH`&1 % ((&1 - a) % u + a % w - x) = (inv (v' - t3) * t2) % (v - x)<=> (&1 - a) % u + a % w = (&1-(inv (v' - t3) * t2))%x +(inv (v' - t3) * t2) % v:real^3`] THEN STRIP_TAC THEN EXISTS_TAC`&1-(inv (v' - t3) * (t2:real))` THEN EXISTS_TAC`(inv (v' - t3) * (t2:real))` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC]; POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN DISCH_TAC THEN REMOVE_THEN "A" MP_TAC THEN ASM_REWRITE_TAC[] THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v1:real^3`;`v:real^3`;`u1:real^3`;`((&1 - a) % u + a % w):real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"B") THEN DISCH_TAC THEN SUBGOAL_THEN`azim x v1 v ((&1 - a) % u + a % w)= pi` ASSUME_TAC THENL[ POP_ASSUM MP_TAC THEN MRESA_TAC th3[`(x:real^3)` ;`v1:real^3`;` (v:real^3)`] THEN MRESA_TAC AFF_LT_2_1[`x:real^3`;`v1:real^3`;`v:real^3`] THEN MRESAL_TAC AZIM_EQ_PI_ALT[`x:real^3`;`v1:real^3`;`v:real^3`;`((&1 - a) % u + a % w):real^3`][IN_ELIM_THM] THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[VECTOR_ARITH`A=B+C+D <=> D=A-B-C:real^3`] THEN MP_TAC(REAL_ARITH`&0<t3==> ~(t3= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV `(t3:real)` THEN STRIP_TAC THEN MP_TAC(SET_RULE`t3 % ((&1 - a) % u + a % w) = v1 - t1 % x - t2 % v ==> (inv (t3)) % t3 % ((&1 - a) % u + a % w) = (inv (t3)) % ( v1 - t1 % x - t2 % v:real^3)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) THEN REWRITE_TAC[VECTOR_ARITH`&1 % ((&1 - a) % u + a % w) = inv t3 % (v1 - t1 % x - t2 % v) <=> (&1 - a) % u + a % w = (-- inv t3 * t1) % x + (inv t3) % v1 +(-- (inv t3* t2)) % v`] THEN STRIP_TAC THEN EXISTS_TAC`(-- inv t3 * t1):real` THEN EXISTS_TAC`(inv t3):real` THEN EXISTS_TAC`(-- (inv t3 * t2)):real` THEN ASM_REWRITE_TAC[REAL_ARITH`--inv t3 * t1 + inv t3 + --(inv t3 * t2)= inv t3 *(t3+ &1-(t1+t2+t3))`;REAL_ARITH`(t3 + &1 - &1)=t3`;REAL_ARITH`--A< &0 <=> &0< A`] THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LT_INV THEN ASM_REWRITE_TAC[]; REMOVE_THEN "B" MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN REMOVE_ASSUM_TAC THEN MP_TAC(REAL_ARITH`azim x v1 v u1 < pi==> azim x v1 v u1 <= pi`) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN FIND_ASSUM MP_TAC`azim x v1 v (u1:real^3) < pi` THEN FIND_ASSUM MP_TAC`&0< azim x v1 v (u1:real^3) ` THEN REAL_ARITH_TAC]]);;
let exists_cross_dot_fully_surrounded1_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a< &1 /\ fan80(x,V,E) /\ ~collinear{x,v1,u1} /\ v1 IN aff_gt {x} {v,(&1-a)%u+ a%w} /\ &0< azim x v1 v u1 /\ azim x v1 v u1 < pi ==> ?t. &0< t/\ t < &1 /\( !h:real. &0< h/\ h<t ==> &0< ((v1 - x) cross (u1 - x)) dot (((&1 - h) % ((&1 - a) % u + a % w) + h % u) - x))`,
REPEAT STRIP_TAC THEN REWRITE_TAC[VECTOR_ARITH`(((&1 - t) % ((&1 - a) % u + a % w) + t % u) - x)= ((&1 - a) % u + a % w - x) + t % (--a) % ( w-u)`;] THEN ABBREV_TAC`va=(&1 - a) % u + a % w-x:real^3` THEN REWRITE_TAC[DOT_RADD;DOT_RMUL; REAL_ARITH`&0<A+C*(--B)*D<=> (B*D)*C<A`] THEN MRESA_TAC cross_dot_fully_surrounded1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;`u1:real^3`] THEN DISJ_CASES_TAC(REAL_ARITH`(((v1 - x) cross (u1 - x:real^3)) dot (w - u)<= &0 )\/ (&0<((v1 - x) cross (u1 - x)) dot (w - u))`) THENL[ EXISTS_TAC`&1/ &2` THEN REWRITE_TAC[REAL_ARITH`&0 < &1 / &2 /\ &1 / &2 < &1`] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0 < a ==> &0<= (a:real)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0 < h ==> &0<= (h:real)`) THEN RESA_TAC THEN MRESAL_TAC REAL_LE_LMUL[`a:real`;`((v1 - x) cross (u1 - x)) dot ((w - u):real^3)`;`&0`][REAL_ARITH`(A:real)* &0= &0`] THEN MRESAL_TAC REAL_LE_RMUL[`a*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)`;`&0`;`h:real`][REAL_ARITH`&0 * (A:real)= &0`] 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 POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; MRESA_TAC REAL_LT_MUL[`a:real`;`((v1 - x) cross (u1 - x)) dot ((w - u):real^3)`] THEN MP_TAC(REAL_ARITH`&0<(a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)==> ~( (a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_RINV`(a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)` THEN MRESA1_TAC REAL_LT_INV`(a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)` THEN MRESA_TAC REAL_LT_MUL[`inv((a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3))`;`((v1 - x) cross (u1 - x)) dot (va:real^3)`] THEN EXISTS_TAC `min ((inv(a *(((v1 - x) cross (u1 - x)) dot (w - u)))*(((v1 - x) cross (u1 - x)) dot va)) / &2 ) (&1/ &2)` THEN STRIP_TAC THENL[POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; STRIP_TAC THENL[ REAL_ARITH_TAC; REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH` h< min ((inv (a * (((v1 - x) cross (u1 - x)) dot (w - u))) * (((v1 - x) cross (u1 - x)) dot va)) / &2) (&1 / &2) ==> h< ((inv (a * (((v1 - x) cross (u1 - x)) dot (w - u))) * (((v1 - x) cross (u1 - x)) dot va)) / &2)`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_LMUL[`(a * (((v1 - x) cross (u1 - x)) dot (w - u:real^3)))`;`h:real`;`((inv (a * (((v1 - x) cross (u1 - x)) dot (w - u))) * (((v1 - x) cross (u1 - x:real^3)) dot va)) / &2)`] THEN ASM_TAC THEN ABBREV_TAC`vb=a * (((v1 - x) cross (u1 - x)) dot (w - u))` THEN REPEAT DISCH_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`vb * (inv vb * (((v1 - x) cross (u1 - x)) dot va)) / &2= (vb * inv vb) * (((v1 - x) cross (u1 - x)) dot va)/ &2`] 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 MP_TAC THEN REAL_ARITH_TAC]]]);;
let cross_dot_fully_surrounded2_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a< &1 /\ fan80(x,V,E) /\ ~collinear{x,v1,u1} /\ v1 IN aff_gt {x} {v,(&1-a)%u+ a%w} /\ &0< azim x v1 v u1 /\ azim x v1 v u1 < pi ==> &0 < (((&1 - a) % u + a % w - x) cross (v - x)) dot (u1 - x)`,
REPEAT STRIP_TAC THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` THEN REWRITE_TAC[fan80] THEN DISCH_THEN(LABEL_TAC"yeu em") THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`(&1-a)%u+ a%w:real^3`;`v1:real^3`] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] THEN MRESA1_TAC SIN_POS_PI`azim x v1 v (u1:real^3)` THEN POP_ASSUM MP_TAC THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`v1:real^3`;` v:real^3`;`u1:real^3`] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN MRESA_TAC JBDNJJB[`(v1-x):real^3`;`v-x:real^3`;`u1-x:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM COLLINEAR_3;] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN MRESAL_TAC REAL_LT_LMUL_EQ [` &0:real `;`(((v1 - x) cross (v - x)) dot ((u1 - x):real^3)):real`;`t:real`][REAL_ARITH`a * &0 = &0`] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3) `;] THEN FIND_ASSUM MP_TAC `v1 IN aff_gt {x} {v,(&1-a)%u+ a%(w:real^3)}` THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th;VECTOR_ARITH`A- vec 0= A`;VECTOR_ARITH`(t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w)) - x=(t1- &1) % x + t2 % v + t3 % ((&1 - a) % u + a % w)`]) THEN FIND_ASSUM MP_TAC `t1 + t2 + t3 = &1:real` THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1- &1= (-- t2)- t3 `] THEN DISCH_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`(--t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w)= t2 % (v-x) + t3 % ((&1 - a) % u + a % w-x)`] THEN REWRITE_TAC[CROSS_LADD; CROSS_RADD; CROSS_LMUL; CROSS_RMUL;CROSS_REFL;CROSS_RNEG;CROSS_LNEG] THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[GSYM CROSS_LMUL;GSYM CROSS_LADD;DOT_LMUL] THEN MRESAL_TAC REAL_LT_LMUL_EQ [` &0:real `;`((((&1 - a) % u + a % w - x) cross (v - x)) dot (u1 - x)):real`;`t3:real`][REAL_ARITH`a * &0 = &0`]);;
let exists_cross_dot_fully_surrounded2_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a< &1 /\ fan80(x,V,E) /\ ~collinear{x,v1,u1} /\ v1 IN aff_gt {x} {v,(&1-a)%u+ a%w} /\ &0< azim x v1 v u1 /\ azim x v1 v u1 < pi ==> ?t:real. &0< t/\ t < &1 /\ (!h:real. &0<h /\ h< t ==> &0 < ((((&1 - h) % ((&1 - a) % u + a % w) + h % u) - x) cross (v - x)) dot (u1 - x))`,
REPEAT STRIP_TAC THEN REWRITE_TAC[VECTOR_ARITH`(((&1 - t) % ((&1 - a) % u + a % w) + t % u) - x)= ((&1 - a) % u + a % w - x) + t % (--a) % ( w-u)`;] THEN ABBREV_TAC`va=(&1 - a) % u + a % w-x:real^3` THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;DOT_LADD;DOT_LMUL; REAL_ARITH`&0<A+C*(--B)*D<=> (B*D)*C<A`] THEN MRESA_TAC cross_dot_fully_surrounded2_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;`u1:real^3`] THEN DISJ_CASES_TAC(REAL_ARITH`(((w - u) cross (v - x:real^3)) dot (u1- x)<= &0 )\/ (&0<((w - u) cross (v - x:real^3)) dot (u1- x))`) THENL[ EXISTS_TAC`&1/ &2` THEN REWRITE_TAC[REAL_ARITH`&0 < &1 / &2 /\ &1 / &2 < &1`] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0 < a ==> &0<= (a:real)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0 < h ==> &0<= (h:real)`) THEN RESA_TAC THEN MRESAL_TAC REAL_LE_LMUL[`a:real`;`((w - u) cross (v - x:real^3)) dot (u1- x:real^3)`;`&0`][REAL_ARITH`(A:real)* &0= &0`] THEN MRESAL_TAC REAL_LE_RMUL[`a*(((w - u) cross (v - x:real^3)) dot (u1- x))`;`&0`;`h:real`][REAL_ARITH`&0 * (A:real)= &0`] 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 POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; MRESA_TAC REAL_LT_MUL[`a:real`;`((w - u) cross (v - x:real^3)) dot (u1- x:real^3)`] THEN MP_TAC(REAL_ARITH`&0<(a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))==> ~( (a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_RINV`(a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))` THEN MRESA1_TAC REAL_LT_INV`(a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))` THEN MRESA_TAC REAL_LT_MUL[`inv((a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x)))`;`((va cross (v - x)) dot (u1 - x))`] THEN EXISTS_TAC `min ((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 ) (&1/ &2)` THEN STRIP_TAC THENL[POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; STRIP_TAC THENL[ REAL_ARITH_TAC; REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH` h< min ((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 ) (&1/ &2) ==> h< ((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 )`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_LMUL[`(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))`;`h:real`;`((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 )`] THEN ASM_TAC THEN ABBREV_TAC`vb=a * (((w - u) cross (v - x:real^3)) dot (u1- x))` THEN REPEAT DISCH_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`vb * (inv vb * ((va cross (v - x)) dot (u1 - x))) / &2= (vb * inv vb) * ((va cross (v - x)) dot (u1 - x))/ &2`] 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 MP_TAC THEN REAL_ARITH_TAC]]]);;
let properties_of_coplanar=
prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. ~collinear{x,v,u} /\ v1 IN aff_gt {x} {v,u} ==> coplanar{x,v1,v,u}`,
REPEAT STRIP_TAC THEN REWRITE_TAC[coplanar] THEN POP_ASSUM MP_TAC THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) THEN STRIP_TAC THEN EXISTS_TAC`x:real^3` THEN EXISTS_TAC`v:real^3` THEN EXISTS_TAC`u:real^3` THEN SUBGOAL_THEN`(x:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL[REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`&1` THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&0` THEN REDUCE_ARITH_TAC THEN VECTOR_ARITH_TAC; SUBGOAL_THEN`(v:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1` THEN EXISTS_TAC`&0` THEN REDUCE_ARITH_TAC THEN VECTOR_ARITH_TAC; SUBGOAL_THEN`(u:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1` THEN REDUCE_ARITH_TAC THEN VECTOR_ARITH_TAC; SUBGOAL_THEN`(v1:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`t1:real` THEN EXISTS_TAC`t2:real` THEN EXISTS_TAC`t3:real` THEN ASM_REWRITE_TAC[]; ASM_TAC THEN SET_TAC[]]]]]);;
let coplanar_is_cross_fan=
prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. ~collinear{x,v,u} /\ v1 IN aff_gt {x} {v,u} ==> ((v-x) cross (u-x)) dot (v1-x)= &0`,
REPEAT STRIP_TAC THEN MRESA_TAC properties_of_coplanar[`x:real^3`;`v:real^3`;`u:real^3`;`v1:real^3`] THEN ONCE_REWRITE_TAC[DOT_SYM;] THEN REWRITE_TAC[DOT_CROSS_DET] THEN ONCE_REWRITE_TAC[GSYM COPLANAR_DET_EQ_0] THEN ASM_REWRITE_TAC[]);;
let lie_in_half_space_and_azim=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a< &1 /\ fan80(x,V,E) /\ ~collinear{x,v1,u1} /\ v1 IN aff_gt {x} {v,(&1-a)%u+ a%w} /\ &0< azim x v1 v u1 /\ azim x v1 v u1 < pi ==> &0 < ((v-x) cross (u - x)) dot (v1-x)`,
REPEAT STRIP_TAC THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` THEN REWRITE_TAC[fan80] THEN DISCH_THEN(LABEL_TAC"yeu em") THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3) `;] THEN FIND_ASSUM MP_TAC `v1 IN aff_gt {x} {v,(&1-a)%u+ a%(w:real^3)}` THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) THEN STRIP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`A- vec 0= A`;VECTOR_ARITH`(t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w)) - x=(t1- &1) % x + t2 % v + t3 % ((&1 - a) % u + a % w)`] THEN FIND_ASSUM MP_TAC `t1 + t2 + t3 = &1:real` THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1- &1= (-- t2)- t3 `] THEN DISCH_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`(--t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w)= t2 % (v-x) + t3 % ((&1 - a) % (u-x) + a % (w-x))`] THEN REWRITE_TAC[ DOT_RADD;DOT_RMUL;DOT_CROSS_SELF] THEN REDUCE_ARITH_TAC THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[] THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `u:real^3`;`v:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[CROSS_TRIPLE]);;
let exists_cut_small_edges_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a< &1 /\ fan80(x,V,E) /\ ~collinear{x,v1,u1} /\ v1 IN aff_gt {x} {v,(&1-a)%u+ a%w} /\ &0< azim x v1 v u1 /\ azim x v1 v u1 < pi ==> ?t:real. &0< t/\ t < &1 /\ ~(aff_gt {x} {v,(&1-t)%((&1-a)%u+ a%w)+t%u} INTER aff_gt {x} {v1,u1}={})`,
REPEAT STRIP_TAC THEN MRESA_TAC lie_in_half_space_and_azim[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;` u1:real^3`] THEN MRESA_TAC exists_cross_dot_fully_surrounded1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;` u1:real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"MA") THEN MRESA_TAC exists_cross_dot_fully_surrounded2_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;` u1:real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"BE NHO") THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` THEN REWRITE_TAC[fan80] THEN DISCH_THEN(LABEL_TAC"yeu em") THEN ABBREV_TAC`ta=min (t:real) (t':real)/ &2` THEN EXISTS_TAC `(ta:real)` THEN SUBGOAL_THEN `&0< ta:real /\ ta < &1 /\ ta< t /\ ta< t'` ASSUME_TAC THENL(*1*)[ POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN FIND_ASSUM MP_TAC`&0<t:real` THEN FIND_ASSUM MP_TAC`t:real < &1` THEN FIND_ASSUM MP_TAC`&0<t':real` THEN FIND_ASSUM MP_TAC`t':real < &1` THEN REAL_ARITH_TAC;(*1*) ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`ta< &1 ==> &0< (&1-ta):real`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL [`(&1-ta):real`;`a:real`] THEN MRESA_TAC REAL_LT_LMUL [`(&1-ta):real`;`a:real`;`&1`] THEN MP_TAC(REAL_ARITH` &0< ta /\ (&1-ta)*a< (&1-ta)* &1 :real==> (&1-ta)*a< &1`) THEN RESA_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) THEN MRESAL_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`((&1-ta)*a):real`][VECTOR_ARITH`(&1 - ((&1 - ta) * a)) % u + ((&1 - ta) * a ) % w= (&1 - ta) % ((&1 - a) % u + a % w) + ta % u:real^3`] THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`(&1-a)%u+ a%w:real^3`;`v1:real^3`] THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`;`u1:real^3`;`v:real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"CON") THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - ta) % ((&1 - a) % u + a % w) + ta % u:real^3`;] THEN MRESA_TAC th3[`(x:real^3)` ;` (v1:real^3)`;`u1:real^3`;] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v1:real^3)`;`(u1:real^3) `;] THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - ta) % ((&1 - a) % u + a % w) + ta % u:real^3 `;] THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;EXTENSION;EMPTY;IN;NOT_FORALL_THM] THEN ABBREV_TAC`a1=(v-x):real^3` THEN ABBREV_TAC`a2=(((&1-ta)%((&1-a)%u+ a%w)+ta%u)-x):real^3` THEN ABBREV_TAC`a3=(v1-x) :real^3` THEN ABBREV_TAC`a4=u1-x:real^3` THEN ABBREV_TAC`va=a1 cross a2:real^3` THEN ABBREV_TAC`vb=a3 cross a4:real^3` THEN EXISTS_TAC`(vb:real^3) cross (va:real^3)+(x:real^3)` THEN STRIP_TAC THENL(*2*)[ EXISTS_TAC`&1-(vb:real^3) dot (a2:real^3)+ vb dot (a1:real^3)` THEN EXISTS_TAC`(vb:real^3) dot (a2:real^3)` THEN EXISTS_TAC`--((vb:real^3) dot (a1:real^3))` THEN REMOVE_THEN "MA"(fun th-> MRESA1_TAC th `ta:real`) THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - vb dot a2 + vb dot a1) + vb dot a2 + --(vb dot a1) = &1`] THEN SUBGOAL_THEN `&0< --((vb:real^3) dot (a1:real^3))` ASSUME_TAC THENL(*3*)[EXPAND_TAC"vb" THEN ONCE_REWRITE_TAC[CROSS_SKEW;] THEN REWRITE_TAC[DOT_LNEG] THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN REMOVE_THEN "CON"MP_TAC THEN REAL_ARITH_TAC;(*3*) ASM_REWRITE_TAC[] THEN EXPAND_TAC"va" THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_MUL_LNEG] THEN EXPAND_TAC"a1" THEN EXPAND_TAC"a2" THEN VECTOR_ARITH_TAC];(*2*) ONCE_REWRITE_TAC[CROSS_SKEW] THEN EXPAND_TAC"vb" THEN REWRITE_TAC[CROSS_LAGRANGE;] THEN EXISTS_TAC`&1+(va:real^3) dot (a4:real^3)- va dot (a3:real^3)` THEN EXISTS_TAC`--(va:real^3) dot (a4:real^3)` THEN EXISTS_TAC`((va:real^3) dot (a3:real^3))` THEN REMOVE_THEN "BE NHO"(fun th-> MRESA1_TAC th `ta:real`) THEN ASM_REWRITE_TAC[DOT_LNEG;VECTOR_MUL_LNEG;REAL_ARITH`(&1 + va dot a4 - va dot a3) + --(va dot a4) + va dot a3 = &1`;] THEN STRIP_TAC THENL(*3*)[ EXPAND_TAC"va" THEN ONCE_REWRITE_TAC[CROSS_SKEW;] THEN REWRITE_TAC[DOT_LNEG] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*3*) STRIP_TAC THENL(*4*)[ EXPAND_TAC"va" THEN EXPAND_TAC"a2" THEN REWRITE_TAC[VECTOR_ARITH`((&1 - ta) % ((&1 - a) % u + a % w) + ta % u) - x =(&1 - ta) % ((&1 - a) % u + a % w-x) + ta % (u - x)`] THEN ABBREV_TAC`vu=(&1 - a) % u + a % w - x:real^3` THEN REWRITE_TAC[CROSS_RADD;CROSS_RMUL;DOT_LADD;DOT_LMUL;] THEN MRESAL_TAC coplanar_is_cross_fan[`x:real^3`;`v:real^3`;`(&1 - a) % u + a % w:real^3`;`v1:real^3`] [VECTOR_ARITH`((&1 - a) % u + a % w) - x=(&1 - a) % u + a % w - x`] THEN REDUCE_ARITH_TAC THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[];(*4*) EXPAND_TAC"a3" THEN EXPAND_TAC"a4" THEN REWRITE_TAC[VECTOR_ARITH`-- A+B= B-A:real^3`;VECTOR_ARITH`(&1+A-B)%X+B%U-A%V=X-A%(V-X)+B%(U-X)`] THEN VECTOR_ARITH_TAC]]]]);;
let aff_gt_subset_aff_ge=
prove(`!x:real^3 v:real^3 u:real^3. DISJOINT {x} {v,u} ==> aff_gt {x} {v,u} SUBSET aff_ge {x} {v,u}`,
REPEAT STRIP_TAC THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM;SUBSET] THEN REPEAT STRIP_TAC THEN EXISTS_TAC`t1:real` THEN EXISTS_TAC`t2:real` THEN EXISTS_TAC`t3:real` THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC);;
let aff_gt1_subset_aff_ge=
prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. DISJOINT {x} {v,u} /\ ~collinear {x,v1,u} /\ v1 IN aff_ge {x} {v,u} ==> aff_gt {x} {v1,u} SUBSET aff_ge {x} {v,u}`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC th3[`x:real^3`;`v1:real^3`;`u:real^3`] THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v1:real^3`;`u:real^3`][IN_ELIM_THM;SUBSET] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) + t3' % u =(t1'+ t2'*t1) % x + (t2'* t2) % v + (t2' * t3 + t3') % u:real^3`] THEN STRIP_TAC THEN EXISTS_TAC`t1' + t2' * t1:real` THEN EXISTS_TAC`t2' * t2:real` THEN EXISTS_TAC`t2' * t3 +t3':real` THEN MP_TAC(REAL_ARITH`&0<t2'==> &0<= t2'`) THEN RESA_TAC THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t2:real`] THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t3:real`] THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + t2' * t2 + t2' * t3 + t3'= t1'+t2'*(t1+t2+t3)+t3'`; REAL_ARITH`A* &1=A`] THEN ASM_TAC THEN REAL_ARITH_TAC);;
let aff_gt12_subset_aff_ge=
prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. DISJOINT {x} {v,u} /\ ~collinear {x,v1,v} /\ v1 IN aff_ge {x} {v,u} ==> aff_gt {x} {v1,v} SUBSET aff_ge {x} {v,u}`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC th3[`x:real^3`;`v1:real^3`;`v:real^3`] THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v1:real^3`;`v:real^3`][IN_ELIM_THM;SUBSET] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) + t3' % v =(t1'+ t2'*t1) % x + (t2'* t2+t3') % v + (t2' * t3 ) % u:real^3`] THEN STRIP_TAC THEN EXISTS_TAC`t1' + t2' * t1:real` THEN EXISTS_TAC`t2' * t2 +t3':real` THEN EXISTS_TAC`t2' * t3 :real` THEN MP_TAC(REAL_ARITH`&0<t2'==> &0<= t2'`) THEN RESA_TAC THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t2:real`] THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t3:real`] THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + (t2' * t2 +t3')+ t2' * t3 = t1'+t2'*(t1+t2+t3)+t3'`; REAL_ARITH`A* &1=A`] THEN ASM_TAC THEN REAL_ARITH_TAC);;
let aff_gt2_subset_aff_ge=
prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. DISJOINT {x} {v,u} /\ ~collinear {x,v1,u} /\ ~collinear {x,v1,v} /\ v1 IN aff_gt {x} {v,u} ==> azim x v1 v u= pi`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC th3[`x:real^3`;`v1:real^3`;`u:real^3`] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN MRESA_TAC AZIM_EQ_PI[`x:real^3`;`v1:real^3`;`v:real^3`;`u:real^3`] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`v1 = t1 % x + t2 % v + t3 % u <=> t2 % v = (--t1) % x + v1 + (--t3) % u`] THEN MP_TAC(REAL_ARITH`&0<t2==> ~( t2= &0)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0<t3==> -- t3< &0`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`t2:real` THEN MRESA1_TAC REAL_LT_INV`t2:real` THEN MRESAL_TAC REAL_LT_LMUL[`inv t2:real`;`-- t3:real`;`&0`][REAL_ARITH`A * &0= &0`] THEN STRIP_TAC THEN MP_TAC(SET_RULE`t2 % v = --t1 % x + v1 + --t3 % u:real^3 ==> (inv (t2))%(t2 % v ) = (inv (t2))%( --t1 % x + v1 + --t3 % u)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C+D)=A%B+A%C+A%D`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN MRESAL_TAC AFF_LT_2_1[`x:real^3`;`v1:real^3`;`u:real^3`][IN_ELIM_THM;SUBSET] THEN EXISTS_TAC`(inv t2 * --t1):real` THEN EXISTS_TAC`inv t2:real` THEN EXISTS_TAC`(inv t2 * --t3):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv t2 * (--t1) + inv t2 + inv t2 * (--t3)= inv t2 * (t2+ &1 -(t1 +t2 +t3))`; REAL_ARITH`A+ &1- &1=A`]);;
let remove_variable_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3 t1:real t2:real t3:real. &0 < t3 /\ w = t1 % x + t2 % v + t3 % u ==> u= inv(t3) % w - (inv(t3)*t1) % x- (inv(t3) * t2) % v`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[VECTOR_ARITH`w = t1'' % x + t2'' % v + t3'' % u <=> t3'' % u = w-t1'' % x - t2'' % (v:real^3)`] THEN MP_TAC(REAL_ARITH `&0 < (t3:real) ==> ~(t3 = &0)`) THEN MP_TAC(ISPEC`(t3:real)`REAL_LT_INV) THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC(th)) THEN STRIP_TAC THEN STRIP_TAC THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC(th)) THEN STRIP_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t3 % u = w-t1 % x - t2 % v:real^3 ==> (inv (t3))%(t3 % u) = (inv (t3))%( w-t1 % x - t2 % v:real^3)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN POP_ASSUM(fun th-> REWRITE_TAC[th;VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`&1 %A=A`;VECTOR_ARITH`A%(B-C-D)=A%B-A%C-A%D`] THEN ASSUME_TAC(th)));;
let aff_gt_inter_aff_gt=
prove(`!(x:real^3) (v:real^3) (w:real^3). ~collinear {x,v,w} ==> aff_gt {x} {v , w} = aff_gt {x , v} {w} INTER aff_gt {x , w} {v}`,
REPEAT STRIP_TAC THEN MRESA_TAC th3 [`x:real^3`;`v:real^3`;`w:real^3`] THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_1_2) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_2_1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(ISPECL[`x:real^3`;`w:real^3`;`v:real^3`]AFF_GT_2_1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;EXTENSION]THEN GEN_TAC THEN EQ_TAC THENL(*1*)[ STRIP_TAC THEN STRIP_TAC THENL(*2*)[ EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN EXISTS_TAC `t3:real` THEN ASM_MESON_TAC[]; EXISTS_TAC `(t1:real)` THEN EXISTS_TAC `(t3:real)` THEN EXISTS_TAC `(t2:real)` THEN ASM_MESON_TAC[REAL_ARITH `(t1:real)+ (t3:real) +(t2:real)=t1 + t2 + t3`;VECTOR_ARITH ` t1 % x + t2 % v + t3 % w = (t1:real) % (x:real^3) + (t3:real) % (w:real^3) + (t2:real) % (v:real^3)`]](*2*); STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(PATH_CONV "rrlr" o ONCE_DEPTH_CONV )[th] THEN ASSUME_TAC(th)) THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(PATH_CONV "rrlr" o ONCE_DEPTH_CONV )[SYM(th)] THEN ASSUME_TAC(th)) THEN DISJ_CASES_TAC(SET_RULE`t3 - t2' = &0 \/ ~((t3:real) - (t2':real) = &0) `) THENL[POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`A-B= &0 <=> A=B`] THEN REPEAT STRIP_TAC THEN EXISTS_TAC`t1':real` THEN EXISTS_TAC`t3':real` THEN EXISTS_TAC`t2':real` THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % w + t3' % v = t1' % x + t3' % v + t2' % w`; REAL_ARITH`t1' + t3' + t2'=t1' + t2' + t3'`] THEN ASM_TAC THEN REAL_ARITH_TAC; REWRITE_TAC[VECTOR_ARITH `a % x + b % y + c % z= a1 % x + b1 % z + c1 % y <=> (c-b1) % z = (a1-a) % x + (c1-b)% y`] THEN REWRITE_TAC[REAL_ARITH`a+b+c=a1+b1+c1<=> c1-b=(a-a1)+(c-b1)`] THEN MRESA1_TAC REAL_MUL_LINV`t3 - t2'` THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN MP_TAC(SET_RULE` (t3 - t2') % w = (t1' - t1) % x + (t3' - t2) % v:real^3 ==> (inv (t3 - t2'))%((t3 - t2') % w ) = (inv (t3 - t2'))%((t1' - t1) % x + (t3' - t2) % v:real^3)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`&1 %A=A`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN ASSUME_TAC(SYM(th))) THEN STRIP_TAC THEN SUBGOAL_THEN`w IN aff{(x:real^3),v}` ASSUME_TAC THENL[REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM;] THEN EXISTS_TAC`inv(t3-t2') *(t1'-t1)` THEN EXISTS_TAC`inv(t3-t2') *(t3'-t2)` THEN ASM_REWRITE_TAC[REAL_ARITH`A*B+A*C=A*(B+C)`]; ASM_SET_TAC[]]]]);;
let aff_gt3_subset_aff_gt=
prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. DISJOINT {x} {v,u} /\ ~collinear{x,v,v1} /\ v1 IN aff_gt {x} {v,u} ==> aff_gt {x} {v,v1} SUBSET aff_gt {x} {v,u}`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`v1:real^3`] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`v1:real^3`][IN_ELIM_THM;SUBSET] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v + t3' % (t1 % x + t2 % v + t3 % u) =(t1'+ t3'*t1) % x + (t2'+ t3' * t2) % v + (t3' * t3) % u:real^3`] THEN STRIP_TAC THEN EXISTS_TAC`t1' + t3' * t1:real` THEN EXISTS_TAC`t2' + t3' * t2:real` THEN EXISTS_TAC`t3' * t3:real` THEN MRESA_TAC REAL_LT_MUL[`t3':real`;`t2:real`] THEN MRESA_TAC REAL_LT_MUL[`t3':real`;`t3:real`] THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t3' * t1) + (t2' + t3' * t2) + t3' * t3= t1'+ t2' + t3'*(t1+t2+t3)`; REAL_ARITH`A* &1=A`] THEN ASM_TAC THEN REAL_ARITH_TAC);;
let aff_ge1_subset_aff_ge=
prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. DISJOINT {x} {v,u} /\ ~collinear{x,v1,u} /\ v1 IN aff_ge {x} {v,u} ==> aff_ge {x} {v1,u} SUBSET aff_ge {x} {v,u}`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC th3[`x:real^3`;`v1:real^3`;`u:real^3`] THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v1:real^3`;`u:real^3`][IN_ELIM_THM;SUBSET] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) + t3' % u =(t1'+ t2'*t1) % x + (t2'* t2) % v + (t2' * t3 + t3') % u:real^3`] THEN STRIP_TAC THEN EXISTS_TAC`t1' + t2' * t1:real` THEN EXISTS_TAC`t2' * t2:real` THEN EXISTS_TAC`t2' * t3 +t3':real` THEN MP_TAC(REAL_ARITH`&0<t2'==> &0<= t2'`) THEN RESA_TAC THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t2:real`] THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t3:real`] THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + t2' * t2 + t2' * t3 + t3'= t1'+t2'*(t1+t2+t3)+t3'`; REAL_ARITH`A* &1=A`] THEN ASM_TAC THEN REAL_ARITH_TAC);;
let aff_ge_1_1_subset_aff_ge_fan=
prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. DISJOINT {x} {v,u} /\ ~(x=v1) /\ v1 IN aff_ge {x} {v,u} ==> aff_ge {x} {v1} SUBSET aff_ge {x} {v,u}`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`v1:real^3`][IN_ELIM_THM;SUBSET] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) =(t1'+ t2'*t1) % x + (t2'* t2) % v + (t2' * t3 ) % u:real^3`] THEN STRIP_TAC THEN EXISTS_TAC`t1' + t2' * t1:real` THEN EXISTS_TAC`t2' * t2:real` THEN EXISTS_TAC`t2' * t3 :real` THEN MP_TAC(REAL_ARITH`&0<t2'==> &0<= t2'`) THEN RESA_TAC THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t2:real`] THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t3:real`] THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + t2' * t2 + t2' * t3 = t1'+t2'*(t1+t2+t3)`; REAL_ARITH`A* &1=A`]);;
let decomposition_planar_by_angle_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3. ~ collinear {x,v,u} /\ ~collinear {x,v,w} /\ w IN aff_ge {x,v} {u} ==> u IN aff_gt {x} {v,w} \/ w IN aff_ge {x} {v,u}`,
REPEAT STRIP_TAC THEN MRESAL_TAC aff_ge_inter_aff_ge[`(x:real^3)`;`(v:real^3)`;`(u:real^3)`][INTER; IN_ELIM_THM] THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`w:real^3`; `u:real^3`] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`w:real^3`; `u:real^3`] THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN DISJ_CASES_TAC(REAL_ARITH`(&0 < t2) \/ &0 <= --(t2:real)`) THENL[ SUBGOAL_THEN `u IN aff_gt {x} {v,w:real^3}` ASSUME_TAC THENL[ MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] THEN EXISTS_TAC`t1:real` THEN EXISTS_TAC`t2:real` THEN EXISTS_TAC`t3:real` THEN MP_TAC(REAL_ARITH`&0< t3==> &0 <= t3:real`) THEN ASM_REWRITE_TAC[]; POP_ASSUM MP_TAC THEN SET_TAC[]]; MRESA_TAC remove_variable_fan[`x:real^3`; `v:real^3`; `w:real^3`;`u:real^3`;`t1:real`;`t2:real`;`t3:real`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th);]) THEN DISCH_TAC THEN REWRITE_TAC[VECTOR_ARITH`inv t3 % u - (inv t3 * t1) % x - (inv t3 * t2) % v =(--inv t3 * t1) % x + inv t3 % u + (inv t3 * (--t2)) % v`] THEN MP_TAC(REAL_ARITH`&0<t3==> ~( t3= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`t3:real` THEN MRESA1_TAC REAL_LT_INV`t3:real` THEN MP_TAC(REAL_ARITH`&0< inv t3==> &0 <= inv t3`) THEN RESA_TAC THEN MRESA_TAC REAL_LE_MUL[`inv t3:real`;`-- (t2:real)`] THEN DISCH_TAC THEN SUBGOAL_THEN `w IN aff_ge {x, u} {v:real^3}` ASSUME_TAC THENL[ MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`u:real^3`;`v:real^3`][IN_ELIM_THM] THEN EXISTS_TAC`(--inv t3 * t1):real` THEN EXISTS_TAC`inv t3:real` THEN EXISTS_TAC`(inv t3 * --t2):real` THEN ASM_REWRITE_TAC[REAL_ARITH`--inv t3 * t1 + inv t3 + inv t3 * --t2= inv t3 * (t3+ &1- (t1 +t2 + t3))`; REAL_ARITH`a + &1 - &1 =a`]; POP_ASSUM MP_TAC THEN SET_TAC[]]]);;
let properties_of_fan7=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 v1:real^3 u1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {v1,u1} IN E /\ v IN aff_ge {x} {v1,u1} ==> v = v1 \/ v = u1`,
REPEAT STRIP_TAC THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` THEN REWRITE_TAC[FAN; fan6; fan7] THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`v:real^3`] THEN STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(v:real^3),(u:real^3)}`;`{(v1:real^3),(u1:real^3)}`]th)) THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] THEN SUBGOAL_THEN `(v:real^3) IN aff_ge {(x:real^3)} {(v:real^3),(u:real^3)}` ASSUME_TAC THENL(*1*)[ MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]AFF_GE_1_2) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC `&0:real` THEN EXISTS_TAC `&1:real` THEN EXISTS_TAC `&0:real` THEN REWRITE_TAC[VECTOR_ARITH`w= &0 % x+ &1 % w + &0 % v `] THEN REAL_ARITH_TAC; DISCH_TAC THEN MP_TAC(SET_RULE`v IN aff_ge {x} {v, u} /\ v IN aff_ge {x} {v1, u1} ==> v IN aff_ge {x} {v, u} INTER aff_ge {x:real^3} {v1, u1:real^3}`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISJ_CASES_TAC(SET_RULE`{v, u} INTER {v1, u1:real^3}={} \/ ~({v, u} INTER {v1, u1}={})`) THENL(*2*)[ ASM_REWRITE_TAC[] THEN SUBGOAL_THEN`aff_ge {x:real^3} {}= {y| ?t1. t1= &1 /\ y= t1 %x}` ASSUME_TAC THENL(*3*)[ ASSUME_TAC(SET_RULE `DISJOINT {x:real^3} {}`) THEN AFF_TAC; ASM_REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC THEN ASM_REWRITE_TAC[]];(*2*) DISJ_CASES_TAC(SET_RULE`~(v IN {v, u} INTER {v1, u1:real^3}) \/ (v IN {v, u} INTER {v1, u1})`) THENL(*3*)[ SUBGOAL_THEN`({v:real^3, u} INTER {v1, u1}={u})` ASSUME_TAC THENL(*4*)[ ASM_TAC THEN SET_TAC[];(*4*) ASM_REWRITE_TAC[] THEN SUBGOAL_THEN` aff_ge {(x:real^3)} {(u:real^3)} SUBSET aff {x,u}` ASSUME_TAC THENL(*5*)[ MP_TAC(ISPECL[`(x:real^3)`;` (u:real^3)`;]AFF_GE_1_1) THEN MP_TAC(SET_RULE`~((x:real^3) = (u:real^3))==> DISJOINT {x} {u}`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[aff;AFFINE_HULL_2] THEN ASM_TAC THEN SET_TAC[];(*5*) FIND_ASSUM MP_TAC`{v,u:real^3} IN E` THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN DISCH_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;`u:real^3`] THEN ASM_TAC THEN SET_TAC[]]];(*3*) POP_ASSUM MP_TAC THEN SET_TAC[]]]]) ;;
let properties1_of_fan7=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 v1:real^3 u1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {v1,u1} IN E /\ v IN aff_ge {x} {v1} ==> v = v1`,
REPEAT STRIP_TAC THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` THEN REWRITE_TAC[FAN; fan6; fan7] THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`v:real^3`] THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u1:real^3`;`v1:real^3`] THEN MP_TAC(SET_RULE`(v1:real^3) IN V==> (?v. v IN V /\ {v1} = {v})`) THEN REDA_TAC THEN STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(v:real^3),(u:real^3)}`;`{(v1:real^3)}`]th)) THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] THEN SUBGOAL_THEN `(v:real^3) IN aff_ge {(x:real^3)} {(v:real^3),(u:real^3)}` ASSUME_TAC THENL(*1*)[ MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]AFF_GE_1_2) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC `&0:real` THEN EXISTS_TAC `&1:real` THEN EXISTS_TAC `&0:real` THEN REWRITE_TAC[VECTOR_ARITH`w= &0 % x+ &1 % w + &0 % v `] THEN REAL_ARITH_TAC; DISCH_TAC THEN MP_TAC(SET_RULE`v IN aff_ge {x} {v, u:real^3} /\ v IN aff_ge {x} {v1} ==> v IN aff_ge {x} {v, u} INTER aff_ge {x:real^3} {v1}`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISJ_CASES_TAC(SET_RULE`{v, u:real^3} INTER {v1}={} \/ ~({v, u} INTER {v1}={})`) THENL(*2*)[ ASM_REWRITE_TAC[] THEN SUBGOAL_THEN`aff_ge {x:real^3} {}= {y| ?t1. t1= &1 /\ y= t1 %x}` ASSUME_TAC THENL(*3*)[ ASSUME_TAC(SET_RULE `DISJOINT {x:real^3} {}`) THEN AFF_TAC; ASM_REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC THEN ASM_REWRITE_TAC[]];(*2*) DISJ_CASES_TAC(SET_RULE`~(v IN {v, u} INTER {v1:real^3}) \/ (v IN {v, u} INTER {v1})`) THENL(*3*)[ SUBGOAL_THEN`({v:real^3, u} INTER {v1:real^3}={u})` ASSUME_TAC THENL(*4*)[ ASM_TAC THEN SET_TAC[]; ASM_REWRITE_TAC[] THEN SUBGOAL_THEN` aff_ge {(x:real^3)} {(u:real^3)} SUBSET aff {x,u}` ASSUME_TAC THENL(*5*)[ MP_TAC(ISPECL[`(x:real^3)`;` (u:real^3)`;]AFF_GE_1_1) THEN MP_TAC(SET_RULE`~((x:real^3) = (u:real^3))==> DISJOINT {x} {u}`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[aff;AFFINE_HULL_2] THEN ASM_TAC THEN SET_TAC[]; FIND_ASSUM MP_TAC`{v,u:real^3} IN E` THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN DISCH_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] THEN ASM_TAC THEN SET_TAC[]]];(*3*) POP_ASSUM MP_TAC THEN SET_TAC[]]]]) ;;
let point_in_aff_ge=
prove(`!(x:real^3) (v:real^3) (w:real^3). ~collinear {x,v,w} ==> x IN aff_ge {x} {v,w} /\ v IN aff_ge {x} {v,w} /\ w IN aff_ge {x} {v,w}`,
REPEAT GEN_TAC THEN STRIP_TAC THEN MRESA_TAC th3 [`x:real^3`;`v:real^3`;`w:real^3`] THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GE_1_2) THEN RESA_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THENL[ EXISTS_TAC`&1:real` THEN EXISTS_TAC`&0:real` THEN EXISTS_TAC`&0:real` THEN REDUCE_VECTOR_TAC THEN REAL_ARITH_TAC; STRIP_TAC THENL[ EXISTS_TAC`&0:real` THEN EXISTS_TAC`&1:real` THEN EXISTS_TAC`&0:real` THEN REDUCE_VECTOR_TAC THEN REAL_ARITH_TAC; EXISTS_TAC`&0:real` THEN EXISTS_TAC`&0:real` THEN EXISTS_TAC`&1:real` THEN REDUCE_VECTOR_TAC THEN REAL_ARITH_TAC]]);;
let aff_ge_subset_aff_gt_union_aff_ge=
prove(`!(x:real^3) (v:real^3) (w:real^3). ~collinear {x,v,w} ==> aff_ge {x} {v , w} SUBSET (aff_gt {x , v} {w}) UNION (aff_ge {x} {v})`,
REPEAT STRIP_TAC THEN MRESA_TAC th3 [`x:real^3`;`v:real^3`;`w:real^3`] THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GE_1_2) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_2_1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`]AFF_GE_1_1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[SUBSET; UNION;IN_ELIM_THM] THEN GEN_TAC THEN REWRITE_TAC[REAL_ARITH `(&0 <= (t3:real)) <=> (&0 < t3) \/ ( t3 = &0)`; TAUT `(a \/ b) /\ (c \/ d) /\ e /\ f <=> ((a \/ b)/\ c /\ e /\ f) \/ ((a \/ b) /\ d /\ e /\ f)`; EXISTS_OR_THM] THEN MATCH_MP_TAC MONO_OR THEN SUBGOAL_THEN `((?t1:real t2:real t3:real. (&0 < t2 \/ t2 = &0) /\ &0< t3 /\ t1 + t2 + t3 = &1 /\ (x':real^3) = t1 % x + t2 % v + t3 % w) ==> (?t1 t2 t3. &0< t3 /\ t1 + t2 + t3 = &1 /\ x' = t1 % x + t2 % v + t3 % w))` ASSUME_TAC THENL [MESON_TAC[]; ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC THEN MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC THEN REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN GEN_TAC THEN REWRITE_TAC[REAL_ARITH `(&0< (t2:real) \/ (t2 = &0)) <=> ( &0<= t2)`] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC [REAL_ARITH `(a:real)+ &0 = a`; VECTOR_ARITH `&0 % (w:real^3) = vec 0`; VECTOR_ARITH ` ((x':real^3) = (t1:real) % (x:real^3) + (t2:real) % (v:real^3) + vec 0)<=> ( x' = t1 % x + t2 % v )` ] THEN MESON_TAC[]]);;
let pos_in_aff_ge_fan=
prove(`!x:real^3 v:real^3 u:real^3 a:real. DISJOINT {x} {v,u} /\ &0<a /\ a< &1 ==> (&1-a)%v + a % u IN aff_ge {x} {v,u:real^3}`,
REPEAT STRIP_TAC THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1 -a:real` THEN EXISTS_TAC`a:real` THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC THEN REAL_ARITH_TAC);;
let aff_gt1_subset_aff_gt=
prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. DISJOINT {x} {v,u} /\ ~collinear {x,v1,u} /\ v1 IN aff_gt {x} {v,u} ==> aff_gt {x} {v1,u} SUBSET aff_gt {x} {v,u}`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC th3[`x:real^3`;`v1:real^3`;`u:real^3`] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v1:real^3`;`u:real^3`][IN_ELIM_THM;SUBSET] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) + t3' % u =(t1'+ t2'*t1) % x + (t2'* t2) % v + (t2' * t3 + t3') % u:real^3`] THEN STRIP_TAC THEN EXISTS_TAC`t1' + t2' * t1:real` THEN EXISTS_TAC`t2' * t2:real` THEN EXISTS_TAC`t2' * t3 +t3':real` THEN MP_TAC(REAL_ARITH`&0<t2'==> &0<= t2'`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`t2':real`;`t2:real`] THEN MRESA_TAC REAL_LT_MUL[`t2':real`;`t3:real`] THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + t2' * t2 + t2' * t3 + t3'= t1'+t2'*(t1+t2+t3)+t3'`; REAL_ARITH`A* &1=A`] THEN ASM_TAC THEN REAL_ARITH_TAC);;
let not_cut_inside_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a< &1 /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ (!h:real. &0<h /\ h< a ==> aff_gt{x} {v,(&1-h)%u+ h % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={}) ==> aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={}`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") THEN DISCH_TAC THEN POP_ASSUM (fun th-> MP_TAC (th) THEN ASSUME_TAC(th)) THEN REWRITE_TAC[fan80] THEN DISCH_THEN(LABEL_TAC"BE") THEN DISCH_THEN(LABEL_TAC"YEU") THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC THENL(*1*)[ STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN DISCH_TAC THEN REMOVE_THEN "A" MP_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[(th)]) THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN DISCH_TAC THEN REMOVE_THEN "A" MP_TAC THEN REMOVE_THEN "BE" (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"BE") ) THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; ` (v':real^3)`] THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v':real^3`;`w':real^3`][IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "VUT1") THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-a)%u +a%w:real^3`][IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "VUT") THEN REPEAT 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 DISCH_THEN(LABEL_TAC "VUT1") THEN DISCH_TAC THEN DISCH_TAC THEN DISJ_CASES_TAC(REAL_ARITH`(t3'= &0) \/ ~(t3':real= &0)`) THENL(*2*)[ ASM_REWRITE_TAC[] THEN REDUCE_ARITH_TAC THEN REDUCE_VECTOR_TAC THEN DISJ_CASES_TAC(REAL_ARITH`(t2'= &0) \/ ~(t2':real= &0)`) THENL(*3*)[ ASM_REWRITE_TAC[] THEN REDUCE_ARITH_TAC THEN REDUCE_VECTOR_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`&0<t3:real==> ~(t3= &0)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM(th)])`t1 + t2 + t3 = &1:real` THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % (((t1 + t2 + t3) - a) % u + a % w) = (t1 + t2 + t3) % x<=>(t3) % (((t1 + t2 + t3) - a) % u + a % w- x)=(-- t2) % (v-x) `] THEN ASM_REWRITE_TAC[IN;EMPTY] THEN STRIP_TAC THEN MP_TAC(SET_RULE` (t3) % ((&1 - a) % u + a % w- x)=(-- t2) % (v-x) ==> (inv (t3))%((t3) % ((&1 - a) % u + a % w- x) ) = (inv (t3))%((-- t2) % (v-x)):real^3`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;] THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[VECTOR_ARITH`E+A-B=C%(D-B)<=>E+A=(&1-C)%B+C%D`;] THEN STRIP_TAC THEN FIND_ASSUM MP_TAC `~((&1 - a) % u + a % w IN aff {x, v:real^3})` THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN EXISTS_TAC`&1-(inv t3 * (--t2)):real` THEN EXISTS_TAC`(inv t3 * (--t2)):real` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC;(*3*) FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1= &1 -t2 -t3`; REAL_ARITH`A+B= &1<=> A= &1-B`] THEN DISCH_THEN(LABEL_TAC"MAI") THEN DISCH_THEN (LABEL_TAC"YEU EM") THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w) = (&1 - t2') % x + t2' % v'<=> t2' % v'=(t2' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3 `] THEN MP_TAC(ISPEC`(t2':real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2' % v'=(t2' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3 ==> (inv (t2'))%(t2' % v' ) = (inv (t2'))%((t2' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C+D)=(A%B+A%C+A%D)`;REAL_ARITH`a*(b-c-d)=a*b-a*c-a*d`] THEN REDUCE_VECTOR_TAC THEN DISCH_TAC THEN SUBGOAL_THEN `~coplanar{x:real^3,v':real^3,v:real^3,u:real^3}` ASSUME_TAC THENL(*4*)[ POP_ASSUM MP_TAC THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, v', v, u}= {(--x) +x, (--x) +v', (--x) +v, (--x) +u}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,v':real^3,v:real^3,u:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`]) THEN DISCH_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th;VECTOR_ARITH`((&1 - inv t2' * t2 - inv t2' * t3) % x + (inv t2' * t2) % v + (inv t2' * t3) % ((&1 - a) % u + a % w)) - x=(inv t2' * t2) % (v-x) + (inv t2' * t3) % ((&1 - a) % u + a % w-x)`]) THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3 /\ t1+t2+t3= &1==> &0 < &1- t1 /\ ~(&1- t1 = &0)/\ t2+t3= &1- t1`) THEN REMOVE_THEN"MAI" MP_TAC THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2 + t3 = &1 - t1:real ==> (inv ( &1 - t1))*(t2 + t3) = (inv ( &1 - t1))*( &1 - t1:real) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> A*B = &1 -A*C`] THEN STRIP_TAC THEN MP_TAC(REAL_ARITH` ~(t2' = &0) /\ &0 <= t2'==> &0 <t2'`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH` &0 < a==> ~(a = &0) `) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`t2':real`;`inv (&1- t1):real`] THEN MRESA_TAC REAL_LT_MUL[`inv (&1- t1):real`;`t3:real`;] THEN MP_TAC(REAL_ARITH`&0< (inv (&1- t1)) * t3 ==> ~( (inv(&1- t1)) * t3= &0)`) THEN MP_TAC(REAL_ARITH`&0< (t2') * inv (&1- t1) ==> ~((t2')* inv(&1- t1)= &0)`) THEN RESA_TAC THEN ASSUME_TAC(REAL_ARITH`~(&1 = &0)`) THEN MRESA_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`(t2')* inv(&1- t1)`;`u - x:real^3`; `v - x:real^3`; `(inv t2' * t2) % (v - x) +(inv t2' * t3) % ((&1 - a) % u + a % w - x):real^3`] THEN POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM(th);]) THEN REDUCE_VECTOR_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+E%(C+D))=A%B+(A*E)%(C+D)`; VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(t2' * inv (&1 - t1)) * inv t2' * t2= (inv (t2')* t2' ) * inv (&1-t1) * t2`] THEN REDUCE_ARITH_TAC THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN DISCH_TAC THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th`(inv(&1- t1)) * t3:real`) THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[VECTOR_ARITH` (&1 - inv (&1 - t1) * t3) % (v - x) + (inv (&1 - t1) * t3) % (((&1 - a) % u + a % w) - x)= (&1 - inv (&1 - t1) * t3) % (v - x) + (inv (&1 - t1) * t3) % ((&1 - a) % u + a % w - x)`];(*4*) POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"DICH") THEN DISCH_TAC THEN ABBREV_TAC `va=((&1 - a) % u + a % w):real^3` THEN MP_TAC(REAL_ARITH` ~(t2' = &0) /\ &0 <= t2'==> &0 <t2'`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH` &0 < a==> ~(a = &0) `) THEN RESA_TAC THEN MRESA1_TAC REAL_LT_INV`t2':real` THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t2:real`;] THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t3:real`;] THEN SUBGOAL_THEN `(v':real^3) IN aff_gt {x} {v,va:real^3}` ASSUME_TAC THENL(*5*)[ ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`(&1 - inv t2' * t2 - inv t2' * t3:real)` THEN EXISTS_TAC`inv t2' * t2:real` THEN EXISTS_TAC`(inv t2' * t3:real)` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC;(*5*) REMOVE_THEN "DICH" MP_TAC THEN REMOVE_THEN "VUT" MP_TAC THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `v':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN MRESA_TAC exists_element_in_half_sapace_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;` v:real^3`;`u:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; ` (v':real^3)`] THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v':real^3`;`u':real^3`] THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN REWRITE_TAC[EMPTY;IN] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`&0<t /\ t< &1==> &0< &1-t:real /\ &1-t< &1`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v':real^3`;`u':real^3`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC`{v',u'} IN (E:(real^3->bool)->bool)` THEN SET_TAC[]](*5*)](*4*)](*3*);(*2*) DISJ_CASES_TAC(REAL_ARITH`(t2'= &0) \/ ~(t2':real= &0)`) THENL(*3*)[ FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1= &1 -t2 -t3`; REAL_ARITH`A+B= &1<=> A= &1-B`] THEN DISCH_THEN(LABEL_TAC"MAI") THEN DISCH_THEN (LABEL_TAC"YEU EM") THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w) = (&1 - &0 - t3') % x + &0% v'+t3' % w'<=> t3' % w'=(t3' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3 `] THEN MP_TAC(ISPEC`(t3':real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t3' % w'=(t3' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3 ==> (inv (t3'))%(t3' % w' ) = (inv (t3'))%((t3' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C+D)=(A%B+A%C+A%D)`;REAL_ARITH`a*(b-c-d)=a*b-a*c-a*d`] THEN REDUCE_VECTOR_TAC THEN DISCH_TAC THEN SUBGOAL_THEN `~coplanar{x:real^3,w':real^3,v:real^3,u:real^3}` ASSUME_TAC THENL(*4*)[ POP_ASSUM MP_TAC THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, w', v, u}= {(--x) +x, (--x) +w', (--x) +v, (--x) +u}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,w':real^3,v:real^3,u:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`]) THEN DISCH_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th;VECTOR_ARITH`((&1 - inv t2' * t2 - inv t2' * t3) % x + (inv t2' * t2) % v + (inv t2' * t3) % ((&1 - a) % u + a % w)) - x=(inv t2' * t2) % (v-x) + (inv t2' * t3) % ((&1 - a) % u + a % w-x)`]) THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3 /\ t1+t2+t3= &1==> &0 < &1- t1 /\ ~(&1- t1 = &0)/\ t2+t3= &1- t1`) THEN REMOVE_THEN"MAI" MP_TAC THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2 + t3 = &1 - t1:real ==> (inv ( &1 - t1))*(t2 + t3) = (inv ( &1 - t1))*( &1 - t1:real) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> A*B = &1 -A*C`] THEN STRIP_TAC THEN MP_TAC(REAL_ARITH` ~(t3' = &0) /\ &0 <= t3'==> &0 <t3'`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH` &0 < a==> ~(a = &0) `) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`t3':real`;`inv (&1- t1):real`] THEN MRESA_TAC REAL_LT_MUL[`inv (&1- t1):real`;`t3:real`;] THEN MP_TAC(REAL_ARITH`&0< (inv (&1- t1)) * t3 ==> ~( (inv(&1- t1)) * t3= &0)`) THEN MP_TAC(REAL_ARITH`&0< (t3') * inv (&1- t1) ==> ~((t3')* inv(&1- t1)= &0)`) THEN RESA_TAC THEN ASSUME_TAC(REAL_ARITH`~(&1 = &0)`) THEN MRESA_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`(t3')* inv(&1- t1)`;`u - x:real^3`; `v - x:real^3`; `(inv t3' * t2) % (v - x) +(inv t3' * t3) % ((&1 - a) % u + a % w - x):real^3`] THEN POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM(th);]) THEN REDUCE_VECTOR_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+E%(C+D))=A%B+(A*E)%(C+D)`; VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(t2' * inv (&1 - t1)) * inv t2' * t2= (inv (t2')* t2' ) * inv (&1-t1) * t2`] THEN REDUCE_ARITH_TAC THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN DISCH_TAC THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th`(inv(&1- t1)) * t3:real`) THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[VECTOR_ARITH` (&1 - inv (&1 - t1) * t3) % (v - x) + (inv (&1 - t1) * t3) % (((&1 - a) % u + a % w) - x)= (&1 - inv (&1 - t1) * t3) % (v - x) + (inv (&1 - t1) * t3) % ((&1 - a) % u + a % w - x)`];(*4*) POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"DICH") THEN DISCH_TAC THEN ABBREV_TAC `va=((&1 - a) % u + a % w):real^3` THEN MP_TAC(REAL_ARITH` ~(t3' = &0) /\ &0 <= t3'==> &0 <t3'`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH` &0 < a==> ~(a = &0) `) THEN RESA_TAC THEN MRESA1_TAC REAL_LT_INV`t3':real` THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t2:real`;] THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t3:real`;] THEN SUBGOAL_THEN `(w':real^3) IN aff_gt {x} {v,va:real^3}` ASSUME_TAC THENL[(*5*) ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`(&1 - inv t3' * t2 - inv t3' * t3:real)` THEN EXISTS_TAC`inv t3' * t2:real` THEN EXISTS_TAC`(inv t3' * t3:real)` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC;(*5*) REMOVE_THEN "DICH" MP_TAC THEN REMOVE_THEN "VUT" MP_TAC THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN FIND_ASSUM MP_TAC`{v',w':real^3} IN E` THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN DISCH_TAC THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; ` (w':real^3)`] THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `w':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN MRESA_TAC exists_element_in_half_sapace_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`;` v:real^3`;`u:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; ` (w':real^3)`] THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`w':real^3`;`u':real^3`] THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN REWRITE_TAC[EMPTY;IN] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`&0<t /\ t< &1==> &0< &1-t:real /\ &1-t< &1`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`w':real^3`;`u':real^3`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC`{w',u'} IN (E:(real^3->bool)->bool)` THEN SET_TAC[]](*5*)](*4*);(*3*) ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_THEN(LABEL_TAC"BO") THEN ABBREV_TAC `va=((&1 - a) % u + a % w):real^3` THEN MP_TAC(REAL_ARITH` ~(t3' = &0) /\ &0 <= t3'==> &0 <t3'`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH` ~(t2' = &0) /\ &0 <= t2'==> &0 <t2'`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH` &0 < a==> ~(a = &0) `) THEN RESA_TAC THEN MRESA1_TAC REAL_LT_INV`t2':real` THEN MRESA1_TAC REAL_MUL_LINV`t2':real` THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t2:real`;] THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t3:real`;] THEN MRESA1_TAC REAL_LT_INV`t3':real` THEN MRESA1_TAC REAL_MUL_LINV`t3':real` THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t2:real`;] THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t3:real`;] THEN SUBGOAL_THEN`(x':real^3) IN aff_gt {x} {v',w'}` ASSUME_TAC THENL(*4*)[ MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v':real^3`;`w':real^3`][IN_ELIM_THM] THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`t1':real` THEN EXISTS_TAC`t2':real` THEN EXISTS_TAC`t3':real` THEN ASM_REWRITE_TAC[];(*4*) SUBGOAL_THEN`(x':real^3) IN aff_ge {x} {v',w'}` ASSUME_TAC THENL(*5*)[ ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`t1':real` THEN EXISTS_TAC`t2':real` THEN EXISTS_TAC`t3':real` THEN ASM_REWRITE_TAC[];(*5*) SUBGOAL_THEN `(x':real^3) IN aff_gt {x} {v,va:real^3}` ASSUME_TAC THENL(*6*)[ ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`t1:real` THEN EXISTS_TAC`t2:real` THEN EXISTS_TAC`t3:real` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC;(*6*) SUBGOAL_THEN `(x':real^3) IN aff_ge {x} {v,va:real^3}` ASSUME_TAC THENL(*7*)[ MRESA_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`va:real^3`] THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`t1:real` THEN EXISTS_TAC`t2:real` THEN EXISTS_TAC`t3:real` THEN MP_TAC(REAL_ARITH`&0< t2==> &0 <= t2`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0< t3==> &0 <= t3`) THEN RESA_TAC THEN ASM_REWRITE_TAC[];(*7*) FIND_ASSUM MP_TAC`{v',w':real^3} IN E` THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN DISCH_TAC THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; ` (w':real^3)`] THEN SUBGOAL_THEN `~collinear {x, x', w':real^3}` ASSUME_TAC THENL(*8*)[ ASM_REWRITE_TAC[collinear1_fan;] THEN FIND_ASSUM MP_TAC `~((v':real^3) IN aff{x,w'})` THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v' + t3' % w' = u' % x + v'' % w' <=> t2' % v' = (u'-t1') % x + (v''-t3') % w'`] THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2' % v' = (u'-t1') % x + (v''-t3') % w':real^3 ==> (inv ( t2'))%(t2' % v') = (inv (t2'))%((u'-t1') % x + (v''-t3') % w') `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC `(inv t2' * (u' - t1':real))` THEN EXISTS_TAC `(inv t2' * (v'' - t3':real))` THEN ASM_REWRITE_TAC[REAL_ARITH`inv t2' * (u' - t1') + inv t2' * (v'' - t3')=inv t2'* (t2'+ (u'+v'') - (t1'+t2'+t3'))`;REAL_ARITH`t2'+ &1 - &1=t2'`];(*8*) SUBGOAL_THEN `~collinear {x, x', v':real^3}` ASSUME_TAC THENL(*9*)[ ASM_REWRITE_TAC[collinear1_fan;] THEN FIND_ASSUM MP_TAC `~((w':real^3) IN aff{x,v'})` THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v' + t3' % w' = u' % x + v'' % v' <=> t3' % w' = (u'-t1') % x + (v''-t2') % v'`] THEN STRIP_TAC THEN MP_TAC(SET_RULE` t3' % w' = (u'-t1') % x + (v''-t2') % v':real^3 ==> (inv ( t3'))%(t3' % w') = (inv (t3'))%((u'-t1') % x + (v''-t2') % v') `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC `(inv t3' * (u' - t1':real))` THEN EXISTS_TAC `(inv t3' * (v'' - t2':real))` THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3' * (u' - t1') + inv t3' * (v'' - t2')=inv t3'* (t3'+ (u'+v'') - (t1'+t2'+t3'))`;REAL_ARITH`t3'+ &1 - &1=t3'`];(*9*) SUBGOAL_THEN`~collinear {x, x', va:real^3}` ASSUME_TAC THENL(*10*)[ REMOVE_THEN "BO" MP_TAC THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN ASM_REWRITE_TAC[collinear1_fan;] THEN FIND_ASSUM MP_TAC`~(va IN aff {x, v:real^3})` THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % (va) = u' % x + v' % (va)<=> (&1-(t1+t2+t3)) % x + (v'-t3) % (va-x) = (&1-(u'+v') ) % x + t2 % (v-x)`;REAL_ARITH`a-a= &0`] THEN REDUCE_VECTOR_TAC THEN DISJ_CASES_TAC(REAL_ARITH`(v'' - t3 = &0) \/ ~(v'' - (t3:real)= &0)`) THENL(*11*)[ ASM_REWRITE_TAC[VECTOR_ARITH`&0 %A=B<=> B= vec 0`;VECTOR_MUL_EQ_0] THEN MP_TAC(REAL_ARITH`&0< t2==> ~(t2 = &0)`) THEN RESA_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> A=B`];(*11*) MRESA1_TAC REAL_MUL_LINV `(v''-t3:real)` THEN STRIP_TAC THEN MP_TAC(SET_RULE`(v'' - t3) % (va- x) = t2 % (v - x:real^3) ==> (inv (v'' -t3)) % ((v'' - t3) % (va - x)) = (inv (v'' -t3)) % ( t2 % (v - x))`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) THEN REWRITE_TAC[VECTOR_ARITH`&1 % (va - x) = (inv (v' - t3) * t2) % (v - x)<=> va = (&1-(inv (v' - t3) * t2))%x +(inv (v' - t3) * t2) % v:real^3`] THEN STRIP_TAC THEN EXISTS_TAC`&1-(inv (v'' - t3) * (t2:real))` THEN EXISTS_TAC`(inv (v'' - t3) * (t2:real))` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC](*11*);(*10*) SUBGOAL_THEN `~collinear {x, x', v:real^3}` ASSUME_TAC THENL(*11*)[ REMOVE_THEN "BO" MP_TAC THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN ASM_REWRITE_TAC[collinear1_fan] THEN FIND_ASSUM MP_TAC `~(va IN aff {x, v:real^3})` THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v' + t3' % w' = u' % x + v'' % v' <=> t3' % w' = (u'-t1') % x + (v''-t2') % v'`] THEN MP_TAC(REAL_ARITH`&0< t3 ==> ~(t3= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`t3:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE` t3 % va = (u'-t1) % x + (v''-t2) % v:real^3 ==> (inv ( t3))%(t3 % va) = (inv (t3))%((u'-t1) % x + (v''-t2) % v) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC `(inv t3 * (u' - t1:real))` THEN EXISTS_TAC `(inv t3 * (v'' - t2:real))` THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3' * (u' - t1') + inv t3' * (v'' - t2')=inv t3'* (t3'+ (u'+v'') - (t1'+t2'+t3'))`;REAL_ARITH`t3'+ &1 - &1=t3'`];(*11*) ABBREV_TAC`an=t1' % x + t2' % v' + t3' % w':real^3` THEN REMOVE_THEN "VUT1" MP_TAC THEN REMOVE_THEN "VUT1" MP_TAC THEN REMOVE_THEN "BO" MP_TAC THEN REMOVE_THEN "VUT" MP_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN DISJ_CASES_TAC(SET_RULE`(&0 < azim x (x':real^3) v w' /\ azim x (x') v w' < pi)\/ ~(&0 < azim x (x') v w' /\ azim x (x') v w' < pi)`) THENL(*12*)[ MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`x':real^3`;`w':real^3`] THEN REWRITE_TAC[EMPTY;IN] THEN MP_TAC(REAL_ARITH`&0<t /\ t< &1==> &0< &1-t:real /\ &1-t< &1`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) THEN MRESA_TAC aff_gt1_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`] 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 POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC`{v',w'} IN (E:(real^3->bool)->bool)` THEN SET_TAC[];(*12*) ASSUME_TAC(ISPECL[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`]azim) THEN ASSUME_TAC(PI_WORKS) THEN MP_TAC(REAL_ARITH`~(&0 < azim x x' v w' /\ azim x x' v w' < pi)/\ &0 <= azim x x' v w' /\ &0< pi==> pi< azim x x' v w' \/(azim x x' v w'= &0 \/ azim x x' v w'=pi) `) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*13*)(*3SUBGOAL*)[ POP_ASSUM MP_TAC THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3 `;`x':real^3`] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN DISCH_TAC THEN MP_TAC(REAL_ARITH`azim x x' v' w' < azim x x' v w'==>azim x x' v' w' <= azim x x' v w'`) THEN RESA_TAC THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`;`w':real^3`] THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3 `;`x':real^3`] THEN DISCH_TAC THEN DISCH_TAC THEN MP_TAC(REAL_ARITH`pi < azim x x' v w' /\ azim x x' v w' = azim x x' v v' + pi /\ azim x x' v w' < &2 * pi==> &0 <azim x x' v v' /\ azim x x' v v' < pi`) THEN RESA_TAC THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`x':real^3`;`v':real^3`] THEN REWRITE_TAC[EMPTY;IN] THEN MP_TAC(REAL_ARITH`&0<t /\ t< &1==> &0< &1-t:real /\ &1-t< &1`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) THEN SUBGOAL_THEN ` aff_ge {x} {w', v':real^3}=aff_ge {x} {v', w'}` ASSUME_TAC THENL(*14*)[ REWRITE_TAC[SET_RULE`{A,B}={B,A}`];(*14*) MRESA_TAC aff_gt1_subset_aff_ge[`x:real^3`;`w':real^3`;`v':real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC 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 FIND_ASSUM MP_TAC`{v',w'} IN (E:(real^3->bool)->bool)` THEN SET_TAC[]](*14*);(*13*) MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`v:real^3`;`w':real^3`] THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`x':real^3`;`v:real^3`;`w':real^3`] THEN MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`w':real^3`;`v:real^3`] THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`w':real^3`;`v:real^3`] THEN DISJ_CASES_TAC(SET_RULE`w' IN aff_gt {x} {v,va:real^3}\/ ~(w' IN aff_gt {x} {v,va:real^3})`) THENL(*14*)[ MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-a)%u +a%w:real^3`][IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") THEN DISCH_TAC THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC THEN ASSUME_TAC(th)) THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`w' = t1'' % x + t2'' % v + t3'' % va<=> ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= w' -x:real^3`;REAL_ARITH`&1- &1 = &0`] THEN REDUCE_VECTOR_TAC THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2'' + t3'' = &1 - t1'':real ==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] THEN STRIP_TAC THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)*(t3'':real)==> ~(inv(&1- t1'':real)*(t3'':real)= &0)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)==> ~(inv(&1- t1'':real)= &0)`) THEN RESA_TAC THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) THEN STRIP_TAC THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `w'-x:real^3`] [VECTOR_ARITH`&1 %A=A`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,w'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + w'}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] THEN DISCH_TAC THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `w':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN MRESA_TAC exists_element_in_half_sapace_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`;` v:real^3`;`u:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; ` (w':real^3)`] THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`w':real^3`;`u':real^3`] THEN REWRITE_TAC[EMPTY;IN] THEN MP_TAC(REAL_ARITH`&0<t /\ t< &1==> &0< &1-t:real /\ &1-t< &1`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`w':real^3`;`u':real^3`] 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 POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC`{w',u'} IN (E:(real^3->bool)->bool)` THEN SET_TAC[];(*14*) DISJ_CASES_TAC(SET_RULE`v' IN aff_gt {x} {v,va:real^3}\/ ~(v' IN aff_gt {x} {v,va:real^3})`) THENL(*15*)[ MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-a)%u +a%w:real^3`][IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") THEN DISCH_TAC THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC THEN ASSUME_TAC(th)) THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`v' = t1'' % x + t2'' % v + t3'' % va<=> ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= v' -x:real^3`;REAL_ARITH`&1- &1 = &0`] THEN REDUCE_VECTOR_TAC THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2'' + t3'' = &1 - t1'':real ==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] THEN STRIP_TAC THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)*(t3'':real)==> ~(inv(&1- t1'':real)*(t3'':real)= &0)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)==> ~(inv(&1- t1'':real)= &0)`) THEN RESA_TAC THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) THEN STRIP_TAC THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `v'-x:real^3`] [VECTOR_ARITH`&1 %A=A`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,v'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + v'}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, v'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] THEN DISCH_TAC THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `v':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN MRESA_TAC exists_element_in_half_sapace_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;` v:real^3`;`u:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; ` (v':real^3)`] THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v':real^3`;`u':real^3`] THEN REWRITE_TAC[EMPTY;IN] THEN MP_TAC(REAL_ARITH`&0<t /\ t< &1==> &0< &1-t:real /\ &1-t< &1`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v':real^3`;`u':real^3`] 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 POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC`{v',u'} IN (E:(real^3->bool)->bool)` THEN SET_TAC[];(*15*) SUBGOAL_THEN`~(w' IN aff_gt {x} { x',v:real^3})` ASSUME_TAC THENL(*16*)[ REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN MRESA_TAC aff_gt3_subset_aff_gt[`x:real^3`;`v:real^3`;`va:real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[];(*16*) MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v:real^3`;`w':real^3`] decomposition_planar_by_angle_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*17*)[ MRESA_TAC aff_gt1_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`] THEN MP_TAC(SET_RULE`v IN aff_gt {x} {x', w':real^3} /\ aff_gt {x} {x', w'} SUBSET aff_ge {x} {v', w'} ==>v IN aff_ge {x} {v', w':real^3}`) THEN RESA_TAC THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*18*)[ MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)]) THEN MP_TAC(PI_WORKS) THEN REAL_ARITH_TAC;(*18*) MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)]) THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_PI_SYM [`x:real^3`;`x':real^3`; `v':real^3`;`v:real^3`] THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`va:real^3`;`v':real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`va:real^3`;`v':real^3`] THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v':real^3`;`va:real^3`] decomposition_planar_by_angle_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*19*)[ MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] THEN ASM_TAC THEN SET_TAC[];(*19*) MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`w':real^3`; `v':real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN STRIP_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE`va IN aff_ge {x} {v', x':real^3} /\ aff_ge {x} {v', x'} SUBSET aff_ge {x} {v', w'} ==>va IN aff_ge {x} {v', w':real^3}`) THEN RESA_TAC THEN SUBGOAL_THEN `va IN aff_ge {x} {u,w:real^3}` ASSUME_TAC THENL(*20*)[ MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1 -a:real` THEN EXISTS_TAC`a:real` THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC THEN REAL_ARITH_TAC;(*20*) MP_TAC(SET_RULE`va IN aff_ge {x} {v', w':real^3} /\ va IN aff_ge {x} {u, w} ==>va IN aff_ge {x} {u, w} INTER aff_ge {x} {v', w':real^3} `) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` THEN REWRITE_TAC[FAN;fan7] THEN STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v':real^3),(w':real^3)}`]th)) THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN DISJ_CASES_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}\/ ~({u, w} INTER {v', w'}={u,w:real^3})`) THENL(*21*)[ DISCH_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] THEN REMOVE_ASSUM_TAC THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}/\ ~(w=u) /\ ~(v'=w') ==> {v', w'}={u,w} `) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN FIND_ASSUM MP_TAC `v IN aff_ge {x} {v', w':real^3}` THEN POP_ASSUM(fun th->REWRITE_TAC[th]) THEN MRESAL_TAC aff_ge_inter_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`][INTER;IN_ELIM_THM] THEN STRIP_TAC THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN POP_ASSUM MP_TAC THEN SET_TAC[];(*21*) MP_TAC(SET_RULE`~({u, w} INTER {v', w'} = {u, w:real^3}) ==> {u, w} INTER {v', w'} PSUBSET {u, w} `) THEN RESA_TAC THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'} PSUBSET {u, w:real^3} ==> {u, w} INTER {v', w'} SUBSET {u}\/ {u, w} INTER {v', w'} SUBSET {w} `) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*22*)[ MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] THEN STRIP_TAC THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{u:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {u}/\ aff_ge {x} {u} SUBSET aff {x, u}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,u}`) THEN RESA_TAC THEN REWRITE_TAC[IN;EMPTY] THEN POP_ASSUM MP_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN EXPAND_TAC"va" THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % u <=> a % w = u' % x + (v''+a- &1) % u`] THEN MRESA1_TAC REAL_MUL_LINV`a:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE`a % w = u' % x + (v'' + a - &1) % u:real^3 ==> (inv (a))%(a % w ) = (inv (a))%( u' % x + (v'' + a - &1) % u)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC`(inv a * u'):real` THEN EXISTS_TAC`(inv a * (v'' + a - &1)):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * u' + inv a * (v'' + a - &1) =inv a * ( a+ (u' + v'') - &1)`;REAL_ARITH`A+ &1- &1=A`];(*22*) STRIP_TAC THEN FIND_ASSUM MP_TAC`{u,w:real^3} IN E` THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN STRIP_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`] THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w} = {}<=> ~(x=w:real^3)`] THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{w:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {w}/\ aff_ge {x} {w} SUBSET aff {x, w}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,w}`) THEN RESA_TAC THEN REWRITE_TAC[IN;EMPTY] THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC `~(u IN aff {x, w:real^3})` THEN REWRITE_TAC[] THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN EXPAND_TAC"va" THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % w <=> (&1-a )% u = u' % x + (v''-a) % w`] THEN MP_TAC(REAL_ARITH`a< &1==> ~(&1-a= &0)` )THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`&1-a:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE`(&1-a )% u = u' % x + (v''-a) % w:real^3 ==> (inv (&1-a))%((&1-a )% u ) = (inv (&1-a))%( u' % x + (v''-a) % w)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC`(inv (&1-a) * u'):real` THEN EXISTS_TAC`(inv (&1-a) * (v'' - a)):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - a) * u' + inv (&1 - a) * (v'' - a)=inv (&1 - a) * ((u' + v'') - a)`]](*22*)](*21*)](*20*)](*19*)](*18*);(*17*) POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN DISCH_TAC THEN MRESA_TAC aff_ge_subset_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;`(x':real^3)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(SET_RULE`aff_ge {x} {v, x':real^3} SUBSET aff_gt {x, v} {x'} UNION aff_ge {x} {v} /\ w' IN aff_ge {x} {v, x'} ==> w' IN aff_gt {x, v} {x'} UNION aff_ge {x} {v}`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(x':real^3)`;`(v:real^3)`] THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;UNION] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `w':real^3`; `v':real^3`; `v:real^3`;`u:real^3`]properties1_of_fan7) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) THEN DISCH_TAC THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v':real^3)`;`(w':real^3)`] THEN SUBGOAL_THEN`v IN aff_ge {x} {v', w':real^3}`ASSUME_TAC THENL(*18*)[ POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[];(*18*) POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"NHAT") THEN DISCH_TAC THEN REMOVE_THEN "NHAT" MP_TAC THEN DISCH_TAC THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)]) THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_PI_SYM [`x:real^3`;`x':real^3`; `v':real^3`;`v:real^3`] THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`va:real^3`;`v':real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`va:real^3`;`v':real^3`] THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v':real^3`;`va:real^3`] decomposition_planar_by_angle_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*19*)[ MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] THEN ASM_TAC THEN SET_TAC[];(*19*) MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`w':real^3`; `v':real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN STRIP_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE`va IN aff_ge {x} {v', x':real^3} /\ aff_ge {x} {v', x'} SUBSET aff_ge {x} {v', w'} ==>va IN aff_ge {x} {v', w':real^3}`) THEN RESA_TAC THEN SUBGOAL_THEN `va IN aff_ge {x} {u,w:real^3}` ASSUME_TAC THENL(*20*)[ MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1 -a:real` THEN EXISTS_TAC`a:real` THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC THEN REAL_ARITH_TAC;(*20*) MP_TAC(SET_RULE`va IN aff_ge {x} {v', w':real^3} /\ va IN aff_ge {x} {u, w} ==>va IN aff_ge {x} {u, w} INTER aff_ge {x} {v', w':real^3} `) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` THEN REWRITE_TAC[FAN;fan7] THEN STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v':real^3),(w':real^3)}`]th)) THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN DISJ_CASES_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}\/ ~({u, w} INTER {v', w'}={u,w:real^3})`) THENL(*21*)[ DISCH_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] THEN REMOVE_ASSUM_TAC THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}/\ ~(w=u) /\ ~(v'=w') ==> {v', w'}={u,w} `) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN FIND_ASSUM MP_TAC `v IN aff_ge {x} {v', w':real^3}` THEN POP_ASSUM(fun th->REWRITE_TAC[th]) THEN MRESAL_TAC aff_ge_inter_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`][INTER;IN_ELIM_THM] THEN STRIP_TAC THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN POP_ASSUM MP_TAC THEN SET_TAC[];(*21*) MP_TAC(SET_RULE`~({u, w} INTER {v', w'} = {u, w:real^3}) ==> {u, w} INTER {v', w'} PSUBSET {u, w} `) THEN RESA_TAC THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'} PSUBSET {u, w:real^3} ==> {u, w} INTER {v', w'} SUBSET {u}\/ {u, w} INTER {v', w'} SUBSET {w} `) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*22*)[ MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] THEN STRIP_TAC THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{u:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {u}/\ aff_ge {x} {u} SUBSET aff {x, u}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,u}`) THEN RESA_TAC THEN REWRITE_TAC[IN;EMPTY] THEN POP_ASSUM MP_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN EXPAND_TAC"va" THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % u <=> a % w = u' % x + (v''+a- &1) % u`] THEN MRESA1_TAC REAL_MUL_LINV`a:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE`a % w = u' % x + (v'' + a - &1) % u:real^3 ==> (inv (a))%(a % w ) = (inv (a))%( u' % x + (v'' + a - &1) % u)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC`(inv a * u'):real` THEN EXISTS_TAC`(inv a * (v'' + a - &1)):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * u' + inv a * (v'' + a - &1) =inv a * ( a+ (u' + v'') - &1)`;REAL_ARITH`A+ &1- &1=A`];(*22*) STRIP_TAC THEN FIND_ASSUM MP_TAC`{u,w:real^3} IN E` THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN STRIP_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`] THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w} = {}<=> ~(x=w:real^3)`] THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{w:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {w}/\ aff_ge {x} {w} SUBSET aff {x, w}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,w}`) THEN RESA_TAC THEN REWRITE_TAC[IN;EMPTY] THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC `~(u IN aff {x, w:real^3})` THEN REWRITE_TAC[] THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN EXPAND_TAC"va" THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % w <=> (&1-a )% u = u' % x + (v''-a) % w`] THEN MP_TAC(REAL_ARITH`a< &1==> ~(&1-a= &0)` )THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`&1-a:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE`(&1-a )% u = u' % x + (v''-a) % w:real^3 ==> (inv (&1-a))%((&1-a )% u ) = (inv (&1-a))%( u' % x + (v''-a) % w)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC`(inv (&1-a) * u'):real` THEN EXISTS_TAC`(inv (&1-a) * (v'' - a)):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - a) * u' + inv (&1 - a) * (v'' - a)=inv (&1 - a) * ((u' + v'') - a)`]](*22*)](*21*)](*20*)](*19*)](*18*)](*17*)](*16*)](*15*)](*14*);(*13*) POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"CUOI") THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3 `;`x':real^3`] THEN ASSUME_TAC(REAL_ARITH`pi<= pi`) THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`;`w':real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`A=B+A<=>B= &0`] THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`] THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`] THEN MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`v':real^3`;`v:real^3`] THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`v':real^3`;`v:real^3`] THEN DISJ_CASES_TAC(SET_RULE`w' IN aff_gt {x} {v,va:real^3}\/ ~(w' IN aff_gt {x} {v,va:real^3})`) THENL(*14*)[ MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-a)%u +a%w:real^3`][IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") THEN DISCH_TAC THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC THEN ASSUME_TAC(th)) THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`w' = t1'' % x + t2'' % v + t3'' % va<=> ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= w' -x:real^3`;REAL_ARITH`&1- &1 = &0`] THEN REDUCE_VECTOR_TAC THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2'' + t3'' = &1 - t1'':real ==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] THEN STRIP_TAC THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)*(t3'':real)==> ~(inv(&1- t1'':real)*(t3'':real)= &0)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)==> ~(inv(&1- t1'':real)= &0)`) THEN RESA_TAC THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) THEN STRIP_TAC THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `w'-x:real^3`] [VECTOR_ARITH`&1 %A=A`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,w'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + w'}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] THEN DISCH_TAC THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `w':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN MRESA_TAC exists_element_in_half_sapace_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`;` v:real^3`;`u:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; ` (w':real^3)`] THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`w':real^3`;`u':real^3`] THEN REWRITE_TAC[EMPTY;IN] THEN MP_TAC(REAL_ARITH`&0<t /\ t< &1==> &0< &1-t:real /\ &1-t< &1`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`w':real^3`;`u':real^3`] 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 POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC`{w',u'} IN (E:(real^3->bool)->bool)` THEN SET_TAC[];(*14*) DISJ_CASES_TAC(SET_RULE`v' IN aff_gt {x} {v,va:real^3}\/ ~(v' IN aff_gt {x} {v,va:real^3})`) THENL(*15*)[ MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-a)%u +a%w:real^3`][IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") THEN DISCH_TAC THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC THEN ASSUME_TAC(th)) THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`v' = t1'' % x + t2'' % v + t3'' % va<=> ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= v' -x:real^3`;REAL_ARITH`&1- &1 = &0`] THEN REDUCE_VECTOR_TAC THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2'' + t3'' = &1 - t1'':real ==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] THEN STRIP_TAC THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)*(t3'':real)==> ~(inv(&1- t1'':real)*(t3'':real)= &0)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)==> ~(inv(&1- t1'':real)= &0)`) THEN RESA_TAC THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) THEN STRIP_TAC THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) THEN POP_ASSUM MP_TAC THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `v'-x:real^3`] [VECTOR_ARITH`&1 %A=A`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,v'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + v'}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, v'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] THEN DISCH_TAC THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `v':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN MRESA_TAC exists_element_in_half_sapace_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;` v:real^3`;`u:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; ` (v':real^3)`] THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v':real^3`;`u':real^3`] THEN REWRITE_TAC[EMPTY;IN] THEN MP_TAC(REAL_ARITH`&0<t /\ t< &1==> &0< &1-t:real /\ &1-t< &1`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v':real^3`;`u':real^3`] 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 POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC`{v',u'} IN (E:(real^3->bool)->bool)` THEN SET_TAC[];(*15*) SUBGOAL_THEN`~(v' IN aff_gt {x} { x',v:real^3})` ASSUME_TAC THENL(*16*)[ REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN MRESA_TAC aff_gt3_subset_aff_gt[`x:real^3`;`v:real^3`;`va:real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN SET_TAC[];(*16*) MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`] decomposition_planar_by_angle_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*17*)[ MRESA_TAC aff_gt12_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`] THEN MP_TAC(SET_RULE`v IN aff_gt {x} {x', v':real^3} /\ aff_gt {x} {x', v'} SUBSET aff_ge {x} {v', w'} ==>v IN aff_ge {x} {v', w':real^3}`) THEN RESA_TAC THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*18*)[ MRESA_TAC aff_gt2_subset_aff_ge [`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`va:real^3`;`w':real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`va:real^3`;`w':real^3`] THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`w':real^3`;`va:real^3`] decomposition_planar_by_angle_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*19*)[ MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] THEN ASM_TAC THEN SET_TAC[];(*19*) MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] THEN ASM_TAC THEN SET_TAC[]](*19*);(*18*) REMOVE_THEN "CUOI" MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN REWRITE_TAC[AZIM_REFL] THEN MP_TAC(PI_WORKS) THEN REAL_ARITH_TAC](*18*);(*17*) POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN DISCH_TAC THEN MRESA_TAC aff_ge_subset_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;`(x':real^3)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(SET_RULE`aff_ge {x} {v, x':real^3} SUBSET aff_gt {x, v} {x'} UNION aff_ge {x} {v} /\ v' IN aff_ge {x} {v, x'} ==> v' IN aff_gt {x, v} {x'} UNION aff_ge {x} {v}`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(x':real^3)`;`(v:real^3)`] THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;UNION] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v':real^3`; `w':real^3`; `v:real^3`;`u:real^3`]properties1_of_fan7) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) THEN DISCH_TAC THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v':real^3)`;`(w':real^3)`] THEN MRESA_TAC aff_gt2_subset_aff_ge [`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`va:real^3`;`w':real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`va:real^3`;`w':real^3`] THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`w':real^3`;`va:real^3`] decomposition_planar_by_angle_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*18*)[ MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] THEN ASM_TAC THEN SET_TAC[];(*18*) MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] THEN MP_TAC(SET_RULE`va IN aff_ge {x} { x',w':real^3} /\ aff_ge {x} { x',w'} SUBSET aff_ge {x} {v', w'} ==>va IN aff_ge {x} {v', w':real^3}`) THEN RESA_TAC THEN SUBGOAL_THEN `va IN aff_ge {x} {u,w:real^3}` ASSUME_TAC THENL(*19*)[ MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1 -a:real` THEN EXISTS_TAC`a:real` THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC THEN REAL_ARITH_TAC;(*19*) MP_TAC(SET_RULE`va IN aff_ge {x} {v', w':real^3} /\ va IN aff_ge {x} {u, w} ==>va IN aff_ge {x} {u, w} INTER aff_ge {x} {v', w':real^3} `) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` THEN REWRITE_TAC[FAN;fan7] THEN STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v':real^3),(w':real^3)}`]th)) THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN DISJ_CASES_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}\/ ~({u, w} INTER {v', w'}={u,w:real^3})`) THENL(*20*)[ DISCH_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] THEN REMOVE_ASSUM_TAC THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}/\ ~(w=u) /\ ~(v'=w') ==> {v', w'}={u,w} `) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN FIND_ASSUM MP_TAC `v' IN aff_ge {x} {v', w':real^3}` THEN POP_ASSUM(fun th->REWRITE_TAC[th]) THEN MRESAL_TAC aff_ge_inter_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`][INTER;IN_ELIM_THM] THEN STRIP_TAC THEN FIND_ASSUM MP_TAC `~collinear {x, v, u:real^3}` THEN FIND_ASSUM MP_TAC `v=v':real^3` THEN DISCH_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[th]) THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN POP_ASSUM MP_TAC THEN SET_TAC[];(*20*) MP_TAC(SET_RULE`~({u, w} INTER {v', w'} = {u, w:real^3}) ==> {u, w} INTER {v', w'} PSUBSET {u, w} `) THEN RESA_TAC THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'} PSUBSET {u, w:real^3} ==> {u, w} INTER {v', w'} SUBSET {u}\/ {u, w} INTER {v', w'} SUBSET {w} `) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*21*)[ MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] THEN STRIP_TAC THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{u:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {u}/\ aff_ge {x} {u} SUBSET aff {x, u}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,u}`) THEN RESA_TAC THEN REWRITE_TAC[IN;EMPTY] THEN POP_ASSUM MP_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN EXPAND_TAC"va" THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % u <=> a % w = u' % x + (v''+a- &1) % u`] THEN MRESA1_TAC REAL_MUL_LINV`a:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE`a % w = u' % x + (v'' + a - &1) % u:real^3 ==> (inv (a))%(a % w ) = (inv (a))%( u' % x + (v'' + a - &1) % u)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC`(inv a * u'):real` THEN EXISTS_TAC`(inv a * (v'' + a - &1)):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * u' + inv a * (v'' + a - &1) =inv a * ( a+ (u' + v'') - &1)`;REAL_ARITH`A+ &1- &1=A`];(*21*) STRIP_TAC THEN FIND_ASSUM MP_TAC`{u,w:real^3} IN E` THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN STRIP_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`] THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w} = {}<=> ~(x=w:real^3)`] THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{w:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {w}/\ aff_ge {x} {w} SUBSET aff {x, w}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,w}`) THEN RESA_TAC THEN REWRITE_TAC[IN;EMPTY] THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC `~(u IN aff {x, w:real^3})` THEN REWRITE_TAC[] THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN EXPAND_TAC"va" THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % w <=> (&1-a )% u = u' % x + (v''-a) % w`] THEN MP_TAC(REAL_ARITH`a< &1==> ~(&1-a= &0)` )THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`&1-a:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE`(&1-a )% u = u' % x + (v''-a) % w:real^3 ==> (inv (&1-a))%((&1-a )% u ) = (inv (&1-a))%( u' % x + (v''-a) % w)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC`(inv (&1-a) * u'):real` THEN EXISTS_TAC`(inv (&1-a) * (v'' - a)):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - a) * u' + inv (&1 - a) * (v'' - a)=inv (&1 - a) * ((u' + v'') - a)`]](*21*)](*20*)](*19*)](*18*)](*17*)](*16*)](*15*)](*14*)](*13*)](*12*)](*11*)](*10*)](*9*)] (*8*)](*7*)](*6*)](*5*)](*4*)](*3*)](*2*);(*1*) SET_TAC[]]);;
let aff_ge_eq_aff_gt_union_aff_ge=
prove(`!(x:real^3) (v:real^3) (w:real^3). ~collinear {x,v,w} ==> aff_ge {x} {v , w} = (aff_gt {x} {v,w}) UNION (aff_ge {x} {v}) UNION (aff_ge {x} {w})`,
REPEAT STRIP_TAC THEN MRESA_TAC th3 [`x:real^3`;`v:real^3`;`w:real^3`] THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GE_1_2) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_1_2) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`]AFF_GE_1_1) THEN MP_TAC(ISPECL[`x:real^3`;`w:real^3`]AFF_GE_1_1) THEN RESA_TAC THEN RESA_TAC THEN ASM_REWRITE_TAC[EXTENSION;UNION;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC THENL[STRIP_TAC THEN MP_TAC(REAL_ARITH`&0<= t2/\ &0<=t3==> (t2= &0)\/ (t3= &0)\/ (&0<t2 /\ &0<t3)`) THEN RESA_TAC THENL[ SUBGOAL_THEN `(?t1' t2'. &0 <= t2' /\ t1' + t2' = &1 /\ t1 % x + &0 % v + t3 % w = t1' % x + t2' % w:real^3)`ASSUME_TAC THENL[ EXISTS_TAC`t1:real` THEN EXISTS_TAC`t3:real` THEN REDUCE_VECTOR_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC; POP_ASSUM MP_TAC THEN SET_TAC[]]; SUBGOAL_THEN `(?t1' t2'. &0 <= t2' /\ t1' + t2' = &1 /\ t1 % x + t2 % v + &0 % w = t1' % x + t2' % v:real^3)`ASSUME_TAC THENL[ EXISTS_TAC`t1:real` THEN EXISTS_TAC`t2:real` THEN REDUCE_VECTOR_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC; POP_ASSUM MP_TAC THEN SET_TAC[]]; SUBGOAL_THEN `(?t1' t2' t3'. &0 < t2' /\ &0 < t3' /\ t1' + t2' + t3' = &1 /\ t1 % x + t2 % v + t3 % w = t1' % x + t2' % v + t3' % w:real^3)`ASSUME_TAC THENL[ EXISTS_TAC`t1:real` THEN EXISTS_TAC`t2:real` THEN EXISTS_TAC`t3:real` THEN REDUCE_VECTOR_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC; POP_ASSUM MP_TAC THEN SET_TAC[]]]; STRIP_TAC THENL[ EXISTS_TAC`t1:real` THEN EXISTS_TAC`t2:real` THEN EXISTS_TAC`t3:real` THEN REDUCE_VECTOR_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC; EXISTS_TAC`t1:real` THEN EXISTS_TAC`t2:real` THEN EXISTS_TAC`&0:real` THEN REDUCE_VECTOR_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC; EXISTS_TAC`t1:real` THEN EXISTS_TAC`&0:real` THEN EXISTS_TAC`t2:real` THEN REDUCE_VECTOR_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC]]);;
let AFFINE_HULL_1=
prove(`!a. affine hull {a} ={u % a| u = &1}`,
SIMP_TAC[AFFINE_HULL_FINITE; FINITE_INSERT; FINITE_RULES] THEN SIMP_TAC[AFFINE_HULL_FINITE_STEP; FINITE_INSERT; FINITE_RULES] THEN REWRITE_TAC[REAL_ARITH `x - y = z:real <=> x = y + z`; VECTOR_ARITH `x - y = z:real^N <=> x = y + z`] THEN REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN SET_TAC[]);;
let aff_ge1_1_subset_aff_ge=
prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. DISJOINT {x} {v,u} /\ ~(x=v1) /\ v1 IN aff_ge {x} {v,u} ==> aff_ge {x} {v1} SUBSET aff_ge {x} {v,u}`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`v1:real^3`;][IN_ELIM_THM;SUBSET] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) =(t1'+ t2'*t1) % x + (t2'* t2) % v + (t2' * t3 ) % u:real^3`] THEN STRIP_TAC THEN EXISTS_TAC`t1' + t2' * t1:real` THEN EXISTS_TAC`t2' * t2:real` THEN EXISTS_TAC`t2' * t3:real` THEN MP_TAC(REAL_ARITH`&0<t2'==> &0<= t2'`) THEN RESA_TAC THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t2:real`] THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t3:real`] THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + t2' * t2 + t2' * t3 = t1'+t2'*(t1+t2+t3)`; REAL_ARITH`A* &1=A`] THEN ASM_TAC THEN REAL_ARITH_TAC);;
let exist_close1_fan=
prove(`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) (v1:real^3) (w1:real^3) a:real. FAN(x,V,E) /\ {v,u} INTER {v1,w1}={} /\ {v1,w1} IN E /\ {v,u} IN E /\ {u,w} IN E /\ (&0< azim x u w v ) /\ (azim x u w v <pi) /\ &0 <a /\ a< &1 /\(aff_gt {x} {v, (&1 - a) % u + a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}) ==> ?h:real. (&0 < h) /\ (!y1:real^3 y2:real^3. y1 IN (aff_ge {x} {v, (&1 - a) % u + a % w} INTER ballnorm_fan x) /\ y2 IN (aff_ge {x} {v1, w1} INTER ballnorm_fan x) ==> h <= dist(y1,y2) ))`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; ` (v1:real^3)`] THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] THEN MRESA_TAC not_collinear_is_properties_fully_surrounded[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`;`a:real`] THEN MATCH_MP_TAC( ISPECL [`aff_ge {(x:real^3)} {(v:real^3), ((&1 - a) % u + a % w:real^3)} INTER ballnorm_fan x`; `aff_ge {(x:real^3)} {(v1:real^3), (w1:real^3)} INTER ballnorm_fan x`] SEPARATE_CLOSED_COMPACT) THEN MP_TAC(ISPECL[`(x:real^3) `;` (v:real^3)`;` ((&1 - a) % u + a % w:real^3)`]closed_aff_ge_ballnorm_fan) THEN RESA_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;` (v1:real^3)`;` (w1:real^3)`]compact_aff_ge_ballnorm_fan) THEN RESA_TAC THEN REMOVE_THEN "EM" MP_TAC THEN FIND_ASSUM MP_TAC `{v1,w1:real^3} IN E` THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;` (v:real^3)`;`((&1 - a) % u + a % w:real^3)`] THEN FIND_ASSUM(MP_TAC)`FAN(x:real^3,V,E)` THEN REWRITE_TAC[FAN;fan7] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(v:real^3)}`;`{(v1:real^3),(w1:real^3)}`]th)) THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] THEN MP_TAC(SET_RULE`(v:real^3) IN V==>(?v'. v' IN V /\ {v} = {v'})`) THEN REDA_TAC THEN MP_TAC(SET_RULE`{(v:real^3),u} INTER {v1,w1}={} ==> {v} INTER {v1,w1}={}`) THEN REDA_TAC THEN REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_1;] THEN STRIP_TAC THEN SUBGOAL_THEN`(aff_ge {x} {v} INTER aff_ge {x} {v1, w1:real^3}) INTER ballnorm_fan x={}` ASSUME_TAC THENL(*1*)[ ASM_REWRITE_TAC[INTER;ballnorm_fan;EXTENSION;IN_ELIM_THM;SET_RULE`(?u. u = &1 /\ x' = u % x)<=> x'= &1 % x`;] THEN REDUCE_VECTOR_TAC THEN GEN_TAC THEN EQ_TAC THENL(*2*)[ STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[DIST_REFL] THEN REAL_ARITH_TAC; SET_TAC[]]; ABBREV_TAC`va=(&1 - a) % u + a % w:real^3` THEN SUBGOAL_THEN `va IN aff_ge {x} {u,w:real^3}` ASSUME_TAC THENL(*2*)[ MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1 -a:real` THEN EXISTS_TAC`a:real` THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC THEN REAL_ARITH_TAC;(*2*) SUBGOAL_THEN`(aff_ge {x} {va} INTER aff_ge {x} {v1, w1:real^3}) SUBSET {x}` ASSUME_TAC THENL(*3*)[ MRESA_TAC th3[` (x:real^3)`;`(v:real^3)`;`(va:real^3)`] THEN MRESA_TAC aff_ge1_1_subset_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`;`va:real^3`] THEN FIND_ASSUM(MP_TAC)`FAN(x:real^3,V,E)` THEN REWRITE_TAC[FAN;fan7] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v1:real^3),(w1:real^3)}`]th)) THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] THEN MP_TAC(SET_RULE`{v,u} INTER {v1,w1}={}==> {u,w} INTER {v1,w1} SUBSET {w:real^3}`) THEN RESA_TAC THEN STRIP_TAC THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v1, w1:real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) THEN REMOVE_ASSUM_TAC THEN DISCH_TAC THEN MP_TAC(SET_RULE`aff_ge {x} {va} SUBSET aff_ge {x} {u, w}/\ aff_ge {x} {u, w} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {w} ==> aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {va} INTER aff_ge {x} {w}`) THEN RESA_TAC THEN MATCH_MP_TAC(SET_RULE` aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {va} INTER aff_ge {x} {w} /\ aff_ge {x} {va} INTER aff_ge {x} {w} SUBSET {x:real^3} ==>aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET {x}`) THEN ASM_REWRITE_TAC[] THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`va:real^3`;][IN_ELIM_THM;SUBSET;INTER] THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`w:real^3`;][IN_ELIM_THM;SUBSET;IN_SING] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN EXPAND_TAC"va" THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % ((&1 - a) % u + a % w) = t1' % x + t2' % w <=> (t2 *(&1 - a)) % u = (t1'-t1) % x + (t2'- t2*a) % w:real^3`] THEN MP_TAC(REAL_ARITH`&0<= t2==> t2= &0 \/ &0 < t2:real`) THEN RES_TAC THENL(*4*)[ FIND_ASSUM MP_TAC`t1+ t2:real= &1` THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN REDUCE_ARITH_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC;(*4*) MP_TAC(REAL_ARITH`a< &1==> &0< &1-a:real`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`t2:real`;`&1- a:real`] THEN MP_TAC(REAL_ARITH` &0< t2*(&1-a)==> ~(t2*(&1-a):real= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`t2*(&1-a):real` THEN MRESA1_TAC REAL_LT_INV`t2*(&1-a):real` THEN STRIP_TAC THEN MP_TAC(SET_RULE`(t2 * (&1 - a)) % u = (t1' - t1) % x + (t2' - t2 * a) % w:real^3 ==> (inv (t2 * (&1 - a)))%((t2 * (&1 - a)) % u ) = (inv (t2 * (&1 - a)))%((t1' - t1) % x + (t2' - t2 * a) % w)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`u IN aff {x,w:real^3}`ASSUME_TAC THENL(*5*)[ REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN EXISTS_TAC`(inv (t2 * (&1 - a)) * (t1' - t1)):real` THEN EXISTS_TAC`(inv (t2 * (&1 - a)) * (t2' - t2 * a)):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t2 * (&1 - a)) * (t1' - t1) + inv (t2 * (&1 - a)) * (t2' - t2 * a) = inv (t2 * (&1 - a)) * ((t1' +t2')- (t1+t2)+ t2*(&1 - a)):real`; REAL_ARITH`&1- &1 + A= A`];(*5*) FIND_ASSUM MP_TAC `~collinear {x, u, w:real^3}` THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN STRIP_TAC THEN MRESA_TAC th3[`x:real^3`;`w:real^3`;`u:real^3`]]];(*3*) SUBGOAL_THEN`(aff_ge {x} {va} INTER aff_ge {x} {v1, w1:real^3}) INTER ballnorm_fan x={}` ASSUME_TAC THENL(*4*)[ ASM_REWRITE_TAC[INTER;ballnorm_fan;EXTENSION;IN_ELIM_THM;] THEN REDUCE_VECTOR_TAC THEN GEN_TAC THEN EQ_TAC THENL(*5*)[ STRIP_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(SET_RULE`x' IN aff_ge {x} {va} /\ x' IN aff_ge {x} {v1, w1} /\ aff_ge {x} {va} INTER aff_ge {x} {v1, w1} SUBSET {x} ==> x' IN {x:real^3}`) THEN REWRITE_TAC[IN_SING] THEN RESA_TAC THEN ASM_REWRITE_TAC[DIST_REFL;] THEN REAL_ARITH_TAC;(*5*) SET_TAC[]]; ASM_TAC THEN SET_TAC[]]]]]);;
let properties_inside_collinear0_fan=
prove(`!(x:real^3) (u:real^3) (w:real^3) a:real. &0 <a /\ a< &1 /\ ~collinear{x,w,u} ==> ~collinear{x,(&1 - a) % u + a % w,u}`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[collinear1_fan] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v % u <=> a % w = u' % x + (v+a- &1) % u`] THEN MP_TAC(REAL_ARITH`&0< a ==> ~(a= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`a:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE` a % w = u' % x + (v+a- &1) % u:real^3 ==> (inv ( a))%(a % w) = (inv (a))%(u' % x + (v+a- &1) % u) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC `(inv a * (u':real))` THEN EXISTS_TAC `(inv a * (v +a - &1 :real))` THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * (u') + inv a * (v +a - &1)=inv a* (a+ (u'+v) - &1)`;REAL_ARITH`t3'+ &1 - &1=t3'`]);;
let properties_inside_collinear1_fan=
prove(`!(x:real^3) (u:real^3) (w:real^3) a:real. &0 <a /\ a< &1 /\ ~collinear{x,w,u} ==> ~collinear{x,(&1 - a) % u + a % w,w}`,
REPEAT STRIP_TAC THEN MRESAL_TAC properties_inside_collinear0_fan[`(x:real^3)`;` (w:real^3)`;`(u:real^3)`;`&1-a:real`][VECTOR_ARITH`(&1 - (&1 - a)) % w + (&1 - a) % u=(&1 - a) % u + a % w`;] THENL[ ASM_TAC THEN REAL_ARITH_TAC; STRIP_TAC THENL[ASM_TAC THEN REAL_ARITH_TAC; ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[]]]);;
let properties1_inside_fan=
prove(`!x:real^3 u:real^3 w:real^3. DISJOINT {x} {u,w} /\ &0<a /\ a< &1 ==> (&1-a)%u+ a%w IN aff_ge {x} {u,w:real^3}`,
REPEAT STRIP_TAC THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1 -a:real` THEN EXISTS_TAC`a:real` THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC THEN REAL_ARITH_TAC);;
let properties_inside_collinear_fan=
prove(`!(x:real^3) (u:real^3) (w:real^3) a:real. &0 <a /\ a< &1 /\ ~collinear{x,u,w} ==> ~collinear{x,(&1 - a) % u + a % w,u} /\ ~collinear{x,(&1 - a) % u + a % w,w}`,
MESON_TAC[SET_RULE`{A,B,C}={A,C,B}`;properties_inside_collinear0_fan;properties_inside_collinear1_fan] );;
let properties_inside_collinear1_fan=
prove(`!x:real^3 u:real^3 w:real^3. ~collinear{x,u,w} /\ &0<a /\ a< &1 ==> aff_ge {x} {u} INTER aff_ge {x} {(&1-a)%u+ a%w,w:real^3} SUBSET aff_ge {x} {}`,
REPEAT STRIP_TAC THEN MRESA_TAC properties_inside_collinear_fan[`(x:real^3)`;`(u:real^3)`;`(w:real^3)`;`a:real`] THEN MRESA_TAC th3[`(x:real^3)`;`((&1-a)%u+ a%w:real^3)`;`(w:real^3)`] THEN MRESA_TAC th3[`(x:real^3)`;`u:real^3`;`(w:real^3)`] THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`(&1-a)%u+ a%w:real^3`;`w:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`u:real^3`][IN_ELIM_THM;INTER;SUBSET;AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_1] THEN REPEAT STRIP_TAC THEN EXISTS_TAC`&1` THEN REDUCE_VECTOR_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN MP_TAC(REAL_ARITH`&0<= t2' /\ &0 <= t3==> (t2'= &0 /\ t3 = &0)\/ (&0< t2' \/ &0 <t3) `) THEN RESA_TAC THENL[REDUCE_ARITH_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC; STRIP_TAC THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % u = t1' % x + t2' % ((&1 - a) % u + a % w) + t3 % w <=> (t2'* a + t3) % w = (t1-t1') % x +( t2-t2' * (&1-a))% u :real^3`] THEN MRESA_TAC REAL_LT_MUL[`t2':real`;`a:real`] THEN MP_TAC(REAL_ARITH` &0< t2'*(a) /\ &0<= t3 ==> &0 < t2'*(a)+t3 /\ ~(t2'*(a)+t3:real= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`t2'*(a)+t3:real` THEN MRESA1_TAC REAL_LT_INV`t2'*(a)+t3:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE`(t2'* a + t3) % w = (t1-t1') % x +( t2-t2' * (&1-a))% u:real^3 ==> (inv (t2' * a+t3))%((t2'* a + t3) % w) = (inv (t2' * a+t3))%( (t1-t1') % x +( t2-t2' * (&1-a))% u)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`w IN aff {x,u:real^3}`ASSUME_TAC THENL[REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN EXISTS_TAC`(inv (t2' * a+t3)) * (t1 - t1'):real` THEN EXISTS_TAC`(inv (t2' * a+t3) * (t2 - t2' *(&1- a))):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t2' * a + t3) * (t1 - t1') + inv (t2' * a + t3) * (t2 - t2' * (&1 - a)) = inv (t2' * a + t3) * ((t2'*a +t3)+(t1 + t2) -(t1'+ t2' +t3) ):real`; REAL_ARITH`A+ &1- &1= A`]; ASM_MESON_TAC[]]; STRIP_TAC THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % u = t1' % x + t2' % ((&1 - a) % u + a % w) + t3 % w <=> (t2'* a + t3) % w = (t1-t1') % x +( t2-t2' * (&1-a))% u :real^3`] THEN MP_TAC(REAL_ARITH`&0<a==> &0<=a`) THEN RESA_TAC THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`a:real`] THEN MP_TAC(REAL_ARITH` &0<= t2'*(a) /\ &0< t3 ==> &0 < t2'*(a)+t3 /\ ~(t2'*(a)+t3:real= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`t2'*(a)+t3:real` THEN MRESA1_TAC REAL_LT_INV`t2'*(a)+t3:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE`(t2'* a + t3) % w = (t1-t1') % x +( t2-t2' * (&1-a))% u:real^3 ==> (inv (t2' * a+t3))%((t2'* a + t3) % w) = (inv (t2' * a+t3))%( (t1-t1') % x +( t2-t2' * (&1-a))% u)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`w IN aff {x,u:real^3}`ASSUME_TAC THENL[ REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN EXISTS_TAC`(inv (t2' * a+t3)) * (t1 - t1'):real` THEN EXISTS_TAC`(inv (t2' * a+t3) * (t2 - t2' *(&1- a))):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t2' * a + t3) * (t1 - t1') + inv (t2' * a + t3) * (t2 - t2' * (&1 - a)) = inv (t2' * a + t3) * ((t2'*a +t3)+(t1 + t2) -(t1'+ t2' +t3) ):real`; REAL_ARITH`A+ &1- &1= A`]; ASM_MESON_TAC[]]]);;
let lemma_proof0_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (w:real^3) (v1:real^3) (w1:real^3) a:real. FAN(x,V,E) /\ {v1,w1} IN E /\ {u,w} IN E /\ ~(u IN {v1,w1}) /\ &0 <a /\ a< &1 ==> (aff_ge {x} {(&1 - a) % u + a % w} INTER aff_ge {x} {v1, w1:real^3}) SUBSET {x}`,
REPEAT STRIP_TAC THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; ` (v1:real^3)`] THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] THEN FIND_ASSUM MP_TAC `{v1,w1:real^3} IN E` THEN ABBREV_TAC`va=(&1 - a) % u + a % w:real^3` THEN MRESA_TAC properties1_inside_fan[`(x:real^3)`;` (u:real^3)`;`(w:real^3)`;] THEN MRESA_TAC properties_inside_collinear_fan[`(x:real^3)`;` (u:real^3)`;`(w:real^3)`;`a:real`] THEN MRESA_TAC th3[` (x:real^3)`;`(va:real^3)`;`(u:real^3)`] THEN MRESA_TAC aff_ge1_1_subset_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`;`va:real^3`] THEN FIND_ASSUM(MP_TAC)`FAN(x:real^3,V,E)` THEN REWRITE_TAC[FAN;fan7] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v1:real^3),(w1:real^3)}`]th)) THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] THEN MP_TAC(SET_RULE`~(u IN {v1,w1})==> {u,w} INTER {v1,w1} SUBSET {w:real^3}`) THEN RESA_TAC THEN STRIP_TAC THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v1, w1:real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) THEN REMOVE_ASSUM_TAC THEN DISCH_TAC THEN MP_TAC(SET_RULE`aff_ge {x} {va} SUBSET aff_ge {x} {u, w}/\ aff_ge {x} {u, w} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {w} ==> aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {va} INTER aff_ge {x} {w}`) THEN RESA_TAC THEN MATCH_MP_TAC(SET_RULE` aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {va} INTER aff_ge {x} {w} /\ aff_ge {x} {va} INTER aff_ge {x} {w} SUBSET {x:real^3} ==>aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET {x}`) THEN ASM_REWRITE_TAC[] THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`va:real^3`;][IN_ELIM_THM;SUBSET;INTER] THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`w:real^3`;][IN_ELIM_THM;SUBSET;IN_SING] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN EXPAND_TAC"va" THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % ((&1 - a) % u + a % w) = t1' % x + t2' % w <=> (t2 *(&1 - a)) % u = (t1'-t1) % x + (t2'- t2*a) % w:real^3`] THEN MP_TAC(REAL_ARITH`&0<= t2==> t2= &0 \/ &0 < t2:real`) THEN RES_TAC THENL(*4*)[ FIND_ASSUM MP_TAC`t1+ t2:real= &1` THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN REDUCE_ARITH_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC; MP_TAC(REAL_ARITH`a< &1==> &0< &1-a:real`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`t2:real`;`&1- a:real`] THEN MP_TAC(REAL_ARITH` &0< t2*(&1-a)==> ~(t2*(&1-a):real= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`t2*(&1-a):real` THEN MRESA1_TAC REAL_LT_INV`t2*(&1-a):real` THEN STRIP_TAC THEN MP_TAC(SET_RULE`(t2 * (&1 - a)) % u = (t1' - t1) % x + (t2' - t2 * a) % w:real^3 ==> (inv (t2 * (&1 - a)))%((t2 * (&1 - a)) % u ) = (inv (t2 * (&1 - a)))%((t1' - t1) % x + (t2' - t2 * a) % w)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`u IN aff {x,w:real^3}`ASSUME_TAC THENL(*5*)[ REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN EXISTS_TAC`(inv (t2 * (&1 - a)) * (t1' - t1)):real` THEN EXISTS_TAC`(inv (t2 * (&1 - a)) * (t2' - t2 * a)):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t2 * (&1 - a)) * (t1' - t1) + inv (t2 * (&1 - a)) * (t2' - t2 * a) = inv (t2 * (&1 - a)) * ((t1' +t2')- (t1+t2)+ t2*(&1 - a)):real`; REAL_ARITH`&1- &1 + A= A`]; FIND_ASSUM MP_TAC `~collinear {x, u, w:real^3}` THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN STRIP_TAC THEN MRESA_TAC th3[`x:real^3`;`w:real^3`;`u:real^3`]]]);;
let lemma_proof1_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (w:real^3) (v1:real^3) (w1:real^3) a:real. FAN(x,V,E) /\ {v1,w1} IN E /\ {u,w} IN E /\ ~(w IN {v1,w1}) /\ &0 <a /\ a< &1 ==> (aff_ge {x} {(&1 - a) % u + a % w} INTER aff_ge {x} {v1, w1:real^3}) SUBSET {x}`,
REPEAT STRIP_TAC THEN MRESAL_TAC lemma_proof0_fan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(w:real^3)`;` (u:real^3)`;`(v1:real^3)`;`(w1:real^3)`;`&1 -a:real`][VECTOR_ARITH`(&1 - (&1 - a)) % w + (&1 - a) % u=(&1 - a) % u + a % w`;] THEN POP_ASSUM MATCH_MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC);;
let GRAPH = 
prove (`!E. graph E <=> !e. e IN E ==> e HAS_SIZE 2`,
REWRITE_TAC[graph; IN]);;
let CARD_2_FAN=
prove(`!v:A w:A. ~(v=w) ==> CARD {v,w}=2`,
REPEAT STRIP_TAC THEN SUBGOAL_THEN`FINITE {v,w:A}`ASSUME_TAC THENL[ SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; IN_INSERT; NOT_IN_EMPTY]; ASSUME_TAC(SET_RULE `v:A IN {v:A,w:A} `) THEN MP_TAC(ISPECL[`v:A`;`{v:A,w:A}`;]CARD_DELETE) THEN RESA_TAC THEN MP_TAC(SET_RULE `v IN {v,w}==>{v:A,w:A} DELETE v PSUBSET {v,w}`) THEN RESA_TAC THEN MP_TAC(ISPECL[`{v:A,w:A} DELETE v`;`{v:A,w:A}`]CARD_PSUBSET) THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN FIND_ASSUM MP_TAC`FINITE {v:A,w:A}` THEN DISCH_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN DISCH_TAC THEN MP_TAC(ARITH_RULE`CARD ({v, w} DELETE v) < CARD {v, w}/\ CARD ({v, w} DELETE v) = CARD {v, w}-1 <=>CARD ({v, w} DELETE v) +1= CARD {v:A, w:A}`) THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) THEN REWRITE_TAC[ARITH_RULE`A=A`] THEN DISCH_TAC THEN SUBGOAL_THEN `w:A IN ({v:A,w:A} DELETE v)` ASSUME_TAC THENL[ ASM_SET_TAC[]; MP_TAC(ISPECL[`{v:A,w:A}`;`v:A`] FINITE_DELETE) THEN RESA_TAC THEN MP_TAC(ISPECL[`w:A`;`{v:A,w:A} DELETE v`;]CARD_DELETE) THEN RESA_TAC THEN MP_TAC(SET_RULE `w IN ({v,w} DELETE v)==>{v:A,w:A} DELETE v DELETE w PSUBSET {v,w} DELETE v`) THEN RESA_TAC THEN MP_TAC(ISPECL[`{v:A,w:A} DELETE v DELETE w`;`{v:A,w:A} DELETE v`]CARD_PSUBSET) THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN FIND_ASSUM MP_TAC`FINITE ({v:A,w:A} DELETE v)` THEN DISCH_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN DISCH_TAC THEN MP_TAC(ARITH_RULE`CARD ({v, w} DELETE v DELETE w) < CARD ({v, w} DELETE v)/\ CARD ({v, w} DELETE v DELETE w) = CARD ({v, w} DELETE v)-1 <=>CARD ({v, w} DELETE v DELETE w) +1= CARD ({v:A, w:A} DELETE v)`) THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) THEN REWRITE_TAC[ARITH_RULE`A=A`] THEN DISCH_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[]) THEN POP_ASSUM (fun th->REWRITE_TAC[]) THEN ASSUME_TAC(SET_RULE `{v, w} DELETE v:A DELETE w:A={}`) THEN POP_ASSUM (fun th->REWRITE_TAC[th;CARD_CLAUSES; ARITH_RULE `0+1=1`]) THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"B") THEN DISCH_TAC THEN REMOVE_THEN "B" MP_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th);ARITH_RULE` 1+1=2`]) THEN SET_TAC[]]]);;
let lemma_proof_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (w:real^3) (v1:real^3) (w1:real^3) a:real. FAN(x,V,E) /\ {v1,w1} IN E /\ {u,w} IN E /\ ~({u,w} = {v1,w1}) /\ &0 <a /\ a< &1 ==> (aff_ge {x} {(&1 - a) % u + a % w} INTER aff_ge {x} {v1, w1:real^3}) SUBSET {x}`,
REPEAT STRIP_TAC THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; ` (v1:real^3)`] THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] THEN MP_TAC(SET_RULE` ~(u=w) /\ ~(v1=w1:real^3)==> ({u,w} = {v1,w1}<=> {u,w} SUBSET {v1,w1})`) THEN ASM_REWRITE_TAC[SET_RULE`~({u,w} SUBSET {v1,w1})<=> ~(w IN {v1,w1})\/ ~( u IN {v1,w1})`] THEN ASM_TAC THEN SET_TAC[lemma_proof0_fan;lemma_proof1_fan]);;
let remark012_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (w:real^3) a:real. FAN(x,V,E) /\ {u,w} IN E /\ &0 <a /\ a< &1 ==> ~((&1 - a) % u + a % w IN V)`,
REPEAT STRIP_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] THEN ABBREV_TAC`v1=(&1 - a) % u + a % w:real^3` THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` THEN REWRITE_TAC[FAN;fan2] THEN STRIP_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(SET_RULE`~(x IN V) /\ v1 IN V==> ~(x=(v1:real^3))`) THEN RESA_TAC THEN MRESA_TAC properties_inside_collinear_fan[`(x:real^3)`;`(u:real^3)`;`(w:real^3)`;`a:real`] THEN MRESA_TAC th3[`(x:real^3)`;`((&1-a)%u+ a%w:real^3)`;`(w:real^3)`] THEN MRESA_TAC th3[`(x:real^3)`;`((&1-a)%u+ a%w:real^3)`;`(u:real^3)`] THEN MP_TAC(SET_RULE`DISJOINT {x, v1} {u}==> ~(v1=u:real^3)`) THEN RESA_TAC THEN MP_TAC(SET_RULE`DISJOINT {x, v1} {w}==> ~(v1=w:real^3)`) THEN RESA_TAC THEN MP_TAC(SET_RULE` ~(v1=w:real^3) /\ ~(v1=u:real^3) ==> {u,w} INTER {v1}={}`) THEN RESA_TAC THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` THEN REWRITE_TAC[FAN;fan7] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(u:real^3),w}`;`({v1:real^3})`]th)) THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] THEN MP_TAC(SET_RULE`(v1:real^3) IN V==>(?v'. v' IN V /\ {v1} = {v'})`) THEN REDA_TAC THEN MRESA_TAC properties1_inside_fan[`(x:real^3)`;` (u:real^3)`;`(w:real^3)`;] THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`u:real^3`; `w:real^3`;`v1:real^3`] THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`((&1 - a) % u + a % w:real^3)`;` (w:real^3)`] THEN MP_TAC(SET_RULE`aff_ge {x} {v1, w} SUBSET aff_ge {x} {u, w}/\ aff_ge {x} {v1, w} = aff_gt {x} {v1, w} UNION aff_ge {x} {v1} UNION aff_ge {x} {w} ==> aff_ge {x} {u, w} INTER aff_ge {x} {v1}=aff_ge {x} {v1:real^3}`) THEN RESA_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`v1 IN aff_ge {x} {v1:real^3}` ASSUME_TAC THENL[MRESAL_TAC AFF_GE_1_1[`x:real^3`;`v1:real^3`;][IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1` THEN REDUCE_VECTOR_TAC THEN REAL_ARITH_TAC; POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_1;SUBSET;IN_SING;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 %A=A`]]);;
let remark01_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (w:real^3) (v1:real^3) (w1:real^3) a:real. FAN(x,V,E) /\ {v1,w1} IN E /\ {u,w} IN E /\ ~({u,w} = {v1,w1}) /\ &0 <a /\ a< &1 ==> ~((&1 - a) % u + a % w IN {v1, w1:real^3})`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w1:real^3`;`v1:real^3`] THEN FIND_ASSUM MP_TAC `{v1,w1:real^3} IN E` THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN STRIP_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v1:real^3`;`w1:real^3`] THEN MRESA_TAC remark012_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`;`a:real`] THEN ASM_TAC THEN SET_TAC[]);;
let remark0_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) e:real^3->bool. FAN(x,V,E)/\ e IN E ==> {x} INTER e={}`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) THEN RESA_TAC THEN REMOVE_THEN "A" MP_TAC THEN RESA_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]);;
let case2_proof_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v,w1} IN E /\ &0 < azim x u w v /\ azim x u w v < pi /\ &0<a /\ a< &1 /\ (&1-a)%u+ a%w=ua /\ ~(ua=w) /\ ~collinear {x,w,ua} /\ (aff_gt {x} {v, ua} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}) ==> (!e. e IN (E DELETE {u,w}) ==> aff_ge {x} e INTER aff_ge {x} {ua,w} = aff_ge {x} (e INTER {ua,w}))`,
REPEAT STRIP_TAC THEN FIND_ASSUM MP_TAC `~collinear {x,w,ua:real^3}` THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN DISCH_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] THEN FIND_ASSUM MP_TAC `e IN E DELETE {u,w:real^3}` THEN REWRITE_TAC[DELETE;IN_ELIM_THM;SET_RULE`~(e={u,w:real^3})<=> ~({u,w:real^3}=e)`] THEN DISCH_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) THEN RESA_TAC THEN MRESA_TAC lemma_proof_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`(w:real^3)`;`(v':real^3)`;`(w':real^3)`;`a:real`] THEN MRESA_TAC remark01_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`(w:real^3)`;`(v':real^3)`;`(w':real^3)`;`a:real`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM(th)]) THEN RESA_TAC THEN RESA_TAC THEN MP_TAC(SET_RULE`~(ua IN e)==> e INTER {ua,w:real^3} SUBSET {w}`) THEN RESA_TAC THEN MRESA_TAC properties1_inside_fan[`(x:real^3)`;` (u:real^3)`;`(w:real^3)`;] THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`u:real^3`; `w:real^3`;`ua:real^3`] THEN MRESA_TAC th3[` (x:real^3)`;`(ua:real^3)`;`(w:real^3)`] THEN MRESA_TAC remark0_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`e:real^3->bool`] THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`e INTER { ua,w:real^3}`;`e:real^3->bool`][DISJOINT;SET_RULE` e INTER {ua,w} SUBSET e`;] THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`e INTER { ua,w:real^3}`;`{ua,w:real^3}`][DISJOINT;SET_RULE` e INTER {ua,w} SUBSET {ua,w:real^3}`;] THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{}:real^3->bool`;`{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w}={} <=> ~(x=w)`;SET_RULE` {} SUBSET {w:real^3}`;] THEN MATCH_MP_TAC(SET_RULE`C SUBSET A /\ C SUBSET B /\ A INTER B SUBSET C==>A INTER B= C`) THEN ASM_REWRITE_TAC[] THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` THEN REWRITE_TAC[FAN;fan7] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(u:real^3),w}`;`(e:real^3->bool)`]th)) THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] THEN DISJ_CASES_TAC(SET_RULE`{u,w:real^3} INTER e= {u,w} \/ ~({u,w} INTER e= {u,w})`) THENL[MP_TAC(SET_RULE`{u,w} INTER e= {u,w:real^3}==> {u,w} SUBSET e`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` ~(u=w:real^3) ==> ({u,w} = {v',w'}<=> {u,w} SUBSET {v',w'})`) THEN RESA_TAC THEN ASM_TAC THEN SET_TAC[]; MP_TAC(SET_RULE` e INTER {ua,w:real^3} SUBSET {w}==> e INTER { ua,w:real^3} = {w} \/ e INTER { ua,w:real^3}= {}`) THEN RESA_TAC THENL[ MP_TAC(SET_RULE`e INTER {ua, w} = {w:real^3}==> w IN e`) THEN RESA_TAC THEN MP_TAC(SET_RULE`~({u, w} INTER e = {u, w:real^3}) ==> {u, w} INTER e PSUBSET {u, w} `) THEN RESA_TAC THEN MP_TAC(SET_RULE`{u, w} INTER e PSUBSET {u, w:real^3} /\ w IN e /\ ~(u=w) ==> {u, w} INTER e SUBSET {w} `) THEN RESA_TAC THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER (e:real^3->bool)`;`{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w}={} <=> ~(x=w)`;SET_RULE` {} SUBSET {w:real^3}`;] 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 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 MP_TAC THEN SET_TAC[]; MP_TAC(SET_RULE`e INTER {ua, w:real^3} = {}==> ~(w IN e)`) THEN RESA_TAC THEN MP_TAC(SET_RULE`~({u, w} INTER e = {u, w:real^3}) ==> {u, w} INTER e PSUBSET {u, w} `) THEN RESA_TAC THEN MP_TAC(SET_RULE`{u, w} INTER e PSUBSET {u, w:real^3} /\ ~(w IN e) ==> {u, w} INTER e SUBSET {u} `) THEN RESA_TAC THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER (e:real^3->bool)`;`{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u}={} <=> ~(x=u)`;SET_RULE` {} SUBSET {w:real^3}`;] THEN STRIP_TAC THEN SUBGOAL_THEN `aff_ge {x} e INTER aff_ge {x} {ua, w} SUBSET aff_ge {x} {u} INTER aff_ge {x} {ua, w:real^3}`ASSUME_TAC THENL[ 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 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 MP_TAC THEN SET_TAC[]; MRESA_TAC properties_inside_collinear1_fan[`x:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]]]]);;
let inequality1_not0_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real a:real. FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d /\ &0<a /\ a < &1 ==> ?(h:real). a <h /\ h<= &1 /\ (!t:real. a <= t /\ t<h ==> (!(s:real). &0 <= s /\ s <= &1 ==> s * inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))* norm( ((&1-a)%u + a %w)-((&1-t)%u+ t%w))< d ))`,
REPEAT STRIP_TAC THEN REWRITE_TAC[VECTOR_ARITH`((&1-a)%u + a %w)-((&1-t)%u+ t%w)=(t-a)%(u-w):real^3`;NORM_MUL] THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`]separate_point_convex_fan) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN EXISTS_TAC`min (a+(h:real)*(d:real) *inv(norm(u-w:real^3))) (&1)` THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] remark1_fan) THEN RESA_TAC THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_gl_zero_fan) THEN RESA_TAC THEN MP_TAC(ISPECL[`(h:real)*(d:real)`;`inv(norm(u-w:real^3))`] REAL_LT_MUL) THEN RESA_TAC THEN STRIP_TAC THENL[ MP_TAC(ISPECL[`h:real`;`d:real`] REAL_LT_MUL) THEN RESA_TAC THEN ASM_TAC THEN REAL_ARITH_TAC; STRIP_TAC THENL[ REAL_ARITH_TAC; REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0 <(h:real)==> ~(h= &0)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(h:real)`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`(t:real)< min (a+(h:real) * (d:real) * inv (norm (u - w:real^3))) (&1)/\ min (a+h * d * inv (norm (u - w))) (&1)<= &1 /\ &0 <a /\ a <= t ==> &0 <= t /\ t <= &1 /\ &0 <= t-a /\ t - a<= &1/\ (t:real)-a < (h * d * inv (norm (u - w:real^3)))`) THEN ASM_REWRITE_TAC[REAL_ARITH`min (a+h * d * inv (norm (u - w))) (&1)<= &1`] THEN STRIP_TAC THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) THEN RESA_TAC THEN REMOVE_THEN "A"(fun th -> MP_TAC(ISPEC`(&1-s)%v+s%((&1-t)%u+ t%w):real^3`th)) THEN RESA_TAC THEN MP_TAC(ISPECL[`h:real`;`norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`]REAL_LT_INV2) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0 <h /\ (h:real)< norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)==> &0 <= norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`) THEN RESA_TAC THEN MP_TAC(ISPEC`norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`REAL_LE_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`t-a:real`REAL_ABS_REFL) THEN RESP_TAC THEN MP_TAC(ISPECL[`inv(norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))`; `inv(h:real)`;`t:real-a`;`(h * d * inv (norm (u - w:real^3)))`;]REAL_LT_MUL2) THEN RESA_TAC THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_not_zero_fan) THEN RESA_TAC THEN MP_TAC(ISPEC`(norm(u-w:real^3))`REAL_MUL_LINV) THEN RESA_TAC THEN ASSUME_TAC(ISPEC`u-w:real^3`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(&0 =norm(u-w:real^3)) /\ &0 <= norm(u-w:real^3)==> &0 <norm(u-w:real^3)`) THEN RESA_TAC THEN MP_TAC(ISPECL[`inv (norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)) * (t:real-a)`;`inv (h:real) * h * d * inv (norm (u - w:real^3))`;`norm (u - w:real^3)`]REAL_LT_RMUL) THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B*C*D)*E=(A*B)*C*(D*E)`] THEN REDUCE_ARITH_TAC THEN STRIP_TAC THEN MP_TAC(ISPECL[`inv (norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))`;`(t:real-a)`;] REAL_LE_MUL) THEN RESA_TAC THEN MP_TAC(ISPECL[`inv (norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))*(t-a:real)`;`norm(u-w:real^3)`] REAL_LE_MUL) THEN RESA_TAC THEN DISJ_CASES_TAC(REAL_ARITH`(s= &1) \/ ~((s:real)= &1)`) THENL[ POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN REDUCE_ARITH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`A*B*C=(A*B)*C:real`;VECTOR_ARITH`(&1 - s) % v + s % ((&1 - t) % u + t % w) - x=((&1 - s) % v + s % ((&1 - t) % u + t % w))- x :real^3`]; MP_TAC(REAL_ARITH`~(s= &1) /\ s<= &1==> (s:real)< &1`) THEN RESA_TAC THEN MP_TAC(ISPECL[`s:real`;`&1`;`(inv (norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))*(t-a:real)) * norm(u-w:real^3)`; `d:real`]REAL_LT_MUL2) THEN REDUCE_ARITH_TAC THEN RESA_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`A*d*B*C=A*(d*B)*C:real`;VECTOR_ARITH`(&1 - s) % v + s % ((&1 - t) % u + t % w) - x=((&1 - s) % v + s % ((&1 - t) % u + t % w))- x :real^3`]]]]);;
let bounded_convex1_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) w:real^3. FAN(x,V,E) /\ {v,u} IN E /\ {u,w} IN E ==> ?(h:real). &0< h /\ (!(y:real^3). y IN convex hull{v,u,w} ==> norm(y-x)<h )`,
REPEAT STRIP_TAC THEN SUBGOAL_THEN `FINITE {(v:real^3),(u:real^3),w}` ASSUME_TAC THENL(*1*)[ SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; IN_INSERT; NOT_IN_EMPTY]; MP_TAC(ISPEC`{(v:real^3),(u:real^3),w}`FINITE_IMP_COMPACT_CONVEX_HULL) THEN POP_ASSUM (fun th-> REWRITE_TAC[th;]) THEN DISCH_TAC THEN ASSUME_TAC(ISPEC`x:real^3` norm_origin_fan ) THEN ASSUME_TAC(SET_RULE`convex hull {(v:real^3), u,w} SUBSET (:real^3)`) THEN MP_TAC(ISPECL[`(\(y:real^3). lift(norm(y-x:real^3)))`;`(:real^3)`;`convex hull {(v:real^3),(u:real^3),w}`]CONTINUOUS_ON_SUBSET) THEN RESA_TAC THEN MP_TAC(ISPECL[`(\(y:real^3). lift(norm(y-x:real^3)))`;`convex hull {(v:real^3),(u:real^3),w}`]COMPACT_CONTINUOUS_IMAGE) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[COMPACT_EQ_BOUNDED_CLOSED;bounded;IMAGE;IN_ELIM_THM] THEN ONCE_REWRITE_TAC[TAUT`A/\B<=>B/\A`;] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN SUBGOAL_THEN `(?x':real^3. x' IN convex hull {v, u,w} /\ lift (norm (v - x:real^3)) = lift (norm (x' - x)))`ASSUME_TAC THENL[ EXISTS_TAC`v:real^3` THEN SIMP_TAC[CONVEX_HULL_3; IN_ELIM_THM;] THEN EXISTS_TAC`&1` THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&0` THEN REDUCE_VECTOR_TAC THEN REAL_ARITH_TAC; SUBGOAL_THEN `&0< (a:real)` ASSUME_TAC THENL[ REMOVE_THEN "A" (fun th-> MP_TAC(ISPEC`lift (norm (v - (x:real^3)))`th)) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[NORM_LIFT;REAL_ABS_NORM ] THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] remark1_fan) THEN RESA_TAC THEN MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_not_zero_fan) THEN RESA_TAC THEN ASSUME_TAC(ISPEC`v-x:real^3`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(&0 =norm(v-x:real^3)) /\ &0 <= norm(v-x:real^3)==> &0 <norm(v-x:real^3)`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; EXISTS_TAC`&2 * a:real` THEN STRIP_TAC THENL[ REPEAT STRIP_TAC THEN SUBGOAL_THEN `(?x':real^3. x' IN convex hull {v, u,w} /\ lift (norm (y - x:real^3)) = lift (norm (x' - x)))`ASSUME_TAC THENL[ EXISTS_TAC`y:real^3` THEN ASM_SIMP_TAC[]; REMOVE_THEN "A"(fun th-> MP_TAC(ISPEC`lift (norm (y - x:real^3))`th)) THEN ASM_REWRITE_TAC[NORM_LIFT;REAL_ABS_NORM ] THEN ASM_TAC THEN REAL_ARITH_TAC]; ASM_TAC THEN REAL_ARITH_TAC]]]]);;
let inequaility2_not0_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real a:real. FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d /\ &0 <a /\ a< &1 ==> ?(h:real). a <h /\ h<= &1 /\ (!t:real. a <= t /\ t<h ==> (!(s:real). &0 <= s /\ s <= &1 ==> (norm(inv(norm((&1-s)%v+s%((&1-a)%u+ a%w)-x))%((&1-s)%v+s%((&1-a)%u+ a%w)-x) - inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))% ((&1-s)%v+s%((&1-a)%u+ a%w)-x)))< d ))`,
REWRITE_TAC[VECTOR_ARITH`A%B-C%B=(A-C)%B`;NORM_MUL] THEN REPEAT STRIP_TAC THEN REWRITE_TAC[VECTOR_ARITH`u-((&1-t)%u+ t%w)=t%(u-w):real^3`;NORM_MUL] THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`]separate_point_convex_fan) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`]origin_point_not_in_convex_fan) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"B") THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`w:real^3`]bounded_convex1_fan) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"C") THEN EXISTS_TAC`min (a+h*h*(inv (h'))* inv(norm(u-w:real^3))*d:real) (&1)` THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] remark1_fan) THEN RESA_TAC THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_not_zero_fan) THEN RESA_TAC THEN ASSUME_TAC(ISPEC`u-w:real^3`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(&0 =norm(u-w:real^3)) /\ &0 <= norm(u-w:real^3)==> &0 <norm(u-w:real^3)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(norm(u-w:real^3))`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0 <(h:real)==> ~(h= &0)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(h:real)`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0 <(h':real)==> ~(h'= &0)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(h':real)`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(ISPEC`norm (u-w:real^3)`REAL_LE_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`norm (u-w:real^3)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`(h:real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0 <inv (h:real)==> &0 <= inv(h)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(h':real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0 <inv (h':real)==> &0 <= inv(h')`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0 <a /\ a< &1==> &0 <= a/\ a <= &1`) THEN RESA_TAC THEN STRIP_TAC THENL(*1*)[ MP_TAC(ISPECL[`(h:real)`;`inv (h':real) `]REAL_LT_MUL) THEN RESA_TAC THEN MP_TAC(ISPECL[`(h:real)`;`(h:real)*inv (h':real) `]REAL_LT_MUL) THEN RESA_TAC THEN MP_TAC(ISPECL[`(h:real)*(h:real)*inv (h':real)`;`inv(norm(u-w:real^3))`]REAL_LT_MUL) THEN RESA_TAC THEN MP_TAC(ISPECL[`(h:real)*(h:real)*inv (h':real) *inv(norm(u-w:real^3))`;`d:real`]REAL_LT_MUL) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC`a:real < &1 ` THEN REAL_ARITH_TAC;(*1*) STRIP_TAC THENL(*2*)[ REAL_ARITH_TAC;(*2*) REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3)`;`w:real^3`;`a:real`;` s:real`]expansion_convex_fan) THEN RESA_TAC THEN REMOVE_THEN "C"(fun th->MP_TAC(ISPEC`(&1 - s) % v + s % ((&1 - a) % u + a % w):real^3`th)) THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] THEN RESA_TAC THEN SUBGOAL_THEN`~(x=(&1 - s) % v + s % ((&1 - a) % u + a % w):real^3)` ASSUME_TAC THENL(*3*)[ ASM_TAC THEN SET_TAC[];(*3*) MP_TAC(ISPECL[`(&1 - s) % v + s % ((&1 - a) % u + a % w):real^3`;`x:real^3`]imp_norm_not_zero_fan) THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] THEN RESA_TAC THEN ASSUME_TAC(ISPEC`(&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)= &0) /\ &0 <= norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)==> &0 <norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3))`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(ISPEC`(norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3))`REAL_LE_INV) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`(t:real)< min (a+h * h * inv h' * inv (norm (u - w)) * d) (&1)/\ min (a+h * h * inv h' * inv (norm (u - w)) * d) (&1)<= &1 /\ &0<a /\ a<=t ==> &0<= t-a /\ &0<= t /\ t<= &1/\ (t:real)-a< (h * h * inv h' * inv (norm (u - w:real^3)) * d) `) THEN ASM_REWRITE_TAC[REAL_ARITH`min (a+h * h * inv h' * inv (norm (u - w:real^3)) * d) (&1)<= &1`] THEN STRIP_TAC THEN MP_TAC(ISPECL[`norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3) `; `(h':real)`;`t-a:real`;`(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) THEN RESA_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &0/\ &0<= &1`] THEN USE_THEN "A" (fun th-> MP_TAC(ISPEC`((&1 - s) % v + s % ((&1 - a) % u + a % w):real^3)`th)) THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(ISPECL[`h:real`;`norm ((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)`]REAL_LT_INV2) THEN RESA_TAC THEN MP_TAC(ISPECL[`norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)`;`t-a:real`]REAL_LE_MUL) THEN RESA_TAC THEN MP_TAC(ISPECL[`inv(norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3))`;`inv(h:real)`;`norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3)*(t:real-a)`;`(h':real)*(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) THEN RESA_TAC THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN USE_THEN "A" (fun th-> MP_TAC(ISPEC`(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3`th)) THEN POP_ASSUM(fun th-> REWRITE_TAC[th; VECTOR_ARITH`(A+B)-C=A+B-C:real^3`]) THEN DISCH_TAC THEN MP_TAC(ISPECL[`h:real`;`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`]REAL_LT_INV2) THEN RESA_TAC THEN MP_TAC(ISPECL[`inv(norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3))`;`norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)*(t-a:real)`]REAL_LE_MUL) THEN RESA_TAC THEN ASSUME_TAC(ISPEC`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`NORM_POS_LE) THEN MP_TAC(ISPEC`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`REAL_LE_INV) THEN RESA_TAC THEN MP_TAC(ISPECL[`inv(norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3))`;`inv(h:real)`;`inv(norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3)) * norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3)*(t-a:real)`;`inv(h:real)*(h':real)*(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) THEN RESA_TAC THEN MP_TAC(ISPECL[`norm (u - w:real^3)`; `inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)) * inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) * norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) * (t-a)`;`inv h * inv h * h' * h * h * inv h' * inv (norm (u - w:real^3)) * d`;]REAL_LT_LMUL) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(B*C)*E*A*D`] THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*E*(C*D)`] THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*E*(C*D)`] THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D=(A*B)*C*D`] THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*(C*D)*E`] THEN ONCE_REWRITE_TAC[REAL_ARITH`(A*B*C)*D*E=A*B*(C*D)*E`] THEN ASM_REWRITE_TAC[] THEN REDUCE_ARITH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B*C)*D=A*B*(C*D)`] THEN REDUCE_ARITH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`((A*B)*C*D)*E=(A*C)*(B*D)*E`] THEN REDUCE_ARITH_TAC THEN REWRITE_TAC[REAL_ARITH`((A*B)*C)*D*E=(A*B)*(C*D)*E`] THEN ASSUME_TAC(ISPECL[`u:real^3`;`w:real^3`]NORM_SUB) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN MP_TAC(ISPECL[`t-a:real`;`w-u:real^3`]NORM_MUL) THEN MP_TAC(ISPEC`t-a:real`REAL_ABS_REFL) THEN RESP_TAC THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C*D=C*A*(B*D)`] THEN REDUCE_ARITH_TAC THEN DISCH_THEN(LABEL_TAC"BA") THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) THEN RESA_TAC THEN SUBGOAL_THEN`~(x=(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3)` ASSUME_TAC THENL(*4*)[ POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"MA") THEN STRIP_TAC THEN REMOVE_THEN"MA" MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN ASM_REWRITE_TAC[];(*4*) MP_TAC(ISPECL[`(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3`;`x:real^3`]imp_norm_not_zero_fan) THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] THEN RESA_TAC THEN MP_TAC(ISPECL[`norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)`;`norm((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`]REAL_SUB_INV) THEN RESP_TAC THEN ASM_REWRITE_TAC[REAL_ABS_ABS;REAL_ABS_DIV;REAL_ABS_MUL;REAL_ABS_NORM;real_div;REAL_INV_MUL; REAL_ARITH`(A*B*C)*D=A*C*(B*D)`] THEN REDUCE_ARITH_TAC THEN MP_TAC(ISPECL[`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`;`((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)`]REAL_ABS_SUB_NORM) THEN REWRITE_TAC[VECTOR_ARITH` ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)-((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)=s%(t-a)%(w-u) :real^3`] THEN ONCE_REWRITE_TAC[NORM_MUL] THEN MP_TAC(ISPEC`s:real`REAL_ABS_REFL) THEN RESP_TAC THEN DISCH_TAC THEN MP_TAC(ISPECL[`abs (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3) - norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x))`;`s * norm ((t-a) % (w - u):real^3)`;`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`]REAL_LE_RMUL) THEN RESA_TAC THEN REMOVE_THEN "BA" MP_TAC THEN POP_ASSUM MP_TAC THEN DISJ_CASES_TAC(REAL_ARITH`(s= &1)\/ ~((s:real) = &1)`) THENL(*5*)[ ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC;(*5*) MP_TAC(REAL_ARITH`~(s= &1) /\ s<= &1==> (s:real)< &1`) THEN RESA_TAC THEN ASSUME_TAC(ISPEC`((t-a) % (w - u):real^3)`NORM_POS_LE) THEN MP_TAC(ISPECL[`norm ((t-a) % (w - u):real^3)`;`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`]REAL_LE_MUL) THEN RESA_TAC THEN REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`s:real`;`&1`;`norm ((t-a) % (w - u)) * inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`; `d:real`]REAL_LT_MUL2) THEN REDUCE_ARITH_TAC THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]]]]);;
let exists_point_small_edges_not0_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real a:real. FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d /\ &0 <a /\ a< &1 ==> ?(h:real). a <h /\ h<= &1 /\ (!t:real. a <= t /\ t<h ==> (!(s:real). &0 <= s /\ s <= &1 ==> norm(inv(norm((&1-s)%v+s%((&1-a)%u+ a%w)-x))%((&1-s)%v+s%((&1-a)%u+ a%w)-x) - inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))% ((&1-s)%v+s%((&1-t)%u+ t%w)-x))< d ))`,
REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0< (d:real)==> &0< d/ &2`) THEN RESA_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`]origin_point_not_in_convex_fan) THEN RESA_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`;` (d:real)/ &2`;`a:real`]inequaility2_not0_fan) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool) `;`(v:real^3)`;` (u:real^3)`;` (w:real^3)`;` (d:real)/ &2`;`a:real`]inequality1_not0_fan) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"B") THEN EXISTS_TAC`min (h:real) (h':real)` THEN STRIP_TAC THENL[ASM_TAC THEN REAL_ARITH_TAC; STRIP_TAC THENL[ ASM_TAC THEN REAL_ARITH_TAC; REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`t< min (h:real) (h':real)==> t< (h:real) /\ t< (h':real)`) THEN RESA_TAC THEN REMOVE_THEN"B" (fun th-> MP_TAC(ISPEC`t:real`th)) THEN RESA_TAC THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"B") THEN REMOVE_THEN"A" (fun th-> MP_TAC(ISPEC`t:real`th)) THEN RESA_TAC THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN ASSUME_TAC(ISPEC`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`NORM_POS_LE) THEN MP_TAC(ISPEC`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`REAL_LE_INV) THEN RESA_TAC THEN MP_TAC(ISPECL[`s * inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)):real`;`(((&1 - a) % u + a % w) - ((&1 - t) % u + t % w)):real^3`]NORM_MUL) THEN REWRITE_TAC[REAL_ABS_MUL] THEN MP_TAC(ISPEC`s:real`REAL_ABS_REFL) THEN RESP_TAC THEN MP_TAC(ISPEC`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)):real`REAL_ABS_REFL) THEN RESP_TAC THEN REWRITE_TAC[REAL_ARITH`(A*B)*C=A*B*C`] THEN DISCH_TAC THEN REMOVE_THEN"B"MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN REWRITE_TAC[VECTOR_ARITH`(s * inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x))) % (((&1 - a) % u + a % w) - ((&1 - t) % u + t % w))= inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3`] THEN DISCH_TAC THEN MP_TAC(ISPECL[`norm(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)`;`(d:real)/ &2`; `norm (inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) - inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x):real^3)`;`(d:real)/ &2`; ]REAL_LT_ADD2) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`d / &2 + d/ &2 = d`] THEN MP_TAC(ISPECL[`(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)`; `(inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) - inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x):real^3)`]NORM_TRIANGLE) THEN REWRITE_TAC[VECTOR_ARITH`(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)+ (inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) - inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x):real^3)=(inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) - inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) `] THEN REAL_ARITH_TAC]]);;
(*********************************)
let separate1_sphere_not0_fan=
prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) (v1:real^3) (u1:real^3) a:real. FAN(x,V,E) /\ {v,u} INTER {v1,u1}={} /\ {v,u} IN E/\ {u,w} IN E /\ {v1,u1} IN E /\ ~(coplanar{x,v,u,w}) /\ (&0< azim x u w v ) /\ (azim x u w v <pi) /\ &0 < a /\ a < &1 /\ aff_gt {x} {v, (&1 - a) % u + a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {} ==> ?h:real. (a < h) /\ (h<= &1) /\ (!t:real. a<t /\ t<h ==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge {x} {v1, u1} INTER ballnorm_fan x={})`,
REPEAT STRIP_TAC THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN MRESA_TAC exist_close1_fan[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`w:real^3`;`(v1:real^3)`;` (u1:real^3)`;`a:real`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"THA") THEN MRESA_TAC not_collinear_is_properties_fully_surrounded[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`;] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A" ) THEN MRESA_TAC exists_point_small_edges_not0_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3)`;`(u:real^3) `;`(w:real^3)`;`h:real`;`a:real`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"B" ) THEN EXISTS_TAC`min (a+((h'-a:real)/ &2)) (&1:real)` THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*1*)[ MP_TAC(REAL_ARITH`a< h':real==> &0< (h'-a)/ &2`) THEN ASM_REWRITE_TAC[] THEN FIND_ASSUM MP_TAC`a:real< &1` THEN REAL_ARITH_TAC;(*1*) STRIP_TAC THENL(*2*)[ ASM_TAC THEN REAL_ARITH_TAC;(*2*) REPEAT STRIP_TAC THEN REWRITE_TAC[EXTENSION] THEN GEN_TAC THEN EQ_TAC THENL(*3*)[ STRIP_TAC THEN REWRITE_TAC[EMPTY;IN_ELIM_THM] THEN SUBGOAL_THEN `!y1:real^3. y1 IN aff_gt {x} {v, (&1-t)%u+(t:real)% (w:real^3)} INTER ballnorm_fan x ==> ?y2:real^3. y2 IN aff_ge {x:real^3} {(v:real^3), ((&1 - a) % u + a % w:real^3)} INTER ballnorm_fan x /\ dist (y1,y2)<(h:real)` ASSUME_TAC THENL(*4*)[ MP_TAC(REAL_ARITH`&0<a /\ a < &1 /\ a <(t:real)/\ a< h' /\ t < min (a+(h'-a:real)/ &2) (&1:real)==> &0<t /\ t< &1 /\ &0 <= t /\ t<= &1 /\ t< h'/\ &0<=a /\ a<= &1/\ a<=t`) THEN RESA_TAC THEN USE_THEN"A" (fun th-> MP_TAC(ISPEC`a:real`th)) THEN REMOVE_THEN"A" (fun th-> MP_TAC(ISPEC`t:real`th)) THEN RESA_TAC THEN RESA_TAC THEN REPEAT STRIP_TAC THEN MRESA_TAC same_projective_sphere_gt_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3)`;`(u:real^3) `;`(w:real^3)`;` (t:real) `;`(y1:real^3)`] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] THEN MRESA_TAC AFF_GE_1_2[`(x:real^3)` ;` (v:real^3)`;`((&1 - a) % u + a % w:real^3) `;] THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;dist] THEN MRESA_TAC expansion_convex_fan[`(v:real^3)`;` (u:real^3)`;`w:real^3`;`a:real`;` s:real`;] THEN MRESA_TAC origin_point_not_in_convex_fan[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`w:real^3`] THEN SUBGOAL_THEN`~(x=(&1-s)%v+s%((&1 - a) % u + a % w):real^3)` ASSUME_TAC THENL(*5*)[ POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN RESA_TAC;(*5*) MP_TAC(ISPECL[`x:real^3`;`(&1 - s) % v + s % ((&1 - a) % u + a % w):real^3`]imp_norm_not_zero_fan) THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] THEN RESA_TAC THEN ASSUME_TAC(ISPEC`(&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(&0 =norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)) /\ &0 <= norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)==> &0 <norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3))`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(ISPEC`(norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3))`REAL_LE_INV) THEN RESA_TAC THEN EXISTS_TAC`inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) +x:real^3` THEN STRIP_TAC THENL(*6*)[ STRIP_TAC THENL(*7*)[ EXISTS_TAC`&1 - inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3)) ` THEN EXISTS_TAC`inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3)) * (&1 - s)` THEN EXISTS_TAC`inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3)) * (s)` THEN REWRITE_TAC[VECTOR_ARITH`A%(B%C + a%b-c)+c=(&1-A)%c+(A*B)%C+(A*a)%b:real^3`] THEN ASM_REWRITE_TAC[REAL_ARITH`&1-A+A*(&1-C)+A*C= &1`] THEN STRIP_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC;(*7*) REWRITE_TAC[ballnorm_fan;IN_ELIM_THM;dist;VECTOR_ARITH`A-(B+A)=(--B):real^3`;NORM_NEG;NORM_MUL] THEN MP_TAC(ISPEC`inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3))`REAL_ABS_REFL) THEN RESP_TAC THEN ASM_REWRITE_TAC[]](*7*);(*6*) ASM_REWRITE_TAC[VECTOR_ARITH`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x) + x - (inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) + x)= inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x) - (inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) ):real^3`] THEN REMOVE_THEN "B" (fun th-> MP_TAC(ISPEC`t:real`th)) THEN RESA_TAC THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) THEN RESA_TAC THEN ASM_REWRITE_TAC[NORM_SUB]](*6*)](*5*);(*4*) POP_ASSUM (fun th->MP_TAC(ISPEC`x':real^3`th)) THEN MP_TAC(SET_RULE` x' IN aff_gt {x} {v, (&1 - t) % u + t % w} INTER aff_ge {x} {v1, u1} INTER ballnorm_fan x ==> x' IN aff_ge {x} {v1, u1:real^3} INTER ballnorm_fan x /\ x' IN aff_gt {x} {v, (&1 - t) % u + t % w:real^3} INTER ballnorm_fan x`) THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN SIMP_TAC[] THEN REPEAT STRIP_TAC THEN REMOVE_THEN "THA" (fun th-> MP_TAC(ISPECL[`y2:real^3`;`x':real^3`]th)) THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN SIMP_TAC[dist;NORM_SUB] THEN REAL_ARITH_TAC](*4*);(*3*) SET_TAC[]]]]);;
let fan_run_in_small11_not0_is_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 v1:real^3 u1:real^3 a:real. FAN(x,V,E) /\ {v,u} INTER {v1,u1}={} /\ {v,u} IN E/\ {u,w} IN E /\ {v1,u1} IN E /\ ~(coplanar{x,v,u,w}) /\ (&0< azim x u w v ) /\ (azim x u w v <pi) /\ &0 < a /\ a < &1 /\ aff_gt {x} {v, (&1 - a) % u + a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {} ==> ?t1:real. a < t1 /\ t1 <= &1 /\ (!t:real. a< t /\ t< t1 ==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v1,u1}={})`,
REPEAT STRIP_TAC THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u1:real^3)`; ` (v1:real^3)`] THEN MRESA_TAC not_collinear_is_properties_fully_surrounded[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`;] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"BA") THEN MRESA_TAC separate1_sphere_not0_fan[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3)`;` (w:real^3)`;` (v1:real^3)`;`(u1:real^3)`;`a:real`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH` a < &1 /\ a < h ==> a < min (h:real) (&1:real)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH` h <= &1==> min (h:real) (&1:real)<= &1`) THEN RESA_TAC THEN EXISTS_TAC`min (h:real) (&1:real)` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH` &0< a /\ a < t /\ t< min (h:real) (&1:real)==> t< h /\ t<= &1 /\ &0 <= t/\ &0<t /\ t< &1`) THEN RESA_TAC THEN REMOVE_THEN "A"(fun th-> MRESA1_TAC th `(t:real)`) THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN REMOVE_THEN "BA"(fun th-> MRESA1_TAC th `(t:real)`) THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] THEN MRESA_TAC origin_is_not_aff_gt_fan[`x:real^3`;`v:real^3`;`(&1-t)%u+t%w:real^3`] THEN REWRITE_TAC[EXTENSION;INTER;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC THENL[ REPEAT STRIP_TAC THEN SUBGOAL_THEN`~(x=x':real^3)`ASSUME_TAC THENL[ POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; MRESA_TAC imp_norm_not_zero_fan[`x':real^3`;`x:real^3`] THEN ASSUME_TAC(ISPEC`x'-x:real^3`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(norm(x'-x:real^3)= &0) /\ &0 <= norm(x'-x:real^3)==> &0 <norm(x'-x:real^3)`) THEN RESA_TAC THEN MRESA1_TAC REAL_LE_INV `norm(x'-x:real^3)` THEN MRESA1_TAC REAL_LT_INV `norm(x'-x:real^3)` THEN MRESA1_TAC REAL_MUL_LINV `norm(x'-x:real^3)` THEN MRESA_TAC scale_aff_ge_fan[`x:real^3`;`v1:real^3`;`u1:real^3`] THEN POP_ASSUM(fun th -> MRESA_TAC th [`x':real^3`;`inv(norm(x'-x:real^3))`]) THEN MRESA_TAC scale_aff_gt_fan[`x:real^3`;`v:real^3`;`(&1-t)%u+t%w:real^3`] THEN POP_ASSUM(fun th -> MRESA_TAC th [`x':real^3`;`inv(norm(x'-x:real^3))`]) THEN SUBGOAL_THEN`inv (norm (x' - x)) % (x' - x) + x IN ballnorm_fan x:real^3->bool` ASSUME_TAC THENL[ MRESA1_TAC REAL_ABS_REFL `inv(norm(x'-x:real^3))` THEN ASM_REWRITE_TAC[ballnorm_fan;IN_ELIM_THM;dist;VECTOR_ARITH`B-(A+B)= --A:real^3`;NORM_NEG;NORM_MUL]; ASM_TAC THEN SET_TAC[]]]; SET_TAC[]]);;
let fan_run_in_small1_not0_is_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 v1:real^3 u1:real^3 a:real. FAN(x,V,E) /\ {v,u} INTER {v1,u1}={} /\ {v,u} IN E/\ {u,w} IN E /\ {v1,u1} IN E /\ ~(coplanar{x,v,u,w}) /\ (&0< azim x u w v ) /\ (azim x u w v <pi) /\ &0 < a /\ a < &1 /\ aff_gt {x} {v, (&1 - a) % u + a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {} /\ (!s. &0 < s /\ s < a ==> aff_gt {x} {v, (&1 - s) % u + s % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}) ==> (?t1:real. a < t1 /\ t1 <= &1 /\ (!t:real. &0< t /\ t< t1 ==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v1,u1}={}))`,
REPEAT STRIP_TAC THEN MRESA_TAC fan_run_in_small11_not0_is_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`;`v1:real^3`;`u1:real^3`;`a:real`] THEN EXISTS_TAC`t1:real` THEN ASM_REWRITE_TAC[] THEN GEN_TAC THEN MP_TAC(REAL_ARITH`&0<a /\ a< t1==>((&0<t /\ t<t1) <=> (&0<t /\ t<a)\/ t=a \/ (a<t/\ t<t1:real))`) THEN RESA_TAC THEN STRIP_TAC THEN ASM_TAC THEN SET_TAC[]);;
let fan_run_in_small2_not0_is_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 w1:real^3 a:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v,w1} IN E /\ ~coplanar {x,v,u,w} /\ (&0< azim x u w v ) /\ (azim x u w v <pi) /\ &0 <a /\ a< &1 /\(aff_gt {x} {v, (&1 - a) % u + a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}) /\ (!s. &0 < s /\ s < a ==> aff_gt {x} {v, (&1 - s) % u + s % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}) ==> ?t1. a < t1 /\ t1<= &1 /\ (!t:real. &0< t /\ t< t1==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v,w1}={})`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"MAI MAI") THEN DISCH_THEN(LABEL_TAC"YEU EM") THEN MRESA_TAC not_collinear_is_properties_fully_surrounded[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`;] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN DISJ_CASES_TAC(SET_RULE`(?h:real. a<h /\ h<= &1/\ azim x v u w1=azim x v u ((&1-h)%u+h%w:real^3))\/ ~(?h:real. a<h /\ h<= &1 /\ azim x v u ((&1-h)%u+h%w:real^3)=azim x v u w1)`) THENL(*1*)[ POP_ASSUM MP_TAC THEN STRIP_TAC THEN EXISTS_TAC`(h:real)` THEN STRIP_TAC THENL(*2*)[ ASM_TAC THEN REAL_ARITH_TAC;(*2*) STRIP_TAC THENL(*3*)[ ASM_TAC THEN REAL_ARITH_TAC;(*3*) REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0<t:real==> &0<=t`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`(t:real)< (h:real) /\ h <= &1 ==> t < &1`) THEN RESA_TAC THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; ` (v:real^3)`] THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM;] THEN GEN_TAC THEN EQ_TAC THENL(*4*)[ DISCH_TAC THEN SUBGOAL_THEN `(&1-t)%u+t%w IN aff_ge {x,v} {w1}:real^3->bool` ASSUME_TAC THENL(*5*)[ POP_ASSUM MP_TAC THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = t1'' % x + t2' % v + t3' % w1<=> t3 % ((&1 - t) % u + t % w) = (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3`] THEN MP_TAC(REAL_ARITH`&0<t3:real==> ~(t3= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`(t3:real)` THEN STRIP_TAC THEN MP_TAC(SET_RULE` t3 % ((&1 - t) % u + t % w) = (t1'-t1) % x + (t2'-t2) % v + t3' % w1:real^3 ==> (inv (t3))%(t3 % ((&1 - t) % u + t % w)) = (inv (t3))%((t1'-t1) % x + (t2'-t2) % v + t3' % w1)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`A%(B%X+C%Y+D%Z)=(A*B)%X+(A*C)%Y+(A*D)%Z`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN FIND_ASSUM MP_TAC`t1' + t2' + t3' = &1:real` THEN FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` THEN DISCH_TAC THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM(th)]) THEN REWRITE_TAC[REAL_ARITH`t1'' + t2' + t3' = t1' + t2 + t3<=> (t1''-t1') + (t2'-t2) + t3' = t3:real`] THEN STRIP_TAC THEN MP_TAC(SET_RULE` (t1'-t1) + (t2'-t2) + t3' = t3 ==> (inv (t3))*((t1'-t1) + (t2'-t2) + t3') = (inv (t3))*t3`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C+D)=A*B+A*C+A*D`] THEN STRIP_TAC THEN EXISTS_TAC`inv t3 * (t1' - t1):real` THEN EXISTS_TAC`inv t3 * (t2' - t2):real` THEN EXISTS_TAC`inv t3 * t3':real` THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LE_INV THEN ASM_TAC THEN REAL_ARITH_TAC;(*5*) MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`(&1 - t) % u + t % w:real^3`;] THEN MRESA_TAC injective_azim_coplanar[`x:real^3`;` v:real^3`;` u:real^3`;` w:real^3`] THEN POP_ASSUM (fun th->MRESA_TAC th [`h:real`;`t:real`]) THEN ASM_TAC THEN REAL_ARITH_TAC](*5*)(*4*); SET_TAC[]]]];(*1*) POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[NOT_EXISTS_THM] THEN DISCH_THEN(LABEL_TAC"B") THEN EXISTS_TAC`&1:real` THEN ASM_REWRITE_TAC[REAL_ARITH `&1<= &1`] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0<t:real==> &0<=t`) THEN RESA_TAC THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; ` (v:real^3)`] THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM;] THEN GEN_TAC THEN EQ_TAC THENL(*2*)[ DISCH_TAC THEN SUBGOAL_THEN `(&1-t)%u+t%w IN aff_ge {x,v} {w1}:real^3->bool` ASSUME_TAC THENL(*3*)[ POP_ASSUM MP_TAC THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = t1'' % x + t2' % v + t3' % w1<=> t3 % ((&1 - t) % u + t % w) = (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3`] THEN MP_TAC(REAL_ARITH`&0<t3:real==> ~(t3= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`(t3:real)` THEN STRIP_TAC THEN MP_TAC(SET_RULE` t3 % ((&1 - t) % u + t % w) = (t1'-t1) % x + (t2'-t2) % v + t3' % w1:real^3 ==> (inv (t3))%(t3 % ((&1 - t) % u + t % w)) = (inv (t3))%((t1'-t1) % x + (t2'-t2) % v + t3' % w1)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`A%(B%X+C%Y+D%Z)=(A*B)%X+(A*C)%Y+(A*D)%Z`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN FIND_ASSUM MP_TAC`t1' + t2' + t3' = &1:real` THEN FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` THEN DISCH_TAC THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM(th)]) THEN REWRITE_TAC[REAL_ARITH`t1'' + t2' + t3' = t1' + t2 + t3<=> (t1''-t1') + (t2'-t2) + t3' = t3:real`] THEN STRIP_TAC THEN MP_TAC(SET_RULE` (t1'-t1) + (t2'-t2) + t3' = t3 ==> (inv (t3))*((t1'-t1) + (t2'-t2) + t3') = (inv (t3))*t3`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C+D)=A*B+A*C+A*D`] THEN STRIP_TAC THEN EXISTS_TAC`inv t3 * (t1' - t1):real` THEN EXISTS_TAC`inv t3 * (t2' - t2):real` THEN EXISTS_TAC`inv t3 * t3':real` THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LE_INV THEN ASM_TAC THEN REAL_ARITH_TAC;(*3*) MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`(&1 - t) % u + t % w:real^3`;] THEN REMOVE_THEN "B"(fun th -> MRESAL1_TAC th `t:real`[DE_MORGAN_THM; REAL_ARITH`~(A<B)<=> B<A\/ B=A`]) THENL(*4*)[REMOVE_THEN"YEU EM"(fun th-> MRESA1_TAC th `t:real`) 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 POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC `{v,w1:real^3} IN E` THEN SET_TAC[]; REMOVE_THEN"MAI MAI" MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC `{v,w1:real^3} IN E` THEN SET_TAC[]; ASM_TAC THEN REAL_ARITH_TAC](*4*)]; SET_TAC[]]]);;
let fan_run_in_small3_not0_is_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 w1:real^3 a:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {u,w1} IN E /\ ~coplanar {x,v,u,w} /\ sigma_fan x V E u w=v /\ (&0< azim x u w v ) /\ (azim x u w v <pi) /\ &0 <a /\ a< &1 /\(aff_gt {x} {v, (&1 - a) % u + a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}) /\ (!s. &0 < s /\ s < a ==> aff_gt {x} {v, (&1 - s) % u + s % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}) ==> ?t1. a < t1 /\ t1 <= &1 /\ (!t:real. &0< t /\ t< t1==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {u,w1}={})`,
REPEAT STRIP_TAC THEN MRESA_TAC not_collinear_is_properties_fully_surrounded[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`;] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN EXISTS_TAC`&1:real` THEN ASM_REWRITE_TAC[REAL_ARITH`&1<= &1`] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0<t:real==> &0<=t /\ ~(t= &0)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`t< &1 ==>t<= &1`) THEN RESA_TAC THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; ` (u:real^3)`] THEN REWRITE_TAC[EXTENSION;INTER;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC THENL(*1*)[ MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] THEN STRIP_TAC THEN SUBGOAL_THEN `x' IN (aff_ge {x,u} {w1}:real^3->bool)`ASSUME_TAC THENL(*2*)[ POP_ASSUM MP_TAC THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w1:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`u:real^3`;`w1:real^3`][IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC`t1':real` THEN EXISTS_TAC`t2':real` THEN EXISTS_TAC`t3':real` THEN ASM_REWRITE_TAC[]; POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN MRESA_TAC inequality3_aim_in_convex_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`] THEN POP_ASSUM(fun th-> MRESA1_TAC th `t:real`) THEN POP_ASSUM(fun th-> MRESA_TAC th [`t1:real`;`t2:real`;`t3:real`]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"BE") THEN DISCH_THEN(LABEL_TAC"YEU") THEN SUBGOAL_THEN`~collinear {x, u, x':real^3}`ASSUME_TAC THENL(*3*)[ MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `t:real`) THEN ASM_REWRITE_TAC[collinear_fan;] THEN POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[coplanar;aff; AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC`x:real^3` THEN EXISTS_TAC`v:real^3` THEN EXISTS_TAC`u:real^3` THEN SUBGOAL_THEN`(x:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL(*4*)[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`&1` THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&0` THEN REDUCE_ARITH_TAC THEN VECTOR_ARITH_TAC; SUBGOAL_THEN`(v:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL(*5*)[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1` THEN EXISTS_TAC`&0` THEN REDUCE_ARITH_TAC THEN VECTOR_ARITH_TAC; SUBGOAL_THEN`(u:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL(*6*)[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1` THEN REDUCE_ARITH_TAC THEN VECTOR_ARITH_TAC; SUBGOAL_THEN`((&1 - t) % u + t % w:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC THENL(*7*)[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(REAL_ARITH`&0<t3:real==> ~(t3= &0)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = u' % x + v' % u <=>t3 % ((&1 - t) % u + t % w) = (u'-t1') % x -t2 % v+v' % u:real^3`] THEN STRIP_TAC THEN MP_TAC(SET_RULE` t3 % ((&1 - t) % u + t % w) = (u'-t1) % x -t2 % v+v' % u ==> (inv (t3))%(t3 % ((&1 - t) % u + t % w) ) = (inv (t3))%((u'-t1) % x -t2 % v+v' % u):real^3`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B-C+D)=A%B-A%C+A%D`;VECTOR_ARITH`A%B%C=(A*B)%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC`(inv t3 * (u' - t1)):real` THEN EXISTS_TAC`-- (inv t3 * t2):real` THEN EXISTS_TAC`(inv t3 * v'):real` THEN ASM_REWRITE_TAC[VECTOR_ARITH`A+(--b)%C+d=A-b%C+d`;REAL_ARITH`inv t3 * (u' - t1') + --(inv t3 * t2) + inv t3 * v'=inv t3 * (t3+(u'+v') - (t1'+ t2+t3))`;REAL_ARITH`A+ &1- &1=A`];(*7*) ASM_TAC THEN SET_TAC[]](*7*)](*6*)](*5*)](*4*);(*3*) MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`u:real^3`;`x':real^3`;`w1:real^3`;] THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`u:real^3`;`x':real^3`;`w1:real^3`;] THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`;`x':real^3`;] THEN REMOVE_THEN"BE" MP_TAC THEN REMOVE_THEN"YEU" MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN FIND_ASSUM MP_TAC`(sigma_fan x V E u w = (v:real^3))` THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge u V E = {w:real^3}) \/ ~(set_of_edge u V E = {w})`) THENL(*4*)[ FIND_ASSUM MP_TAC`w1 IN set_of_edge (u:real^3) V E` THEN POP_ASSUM (fun th-> REWRITE_TAC[(th);IN_SING]) THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC (ISPECL[`x:real^3`;`u:real^3`;`w:real^3`]AZIM_REFL) THEN REAL_ARITH_TAC;(*4*) DISJ_CASES_TAC(SET_RULE`(w1:real^3)=w \/ ~((w1:real^3)=w)`) THENL(*5*)[ ASM_REWRITE_TAC[] THEN MP_TAC (ISPECL[`x:real^3`;`u:real^3`;`w:real^3`]AZIM_REFL) THEN REAL_ARITH_TAC; MRESA_TAC SIGMA_FAN[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(u:real^3)`;`(w:real^3)`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `w1:real^3`) THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]]]; SET_TAC[]]);;
let fan_run_in_small_not0_is_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 v1:real^3 w1:real^3 a:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v1,w1} IN E /\ (&0< azim x u w v ) /\ (azim x u w v <pi) /\ sigma_fan x V E u w = v /\ &0 <a /\ a< &1 /\(aff_gt {x} {v, (&1 - a) % u + a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}) /\ (!s. &0 < s /\ s < a ==> aff_gt {x} {v, (&1 - s) % u + s % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}) ==> ?t1:real. a<t1 /\ t1<= &1 /\ (!t:real. &0< t /\ t< t1==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v1,w1}={})`,
(
let lem=prove(`!x v v1. aff_ge {x} {v1, v}=aff_ge {x} {v, v1}`,
REPEAT STRIP_TAC
THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`]
THEN SIMP_TAC[]) in

REPEAT STRIP_TAC
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`]
THEN DISJ_CASES_TAC(SET_RULE`(v1=v)\/ ~(v1=v:real^3)`)
THENL[
MRESA_TAC fan_run_in_small2_not0_is_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v1:real^3`;`u:real^3`;` w:real^3`;`w1:real^3`;`a:real`];

DISJ_CASES_TAC(SET_RULE`(v1=u)\/ ~(v1=u:real^3)`)
THENL[
MRESA_TAC fan_run_in_small3_not0_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` v1:real^3`;` w:real^3`;`w1:real^3`;`a:real`];
 DISJ_CASES_TAC(SET_RULE`(w1=v)\/ ~(w1=v:real^3)`)
THENL[
FIND_ASSUM MP_TAC`{v1,w1} IN (E:(real^3->bool)->bool)`
THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`]
THEN STRIP_TAC
THEN MRESA_TAC fan_run_in_small2_not0_is_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w1:real^3`;`u:real^3`;` w:real^3`;`v1:real^3`;`a:real`]
THEN EXISTS_TAC`t1:real`
THEN ASM_REWRITE_TAC[lem];
DISJ_CASES_TAC(SET_RULE`(w1=u)\/ ~(w1=u:real^3)`)
THENL[
FIND_ASSUM MP_TAC`{v1,w1} IN (E:(real^3->bool)->bool)`
THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`]
THEN STRIP_TAC
THEN MRESA_TAC fan_run_in_small3_not0_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` w1:real^3`;` w:real^3`;`v1:real^3`;`a:real`]
THEN EXISTS_TAC`t1:real`
THEN ASM_REWRITE_TAC[lem];
SUBGOAL_THEN`{v,u} INTER {v1,w1:real^3}={}` ASSUME_TAC
THENL[
ASM_TAC
THEN SET_TAC[];
MRESA_TAC fan_run_in_small1_not0_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`;`v1:real^3`;`w1:real^3`;`a:real`]]]]]]));;
let fan_run1_in_small_not0_is_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) (E':(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ E' SUBSET E /\ (&0< azim x u w v ) /\ (azim x u w v <pi) /\ sigma_fan x V E u w = v /\ &0 <a /\ a< &1 /\(aff_gt {x} {v, (&1 - a) % u + a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}) /\ (!s. &0 < s /\ s < a ==> aff_gt {x} {v, (&1 - s) % u + s % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}) ==> ?h:real. a<h /\ h<= &1 /\ (!s:real. &0< s /\ s< h==> aff_gt{x} {v,(&1-s)%u+ s % w} INTER {v | ?e. e IN E' /\ v IN aff_ge {x} e}={})`,
REPEAT STRIP_TAC THEN MRESA_TAC set_edges_is_finite_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] THEN MRESA_TAC FINITE_SUBSET [`(E':(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`] THEN ABBREV_TAC`n=CARD (E':(real^3->bool)->bool)` THEN REPEAT(POP_ASSUM MP_TAC) THEN SPEC_TAC (`(E':(real^3->bool)->bool)`,`(E':(real^3->bool)->bool)`) THEN SPEC_TAC (`n:num`,`n:num`) THEN INDUCT_TAC THENL(*1*)[ REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`E':(real^3->bool)->bool`]CARD_EQ_0) THEN RESA_TAC THEN EXISTS_TAC`a+ (&1-a:real) / &2` THEN MP_TAC(REAL_ARITH`&0<a /\ a < &1 ==> a< a+ (&1-a:real) / &2/\ a+ (&1-a:real) / &2 <= &1`) THEN RESA_TAC THEN ASM_SET_TAC[];(*1*) REPEAT GEN_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "A") THEN REPEAT STRIP_TAC THEN MP_TAC(ISPEC`(E':(real^3->bool)->bool)` CHOOSE_SUBSET) THEN RESA_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`n:num `th)) THEN REWRITE_TAC[ARITH_RULE `n:num <= SUC n`; HAS_SIZE] THEN STRIP_TAC THEN MP_TAC(SET_RULE` t SUBSET E' /\ E' SUBSET E ==> (t:(real^3->bool)->bool) SUBSET E`) THEN RESA_TAC THEN REMOVE_THEN "A" (fun th-> MP_TAC(ISPEC`(t:(real^3->bool)->bool)`th)) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") THEN SUBGOAL_THEN `~((E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)= {})` ASSUME_TAC THENL(*2*)[ STRIP_TAC THEN MP_TAC(SET_RULE`(E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)={} /\ t SUBSET E' ==> t= E'`) THEN RESA_TAC THEN FIND_ASSUM MP_TAC`CARD (t:(real^3->bool)->bool)=n` THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN ASM_REWRITE_TAC[] THEN ARITH_TAC;(*2*) SUBGOAL_THEN`?e. e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)` ASSUME_TAC THENL(*3*)[ ASM_SET_TAC[];(*3*) POP_ASSUM MP_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE`e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)/\ (E':(real^3->bool)->bool) SUBSET (E:(real^3->bool)->bool) /\ t SUBSET E' ==> e IN E'/\ e IN E/\ ~(e IN t) /\ {e} UNION t SUBSET E'`) THEN RESA_TAC THEN MP_TAC(ISPECL [`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`(E':(real^3->bool)->bool)`] FINITE_SUBSET) THEN RESA_TAC THEN ASSUME_TAC(SET_RULE`e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) THEN MP_TAC(ISPECL[`e:real^3->bool`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;]CARD_DELETE) THEN RESA_TAC THEN MP_TAC(SET_RULE `e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool) ==> ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e PSUBSET {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) THEN RESA_TAC THEN MP_TAC(ISPECL[`({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))DELETE e`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`]CARD_PSUBSET) THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN FIND_ASSUM MP_TAC`FINITE ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool))` THEN DISCH_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN DISCH_TAC THEN MP_TAC(ARITH_RULE`CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) < CARD ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) /\ CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) = CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))-1 <=>CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) +1= CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))`) THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) THEN REWRITE_TAC[ARITH_RULE`A=A`; ] THEN MP_TAC(SET_RULE`~(e IN t)==>({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e=t`) THEN RESA_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN FIND_ASSUM MP_TAC`(CARD (E':(real^3->bool)->bool)=SUC n)` THEN REWRITE_TAC[ARITH_RULE`SUC n=(n:num) +1`] THEN DISCH_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) THEN DISCH_TAC THEN MP_TAC(ISPECL[`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`E':(real^3->bool)->bool`]CARD_SUBSET_EQ) THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"MA") THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) THEN RESA_TAC THEN MRESA_TAC fan_run_in_small_not0_is_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`;`v':real^3`;`w':real^3`;`a:real`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"BE") THEN EXISTS_TAC` min (h:real) (t1:real)` THEN STRIP_TAC THENL(*4*)[ ASM_TAC THEN REAL_ARITH_TAC;(*4*) STRIP_TAC THENL(*5*)[ ASM_TAC THEN REAL_ARITH_TAC;(*5*) REPEAT STRIP_TAC THEN REMOVE_THEN "MA" MP_TAC THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) THEN REWRITE_TAC[UNION;IN_ELIM_THM;EXTENSION; INTER;] THEN GEN_TAC THEN EQ_TAC THENL(*6*)[ ASM_REWRITE_TAC[IN_SING] THEN MP_TAC(REAL_ARITH`s< min h t1==> s<h /\ s<t1`) THEN RESA_TAC THEN STRIP_TAC THENL(*7*)[ POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN REMOVE_THEN "BE"(fun th-> MRESA1_TAC th `s:real`) THEN ASM_SET_TAC[]; POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th `s:real`) THEN ASM_SET_TAC[]]; SET_TAC[]]]]]]]);;
let cut_in_edges_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a<= &1 /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ ~(aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={}) ==> a= &1 `,
REPEAT STRIP_TAC THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` THEN REWRITE_TAC[fan80] THEN DISCH_TAC THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) THEN ABBREV_TAC`s1={h:real| &0< h/\ h<= &1 /\ ~(aff_gt{x} {v,(&1-h)%u+ h % w:real^3} INTER {v | ?e. e IN E /\ v IN aff_ge {x:real^3} e}={})}` THEN SUBGOAL_THEN`(a:real) IN (s1:real->bool)` ASSUME_TAC THENL(*1*)[ POP_ASSUM(fun th->ASM_REWRITE_TAC[SYM(th);IN_ELIM_THM]); MP_TAC(SET_RULE`(a:real) IN (s1:real->bool)==> ~(s1={})`) THEN RESA_TAC THEN SUBGOAL_THEN`(?b. !x:real. x IN s1 ==> b <= x)`ASSUME_TAC THENL(*2*)[ EXISTS_TAC`&0` THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th->ASM_REWRITE_TAC[SYM(th);IN_ELIM_THM]) THEN REAL_ARITH_TAC; MRESA1_TAC INF`s1:real->bool` THEN ABBREV_TAC`b= inf (s1:real->bool)` THEN SUBGOAL_THEN`b<= &1` ASSUME_TAC THENL(*3*)[POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) THEN ASM_TAC THEN REAL_ARITH_TAC;(*3*) SUBGOAL_THEN`~(?s. &0 < s /\ s < b /\ ~( aff_gt {x} {v, (&1 - s) % u + s % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x:real^3} e} = {}))` ASSUME_TAC THENL(*4*)[STRIP_TAC THEN SUBGOAL_THEN`s IN (s1:real->bool)` ASSUME_TAC THENL(*5*)[ EXPAND_TAC"s1" THEN REWRITE_TAC[IN_ELIM_THM] THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC;(*5*) POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th->MP_TAC(ISPEC`s:real` th)) THEN DISCH_THEN (LABEL_TAC"DICH") THEN REPEAT STRIP_TAC THEN REMOVE_THEN"DICH" MP_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC];(*4*) POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM;IMP_IMP] THEN STRIP_TAC THEN MRESA_TAC fan_run_in_small_is_not_meet_xfan [`x:real^3`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;`u:real^3`;`w:real^3`] THEN SUBGOAL_THEN`~(?x:real. x IN s1 /\ ~(h <= x))`ASSUME_TAC THENL(*5*)[ POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN EXPAND_TAC"s1" THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`~(A<=B)<=> B<A`] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `x':real`);(*5*) POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM] THEN STRIP_TAC THEN SUBGOAL_THEN`&0<b:real`ASSUME_TAC THENL(*6*)[ POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th->MP_TAC(ISPEC`h:real` th)) THEN DISCH_THEN (LABEL_TAC"DICH") THEN REPEAT STRIP_TAC THEN REMOVE_THEN"DICH" MP_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*6*) MRESA_TAC not_cut_inside_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3` ;`b:real`] THEN POP_ASSUM MP_TAC THEN DISJ_CASES_TAC(REAL_ARITH`(b:real)< &1\/ &1 <= b`) THENL(*7*)[ ASM_REWRITE_TAC[] THEN STRIP_TAC THEN MRESAL_TAC fan_run1_in_small_not0_is_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`b:real`][SET_RULE`A SUBSET A`] THEN SUBGOAL_THEN`~(?x:real. x IN s1 /\ ~(h' <= x))`ASSUME_TAC THENL(*8*)[ POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN EXPAND_TAC"s1" THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`~(A<=B)<=> B<A`] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `x':real`);(*8*) POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM] THEN STRIP_TAC THEN SUBGOAL_THEN `h':real <= b`ASSUME_TAC THENL(*9*)[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 REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th->MP_TAC(ISPEC`h':real` th)) THEN REWRITE_TAC[];(*9*) POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC](*9*)](*8*);(*7*) STRIP_TAC THEN MP_TAC(REAL_ARITH`&1<=b /\ b<= &1==> b= &1`) THEN RESA_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 REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th->MP_TAC(ISPEC`a:real` th)) THEN RESA_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 REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]]]]]]);;
let not_cut_in_edges_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a< &1 /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) ==> (aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={})`,
REPEAT STRIP_TAC THEN DISJ_CASES_TAC(SET_RULE`(?a. &0< a /\ a< &1 /\ ~(aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={})) \/ (!a. &0< a /\ a< &1 ==> (aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x:real^3} e}={})) `) THENL[ POP_ASSUM MP_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM BE") THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` THEN REWRITE_TAC[fan80] THEN DISCH_TAC THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) THEN ABBREV_TAC`s1={h:real| &0< h/\ h< &1 /\ ~(aff_gt{x} {v,(&1-h)%u+ h % w:real^3} INTER {v | ?e. e IN E /\ v IN aff_ge {x:real^3} e}={})}` THEN SUBGOAL_THEN`(a':real) IN (s1:real->bool)` ASSUME_TAC THENL(*1*)[ POP_ASSUM(fun th->ASM_REWRITE_TAC[SYM(th);IN_ELIM_THM]); MP_TAC(SET_RULE`(a':real) IN (s1:real->bool)==> ~(s1={})`) THEN RESA_TAC THEN SUBGOAL_THEN`(?b. !x:real. x IN s1 ==> b <= x)`ASSUME_TAC THENL(*2*)[EXISTS_TAC`&0` THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th->ASM_REWRITE_TAC[SYM(th);IN_ELIM_THM]) THEN REAL_ARITH_TAC;(*2*) MRESA1_TAC INF`s1:real->bool` THEN ABBREV_TAC`b= inf (s1:real->bool)` THEN SUBGOAL_THEN`b< &1` ASSUME_TAC THENL(*3*)[ POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th `a':real`) THEN ASM_TAC THEN REAL_ARITH_TAC;(*3*) SUBGOAL_THEN`~(?s. &0 < s /\ s < b /\ ~( aff_gt {x} {v, (&1 - s) % u + s % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x:real^3} e} = {}))` ASSUME_TAC THENL(*4*)[ STRIP_TAC THEN SUBGOAL_THEN`s IN (s1:real->bool)` ASSUME_TAC THENL(*5*)[EXPAND_TAC"s1" THEN REWRITE_TAC[IN_ELIM_THM] THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC;(*5*) POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th->MP_TAC(ISPEC`s:real` th)) THEN DISCH_THEN (LABEL_TAC"DICH") THEN REPEAT STRIP_TAC THEN REMOVE_THEN"DICH" MP_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC];(*4*) POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM;IMP_IMP] THEN STRIP_TAC THEN MRESA_TAC fan_run_in_small_is_not_meet_xfan [`x:real^3`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;`u:real^3`;`w:real^3`] THEN SUBGOAL_THEN`~(?x:real. x IN s1 /\ ~(h <= x))`ASSUME_TAC THENL(*5*)[POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN EXPAND_TAC"s1" THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`~(A<=B)<=> B<A`] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `x':real`);(*5*) POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM] THEN STRIP_TAC THEN SUBGOAL_THEN`&0<b:real`ASSUME_TAC THENL(*6*)[ POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th->MP_TAC(ISPEC`h:real` th)) THEN DISCH_THEN (LABEL_TAC"DICH") THEN REPEAT STRIP_TAC THEN REMOVE_THEN"DICH" MP_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th]) THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*6*) MRESA_TAC not_cut_inside_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3` ;`b:real`] THEN MRESAL_TAC fan_run1_in_small_not0_is_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`b:real`][SET_RULE`A SUBSET A`] THEN SUBGOAL_THEN`~(?x:real. x IN s1 /\ ~(h' <= x))`ASSUME_TAC THENL(*7*)[ POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN EXPAND_TAC"s1" THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`~(A<=B)<=> B<A`] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `x':real`);(*7*) POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM] THEN STRIP_TAC THEN SUBGOAL_THEN `h':real <= b`ASSUME_TAC THENL(*8*)[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 REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th->MP_TAC(ISPEC`h':real` th)) THEN REWRITE_TAC[]; POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]]]]]]]; POP_ASSUM (fun th-> MRESA1_TAC th`a:real`)]);;
let lie_in_half_space_and_azim_le=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a<= &1 /\ fan80(x,V,E) /\ ~collinear{x,v1,u1} /\ v1 IN aff_gt {x} {v,(&1-a)%u+ a%w} /\ &0< azim x v1 v u1 /\ azim x v1 v u1 < pi ==> &0 < ((v-x) cross (u - x)) dot (v1-x)`,
REPEAT STRIP_TAC THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` THEN REWRITE_TAC[fan80] THEN DISCH_THEN(LABEL_TAC"yeu em") THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) THEN MP_TAC(ARITH_RULE`&0<a==> &0<= a`) THEN RESA_TAC THEN MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3) `;] THEN FIND_ASSUM MP_TAC `v1 IN aff_gt {x} {v,(&1-a)%u+ a%(w:real^3)}` THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) THEN STRIP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`A- vec 0= A`;VECTOR_ARITH`(t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w)) - x=(t1- &1) % x + t2 % v + t3 % ((&1 - a) % u + a % w)`] THEN FIND_ASSUM MP_TAC `t1 + t2 + t3 = &1:real` THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1- &1= (-- t2)- t3 `] THEN DISCH_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`(--t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w)= t2 % (v-x) + t3 % ((&1 - a) % (u-x) + a % (w-x))`] THEN REWRITE_TAC[ DOT_RADD;DOT_RMUL;DOT_CROSS_SELF] THEN REDUCE_ARITH_TAC THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[] THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `u:real^3`;`v:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[CROSS_TRIPLE]);;
let cross_dot_fully_surrounded1_fan_le=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a<= &1 /\ fan80(x,V,E) /\ ~collinear{x,v1,u1} /\ v1 IN aff_gt {x} {v,(&1-a)%u+ a%w} /\ &0< azim x v1 v u1 /\ azim x v1 v u1 < pi ==> &0< ((v1 - x) cross (u1 - x)) dot ((&1 - a) % u + a % w-x)`,
REPEAT STRIP_TAC THEN MRESAL_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `(&1 - a) % u + a % w:real^3`;`u1:real^3`][VECTOR_ARITH`((&1 - a) % u + a % w) - x=(&1 - a) % u + a % w - x`] THEN POP_ASSUM MATCH_MP_TAC THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` THEN REWRITE_TAC[fan80] THEN DISCH_THEN(LABEL_TAC"yeu em") THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) THEN MP_TAC(ARITH_RULE`&0<a==> &0<= a`) THEN RESA_TAC THEN MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`(&1-a)%u+ a%w:real^3`;`v1:real^3`] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3) `;] THEN FIND_ASSUM MP_TAC `(v1:real^3) IN aff_gt {x} {v,(&1-a)%u+ a%(w:real^3)}` THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) THEN STRIP_TAC THEN SUBGOAL_THEN`~collinear {x, v1, (&1 - a) % u + a % w:real^3}` ASSUME_TAC THENL[ ASM_REWRITE_TAC[collinear1_fan;] THEN FIND_ASSUM MP_TAC`~((&1 - a) % u + a % w IN aff {x, v:real^3})` THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w) = u' % x + v' % ((&1 - a) % u + a % w)<=> (&1-(t1+t2+t3)) % x + (v'-t3) % ((&1 - a) % u + a % w-x) = (&1-(u'+v') ) % x + t2 % (v-x)`;REAL_ARITH`a-a= &0`] THEN REDUCE_VECTOR_TAC THEN DISJ_CASES_TAC(REAL_ARITH`v' - t3= &0 \/ ~(v' - (t3:real)= &0)`) THENL[ ASM_REWRITE_TAC[VECTOR_ARITH`&0 %A=B<=> B= vec 0`;VECTOR_MUL_EQ_0] THEN MP_TAC(REAL_ARITH`&0< t2==> ~(t2 = &0)`) THEN RESA_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> A=B`]; MRESA1_TAC REAL_MUL_LINV `(v'-t3:real)` THEN STRIP_TAC THEN MP_TAC(SET_RULE`(v' - t3) % ((&1 - a) % u + a % w - x) = t2 % (v - x:real^3) ==> (inv (v'-t3)) % (v' - t3) % ((&1 - a) % u + a % w - x) = (inv (v'-t3)) % ( t2 % (v - x))`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) THEN REWRITE_TAC[VECTOR_ARITH`&1 % ((&1 - a) % u + a % w - x) = (inv (v' - t3) * t2) % (v - x)<=> (&1 - a) % u + a % w = (&1-(inv (v' - t3) * t2))%x +(inv (v' - t3) * t2) % v:real^3`] THEN STRIP_TAC THEN EXISTS_TAC`&1-(inv (v' - t3) * (t2:real))` THEN EXISTS_TAC`(inv (v' - t3) * (t2:real))` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC]; POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"A") THEN DISCH_TAC THEN REMOVE_THEN "A" MP_TAC THEN ASM_REWRITE_TAC[] THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v1:real^3`;`v:real^3`;`u1:real^3`;`((&1 - a) % u + a % w):real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"B") THEN DISCH_TAC THEN SUBGOAL_THEN`azim x v1 v ((&1 - a) % u + a % w)= pi` ASSUME_TAC THENL[ POP_ASSUM MP_TAC THEN MRESA_TAC th3[`(x:real^3)` ;`v1:real^3`;` (v:real^3)`] THEN MRESA_TAC AFF_LT_2_1[`x:real^3`;`v1:real^3`;`v:real^3`] THEN MRESAL_TAC AZIM_EQ_PI_ALT[`x:real^3`;`v1:real^3`;`v:real^3`;`((&1 - a) % u + a % w):real^3`][IN_ELIM_THM] THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[VECTOR_ARITH`A=B+C+D <=> D=A-B-C:real^3`] THEN MP_TAC(REAL_ARITH`&0<t3==> ~(t3= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV `(t3:real)` THEN STRIP_TAC THEN MP_TAC(SET_RULE`t3 % ((&1 - a) % u + a % w) = v1 - t1 % x - t2 % v ==> (inv (t3)) % t3 % ((&1 - a) % u + a % w) = (inv (t3)) % ( v1 - t1 % x - t2 % v:real^3)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) THEN REWRITE_TAC[VECTOR_ARITH`&1 % ((&1 - a) % u + a % w) = inv t3 % (v1 - t1 % x - t2 % v) <=> (&1 - a) % u + a % w = (-- inv t3 * t1) % x + (inv t3) % v1 +(-- (inv t3* t2)) % v`] THEN STRIP_TAC THEN EXISTS_TAC`(-- inv t3 * t1):real` THEN EXISTS_TAC`(inv t3):real` THEN EXISTS_TAC`(-- (inv t3 * t2)):real` THEN ASM_REWRITE_TAC[REAL_ARITH`--inv t3 * t1 + inv t3 + --(inv t3 * t2)= inv t3 *(t3+ &1-(t1+t2+t3))`;REAL_ARITH`(t3 + &1 - &1)=t3`;REAL_ARITH`--A< &0 <=> &0< A`] THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LT_INV THEN ASM_REWRITE_TAC[]; REMOVE_THEN "B" MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN REMOVE_ASSUM_TAC THEN MP_TAC(REAL_ARITH`azim x v1 v u1 < pi==> azim x v1 v u1 <= pi`) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN FIND_ASSUM MP_TAC`azim x v1 v (u1:real^3) < pi` THEN FIND_ASSUM MP_TAC`&0< azim x v1 v (u1:real^3) ` THEN REAL_ARITH_TAC]]);;
let exists_cross_dot_fully_surrounded1_fan_le=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a<= &1 /\ fan80(x,V,E) /\ ~collinear{x,v1,u1} /\ v1 IN aff_gt {x} {v,(&1-a)%u+ a%w} /\ &0< azim x v1 v u1 /\ azim x v1 v u1 < pi ==> ?t. &0< t/\ t < &1 /\( !h:real. &0< h/\ h<t ==> &0< ((v1 - x) cross (u1 - x)) dot (((&1 - h) % ((&1 - a) % u + a % w) + h % u) - x))`,
REPEAT STRIP_TAC THEN REWRITE_TAC[VECTOR_ARITH`(((&1 - t) % ((&1 - a) % u + a % w) + t % u) - x)= ((&1 - a) % u + a % w - x) + t % (--a) % ( w-u)`;] THEN ABBREV_TAC`va=(&1 - a) % u + a % w-x:real^3` THEN REWRITE_TAC[DOT_RADD;DOT_RMUL; REAL_ARITH`&0<A+C*(--B)*D<=> (B*D)*C<A`] THEN MRESA_TAC cross_dot_fully_surrounded1_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;`u1:real^3`] THEN DISJ_CASES_TAC(REAL_ARITH`(((v1 - x) cross (u1 - x:real^3)) dot (w - u)<= &0 )\/ (&0<((v1 - x) cross (u1 - x)) dot (w - u))`) THENL[ EXISTS_TAC`&1/ &2` THEN REWRITE_TAC[REAL_ARITH`&0 < &1 / &2 /\ &1 / &2 < &1`] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0 < a ==> &0<= (a:real)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0 < h ==> &0<= (h:real)`) THEN RESA_TAC THEN MRESAL_TAC REAL_LE_LMUL[`a:real`;`((v1 - x) cross (u1 - x)) dot ((w - u):real^3)`;`&0`][REAL_ARITH`(A:real)* &0= &0`] THEN MRESAL_TAC REAL_LE_RMUL[`a*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)`;`&0`;`h:real`][REAL_ARITH`&0 * (A:real)= &0`] 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 POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; MRESA_TAC REAL_LT_MUL[`a:real`;`((v1 - x) cross (u1 - x)) dot ((w - u):real^3)`] THEN MP_TAC(REAL_ARITH`&0<(a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)==> ~( (a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_RINV`(a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)` THEN MRESA1_TAC REAL_LT_INV`(a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)` THEN MRESA_TAC REAL_LT_MUL[`inv((a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3))`;`((v1 - x) cross (u1 - x)) dot (va:real^3)`] THEN EXISTS_TAC `min ((inv(a *(((v1 - x) cross (u1 - x)) dot (w - u)))*(((v1 - x) cross (u1 - x)) dot va)) / &2 ) (&1/ &2)` THEN STRIP_TAC THENL[POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; STRIP_TAC THENL[ REAL_ARITH_TAC; REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH` h< min ((inv (a * (((v1 - x) cross (u1 - x)) dot (w - u))) * (((v1 - x) cross (u1 - x)) dot va)) / &2) (&1 / &2) ==> h< ((inv (a * (((v1 - x) cross (u1 - x)) dot (w - u))) * (((v1 - x) cross (u1 - x)) dot va)) / &2)`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_LMUL[`(a * (((v1 - x) cross (u1 - x)) dot (w - u:real^3)))`;`h:real`;`((inv (a * (((v1 - x) cross (u1 - x)) dot (w - u))) * (((v1 - x) cross (u1 - x:real^3)) dot va)) / &2)`] THEN ASM_TAC THEN ABBREV_TAC`vb=a * (((v1 - x) cross (u1 - x)) dot (w - u))` THEN REPEAT DISCH_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`vb * (inv vb * (((v1 - x) cross (u1 - x)) dot va)) / &2= (vb * inv vb) * (((v1 - x) cross (u1 - x)) dot va)/ &2`] 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 MP_TAC THEN REAL_ARITH_TAC]]]);;
let cross_dot_fully_surrounded2_fan_le=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a<= &1 /\ fan80(x,V,E) /\ ~collinear{x,v1,u1} /\ v1 IN aff_gt {x} {v,(&1-a)%u+ a%w} /\ &0< azim x v1 v u1 /\ azim x v1 v u1 < pi ==> &0 < (((&1 - a) % u + a % w - x) cross (v - x)) dot (u1 - x)`,
REPEAT STRIP_TAC THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` THEN REWRITE_TAC[fan80] THEN DISCH_THEN(LABEL_TAC"yeu em") THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) THEN MP_TAC(ARITH_RULE`&0<a==> &0<= a`) THEN RESA_TAC THEN MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`(&1-a)%u+ a%w:real^3`;`v1:real^3`] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] THEN MRESA1_TAC SIN_POS_PI`azim x v1 v (u1:real^3)` THEN POP_ASSUM MP_TAC THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`v1:real^3`;` v:real^3`;`u1:real^3`] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN MRESA_TAC JBDNJJB[`(v1-x):real^3`;`v-x:real^3`;`u1-x:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM COLLINEAR_3;] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN MRESAL_TAC REAL_LT_LMUL_EQ [` &0:real `;`(((v1 - x) cross (v - x)) dot ((u1 - x):real^3)):real`;`t:real`][REAL_ARITH`a * &0 = &0`] THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3) `;] THEN FIND_ASSUM MP_TAC `v1 IN aff_gt {x} {v,(&1-a)%u+ a%(w:real^3)}` THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) THEN STRIP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th;VECTOR_ARITH`A- vec 0= A`;VECTOR_ARITH`(t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w)) - x=(t1- &1) % x + t2 % v + t3 % ((&1 - a) % u + a % w)`]) THEN FIND_ASSUM MP_TAC `t1 + t2 + t3 = &1:real` THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1- &1= (-- t2)- t3 `] THEN DISCH_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`(--t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w)= t2 % (v-x) + t3 % ((&1 - a) % u + a % w-x)`] THEN REWRITE_TAC[CROSS_LADD; CROSS_RADD; CROSS_LMUL; CROSS_RMUL;CROSS_REFL;CROSS_RNEG;CROSS_LNEG] THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[GSYM CROSS_LMUL;GSYM CROSS_LADD;DOT_LMUL] THEN MRESAL_TAC REAL_LT_LMUL_EQ [` &0:real `;`((((&1 - a) % u + a % w - x) cross (v - x)) dot (u1 - x)):real`;`t3:real`][REAL_ARITH`a * &0 = &0`]);;
let exists_cross_dot_fully_surrounded2_fan_le=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a<= &1 /\ fan80(x,V,E) /\ ~collinear{x,v1,u1} /\ v1 IN aff_gt {x} {v,(&1-a)%u+ a%w} /\ &0< azim x v1 v u1 /\ azim x v1 v u1 < pi ==> ?t:real. &0< t/\ t < &1 /\ (!h:real. &0<h /\ h< t ==> &0 < ((((&1 - h) % ((&1 - a) % u + a % w) + h % u) - x) cross (v - x)) dot (u1 - x))`,
REPEAT STRIP_TAC THEN REWRITE_TAC[VECTOR_ARITH`(((&1 - t) % ((&1 - a) % u + a % w) + t % u) - x)= ((&1 - a) % u + a % w - x) + t % (--a) % ( w-u)`;] THEN ABBREV_TAC`va=(&1 - a) % u + a % w-x:real^3` THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;DOT_LADD;DOT_LMUL; REAL_ARITH`&0<A+C*(--B)*D<=> (B*D)*C<A`] THEN MRESA_TAC cross_dot_fully_surrounded2_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;`u1:real^3`] THEN DISJ_CASES_TAC(REAL_ARITH`(((w - u) cross (v - x:real^3)) dot (u1- x)<= &0 )\/ (&0<((w - u) cross (v - x:real^3)) dot (u1- x))`) THENL[ EXISTS_TAC`&1/ &2` THEN REWRITE_TAC[REAL_ARITH`&0 < &1 / &2 /\ &1 / &2 < &1`] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0 < a ==> &0<= (a:real)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0 < h ==> &0<= (h:real)`) THEN RESA_TAC THEN MRESAL_TAC REAL_LE_LMUL[`a:real`;`((w - u) cross (v - x:real^3)) dot (u1- x:real^3)`;`&0`][REAL_ARITH`(A:real)* &0= &0`] THEN MRESAL_TAC REAL_LE_RMUL[`a*(((w - u) cross (v - x:real^3)) dot (u1- x))`;`&0`;`h:real`][REAL_ARITH`&0 * (A:real)= &0`] 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 POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; MRESA_TAC REAL_LT_MUL[`a:real`;`((w - u) cross (v - x:real^3)) dot (u1- x:real^3)`] THEN MP_TAC(REAL_ARITH`&0<(a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))==> ~( (a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_RINV`(a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))` THEN MRESA1_TAC REAL_LT_INV`(a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))` THEN MRESA_TAC REAL_LT_MUL[`inv((a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x)))`;`((va cross (v - x)) dot (u1 - x))`] THEN EXISTS_TAC `min ((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 ) (&1/ &2)` THEN STRIP_TAC THENL[POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; STRIP_TAC THENL[ REAL_ARITH_TAC; REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH` h< min ((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 ) (&1/ &2) ==> h< ((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 )`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_LMUL[`(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))`;`h:real`;`((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 )`] THEN ASM_TAC THEN ABBREV_TAC`vb=a * (((w - u) cross (v - x:real^3)) dot (u1- x))` THEN REPEAT DISCH_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`vb * (inv vb * ((va cross (v - x)) dot (u1 - x))) / &2= (vb * inv vb) * ((va cross (v - x)) dot (u1 - x))/ &2`] 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 MP_TAC THEN REAL_ARITH_TAC]]]);;
let exists_cut_small_edges_fan_le=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a<= &1 /\ fan80(x,V,E) /\ ~collinear{x,v1,u1} /\ v1 IN aff_gt {x} {v,(&1-a)%u+ a%w} /\ &0< azim x v1 v u1 /\ azim x v1 v u1 < pi ==> ?t:real. &0< t/\ t < &1 /\ ~(aff_gt {x} {v,(&1-t)%((&1-a)%u+ a%w)+t%u} INTER aff_gt {x} {v1,u1}={})`,
REPEAT STRIP_TAC THEN MRESA_TAC lie_in_half_space_and_azim_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;` u1:real^3`] THEN MRESA_TAC exists_cross_dot_fully_surrounded1_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;` u1:real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"MA") THEN MRESA_TAC exists_cross_dot_fully_surrounded2_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;` u1:real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"BE NHO") THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` THEN REWRITE_TAC[fan80] THEN DISCH_THEN(LABEL_TAC"yeu em") THEN ABBREV_TAC`ta=min (t:real) (t':real)/ &2` THEN EXISTS_TAC `(ta:real)` THEN SUBGOAL_THEN `&0< ta:real /\ ta < &1 /\ ta< t /\ ta< t'` ASSUME_TAC THENL(*1*)[ POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN FIND_ASSUM MP_TAC`&0<t:real` THEN FIND_ASSUM MP_TAC`t:real < &1` THEN FIND_ASSUM MP_TAC`&0<t':real` THEN FIND_ASSUM MP_TAC`t':real < &1` THEN REAL_ARITH_TAC;(*1*) ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE`&0<a==> &0<= a`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`ta< &1 ==> &0<= (&1-ta):real`) THEN RESA_TAC THEN MRESA_TAC REAL_LE_MUL [`(&1-ta):real`;`a:real`] THEN MRESA_TAC REAL_LE_LMUL [`(&1-ta):real`;`a:real`;`&1`] THEN MP_TAC(REAL_ARITH` &0< ta /\ (&1-ta)*a<= (&1-ta)* &1 :real==> (&1-ta)*a<= &1`) THEN RESA_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) THEN MRESAL_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`((&1-ta)*a):real`][VECTOR_ARITH`(&1 - ((&1 - ta) * a)) % u + ((&1 - ta) * a ) % w= (&1 - ta) % ((&1 - a) % u + a % w) + ta % u:real^3`] THEN MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`(&1-a)%u+ a%w:real^3`;`v1:real^3`] THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`;`u1:real^3`;`v:real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"CON") THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - ta) % ((&1 - a) % u + a % w) + ta % u:real^3`;] THEN MRESA_TAC th3[`(x:real^3)` ;` (v1:real^3)`;`u1:real^3`;] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v1:real^3)`;`(u1:real^3) `;] THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - ta) % ((&1 - a) % u + a % w) + ta % u:real^3 `;] THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;EXTENSION;EMPTY;IN;NOT_FORALL_THM] THEN ABBREV_TAC`a1=(v-x):real^3` THEN ABBREV_TAC`a2=(((&1-ta)%((&1-a)%u+ a%w)+ta%u)-x):real^3` THEN ABBREV_TAC`a3=(v1-x) :real^3` THEN ABBREV_TAC`a4=u1-x:real^3` THEN ABBREV_TAC`va=a1 cross a2:real^3` THEN ABBREV_TAC`vb=a3 cross a4:real^3` THEN EXISTS_TAC`(vb:real^3) cross (va:real^3)+(x:real^3)` THEN STRIP_TAC THENL(*2*)[ EXISTS_TAC`&1-(vb:real^3) dot (a2:real^3)+ vb dot (a1:real^3)` THEN EXISTS_TAC`(vb:real^3) dot (a2:real^3)` THEN EXISTS_TAC`--((vb:real^3) dot (a1:real^3))` THEN REMOVE_THEN "MA"(fun th-> MRESA1_TAC th `ta:real`) THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - vb dot a2 + vb dot a1) + vb dot a2 + --(vb dot a1) = &1`] THEN SUBGOAL_THEN `&0< --((vb:real^3) dot (a1:real^3))` ASSUME_TAC THENL(*3*)[ EXPAND_TAC"vb" THEN ONCE_REWRITE_TAC[CROSS_SKEW;] THEN REWRITE_TAC[DOT_LNEG] THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN REMOVE_THEN "CON"MP_TAC THEN REAL_ARITH_TAC;(*3*) ASM_REWRITE_TAC[] THEN EXPAND_TAC"va" THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_MUL_LNEG] THEN EXPAND_TAC"a1" THEN EXPAND_TAC"a2" THEN VECTOR_ARITH_TAC];(*2*) ONCE_REWRITE_TAC[CROSS_SKEW] THEN EXPAND_TAC"vb" THEN REWRITE_TAC[CROSS_LAGRANGE;] THEN EXISTS_TAC`&1+(va:real^3) dot (a4:real^3)- va dot (a3:real^3)` THEN EXISTS_TAC`--(va:real^3) dot (a4:real^3)` THEN EXISTS_TAC`((va:real^3) dot (a3:real^3))` THEN REMOVE_THEN "BE NHO"(fun th-> MRESA1_TAC th `ta:real`) THEN ASM_REWRITE_TAC[DOT_LNEG;VECTOR_MUL_LNEG;REAL_ARITH`(&1 + va dot a4 - va dot a3) + --(va dot a4) + va dot a3 = &1`;] THEN STRIP_TAC THENL(*3*)[ EXPAND_TAC"va" THEN ONCE_REWRITE_TAC[CROSS_SKEW;] THEN REWRITE_TAC[DOT_LNEG] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*3*) STRIP_TAC THENL(*4*)[ EXPAND_TAC"va" THEN EXPAND_TAC"a2" THEN REWRITE_TAC[VECTOR_ARITH`((&1 - ta) % ((&1 - a) % u + a % w) + ta % u) - x =(&1 - ta) % ((&1 - a) % u + a % w-x) + ta % (u - x)`] THEN ABBREV_TAC`vu=(&1 - a) % u + a % w - x:real^3` THEN REWRITE_TAC[CROSS_RADD;CROSS_RMUL;DOT_LADD;DOT_LMUL;] THEN MRESAL_TAC coplanar_is_cross_fan[`x:real^3`;`v:real^3`;`(&1 - a) % u + a % w:real^3`;`v1:real^3`] [VECTOR_ARITH`((&1 - a) % u + a % w) - x=(&1 - a) % u + a % w - x`] THEN REDUCE_ARITH_TAC THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[];(*4*) EXPAND_TAC"a3" THEN EXPAND_TAC"a4" THEN REWRITE_TAC[VECTOR_ARITH`-- A+B= B-A:real^3`;VECTOR_ARITH`(&1+A-B)%X+B%U-A%V=X-A%(V-X)+B%(U-X)`] THEN VECTOR_ARITH_TAC]]]]);;
let AFF_GT_CUT_XFAN_IMP_EDGE_FAN=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ ~(aff_gt{x} {v,w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={}) ==> {v,w} IN E`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") THEN DISCH_TAC THEN POP_ASSUM (fun th-> MP_TAC (th) THEN ASSUME_TAC(th)) THEN REWRITE_TAC[fan80] THEN DISCH_THEN(LABEL_TAC"BE") THEN DISCH_THEN(LABEL_TAC"YEU") THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?x'. x' IN A`;INTER;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN DISCH_TAC THEN REMOVE_THEN "A" MP_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[(th)]) THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN DISCH_TAC THEN REMOVE_THEN "A" MP_TAC THEN REMOVE_THEN "BE" (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"BE") ) THEN MRESAL_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`][REAL_ARITH`&0<= &1/\ &1<= &1 `;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(w:real^3)`;] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; ` (v':real^3)`] THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v':real^3`;`w':real^3`][IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "VUT1") THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "VUT") THEN REPEAT 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 DISCH_THEN(LABEL_TAC "VUT1") THEN DISCH_TAC THEN DISCH_TAC THEN DISJ_CASES_TAC(REAL_ARITH`(t3'= &0) \/ ~(t3':real= &0)`) THENL(*1*)[ ASM_REWRITE_TAC[] THEN REDUCE_ARITH_TAC THEN REDUCE_VECTOR_TAC THEN DISJ_CASES_TAC(REAL_ARITH`(t2'= &0) \/ ~(t2':real= &0)`) THENL(*2*)[ ASM_REWRITE_TAC[] THEN REDUCE_ARITH_TAC THEN REDUCE_VECTOR_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`&0<t3:real==> ~(t3= &0)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM(th)])`t1 + t2 + t3 = &1:real` THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % w = (t1 + t2 + t3) % x<=>(t3) % (w- x)=(-- t2) % (v-x) `] THEN STRIP_TAC THEN MP_TAC(SET_RULE` (t3) % (w- x)=(-- t2) % (v-x) ==> (inv (t3))%((t3) % (w- x) ) = (inv (t3))%((-- t2) % (v-x)):real^3`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;] THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[VECTOR_ARITH`A-B=C%(D-B)<=>A=(&1-C)%B+C%D`;] THEN STRIP_TAC THEN FIND_ASSUM MP_TAC `~(w IN aff {x, v:real^3})` THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC`&1-(inv t3 * (--t2)):real` THEN EXISTS_TAC`(inv t3 * (--t2)):real` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC ;(*2*) FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1= &1 -t2 -t3`; REAL_ARITH`A+B= &1<=> A= &1-B`] THEN DISCH_THEN(LABEL_TAC"MAI") THEN DISCH_THEN (LABEL_TAC"YEU EM") THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - t2 - t3) % x + t2 % v + t3 % w = (&1 - t2') % x + t2' % v'<=> t2' % v'=(t2' - t2 - t3) % x + t2 % v + t3 % w:real^3 `] THEN MP_TAC(ISPEC`(t2':real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2' % v'=(t2' - t2 - t3) % x + t2 % v + t3 % w:real^3 ==> (inv (t2'))%(t2' % v' ) = (inv (t2'))%((t2' - t2 - t3) % x + t2 % v + t3 % w:real^3) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C+D)=(A%B+A%C+A%D)`;REAL_ARITH`a*(b-c-d)=a*b-a*c-a*d`] THEN REDUCE_VECTOR_TAC THEN DISCH_TAC THEN SUBGOAL_THEN `~coplanar{x:real^3,v':real^3,v:real^3,u:real^3}` ASSUME_TAC THENL(*3*)[ POP_ASSUM MP_TAC THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, v', v, u}= {(--x) +x, (--x) +v', (--x) +v, (--x) +u}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,v':real^3,v:real^3,u:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`]) THEN DISCH_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th;VECTOR_ARITH`((&1 - inv t2' * t2 - inv t2' * t3) % x + (inv t2' * t2) % v + (inv t2' * t3) % w) - x=(inv t2' * t2) % (v-x) + (inv t2' * t3) % (w-x)`]) THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3 /\ t1+t2+t3= &1==> &0 < &1- t1 /\ ~(&1- t1 = &0)/\ t2+t3= &1- t1`) THEN REMOVE_THEN"MAI" MP_TAC THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2 + t3 = &1 - t1:real ==> (inv ( &1 - t1))*(t2 + t3) = (inv ( &1 - t1))*( &1 - t1:real) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> A*B = &1 -A*C`] THEN STRIP_TAC THEN MP_TAC(REAL_ARITH` ~(t2' = &0) /\ &0 <= t2'==> &0 <t2'`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`t2':real`;`inv (&1- t1):real`] THEN MRESA_TAC REAL_LT_MUL[`inv (&1- t1):real`;`t3:real`;] THEN MP_TAC(REAL_ARITH`&0< (inv (&1- t1)) * t3 ==> ~( (inv(&1- t1)) * t3= &0)`) THEN MP_TAC(REAL_ARITH`&0< (t2') * inv (&1- t1) ==> ~((t2')* inv(&1- t1)= &0)`) THEN RESA_TAC THEN ASSUME_TAC(REAL_ARITH`~(&1 = &0)`) THEN MRESA_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`(t2')* inv(&1- t1)`;`u - x:real^3`; `v - x:real^3`; `(inv t2' * t2) % (v - x) +(inv t2' * t3) % (w - x):real^3`] THEN POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM(th);]) THEN REDUCE_VECTOR_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+D)=A%B+A%D`; VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(t2' * inv (&1 - t1)) * inv t2' * t2= (inv (t2')* t2' ) * inv (&1-t1) * t2`] THEN REDUCE_ARITH_TAC THEN DISCH_TAC THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, w}= {(--x) +x, (--x) +v, (--x) +u, (--x) + w}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) THEN DISCH_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` w-x:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th`(inv(&1- t1)) * t3:real`) ;(*3*) POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"DICH") THEN DISCH_TAC THEN MP_TAC(REAL_ARITH` ~(t2' = &0) /\ &0 <= t2'==> &0 <t2'`) THEN RESA_TAC THEN MRESA1_TAC REAL_LT_INV`t2':real` THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t2:real`;] THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t3:real`;] THEN SUBGOAL_THEN `(v':real^3) IN aff_gt {x} {v,w:real^3}` ASSUME_TAC THENL(*4*)[ ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`(&1 - inv t2' * t2 - inv t2' * t3:real)` THEN EXISTS_TAC`inv t2' * t2:real` THEN EXISTS_TAC`(inv t2' * t3:real)` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC;(*4*) REMOVE_THEN "DICH" MP_TAC THEN REMOVE_THEN "VUT" MP_TAC THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `v':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN MRESA_TAC exists_element_in_half_sapace_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;` v:real^3`;`u:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; ` (v':real^3)`] THEN MRESAL_TAC exists_cut_small_edges_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1`;`v':real^3`;`u':real^3`][REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN MRESAL_TAC not_cut_in_edges_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] [REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER aff_ge {x} e = {}`] THEN POP_ASSUM(fun th-> MRESA1_TAC th`{v',u':real^3}`) THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v':real^3`;`u':real^3`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[] ](*4*)](*3*)](*2*);(*1*) DISJ_CASES_TAC(REAL_ARITH`(t2'= &0) \/ ~(t2':real= &0)`) THENL(*2*)[ FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1= &1 -t2 -t3`; REAL_ARITH`A+B= &1<=> A= &1-B`] THEN DISCH_THEN(LABEL_TAC"MAI") THEN DISCH_THEN (LABEL_TAC"YEU EM") THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - t2 - t3) % x + t2 % v + t3 % w = (&1 - &0 - t3') % x + &0% v'+t3' % w'<=> t3' % w'=(t3' - t2 - t3) % x + t2 % v + t3 % w:real^3 `] THEN MP_TAC(ISPEC`(t3':real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t3' % w'=(t3' - t2 - t3) % x + t2 % v + t3 % w:real^3 ==> (inv (t3'))%(t3' % w' ) = (inv (t3'))%((t3' - t2 - t3) % x + t2 % v + t3 % w:real^3) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C+D)=(A%B+A%C+A%D)`;REAL_ARITH`a*(b-c-d)=a*b-a*c-a*d`] THEN REDUCE_VECTOR_TAC THEN DISCH_TAC THEN SUBGOAL_THEN `~coplanar{x:real^3,w':real^3,v:real^3,u:real^3}` ASSUME_TAC THENL(*3*)[ POP_ASSUM MP_TAC THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, w', v, u}= {(--x) +x, (--x) +w', (--x) +v, (--x) +u}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,w':real^3,v:real^3,u:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`]) THEN DISCH_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[th;VECTOR_ARITH`((&1 - inv t2' * t2 - inv t2' * t3) % x + (inv t2' * t2) % v + (inv t2' * t3) % w) - x=(inv t2' * t2) % (v-x) + (inv t2' * t3) % (w-x)`]) THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3 /\ t1+t2+t3= &1==> &0 < &1- t1 /\ ~(&1- t1 = &0)/\ t2+t3= &1- t1`) THEN REMOVE_THEN"MAI" MP_TAC THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2 + t3 = &1 - t1:real ==> (inv ( &1 - t1))*(t2 + t3) = (inv ( &1 - t1))*( &1 - t1:real) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> A*B = &1 -A*C`] THEN STRIP_TAC THEN MP_TAC(REAL_ARITH` ~(t3' = &0) /\ &0 <= t3'==> &0 <t3'`) THEN RESA_TAC THEN MRESA_TAC REAL_LT_MUL[`t3':real`;`inv (&1- t1):real`] THEN MRESA_TAC REAL_LT_MUL[`inv (&1- t1):real`;`t3:real`;] THEN MP_TAC(REAL_ARITH`&0< (inv (&1- t1)) * t3 ==> ~( (inv(&1- t1)) * t3= &0)`) THEN MP_TAC(REAL_ARITH`&0< (t3') * inv (&1- t1) ==> ~((t3')* inv(&1- t1)= &0)`) THEN RESA_TAC THEN ASSUME_TAC(REAL_ARITH`~(&1 = &0)`) THEN MRESA_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`(t3')* inv(&1- t1)`;`u - x:real^3`; `v - x:real^3`; `(inv t3' * t2) % (v - x) +(inv t3' * t3) % (w - x):real^3`] THEN POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM(th);]) THEN REDUCE_VECTOR_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+D)=A%B+A%D`; VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(t2' * inv (&1 - t1)) * inv t2' * t2= (inv (t2')* t2' ) * inv (&1-t1) * t2`] THEN REDUCE_ARITH_TAC THEN DISCH_TAC THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +w}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN RESA_TAC THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` w-x:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN RESA_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th`(inv(&1- t1)) * t3:real`) ;(*3*) POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"DICH") THEN DISCH_TAC THEN MP_TAC(REAL_ARITH` ~(t3' = &0) /\ &0 <= t3'==> &0 <t3'`) THEN RESA_TAC THEN MRESA1_TAC REAL_LT_INV`t3':real` THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t2:real`;] THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t3:real`;] THEN SUBGOAL_THEN `(w':real^3) IN aff_gt {x} {v,w:real^3}` ASSUME_TAC THENL(*4*)[ ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`(&1 - inv t3' * t2 - inv t3' * t3:real)` THEN EXISTS_TAC`inv t3' * t2:real` THEN EXISTS_TAC`(inv t3' * t3:real)` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC;(*4*) REMOVE_THEN "DICH" MP_TAC THEN REMOVE_THEN "VUT" MP_TAC THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; ` (w':real^3)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN RESA_TAC THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `w':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN MRESA_TAC exists_element_in_half_sapace_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`;` v:real^3`;`u:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; ` (w':real^3)`] THEN MRESAL_TAC exists_cut_small_edges_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1`;`w':real^3`;`u':real^3`][REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN MRESAL_TAC not_cut_in_edges_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] [REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER aff_ge {x} e = {}`] THEN POP_ASSUM(fun th-> MRESA1_TAC th`{w',u':real^3}`) THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`w':real^3`;`u':real^3`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]](*4*)](*3*);(*2*) ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_THEN(LABEL_TAC"BO") THEN MP_TAC(REAL_ARITH` ~(t3' = &0) /\ &0 <= t3'==> &0 <t3'`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH` ~(t2' = &0) /\ &0 <= t2'==> &0 <t2'`) THEN RESA_TAC THEN MRESA1_TAC REAL_LT_INV`t2':real` THEN MRESA1_TAC REAL_MUL_LINV`t2':real` THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t2:real`;] THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t3:real`;] THEN MRESA1_TAC REAL_LT_INV`t3':real` THEN MRESA1_TAC REAL_MUL_LINV`t3':real` THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t2:real`;] THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t3:real`;] THEN SUBGOAL_THEN`(x':real^3) IN aff_gt {x} {v',w'}` ASSUME_TAC THENL(*3*)[ MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v':real^3`;`w':real^3`][IN_ELIM_THM] THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`t1':real` THEN EXISTS_TAC`t2':real` THEN EXISTS_TAC`t3':real` THEN ASM_REWRITE_TAC[] ;(*3*) SUBGOAL_THEN`(x':real^3) IN aff_ge {x} {v',w'}` ASSUME_TAC THENL(*4*)[ ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`t1':real` THEN EXISTS_TAC`t2':real` THEN EXISTS_TAC`t3':real` THEN ASM_REWRITE_TAC[];(*4*) SUBGOAL_THEN `(x':real^3) IN aff_gt {x} {v,w:real^3}` ASSUME_TAC THENL(*5*)[ ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`t1:real` THEN EXISTS_TAC`t2:real` THEN EXISTS_TAC`t3:real` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC;(*5*) SUBGOAL_THEN `(x':real^3) IN aff_ge {x} {v,w:real^3}` ASSUME_TAC THENL(*6*)[ MRESA_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`w:real^3`] THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC`t1:real` THEN EXISTS_TAC`t2:real` THEN EXISTS_TAC`t3:real` THEN MP_TAC(REAL_ARITH`&0< t2==> &0 <= t2`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0< t3==> &0 <= t3`) THEN RESA_TAC THEN ASM_REWRITE_TAC[];(*6*) FIND_ASSUM MP_TAC`{v',w':real^3} IN E` THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN DISCH_TAC THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; ` (w':real^3)`] THEN SUBGOAL_THEN `~collinear {x, x', w':real^3}` ASSUME_TAC THENL(*7*)[ ASM_REWRITE_TAC[collinear1_fan;] THEN FIND_ASSUM MP_TAC `~((v':real^3) IN aff{x,w'})` THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v' + t3' % w' = u' % x + v'' % w' <=> t2' % v' = (u'-t1') % x + (v''-t3') % w'`] THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2' % v' = (u'-t1') % x + (v''-t3') % w':real^3 ==> (inv ( t2'))%(t2' % v') = (inv (t2'))%((u'-t1') % x + (v''-t3') % w') `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC `(inv t2' * (u' - t1':real))` THEN EXISTS_TAC `(inv t2' * (v'' - t3':real))` THEN ASM_REWRITE_TAC[REAL_ARITH`inv t2' * (u' - t1') + inv t2' * (v'' - t3')=inv t2'* (t2'+ (u'+v'') - (t1'+t2'+t3'))`;REAL_ARITH`t2'+ &1 - &1=t2'`] ;(*7*) SUBGOAL_THEN `~collinear {x, x', v':real^3}` ASSUME_TAC THENL(*8*)[ ASM_REWRITE_TAC[collinear1_fan;] THEN FIND_ASSUM MP_TAC `~((w':real^3) IN aff{x,v'})` THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v' + t3' % w' = u' % x + v'' % v' <=> t3' % w' = (u'-t1') % x + (v''-t2') % v'`] THEN STRIP_TAC THEN MP_TAC(SET_RULE` t3' % w' = (u'-t1') % x + (v''-t2') % v':real^3 ==> (inv ( t3'))%(t3' % w') = (inv (t3'))%((u'-t1') % x + (v''-t2') % v') `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC `(inv t3' * (u' - t1':real))` THEN EXISTS_TAC `(inv t3' * (v'' - t2':real))` THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3' * (u' - t1') + inv t3' * (v'' - t2')=inv t3'* (t3'+ (u'+v'') - (t1'+t2'+t3'))`;REAL_ARITH`t3'+ &1 - &1=t3'`] ;(*8*) SUBGOAL_THEN`~collinear {x, x', w:real^3}` ASSUME_TAC THENL(*9*)[ REMOVE_THEN "BO" MP_TAC THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN ASM_REWRITE_TAC[collinear1_fan;] THEN FIND_ASSUM MP_TAC`~(w IN aff {x, v:real^3})` THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % (va) = u' % x + v' % (va)<=> (&1-(t1+t2+t3)) % x + (v'-t3) % (va-x) = (&1-(u'+v') ) % x + t2 % (v-x)`;REAL_ARITH`a-a= &0`] THEN REDUCE_VECTOR_TAC THEN DISJ_CASES_TAC(REAL_ARITH`(v'' - t3 = &0) \/ ~(v'' - (t3:real)= &0)`) THENL(*10*)[ ASM_REWRITE_TAC[VECTOR_ARITH`&0 %A=B<=> B= vec 0`;VECTOR_MUL_EQ_0] THEN MP_TAC(REAL_ARITH`&0< t2==> ~(t2 = &0)`) THEN RESA_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> A=B`];(*10*) MRESA1_TAC REAL_MUL_LINV `(v''-t3:real)` THEN STRIP_TAC THEN MP_TAC(SET_RULE`(v'' - t3) % (w- x) = t2 % (v - x:real^3) ==> (inv (v'' -t3)) % ((v'' - t3) % (w - x)) = (inv (v'' -t3)) % ( t2 % (v - x))`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) THEN REWRITE_TAC[VECTOR_ARITH`&1 % (va - x) = (inv (v' - t3) * t2) % (v - x)<=> va = (&1-(inv (v' - t3) * t2))%x +(inv (v' - t3) * t2) % v:real^3`] THEN STRIP_TAC THEN EXISTS_TAC`&1-(inv (v'' - t3) * (t2:real))` THEN EXISTS_TAC`(inv (v'' - t3) * (t2:real))` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC](*10*);(*9*) SUBGOAL_THEN `~collinear {x, x', v:real^3}` ASSUME_TAC THENL(*10*)[ REMOVE_THEN "BO" MP_TAC THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN ASM_REWRITE_TAC[collinear1_fan] THEN FIND_ASSUM MP_TAC `~(w IN aff {x, v:real^3})` THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v' + t3' % w' = u' % x + v'' % v' <=> t3' % w' = (u'-t1') % x + (v''-t2') % v'`] THEN MP_TAC(REAL_ARITH`&0< t3 ==> ~(t3= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`t3:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE` t3 % w = (u'-t1) % x + (v''-t2) % v:real^3 ==> (inv ( t3))%(t3 % w) = (inv (t3))%((u'-t1) % x + (v''-t2) % v) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC `(inv t3 * (u' - t1:real))` THEN EXISTS_TAC `(inv t3 * (v'' - t2:real))` THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3' * (u' - t1') + inv t3' * (v'' - t2')=inv t3'* (t3'+ (u'+v'') - (t1'+t2'+t3'))`;REAL_ARITH`t3'+ &1 - &1=t3'`] ;(*10*) REMOVE_THEN "VUT1" MP_TAC THEN REMOVE_THEN "VUT1" MP_TAC THEN REMOVE_THEN "BO" MP_TAC THEN REMOVE_THEN "VUT" MP_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN DISJ_CASES_TAC(SET_RULE`(&0 < azim x (x':real^3) v w' /\ azim x (x') v w' < pi)\/ ~(&0 < azim x (x') v w' /\ azim x (x') v w' < pi)`) THENL(*11*)[ MRESAL_TAC exists_cut_small_edges_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`;`x':real^3`;`w':real^3`][REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] THEN MRESAL_TAC not_cut_in_edges_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] [REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER aff_ge {x} e = {}`] THEN POP_ASSUM(fun th-> MRESA1_TAC th`{v',w':real^3}`) THEN MRESA_TAC aff_gt1_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[] ;(*11*) ASSUME_TAC(ISPECL[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`]azim) THEN ASSUME_TAC(PI_WORKS) THEN MP_TAC(REAL_ARITH`~(&0 < azim x x' v w' /\ azim x x' v w' < pi)/\ &0 <= azim x x' v w' /\ &0< pi==> pi< azim x x' v w' \/(azim x x' v w'= &0 \/ azim x x' v w'=pi) `) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*12*)(*3GOAL*)[ POP_ASSUM MP_TAC THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3 `;`x':real^3`] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN DISCH_TAC THEN MP_TAC(REAL_ARITH`azim x x' v' w' < azim x x' v w'==>azim x x' v' w' <= azim x x' v w'`) THEN RESA_TAC THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`;`w':real^3`] THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3 `;`x':real^3`] THEN DISCH_TAC THEN DISCH_TAC THEN MP_TAC(REAL_ARITH`pi < azim x x' v w' /\ azim x x' v w' = azim x x' v v' + pi /\ azim x x' v w' < &2 * pi==> &0 <azim x x' v v' /\ azim x x' v v' < pi`) THEN RESA_TAC THEN MRESAL_TAC exists_cut_small_edges_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`;`x':real^3`;`v':real^3`][REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] THEN MRESAL_TAC not_cut_in_edges_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] [REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER aff_ge {x} e = {}`] THEN POP_ASSUM(fun th-> MRESA1_TAC th`{w',v':real^3}`) THEN MRESA_TAC aff_gt1_subset_aff_ge[`x:real^3`;`w':real^3`;`v':real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[];(*12*) MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`v:real^3`;`w':real^3`] THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`x':real^3`;`v:real^3`;`w':real^3`] THEN MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`w':real^3`;`v:real^3`] THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`w':real^3`;`v:real^3`] THEN DISJ_CASES_TAC(SET_RULE`w' IN aff_gt {x} {v,w:real^3}\/ ~(w' IN aff_gt {x} {v,w:real^3})`) THENL(*13*)[ MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") THEN DISCH_TAC THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC THEN ASSUME_TAC(th)) THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`w' = t1'' % x + t2'' % v + t3'' % va<=> ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= w' -x:real^3`;REAL_ARITH`&1- &1 = &0`] THEN REDUCE_VECTOR_TAC THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2'' + t3'' = &1 - t1'':real ==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] THEN STRIP_TAC THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)*(t3'':real)==> ~(inv(&1- t1'':real)*(t3'':real)= &0)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)==> ~(inv(&1- t1'':real)= &0)`) THEN RESA_TAC THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) THEN STRIP_TAC THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, w}= {(--x) +x, (--x) +v, (--x) +u, (--x) + w}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` w-x:real^3`] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `w'-x:real^3`] [VECTOR_ARITH`&1 %A=A`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,w'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + w'}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] THEN DISCH_TAC THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `w':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN MRESA_TAC exists_element_in_half_sapace_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`;` v:real^3`;`u:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; ` (w':real^3)`] THEN MRESAL_TAC exists_cut_small_edges_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`;`w':real^3`;`u':real^3`][REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] THEN MRESAL_TAC not_cut_in_edges_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] [REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER aff_ge {x} e = {}`] THEN POP_ASSUM(fun th-> MRESA1_TAC th`{w',u':real^3}`) THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`w':real^3`;`u':real^3`;] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[];(*13*) DISJ_CASES_TAC(SET_RULE`v' IN aff_gt {x} {v,w:real^3}\/ ~(v' IN aff_gt {x} {v,w:real^3})`) THENL(*14*)[ MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") THEN DISCH_TAC THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC THEN ASSUME_TAC(th)) THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`v' = t1'' % x + t2'' % v + t3'' % va<=> ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= v' -x:real^3`;REAL_ARITH`&1- &1 = &0`] THEN REDUCE_VECTOR_TAC THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2'' + t3'' = &1 - t1'':real ==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] THEN STRIP_TAC THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)*(t3'':real)==> ~(inv(&1- t1'':real)*(t3'':real)= &0)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)==> ~(inv(&1- t1'':real)= &0)`) THEN RESA_TAC THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) THEN STRIP_TAC THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN STRIP_TAC THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +w}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN STRIP_TAC THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` w-x:real^3`] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `v'-x:real^3`] [VECTOR_ARITH`&1 %A=A`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,v'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + v'}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, v'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] THEN DISCH_TAC THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `v':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN MRESA_TAC exists_element_in_half_sapace_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;` v:real^3`;`u:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; ` (v':real^3)`] THEN MRESAL_TAC exists_cut_small_edges_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`;`v':real^3`;`u':real^3`][REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] THEN MRESAL_TAC not_cut_in_edges_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] [REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER aff_ge {x} e = {}`] THEN POP_ASSUM(fun th-> MRESA1_TAC th`{v',u':real^3}`) THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v':real^3`;`u':real^3`;] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[];(*14*) SUBGOAL_THEN`~(w' IN aff_gt {x} { x',v:real^3})` ASSUME_TAC THENL(*15*)[ REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN MRESA_TAC aff_gt3_subset_aff_gt[`x:real^3`;`v:real^3`;`w:real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[] ;(*15*) MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v:real^3`;`w':real^3`] decomposition_planar_by_angle_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*16*)[ MRESA_TAC aff_gt1_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`] THEN MP_TAC(SET_RULE`v IN aff_gt {x} {x', w':real^3} /\ aff_gt {x} {x', w'} SUBSET aff_ge {x} {v', w'} ==>v IN aff_ge {x} {v', w':real^3}`) THEN RESA_TAC THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*17*)[ MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)]) THEN MP_TAC(PI_WORKS) THEN REAL_ARITH_TAC;(*17*) MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] THEN DISCH_TAC THEN REWRITE_TAC[th]) THEN MRESA_TAC AZIM_EQ_PI_SYM [`x:real^3`;`x':real^3`; `v':real^3`;`v:real^3`] THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`w:real^3`;`v':real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`w:real^3`;`v':real^3`] THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v':real^3`;`w:real^3`] decomposition_planar_by_angle_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*18*)[ MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] THEN ASM_TAC THEN SET_TAC[];(*18*) MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`w':real^3`; `v':real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN STRIP_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE`w IN aff_ge {x} {v', x':real^3} /\ aff_ge {x} {v', x'} SUBSET aff_ge {x} {v', w'} ==>w IN aff_ge {x} {v', w':real^3}`) THEN RESA_TAC THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `w:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN STRIP_TAC THENL(*19*)[ ASM_REWRITE_TAC[];(*19*) 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 POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "XONG") THEN DISCH_TAC THEN REMOVE_THEN "XONG" MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC PI_WORKS THEN REAL_ARITH_TAC ](*19*)](*18*)](*17*);(*16*) POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN DISCH_TAC THEN MRESA_TAC aff_ge_subset_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;`(x':real^3)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(SET_RULE`aff_ge {x} {v, x':real^3} SUBSET aff_gt {x, v} {x'} UNION aff_ge {x} {v} /\ w' IN aff_ge {x} {v, x'} ==> w' IN aff_gt {x, v} {x'} UNION aff_ge {x} {v}`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(x':real^3)`;`(v:real^3)`] THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;UNION] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `w':real^3`; `v':real^3`; `v:real^3`;`u:real^3`]properties1_of_fan7) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) THEN DISCH_TAC THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v':real^3)`;`(w':real^3)`] THEN SUBGOAL_THEN`v IN aff_ge {x} {v', w':real^3}`ASSUME_TAC THENL(*17*)[ POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[];(*17*) POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"NHAT") THEN DISCH_TAC THEN REMOVE_THEN "NHAT" MP_TAC THEN DISCH_TAC THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] THEN STRIP_TAC THEN REWRITE_TAC[th]) THEN MRESA_TAC AZIM_EQ_PI_SYM [`x:real^3`;`x':real^3`; `v':real^3`;`v:real^3`] THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`w:real^3`;`v':real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`w:real^3`;`v':real^3`] THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v':real^3`;`w:real^3`] decomposition_planar_by_angle_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*18*)[ MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] THEN ASM_TAC THEN SET_TAC[];(*18*) MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`w':real^3`; `v':real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN STRIP_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE`w IN aff_ge {x} {v', x':real^3} /\ aff_ge {x} {v', x'} SUBSET aff_ge {x} {v', w'} ==>w IN aff_ge {x} {v', w':real^3}`) THEN RESA_TAC THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `w:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN STRIP_TAC THENL(*19*)[ ASM_REWRITE_TAC[];(*19*) 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 POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "XONG") THEN DISCH_TAC THEN REMOVE_THEN "XONG" MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC PI_WORKS THEN REAL_ARITH_TAC](*19*)](*18*)](*17*)]]]];(*12*) POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"CUOI") THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3 `;`x':real^3`] THEN ASSUME_TAC(REAL_ARITH`pi<= pi`) THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`;`w':real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`A=B+A<=>B= &0`] THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`] THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`] THEN MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`v':real^3`;`v:real^3`] THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`v':real^3`;`v:real^3`] THEN DISJ_CASES_TAC(SET_RULE`w' IN aff_gt {x} {v,w:real^3}\/ ~(w' IN aff_gt {x} {v,w:real^3})`) THENL(*13*)[ MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") THEN DISCH_TAC THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC THEN ASSUME_TAC(th)) THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`w' = t1'' % x + t2'' % v + t3'' % va<=> ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= w' -x:real^3`;REAL_ARITH`&1- &1 = &0`] THEN REDUCE_VECTOR_TAC THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2'' + t3'' = &1 - t1'':real ==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] THEN STRIP_TAC THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)*(t3'':real)==> ~(inv(&1- t1'':real)*(t3'':real)= &0)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)==> ~(inv(&1- t1'':real)= &0)`) THEN RESA_TAC THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) THEN STRIP_TAC THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, w}= {(--x) +x, (--x) +v, (--x) +u, (--x) + w}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;`w-x:real^3`] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `w'-x:real^3`] [VECTOR_ARITH`&1 %A=A`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,w'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + w'}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] THEN DISCH_TAC THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `w':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN MRESA_TAC exists_element_in_half_sapace_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`;` v:real^3`;`u:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; ` (w':real^3)`] THEN MRESAL_TAC exists_cut_small_edges_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`;`w':real^3`;`u':real^3`] [REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] THEN MRESAL_TAC not_cut_in_edges_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] [REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER aff_ge {x} e = {}`] THEN POP_ASSUM(fun th-> MRESA1_TAC th`{w',u':real^3}`) THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`w':real^3`;`u':real^3`;] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[];(*13*) DISJ_CASES_TAC(SET_RULE`v' IN aff_gt {x} {v,w:real^3}\/ ~(v' IN aff_gt {x} {v,w:real^3})`) THENL(*14*)[ MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") THEN DISCH_TAC THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC THEN ASSUME_TAC(th)) THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`v' = t1'' % x + t2'' % v + t3'' % va<=> ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= v' -x:real^3`;REAL_ARITH`&1- &1 = &0`] THEN REDUCE_VECTOR_TAC THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2'' + t3'' = &1 - t1'':real ==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] THEN STRIP_TAC THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)*(t3'':real)==> ~(inv(&1- t1'':real)*(t3'':real)= &0)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0<inv(&1- t1'':real)==> ~(inv(&1- t1'':real)= &0)`) THEN RESA_TAC THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) THEN STRIP_TAC THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +w}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` w-x:real^3`] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `v'-x:real^3`] [VECTOR_ARITH`&1 %A=A`] THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,v'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + v'}`) THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, v'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] THEN DISCH_TAC THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `v':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN MRESA_TAC exists_element_in_half_sapace_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;` v:real^3`;`u:real^3`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; ` (v':real^3)`] THEN MRESAL_TAC exists_cut_small_edges_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`;`v':real^3`;`u':real^3`] [REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] THEN MRESAL_TAC not_cut_in_edges_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] [REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e} = {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER aff_ge {x} e = {}`] THEN POP_ASSUM(fun th-> MRESA1_TAC th`{v',u':real^3}`) THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v':real^3`;`u':real^3`;] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[];(*14*) SUBGOAL_THEN`~(v' IN aff_gt {x} { x',v:real^3})` ASSUME_TAC THENL(*15*)[ REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN MRESA_TAC aff_gt3_subset_aff_gt[`x:real^3`;`v:real^3`;`w:real^3`;`x':real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN SET_TAC[];(*15*) MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`] decomposition_planar_by_angle_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*16*)[ MRESA_TAC aff_gt12_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`] THEN MP_TAC(SET_RULE`v IN aff_gt {x} {x', v':real^3} /\ aff_gt {x} {x', v'} SUBSET aff_ge {x} {v', w'} ==>v IN aff_ge {x} {v', w':real^3}`) THEN RESA_TAC THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*17*)[ MRESA_TAC aff_gt2_subset_aff_ge [`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`w:real^3`;`w':real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`w:real^3`;`w':real^3`] THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`w':real^3`;`w:real^3`] decomposition_planar_by_angle_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*18*)[ MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] THEN ASM_TAC THEN SET_TAC[];(*18*) MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] THEN ASM_TAC THEN SET_TAC[]](*18*);(*17*) REMOVE_THEN "CUOI" MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN REWRITE_TAC[AZIM_REFL] THEN MP_TAC(PI_WORKS) THEN REAL_ARITH_TAC](*17*);(*16*) POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN DISCH_TAC THEN MRESA_TAC aff_ge_subset_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;`(x':real^3)`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(SET_RULE`aff_ge {x} {v, x':real^3} SUBSET aff_gt {x, v} {x'} UNION aff_ge {x} {v} /\ v' IN aff_ge {x} {v, x'} ==> v' IN aff_gt {x, v} {x'} UNION aff_ge {x} {v}`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(x':real^3)`;`(v:real^3)`] THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;UNION] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v':real^3`; `w':real^3`; `v:real^3`;`u:real^3`]properties1_of_fan7) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) THEN DISCH_TAC THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v':real^3)`;`(w':real^3)`] THEN MRESA_TAC aff_gt2_subset_aff_ge [`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`w:real^3`;`w':real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] THEN DISCH_TAC THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`w:real^3`;`w':real^3`] THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`w':real^3`;`w:real^3`] decomposition_planar_by_angle_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*17*)[ MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] THEN ASM_TAC THEN SET_TAC[];(*17*) MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] THEN MP_TAC(SET_RULE`w IN aff_ge {x} { x',w':real^3} /\ aff_ge {x} { x',w'} SUBSET aff_ge {x} {v', w'} ==>w IN aff_ge {x} {v', w':real^3}`) THEN RESA_TAC THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `w:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN STRIP_TAC THENL(*18*)[ 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 DISCH_THEN(LABEL_TAC "XONG") THEN DISCH_TAC THEN REMOVE_THEN "XONG" MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC PI_WORKS THEN REAL_ARITH_TAC;(*18*) ASM_REWRITE_TAC[]](*18*)]]]]]]]]]]]]]]]]]);;
let DHVFGBC=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<a /\ a<= &1 /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ ~(aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={}) ==> a= &1 /\ independent {v - x, u - x, ((&1 - a) % u + a % w) - x}`,
(**********************************************************) (********************** RWXUYZZ *************************) (**********************************************************)
let exists_in_aff_gt=
prove(`!x:real^3 v:real^3 u:real^3. ~collinear {x,v,u} ==> ?y:real^3. y IN aff_gt {x} {v, u}`,
REPEAT STRIP_TAC THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN EXISTS_TAC`&0 % x+ &1 / &2 % v+ &1/ &2 %u:real^3 ` THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1/ &2` THEN EXISTS_TAC`&1/ &2` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);;
let cut_inside_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3 w1:real^3. ~collinear {x,v,w1} /\ ~collinear {x,u,w} /\ ~collinear {x,v,u} /\ ~collinear {x,v,w} /\ &0< azim x u w v /\ azim x u w v < pi /\ &0< azim x v u w1 /\ azim x v u w1 < pi /\ &0< azim x v w1 w /\ azim x v w1 w < pi ==> ~(aff_ge {x,v} {w1} INTER aff_gt {x} {u,w:real^3}={})`,
REWRITE_TAC[SET_RULE`~(A={})<=> ?x. x IN A`;IN_ELIM_THM; INTER] THEN REPEAT STRIP_TAC THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w1:real^3`] THEN MRESA_TAC th3[`x:real^3`;`u:real^3`;`w:real^3`] THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"CON") THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`w1:real^3`;`u:real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"CON BE") THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"CON EM") THEN ABBREV_TAC`a1=(v-x):real^3` THEN ABBREV_TAC`a2=(w1-x):real^3` THEN ABBREV_TAC`a3=(w-x) :real^3` THEN ABBREV_TAC`a4=(u-x):real^3` THEN ABBREV_TAC`va=a1 cross a2:real^3` THEN ABBREV_TAC`vb=a3 cross a4:real^3` THEN EXISTS_TAC`(vb:real^3) cross (va:real^3)+(x:real^3)` THEN STRIP_TAC THENL(*2*)[ EXISTS_TAC`&1-(vb:real^3) dot (a2:real^3)+ vb dot (a1:real^3)` THEN EXISTS_TAC`(vb:real^3) dot (a2:real^3)` THEN EXISTS_TAC`--((vb:real^3) dot (a1:real^3))` THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - vb dot a2 + vb dot a1) + vb dot a2 + --(vb dot a1) = &1`] THEN SUBGOAL_THEN `&0<= --((vb:real^3) dot (a1:real^3))` ASSUME_TAC THENL(*3*)[ EXPAND_TAC"vb" THEN ONCE_REWRITE_TAC[CROSS_SKEW;] THEN REWRITE_TAC[DOT_LNEG] THEN REMOVE_THEN "CON"MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; ASM_REWRITE_TAC[] THEN EXPAND_TAC"va" THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_MUL_LNEG] THEN EXPAND_TAC"a1" THEN EXPAND_TAC"a2" THEN VECTOR_ARITH_TAC];(*2*) ONCE_REWRITE_TAC[CROSS_SKEW] THEN EXPAND_TAC"vb" THEN REWRITE_TAC[CROSS_LAGRANGE;] THEN EXISTS_TAC`&1+(va:real^3) dot (a4:real^3)- va dot (a3:real^3)` THEN EXISTS_TAC`((va:real^3) dot (a3:real^3))` THEN EXISTS_TAC`--(va:real^3) dot (a4:real^3)` THEN ASM_REWRITE_TAC[DOT_LNEG;VECTOR_MUL_LNEG;REAL_ARITH`(&1 + va dot a4 - va dot a3) + va dot a3 + --(va dot a4) = &1`;] THEN STRIP_TAC THENL(*3*)[ EXPAND_TAC"va" THEN ONCE_REWRITE_TAC[CROSS_SKEW;] THEN REWRITE_TAC[DOT_LNEG;CROSS_TRIPLE] THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC; EXPAND_TAC"a3" THEN EXPAND_TAC"a4" THEN REWRITE_TAC[VECTOR_ARITH`(&1+A-B)%X+B%U+ --(A%V)=X-(A%(V-X)-B%(U-X))`] THEN VECTOR_ARITH_TAC]]);;
let exists_cut_in_edge_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3 w1:real^3. ~collinear {x,v,w1} /\ ~collinear {x,u,w} /\ ~collinear {x,v,u} /\ ~collinear {x,v,w} /\ &0< azim x u w v /\ azim x u w v < pi /\ &0< azim x v u w1 /\ azim x v u w1 < pi /\ &0< azim x v w1 w /\ azim x v w1 w < pi ==> ?a. &0< a /\ a< &1 /\ (&1-a) %u + a % w IN aff_ge {x,v} {w1:real^3}`,
REPEAT STRIP_TAC THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w1:real^3`] THEN MRESA_TAC th3[`x:real^3`;`u:real^3`;`w:real^3`] THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] THEN MRESA_TAC cut_inside_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SET_RULE`~(A={})<=> ?x. x IN A`;INTER;] THEN REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC`inv(&1-t1')*t3'` THEN MP_TAC(REAL_ARITH`&0< t2' /\ &0< t3' /\ t1'+t2'+t3'= &1==> &0 < &1- t1' /\ ~(&1- t1' = &0)/\ t2'+t3'= &1- t1'`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPEC`&1- (t1':real)`REAL_LT_INV) THEN RESA_TAC THEN MP_TAC(ISPEC`&1- (t1':real)`REAL_MUL_LINV) THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` t2' + t3' = &1 - t1':real ==> (inv ( &1 - t1'))*(t2' + t3') = (inv ( &1 - t1'))*( &1 - t1':real) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1 -A*C=A*B`;REAL_ARITH`A< &1 <=> &0< &1-A`] THEN STRIP_TAC THEN MRESA_TAC REAL_LT_MUL[`inv (&1- t1'):real`;`t2':real`;] THEN MRESA_TAC REAL_LT_MUL[`inv (&1- t1'):real`;`t3':real`;] THEN REWRITE_TAC[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`; VECTOR_ARITH`A%(t2' % u + t3' % w)= A%((t1'%x +t2' % u + t3' % w) - t1' %x) :real^3`] THEN FIND_ASSUM MP_TAC`x' = t1' % x + t2' % u + t3' % w:real^3` THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`(t1 % x + t2 % v + t3 % w1) - t1' % x=(t1-t1') % x + t2 % v + t3 % w1`; VECTOR_ARITH`A%(B+C+D)=A%B+A%C+A%D`;VECTOR_ARITH`A%B%C=(A*B)%C`] THEN EXISTS_TAC`(inv (&1 - t1') * (t1 - t1')):real` THEN EXISTS_TAC`(inv (&1 - t1') * t2):real` THEN EXISTS_TAC`(inv (&1 - t1') * t3):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - t1') * (t1 - t1') + inv (&1 - t1') * t2 + inv (&1 - t1') * t3 =inv (&1 - t1') * ((t1 +t2 + t3)-t1')`] THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC);;
let notcoplanar_imp_notcollinear_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3. ~coplanar {x,v,u,w}==> ~collinear {x,u,w} /\ ~collinear {x,v,u} /\ ~collinear {x,v,w}`,
REPEAT GEN_TAC THEN STRIP_TAC THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] THEN RESA_TAC THEN MRESAL_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`v:real^3`;`w:real^3`;`u:real^3`][SET_RULE`{A,B,C,D}={A,B,D,C}`]);;
let properties_of_fully_surrounded1_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3 w1:real^3. ~coplanar {x,v,u,w}/\ &0< azim x u w v /\ azim x u w v < pi ==> &0 < azim x v u w /\ azim x v u w < pi`,
REPEAT STRIP_TAC THEN MRESA_TAC azim[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`;`(w:real^3)`] THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THENL[ MP_TAC(REAL_ARITH` &0<= azim x v u (w:real^3) ==> azim x v u w = &0 \/ &0< azim x v u w`) THEN RESA_TAC THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]; MP_TAC(REAL_ARITH` (azim x v u w = pi) \/ (pi < azim x v u w) \/ azim x v u w< pi`) THEN RESA_TAC THENL[ MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]; MP_TAC(REAL_ARITH`pi< azim x v u w /\ azim x v u w < &2 * pi ==> &0< azim x v u w - pi /\ azim x v u w - pi< pi`) THEN RESA_TAC THEN MRESAL1_TAC SIN_POS_PI`azim x v u (w:real^3) -pi`[SIN_SUB; SIN_PI; COS_PI;REAL_ARITH`&0< A * -- &1 -B * &0 <=> A < &0`] THEN POP_ASSUM MP_TAC THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`v:real^3`;` u:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] THEN DISCH_TAC THEN MRESA_TAC JBDNJJB[`(v-x):real^3`;`u-x:real^3`;`w-x:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM COLLINEAR_3;] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN RESA_TAC THEN STRIP_TAC THEN MRESAL_TAC REAL_LT_LMUL_EQ[`(((v - x) cross (u - x)) dot (w - x:real^3))`;`&0`;`t:real`][REAL_ARITH`A * &0= &0`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[DOT_LNEG;CROSS_TRIPLE] THEN MRESA1_TAC SIN_POS_PI`azim x u (w:real^3) v` THEN POP_ASSUM MP_TAC THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`u:real^3`;` w:real^3`;`v:real^3`] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] THEN DISCH_TAC THEN MRESA_TAC JBDNJJB[`(u-x):real^3`;`w-x:real^3`;`v-x:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM COLLINEAR_3;] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN RESA_TAC THEN STRIP_TAC THEN MRESAL_TAC REAL_LT_LMUL_EQ[`&0`;`(((u - x) cross (w - x)) dot (v - x:real^3))`;`t':real`][REAL_ARITH`A * &0= &0`] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]) ;;
let in_aff_2_2_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3. ~coplanar {x,v,u,w} ==> (!t:real. &0< t /\ t< &1 ==> (!t1:real t2:real t3:real. &0<t3 /\ t1+t2+t3= &1 ==>t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w) IN aff_gt {x,v} {u,w}))`,
REPEAT STRIP_TAC THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] THEN MRESA_TAC th3[`x:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] THEN SUBGOAL_THEN `DISJOINT {x,v:real^3} {u,w:real^3}` ASSUME_TAC THENL[ REWRITE_TAC[DISJOINT_SYM;SET_RULE`{v:real^3,w:real^3}= {v} UNION {w}`;DISJOINT_UNION] THEN REWRITE_TAC[SET_RULE`{v} UNION {w}={v:real^3,w:real^3}`] THEN ONCE_REWRITE_TAC[DISJOINT_SYM] THEN ASM_REWRITE_TAC[]; MRESAL_TAC AFF_GT_2_2[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] THEN EXISTS_TAC`t1:real` THEN EXISTS_TAC`t2:real` THEN EXISTS_TAC`t3*(&1-t):real` THEN EXISTS_TAC`t3*(t):real` THEN ASM_REWRITE_TAC[REAL_ARITH`t1 +t2+ t3 * (&1 - t) + t3 * t = t1+t2+t3:real`;VECTOR_ARITH`t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w) = t1 % x + t2 % v + (t3 * (&1 - t)) % u + (t3 * t) % w:real^3`] THEN STRIP_TAC THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_TAC THEN REAL_ARITH_TAC]);;
let inequality4_aim_in_convex_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3 a:real. ~coplanar {x,v,u,w}/\ &0< azim x u w v /\ azim x u w v < pi /\ &0< a /\ a < &1 ==> &0< azim x v u ((&1 - a) % u + a % w) /\ azim x v u ((&1 - a) % u + a % w)< azim x v u w `,
REPEAT STRIP_TAC THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] THEN MRESA_TAC th3[`x:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] THEN MRESA_TAC properties_of_fully_surrounded1_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;` v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) THEN DISCH_TAC THEN MRESA_TAC in_aff_2_2_fan[`x:real^3`;` v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM(fun th-> MRESA1_TAC th `a:real`) THEN POP_ASSUM(fun th-> MRESAL_TAC th [`&0:real`;`&0`;`&1`][REAL_ARITH`&0< &1/\ &0+ &0 + &1 = &1`;wedge;IN_ELIM_THM]) THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REDUCE_VECTOR_TAC THEN DISCH_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[]);;
let condition_to_in_aff_gt_by_angle=
prove(`!x:real^3 v:real^3 u:real^3 s1:real. ~collinear {x,v,u} /\ &0< (v - x) dot (u - x) /\ &0< s1 /\ s1< atn ((norm ((v - x) cross (u - x))) * inv((v - x) dot (u - x))) ==> sin s1 % e1_fan x v u + cos s1 % e3_fan x v u + x IN aff_gt {x} {v, u}`,
REPEAT STRIP_TAC THEN ASSUME_TAC(ISPEC`(norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x))):real`ATN_BOUNDS) THEN MP_TAC (REAL_ARITH`s1< atn ((norm ((v - x) cross (u - x))) * inv((v - x) dot (u - x))) /\ atn ((norm ((v - x) cross (u - x))) * inv((v - x) dot (u - x))) < pi/ &2 ==> s1< pi / &2`) THEN RESA_TAC THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN REWRITE_TAC[VECTOR_ARITH`sin s1 % e1_fan x v u + cos s1 % e3_fan x v u + x = t1 % x + t2 % v + t3 % u <=> sin s1 % e1_fan x v u + cos s1 % e3_fan x v u = (t1- &1) % x + t2 % v + t3 % u`;e1_fan;e2_fan;e3_fan;CROSS_LMUL;CROSS_RMUL] THEN ONCE_REWRITE_TAC[CROSS_SKEW;] THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`-- (A-B) = B-A:real^3`] THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC THENL[ ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`]; MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) THEN RESA_TAC THEN REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(((A*B)*D)*D)=A*B*(D pow 2)`;] THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A%(B-C)=A%B-A%C`] THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;DOT_SQUARE_NORM;REAL_ARITH`(A*B*C pow 2) * D pow 2=A*B*(C*D) pow 2`;REAL_ARITH`A* &1 pow 2=A`;NORM_MUL;REAL_ABS_INV;REAL_ABS_NORM;REAL_INV_MUL;REAL_INV_INV ; ] THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B*C) * D pow 2= A*C * D*(D*B)`;REAL_ARITH`A*B* &1= A*B`;VECTOR_ARITH`A-B+C%D-C%E=A-B+C%(D-E)`;VECTOR_ARITH`A-C%D+B%D=A+(B-C)%D`; REAL_ARITH`A*B-(C*D*B)*E=B*(A-C*D*E)`] THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] THEN SUBGOAL_THEN`~(norm((v - x) cross (u - x:real^3))= &0)` ASSUME_TAC THENL[ ASM_REWRITE_TAC[NORM_EQ_0] THEN MP_TAC(ISPECL[`v-x:real^3`;`u-x:real^3`]CROSS_EQ_0) THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3;] THEN RESA_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN ASM_REWRITE_TAC[]; MP_TAC(ISPEC`norm((v - x) cross (u - x:real^3))`REAL_MUL_LINV) THEN RESA_TAC THEN ASSUME_TAC(ISPEC`(v - x) cross (u - x:real^3)`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(norm ((v - x) cross (u - x:real^3)) = &0)/\ &0 <= norm ((v - x) cross (u - x:real^3))==> &0< norm ((v - x) cross (u - x:real^3)) `) THEN RESA_TAC THEN MRESA1_TAC REAL_LT_INV`norm((v - x) cross (u - x:real^3))` THEN ASSUME_TAC(ISPEC`(v - x:real^3)`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(norm ((v - x:real^3)) = &0)/\ &0 <= norm ((v - x:real^3))==> &0< norm ((v - x:real^3)) `) THEN RESA_TAC THEN MRESA1_TAC REAL_LT_INV`norm((v - x:real^3))` THEN MRESA1_TAC COS_POS_PI2`s1:real` THEN MRESA1_TAC SIN_POS_PI2`s1:real` THEN EXISTS_TAC`&1-(sin s1 * norm (v - x) * inv (norm ((v - x) cross (u - x)))) -(inv (norm (v - x)) * (cos s1 - sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x:real^3))))` THEN EXISTS_TAC `(inv (norm (v - x)) * (cos s1 - sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x:real^3))))` THEN EXISTS_TAC`(sin s1 * norm (v - x) * inv (norm ((v - x) cross (u - x:real^3))))` THEN STRIP_TAC THENL[ MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[REAL_ARITH`&0<A-B<=> B<A`] THEN ASSUME_TAC(PI_WORKS) THEN MP_TAC(REAL_ARITH`&0< pi /\ &0< s1 ==> --(pi / &2) < s1`) THEN RESA_TAC THEN MRESAL_TAC TAN_MONO_LT[`s1:real`;`atn (norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x))):real`][ATN_TAN] THEN MRESAL_TAC REAL_LT_LMUL[`inv (norm ((v - x) cross (u - x:real^3)))`;`tan s1:real`;`norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x:real^3))`][REAL_ARITH`A*B*C=(A*B)*C`;REAL_ARITH`&1*A=A`] THEN MP_TAC(REAL_ARITH`&0<(v - x) dot (u - x:real^3)==> ~((v - x) dot (u - x:real^3)= &0)`) THEN RESA_TAC THEN MP_TAC(ISPEC`(v - x) dot (u - x:real^3)`REAL_MUL_LINV) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0<cos s1 ==> ~(cos s1= &0)`) THEN RESA_TAC THEN MP_TAC(ISPEC`cos s1`REAL_MUL_LINV) THEN RESA_TAC THEN MRESAL_TAC REAL_LT_RMUL[`inv (norm ((v - x) cross (u - x:real^3)))* tan s1:real`;`inv ((v - x) dot (u - x:real^3))`;`(v - x) dot (u - x:real^3)`][REAL_ARITH`(A*B)*C=A*C*B`;tan] THEN MRESAL_TAC REAL_LT_RMUL[`inv (norm ((v - x) cross (u - x:real^3)))* ((v - x) dot (u - x:real^3))* sin s1 / cos s1`;`&1`;`cos s1`][REAL_ARITH`&1* A=A`;real_div;REAL_ARITH`(A*B*C*D)*E=(C*A*B)*(D*E)`;REAL_ARITH`A* &1=A`] THEN ASM_TAC THEN REAL_ARITH_TAC; STRIP_TAC THENL[ MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[]; STRIP_TAC THENL[ REAL_ARITH_TAC; VECTOR_ARITH_TAC]]]]]);;
let condition1_to_in_aff_gt_by_angle=
prove(`!x:real^3 v:real^3 u:real^3 s1:real. ~collinear {x,v,u} /\ &0< s1 /\ s1< pi/ &2 /\ (v - x) dot (u - x:real^3) <= &0 ==> sin s1 % e1_fan x v u + cos s1 % e3_fan x v u + x IN aff_gt {x} {v, u}`,
REPEAT STRIP_TAC THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN REWRITE_TAC[VECTOR_ARITH`sin s1 % e1_fan x v u + cos s1 % e3_fan x v u + x = t1 % x + t2 % v + t3 % u <=> sin s1 % e1_fan x v u + cos s1 % e3_fan x v u = (t1- &1) % x + t2 % v + t3 % u`;e1_fan;e2_fan;e3_fan;CROSS_LMUL;CROSS_RMUL] THEN ONCE_REWRITE_TAC[CROSS_SKEW;] THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`-- (A-B) = B-A:real^3`] THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC THENL[ ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`]; MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) THEN RESA_TAC THEN REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(((A*B)*D)*D)=A*B*(D pow 2)`;] THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A%(B-C)=A%B-A%C`] THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;DOT_SQUARE_NORM;REAL_ARITH`(A*B*C pow 2) * D pow 2=A*B*(C*D) pow 2`;REAL_ARITH`A* &1 pow 2=A`;NORM_MUL;REAL_ABS_INV;REAL_ABS_NORM;REAL_INV_MUL;REAL_INV_INV ; ] THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B*C) * D pow 2= A*C * D*(D*B)`;REAL_ARITH`A*B* &1= A*B`;VECTOR_ARITH`A-B+C%D-C%E=A-B+C%(D-E)`;VECTOR_ARITH`A-C%D+B%D=A+(B-C)%D`; REAL_ARITH`A*B-(C*D*B)*E=B*(A-C*D*E)`] THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] THEN SUBGOAL_THEN`~(norm((v - x) cross (u - x:real^3))= &0)` ASSUME_TAC THENL[ ASM_REWRITE_TAC[NORM_EQ_0] THEN MP_TAC(ISPECL[`v-x:real^3`;`u-x:real^3`]CROSS_EQ_0) THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3;] THEN RESA_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN ASM_REWRITE_TAC[]; MP_TAC(ISPEC`norm((v - x) cross (u - x:real^3))`REAL_MUL_LINV) THEN RESA_TAC THEN ASSUME_TAC(ISPEC`(v - x) cross (u - x:real^3)`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(norm ((v - x) cross (u - x:real^3)) = &0)/\ &0 <= norm ((v - x) cross (u - x:real^3))==> &0< norm ((v - x) cross (u - x:real^3)) `) THEN RESA_TAC THEN MRESA1_TAC REAL_LT_INV`norm((v - x) cross (u - x:real^3))` THEN ASSUME_TAC(ISPEC`(v - x:real^3)`NORM_POS_LE) THEN MP_TAC(REAL_ARITH`~(norm ((v - x:real^3)) = &0)/\ &0 <= norm ((v - x:real^3))==> &0< norm ((v - x:real^3)) `) THEN RESA_TAC THEN MRESA1_TAC REAL_LT_INV`norm((v - x:real^3))` THEN MRESA1_TAC COS_POS_PI2`s1:real` THEN MRESA1_TAC SIN_POS_PI2`s1:real` THEN EXISTS_TAC`&1-(sin s1 * norm (v - x) * inv (norm ((v - x) cross (u - x)))) -(inv (norm (v - x)) * (cos s1 - sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x:real^3))))` THEN EXISTS_TAC `(inv (norm (v - x)) * (cos s1 - sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x:real^3))))` THEN EXISTS_TAC`(sin s1 * norm (v - x) * inv (norm ((v - x) cross (u - x:real^3))))` THEN STRIP_TAC THENL[ MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[REAL_ARITH`&0<A-B<=> B<A`] THEN MATCH_MP_TAC(REAL_ARITH`&0< cos s1 /\ sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x)) <= &0==> sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x)) < cos s1`) THEN ASM_REWRITE_TAC[REAL_ARITH`A *B *C<= &0<=> &0<= A*B*(-- C)`] THEN MATCH_MP_TAC REAL_LE_MUL THEN MP_TAC(REAL_ARITH`&0< sin s1==> &0<= sin s1`) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LE_MUL THEN MP_TAC(REAL_ARITH`&0< inv (norm ((v - x) cross (u - x)))==> &0<= inv (norm ((v - x) cross (u - x)))`) THEN RESA_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC; STRIP_TAC THENL[ MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[]; STRIP_TAC THENL[ REAL_ARITH_TAC; VECTOR_ARITH_TAC]]]]]);;
let angle_is_small_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ fan80(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) ==> azim x v u w <= azim x v u (sigma_fan x V E v u) `,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "BE") THEN DISCH_THEN(LABEL_TAC"EM") THEN USE_THEN "BE" MP_TAC THEN REWRITE_TAC[fan80] THEN DISCH_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `v:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN DISJ_CASES_TAC(SET_RULE`set_of_edge v V E = {u} \/ ~(set_of_edge v V E = {u:real^3})`) THENL(*1*)[ MRESA_TAC CARD_SING[`u:real^3`; `(set_of_edge v V E):real^3->bool`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) THEN ASM_TAC THEN ARITH_TAC;(*1*) MRESA_TAC SIGMA_FAN[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v (u:real^3)`;` (v:real^3)`] THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] THEN ABBREV_TAC`w1=(sigma_fan x V E v u) :real^3` THEN MRESA_TAC properties_of_fully_surrounded1_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] THEN DISJ_CASES_TAC(REAL_ARITH` azim x v u w1 < azim x v u w\/ azim x v u w <= azim x v u w1 `) THENL(*2*)[ MP_TAC(REAL_ARITH`azim x v u w1 < azim x v u w ==> azim x v u w1 <= azim x v u w`) THEN RESA_TAC THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`w:real^3`] THEN MP_TAC(REAL_ARITH` &0< azim x v u w1 /\ azim x v u w1 < azim x v u w /\ azim x v u w = azim x v u w1 + azim x v w1 w ==> &0< azim x v w1 w /\ azim x v w1 w <= azim x v u w`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`azim x v w1 w <= azim x v u w /\ azim x v u w < pi ==> azim x v w1 w < pi`) THEN RESA_TAC THEN MRESA_TAC exists_cut_in_edge_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SET_RULE`~(A={})<=> ?x. x IN A`;INTER] THEN REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN ABBREV_TAC`va=(&1-a)%u + a%w:real^3` THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`va:real^3`] decomposition_planar_by_angle_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*3*)[ MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v:real^3)`;`(w1:real^3)`] THEN MRESA_TAC not_cut_in_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] THEN MP_TAC(SET_RULE`w1 IN aff_gt {x} {v, va} /\ w1 IN aff_ge {x} {v, w1}==> ~(aff_gt {x} {v, va} INTER aff_ge {x:real^3} {v, w1}={})`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC`{v,w1:real^3} IN E` THEN SET_TAC[];(*3*) MRESA_TAC pos_in_aff_ge_fan [`x:real^3`;`u:real^3`;`w:real^3`;`a:real`] THEN MP_TAC(SET_RULE`va IN aff_ge {x} {v, w1:real^3} /\ va IN aff_ge {x} {u, w} ==>va IN aff_ge {x} {u, w} INTER aff_ge {x} {v, w1:real^3} `) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` THEN REWRITE_TAC[FAN;fan7] THEN STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v:real^3),(w1:real^3)}`]th)) THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(SET_RULE`~(v=u) /\ DISJOINT{x,v} {w} ==> ~(v IN {u,w:real^3}) `) THEN RESA_TAC THEN MP_TAC(SET_RULE`~(v IN {u,w:real^3})/\ ~(u=w)==> ~({u, w} INTER {v, w1} = {u, w:real^3})`) THEN RESA_TAC THEN MP_TAC(SET_RULE`~({u, w} INTER {v, w1} = {u, w:real^3}) ==> {u, w} INTER {v, w1} PSUBSET {u, w} `) THEN RESA_TAC THEN MP_TAC(SET_RULE`{u, w} INTER {v, w1} PSUBSET {u, w:real^3} ==> {u, w} INTER {v, w1} SUBSET {u}\/ {u, w} INTER {v, w1} SUBSET {w} `) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*4*)[ MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v, w1:real^3}`; `{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] THEN STRIP_TAC THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{u:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v, w1}) SUBSET aff_ge {x} {u}/\ aff_ge {x} {u} SUBSET aff {x, u}/\ va IN aff_ge {x} ({u, w} INTER {v, w1})==> va IN aff {x,u}`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN EXPAND_TAC"va" THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % u <=> a % w = u' % x + (v''+a- &1) % u`] THEN MP_TAC(REAL_ARITH`&0< a==> ~(a = &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`a:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE`a % w = u' % x + (v' + a - &1) % u:real^3 ==> (inv (a))%(a % w ) = (inv (a))%( u' % x + (v' + a - &1) % u)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `w IN aff {x,u:real^3}` ASSUME_TAC THENL(*5*)[ REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN EXISTS_TAC`(inv a * u'):real` THEN EXISTS_TAC`(inv a * (v' + a - &1)):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * u' + inv a * (v' + a - &1) =inv a * ( a+ (u' + v') - &1)`;REAL_ARITH`A+ &1- &1=A`];(*5*) POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC `~(w IN aff {x, u:real^3})` THEN SET_TAC[]](*5*);(*4*) FIND_ASSUM MP_TAC`{u,w:real^3} IN E` THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN STRIP_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v, w1:real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w} = {}<=> ~(x=w:real^3)`] THEN STRIP_TAC THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{w:real^3}`][SET_RULE`{x} UNION {w}={x,w}`;GSYM aff] THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v, w1}) SUBSET aff_ge {x} {w}/\ aff_ge {x} {w} SUBSET aff {x, w}/\ va IN aff_ge {x} ({u, w} INTER {v, w1})==> va IN aff {x,w}`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN EXPAND_TAC"va" THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % w <=> (&1-a) % u = u' % x + (v''-a) % w`] THEN MP_TAC(REAL_ARITH`a < &1==> ~(&1- a= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`&1-a:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE`(&1-a) % u = u' % x + (v' - a) % w:real^3 ==> (inv (&1-a))%((&1-a) % u ) = (inv (&1-a))%( u' % x + (v' - a) % w)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `u IN aff {x,w:real^3}` ASSUME_TAC THENL(*5*)[ REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN EXISTS_TAC`(inv (&1-a) * u'):real` THEN EXISTS_TAC`(inv (&1-a) * (v' - a)):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1-a') * u' + inv (&1-a') * (v' - a') =inv (&1-a') * ( (u' + v') - a')`;];(*5*) POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC `~(u IN aff {x, w:real^3})` THEN SET_TAC[]](*5*)](*4*)](*3*);(*2*) ASM_REWRITE_TAC[]]]);;
let angle_is_smallpi_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ fan80(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) ==> &0< azim x v u w /\ azim x v u w <pi`,
REPEAT STRIP_TAC THENL[ POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "BE") THEN DISCH_THEN(LABEL_TAC"EM") THEN USE_THEN "BE" MP_TAC THEN REWRITE_TAC[fan80] THEN DISCH_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN SUBGOAL_THEN`~(azim x v u (w:real^3)= &0)`ASSUME_TAC THENL[STRIP_TAC THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]; MATCH_MP_TAC(REAL_ARITH`~(azim x v u (w:real^3)= &0)/\ &0<= azim x v u w ==> &0 < azim x v u w`) THEN ASM_REWRITE_TAC[azim]]; POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "BE") THEN DISCH_THEN(LABEL_TAC"EM") THEN USE_THEN "BE" MP_TAC THEN REWRITE_TAC[fan80] THEN DISCH_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) THEN MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`] THEN ASM_TAC THEN REAL_ARITH_TAC]);;
let exists_rw_dart_inter_aff_gt_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 . FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ fan80(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) ==> (?h:real. &0< h /\ (!t:real. &0< t /\ t< h==> (!s:real. &0<s /\ s< pi/ &2 ==> ~(rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),(sigma_fan x V E v (u:real^3))) (cos(s)) INTER aff_gt {x} {v, (&1-t)%u+t%w}={}) )))`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "BE") THEN DISCH_THEN(LABEL_TAC"EM") THEN USE_THEN "BE" MP_TAC THEN REWRITE_TAC[fan80] THEN DISCH_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `v:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN DISJ_CASES_TAC(SET_RULE`set_of_edge v V E = {u} \/ ~(set_of_edge v V E = {u:real^3})`) THENL(*1*)[ MRESA_TAC CARD_SING[`u:real^3`; `(set_of_edge v V E):real^3->bool`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) THEN ASM_TAC THEN ARITH_TAC;(*1*) MRESA_TAC SIGMA_FAN[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v (u:real^3)`;` (v:real^3)`] THEN POP_ASSUM MP_TAC THEN RESA_TAC THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] THEN ABBREV_TAC`w1=(sigma_fan x V E v u) :real^3` THEN MRESA_TAC properties_of_fully_surrounded1_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] THEN DISJ_CASES_TAC(REAL_ARITH` azim x v u w1 < azim x v u w\/ azim x v u w <= azim x v u w1 `) THENL(*2*)[ MP_TAC(REAL_ARITH`azim x v u w1 < azim x v u w ==> azim x v u w1 <= azim x v u w`) THEN RESA_TAC THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`w:real^3`] THEN MP_TAC(REAL_ARITH` &0< azim x v u w1 /\ azim x v u w1 < azim x v u w /\ azim x v u w = azim x v u w1 + azim x v w1 w ==> &0< azim x v w1 w /\ azim x v w1 w <= azim x v u w`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`azim x v w1 w <= azim x v u w /\ azim x v u w < pi ==> azim x v w1 w < pi`) THEN RESA_TAC THEN MRESA_TAC exists_cut_in_edge_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] THEN POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SET_RULE`~(A={})<=> ?x. x IN A`;INTER] THEN REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN ABBREV_TAC`va=(&1-a)%u + a%w:real^3` THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`va:real^3`] decomposition_planar_by_angle_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*3*)[ MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v:real^3)`;`(w1:real^3)`] THEN MRESA_TAC not_cut_in_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] THEN MP_TAC(SET_RULE`w1 IN aff_gt {x} {v, va} /\ w1 IN aff_ge {x} {v, w1}==> ~(aff_gt {x} {v, va} INTER aff_ge {x:real^3} {v, w1}={})`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC`{v,w1:real^3} IN E` THEN SET_TAC[];(*3*) MRESA_TAC pos_in_aff_ge_fan [`x:real^3`;`u:real^3`;`w:real^3`;`a:real`] THEN MP_TAC(SET_RULE`va IN aff_ge {x} {v, w1:real^3} /\ va IN aff_ge {x} {u, w} ==>va IN aff_ge {x} {u, w} INTER aff_ge {x} {v, w1:real^3} `) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` THEN REWRITE_TAC[FAN;fan7] THEN STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v:real^3),(w1:real^3)}`]th)) THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(SET_RULE`~(v=u) /\ DISJOINT{x,v} {w} ==> ~(v IN {u,w:real^3}) `) THEN RESA_TAC THEN MP_TAC(SET_RULE`~(v IN {u,w:real^3})/\ ~(u=w)==> ~({u, w} INTER {v, w1} = {u, w:real^3})`) THEN RESA_TAC THEN MP_TAC(SET_RULE`~({u, w} INTER {v, w1} = {u, w:real^3}) ==> {u, w} INTER {v, w1} PSUBSET {u, w} `) THEN RESA_TAC THEN MP_TAC(SET_RULE`{u, w} INTER {v, w1} PSUBSET {u, w:real^3} ==> {u, w} INTER {v, w1} SUBSET {u}\/ {u, w} INTER {v, w1} SUBSET {w} `) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*4*)[ MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v, w1:real^3}`; `{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] THEN STRIP_TAC THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{u:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v, w1}) SUBSET aff_ge {x} {u}/\ aff_ge {x} {u} SUBSET aff {x, u}/\ va IN aff_ge {x} ({u, w} INTER {v, w1})==> va IN aff {x,u}`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN EXPAND_TAC"va" THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % u <=> a % w = u' % x + (v''+a- &1) % u`] THEN MP_TAC(REAL_ARITH`&0< a==> ~(a = &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`a:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE`a % w = u' % x + (v' + a - &1) % u:real^3 ==> (inv (a))%(a % w ) = (inv (a))%( u' % x + (v' + a - &1) % u)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `w IN aff {x,u:real^3}` ASSUME_TAC THENL(*5*)[ REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN EXISTS_TAC`(inv a * u'):real` THEN EXISTS_TAC`(inv a * (v' + a - &1)):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * u' + inv a * (v' + a - &1) =inv a * ( a+ (u' + v') - &1)`;REAL_ARITH`A+ &1- &1=A`];(*5*) POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC `~(w IN aff {x, u:real^3})` THEN SET_TAC[]](*5*);(*4*) FIND_ASSUM MP_TAC`{u,w:real^3} IN E` THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN STRIP_TAC THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v, w1:real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w} = {}<=> ~(x=w:real^3)`] THEN STRIP_TAC THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{w:real^3}`][SET_RULE`{x} UNION {w}={x,w}`;GSYM aff] THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v, w1}) SUBSET aff_ge {x} {w}/\ aff_ge {x} {w} SUBSET aff {x, w}/\ va IN aff_ge {x} ({u, w} INTER {v, w1})==> va IN aff {x,w}`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN EXPAND_TAC"va" THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % w <=> (&1-a) % u = u' % x + (v''-a) % w`] THEN MP_TAC(REAL_ARITH`a < &1==> ~(&1- a= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`&1-a:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE`(&1-a) % u = u' % x + (v' - a) % w:real^3 ==> (inv (&1-a))%((&1-a) % u ) = (inv (&1-a))%( u' % x + (v' - a) % w)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `u IN aff {x,w:real^3}` ASSUME_TAC THENL(*5*)[REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] THEN EXISTS_TAC`(inv (&1-a) * u'):real` THEN EXISTS_TAC`(inv (&1-a) * (v' - a)):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1-a') * u' + inv (&1-a') * (v' - a') =inv (&1-a') * ( (u' + v') - a')`;];(*5*) POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC `~(u IN aff {x, w:real^3})` THEN SET_TAC[]](*5*)](*4*)](*3*);(*2*) EXISTS_TAC`&1` THEN REWRITE_TAC[REAL_ARITH`&0< &1`] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ABBREV_TAC`va=(&1-t)%u + t%w:real^3` THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`t:real`] THEN MRESA_TAC inequality4_aim_in_convex_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`t:real`] THEN ASM_REWRITE_TAC[rw_dart_fan;w_dart_fan] THEN SUBGOAL_THEN`aff_gt {x} {v,va:real^3} SUBSET wedge x v u w1` ASSUME_TAC THENL(*3*)[ REWRITE_TAC[SUBSET; IN_ELIM_THM; wedge] THEN GEN_TAC THEN MRESAL_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(v:real^3)`;`(va:real^3)`][INTER;IN_ELIM_THM] THEN STRIP_TAC THEN MRESAL_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`va:real^3`;`x':real^3`][IN_ELIM_THM] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`; `x':real^3`;`va:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN RESA_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 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 REAL_ARITH_TAC;(*3*) MP_TAC(SET_RULE`aff_gt {x} {v, va:real^3} SUBSET wedge x v u w1 ==> (wedge x v u w1 INTER rcone_fan x v (cos s)) INTER aff_gt {x} {v, va}=(rcone_fan x v (cos s)) INTER aff_gt {x} {v, va}`) THEN RESA_TAC THEN REWRITE_TAC[rcone_fan;INTER;IN_ELIM_THM] THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;IN_ELIM_THM] THEN DISJ_CASES_TAC(REAL_ARITH`(v - x) dot (va - x:real^3) <= &0 \/ &0< (v - x) dot (va - x)`) THENL(*4*)[ ABBREV_TAC`s1= s/ &2:real` THEN MP_TAC(REAL_ARITH`&0< s /\ s< pi/ &2/\ s1= s/ &2 /\ &0< pi ==> &0<= s1 /\ s1< s /\ s <= pi/\ &0<s1 /\ s1<pi/ &2`) THEN REWRITE_TAC[PI_WORKS] THEN RESA_TAC THEN EXISTS_TAC`sin (s1) % (e1_fan x v va) + (cos s1) %(e3_fan x v va)+x :real^3 ` THEN REWRITE_TAC[dist;vector_norm;VECTOR_ARITH`(B+C+A)-A=(B+C:real^3)`; DOT_LADD;DOT_RADD;DOT_RMUL;DOT_LMUL;] THEN MRESAL_TAC properties_coordinate[`x:real^3`;`v:real^3`;`va:real^3`][orthonormal] THEN ONCE_REWRITE_TAC[DOT_SYM] THEN ASSUME_TAC(ISPEC`s1:real`SIN_CIRCLE) THEN ASM_REWRITE_TAC[] THEN REDUCE_ARITH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`sin s * sin s + cos s * cos s =(sin s) pow 2 + (cos s) pow 2`;e3_fan;DOT_RMUL; ] THEN ONCE_REWRITE_TAC[GSYM vector_norm;] THEN REWRITE_TAC[DOT_SQUARE_NORM;] THEN MRESAL1_TAC SQRT_POW_2`&1`[REAL_ARITH`a pow 2 = a * a`;REAL_ARITH`&0<= &1`;] THEN POP_ASSUM MP_TAC THEN MRESAL_TAC SQRT_MUL[`&1`;`&1`][REAL_ARITH`&0<= &1`;] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th); REAL_ARITH`&1* &1= &1`]) THEN RESA_TAC THEN REDUCE_ARITH_TAC THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC THENL(*5*)[ ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`];(*5*) MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) THEN REWRITE_TAC[REAL_ARITH`A*B*D *D=(B*D) *D *A`;REAL_ARITH`A>B<=> B<A`] THEN RESA_TAC THEN REDUCE_ARITH_TAC THEN ASSUME_TAC(ISPEC`v-x:real^3`NORM_POS_LE) THEN STRIP_TAC THENL(*6*)[ MATCH_MP_TAC REAL_LT_LMUL THEN MP_TAC(REAL_ARITH`~(norm (v - x:real^3) = &0)/\ &0 <= norm (v - x)==> &0< norm (v - x) `) THEN RESA_TAC THEN MATCH_MP_TAC COS_MONO_LT THEN ASM_REWRITE_TAC[];(*6*) MRESA_TAC condition1_to_in_aff_gt_by_angle[`x:real^3`;`v:real^3`;`va:real^3`;`s1:real`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[e3_fan]](*6*)](*5*);(*4*) SUBGOAL_THEN`&0<(atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x))))` ASSUME_TAC THENL(*5*)[ MP_TAC(ISPEC`(v - x) dot (va - x:real^3)`REAL_LT_INV) THEN RESA_TAC THEN ASSUME_TAC(PI_WORKS) THEN MP_TAC(REAL_ARITH`&0< pi ==> --(pi / &2) < &0`) THEN RESA_TAC THEN MRESAL_TAC ATN_MONO_LT[`&0:real`;` (norm ((v - x) cross (va - x)) * inv ((v - x) dot (va - x))):real`][ ATN_0] THEN POP_ASSUM MATCH_MP_TAC THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[] THEN SUBGOAL_THEN`~(norm((v - x) cross (va - x:real^3))= &0)` ASSUME_TAC THENL(*6*)[ASM_REWRITE_TAC[NORM_EQ_0] THEN MP_TAC(ISPECL[`v-x:real^3`;`va-x:real^3`]CROSS_EQ_0) THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3;] THEN RESA_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] THEN ASM_REWRITE_TAC[]; POP_ASSUM MP_TAC THEN MP_TAC(ISPEC`(v - x) cross (va - x:real^3)`NORM_POS_LE) THEN REAL_ARITH_TAC];(*5*) ABBREV_TAC`s1= min (s:real) (atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x)))) / &2` THEN ASSUME_TAC(ISPEC`(norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x))):real`ATN_BOUNDS) THEN MP_TAC(REAL_ARITH`&0< s /\ s< pi/ &2/\ s1= min (s:real) (atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x)))) / &2 /\ &0< pi /\ &0< (atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x)))) /\ (atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x)))) < pi/ &2 ==> &0<= s1 /\ s1< s /\ s <= pi/\ &0<s1 /\ s1<pi/ &2 /\ s1< (atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x)))) `) THEN REWRITE_TAC[PI_WORKS] THEN RESA_TAC THEN EXISTS_TAC`sin (s1) % (e1_fan x v va) + (cos s1) %(e3_fan x v va)+x :real^3 ` THEN REWRITE_TAC[dist;vector_norm;VECTOR_ARITH`(B+C+A)-A=(B+C:real^3)`; DOT_LADD;DOT_RADD;DOT_RMUL;DOT_LMUL;] THEN MRESAL_TAC properties_coordinate[`x:real^3`;`v:real^3`;`va:real^3`][orthonormal] THEN ONCE_REWRITE_TAC[DOT_SYM] THEN ASSUME_TAC(ISPEC`s1:real`SIN_CIRCLE) THEN ASM_REWRITE_TAC[] THEN REDUCE_ARITH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`sin s * sin s + cos s * cos s =(sin s) pow 2 + (cos s) pow 2`;e3_fan;DOT_RMUL; ] THEN ONCE_REWRITE_TAC[GSYM vector_norm;] THEN REWRITE_TAC[DOT_SQUARE_NORM;] THEN MRESAL1_TAC SQRT_POW_2`&1`[REAL_ARITH`a pow 2 = a * a`;REAL_ARITH`&0<= &1`;] THEN POP_ASSUM MP_TAC THEN MRESAL_TAC SQRT_MUL[`&1`;`&1`][REAL_ARITH`&0<= &1`;] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th); REAL_ARITH`&1* &1= &1`]) THEN RESA_TAC THEN REDUCE_ARITH_TAC THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC THENL(*6*)[ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`];(*6*) MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) THEN REWRITE_TAC[REAL_ARITH`A*B*D *D=(B*D) *D *A`;REAL_ARITH`A>B<=> B<A`] THEN RESA_TAC THEN REDUCE_ARITH_TAC THEN ASSUME_TAC(ISPEC`v-x:real^3`NORM_POS_LE) THEN STRIP_TAC THENL(*7*)[ MATCH_MP_TAC REAL_LT_LMUL THEN MP_TAC(REAL_ARITH`~(norm (v - x:real^3) = &0)/\ &0 <= norm (v - x)==> &0< norm (v - x) `) THEN RESA_TAC THEN MATCH_MP_TAC COS_MONO_LT THEN ASM_REWRITE_TAC[]; MRESA_TAC condition_to_in_aff_gt_by_angle[`x:real^3`;`v:real^3`;`va:real^3`;`s1:real`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[e3_fan]]]]]]]]);;
let scale_in_edges_fan=
prove(`!(x:real^3) (v:real^3) (u:real^3) (w:real^3). DISJOINT {x} {v,u} /\ w IN aff_gt {x} {v,u} ==> (?a t:real. &0<a /\ &0<t /\ t< &1 /\ a%(w-x) = (&1-t)% v+ t%u-x)`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[VECTOR_ARITH`w = t1 % x + t2 % v + t3 % u <=> w-x = ((t1+t2+t3)- &1) % x + (((t1+t2+t3) -t1)- t3)% (v-x) + t3 % (u-x):real^3`] THEN ASM_REWRITE_TAC[REAL_ARITH`&1- &1= &0`] THEN REDUCE_VECTOR_TAC THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3 /\ t1+t2+t3= &1 ==> ~(&1-t1= &0)/\ &0< &1- t1`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV `(&1-t1:real)` THEN MRESA1_TAC REAL_LT_INV `(&1-t1:real)` THEN MRESA_TAC REAL_LT_MUL [`inv(&1-t1:real)`;`t3:real`] THEN MRESA_TAC REAL_LT_MUL [`inv(&1-t1:real)`;`t2:real`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[REAL_ARITH`inv (&1 - t1) * t2=inv (&1 - t1) * ((t1+t2+t3)-t1)- inv(&1-t1)*t3:real`] THEN RESA_TAC THEN STRIP_TAC THEN MP_TAC(SET_RULE` w - x = (&1 - t1 - t3) % (v - x) + t3 % (u - x):real^3 ==> (inv (&1- t1))%(w - x ) = (inv (&1-t1))%((&1 - t1 - t3) % (v - x) + t3 % (u - x)) `) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`;REAL_ARITH`inv (&1 - t1) * (&1 - t1 - t3)=inv (&1 - t1) * (&1 - t1) - inv (&1 - t1) * (t3)`;VECTOR_ARITH`(&1-A)%(U-X)+A%(V-X)=(&1-A)%U+A%V-X`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC`inv(&1- t1:real)` THEN EXISTS_TAC`inv(&1-t1) *t3:real` THEN ASM_REWRITE_TAC[REAL_ARITH`A< &1<=> &0< &1- A`]);;
let aff_gt_imp_not_collinear=
prove(`!x u v w:real^3. ~collinear{x,v,u}/\ w IN aff_gt{x,v} {u}==> ~collinear{x,v,w}`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] THEN POP_ASSUM MP_TAC THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] THEN ASM_REWRITE_TAC[collinear_fan;aff;AFFINE_HULL_2;IN_ELIM_THM;] THEN DISCH_THEN(LABEL_TAC"A") THEN REPEAT STRIP_TAC THEN REMOVE_THEN "A" MP_TAC THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % u = u' % x + v' % v<=> t3 % u = (u'-t1) % x + (v'-t2) % v`] THEN MP_TAC(REAL_ARITH`&0<t3==> ~(t3= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`t3:real` THEN STRIP_TAC THEN MP_TAC(SET_RULE`t3 % u = (u' - t1) % x + (v' - t2) % v:real^3 ==> (inv (t3))%(t3 % u ) = (inv (t3))%( (u' - t1) % x + (v' - t2) % v)`) THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN REDUCE_VECTOR_TAC THEN STRIP_TAC THEN EXISTS_TAC`(inv (t3)) * (u' - t1):real` THEN EXISTS_TAC`(inv (t3)) * (v' -t2):real` THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t3) * (u' - t1) + inv (t3) * (v'- t2) = inv (t3) * (t3+ (u'+v')- (t1 + t2 +t3)):real`; REAL_ARITH`A+ &1- &1= A`]);;
let conditions_in_rcone_fan=
prove(`!x v u w:real^3 s:real. ~collinear {x,v,u}/\ w IN aff_gt {x} {v,u} /\ &0<s /\ s< pi/ &2 /\u IN rcone_fan x v (cos s)==> w IN rcone_fan x v (cos s) `,
REWRITE_TAC[rcone_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN ASM_TAC THEN DISCH_TAC THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(u:real^3)`;] THEN MRESAL_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;` (u:real^3) `;][IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[dist;VECTOR_ARITH`(t1 % x + t2 % v + t3 % u) - x=((t1+t2+t3)- &1) % x + t2 % (v-x) + t3 % (u-x)`;REAL_ARITH`&1 - &1= &0`;REAL_ARITH`A>B<=> B<A`;DOT_LADD;DOT_LMUL] THEN REDUCE_VECTOR_TAC THEN REDUCE_ARITH_TAC THEN STRIP_TAC THEN MP_TAC(REAL_ARITH`&0< t3==> &0<= t3`) THEN RESA_TAC THEN MRESA1_TAC REAL_ABS_REFL`t3:real` THEN MRESA_TAC NORM_MUL[`t3:real`;`u-x:real^3`] THEN MP_TAC(REAL_ARITH`&0< t2==> &0<= t2`) THEN RESA_TAC THEN MRESA1_TAC REAL_ABS_REFL`t2:real` THEN MRESA_TAC NORM_MUL[`t2:real`;`v-x:real^3`] THEN MRESA_TAC REAL_LT_LMUL[`t3:real`;`norm (u - x) * norm (v - x:real^3) * (cos s):real`;`(u - x) dot (v - x:real^3)`] THEN MRESA1_TAC COS_BOUNDS`s:real` THEN MRESA1_TAC DOT_POS_LE`(v - x):real^3` THEN MRESA_TAC REAL_LE_MUL[`t2:real`;`(v-x) dot (v-x:real^3)`;] THEN MRESA_TAC REAL_LE_LMUL[`t2*((v - x:real^3) dot (v-x)):real`;`cos s:real`;`&1`] THEN POP_ASSUM MP_TAC THEN REDUCE_ARITH_TAC THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[DOT_SQUARE_NORM;] THEN STRIP_TAC THEN MP_TAC(REAL_ARITH` t3 * norm (u - x) * norm (v - x) * cos s< t3 * ((u - x) dot (v - x)) /\(t2 * norm (v - x) pow 2) * cos s <= t2 * ((v - x) dot (v - x)) ==> (t2 * norm (v - x:real^3) + t3 * norm (u - x)) * norm (v - x) * cos s< t2 * ((v - x) dot (v - x))+ t3 * ((u - x) dot (v - x))`) THEN RESA_TAC THEN MRESA_TAC NORM_TRIANGLE[`t2 %(v - x:real^3)`;`t3 % (u - x:real^3)`] THEN MRESA1_TAC NORM_POS_LE`(v - x):real^3` THEN MRESA1_TAC COS_POS_PI2`(s):real` THEN MP_TAC(REAL_ARITH`&0< cos s:real ==> &0<= cos s`) THEN RESA_TAC THEN MRESA_TAC REAL_LE_MUL[`norm (v-x:real^3)`;`cos s:real`] THEN MRESA_TAC REAL_LE_RMUL[`norm (t2 % (v - x) + t3 % (u - x):real^3):real`;`t2 * norm (v - x:real^3) + t3 * norm (u - x)`;`norm (v - x:real^3) * cos s`] 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 POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);;
let exists_point_inside_domain_cone_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 s:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<s /\ s<pi/ &2 /\ fan80(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) ==> (?y:real^3. y IN rw_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(w2:real^3)) (cos(s)) /\ azim x v u y< azim x v u w)`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "BE") THEN DISCH_THEN(LABEL_TAC"EM") THEN USE_THEN "BE" MP_TAC THEN REWRITE_TAC[fan80] THEN DISCH_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN DISJ_CASES_TAC(SET_RULE`set_of_edge u V E = {w} \/ ~(set_of_edge u V E = {w:real^3})`) THENL(*1*)[ MRESA_TAC CARD_SING[`w:real^3`; `(set_of_edge u V E):real^3->bool`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC;(*1*) MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`; `w:real^3`] THEN POP_ASSUM(fun th-> MRESA1_TAC th `s:real`) THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;rw_dart_fan;INTER; w_dart_fan;wedge;IN_ELIM_THM;] THEN STRIP_TAC THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v==> azim x u w y<= azim x u w (v:real^3)`) THEN RESA_TAC THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`;`v:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"YEU EM") THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v/\ &0< azim x u w y/\ azim x u w v < pi /\ azim x u w v = azim x u w y + azim x u y v==> ~(azim x u y (v:real^3)= &0)/\ &0< azim x u y v/\ azim x u y v < pi/\ ~(azim x u y (v:real^3)= pi)`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN REPEAT DISCH_TAC THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`y:real^3`;`u:real^3`] THEN SUBGOAL_THEN`~(azim x v u (y:real^3)= &0)`ASSUME_TAC THENL(*2*)[ STRIP_TAC THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] THEN POP_ASSUM MATCH_MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[];(*2*) SUBGOAL_THEN`~(azim x v u (y:real^3)= pi)`ASSUME_TAC THENL(*3*)[ STRIP_TAC THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] THEN POP_ASSUM MATCH_MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[];(*3*) MP_TAC(REAL_ARITH`~(azim x v u y=pi)==>pi< azim x v u y \/ azim x v u (y:real^3) < pi`) THEN RESA_TAC THENL(*4*)[ MRESA_TAC AZIM_COMPL[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] THEN MRESA_TAC azim[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] THEN MP_TAC(REAL_ARITH`pi< azim x v u y /\ azim x v u y < &2 * pi /\ azim x v y u = &2 * pi - azim x v u y ==> azim x v y u< pi/\ &0<azim x v y u `) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN REPEAT STRIP_TAC THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`v:real^3`;`y:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;CROSS_TRIPLE;] THEN ONCE_REWRITE_TAC[CROSS_SKEW] THEN ASM_REWRITE_TAC[DOT_LNEG] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*4*) DISJ_CASES_TAC(REAL_ARITH`azim x v u w <= azim x v u (y:real^3) \/ azim x v u y < azim x v u w`) THENL(*5*)[ ABBREV_TAC`a1=(v-x):real^3` THEN ABBREV_TAC`a2=(y-x):real^3` THEN ABBREV_TAC`a3=(u-x) :real^3` THEN ABBREV_TAC`a4=w-x:real^3` THEN ABBREV_TAC`va=a1 cross a4:real^3` THEN ABBREV_TAC`vb=a2 cross a3:real^3` THEN ABBREV_TAC`v3= (vb:real^3) cross (va:real^3)+(x:real^3)` THEN ABBREV_TAC`v4= &1/ &2 % v3+ &1/ &2 % u:real^3` THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;CROSS_TRIPLE;] THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] THEN ASM_REWRITE_TAC[DOT_LNEG] THEN STRIP_TAC THEN SUBGOAL_THEN `v3 IN aff_gt {x,u} {y:real^3}` ASSUME_TAC THENL(*6*)[ MRESA_TAC th3[`(x:real^3)` ;` (u:real^3)`;`(y:real^3) `;] THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`u:real^3`;`y:real^3`][IN_ELIM_THM] THEN EXISTS_TAC`&1-(va:real^3) dot (a2:real^3)+va dot (a3:real^3)` THEN EXISTS_TAC`((va:real^3) dot (a2:real^3))` THEN EXISTS_TAC`(--((va:real^3) dot (a3:real^3)))` THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - va dot a3 + va dot a2) + (va dot a3) + --(va dot a2) = &1`;VECTOR_ARITH`(&1-A+B)%X+ (A)%U+ (--B) %V=A%(U-X)- B%(V-X)+X`] THEN EXPAND_TAC"v3" THEN EXPAND_TAC"vb" THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`--(A-B)+C=B-A+C:real^3`];(*6*) SUBGOAL_THEN `(v4:real^3) IN aff_gt {x,u} {y:real^3}` ASSUME_TAC THENL(*7*)[ POP_ASSUM MP_TAC THEN MRESA_TAC th3[`(x:real^3)` ;` (u:real^3)`;`(y:real^3) `;] THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`u:real^3`;`y:real^3`][IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC`&1/ &2 * t1:real` THEN EXISTS_TAC`&1/ &2 * t2+ &1/ &2:real` THEN EXISTS_TAC`&1/ &2*t3:real` THEN ASM_REWRITE_TAC[REAL_ARITH`&1 / &2 * t1 + (&1 / &2 * t2 + &1 / &2) + &1 / &2 * t3 = &1/ &2*(t1+t2+t3)+ &1/ &2`; REAL_ARITH`&1/ &2 * &1 + &1/ &2= &1`;VECTOR_ARITH`(&1 / &2 * t1) % x + (&1 / &2 * t2 + &1 / &2) % u + (&1 / &2 * t3) % y= &1/ &2 %(t1 % x + t2 % u + t3 % y)+ &1/ &2 % u`] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC;(*7*) MRESA_TAC aff_gt_imp_not_collinear[`x:real^3`;`y:real^3`;`u:real^3`; `v4:real^3`] THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`w:real^3`; `v4:real^3`;`y:real^3`] THEN EXISTS_TAC`v4:real^3` THEN ASM_REWRITE_TAC[] THEN SUBGOAL_THEN `v3 IN aff_gt {x,v} {w:real^3}` ASSUME_TAC THENL(*8*)[ MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(w:real^3) `;] THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] THEN EXISTS_TAC`&1-(vb:real^3) dot (a4:real^3)+vb dot (a1:real^3)` THEN EXISTS_TAC`((vb:real^3) dot (a4:real^3))` THEN EXISTS_TAC`(--((vb:real^3) dot (a1:real^3)))` THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - vb dot a4 + vb dot a1) + (vb dot a4) + --(vb dot a1) = &1`;VECTOR_ARITH`(&1-A+B)%X+ (A)%U+ (--B) %V=A%(U-X)- B%(V-X)+X`] THEN EXPAND_TAC"v3" THEN EXPAND_TAC"va" THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`--(A-B)+C=B-A+C:real^3`] THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`y:real^3`;`u:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;CROSS_TRIPLE;] THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] THEN ASM_REWRITE_TAC[DOT_LNEG] THEN DISCH_TAC THEN POP_ASSUM MATCH_MP_TAC THEN MRESA_TAC azim[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] THEN FIND_ASSUM(MP_TAC)`~(azim x v u (y:real^3)= &0)` THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*8*) REMOVE_THEN "YEU EM"(fun th-> ASM_REWRITE_TAC[SYM(th)]) THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC aff_gt_imp_not_collinear[`x:real^3`;`w:real^3`;`v:real^3`; `v3:real^3`] THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`; `v3:real^3`;`w:real^3`] THEN SUBGOAL_THEN`~(coplanar{x,v,u,v3:real^3})`ASSUME_TAC THENL(*9*)[ STRIP_TAC THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`v3:real^3`] THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`];(*9*) SUBGOAL_THEN`~(azim x u v3 (v:real^3)= &0)`ASSUME_TAC THENL(*10*)[ POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`u:real^3`;`v3:real^3`;`v:real^3`] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN ASM_REWRITE_TAC[];(*10*) MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`v3:real^3`] THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`v:real^3`; `v3:real^3`;`y:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"YEU EM") THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] THEN RESA_TAC THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`v3:real^3`;`v:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&2 * pi - azim x u y v = &2 * pi - azim x u v3 v==> azim x u v3 v= azim x u y v `) THEN RESA_TAC THEN MRESAL_TAC inequality4_aim_in_convex_fan[`x:real^3`;`v:real^3`;`u:real^3`;`v3:real^3`;`&1/ &2`][REAL_ARITH`&1- &1/ &2= &1/ &2/\ &0< &1/ &2 /\ &1/ &2< &1`;VECTOR_ARITH`A+B=B+A:real^3`] THEN MATCH_MP_TAC conditions_in_rcone_fan THEN EXISTS_TAC `y:real^3` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC th3[`(x:real^3)` ;` (u:real^3)`;`(y:real^3) `;] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`u:real^3`;`y:real^3`][IN_ELIM_THM] THEN EXISTS_TAC`&1/ &2 *(&1-(va:real^3) dot (a2:real^3)+va dot (a3:real^3))` THEN EXISTS_TAC`&1/ &2 *((va:real^3) dot (a2:real^3))+ &1/ &2` THEN EXISTS_TAC`&1/ &2 *(--((va:real^3) dot (a3:real^3)))` THEN ASM_REWRITE_TAC[REAL_ARITH`&1 / &2 * t1 + (&1 / &2 * t2 + &1 / &2) + &1 / &2 * t3 = &1/ &2*(t1+t2+t3)+ &1/ &2`; REAL_ARITH`&1/ &2 * &1 + &1/ &2= &1`;VECTOR_ARITH`(&1 / &2 * t1) % x + (&1 / &2 * t2 + &1 / &2) % u + (&1 / &2 * t3) % y= &1/ &2 %(t1 % x + t2 % u + t3 % y)+ &1/ &2 % u`;REAL_ARITH`(&1 - va dot a3 + va dot a2) + (va dot a3) + --(va dot a2) = &1`;VECTOR_ARITH`(&1-A+B)%X+ (A)%U+ (--B) %V=A%(U-X)- B%(V-X)+X`] THEN EXPAND_TAC"v4" THEN EXPAND_TAC"v3" THEN EXPAND_TAC"vb" THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`--(A-B)+C=B-A+C:real^3`] THEN MP_TAC(REAL_ARITH`&0< --(va dot (a3:real^3))==> &0 < &1 / &2 * --(va dot a3)`) THEN RESA_TAC THEN MATCH_MP_TAC(REAL_ARITH`&0<= (va dot (a2:real^3))==> &0 < &1 / &2 * (va dot a2)+ &1/ &2`) THEN MRESA_TAC cross_dot_fully_surrounded_ge_fan[`x:real^3`;`v:real^3`;`y:real^3`;`w:real^3`] THEN POP_ASSUM MATCH_MP_TAC THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`y:real^3`] THEN REWRITE_TAC[azim] THEN MATCH_MP_TAC(REAL_ARITH`azim x v u y = azim x v u w + azim x v w y/\ &0<= azim x v u w /\ azim x v u y < pi ==>azim x v w y <= pi`) THEN ASM_REWRITE_TAC[azim]](*10*)](*9*)](*8*)](*7*)](*6*);(*5*) EXISTS_TAC`y:real^3` THEN REMOVE_THEN "YEU EM" (fun th-> REWRITE_TAC[SYM(th)]) THEN ASM_REWRITE_TAC[]]]]]]);;
let cut_in_angle_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3 y:real^3. ~coplanar {x,v,u,w} /\ ~collinear {x,u,y} /\ &0< azim x u w v /\ azim x u w v< pi /\ azim x u w y< azim x u w v /\ &0< azim x u w y ==> let a1=(v-x):real^3 in let a2=w-x:real^3 in let a3=(y-x):real^3 in let a4=(u-x) :real^3 in let va=a1 cross a2:real^3 in let vb=a3 cross a4:real^3 in let v3= (vb:real^3) cross (va:real^3)+(x:real^3) in v3 IN aff_gt {x} {v,w:real^3}`,
REPEAT STRIP_TAC THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN ABBREV_TAC`a1=(v-x):real^3` THEN ABBREV_TAC`a2=(y-x):real^3` THEN ABBREV_TAC`a3=(u-x) :real^3` THEN ABBREV_TAC`a4=w-x:real^3` THEN ABBREV_TAC`va=a1 cross a4:real^3` THEN ABBREV_TAC`vb=a2 cross a3:real^3` THEN ABBREV_TAC`v3= (vb:real^3) cross (va:real^3)+(x:real^3)` THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(w:real^3) `;] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] THEN EXISTS_TAC`&1-(vb:real^3) dot (a4:real^3)+vb dot (a1:real^3)` THEN EXISTS_TAC`((vb:real^3) dot (a4:real^3))` THEN EXISTS_TAC`(--((vb:real^3) dot (a1:real^3)))` THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - vb dot a4 + vb dot a1) + (vb dot a4) + --(vb dot a1) = &1`;VECTOR_ARITH`(&1-A+B)%X+ (A)%U+ (--B) %V=A%(U-X)- B%(V-X)+X`] THEN EXPAND_TAC"v3" THEN EXPAND_TAC"va" THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`--(A-B)+C=B-A+C:real^3`] THEN MP_TAC(REAL_ARITH`azim x u w v< pi /\ azim x u w y< azim x u w v==>azim x u w (y:real^3)< pi`) THEN RESA_TAC THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`y:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] THEN ASM_REWRITE_TAC[DOT_LNEG] THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;] THEN ONCE_REWRITE_TAC[CROSS_SKEW;] THEN ASM_REWRITE_TAC[DOT_LNEG;REAL_ARITH`--(--A)=A`] THEN DISCH_TAC THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v==> azim x u w y<= azim x u w (v:real^3)`) THEN RESA_TAC THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`;`v:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN RESA_TAC THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v/\ &0< azim x u w y/\ azim x u w v < pi /\ azim x u w v = azim x u w y + azim x u y v==> ~(azim x u y (v:real^3)= &0)/\ &0< azim x u y v/\ azim x u y v < pi/\ ~(azim x u y (v:real^3)= pi)`) THEN RESA_TAC THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`v:real^3`;`y:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] THEN ASM_REWRITE_TAC[DOT_LNEG] );;
let aff_gt_1_2_scale_fan=
prove(`!x:real^3 v:real^3 u:real^3 w:real^3 a:real. &0< a /\ a % (u-x)= w-x /\ ~collinear {x,w,v} ==> aff_gt {x} {u,v} =aff_gt {x} {w,v}`,
REPEAT GEN_TAC THEN GEOM_ORIGIN_TAC `x:real^3` THEN REDUCE_VECTOR_TAC THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`&0<a:real==> ~(a= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV `a:real` THEN MRESA1_TAC REAL_LT_INV`a:real` THEN FIND_ASSUM(MP_TAC)`a %u=w:real^3` THEN STRIP_TAC THEN MP_TAC(SET_RULE` a%u=w:real^3 ==> (inv (a))%(a%u) = (inv (a))%(w)`) THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C:real^3`] THEN REWRITE_TAC[VECTOR_ARITH`&1 % u= inv a % w<=> inv a % w= u`] THEN STRIP_TAC THEN MRESA_TAC COLLINEAR_SPECIAL_SCALE[`a:real`;`u:real^3`;`v:real^3`] THEN MRESA_TAC th3[`((vec 0):real^3)` ;` (u:real^3)`;`(v:real^3) `;] THEN MRESA_TAC th3[`((vec 0):real^3)` ;` (w:real^3)`;`(v:real^3) `;] THEN MRESAL_TAC AFF_GT_1_2[`(vec 0):real^3`;`u:real^3`;`v:real^3`][IN_ELIM_THM;EXTENSION] THEN MRESAL_TAC AFF_GT_1_2[`(vec 0):real^3`;`w:real^3`;`v:real^3`][IN_ELIM_THM] THEN REDUCE_VECTOR_TAC THEN GEN_TAC THEN EQ_TAC THENL[ STRIP_TAC THEN EXISTS_TAC`&1- inv a * t2-t3:real` THEN EXISTS_TAC `inv a * t2:real` THEN EXISTS_TAC `t3:real` THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - inv a * t2 - t3 + inv a * t2 + t3 = &1`;VECTOR_ARITH`(A*B)%C=B%(A%C)`] THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[]; STRIP_TAC THEN EXISTS_TAC`&1- a * t2-t3:real` THEN EXISTS_TAC `a * t2:real` THEN EXISTS_TAC `t3:real` THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - a * t2 - t3 + a * t2 + t3 = &1`;VECTOR_ARITH`(A*B)%C=B%(A%C)`] THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[]]);;
let exists_cut_rcone_fan_with_edge_run_fan=
prove( `!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 s:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<s /\ s<pi/ &2 /\ fan80(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) ==> (?t:real. &0< t /\ t< &1 /\ ~(rw_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(sigma_fan x V E u w:real^3)) (cos(s)) INTER aff_gt {x} {v, (&1-t)%u+t%w}={}))`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "BE") THEN DISCH_THEN(LABEL_TAC"EM") THEN USE_THEN "BE" MP_TAC THEN REWRITE_TAC[fan80] THEN DISCH_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN DISJ_CASES_TAC(SET_RULE`set_of_edge u V E = {w} \/ ~(set_of_edge u V E = {w:real^3})`) THENL[ MRESA_TAC CARD_SING[`w:real^3`; `(set_of_edge u V E):real^3->bool`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;rw_dart_fan;INTER; w_dart_fan;wedge;IN_ELIM_THM;] THEN MRESA_TAC inequality3_aim_in_convex_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"NHO EM") THEN MRESA_TAC exists_point_inside_domain_cone_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;`s:real`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[rw_dart_fan;INTER; w_dart_fan;wedge;IN_ELIM_THM;] THEN REPEAT STRIP_TAC THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v==> azim x u w y<= azim x u w (v:real^3)`) THEN RESA_TAC THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`;`v:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"YEU EM") THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v/\ &0< azim x u w y/\ azim x u w v < pi /\ azim x u w v = azim x u w y + azim x u y v==> ~(azim x u y (v:real^3)= &0)/\ &0< azim x u y v/\ azim x u y v < pi/\ ~(azim x u y (v:real^3)= pi)`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN REPEAT DISCH_TAC THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`y:real^3`;`u:real^3`] THEN SUBGOAL_THEN`~(azim x v u (y:real^3)= &0)`ASSUME_TAC THENL[STRIP_TAC THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] THEN POP_ASSUM MATCH_MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[]; MP_TAC(REAL_ARITH`&0<= azim x v u (y:real^3) /\ ~(azim x v u y= &0)==> &0< azim x v u y`) THEN ASM_REWRITE_TAC[azim] THEN STRIP_TAC THEN MRESA_TAC angle_is_smallpi_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN ABBREV_TAC`a1=(v-x):real^3` THEN ABBREV_TAC`a2=(y-x):real^3` THEN ABBREV_TAC`a3=(u-x) :real^3` THEN ABBREV_TAC`a4=w-x:real^3` THEN ABBREV_TAC`va=a2 cross a1:real^3` THEN ABBREV_TAC`vb=a4 cross a3:real^3` THEN ABBREV_TAC`v3=(va:real^3) cross (vb:real^3)+(x:real^3)` THEN MRESA_TAC cut_in_angle_fan[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN DISCH_TAC THEN MRESA_TAC scale_in_edges_fan[`(x:real^3)`;`(u:real^3)`;`(w:real^3)`;`(v3:real^3)`] THEN EXISTS_TAC`t:real` THEN ASM_REWRITE_TAC[] THEN EXISTS_TAC`y:real^3` THEN REMOVE_THEN "YEU EM" (fun th-> REWRITE_TAC[SYM(th)]) THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`&0<t:real==> ~(t= &0)`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0<a:real==> ~(a= &0)`) THEN RESA_TAC THEN MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `t:real`) THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`(&1 - t) % u + t % w:real^3`] THEN MRESAL_TAC aff_gt_1_2_scale_fan[`x:real^3`;`v:real^3`;`v3:real^3`;`(&1 - t) % u + t % w:real^3`;`a:real`][VECTOR_ARITH`(&1 - t) % u + t % w - x = ((&1 - t) % u + t % w) - x`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN RESA_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN MRESAL_TAC COLLINEAR_SPECIAL_SCALE[`a:real`;`(v3 - x):real^3`;`v-x:real^3`][VECTOR_ARITH`(&1 - t) % u + t % w - x = ((&1 - t) % u + t % w) - x`] THEN POP_ASSUM MP_TAC THEN EXPAND_TAC"a1" THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`] THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN STRIP_TAC THEN MRESA_TAC th3[`(x:real^3)` ;` (v3:real^3)`;`(v:real^3) `;] THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v3:real^3`;`v:real^3`][IN_ELIM_THM;] THEN EXPAND_TAC"v3" THEN EXPAND_TAC"va" THEN ONCE_REWRITE_TAC[CROSS_SKEW] THEN REWRITE_TAC[CROSS_LAGRANGE;] THEN MP_TAC(REAL_ARITH`azim x u w y < azim x u w v /\ azim x u w v< pi==> azim x u w y< pi`) THEN RESA_TAC THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`y:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[CROSS_SKEW] THEN ASM_REWRITE_TAC[DOT_LNEG] THEN STRIP_TAC THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ONCE_REWRITE_TAC[CROSS_SKEW] THEN ASM_REWRITE_TAC[DOT_LNEG] THEN STRIP_TAC THEN MP_TAC(REAL_ARITH`&0< --(vb dot (a1:real^3))==> ~(--(vb dot (a1:real^3))= &0)`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV `(--(vb dot (a1:real^3)):real)` THEN MRESA1_TAC REAL_LT_INV `(--(vb dot (a1:real^3)):real)` THEN MRESA_TAC REAL_LT_MUL [`inv(--(vb dot (a1:real^3)):real)`;`--(vb dot (a2:real^3)):real`] THEN EXISTS_TAC`&1- inv (--(vb dot (a1:real^3)))- inv (--(vb dot a1)) * --(vb dot a2)` THEN EXISTS_TAC`inv (--(vb dot (a1:real^3)))` THEN EXISTS_TAC`inv (--(vb dot a1)) * --(vb dot (a2:real^3))` THEN ASM_REWRITE_TAC[REAL_ARITH`&1- T1 -T2 +T1 +T2 = &1`;VECTOR_ARITH`A%(--(B%X-C%Y)+Z)=(A*(--B))%X-(A*(--C))%Y+A%Z:real^3`] THEN EXPAND_TAC"a1" THEN EXPAND_TAC"a2" THEN VECTOR_ARITH_TAC]]);;
let aff_gt_in_rw_dart_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 y:real^3 s:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<s /\ s<pi/ &2 /\ y IN rw_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(v:real^3)) (cos(s)) /\ fan80(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) ==> aff_gt {x} {u,y} SUBSET rw_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(sigma_fan x V E u w:real^3)) (cos(s)) `,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "CON") THEN DISCH_THEN(LABEL_TAC "BE") THEN DISCH_THEN(LABEL_TAC"EM") THEN USE_THEN "BE" MP_TAC THEN REWRITE_TAC[fan80] THEN DISCH_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN DISJ_CASES_TAC(SET_RULE`set_of_edge u V E = {w} \/ ~(set_of_edge u V E = {w:real^3})`) THENL[MRESA_TAC CARD_SING[`w:real^3`; `(set_of_edge u V E):real^3->bool`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; REMOVE_THEN "CON" MP_TAC THEN ASM_REWRITE_TAC[rw_dart_fan;INTER; SUBSET; w_dart_fan;wedge;IN_ELIM_THM;] THEN STRIP_TAC THEN GEN_TAC THEN STRIP_TAC THEN MRESA_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(u:real^3)`;`(y:real^3)`] THEN MP_TAC(SET_RULE`aff_gt {x} {u, y} = aff_gt {x, u} {y} INTER aff_gt {x, y} {u} /\ x' IN aff_gt {x} {u, y:real^3} ==> x' IN aff_gt {x,u} {y}`) THEN RESA_TAC THEN MRESA_TAC aff_gt_imp_not_collinear[`x:real^3`;`y:real^3`;`u:real^3`; `x':real^3`] THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`w:real^3`;`x':real^3`;`y:real^3`;] THEN MATCH_MP_TAC conditions_in_rcone_fan THEN EXISTS_TAC`y:real^3` THEN ASM_REWRITE_TAC[]]);;
let in_aff_gt_1_2=
prove(`!x:real^3 v:real^3 u:real^3 t:real. DISJOINT {x} {v,u} /\ &0< t /\ t< &1==> (&1-t)% v+ t% u IN aff_gt {x} {v,u}`,
REPEAT STRIP_TAC THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM;] THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1 - t:real` THEN EXISTS_TAC`t:real` THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1 - t<=> t< &1`;REAL_ARITH`&0 + &1 - t + t= &1`] THEN VECTOR_ARITH_TAC);;
let exists_rw_dart_inter_aff_gt1_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 s:real. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ &0<s /\ s<pi/ &2 /\ fan80(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) ==> (?h:real. &0< h /\ (!t:real. &0< t /\ t< h==> ~(rw_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(sigma_fan x V E u w:real^3)) (cos(s)) INTER aff_gt {x} {v, (&1-t)%u+t%w}={}) ))`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "BE") THEN DISCH_THEN(LABEL_TAC"EM") THEN USE_THEN "BE" MP_TAC THEN REWRITE_TAC[fan80] THEN DISCH_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN DISJ_CASES_TAC(SET_RULE`set_of_edge u V E = {w} \/ ~(set_of_edge u V E = {w:real^3})`) THENL[ MRESA_TAC CARD_SING[`w:real^3`; `(set_of_edge u V E):real^3->bool`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; MRESA_TAC exists_cut_rcone_fan_with_edge_run_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;`u:real^3`;`w:real^3`;`s:real`] THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;INTER;IN_ELIM_THM;] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"OK") THEN DISCH_TAC THEN USE_THEN "OK" MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[rw_dart_fan;] THEN ASM_REWRITE_TAC[INTER; w_dart_fan;wedge;IN_ELIM_THM;] THEN STRIP_TAC THEN EXISTS_TAC`t:real` THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN ABBREV_TAC`vt= (&1 - t':real) % u + t' % w :real^3` THEN ABBREV_TAC`a1=(v-x):real^3` THEN ABBREV_TAC`a2=vt-x:real^3` THEN ABBREV_TAC`a3=(y-x):real^3` THEN ABBREV_TAC`a4=(u-x) :real^3` THEN ABBREV_TAC`va=a1 cross a2:real^3` THEN ABBREV_TAC`vb=a3 cross a4:real^3` THEN ABBREV_TAC`v3=(vb:real^3) cross (va:real^3)+(x:real^3)` THEN MP_TAC(REAL_ARITH`&0< t'/\ t'< t /\ t< &1==> ~(t'= &0) /\ t'< &1`) THEN RESA_TAC THEN MRESA_TAC in_aff_gt_1_2[`x:real^3`;`u:real^3`;`w:real^3 `;`t':real`] THEN MRESA_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(u:real^3)`;`(w:real^3)`] THEN MP_TAC(SET_RULE`aff_gt {x} {u, w} = aff_gt {x, u} {w} INTER aff_gt {x, w} {u} /\ vt IN aff_gt {x} {u, w:real^3} ==> vt IN aff_gt {x,u} {w}`) THEN RESA_TAC THEN MRESA_TAC aff_gt_imp_not_collinear[`x:real^3`;`w:real^3`;`u:real^3`; `vt:real^3`] THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] THEN ASM_REWRITE_TAC[DE_MORGAN_THM] THEN STRIP_TAC THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`v:real^3`;`vt:real^3`;`w:real^3`;] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] THEN RESA_TAC THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`v:real^3`;`vt:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN STRIP_TAC THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`y:real^3`;`vt:real^3`;`w:real^3`;] THEN MP_TAC(REAL_ARITH`&0< azim x u w y /\ azim x u w y< azim x u w v /\ azim x u w v< pi==> azim x u w y<= azim x u w v/\ ~(azim x u w y = &0 \/ azim x u w y= pi)`) THEN RESA_TAC THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`] THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] THEN ASM_REWRITE_TAC[DE_MORGAN_THM] THEN STRIP_TAC THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`y:real^3`;`w:real^3`] THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`y:real^3`;`vt:real^3`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN STRIP_TAC THEN MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `t':real`) THEN MRESA_TAC cut_in_angle_fan[`x:real^3`;`v:real^3`;`u:real^3`;`vt:real^3`;`y:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN RESA_TAC THEN MRESA_TAC aff_gt_in_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`y:real^3`;`s:real`] THEN EXISTS_TAC`v3:real^3` THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(SET_RULE`aff_gt {x} {u, y} SUBSET rw_dart_fan x V E (x,u,w,v) (cos s) /\ v3 IN aff_gt {x} {u, y} ==> v3 IN rw_dart_fan x V E (x,u,w,v) (cos s)`) THEN ASM_REWRITE_TAC[] THEN MRESA_TAC cut_in_angle_fan[`x:real^3`;`y:real^3`;`v:real^3`;`u:real^3`;`vt:real^3`] THEN POP_ASSUM MP_TAC THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[CROSS_SKEW] THEN ASM_REWRITE_TAC[CROSS_LNEG;CROSS_RNEG] THEN ONCE_REWRITE_TAC[GSYM CROSS_RNEG] THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] THEN RESA_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN POP_ASSUM MATCH_MP_TAC THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`;`v:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"NHO EM") THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v/\ &0< azim x u w y/\ azim x u w v < pi /\ azim x u w v = azim x u w y + azim x u y v==> ~(azim x u y (v:real^3)= &0 \/ azim x u y (v:real^3)= pi)`) THEN RESA_TAC THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN RESA_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] THEN ASM_REWRITE_TAC[] THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`u:real^3`;`v:real^3`;`y:real^3`] THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN ASM_REWRITE_TAC[DE_MORGAN_THM] THEN STRIP_TAC THEN MP_TAC(REAL_ARITH`&0<=azim x v u y /\ ~(azim x v u y= &0)==> &0< azim x v u y`) THEN ASM_REWRITE_TAC[azim] THEN RESA_TAC THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`vt:real^3`] THEN MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`vt:real^3`][DE_MORGAN_THM] THEN MP_TAC(REAL_ARITH`&0<=azim x v u vt /\ ~(azim x v u vt= &0)==> &0< azim x v u vt`) THEN ASM_REWRITE_TAC[azim] THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0<t==> ~(t= &0)`) THEN RESA_TAC THEN MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `t:real`) THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`(&1-t) %u+ t%w:real^3`] THEN MRESA_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(v:real^3)`;`((&1-t) %u+ t%w:real^3)`] THEN MP_TAC(SET_RULE`aff_gt {x} {v, (&1-t) %u+ t%w} = aff_gt {x, v} {(&1-t) %u+ t%w} INTER aff_gt {x, (&1-t) %u+ t%w} {v} /\ y IN aff_gt {x} {v, (&1-t) %u+ t%w:real^3} ==> y IN aff_gt {x,v} {(&1-t) %u+ t%w}`) THEN RESA_TAC THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`;`(&1-t) %u+ t%w:real^3`;] THEN MRESA_TAC inequality4_aim_in_convex_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`t:real`] THEN MRESA_TAC angle_is_smallpi_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MP_TAC(REAL_ARITH`azim x v u w< pi /\ azim x v u ((&1 - t) % u + t % w) < azim x v u w ==> azim x v u ((&1 - t) % u + t % w) < pi`) THEN RESA_TAC THEN ABBREV_TAC`vs= (&1 - t:real) % u + t % w :real^3` THEN MRESA_TAC in_aff_gt_1_2[`x:real^3`;`u:real^3`;`w:real^3 `;`t:real`] THEN MP_TAC(SET_RULE`aff_gt {x} {u, w} = aff_gt {x, u} {w} INTER aff_gt {x, w} {u} /\ vs IN aff_gt {x} {u, w:real^3} ==> vs IN aff_gt {x,u} {w}`) THEN RESA_TAC THEN MRESA1_TAC REAL_MUL_LINV`t:real` THEN MRESA1_TAC REAL_LT_INV`t:real` THEN MRESA_TAC REAL_LT_MUL[`inv t:real`;`t':real`] THEN MRESA_TAC REAL_LT_LMUL[`inv t:real`;`t':real`;`t:real`] THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`v:real^3`;`vs:real^3`;`w:real^3`;] THEN REMOVE_THEN"NHO EM" MP_TAC THEN DISCH_TAC THEN REMOVE_ASSUM_TAC THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`v:real^3`;`vs:real^3`] THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] THEN MRESA_TAC inequality4_aim_in_convex_fan[`x:real^3`;`v:real^3`;`u:real^3`;`vs:real^3`;`inv (t) * t':real`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM(th)]) THEN STRIP_TAC THEN MATCH_MP_TAC(SET_RULE`azim x v u ((&1 - inv t * t') % u + (inv t * t') % vs) < azim x v u vs /\ (&1 - inv t * t') % u + (inv t * t') % vs = vt ==> azim x v u vt < azim x v u vs`) THEN ASM_REWRITE_TAC[] THEN EXPAND_TAC"vs" THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - inv t * t') % u + (inv t * t') % ((&1 - t) % u + t % w) = (&1 - (inv t * t) * t') % u + ((inv t * t) *t') % w`;REAL_ARITH`&1* A=A`]]);;
let there_exists_component_contain_aff_gt_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ fan80(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) ==> (?h:real. &0< h /\ (?y:real^3. aff_gt {x} {v, (&1-h)%u+h%w} SUBSET connected_component (yfan(x,V,E)) y ))`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "BE") THEN DISCH_THEN(LABEL_TAC"EM") THEN USE_THEN "BE" MP_TAC THEN REWRITE_TAC[fan80] THEN DISCH_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; ` (v:real^3)`] THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; ` (u:real^3)`] THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) THEN MRESA_TAC fan_run_in_small_is_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM(fun th-> MRESA1_TAC th `h/ &2`) THEN POP_ASSUM MP_TAC THEN MP_TAC(REAL_ARITH`&0< h==> ~(h/ &2 = &0)/\ &0< h/ &2 /\ h/ &2 < h`) THEN RESA_TAC THEN DISCH_TAC THEN EXISTS_TAC`h/ &2 :real` THEN ASM_REWRITE_TAC[] THEN EXISTS_TAC`&1/ &2 % v + &1/ &2 %((&1 - h / &2) % u + h / &2 % w:real^3)` THEN MATCH_MP_TAC CONNECTED_COMPONENT_MAXIMAL THEN ASM_REWRITE_TAC[] THEN MRESA_TAC CONVEX_AFF_GT[`{x:real^3}`;`{v, (&1 - h / &2) % u + h / &2 % w:real^3}`] THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `h/ &2:real`) THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`(&1-h/ &2) %u+ h / &2 %w:real^3`] THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - h/ &2) % (u:real^3) + h / &2 % (w:real^3)`;] THEN MRESAL_TAC in_aff_gt_1_2[`x:real^3`;`v:real^3`;`(&1 - h / &2) % u + h / &2 % w:real^3 `;`&1/ &2:real`] [REAL_ARITH`&1/ &2 < &1 /\ &0< &1/ &2 `; REAL_ARITH`&1 - &1/ &2 = &1/ &2` ] THEN MATCH_MP_TAC CONVEX_CONNECTED THEN ASM_REWRITE_TAC[]);;
let CONNECTED_COMPONENT_OF_SUBSET = 
prove (`!s t x y. s SUBSET t /\ connected_component s x y ==> connected_component t x y`,
REWRITE_TAC[connected_component] THEN SET_TAC[]);;
let connected_component_of_faces_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ sigma_fan x V E u w = v /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) ==> dart_leads_into x V E v u = dart_leads_into x V E u w`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "BE") THEN DISCH_THEN(LABEL_TAC"con") THEN USE_THEN "con" MP_TAC THEN REWRITE_TAC[fan80] THEN DISCH_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) THEN MRESA_TAC exists_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"ANH") THEN MRESA_TAC exists_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;` w:real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"YEU") THEN ABBREV_TAC`h00= min h' (pi/ &2) / &2 :real` THEN MP_TAC(REAL_ARITH`&0< h' /\ &0< pi /\ h00= min h' (pi/ &2) / &2 :real==> &0< h00 /\ h00 < pi / &2`) THEN REWRITE_TAC[PI_WORKS] THEN RESA_TAC THEN MRESA_TAC exists_rw_dart_inter_aff_gt1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`;`h00:real`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] THEN DISCH_THEN (LABEL_TAC"EM") THEN MRESA_TAC exists_rw_dart_inter_aff_gt_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] THEN DISCH_THEN (LABEL_TAC"NHIEU") THEN MRESA_TAC fan_run_in_small_is_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"HA") THEN ABBREV_TAC`h1' = min h'' h''' / &2 :real` THEN ABBREV_TAC`h1= min h1' h'''' / &2 :real` THEN MP_TAC(REAL_ARITH`&0< h'' /\ &0 < h''' /\ h1'= min h'' h''' / &2 ==> &0< h1' /\ h1'< h'' /\ h1' < h'''`) THEN RESA_TAC THEN MP_TAC(REAL_ARITH`&0< h1'/\ h1'< h'' /\ h1' < h''' /\ &0 < h'''' /\ h1= min h1' h'''' / &2 ==> &0< h1 /\ h1< h'' /\ h1 < h''' /\ h1< h''''`) THEN RESA_TAC THEN ABBREV_TAC`h2= min h (pi/ &2) / &2 :real` THEN MP_TAC(REAL_ARITH`&0< h /\ &0< pi /\ h2= min h (pi/ &2) / &2 :real==> &0< h2 /\ h2 < pi / &2`) THEN REWRITE_TAC[PI_WORKS] THEN RESA_TAC THEN REMOVE_THEN "NHIEU" (fun th-> MRESAL1_TAC th `h1:real`[INTER;IN_ELIM_THM]) THEN POP_ASSUM (fun th-> MRESA1_TAC th `h2:real`) THEN MP_TAC(REAL_ARITH`&0< h2 /\ h2= min h (pi/ &2) / &2 :real==> h2 < h`) THEN RESA_TAC THEN USE_THEN "ANH" (fun th -> MP_TAC(ISPECL[`h2:real`;`y:real^3`]th)) THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"LAM") THEN REMOVE_THEN "EM" (fun th-> MRESAL1_TAC th `h1:real`[INTER;IN_ELIM_THM]) THEN MP_TAC(REAL_ARITH`&0< h00 /\ h00= min h' (pi/ &2) / &2 :real==> h00 < h'`) THEN RESA_TAC THEN USE_THEN "YEU" (fun th -> MP_TAC(ISPECL[`h00:real`;`y':real^3`]th)) THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN RESA_TAC THEN SUBGOAL_THEN `U=U':real^3->bool` ASSUME_TAC THENL[ REMOVE_THEN "LAM" (fun th-> REWRITE_TAC[SYM(th)]) THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN REWRITE_TAC[CONNECTED_COMPONENT_EQ_EQ] THEN MRESA_TAC CONVEX_AFF_GT[`{x:real^3}`;`{v, (&1 - h1) % u + h1 % w:real^3}`] THEN MRESA_TAC CONVEX_CONNECTED[`aff_gt {x} {v, (&1 - h1) % u + h1 % w}:real^3->bool`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[CONNECTED_IFF_CONNECTED_COMPONENT] THEN DISCH_TAC THEN POP_ASSUM (fun th-> MRESA_TAC th [`y:real^3`;`y':real^3`]) THEN REMOVE_THEN "HA" (fun th-> MRESA1_TAC th `h1:real`) THEN MRESA_TAC CONNECTED_COMPONENT_OF_SUBSET[`aff_gt {x} {v, (&1 - h1) % u + h1 % w:real^3}:real^3-> bool`;`yfan (x:real^3,(V:real^3->bool),(E:(real^3->bool)->bool)):real^3->bool`;`y:real^3`;`y':real^3`] THEN ASM_TAC THEN SET_TAC[]; SUBGOAL_THEN`dart_leads_into x V E v u= U:real^3->bool` ASSUME_TAC THENL[ REMOVE_ASSUM_TAC THEN MATCH_MP_TAC unique_dart_leads_into THEN ASM_REWRITE_TAC[] THEN EXISTS_TAC`h:real` THEN ASM_REWRITE_TAC[]; SUBGOAL_THEN`dart_leads_into x V E u w= U':real^3->bool` ASSUME_TAC THENL[ MATCH_MP_TAC unique_dart_leads_into THEN ASM_REWRITE_TAC[] THEN EXISTS_TAC`h':real` THEN ASM_REWRITE_TAC[]; ASM_REWRITE_TAC[]]]]);;
(************************)
let dart_leads_into1 = new_definition 
    `dart_leads_into1 (x,V,E) (v,u) = @s.  s IN topological_component_yfan (x,V,E) /\
	(?eps. (eps < &1) /\ 
	   rw_dart_fan x V E (x,v,u,sigma_fan x V E v u) eps  SUBSET s)`;;
let dartset_leads_into = new_definition
  `dartset_leads_into (x,V,E) ds = 
    @s. (!y. (y IN ds) ==> (s = dart_leads_into1 (x,V,E) y))`;;
let exists_dartset_leads_into_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. FAN(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ ds IN face_set(hypermap1_of_fanx (x,V,E)) ==> ?s:real^3->bool. !y. y IN ds==> s= dart_leads_into x V E (pr2 y) (pr3 y)`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] THEN ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC`dart_leads_into x V E (pr2 x') (pr3 x'):real^3->bool` THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISJ_CASES_TAC(SET_RULE`~(x' IN d1_fan (x,V,E) )\/ (x' IN d1_fan (x:real^3,V,E))`) THENL[MRESA_TAC id_power_enf_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`x':real^3#real^3#real^3#real^3` ;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; SPEC_TAC (`y:real^3#real^3#real^3#real^3`,`y:real^3#real^3#real^3#real^3`) THEN SPEC_TAC (`n:num`,`n:num`) THEN INDUCT_TAC THENL[ REWRITE_TAC[POWER_0;I_THM] THEN SET_TAC[]; POP_ASSUM MP_TAC THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3` ) THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3` ) THEN ABBREV_TAC`y1=(f1_fan x V E POWER n) (x':real^3#real^3#real^3#real^3)` THEN DISCH_THEN(LABEL_TAC "EM") THEN ASM_REWRITE_TAC[COM_POWER;o_DEF] THEN POP_ASSUM (fun th-> MRESAL1_TAC th`y1:real^3#real^3#real^3#real^3`[ARITH_RULE`(n:num)>= 0`]) THEN REPEAT STRIP_TAC THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`n:num`] THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3`) THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3`; `y1:real^3#real^3#real^3#real^3`] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") THEN REPEAT STRIP_TAC THEN ABBREV_TAC`u=pr2 (f1_fan x V E y1):real^3` THEN ABBREV_TAC`w=pr3 (f1_fan x V E y1):real^3` THEN ABBREV_TAC`v=sigma_fan x V E u w:real^3` THEN REMOVE_THEN "EM" MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN MRESA_TAC connected_component_of_faces_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`]]]);;
let dartset_leads_into_fan = new_definition
  `dartset_leads_into_fan x V E ds = 
    @s. (!y. (y IN ds) ==> (s = dart_leads_into x V E (pr2 y) (pr3 y)))`;;
let DARTSET_LEADS_INTO_FAN=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. FAN(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ ds IN face_set(hypermap1_of_fanx (x,V,E)) ==> (!y. y IN ds==> dartset_leads_into_fan x V E ds= dart_leads_into x V E (pr2 y) (pr3 y))`,
REPEAT GEN_TAC THEN STRIP_TAC THEN ONCE_REWRITE_TAC[dartset_leads_into_fan] THEN MRESA_TAC exists_dartset_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `ds:real^3#real^3#real^3#real^3->bool`] THEN SELECT_ELIM_TAC THEN EXISTS_TAC`s:real^3->bool` THEN ASM_REWRITE_TAC[]);;
let UNIQUE_DARTSET_LEADS_INTO_FAN=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds s. FAN(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ (!y. y IN ds==> s= dart_leads_into x V E (pr2 y) (pr3 y)) ==> dartset_leads_into_fan x V E ds= s`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN MRESA_TAC FACE_FAN_NOT_EMPTY[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `ds:real^3#real^3#real^3#real^3->bool`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] THEN STRIP_TAC THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `ds:real^3#real^3#real^3#real^3->bool`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) THEN DISCH_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`));;
let equality_dart_leads_into=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y y1. FAN(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ y IN ds /\ y1 IN ds ==>dart_leads_into x V E (pr2 y) (pr3 y)= dart_leads_into x V E (pr2 y1) (pr3 y1)`,
REPEAT STRIP_TAC THEN MRESA_TAC exists_dartset_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `ds:real^3#real^3#real^3#real^3->bool`] THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3` THEN ASSUME_TAC(th)) THEN POP_ASSUM (fun th-> MRESA1_TAC th `y1:real^3#real^3#real^3#real^3`));;
let UNIQUE_DARTSET_LEADS_INTO1_FAN=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds s y. FAN(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ y IN ds /\ s= dart_leads_into x V E (pr2 y) (pr3 y) ==> dartset_leads_into_fan x V E ds= s`,
REPEAT STRIP_TAC THEN SUBGOAL_THEN`(!y. y IN ds==> s= dart_leads_into (x:real^3) V E (pr2 y) (pr3 y))` ASSUME_TAC THENL[REPEAT STRIP_TAC THEN MRESA_TAC equality_dart_leads_into[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `ds:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`;`y':real^3#real^3#real^3#real^3`]; MRESA_TAC UNIQUE_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `ds:real^3#real^3#real^3#real^3->bool`;`s:real^3->bool`]]);;
let exists_point_dart_leads_into_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. FAN(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ ds IN face_set(hypermap1_of_fanx (x,V,E)) ==> ?y. y IN ds /\ dartset_leads_into_fan x V E ds =dart_leads_into x V E (pr2 y) (pr3 y)`,
REPEAT STRIP_TAC THEN MRESA_TAC FACE_FAN_NOT_EMPTY[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `ds:real^3#real^3#real^3#real^3->bool`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] THEN STRIP_TAC THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` THEN ASM_REWRITE_TAC[] THEN MRESA_TAC UNIQUE_DARTSET_LEADS_INTO1_FAN [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `ds:real^3#real^3#real^3#real^3->bool`;`(dart_leads_into x V E (pr2 y) (pr3 y)):real^3->bool`;`y:real^3#real^3#real^3#real^3`]);;
let dartset_leads_into_is_topological_component_yfan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. FAN(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ ds IN face_set(hypermap1_of_fanx (x,V,E)) ==> dartset_leads_into_fan x V E ds IN topological_component_yfan (x,V,E)`,
REPEAT STRIP_TAC THEN MRESA_TAC exists_point_dart_leads_into_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `ds:real^3#real^3#real^3#real^3->bool`;] THEN MRESA_TAC properties_of_elements_in_face_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] THEN MRESA_TAC dart_leads_into_fan_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`pr2(y):real^3`; `pr3(y):real^3`]);;
let dartset_leads_into_subset_yfan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds:real^3#real^3#real^3#real^3->bool. FAN(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ ds IN face_set(hypermap1_of_fanx (x,V,E)) ==> dartset_leads_into_fan x V E ds SUBSET yfan (x,V,E)`,
REPEAT STRIP_TAC THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] THEN STRIP_TAC THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_SUBSET]);;
let RWXUYZZ=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds:real^3#real^3#real^3#real^3->bool. FAN(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ ds IN face_set(hypermap1_of_fanx (x,V,E)) ==> (?s:real^3->bool. !y. y IN ds==> s= dart_leads_into x V E (pr2 y) (pr3 y)) /\ dartset_leads_into_fan x V E ds IN topological_component_yfan (x,V,E)`,
(************DWWUTKW*********)
let add_edge_graph_fan=
prove(`!(V:A->bool) (E:(A->bool)->bool) v:A u:A. v IN V /\ u IN V /\ E1=E UNION {{v,u}} /\ UNIONS E SUBSET V==> UNIONS E1 SUBSET V`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[UNIONS; SUBSET; UNION; IN_ELIM_THM;IN_SING] THEN DISCH_THEN(LABEL_TAC "YEU") THEN REPEAT STRIP_TAC THENL[SUBGOAL_THEN`(?u. u IN E /\ x IN (u:A->bool))`ASSUME_TAC THENL[ EXISTS_TAC`u':A->bool` THEN ASM_REWRITE_TAC[]; REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th `x:A`)]; ASM_TAC THEN SET_TAC[]]);;
let garph_add_edge_is_garph=
prove(`!(V:A->bool) (E:(A->bool)->bool) v:A u:A. E1=E UNION {{v,u}} /\ ~(v=u) /\ graph E==> graph E1`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[GRAPH; UNION;IN_ELIM_THM;IN_SING] THEN DISCH_THEN(LABEL_TAC"YEU") THEN GEN_TAC THEN STRIP_TAC THENL[REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th `e:A->bool`); ASM_REWRITE_TAC[HAS_SIZE] THEN STRIP_TAC THEN MRESA_TAC CARD_2_FAN[`v:A`;`u:A`] THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; IN_INSERT; NOT_IN_EMPTY]]);;
let add_edge_into_collinear_fan=
prove(`!x:real^3 (E:(real^3->bool)->bool) v:real^3 u:real^3. ~collinear {x,v,u} /\ (!e. e IN E ==> ~collinear ({x} UNION e)) ==> (!e. e IN E UNION {{v, u}} ==> ~collinear ({x} UNION e))`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV)[UNION;] THEN REWRITE_TAC[IN_ELIM_THM;IN_SING] THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"YEU") THEN STRIP_TAC THENL[REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th `e:real^3->bool`); ASM_REWRITE_TAC[SET_RULE`{X} UNION {A,B}={X,A,B}`]]);;
let condition_not_edge_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 ds. FAN(x,V,E) /\ v IN V /\ u IN V /\ ~collinear {x,v,u} /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ e1 IN E /\ e2 = {v, u} /\ aff_gt {x} {v,u} SUBSET dartset_leads_into_fan x V E ds ==> ~(e1=e2)`,
REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") THEN STRIP_TAC THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (u:real^3)`] THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds:real^3#real^3#real^3#real^3->bool`] THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E ds SUBSET yfan (x,V,E)/\ aff_gt {x} {v, u} SUBSET dartset_leads_into_fan x V E ds==> aff_gt {x} {v, u} SUBSET yfan (x:real^3,V,E)`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[yfan; SET_RULE`A SUBSET (:real^3) DIFF B <=> A INTER B={}`;] THEN DISCH_TAC THEN SUBGOAL_THEN`aff_ge {x} e1 SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC THENL[REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN EXISTS_TAC `e1:real^3->bool` THEN ASM_REWRITE_TAC[] THEN FIND_ASSUM MP_TAC(`(e1:real^3->bool) IN E`) THEN REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]; ASSUME_TAC(SET_RULE`aff_gt {x} {v, u} INTER (aff_gt {x} {v, u} UNION aff_ge {x} {v} UNION aff_ge {x} {u}) =aff_gt {x} {v, u} `) THEN MP_TAC(SET_RULE`aff_gt {x:real^3} {v, u} INTER xfan (x,V:real^3->bool,E) = {}/\aff_ge {x} e1 SUBSET xfan (x,V,E) ==> aff_gt {x} {v, u} INTER aff_ge {x} e1={}`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] THEN MATCH_MP_TAC exists_in_aff_gt THEN ASM_REWRITE_TAC[]]);;
let properties_edges_eq_fan=
prove(`!e:A-> bool v:A u:A. FINITE e /\ ~(e={v,u}) /\ ~(v=u) /\ CARD e=2 ==> ~(v IN e)\/ ~(u IN e)`,
REPEAT GEN_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "YEU") THEN ONCE_REWRITE_TAC[SET_RULE`~A \/ ~B<=> ~(A/\B)`] THEN STRIP_TAC THEN MP_TAC(SET_RULE`v IN e /\ u IN e ==> {v:A,u} SUBSET e`) THEN RESA_TAC THEN MRESA_TAC CARD_2_FAN[`v:A`;`u:A`] THEN REMOVE_THEN "YEU" MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) THEN STRIP_TAC THEN MRESA_TAC CARD_SUBSET_EQ[`{v,u:A}`;`e:A->bool`]);;
let condition_not_intersection_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 ds e1:real^3->bool e2:real^3->bool. FAN(x,V,E) /\ v IN V /\ u IN V /\ ~collinear {x,v,u} /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ aff_gt {x} {v,u} SUBSET dartset_leads_into_fan x V E ds /\ e1 IN E /\ e2 = {v, u} ==>aff_ge {x} e1 INTER aff_ge {x} e2 = aff_ge {x} (e1 INTER e2)`,
REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (u:real^3)`] THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds:real^3#real^3#real^3#real^3->bool`] THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E ds SUBSET yfan (x,V,E)/\ aff_gt {x} {v, u} SUBSET dartset_leads_into_fan x V E ds==> aff_gt {x} {v, u} SUBSET yfan (x:real^3,V,E)`) THEN RESA_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[yfan; SET_RULE`A SUBSET (:real^3) DIFF B <=> A INTER B={}`;] THEN DISCH_TAC THEN SUBGOAL_THEN`aff_ge {x} e1 SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC THENL[ REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN EXISTS_TAC `e1:real^3->bool` THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN SET_TAC[IN]; MP_TAC(SET_RULE`aff_gt {x:real^3} {v, u} INTER xfan (x,V:real^3->bool,E) = {}/\aff_ge {x} e1 SUBSET xfan (x,V,E) ==> aff_gt {x} {v, u} INTER aff_ge {x} e1={}`) THEN RESA_TAC THEN MP_TAC(SET_RULE` aff_gt {x:real^3} {v, u} INTER aff_ge {x} e1={}==> aff_ge {x} e1 INTER (aff_gt {x} {v, u} UNION aff_ge {x} {v} UNION aff_ge {x} {u}) = (aff_ge {x} e1 INTER aff_ge {x} {v}) UNION (aff_ge {x} e1 INTER aff_ge {x} {u})`) THEN RESA_TAC THEN MP_TAC(SET_RULE`e1 IN E==> e1 IN E UNION {{v:real^3} | v IN V}`) THEN RESA_TAC THEN MP_TAC(SET_RULE`v:real^3 IN V==> {v} IN E UNION {{v} | v IN V}`) THEN RESA_TAC THEN MP_TAC(SET_RULE`u:real^3 IN V==> {u} IN E UNION {{v} | v IN V}`) THEN RESA_TAC THEN FIND_ASSUM MP_TAC(`FAN(x:real^3,V,E)`) THEN REWRITE_TAC[FAN;fan7] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MRESA_TAC th [`e1:real^3->bool`;`{v:real^3}`]THEN ASSUME_TAC th) THEN POP_ASSUM(fun th-> MRESA_TAC th [`e1:real^3->bool`;`{u:real^3}`]) THEN MRESA_TAC condition_not_edge_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`ds:real^3#real^3#real^3#real^3->bool`] THEN FIND_ASSUM MP_TAC (`graph (E:(real^3->bool)->bool)`) THEN REWRITE_TAC[GRAPH] THEN STRIP_TAC THEN POP_ASSUM (fun th-> MRESAL1_TAC th `e1:real^3->bool`[HAS_SIZE]) THEN MRESA_TAC th3[`v:real^3`;`u:real^3`;`x:real^3`] THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] THEN RESA_TAC THEN MRESA_TAC properties_edges_eq_fan[`e1:real^3->bool`; `v:real^3`;`u:real^3`] THENL[MP_TAC(SET_RULE`~(v IN e1)==> e1 INTER {v:real^3}={} /\ e1 INTER {v, u}=e1 INTER {u}`) THEN RESA_TAC THEN ASSUME_TAC(SET_RULE`{} SUBSET e1 INTER {u}:real^3->bool`) THEN MP_TAC(SET_RULE`DISJOINT {v, u} {x:real^3}==> DISJOINT {x} (e1 INTER {u})`) THEN RESA_TAC THEN MRESA_TAC AFF_GE_MONO_RIGHT[`{x:real^3}`;`{}:real^3->bool`;`e1 INTER {u}:real^3->bool`] THEN POP_ASSUM MP_TAC THEN SET_TAC[]; MP_TAC(SET_RULE`~(u IN e1)==> e1 INTER {u:real^3}={} /\ e1 INTER {v, u}=e1 INTER {v}`) THEN RESA_TAC THEN ASSUME_TAC(SET_RULE`{} SUBSET e1 INTER {v}:real^3->bool`) THEN MP_TAC(SET_RULE`DISJOINT {v, u} {x:real^3}==> DISJOINT {x} (e1 INTER {v})`) THEN RESA_TAC THEN MRESA_TAC AFF_GE_MONO_RIGHT[`{x:real^3}`;`{}:real^3->bool`;`e1 INTER {v}:real^3->bool`] THEN POP_ASSUM MP_TAC THEN SET_TAC[]]]);;
let exists_edge_fully_surround_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) w:real^3. FAN(x,V,E) /\ w IN V /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) ==> ?v. {w,v} IN E /\ v IN V`,
REPEAT STRIP_TAC THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`) THEN SUBGOAL_THEN`~(set_of_edge (w:real^3) V E={})`ASSUME_TAC THENL[ POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "YEU") THEN STRIP_TAC THEN REMOVE_THEN "YEU" MP_TAC THEN ASM_REWRITE_TAC[CARD_CLAUSES] THEN ARITH_TAC; POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`; set_of_edge;IN_ELIM_THM]]);;
let condition_not_intersection_point_fan=
prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 ds:real^3#real^3#real^3#real^3->bool e1:real^3->bool w:real^3. FAN(x,V,E) /\ v IN V /\ u IN V /\ ~collinear {x,v,u} /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ fan80(x,V,E) /\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ aff_gt {x} {v,u} SUBSET dartset_leads_into_fan x V E ds /\ w IN V /\ e1 = {v, u} ==>aff_ge {x} e1 INTER aff_ge {x} {w} = aff_ge {x} (e1 INTER {w})`,
REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (u:rea